sachinkumarsingh092/gnuastro

astscript--zero point not recognising hdu=0

Opened this issue · 2 comments

I followed the online tutorial abut astscript-zero point.
When I enter the following command:

astscript-zeropoint ARP_Solved.fits --hdu=0 --refcat=sdss-catalog.fits --refcatmag=imag --refcatra=RA_ICRS --refcatdec=DE_ICRS --output=arp-zeropoint-cat.fits --magnituderange=14,19 --aperarcsec=2,2.5,3,3.5,4 --keepzpap

I get the error:

         | cat -n \
         | asttable --output=/home/astro/Desktop/gnuas/test_zeropoint/ARP_Solved_zeropoint/ref1-2-cat.fits \
               --colmetadata=1,OBJ_ID,int32,"Id of object." \
               --colmetadata=2,RA,float64,"Right Assencion." \
               --colmetadata=3,DEC,float64,"Declination." \
               --colmetadata=4,MAGNITUDE,float32,"Magnitude."
raw=/home/astro/Desktop/gnuas/test_zeropoint/ARP_Solved_zeropoint/stars-raw.fits; \
astquery gaia --dataset=dr3 \
         --overlapwith=ARP_Solved.fits \
         -csource_id -cra -cdec -cparallax \
         -cparallax_error -cpmra -cpmdec --output=$raw; \
asttable $raw -cra,dec --colinfoinstdout \
         -c'arith parallax parallax abs \
                  parallax_error 3 x lt nan where ' \
         --colmetadata=3,GOODPLX,int32,"Stars with good parallax." \
         --noblankend=GOODPLX \
         | asttable -cra,dec --output=/home/astro/Desktop/gnuas/test_zeropoint/ARP_Solved_zeropoint/stars.fits; \
rm $raw
asttable sdss-catalog.fits -cRA_ICRS,DE_ICRS -cimag \
         | cat -n \
         | asttable --output=/home/astro/Desktop/gnuas/test_zeropoint/ARP_Solved_zeropoint/ref1-2.5-cat.fits \
               --colmetadata=1,OBJ_ID,int32,"Id of object." \
               --colmetadata=2,RA,float64,"Right Assencion." \
               --colmetadata=3,DEC,float64,"Declination." \
               --colmetadata=4,MAGNITUDE,float32,"Magnitude."
asttable sdss-catalog.fits -cRA_ICRS,DE_ICRS -cimag \
         | cat -n \
         | asttable --output=/home/astro/Desktop/gnuas/test_zeropoint/ARP_Solved_zeropoint/ref1-3-cat.fits \
               --colmetadata=1,OBJ_ID,int32,"Id of object." \
               --colmetadata=2,RA,float64,"Right Assencion." \
               --colmetadata=3,DEC,float64,"Declination." \
               --colmetadata=4,MAGNITUDE,float32,"Magnitude."
astquery: ARP_Solved.fits: only has one HDU.

You should inform this program to look for your desired input data in the primary HDU with the '--hdu=0' option. For more, see the FOOTNOTE below.

Pro TIP: if your desired HDU has a name (value to 'EXTNAME' keyword), it is best to just use that name with '--hdu' instead of relying on a counter. You can see the list of HDUs in a FITS file (with their data format, type, size and possibly HDU name) using Gnuastro's 'astfits' program, for example:

    astfits ARP_Solved.fits

FOOTNOTE -- When writing a new FITS file, Gnuastro leaves the pimary HDU only for metadata. The output datasets (tables, images or cubes) are written after the primary HDU. In this way the keywords of the the first HDU can be used as metadata of the whole file (which may contain many extensions, this is stipulated in the FITS standard). Usually the primary HDU keywords contains the option names and values that the program was run with. Because of this, Gnuastro's default HDU to read data in a FITS file is the second (or '--hdu=1'). This error is commonly caused when the FITS file wasn't created by Gnuastro or by a program respecting this convention.
make: *** [/usr/local/share/gnuastro/zeropoint.mk:66: /home/astro/Desktop/gnuas/test_zeropoint/ARP_Solved_zeropoint/stars.fits] Error 1
make: *** Waiting for unfinished jobs....

Running

astfits ARP_Solved.fits

Results:

Run on Wed Nov  1 16:27:14 2023
-----
HDU (extension) information: 'ARP_Solved.fits'.
 Column 1: Index (counting from 0, usable with '--hdu').
 Column 2: Name ('EXTNAME' in FITS standard, usable with '--hdu').
           ('n/a': no name in HDU metadata)
 Column 3: Image data type or 'table' format (ASCII or binary).
 Column 4: Size of data in HDU.
 Column 5: Units of data in HDU (only images, for tables use 'asttable -i').
           ('n/a': no unit in HDU metadata, or HDU is a table)
-----
0      n/a             float32         4524x3624 n/a

Hey @dan-adi, this repo is not updated and out of sync of the recent source code. Basically it's just my fork of the project. A better place to file bugs is: https://savannah.gnu.org/bugs/?group=gnuastro.
See also: https://www.gnu.org/savannah-checkouts/gnu/gnuastro/manual/html_node/Report-a-bug.html

@sachinkumarsingh092 ok, thank you