Skip to content

Commit

Permalink
fix for numpy2, add numpy2 to test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
swryan committed Oct 2, 2024
1 parent 37b96dd commit f1e53eb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/dymos_tests_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ on:
required: false
default: false

numpy2_no_pyoptsparse:
type: boolean
description: "Include 'numpy2_no_pyoptsparse' in test matrix"
required: false
default: false

no_snopt:
type: boolean
description: "Include 'no_snopt' in test matrix"
Expand Down Expand Up @@ -97,6 +103,15 @@ jobs:
OPTIONAL: '[test]'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.no_pyoptsparse }}

# numpy 2.x but no PETSc, pyoptsparse or SNOPT
- NAME: numpy2_no_pyoptsparse
PY: '3.12'
NUMPY: 2
SCIPY: 1.14
OPENMDAO: 'latest'
OPTIONAL: '[all]'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.numpy2_no_pyoptsparse }}

# baseline versions except with pyoptsparse but no SNOPT
- NAME: no_snopt
PY: '3.12'
Expand Down
7 changes: 4 additions & 3 deletions dymos/phase/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -2962,9 +2962,10 @@ def _indices_in_constraints(self, name, loc):
duplicate_idxs = all_flat_idxs.intersection(flat_idxs)
if duplicate_idxs:
s = {'initial': 'initial boundary', 'final': 'final boundary', 'path': 'path'}
raise ValueError(f'Duplicate constraint in phase {self.pathname}. '
f'The following indices of `{name}` are used in '
f'multiple {s[loc]} constraints:\n{duplicate_idxs}')
with np.printoptions(legacy='1.13'):
raise ValueError(f'Duplicate constraint in phase {self.pathname}. '
f'The following indices of `{name}` are used in '
f'multiple {s[loc]} constraints:\n{duplicate_idxs}')

all_flat_idxs.update(flat_idxs)

Expand Down

0 comments on commit f1e53eb

Please sign in to comment.