aboutsummaryrefslogtreecommitdiffstats
path: root/astro
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-05-26 17:09:25 +0800
committerAaron LI <aly@aaronly.me>2018-05-26 17:09:25 +0800
commit2455aff9436831768535c0ecb672aa377867185e (patch)
tree2b4f2463f8206dd6db136f264a04c41e5a96e40e /astro
parent1168808b44bc43a94183566485bedafa37d6c1e0 (diff)
downloadatoolbox-2455aff9436831768535c0ecb672aa377867185e.tar.bz2
astro/fitsimage.py: ignore nan
Diffstat (limited to 'astro')
-rwxr-xr-xastro/fits/fitsimage.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/astro/fits/fitsimage.py b/astro/fits/fitsimage.py
index db7030e..5f867d3 100755
--- a/astro/fits/fitsimage.py
+++ b/astro/fits/fitsimage.py
@@ -180,12 +180,12 @@ def show_info(filename, abs_=None, center=None):
rc, cc = rows//2, cols//2
cs1, cs2 = center//2, (center+1)//2
data = data[(rc-cs1):(rc+cs2), (cc-cs1):(cc+cs2)]
- mean = np.mean(data)
- median = np.median(data)
- std = np.std(data)
- iqr = np.diff(np.percentile(data, q=(25, 75)))
- mad = np.median(np.abs(data - median))
- rms = np.sqrt(np.mean(data**2))
+ mean = np.nanmean(data)
+ median = np.nanmedian(data)
+ std = np.nanstd(data)
+ iqr = np.diff(np.nanpercentile(data, q=(25, 75)))
+ mad = np.nanmedian(np.abs(data - median))
+ rms = np.sqrt(np.nanmean(data**2))
print("mean: %13.6e" % mean)
print("median: %13.6e" % median)
print("std: %13.6e (standard deviation)" % std)