diff options
author | Aaron LI <aly@aaronly.me> | 2018-07-23 23:20:23 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-07-23 23:22:51 +0800 |
commit | 4f58d5ec4c5c826896e75b5695e5dd87938f0a5c (patch) | |
tree | a891b5dc076c2858c4f9e99fef7ed32cc3e30c7d | |
parent | dac40d165db737aafc5f11a601477a5add0f7710 (diff) | |
download | atoolbox-4f58d5ec4c5c826896e75b5695e5dd87938f0a5c.tar.bz2 |
astro/fitsimage.py: "info" sub-command show min, max and range
-rwxr-xr-x | astro/fits/fitsimage.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/astro/fits/fitsimage.py b/astro/fits/fitsimage.py index f49280a..95c9ed8 100755 --- a/astro/fits/fitsimage.py +++ b/astro/fits/fitsimage.py @@ -180,12 +180,17 @@ 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)] + min_ = np.nanmin(data) + max_ = np.nanmax(data) 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("min: %13.6e" % min_) + print("max: %13.6e" % max_) + print("range: %13.6e (max - min)" % (max_ - min_)) print("mean: %13.6e" % mean) print("median: %13.6e" % median) print("std: %13.6e (standard deviation)" % std) |