Skip to content

Commit

Permalink
still working on the single failing test in the latest matrix. remove…
Browse files Browse the repository at this point in the history
…d interpolate function from phase.
  • Loading branch information
robfalck committed Nov 11, 2024
1 parent 8b3194b commit ffbb0de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 73 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/dymos_tests_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,13 @@ jobs:
# fi
python -c 'import multiprocessing as mp; print(mp.cpu_count())'
echo "Running multi phase restart test case standalone"
testflo dymos/examples/finite_burn_orbit_raise/test/test_multi_phase_restart.py:TestExampleTwoBurnOrbitRaiseConnected.test_ex_two_burn_orbit_raise_connected -n 2 --pre_announce -s
echo "Running two burn orbit raise MPI standalone"
testflo dymos/examples/finite_burn_orbit_raise/test/test_ex_two_burn_orbit_raise_mpi.py:TestExampleTwoBurnOrbitRaiseMPI.test_ex_two_burn_orbit_raise_mpi -n 2 --pre_announce -s
testflo dymos/examples/finite_burn_orbit_raise/test/test_multi_phase_restart.py:TestExampleTwoBurnOrbitRaiseConnected.test_ex_two_burn_orbit_raise_connected -n 4 --pre_announce -s
# echo "Running two burn orbit raise MPI standalone"
# testflo dymos/examples/finite_burn_orbit_raise/test/test_ex_two_burn_orbit_raise_mpi.py:TestExampleTwoBurnOrbitRaiseMPI.test_ex_two_burn_orbit_raise_mpi -n 4 --pre_announce -s
echo "Running all orbit raise MPI tests"
testflo dymos/examples/finite_burn_orbit_raise/test/test_ex_two_burn_orbit_raise_mpi.py:TestExampleTwoBurnOrbitRaiseMPI -n 2 --pre_announce -s
testflo dymos/examples/finite_burn_orbit_raise/test/test_ex_two_burn_orbit_raise_mpi.py:TestExampleTwoBurnOrbitRaiseConnected -n 4 --pre_announce -s
echo "Running all orbit raise MPI and NON MPI tests"
testflo dymos/examples/finite_burn_orbit_raise/test -n 2 --pre_announce -s
testflo dymos/examples/finite_burn_orbit_raise/test -n 4 --pre_announce -s
- name: Submit coverage
if: github.event_name != 'workflow_dispatch'
continue-on-error: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_outputs(self):
assert_near_equal(p['at_dot'], p['accel']**2 / p['c'])

def test_partials(self):
cpd = self.p.check_partials(compact_print=False)
cpd = self.p.check_partials(compact_print=False, out_stream=None)
assert_check_partials(cpd, atol=1.0E-5, rtol=2.0)


Expand Down
67 changes: 0 additions & 67 deletions dymos/phase/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -2351,73 +2351,6 @@ def _check_parameter_options(self):
f"phase '{self.name}': {', '.join(invalid_options)}",
RuntimeWarning)

def interpolate(self, xs=None, ys=None, nodes='all', kind='linear', axis=0):
"""
Return an array of values on interpolated to the given node subset of the phase.
Parameters
----------
xs : ndarray or Sequence or None
Array of integration variable values.
ys : ndarray or Sequence or None
Array of control/state/parameter values.
nodes : str or None
The name of the node subset.
kind : str
Specifies the kind of interpolation, as per the scipy.interpolate package.
One of ('linear', 'nearest', 'zero', 'slinear', 'quadratic', 'cubic'
where 'zero', 'slinear', 'quadratic' and 'cubic' refer to a spline
interpolation of zeroth, first, second or third order) or as an
integer specifying the order of the spline interpolator to use.
Default is 'linear'.
axis : int
Specifies the axis along which interpolation should be performed. Default is
the first axis (0).
Returns
-------
np.array
The values of y interpolated at nodes of the specified type.
"""
om.issue_warning('phase.interpolate has been deprecated and will be removed from Dymos '
'2.0.0. Use phase.interp instead, which uses a different order for the '
'arguments but is more terse and can interpolate polynomial control '
'values.', category=om.OMDeprecationWarning)

if not isinstance(ys, Iterable):
raise ValueError('ys must be provided as an Iterable of length at least 2.')
if nodes not in ('col', 'all', 'state_disc', 'state_input', 'control_disc',
'control_input', 'segment_ends'):
raise ValueError("nodes must be one of 'col', 'all', 'state_disc', "
"'state_input', 'control_disc', 'control_input', or 'segment_ends'")
if xs is None:
if len(ys) != 2:
raise ValueError('xs may only be unspecified when len(ys)=2')
if kind != 'linear':
raise ValueError('kind must be linear when xs is unspecified.')
xs = [-1, 1]
elif len(xs) != np.prod(np.asarray(xs).shape):
raise ValueError('xs must be viewable as a 1D array')

gd = self.options['transcription'].grid_data

if gd is None:
raise RuntimeError('interpolate cannot be called until the associated '
'problem has been setup')

node_locations = gd.node_ptau[gd.subset_node_indices[nodes]]
# Affine transform xs into tau space [-1, 1]
_xs = np.asarray(xs).ravel()
m = 2.0 / (_xs[-1] - _xs[0])
b = 1.0 - (m * _xs[-1])
taus = m * _xs + b
interpfunc = interpolate.interp1d(taus, ys, axis=axis, kind=kind,
bounds_error=False, fill_value='extrapolate')
res = np.atleast_2d(interpfunc(node_locations))
if res.shape[0] == 1:
res = res.T
return res

def interp(self, name=None, ys=None, xs=None, nodes=None, kind='linear', axis=0):
"""
Interpolate values onto the given subset of nodes in the phase.
Expand Down

0 comments on commit ffbb0de

Please sign in to comment.