-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Update numpy deprecation of product and test dependency issues #38
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,16 +33,18 @@ def interpolate_values_time( ta, xa, tb ): | |
""" | ||
N = list( np.shape( xa ) ) | ||
M = len( tb ) | ||
ta = np.ascontiguousarray( np.squeeze( ta ) ) | ||
tb = np.ascontiguousarray( np.squeeze( tb ) ) | ||
|
||
if ( len( N ) == 1 ): | ||
return interp1d( ta, xa )( tb ) | ||
else: | ||
# Reshape the input array so that we can work on the non-time axes | ||
S = np.product( N[ 1: ] ) | ||
S = np.prod( N[ 1: ] ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixes the numpy.product deprecation |
||
xc = np.reshape( xa, ( N[ 0 ], S ) ) | ||
xd = np.zeros( ( len( tb ), S ) ) | ||
for ii in range( S ): | ||
xd[ :, ii ] = interp1d( ta, xc[ :, ii ] )( tb ) | ||
xd[ :, ii ] = interp1d( ta, xc[ :, ii ], bounds_error=False, fill_value='extrapolate' )( tb ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's often not great, but I'm allowing the interpolator to extrapolate the comparison here (there will always be an error in this case due to changes in the time vector though... this is purely to check how much the curves changed if they were on the same time basis) |
||
|
||
# Return the array to it's expected shape | ||
N[ 0 ] = M | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the issue we ran into was due to these time vectors changing shape from (N,) to (N, 1) was the issue that triggered the interpolation issue.