@@ -18,8 +18,11 @@ import {
1818 ListComponent ,
1919 NetPyNECoordsRange ,
2020} from 'netpyne/components' ;
21+ import Select from 'netpyne/components/general/Select' ;
2122import Utils from '../../../Utils' ;
2223
24+ const densityStrings = [ "uniform" , "1DMap" , "2DMap" , "distance" ]
25+
2326export default class NetPyNESubCellsConnectivityRule extends React . Component {
2427 constructor ( props ) {
2528 super ( props ) ;
@@ -29,6 +32,7 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
2932 sectionId : 'General' ,
3033 errorMessage : undefined ,
3134 errorDetails : undefined ,
35+ type : 'uniform' ,
3236 } ;
3337 }
3438
@@ -48,7 +52,7 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
4852 this . triggerUpdate ( ( ) => {
4953 // Rename the population in Python
5054 Utils . renameKey (
51- 'netParams.connParams ' ,
55+ 'netParams.subConnParams ' ,
5256 storedValue ,
5357 newValue ,
5458 ( response , newValue ) => {
@@ -103,7 +107,91 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
103107 this . setState ( { currentName : nextProps . name } ) ;
104108 }
105109
110+ handleDensity ( value ) {
111+ this . setState ( { type : value } )
112+ if ( value === 'uniform' ) {
113+ Utils . execPythonMessage (
114+ `netpyne_geppetto.netParams.subConnParams['${ this . props . name } ']['density'] = 'uniform'` ,
115+ )
116+ } else {
117+ Utils . execPythonMessage (
118+ `netpyne_geppetto.netParams.subConnParams['${ this . props . name } ']['density'] = {}` ,
119+ )
120+ }
121+ }
122+
123+ densityExtraFun ( ) {
124+ switch ( this . state . type ) {
125+ case '2DMap' :
126+ case '1DMap' :
127+ return (
128+ < >
129+ < NetPyNEField id = "netParams.subConnParams.density.gridY" className = "listStyle" >
130+ < ListComponent
131+ model = { `netParams.subConnParams['${ this . props . name } ']['density']['gridY']` }
132+ />
133+ </ NetPyNEField >
134+ { this . state . type === "2DMap" ?
135+ < NetPyNEField id = "netParams.subConnParams.density.gridX" className = "listStyle" >
136+ < ListComponent
137+ model = { `netParams.subConnParams['${ this . props . name } ']['density']['gridX']` }
138+ />
139+ </ NetPyNEField > : < > </ > }
140+ < NetPyNEField id = "netParams.subConnParams.density.fixedSomaY" className = "listStyle" >
141+ < ListComponent
142+ model = { `netParams.subConnParams['${ this . props . name } ']['density']['fixedSomaY']` }
143+ />
144+ </ NetPyNEField >
145+ < NetPyNEField id = "netParams.subConnParams.density.gridValues" className = "listStyle" >
146+ < ListComponent
147+ model = { `netParams.subConnParams['${ this . props . name } ']['density']['gridValues']` }
148+ />
149+ </ NetPyNEField >
150+
151+ </ >
152+ )
153+ case 'distance' :
154+ return (
155+ < >
156+ < NetPyNEField id = "netParams.subConnParams.density.ref_sec" >
157+ < NetPyNETextField
158+ fullWidth
159+ variant = "filled"
160+ model = { `netParams.subConnParams['${ this . props . name } ']['density']['ref_sec']` }
161+ />
162+ </ NetPyNEField >
163+ < NetPyNEField id = "netParams.subConnParams.density.ref_seg" >
164+ < NetPyNETextField
165+ fullWidth
166+ variant = "filled"
167+ model = { `netParams.subConnParams['${ this . props . name } ']['density']['ref_seg']` }
168+ />
169+ </ NetPyNEField >
170+ < NetPyNEField id = "netParams.subConnParams.density.target_distance" >
171+ < NetPyNETextField
172+ fullWidth
173+ variant = "filled"
174+ model = { `netParams.subConnParams['${ this . props . name } ']['density']['target_distance']` }
175+ />
176+ </ NetPyNEField >
177+ < NetPyNEField id = "netParams.subConnParams.density.coord" >
178+ < NetPyNESelectField
179+ model = { `netParams.subConnParams['${ this . props . name } ']['density']['coord']` }
180+ fullWidth
181+ postProcessItems = { ( ) => [ "" , "cartesian" ] . map ( ( name , idx ) => (
182+ < MenuItem id = { `${ name } MenuItem` } key = { `_${ name } ` } value = { name } >
183+ { name }
184+ </ MenuItem >
185+ ) ) }
186+ />
187+ </ NetPyNEField >
188+ </ >
189+ )
190+ }
191+ }
192+
106193 render ( ) {
194+ const densityExtras = this . densityExtraFun ( ) ;
107195 const dialogPop = this . state . errorMessage !== undefined ? (
108196 < Dialog open style = { { whiteSpace : 'pre-wrap' } } >
109197 < DialogTitle id = "alert-dialog-title" >
@@ -144,58 +232,11 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
144232 />
145233 </ Box >
146234
147- < NetPyNEField id = "netParams.connParams.weight" >
148- < NetPyNETextField
149- fullWidth
150- variant = "filled"
151- model = {
152- `netParams.connParams['${ this . props . name } ']['weight']`
153- }
154- />
155- </ NetPyNEField >
156-
157- < NetPyNEField id = "netParams.connParams.probability" >
158- < NetPyNETextField
159- fullWidth
160- variant = "filled"
161- model = {
162- `netParams.connParams['${ this . props . name } ']['probability']`
163- }
164- />
165- </ NetPyNEField >
166-
167- < NetPyNEField id = "netParams.connParams.convergence" >
168- < NetPyNETextField
169- fullWidth
170- variant = "filled"
171- model = {
172- `netParams.connParams['${ this . props . name } ']['convergence']`
173- }
174- />
175- </ NetPyNEField >
176-
177- < NetPyNEField id = "netParams.connParams.divergence" >
178- < NetPyNETextField
179- fullWidth
180- variant = "filled"
181- model = {
182- `netParams.connParams['${ this . props . name } ']['divergence']`
183- }
184- />
185- </ NetPyNEField >
186-
187- < NetPyNEField id = "netParams.connParams.delay" >
188- < NetPyNETextField
189- fullWidth
190- variant = "filled"
191- model = { `netParams.connParams['${ this . props . name } ']['delay']` }
192- />
193- </ NetPyNEField >
194-
195- < NetPyNEField id = "netParams.connParams.synMech" >
235+ < NetPyNEField id = "netParams.subConnParams.groupSynMechs" >
196236 < NetPyNESelectField
237+ multiple = { 1 }
197238 model = {
198- `netParams.connParams ['${ this . props . name } ']['synMech ']`
239+ `netParams.subConnParams ['${ this . props . name } ']['groupSynMechs ']`
199240 }
200241 fullWidth
201242 method = "netpyne_geppetto.getAvailableSynMech"
@@ -207,47 +248,34 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
207248 />
208249 </ NetPyNEField >
209250
210- < NetPyNEField id = "netParams.connParams .sec" className = "listStyle" >
251+ < NetPyNEField id = "netParams.subConnParams .sec" className = "listStyle" >
211252 < ListComponent
212- model = { `netParams.connParams ['${ this . props . name } ']['sec']` }
253+ model = { `netParams.subConnParams ['${ this . props . name } ']['sec']` }
213254 />
214255 </ NetPyNEField >
215256
216- < NetPyNEField id = "netParams.connParams.loc" className = "listStyle" >
217- < ListComponent
218- model = { `netParams.connParams['${ this . props . name } ']['loc']` }
219- />
257+ < NetPyNEField id = "netParams.subConnParams.density" >
258+ < Select variant = "filled" value = { this . state . type } onChange = { ( event ) => this . handleDensity ( event . target . value ) } >
259+ { densityStrings . map ( ( item ) => (
260+ < MenuItem id = { `${ item } MenuItem` } key = { item } value = { item } >
261+ { `${ item } ` }
262+ </ MenuItem >
263+ ) ) }
264+ </ Select >
220265 </ NetPyNEField >
221266
222- < NetPyNEField id = "netParams.connParams.synsPerConn" >
223- < NetPyNETextField
224- fullWidth
225- variant = "filled"
226- model = {
227- `netParams.connParams['${ this . props . name } ']['synsPerConn']`
228- }
229- />
230- </ NetPyNEField >
267+ { densityExtras }
231268
232- < NetPyNEField id = "netParams.connParams.plasticity" >
233- < NetPyNETextField
234- fullWidth
235- variant = "filled"
236- model = {
237- `netParams.connParams['${ this . props . name } ']['plasticity']`
238- }
239- />
240- </ NetPyNEField >
241269 { dialogPop }
242270 </ Box >
243271 ) ;
244272 } else if ( this . state . sectionId === 'Pre Conditions' ) {
245273 var content = (
246274 < Box className = "scrollbar scrollchild" mt = { 1 } >
247- < NetPyNEField id = "netParams.connParams .preConds.pop" >
275+ < NetPyNEField id = "netParams.subConnParams .preConds.pop" >
248276 < NetPyNESelectField
249277 model = {
250- `netParams.connParams ['${
278+ `netParams.subConnParams ['${
251279 this . props . name
252280 } ']['preConds']['pop']`
253281 }
@@ -257,11 +285,11 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
257285 />
258286 </ NetPyNEField >
259287
260- < NetPyNEField id = "netParams.connParams .preConds.cellType" >
288+ < NetPyNEField id = "netParams.subConnParams .preConds.cellType" >
261289 < NetPyNESelectField
262290 fullWidth
263291 model = {
264- `netParams.connParams ['${
292+ `netParams.subConnParams ['${
265293 this . props . name
266294 } ']['preConds']['cellType']`
267295 }
@@ -274,7 +302,7 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
274302 < NetPyNECoordsRange
275303 id = "xRangePreConn"
276304 name = { this . props . name }
277- model = "netParams.connParams "
305+ model = "netParams.subConnParams "
278306 conds = "preConds"
279307 items = { [
280308 {
@@ -291,7 +319,7 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
291319 < NetPyNECoordsRange
292320 id = "yRangePreConn"
293321 name = { this . props . name }
294- model = "netParams.connParams "
322+ model = "netParams.subConnParams "
295323 conds = "preConds"
296324 items = { [
297325 {
@@ -308,7 +336,7 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
308336 < NetPyNECoordsRange
309337 id = "zRangePreConn"
310338 name = { this . props . name }
311- model = "netParams.connParams "
339+ model = "netParams.subConnParams "
312340 conds = "preConds"
313341 items = { [
314342 {
@@ -326,10 +354,10 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
326354 } else if ( this . state . sectionId === 'Post Conditions' ) {
327355 var content = (
328356 < Box className = "scrollbar scrollchild" mt = { 1 } >
329- < NetPyNEField id = "netParams.connParams .postConds.pop" >
357+ < NetPyNEField id = "netParams.subConnParams .postConds.pop" >
330358 < NetPyNESelectField
331359 model = {
332- `netParams.connParams ['${
360+ `netParams.subConnParams ['${
333361 this . props . name
334362 } ']['postConds']['pop']`
335363 }
@@ -340,10 +368,10 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
340368 />
341369 </ NetPyNEField >
342370
343- < NetPyNEField id = "netParams.connParams .postConds.cellType" >
371+ < NetPyNEField id = "netParams.subConnParams .postConds.cellType" >
344372 < NetPyNESelectField
345373 model = {
346- `netParams.connParams ['${
374+ `netParams.subConnParams ['${
347375 this . props . name
348376 } ']['postConds']['cellType']`
349377 }
@@ -357,7 +385,7 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
357385 < NetPyNECoordsRange
358386 id = "xRangePostConn"
359387 name = { this . props . name }
360- model = "netParams.connParams "
388+ model = "netParams.subConnParams "
361389 conds = "postConds"
362390 items = { [
363391 {
@@ -374,7 +402,7 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
374402 < NetPyNECoordsRange
375403 id = "yRangePostConn"
376404 name = { this . props . name }
377- model = "netParams.connParams "
405+ model = "netParams.subConnParams "
378406 conds = "postConds"
379407 items = { [
380408 {
@@ -391,7 +419,7 @@ export default class NetPyNESubCellsConnectivityRule extends React.Component {
391419 < NetPyNECoordsRange
392420 id = "zRangePostConn"
393421 name = { this . props . name }
394- model = "netParams.connParams "
422+ model = "netParams.subConnParams "
395423 conds = "postConds"
396424 items = { [
397425 {
0 commit comments