@@ -737,7 +737,7 @@ def consolidateWindows( self ):
737737 # condense the ratio and the simData terms as per specified op
738738 if self .window :
739739 w = self .window
740- assert ( w ["operation" ] in ["min" , "max" , "mean" , "sdev" , "oscPk" , "oscVal" ] )
740+ assert ( w ["operation" ] in ["min" , "max" , "mean" , "sdev" , "oscPk" , "oscVal" , "pkToPk" ] )
741741 numSamples = int ( round ( (w ["endt" ] - w ["startt" ]) / w ["dt" ] ) + 1 )
742742 sd = []
743743 #print( "numSamples = {}, len = {}, ".format( numSamples, len( self.simData ) ) )
@@ -760,6 +760,8 @@ def consolidateWindows( self ):
760760 sd .append ( np .mean ( sb ) )
761761 elif op == "sdev" :
762762 sd .append ( np .sdev ( sb ) )
763+ elif op == "pkToPk" :
764+ sd .append ( max ( sb ) - min ( sb ) )
763765 bl = w ["baseline" ]
764766 if w ["baselineOp" ] == "min" :
765767 bl = min ( self .simData )
@@ -798,6 +800,8 @@ def consolidateWindows( self ):
798800 rd .append ( np .mean ( rb ) )
799801 elif op == "sdev" :
800802 rd .append ( np .sdev ( rb ) )
803+ elif op == "pkToPk" :
804+ rd .append ( max ( rb ) - min ( rb ) )
801805 bl = w ["baseline" ] # Use baseline computed above.
802806 rd = [ (x / self .quantityScale - bl ) for x in rd ]
803807 self .ratioData = rd
@@ -1306,7 +1310,7 @@ def runDoser( model, stim, readout ):
13061310 responseList = [ [readout .entities ['name' ]], readout .field , readout_ratioReferenceEntities , readout .field ]
13071311 #responseList = [ readout.entities, readout.field, readout.ratioReferenceEntities, readout.field ]
13081312 ret , ref = sw .steadyStateStims ( stimList , responseList , isSeries = True , settleTime = readout .settleTime )
1309- if len ( readout .ratioReferenceEntities ) > 0 and readout .ratioReferenceTime < EPS :
1313+ if readout .normMode == 'start' or ( readout . normMode == 'presetTime' and readout .ratioReferenceTime < EPS ) :
13101314 # Special case where the extra entry is the value at reset time.
13111315 refLast = sw .getObjParam (readout .ratioReferenceEntities [0 ], "concInit" )
13121316 ret .append ( ret [- 1 ] )
0 commit comments