@@ -18,11 +18,13 @@ import {
1818 NetPyNEField ,
1919 NetPyNECoordsRange ,
2020 NetPyNESelectField ,
21+ NetPyNETextField ,
2122} from 'netpyne/components' ;
2223import Utils from '../../../Utils' ;
2324import Checkbox from '../../general/Checkbox' ;
2425import { vars } from '../../../theme' ;
2526import { BASE_PATH } from '../../general/NetPyNEIcons' ;
27+ import { evalPythonMessage , execPythonMessage } from '../../general/GeppettoJupyterUtils' ;
2628
2729const styles = ( { spacing } ) => ( {
2830 fields : {
@@ -50,6 +52,9 @@ class NetPyNEPopulation extends React.Component {
5052 pulses : [ {
5153 ...newPulseObject ,
5254 } ] ,
55+ // cellModel: undefined,
56+ cellModel : "VecStim" ,
57+ patternType : undefined ,
5358 } ;
5459 }
5560
@@ -185,7 +190,170 @@ class NetPyNEPopulation extends React.Component {
185190 pulses : [ ...prevState . pulses , { ...newPulseObject } ] , // Push the new object into the 'pulses' array
186191 } ) ) ;
187192 } ;
188-
193+
194+ changeCellModel = ( newValue ) => {
195+ this . setState ( ( prevState ) => ( {
196+ ...prevState ,
197+ cellModel : newValue
198+ } ) )
199+ }
200+
201+ changeCellPattern = ( newValue ) => {
202+ if ( ! newValue ) {
203+ execPythonMessage ( `del netpyne_geppetto.netParams.popParams['${ this . props . name } ']['spikePattern']` )
204+ }
205+ else {
206+ execPythonMessage ( `netpyne_geppetto.netParams.popParams['${ this . props . name } ']['spikePattern'] = {}
207+ netpyne_geppetto.netParams.popParams['${ this . props . name } ']['spikePattern']['type'] = '${ newValue } '` )
208+ }
209+ this . setState ( ( prevState ) => ( {
210+ ...prevState ,
211+ patternType : newValue
212+ } ) )
213+ }
214+
215+ cellStimulationLayout = ( ) => {
216+ if ( ! [ "VecStim" , "NetStim" ] . includes ( this . state . cellModel ) ) {
217+ return < > </ >
218+ }
219+ return < >
220+ < NetPyNEField id = "netParams.popParams.seed" >
221+ < NetPyNETextField
222+ fullWidth
223+ variant = "filled"
224+ model = { `netParams.popParams['${ this . props . name } ']['seed']` }
225+ />
226+ </ NetPyNEField >
227+ < Box display = 'flex' alignItems = 'flex-start' style = { { gap : '1rem' } } >
228+ < Typography style = { {
229+ color : experimentLabelColor , flexShrink : 0 , padding : '18.5px 0 18.5px 10px' , fontSize : '0.875rem' , lineHeight : '130%' , fontWeight : 400
230+ } }
231+ >
232+ Spiking Pulse / Rate
233+ </ Typography >
234+ < Box display = 'flex' flexDirection = 'column' style = { { gap : '0.5rem' } } >
235+ { this . state . pulses . map ( ( pulse , index ) => ( < Grid container alignItems = 'center' spacing = { 1 } key = { `pulse_${ index } ` } >
236+ < Grid item xs = { 4 } >
237+ < TextField
238+ variant = "filled"
239+ fullWidth
240+ onChange = { this . handleRenameChange }
241+ value = { pulse . start }
242+ disabled = { this . renaming }
243+ label = "Start"
244+ />
245+ </ Grid >
246+ < Grid item xs = { 4 } >
247+ < TextField
248+ variant = "filled"
249+ fullWidth
250+ onChange = { this . handleRenameChange }
251+ value = { pulse . end }
252+ disabled = { this . renaming }
253+ label = "End"
254+ />
255+ </ Grid >
256+ < Grid item xs = { 4 } >
257+ < TextField
258+ variant = "filled"
259+ fullWidth
260+ onChange = { this . handleRenameChange }
261+ value = { pulse . noise }
262+ disabled = { this . renaming }
263+ label = "Noise"
264+ />
265+ </ Grid >
266+ </ Grid > ) ) }
267+ </ Box >
268+ </ Box >
269+
270+ < Box pl = { 1.25 } >
271+ < Button
272+ className = 'noHover'
273+ disableRipple
274+ style = { { color : primaryColor , padding : 0 , textTransform : 'uppercase' , fontSize : '0.75rem' , letterSpacing : '0.01rem' , lineHeight : '200%' } }
275+ variant = 'text'
276+ onClick = { ( ) => this . addAnotherPulse ( ) }
277+ > + add another pulse</ Button >
278+ </ Box >
279+
280+ < TextField
281+ variant = "filled"
282+ fullWidth
283+ onChange = { this . handleRenameChange }
284+ value = { this . state . currentName }
285+ disabled = { this . renaming }
286+ label = "Spike intervals (ms)"
287+ />
288+
289+ < NetPyNEField mb = { 0 } id = "netParams.popParams.interval" >
290+ < NetPyNETextField
291+ fullWidth
292+ variant = "filled"
293+ model = { `netParams.popParams['${ this . props . name } ']['interval']` }
294+ />
295+ </ NetPyNEField >
296+
297+
298+ { /* <NetPyNEField mb={0} id="netParams.importCellParams.importSynMechs">
299+ <Checkbox
300+ fullWidth
301+ noBackground
302+ />
303+ </NetPyNEField> */ }
304+
305+
306+ < NetPyNEField mb = { 0 } id = "netParams.popParams.spikePattern" >
307+ < NetPyNESelectField
308+ style = { { mb : 0 } }
309+ value = { this . state . patternType }
310+ method = "netpyne_geppetto.getAvailableStimulationPattern"
311+ model = {
312+ `netParams.popParams['${ this . props . name } ']['spikePattern']['type']`
313+ }
314+ // pythonParams={[this.props.name]}
315+ postProcessItems = { this . postProcessMenuItems }
316+ postHandleChange = { this . changeCellPattern }
317+ />
318+ </ NetPyNEField >
319+
320+ < Box display = 'flex' alignItems = 'center' style = { { gap : '1rem' } } >
321+ < Typography style = { { color : experimentLabelColor , fontSize : '0.875rem' , paddingLeft : '0.625rem' , lineHeight : '130%' , fontWeight : 400 } } > Start</ Typography >
322+ < Grid container alignItems = 'center' spacing = { 1 } >
323+ < Grid item xs = { 6 } >
324+ < NetPyNEField mb = { 0 } id = "netParams.popParams.spikePattern.rhythmic.start" >
325+ < NetPyNETextField
326+ fullWidth
327+ variant = "filled"
328+ model = { `netParams.popParams['${ this . props . name } ']['interval']` }
329+ />
330+ </ NetPyNEField >
331+ </ Grid >
332+ < Grid item xs = { 3 } >
333+ < TextField
334+ variant = "filled"
335+ fullWidth
336+ onChange = { this . handleRenameChange }
337+ value = { this . state . currentName }
338+ disabled = { this . renaming }
339+ label = "End"
340+ />
341+ </ Grid >
342+ </ Grid >
343+ </ Box >
344+
345+
346+
347+ < TextField
348+ variant = "filled"
349+ fullWidth
350+ onChange = { this . handleRenameChange }
351+ value = { this . state . currentName }
352+ disabled = { this . renaming }
353+ label = "Frequency (Hz)"
354+ />
355+ </ >
356+ }
189357
190358 render ( ) {
191359
@@ -234,6 +402,7 @@ class NetPyNEPopulation extends React.Component {
234402 < div id = "netParams_popParams_cellType" >
235403 < NetPyNEField id = "netParams.popParams.cellType" >
236404 < NetPyNESelectField
405+ value = ""
237406 method = "netpyne_geppetto.getAvailableCellTypes"
238407 model = {
239408 `netParams.popParams['${ this . props . name } ']['cellType']`
@@ -333,155 +502,18 @@ class NetPyNEPopulation extends React.Component {
333502 </Box>
334503 </Box> */ }
335504 < Box display = 'flex' flexDirection = 'column' style = { { gap : '0.5rem' } } >
336- < NetPyNEField mb = { 0 } id = "netParams.popParams.cellType" >
337- < NetPyNESelectField
338- style = { { mb : 0 } }
339- method = "netpyne_geppetto.getAvailableCellTypes"
340- model = {
341- `netParams.popParams['${ this . props . name } ']['cellType']`
342- }
343- postProcessItems = { this . postProcessMenuItems }
344- />
345- </ NetPyNEField >
346-
347- < TextField
348- variant = "filled"
349- fullWidth
350- onChange = { this . handleRenameChange }
351- value = { this . state . currentName }
352- disabled = { this . renaming }
353- label = "Seed"
354- />
355-
356- < Box display = 'flex' alignItems = 'flex-start' style = { { gap : '1rem' } } >
357- < Typography style = { {
358- color : experimentLabelColor , flexShrink : 0 , padding : '18.5px 0 18.5px 10px' , fontSize : '0.875rem' , lineHeight : '130%' , fontWeight : 400
359- } }
360- >
361- Spiking Pulse / Rate
362- </ Typography >
363- < Box display = 'flex' flexDirection = 'column' style = { { gap : '0.5rem' } } >
364- { this . state . pulses . map ( ( pulse , index ) => ( < Grid container alignItems = 'center' spacing = { 1 } key = { `pulse_${ index } ` } >
365- < Grid item xs = { 4 } >
366- < TextField
367- variant = "filled"
368- fullWidth
369- onChange = { this . handleRenameChange }
370- value = { pulse . start }
371- disabled = { this . renaming }
372- label = "Start"
373- />
374- </ Grid >
375- < Grid item xs = { 4 } >
376- < TextField
377- variant = "filled"
378- fullWidth
379- onChange = { this . handleRenameChange }
380- value = { pulse . end }
381- disabled = { this . renaming }
382- label = "End"
383- />
384- </ Grid >
385- < Grid item xs = { 4 } >
386- < TextField
387- variant = "filled"
388- fullWidth
389- onChange = { this . handleRenameChange }
390- value = { pulse . noise }
391- disabled = { this . renaming }
392- label = "Noise"
393- />
394- </ Grid >
395- </ Grid > ) ) }
396-
397- </ Box >
398- </ Box >
399-
400- < Box pl = { 1.25 } >
401- < Button
402- className = 'noHover'
403- disableRipple
404- style = { { color : primaryColor , padding : 0 , textTransform : 'uppercase' , fontSize : '0.75rem' , letterSpacing : '0.01rem' , lineHeight : '200%' } }
405- variant = 'text'
406- onClick = { ( ) => this . addAnotherPulse ( ) }
407- > + add another pulse</ Button >
408- </ Box >
409-
410- < TextField
411- variant = "filled"
412- fullWidth
413- onChange = { this . handleRenameChange }
414- value = { this . state . currentName }
415- disabled = { this . renaming }
416- label = "Spike intervals (ms)"
417- />
418-
419-
420- < NetPyNEField mb = { 0 } id = "netParams.importCellParams.importSynMechs" >
421- < Checkbox
422- fullWidth
423- noBackground
424- />
425- </ NetPyNEField >
426-
427-
428- < NetPyNEField mb = { 0 } id = "netParams.popParams.cellType" >
505+ < NetPyNEField mb = { 0 } id = "netParams.popParams.cellModel" >
429506 < NetPyNESelectField
430507 style = { { mb : 0 } }
431- method = "netpyne_geppetto.getAvailableCellTypes "
508+ method = "netpyne_geppetto.getAvailableCellModels "
432509 model = {
433- `netParams.popParams['${ this . props . name } ']['cellType ']`
510+ `netParams.popParams['${ this . props . name } ']['cellModel ']`
434511 }
435512 postProcessItems = { this . postProcessMenuItems }
513+ postHandleChange = { this . changeCellModel }
436514 />
437515 </ NetPyNEField >
438-
439- < Box display = 'flex' alignItems = 'center' style = { { gap : '1rem' } } >
440- < Typography style = { { color : experimentLabelColor , fontSize : '0.875rem' , paddingLeft : '0.625rem' , lineHeight : '130%' , fontWeight : 400 } } > Start</ Typography >
441- < Grid container alignItems = 'center' spacing = { 1 } >
442- < Grid item xs = { 6 } >
443- < TextField
444- variant = "filled"
445- fullWidth
446- onChange = { this . handleRenameChange }
447- value = { this . state . currentName }
448- disabled = { this . renaming }
449- label = "Start"
450- />
451- </ Grid >
452- < Grid item xs = { 3 } >
453- < TextField
454- variant = "filled"
455- fullWidth
456- onChange = { this . handleRenameChange }
457- value = { this . state . currentName }
458- disabled = { this . renaming }
459- label = "End"
460- />
461- </ Grid >
462- < Grid item xs = { 3 } >
463- < TextField
464- variant = "filled"
465- fullWidth
466- onChange = { this . handleRenameChange }
467- value = { this . state . currentName }
468- disabled = { this . renaming }
469- label = "Noise"
470- />
471- </ Grid >
472- </ Grid >
473- </ Box >
474-
475-
476-
477- < TextField
478- variant = "filled"
479- fullWidth
480- onChange = { this . handleRenameChange }
481- value = { this . state . currentName }
482- disabled = { this . renaming }
483- label = "Frequency (Hz)"
484- />
516+ { this . cellStimulationLayout ( ) }
485517 </ Box >
486518 { /* <NetPyNECoordsRange
487519 id="xRangePopParams"
0 commit comments