Skip to content

Commit

Permalink
update deprecated namespaces/methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tsole0 committed Jun 17, 2024
1 parent 59f5bae commit ed1ba6d
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion doc/guide/plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ value at a time::

Iq.vectorized = False

Return np.NaN if the parameters are not valid (e.g., cap_radius < radius in
Return np.nan if the parameters are not valid (e.g., cap_radius < radius in
barbell). If I(q; pars) is NaN for any $q$, then those parameters will be
ignored, and not included in the calculation of the weighted polydispersity.

Expand Down
4 changes: 2 additions & 2 deletions explore/realspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def pad_vectors(boundary, *vectors):
if new_size > old_size:
new = np.empty(new_size, dtype=old.dtype)
new[:old_size] = old
new[old_size:] = np.NaN
new[old_size:] = np.nan
yield new
else:
yield old
Expand Down Expand Up @@ -1115,7 +1115,7 @@ def _sasmodels_Iqxy(kernel, qx, qy, pars, view):
# calculator avoids masked values; instead set masked values to NaN
result = np.empty_like(qx)
result[calculator.index] = Iqxy
result[~calculator.index] = np.NaN
result[~calculator.index] = np.nan
return result

def wrap_sasmodel(name, **pars):
Expand Down
6 changes: 3 additions & 3 deletions sasmodels/compare_many.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def try_model(fn, pars):
traceback.print_exc()
print("when comparing %s for %d"%(name, seed))
if hasattr(data, 'qx_data'):
result = np.NaN*data.data
result = np.nan*data.data
else:
result = np.NaN*data.x
result = np.nan*data.x
return result
def check_model(pars):
"""
Expand All @@ -165,7 +165,7 @@ def check_model(pars):
except Exception as exc:
#raise
print('"Error: %s"'%str(exc).replace('"', "'"))
print('"good","%d of %d","max diff",%g' % (0, N, np.NaN))
print('"good","%d of %d","max diff",%g' % (0, N, np.nan))
return
expected = max(PRECISION[base], PRECISION[comp])

Expand Down
6 changes: 3 additions & 3 deletions sasmodels/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ def __init__(self, x=None, y=None, dx=None, dy=None):
self.y, self.dy = _as_numpy(y), _as_numpy(dy)
self.dxl = None
self.filename = None
self.qmin = self.x.min() if self.x is not None else np.NaN
self.qmax = self.x.max() if self.x is not None else np.NaN
self.qmin = self.x.min() if self.x is not None else np.nan
self.qmax = self.x.max() if self.x is not None else np.nan
# TODO: why is 1D mask False and 2D mask True?
self.mask = (np.isnan(y) if y is not None
else np.zeros_like(x, 'b') if x is not None
Expand Down Expand Up @@ -314,7 +314,7 @@ class Source(object):
"""
def __init__(self):
# type: () -> None
self.wavelength = np.NaN
self.wavelength = np.nan
self.wavelength_unit = "A"

class Sample(object):
Expand Down
2 changes: 1 addition & 1 deletion sasmodels/jitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ def make_image(z, kw):

cmap = kw.pop('cmap', cm.coolwarm)

znorm = (z-z.min())/z.ptp()
znorm = (z-z.min())/np.ptp(z)
c = cmap(znorm)
c = c[..., :3]
rgb = np.asarray(c*255, 'u1')
Expand Down
4 changes: 2 additions & 2 deletions sasmodels/kernelpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ def _loops(parameters, form, form_volume, form_radius, nq, call_details,
weighted_form = 0.0
weighted_shell = 0.0
weighted_radius = 0.0
partial_weight = np.NaN
weight = np.NaN
partial_weight = np.nan
weight = np.nan

p0_par = call_details.pd_par[0]
p0_length = call_details.pd_length[0]
Expand Down
4 changes: 2 additions & 2 deletions sasmodels/modelinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def make_parameter_table(pars):
partable.check_angles(strict=True)
return partable

def parse_parameter(name, units='', default=np.NaN,
def parse_parameter(name, units='', default=np.nan,
user_limits=None, ptype='', description=''):
# type: (str, str, float, Sequence[Any], str, str) -> Parameter
"""
Expand Down Expand Up @@ -320,7 +320,7 @@ class Parameter(object):
parameter table is built using :func:`make_parameter_table` and
:func:`parse_parameter` therein.
"""
def __init__(self, name, units='', default=np.NaN, limits=(-np.inf, np.inf),
def __init__(self, name, units='', default=np.nan, limits=(-np.inf, np.inf),
ptype='', description=''):
# type: (str, str, float, Limits, str, str) -> None
self.id = name.split('[')[0].strip() # type: str
Expand Down
6 changes: 3 additions & 3 deletions sasmodels/sasview_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ def getProfile(self):
if p.id == self.multiplicity_info.control:
value = float(self.multiplicity)
elif p.length == 1:
value = self.params.get(p.id, np.NaN)
value = self.params.get(p.id, np.nan)
else:
value = np.array([self.params.get(p.id+str(k), np.NaN)
value = np.array([self.params.get(p.id+str(k), np.nan)
for k in range(1, p.length+1)])
args[p.id] = value

Expand Down Expand Up @@ -841,7 +841,7 @@ def _get_weights(self, par):
else:
# For hidden parameters use default values. This sets
# scale=1 and background=0 for structure factors
default = self._model_info.parameters.defaults.get(par.name, np.NaN)
default = self._model_info.parameters.defaults.get(par.name, np.nan)
return default, [default], [1.0]
elif par.polydisperse:
value = self.params[par.name]
Expand Down

0 comments on commit ed1ba6d

Please sign in to comment.