From ffbb0deab24491fae0b5ba9aedb3bab1f69dded1 Mon Sep 17 00:00:00 2001 From: Rob Falck Date: Mon, 11 Nov 2024 12:06:07 -0500 Subject: [PATCH] still working on the single failing test in the latest matrix. removed interpolate function from phase. --- .github/workflows/dymos_tests_workflow.yml | 10 +-- .../test/test_finite_burn_eom.py | 2 +- dymos/phase/phase.py | 67 ------------------- 3 files changed, 6 insertions(+), 73 deletions(-) diff --git a/.github/workflows/dymos_tests_workflow.yml b/.github/workflows/dymos_tests_workflow.yml index 982f465cc..efbfbafc1 100644 --- a/.github/workflows/dymos_tests_workflow.yml +++ b/.github/workflows/dymos_tests_workflow.yml @@ -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 diff --git a/dymos/examples/finite_burn_orbit_raise/test/test_finite_burn_eom.py b/dymos/examples/finite_burn_orbit_raise/test/test_finite_burn_eom.py index 15107ccf6..79d6b481b 100644 --- a/dymos/examples/finite_burn_orbit_raise/test/test_finite_burn_eom.py +++ b/dymos/examples/finite_burn_orbit_raise/test/test_finite_burn_eom.py @@ -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) diff --git a/dymos/phase/phase.py b/dymos/phase/phase.py index 42eef1f63..47623f0d4 100644 --- a/dymos/phase/phase.py +++ b/dymos/phase/phase.py @@ -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.