From 4f58d5ec4c5c826896e75b5695e5dd87938f0a5c Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 23 Jul 2018 23:20:23 +0800 Subject: astro/fitsimage.py: "info" sub-command show min, max and range --- astro/fits/fitsimage.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'astro/fits') 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) -- cgit v1.2.2