aboutsummaryrefslogtreecommitdiffstats
path: root/astro
diff options
context:
space:
mode:
Diffstat (limited to 'astro')
-rwxr-xr-xastro/calc_psd.py2
-rwxr-xr-xastro/fits/fitscube.py2
-rwxr-xr-xastro/ps2d.py12
-rwxr-xr-xastro/spectrum/crosstalk_deprojection.py4
4 files changed, 9 insertions, 11 deletions
diff --git a/astro/calc_psd.py b/astro/calc_psd.py
index 50344aa..da5465f 100755
--- a/astro/calc_psd.py
+++ b/astro/calc_psd.py
@@ -38,7 +38,7 @@ class PSD:
spectral density (i.e., 1D radial power spectrum).
"""
def __init__(self, image, pixel=(1.0, "pixel"), step=None):
- self.image = np.array(image, dtype=np.float)
+ self.image = np.array(image, dtype=float)
self.shape = self.image.shape
if self.shape[0] != self.shape[1]:
raise ValueError("input image is not square!")
diff --git a/astro/fits/fitscube.py b/astro/fits/fitscube.py
index 2c9a4fc..7c30783 100755
--- a/astro/fits/fitscube.py
+++ b/astro/fits/fitscube.py
@@ -165,7 +165,7 @@ class FITSCube:
"""
nslice = self.nslice
wcs = self.wcs
- pix = np.zeros(shape=(nslice, 3), dtype=np.int)
+ pix = np.zeros(shape=(nslice, 3), dtype=int)
pix[:, 2] = np.arange(nslice)
world = wcs.wcs_pix2world(pix, 0)
return world[:, 2]
diff --git a/astro/ps2d.py b/astro/ps2d.py
index 777d592..ce81b5e 100755
--- a/astro/ps2d.py
+++ b/astro/ps2d.py
@@ -69,7 +69,7 @@ def freq2z(freq):
def get_frequencies(wcs, nfreq):
- pix = np.zeros(shape=(nfreq, 3), dtype=np.int)
+ pix = np.zeros(shape=(nfreq, 3), dtype=int)
pix[:, -1] = np.arange(nfreq)
world = wcs.wcs_pix2world(pix, 0)
freqMHz = world[:, -1] / 1e6
@@ -88,7 +88,7 @@ class PS2D:
def __init__(self, cube, pixelsize, frequencies,
window_name=None, window_width="extended", unit="???"):
logger.info("Initializing PS2D instance ...")
- self.cube = cube
+ self.cube = np.array(cube, dtype=float)
self.pixelsize = pixelsize # [arcsec]
self.unit = unit
logger.info("Loaded data cube: %dx%d (cells) * %d (channels)" %
@@ -157,12 +157,10 @@ class PS2D:
"""
if self.window is not None:
logger.info("Applying window along frequency axis ...")
- cube2 = self.cube * self.window[:, np.newaxis, np.newaxis]
- else:
- cube2 = self.cube.astype(np.float)
+ self.cube *= self.window[:, np.newaxis, np.newaxis]
logger.info("Calculating 3D FFT ...")
- cubefft = fftpack.fftshift(fftpack.fftn(cube2))
+ cubefft = fftpack.fftshift(fftpack.fftn(self.cube))
logger.info("Calculating 3D PS ...")
ps3d = np.abs(cubefft) ** 2 # [K^2]
@@ -190,7 +188,7 @@ class PS2D:
p_z = np.abs(np.arange(self.Nz) - ic_z)
mx, my = np.meshgrid(p_xy, p_xy)
rho, phi = self.cart2pol(mx, my)
- rho = np.around(rho).astype(np.int)
+ rho = np.around(rho).astype(int)
logger.info("Cylindrically averaging 3D power spectrum ...")
for r in range(n_k_perp):
diff --git a/astro/spectrum/crosstalk_deprojection.py b/astro/spectrum/crosstalk_deprojection.py
index b08a66a..263cb15 100755
--- a/astro/spectrum/crosstalk_deprojection.py
+++ b/astro/spectrum/crosstalk_deprojection.py
@@ -1015,7 +1015,7 @@ class SpectrumSet(Spectrum): # {{{
"""
neg_counts = self.spec_data < 0
N = len(neg_counts)
- neg_channels = np.arange(N, dtype=np.int)[neg_counts]
+ neg_channels = np.arange(N, dtype=int)[neg_counts]
if len(neg_channels) > 0:
print("WARNING: %d channels have NEGATIVE counts" % \
len(neg_channels), file=sys.stderr)
@@ -1038,7 +1038,7 @@ class SpectrumSet(Spectrum): # {{{
self.spec_data[ch] = 0
# update negative channels indices
neg_counts = self.spec_data < 0
- neg_channels = np.arange(N, dtype=np.int)[neg_counts]
+ neg_channels = np.arange(N, dtype=int)[neg_counts]
if i > 0:
print("FIXED!", file=sys.stderr)
# record history