@@ -111,14 +111,14 @@ def chop_prv_to_roi(prv_file, outfile=None):
111111 if outfile :
112112 workdir = dirname (normpath (outfile ))
113113 else :
114- tgtname = ".chop" .join (splitext (basename (prv_file )))
114+ tgtname = ".chop" .join (splitext (basename (prv_file )))
115115 # Make sure config._tmpdir_path exists before using it
116116 if config ._tmpdir_path :
117117 try :
118118 os .makedirs (config ._tmpdir_path , exist_ok = True )
119119 except OSError as err :
120120 print ("FATAL: {}" .format (err ))
121- workdir = mkdtemp (dir = config ._tmpdir_path )
121+ workdir = mkdtemp (dir = config ._tmpdir_path )
122122 outfile = os .path .join (workdir , tgtname )
123123
124124 roi_filter = resource_filename (__name__ , ROI_FILTER_XML )
@@ -183,7 +183,8 @@ def chop_prv_to_roi(prv_file, outfile=None):
183183 )
184184
185185 return outfile
186-
186+
187+
187188def _get_roi_times (roi_prv ):
188189 """ Extract ROi timing information from a filtered trace
189190
@@ -195,20 +196,16 @@ def _get_roi_times(roi_prv):
195196 df = data .event
196197
197198 # Get the first on and last off events
198- grouped = df .reset_index (level = ' time' ).groupby (level = [' task' , ' thread' ])
199+ grouped = df .reset_index (level = " time" ).groupby (level = [" task" , " thread" ])
199200 ons = grouped .nth (1 )
200- offs = grouped .last ()
201-
201+ offs = grouped .last ()
202+
202203 # Check the events have the expected values
203- if not (ons ['value' ] == 1 ).all ():
204- raise ValueError (
205- "Unexpected event value: expected 40000012:1"
206- )
207- if not (offs ['value' ] == 0 ).all ():
208- raise ValueError (
209- "Unexpected event value: expected 40000012:0"
210- )
211- return ons ['time' ].min (), 1 + offs ['time' ].max ()
204+ if not (ons ["value" ] == 1 ).all ():
205+ raise ValueError ("Unexpected event value: expected 40000012:1" )
206+ if not (offs ["value" ] == 0 ).all ():
207+ raise ValueError ("Unexpected event value: expected 40000012:0" )
208+ return ons ["time" ].min (), 1 + offs ["time" ].max ()
212209
213210
214211def paramedir_analyze (
@@ -381,16 +378,16 @@ def run_paramedir(tracefile, paramedir_config, outfile=None, variables=None):
381378 outfile: str
382379 Path to the output file.
383380 """
384-
381+
385382 # Make sure config._tmpdir_path exists before using it
386383 if config ._tmpdir_path :
387384 try :
388385 os .makedirs (config ._tmpdir_path , exist_ok = True )
389386 except OSError as err :
390387 print ("FATAL: {}" .format (err ))
391-
388+
392389 tmpdir = mkdtemp (dir = config ._tmpdir_path )
393-
390+
394391 # If variables is none, still sub with empty dict
395392 variables = variables if variables else {}
396393 tmp_config = _write_substituted_config (paramedir_config , tmpdir , variables )
0 commit comments