Skip to content

Commit 98680c5

Browse files
authored
fix: Update numpy deprecation of product and test dependency issues (#38)
1 parent 59d9576 commit 98680c5

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

geos-ats/src/geos/ats/helpers/curve_check.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ def interpolate_values_time( ta, xa, tb ):
3333
"""
3434
N = list( np.shape( xa ) )
3535
M = len( tb )
36+
ta = np.ascontiguousarray( np.squeeze( ta ) )
37+
tb = np.ascontiguousarray( np.squeeze( tb ) )
3638

3739
if ( len( N ) == 1 ):
3840
return interp1d( ta, xa )( tb )
3941
else:
4042
# Reshape the input array so that we can work on the non-time axes
41-
S = np.product( N[ 1: ] )
43+
S = np.prod( N[ 1: ] )
4244
xc = np.reshape( xa, ( N[ 0 ], S ) )
4345
xd = np.zeros( ( len( tb ), S ) )
4446
for ii in range( S ):
45-
xd[ :, ii ] = interp1d( ta, xc[ :, ii ] )( tb )
47+
xd[ :, ii ] = interp1d( ta, xc[ :, ii ], bounds_error=False, fill_value='extrapolate' )( tb )
4648

4749
# Return the array to it's expected shape
4850
N[ 0 ] = M

geos-ats/src/geos/ats/test_case.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ats # type: ignore[import]
1+
import ats # type: ignore[import]
22
import os
33
import shutil
44
import logging
@@ -319,7 +319,7 @@ def testCreate( self ):
319319
priority = 1
320320

321321
# Setup a new test group
322-
atsTest = None
322+
parent_test = None
323323
ats.tests.AtsTest.newGroup( priority=priority, path=self.path )
324324
for stepnum, step in enumerate( self.steps ):
325325
np = getattr( step.p, "np", 1 )
@@ -329,10 +329,10 @@ def testCreate( self ):
329329
label = "%s_%d_%s" % ( self.name, stepnum + 1, step.label() )
330330

331331
# call either 'test' or 'testif'
332-
if atsTest is None:
332+
if parent_test is None:
333333
func = lambda *a, **k: test( *a, **k )
334334
else:
335-
func = lambda *a, **k: testif( atsTest, *a, **k )
335+
func = lambda *a, **k: testif( parent_test, *a, **k )
336336

337337
# Set the time limit
338338
kw = {}
@@ -359,6 +359,11 @@ def testCreate( self ):
359359
if self.last_status == PASSED:
360360
atsTest.status = SKIPPED
361361

362+
# Set the parent test
363+
# Note: do not make tests dependent on the result of curvecheck
364+
if step.label() != 'curvecheck':
365+
parent_test = atsTest
366+
362367
# End the group
363368
ats.tests.AtsTest.endGroup()
364369

0 commit comments

Comments
 (0)