Skip to content

Commit

Permalink
Merge branch 'master' into yge/print
Browse files Browse the repository at this point in the history
  • Loading branch information
YigitElma authored Aug 22, 2024
2 parents 9ebb660 + bdc5de4 commit 9f9e25d
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 175 deletions.
5 changes: 4 additions & 1 deletion desc/io/optimizable_io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Functions and methods for saving and loading equilibria and other objects."""

import copy
import functools
import os
import pickle
import pydoc
Expand Down Expand Up @@ -86,7 +87,9 @@ def _unjittable(x):
return any([_unjittable(y) for y in x.values()])
if hasattr(x, "dtype") and np.ndim(x) == 0:
return np.issubdtype(x.dtype, np.bool_) or np.issubdtype(x.dtype, np.int_)
return isinstance(x, (str, types.FunctionType, bool, int, np.int_))
return isinstance(
x, (str, types.FunctionType, functools.partial, bool, int, np.int_)
)


def _make_hashable(x):
Expand Down
11 changes: 7 additions & 4 deletions desc/objectives/linear_objectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def update_target(self, thing):
assert len(new_target) == len(self.target)
self.target = new_target
self._target_from_user = self.target # in case the Objective is re-built
if self._use_jit:
self.jit()
if not self._use_jit:
self._unjit()

def _parse_target_from_user(
self, target_from_user, default_target, default_bounds, idx
Expand Down Expand Up @@ -232,8 +232,8 @@ def update_target(self, thing):
"""
self.target = self.compute(thing.params_dict)
if self._use_jit:
self.jit()
if not self._use_jit:
self._unjit()


class BoundaryRSelfConsistency(_Objective):
Expand Down Expand Up @@ -3186,6 +3186,7 @@ class FixNearAxisR(_FixedObjective):
"""

_static_attrs = ["_nae_eq"]
_target_arg = "R_lmn"
_fixed = False # not "diagonal", since its fixing a sum
_units = "(m)"
Expand Down Expand Up @@ -3322,6 +3323,7 @@ class FixNearAxisZ(_FixedObjective):
"""

_static_attrs = ["_nae_eq"]
_target_arg = "Z_lmn"
_fixed = False # not "diagonal", since its fixing a sum
_units = "(m)"
Expand Down Expand Up @@ -3464,6 +3466,7 @@ class FixNearAxisLambda(_FixedObjective):
"""

_static_attrs = ["_nae_eq"]
_target_arg = "L_lmn"
_fixed = False # not "diagonal", since its fixing a sum
_units = "(dimensionless)"
Expand Down
Loading

0 comments on commit 9f9e25d

Please sign in to comment.