From e09595909ec3ef72a7862981660b68d84da300a6 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 9 Dec 2017 09:43:10 +0800 Subject: astro/fitsimage.py: Add "Nx" and "Ny" properties --- astro/fits/fitsimage.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/astro/fits/fitsimage.py b/astro/fits/fitsimage.py index 186e09b..ca980a9 100755 --- a/astro/fits/fitsimage.py +++ b/astro/fits/fitsimage.py @@ -32,6 +32,20 @@ class FITSImage: def bunit(self): return self.header.get("BUNIT") + @property + def Nx(self): + """ + Number of pixels along the X axis (i.e., image width) + """ + return self.shape[-1] + + @property + def Ny(self): + """ + Number of pixels along the Y axis (i.e., image height) + """ + return self.shape[-2] + @property def image(self): """ @@ -76,7 +90,7 @@ def cmd_info(args): Sub-command: "info", show FITS image information """ fimage = FITSImage(args.infile) - print("Image data shape: {0}".format(fimage.shape)) + print("Image size: %dx%d" % (fimage.Nx, fimage.Ny)) print("Data unit: %s" % fimage.bunit) data = fimage.image if args.abs: -- cgit v1.2.2