@@ -190,6 +190,11 @@ def load( findsim ):
190190 load = staticmethod ( load )
191191
192192 def minInterval ( self ):
193+ """
194+ This function checks if stim steps up from zero at t>0.
195+ I think for plotting? Maybe for numerical stability. Either way,
196+ it inserts a very small nonzero value just before the step.
197+ """
193198 ret = 1000.0
194199 lastt = 0.0
195200 lastval = 0.0
@@ -208,9 +213,9 @@ def minInterval( self ):
208213 if (not isElec ) and (t - lastt ) >= 100.0 and lastval < 1e-7 and val > 0.5e-4 :
209214 # Have to insert intermediate step in data.
210215 newdata .append ( [float (d [0 ]), 1e-6 / self .quantityScale ] )
211- newt = t + (t - lastt )/ ( 100.0 * self . timeScale )
216+ newt = t + (t - lastt )/ 100.0
212217 #print( "inserting: ", [d[0], 1e-6], [newt, d[1]] )
213- newdata .append ( [newt , d [1 ]] )
218+ newdata .append ( [newt / self . timeScale , d [1 ]] )
214219 ret = min ( ret , (t - lastt )/ 100.0 )
215220 else :
216221 newdata .append ( [d [0 ], d [1 ]] )
@@ -1002,7 +1007,7 @@ def __lt__( self, other ):
10021007
10031008def putStimsInQ ( q , stims , pauseHsolve ):
10041009 for i in stims :
1005- isElec = i .field in ['Im' , 'current' , 'Vclamp' ] or (i .field == 'rate' and 'syn' in i .entities [ 0 ])
1010+ isElec = i .field in ['Im' , 'current' , 'Vclamp' ] or (i .field == 'rate' and 'syn' in i .entity [ 'name' ])
10061011 for j in i .data :
10071012 if len (j ) == 0 :
10081013 continue
@@ -1147,7 +1152,8 @@ def parseAndRun( model, stims, readouts, getPlots = False ):
11471152 currt = sw .getCurrentTime ()
11481153 if ( qe .t > currt ):
11491154 #print( "currt={:.4f}, qt={:.4f}".format( currt, qe.t) )
1150- sw .advanceSimulation ( qe .t - currt , doPlot = getPlots )
1155+ sw .advanceSimulation ( qe .t - currt , doPlot = getPlots ,
1156+ doSettle = (i == 0 ) )
11511157 if isinstance ( qe .entry , Stimulus ):
11521158 sw .deliverStim ( qe )
11531159 #print( "DELIVER STIM {} {} {} {}".format( qe.entry.entities, qe.entry.field, qe.entry.data, qe.val ) )
@@ -1502,9 +1508,9 @@ def runit( expt, model, stims, readouts, getPlots = False ):
15021508def getInitParams ( modelFile , mapFile , paramList ):
15031509 # ParamList as strings of objpath.field
15041510 if modelFile .split ('.' )[- 1 ] == "json" :
1505- sw = SimWrapHillTau ( mapFile = mapFile , ignoreMissingObj = False , silent = False , exptFile = "" )
1511+ sw = SimWrapHillTau ( mapFile = mapFile , ignoreMissingObj = False , silent = False , exptFile = "getInitParams " )
15061512 else :
1507- sw = SimWrapMoose ( mapFile = mapFile , ignoreMissingObj = False , silent = False , exptFile = "" )
1513+ sw = SimWrapMoose ( mapFile = mapFile , ignoreMissingObj = False , silent = False , exptFile = "getInitParams " )
15081514
15091515 sw .deleteSimulation ()
15101516 sw .loadModelFile ( modelFile , silentDummyModify , [], "" , "" )
@@ -1565,6 +1571,9 @@ def innerMain( exptFile, scoreFunc = defaultScoreFunc, modelFile = "", mapFile =
15651571 readouts .tabulateOutput = tabulateOutput
15661572 readouts .generate = generate
15671573
1574+ if not silent :
1575+ print ( "FindSim: doing expt " , exptFile )
1576+
15681577 if mapFile != "" :
15691578 mapFile = mapFile
15701579 else :
0 commit comments