aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-12-05 11:09:20 +0800
committerAaron LI <aly@aaronly.me>2017-12-05 11:09:20 +0800
commit1b7be103d847011f5c4cd810f68804f0a40ff39f (patch)
treebe702e2c5794da01ebb48c3a917d6ef45ff616fb
parent0bb53d7565b00d27e2a0d5c8bd949586b344cfcb (diff)
downloadatoolbox-1b7be103d847011f5c4cd810f68804f0a40ff39f.tar.bz2
astro/fitscube.py: Add --abs argument to "info" sub-command
-rwxr-xr-xastro/fits/fitscube.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/astro/fits/fitscube.py b/astro/fits/fitscube.py
index 13d9be0..bdaca11 100755
--- a/astro/fits/fitscube.py
+++ b/astro/fits/fitscube.py
@@ -234,6 +234,8 @@ def cmd_info(args):
std = np.zeros(cube.nslice)
for i in range(cube.nslice):
image = cube.get_slice(i, csize=args.center)
+ if args.abs:
+ image = np.abs(image)
mean[i] = np.mean(image)
std[i] = np.std(image)
print("Slice <z> <mean> +/- <std>:")
@@ -274,6 +276,8 @@ def main():
parser_info.add_argument("-m", "--mean-std", dest="meanstd",
action="store_true",
help="calculate mean+/-std for each slice")
+ parser_info.add_argument("-a", "--abs", dest="abs", action="store_true",
+ help="take absolute values for image pixels")
parser_info.add_argument("-o", "--outfile", dest="outfile",
help="outfile to save mean/std values")
parser_info.add_argument("infile", help="FITS cube filename")