File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 99import vtk
1010import os
1111import os .path
12+ import re
1213import sys
1314import logging
1415
@@ -40,13 +41,15 @@ def image_from_file(fname):
4041 print "Problem opening file '%s': %s" % (fname ,err )
4142 return None
4243
44+ # find alternate baselines for fname of the form basename_d.ext
45+ # where fname = basename.ext and d is a digit between 1 and 9
4346def find_alternates (fname ):
4447 dirname = os .path .dirname (fname )
4548 prefix , ext = os .path .splitext (os .path .split (fname )[1 ])
4649 files = os .listdir (dirname )
4750 results = [fname ]
4851 for i in files :
49- if i . startswith (prefix ) and i . endswith ( ext ) and i != prefix + ext :
52+ if ( re . match (prefix + '_[1-9]' + ext , i )) :
5053 results .append (os .path .join (dirname , i ))
5154 return results
5255
You can’t perform that action at this time.
0 commit comments