diff options
author | Aaron LI <aly@aaronly.me> | 2017-12-09 09:43:10 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-12-09 09:43:10 +0800 |
commit | e09595909ec3ef72a7862981660b68d84da300a6 (patch) | |
tree | 91a91591ab8db9855ed8efe0840801ea21329da4 /astro | |
parent | ba470446cd814492b03762caa130aac4241763ec (diff) | |
download | atoolbox-e09595909ec3ef72a7862981660b68d84da300a6.tar.bz2 |
astro/fitsimage.py: Add "Nx" and "Ny" properties
Diffstat (limited to 'astro')
-rwxr-xr-x | astro/fits/fitsimage.py | 16 |
1 files changed, 15 insertions, 1 deletions
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 @@ -33,6 +33,20 @@ class FITSImage: 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): """ Deal with single-frequency and single-polarized image cube. @@ -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: |