Skip to content

Commit

Permalink
fix: replace np.Inf with np.inf
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed Jun 29, 2024
1 parent 9a5bb4b commit a9ac42a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion aipy/amp.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def response(self, xyz):
class Beam2DGaussian(phs.Beam):
"""Representation of a 2D Gaussian beam pattern, with default setting for
a flat beam."""
def __init__(self, freqs, xwidth=np.Inf, ywidth=np.Inf):
def __init__(self, freqs, xwidth=np.inf, ywidth=np.inf):
"""xwidth = angular width (radians) in EW direction
ywidth = angular width (radians) in NS direction"""
phs.Beam.__init__(self, freqs)
Expand Down
8 changes: 4 additions & 4 deletions aipy/deconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def recenter(a, c):
return a2

def lsq(im, ker, mdl=None, area=None, gain=.1, tol=1e-3, maxiter=200,
lower=lo_clip_lev, upper=np.Inf, verbose=False):
lower=lo_clip_lev, upper=np.inf, verbose=False):
"""This simple least-square fitting procedure for deconvolving an image
saves computing by assuming a diagonal pixel-pixel gradient of the fit.
In essence, this assumes that the convolution kernel is a delta-function.
Expand Down Expand Up @@ -132,7 +132,7 @@ def f(x):
return x, info

def maxent(im, ker, var0, mdl=None, gain=.1, tol=1e-3, maxiter=200,
lower=lo_clip_lev, upper=np.Inf, verbose=False):
lower=lo_clip_lev, upper=np.inf, verbose=False):
"""Maximum entropy deconvolution (MEM) (see Cornwell and Evans 1984
"A Simple Maximum Entropy Deconvolution Algorithm" and Sault 1990
"A Modification of the Cornwell and Evans Maximum Entropy Algorithm")
Expand Down Expand Up @@ -197,7 +197,7 @@ def dot(x, y): return (x*y/-gg_J).sum()
return b_i, info

def maxent_findvar(im, ker, var=None, f_var0=.6, mdl=None, gain=.1, tol=1e-3,
maxiter=200, lower=lo_clip_lev, upper=np.Inf, verbose=False,
maxiter=200, lower=lo_clip_lev, upper=np.inf, verbose=False,
maxiterok=False):
"""This frontend to maxent tries to find a variance for which maxent will
converge. If the starting variance (var) is not specified, it will be
Expand Down Expand Up @@ -237,7 +237,7 @@ def maxent_findvar(im, ker, var=None, f_var0=.6, mdl=None, gain=.1, tol=1e-3,
if verbose: print('Done with MEM.')
return cl, info

def anneal(im, ker, mdl=None, maxiter=1000, lower=lo_clip_lev, upper=np.Inf,
def anneal(im, ker, mdl=None, maxiter=1000, lower=lo_clip_lev, upper=np.inf,
cooling=lambda i,x: 1e+1*(1-np.cos(i/50.))*(x**2), verbose=False):
"""Annealing takes a non-deterministic approach to deconvolution by
randomly perturbing the model and selecting perturbations that improve the
Expand Down
2 changes: 1 addition & 1 deletion scripts/cl_img.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def to_fits(prefix,ftag,i,kwds):
level = float(opts.rewgt.split('(')[-1][:-1])
abms = np.abs(bms)
thresh = abms.max() * level
divisor = abms.clip(thresh, np.Inf)
divisor = abms.clip(thresh, np.inf)
uvs /= divisor; bms /= divisor
elif opts.rewgt.startswith('radial'):
#x,y = np.indices(dim.shape)
Expand Down
2 changes: 1 addition & 1 deletion scripts/combine_freqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def mfunc(uv, p, d, f):
d = d.sum(axis=1)
f.shape = (opts.nchan, nchan/opts.nchan)
f = np.logical_not(f).astype(np.int_).sum(axis=1)
d /= f.clip(1,np.Inf)
d /= f.clip(1,np.inf)
if opts.careful_flag: f = np.where(f < nchan/opts.nchan, 1, 0)
elif opts.dont_flag: f = np.where(f < 1, 1, 0)
else: f = np.where(f <= nchan/opts.nchan/2, 1, 0)
Expand Down
8 changes: 4 additions & 4 deletions scripts/fitmdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
aa.set_jultime(t)
cat.compute(aa)
del(uv)
if opts.maxiter < 0: opts.maxiter = np.Inf
if opts.maxiter < 0: opts.maxiter = np.inf

# Figure out parameters to fit
prms, prm_dict, shkeys = {}, {}, []
Expand Down Expand Up @@ -234,7 +234,7 @@ def fit_func(prms):
fit_func, prm_list,
#args=(args, opts.decimate, opts.decphs),
full_output=1, disp=0,
maxfun=opts.maxiter, maxiter=np.Inf,
maxfun=opts.maxiter, maxiter=np.inf,
ftol=opts.ftol, xtol=opts.xtol
)
prms,score = rv[:2]
Expand All @@ -252,7 +252,7 @@ def fit_func(prms):
fit_func, prm_list,
args=(args, opts.decimate, opts.decphs),
full_output=1, disp=0,
maxfun=opts.maxiter, maxiter=np.Inf,
maxfun=opts.maxiter, maxiter=np.inf,
ftol=opts.ftol, xtol=opts.xtol
)
prms,score = rv[:2]
Expand Down Expand Up @@ -283,7 +283,7 @@ def fit_func(prms):
fit_func, prm_list,
args=([uvfile], decimate, opts.decimate*cnt + opts.decphs),
full_output=1, disp=0,
maxfun=opts.maxiter, maxiter=np.Inf,
maxfun=opts.maxiter, maxiter=np.inf,
ftol=opts.ftol, xtol=opts.xtol
)
prms,score = rv[:2]
Expand Down
2 changes: 1 addition & 1 deletion scripts/xtalk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
guess[bl] += np.where(f, 0, d)
cnt[bl] += np.logical_not(f)
del(uv)
for bl in guess: xtalk[bl] = guess[bl] / np.clip(cnt[bl], 1, np.Inf)
for bl in guess: xtalk[bl] = guess[bl] / np.clip(cnt[bl], 1, np.inf)
if opts.outfile:
xfile = '%f.xtalk.npz' % jd
print('Writing', xfile)
Expand Down

0 comments on commit a9ac42a

Please sign in to comment.