Skip to content

Commit 4a3abe9

Browse files
committed
netpyne-172 Add layouts for all patterns
1 parent e77504f commit 4a3abe9

2 files changed

Lines changed: 177 additions & 33 deletions

File tree

netpyne_ui/netpyne_geppetto.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,9 @@ def getAvailableCellModels(self):
915915
def getAvailableCellModels(self):
916916
return ["", "VecStim", "NetStim", "IntFire1"]
917917

918+
def getAvailableStimulationDistribution(self):
919+
return ["normal", "uniform"]
920+
918921
def getAvailableStimulationPattern(self):
919922
# self.netParams.popParams[name]['spikePattern'] = {}
920923
return ["", "rhythmic", "evoked", "poisson", "gauss"]

webapp/components/definition/populations/NetPyNEPopulation.js

Lines changed: 174 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,179 @@ netpyne_geppetto.netParams.popParams['${this.props.name}']['spikePattern']['type
212212
}))
213213
}
214214

215+
rhythmicLayout = () => {
216+
return <>
217+
<Box display='flex' alignItems='center' style={ { gap: '1rem' } }>
218+
<Typography style={ { color: experimentLabelColor, fontSize: '0.875rem', paddingLeft: '0.625rem', lineHeight: '130%', fontWeight: 400 } }>Start</Typography>
219+
<Grid container alignItems='center' spacing={1}>
220+
<Grid item xs={4}>
221+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.rhythmic.start">
222+
<NetPyNETextField
223+
fullWidth
224+
variant="filled"
225+
model={`netParams.popParams['${this.props.name}']['interval']`} // TODO
226+
/>
227+
</NetPyNEField>
228+
</Grid>
229+
<Grid item xs={4}>
230+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.rhythmic.startMax">
231+
<NetPyNETextField
232+
fullWidth
233+
variant="filled"
234+
model={`netParams.popParams['${this.props.name}']['interval']`} // TODO
235+
/>
236+
</NetPyNEField>
237+
</Grid>
238+
<Grid item xs={4}>
239+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.rhythmic.startStd">
240+
<NetPyNETextField
241+
fullWidth
242+
variant="filled"
243+
model={`netParams.popParams['${this.props.name}']['spikePattern']['startStd']`}
244+
/>
245+
</NetPyNEField>
246+
</Grid>
247+
</Grid>
248+
</Box>
249+
250+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.rhythmic.freq">
251+
<NetPyNETextField
252+
fullWidth
253+
variant="filled"
254+
model={`netParams.popParams['${this.props.name}']['spikePattern']['freq']`}
255+
/>
256+
</NetPyNEField>
257+
258+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.rhythmic.freqStd">
259+
<NetPyNETextField
260+
fullWidth
261+
variant="filled"
262+
model={`netParams.popParams['${this.props.name}']['spikePattern']['freq']`}
263+
/>
264+
</NetPyNEField>
265+
266+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.rhythmic.distribution">
267+
<NetPyNESelectField
268+
style={{mb: 0}}
269+
method="netpyne_geppetto.getAvailableStimulationDistribution"
270+
model={
271+
`netParams.popParams['${this.props.name}']['spikePattern']['distribution']`
272+
}
273+
postProcessItems={this.postProcessMenuItems}
274+
/>
275+
</NetPyNEField>
276+
277+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.rhythmic.eventsPerCycle">
278+
<NetPyNETextField
279+
fullWidth
280+
variant="filled"
281+
model={`netParams.popParams['${this.props.name}']['spikePattern']['eventsPerCycle']`}
282+
/>
283+
</NetPyNEField>
284+
285+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.rhythmic.repeats">
286+
<NetPyNETextField
287+
fullWidth
288+
variant="filled"
289+
model={`netParams.popParams['${this.props.name}']['spikePattern']['repeats']`}
290+
/>
291+
</NetPyNEField>
292+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.rhythmic.stop">
293+
<NetPyNETextField
294+
fullWidth
295+
variant="filled"
296+
model={`netParams.popParams['${this.props.name}']['spikePattern']['stop']`}
297+
/>
298+
</NetPyNEField>
299+
</>
300+
}
301+
302+
evokedLayout = () => {
303+
return <>
304+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.evoked.start">
305+
<NetPyNETextField
306+
fullWidth
307+
variant="filled"
308+
model={`netParams.popParams['${this.props.name}']['spikePattern']['start']`}
309+
/>
310+
</NetPyNEField>
311+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.evoked.inc">
312+
<NetPyNETextField
313+
fullWidth
314+
variant="filled"
315+
model={`netParams.popParams['${this.props.name}']['spikePattern']['inc']`}
316+
/>
317+
</NetPyNEField>
318+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.evoked.startStd">
319+
<NetPyNETextField
320+
fullWidth
321+
variant="filled"
322+
model={`netParams.popParams['${this.props.name}']['spikePattern']['startStd']`}
323+
/>
324+
</NetPyNEField>
325+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.evoked.numspikes">
326+
<NetPyNETextField
327+
fullWidth
328+
variant="filled"
329+
model={`netParams.popParams['${this.props.name}']['spikePattern']['numspikes']`}
330+
/>
331+
</NetPyNEField>
332+
</>
333+
}
334+
335+
poissonLayout = () => {
336+
return <>
337+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.poisson.start">
338+
<NetPyNETextField
339+
fullWidth
340+
variant="filled"
341+
model={`netParams.popParams['${this.props.name}']['spikePattern']['start']`}
342+
/>
343+
</NetPyNEField>
344+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.poisson.stop">
345+
<NetPyNETextField
346+
fullWidth
347+
variant="filled"
348+
model={`netParams.popParams['${this.props.name}']['spikePattern']['stop']`}
349+
/>
350+
</NetPyNEField>
351+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.poisson.frequency">
352+
<NetPyNETextField
353+
fullWidth
354+
variant="filled"
355+
model={`netParams.popParams['${this.props.name}']['spikePattern']['frequency']`}
356+
/>
357+
</NetPyNEField>
358+
</>
359+
}
360+
361+
gaussLayout = () => {
362+
return <>
363+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.gauss.mu">
364+
<NetPyNETextField
365+
fullWidth
366+
variant="filled"
367+
model={`netParams.popParams['${this.props.name}']['spikePattern']['mu']`}
368+
/>
369+
</NetPyNEField>
370+
<NetPyNEField mb={0} id="netParams.popParams.spikePattern.gauss.sigma">
371+
<NetPyNETextField
372+
fullWidth
373+
variant="filled"
374+
model={`netParams.popParams['${this.props.name}']['spikePattern']['sigma']`}
375+
/>
376+
</NetPyNEField>
377+
</>
378+
}
379+
380+
changeStimulationPatternLayout = (pattern) => {
381+
const patternKey = `${pattern}Layout`;
382+
if (!(patternKey in this)) {
383+
return <></>
384+
}
385+
return this[patternKey]()
386+
}
387+
215388
cellStimulationLayout = () => {
216389
if (!["VecStim", "NetStim"].includes(this.state.cellModel)) {
217390
return <></>
@@ -317,41 +490,9 @@ netpyne_geppetto.netParams.popParams['${this.props.name}']['spikePattern']['type
317490
/>
318491
</NetPyNEField>
319492

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>
493+
{this.changeStimulationPatternLayout(this.state.patternType)}
344494

345495

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-
/>
355496
</>
356497
}
357498

0 commit comments

Comments
 (0)