Skip to content

Commit 19602d7

Browse files
committed
Merge branch 'development' of https://github.com/MetaCell/netpyne-ui into feature/213
2 parents e5a7fbb + cd65b1c commit 19602d7

35 files changed

Lines changed: 3037 additions & 643 deletions

netpyne_ui/netpyne_geppetto.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def getData(self):
8989

9090
def getModelAsJson(self):
9191
# TODO: netpyne should offer a method asJSON (#240)
92-
# that returns the JSON model without dumping to to disk.
92+
# that returns the JSON model without dumping to to disk.
9393
obj = netpyne_utils.replaceFuncObj(self.netParams.__dict__)
9494
obj = netpyne_utils.replaceDictODict(obj)
9595
return obj
@@ -275,7 +275,7 @@ def simulateNetPyNEModelInGeppetto(self, args):
275275
if experiment:
276276
if self.experiments.any_in_state([model.ExperimentState.PENDING, model.ExperimentState.SIMULATING]):
277277
return utils.getJSONError("Experiment is already simulating or pending", "")
278-
278+
279279
if simulations.local.is_running():
280280
simulations.local.stop()
281281

@@ -285,7 +285,7 @@ def simulateNetPyNEModelInGeppetto(self, args):
285285
if allTrials:
286286
if len(experiment.trials) == 1 and experiment.trials[0].id == experiments.BASE_TRIAL_ID:
287287
# special case where we don't want to run a batch simulation
288-
return self.simulate_single_model(experiment, use_prev_inst)
288+
return self.simulate_single_model(experiment, use_prev_inst)
289289
else:
290290
return self.simulate_experiment_trials(experiment)
291291
else:
@@ -808,9 +808,37 @@ def getAvailableSections(self):
808808
sections[cellRule] = list(self.netParams.cellParams[cellRule]['secs'].keys())
809809
return sections
810810

811+
def getAvailableCellTypes(self):
812+
cell_types = set([])
813+
cell_types.add('all')
814+
for p in self.netParams.cellParams:
815+
cell_types.add(p)
816+
return sorted(cell_types)
817+
818+
def getAvailableRxDSections(self, selectedRegion):
819+
sections = set([])
820+
sections.add('all')
821+
if self.netParams.rxdParams.regions[selectedRegion].get('cells'):
822+
if 'all' in self.netParams.rxdParams.regions[selectedRegion]['cells']:
823+
for cellRule in self.netParams.cellParams:
824+
for cellSect in self.netParams.cellParams[cellRule]['secs']:
825+
sections.add(cellSect)
826+
else:
827+
for cellRule in self.netParams.cellParams:
828+
if cellRule in self.netParams.rxdParams.regions[selectedRegion]['cells']:
829+
for cellSect in self.netParams.cellParams[cellRule]['secs']:
830+
sections.add(cellSect)
831+
return sorted(sections)
832+
811833
def getAvailableStimSources(self):
812834
return list(self.netParams.stimSourceParams.keys())
813835

836+
def getAvailableRxdRegions(self):
837+
return list(self.netParams.rxdParams.regions.keys())
838+
839+
def getAvailableRxdSpecies(self):
840+
return list(self.netParams.rxdParams.species.keys())
841+
814842
def getAvailableSynMech(self):
815843
return list(self.netParams.synMechParams.keys())
816844

webapp/components/general/NetPyNEField.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default class NetPyNEField extends Component {
1111
super(props);
1212
this.state = { open: false };
1313
}
14+
1415
setErrorMessage (value) {
1516
return new Promise((resolve, reject) => {
1617
if (this.realType === REAL_TYPE.FUNC) {
@@ -52,7 +53,7 @@ export default class NetPyNEField extends Component {
5253
}
5354

5455
handleTooltip (action) {
55-
this.setState({ open: action});
56+
this.setState({ open: action });
5657
}
5758

5859
render () {
@@ -136,10 +137,13 @@ export default class NetPyNEField extends Component {
136137
disableFocusListener
137138
open={this.state.open}
138139
>
139-
<Box mb={1} width="100%"
140-
onMouseEnter= {() => { this.handleTooltip(true) }}
141-
onMouseLeave = { () => { this.handleTooltip(false) }}
142-
onClick={ () => { this.handleTooltip(false) }}>
140+
<Box
141+
mb={1}
142+
width="100%"
143+
onMouseEnter={() => { this.handleTooltip(true); }}
144+
onMouseLeave={() => { this.handleTooltip(false); }}
145+
onClick={() => { this.handleTooltip(false); }}
146+
>
143147
{childWithProp}
144148
</Box>
145149
</Tooltip>

webapp/components/general/PythonControlledCapability.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,16 +420,19 @@ define((require) => {
420420
}
421421

422422
callPythonMethod = (value) => {
423-
GeppettoUtils.evalPythonMessage(this.props.method, [])
424-
.then((response) => {
425-
if (this._isMounted) {
426-
if (Object.keys(response).length !== 0) {
427-
this.setState({ pythonData: response });
428-
} else {
429-
this.setState({ pythonData: [] });
423+
const params = this.props?.pythonParams || [];
424+
if (this.props.method) {
425+
GeppettoUtils.evalPythonMessage(this.props.method, params)
426+
.then((response) => {
427+
if (this._isMounted) {
428+
if (Object.keys(response).length !== 0) {
429+
this.setState({ pythonData: response });
430+
} else {
431+
this.setState({ pythonData: [] });
432+
}
430433
}
431-
}
432-
});
434+
});
435+
}
433436
};
434437

435438
componentDidUpdate (prevProps, prevState) {

webapp/components/general/Select.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Select extends React.Component {
2121
value={value}
2222
onChange={this.props.onChange}
2323
multiple={!!this.props.multiple}
24+
pythonParams={this.props.pythonParams}
2425
>
2526
{this.props.children}
2627
</MuiSelect>

webapp/components/icons.jsx

Lines changed: 38 additions & 0 deletions
Large diffs are not rendered by default.

webapp/components/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import _LaunchDialog from './topbar/dialogs/LaunchDialog';
6868
import _NetPyNEPythonConsole from './general/NetPyNEPythonConsole';
6969
import _PlotViewer from './general/PlotViewer';
7070
import _ExperimentControlPanel from './general/ExperimentControlPanel';
71+
import _Rxd from './rxd/Wrapper';
7172

7273
const updateCardsDispatch = (dispatch) => ({ updateCards: () => dispatch(updateCards) });
7374

@@ -388,6 +389,15 @@ export const SelectCellTemplate = connect(
388389
}),
389390
)(_SelectCellTemplate);
390391

392+
export const Rxd = connect(
393+
null,
394+
updateCardsDispatch,
395+
)(
396+
PythonControlledCapability.createPythonControlledComponent(
397+
_Rxd,
398+
),
399+
);
400+
391401
// ---------------------------------------------------------------------------------------- //
392402

393403
// DEFAULTS

webapp/components/layout/componentsMap.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
NetPyNEPythonConsole,
1414
ExperimentManager,
1515
ExperimentControlPanel,
16+
Rxd,
1617
} from '..';
1718

1819
import PlotViewer from '../general/PlotViewer';
@@ -36,6 +37,7 @@ const componentMap = {
3637
'analysis': NetPyNEPlots,
3738
'experimentManager': ExperimentManager,
3839
'experimentControlPanel': ExperimentControlPanel,
40+
'rxd': Rxd,
3941
};
4042

4143
export default componentMap;

0 commit comments

Comments
 (0)