diff --git a/doc/guide/plugin.rst b/doc/guide/plugin.rst index e7c0ba4b..17c35087 100644 --- a/doc/guide/plugin.rst +++ b/doc/guide/plugin.rst @@ -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. diff --git a/explore/realspace.py b/explore/realspace.py index b548e9e4..db8c0a01 100644 --- a/explore/realspace.py +++ b/explore/realspace.py @@ -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 @@ -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): diff --git a/sasmodels/compare_many.py b/sasmodels/compare_many.py index bedc832b..3654393f 100755 --- a/sasmodels/compare_many.py +++ b/sasmodels/compare_many.py @@ -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): """ @@ -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]) diff --git a/sasmodels/data.py b/sasmodels/data.py index c1d1105d..a845bbf6 100644 --- a/sasmodels/data.py +++ b/sasmodels/data.py @@ -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 @@ -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): diff --git a/sasmodels/jitter.py b/sasmodels/jitter.py index b8429c0d..68949094 100755 --- a/sasmodels/jitter.py +++ b/sasmodels/jitter.py @@ -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') diff --git a/sasmodels/kernelpy.py b/sasmodels/kernelpy.py index a26a3f88..3f1e6324 100644 --- a/sasmodels/kernelpy.py +++ b/sasmodels/kernelpy.py @@ -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] diff --git a/sasmodels/modelinfo.py b/sasmodels/modelinfo.py index f988f0fd..094f7d2f 100644 --- a/sasmodels/modelinfo.py +++ b/sasmodels/modelinfo.py @@ -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 """ @@ -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 diff --git a/sasmodels/sasview_model.py b/sasmodels/sasview_model.py index ff122fa9..844dfcd4 100644 --- a/sasmodels/sasview_model.py +++ b/sasmodels/sasview_model.py @@ -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 @@ -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]