Skip to content

Commit

Permalink
Fixing curve check paths
Browse files Browse the repository at this point in the history
  • Loading branch information
cssherman committed Feb 2, 2024
1 parent 2fab135 commit 8fbeb45
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
25 changes: 11 additions & 14 deletions geos_ats_package/geos_ats/helpers/curve_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,20 +275,17 @@ def compare_time_history_curves( fname, baseline, curve, tolerance, output, outp
# Generate script-based curve
if script_instructions and ( len( data ) > 0 ):
data[ 'script' ] = {}
try:
for script, fn, p, s in script_instructions:
k = location_strings[ p ]
data[ 'script' ][ f'{p} Time' ] = data[ 'target' ][ f'{p} Time' ]
key = f'{p} {k}'
key2 = f'{p}'
if s != DEFAULT_SET_NAME:
key += f' {s}'
key2 += f' {s}'
data[ 'script' ][ key ] = data[ 'target' ][ key ]
data[ 'script' ][ key2 ] = evaluate_external_script( script, fn, data[ 'target' ] )
data_sizes[ p ][ s ][ 'script' ] = list( np.shape( data[ 'script' ][ key2 ] ) )
except Exception as e:
errors.append( str( e ) )
for script, fn, p, s in script_instructions:
k = location_strings[ p ]
data[ 'script' ][ f'{p} Time' ] = data[ 'target' ][ f'{p} Time' ]
key = f'{p} {k}'
key2 = f'{p}'
if s != DEFAULT_SET_NAME:
key += f' {s}'
key2 += f' {s}'
data[ 'script' ][ key ] = data[ 'target' ][ key ]
data[ 'script' ][ key2 ] = evaluate_external_script( script, fn, data[ 'target' ] )
data_sizes[ p ][ s ][ 'script' ] = list( np.shape( data[ 'script' ][ key2 ] ) )

# Reshape data if necessary so that they have a predictable number of dimensions
for k in data.keys():
Expand Down
12 changes: 10 additions & 2 deletions geos_ats_package/geos_ats/test_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ class curvecheck( CheckTestStepBase ):
params = TestStepBase.defaultParams + CheckTestStepBase.checkParams + (
TestStepBase.commonParams[ "deck" ], TestStepBase.commonParams[ "name" ], TestStepBase.commonParams[ "np" ],
TestStepBase.commonParams[ "allow_rebaseline" ], TestStepBase.commonParams[ "baseline_directory" ],
TestStepBase.commonParams[ "output_directory" ],
TestStepBase.commonParams[ "output_directory" ], TestStepBase.commonParams[ "test_directory" ],
TestParam( "filename", "Name of the target curve file written by GEOS." ),
TestParam( "curves", "A list of parameter, setname value pairs." ),
TestParam(
Expand Down Expand Up @@ -713,6 +713,7 @@ def update( self, dictionary ):
self.requireParam( "deck" )
self.requireParam( "baseline_directory" )
self.requireParam( "output_directory" )
self.requireParam( "test_directory" )

self.baseline_file = os.path.join( self.p.baseline_directory, self.p.filename )
self.target_file = os.path.join( self.p.output_directory, self.p.filename )
Expand Down Expand Up @@ -742,7 +743,14 @@ def makeArgs( self ):
if self.p.script_instructions is not None:
for c in self.p.script_instructions.split( ';' ):
args += [ "-s" ]
args += c.split( ',' )

# Split the args and set the absolute script
tmp = c.split( ',' )
tmp[ 0 ] = os.path.abspath( os.path.join( self.p.test_directory, tmp[ 0 ] ) )
if not os.path.isfile( tmp[ 0 ] ):
raise FileNotFoundError( f"Could not find requested script for curve check: {tmp[0]}" )

args += tmp
if self.p.warnings_are_errors:
args += [ "-w" ]

Expand Down

0 comments on commit 8fbeb45

Please sign in to comment.