mainGNU Astronomy Utilities - Support: sr #110952, astscript-zero errors on --hdu=0

 
 

sr #110952: astscript-zero errors on --hdu=0

Submitter:  danc
Submitted:  Wed 01 Nov 2023 07:45:13 PM UTC
   
 
Category:  Installed scripts Priority:  5 - Normal
Severity:  4 - Important Item Group:  * Crash
Status:  Done Privacy:  Public
Assigned to:  sepideh Open/Closed:  Closed
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 04 Nov 2023 11:18:52 AM UTC, comment #7: 


comment #6:

> By the way, 'danc': we try our best to acknowledge such bug findings by Gnuastro users. For example, see the post-script '[1]' in the announcement for Gnuastro 0.21.
>
> Unfortunately I can't include non-official names in this acknowledgement; so if you like, we would be happy to include your official name for the release of Gnuastro 0.22. Of course, there is no problem if you prefer to stay anonymous, this is optional ;-).
>
> In any case, we are very grateful to helping make Gnuastro better for everyone (with less bugs!).


Thank you for the input, much appreciated.

danc
Fri 03 Nov 2023 05:51:23 PM UTC, comment #6: 

By the way, 'danc': we try our best to acknowledge such bug findings by Gnuastro users. For example, see the post-script '[1]' in the announcement for Gnuastro 0.21.

Unfortunately I can't include non-official names in this acknowledgement; so if you like, we would be happy to include your official name for the release of Gnuastro 0.22. Of course, there is no problem if you prefer to stay anonymous, this is optional ;-).

In any case, we are very grateful to helping make Gnuastro better for everyone (with less bugs!).

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 03 Nov 2023 05:46:12 PM UTC, comment #5: 

Sepideh's fix has been merged into Gnuastro's 'master' branch in Commit d212d56ed (officially as bug #64852). So I am closing this task.

'danc': if you would like to try this fix, you can download the latest Gnuastro source and book (which now includes this fix) from the links below:


Of course, any feedback would be very appreciated, so if you still have questions/doubts, feel free to continue commenting here or defining new; or better yet, in the Gnuastro Matrix-protocol chat room.

Thanks again to 'danc' and Sepideh :-).

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 03 Nov 2023 05:07:12 PM UTC, comment #4: 

Thanks a lot Sepideh for the fast reply and suggested fix; and thanks also to 'danc' for confirming that the temporary solution worked.

Indeed, when the image is not already sky subtracted, it is important to subtract the sky before estimating the zeropoint.

About a practical tutorial, we have two (they starts from downloading pre-defined images and describe the logic behind every step/command shown): https://www.gnu.org/software/gnuastro/manual/html_node/Zero-point-of-an-image.html

If you do the tutorials once carefully (with the same data that is given/used/described in the tutorials), hopefully everything will be clear and you will be set to do it on any image :-).

I'll try to merge Sepideh's fix with the main Gnuastro source as soon as possible. But fortunately that shouldn't be a problem for you any more (as you mentioned, the sky subtracted image is no longer in the 0th HDU).

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 03 Nov 2023 04:13:46 PM UTC, comment #3: 


comment #1:

> Thank you very much for the bug you cashed and reported here.
>
> Fortunately, it was so easy and I could fix and implement it in the this commit: zeropoint-commit
>
> But I should say that it up to Mohammad Akhlaghi to merge it into the main branch.
>
> Until Mohammad merge it you can temporary fix your problem with following command and put your input in first extension. Because in Gnuastro programs by default it consider all the inputs are in first extension. After running the below command 'output.fits' has data in HDU 1 and you can use this program without problem.
>


Thank you very much, didn't noticed your reply. Your simple approach worked. Subtracting the sky worked because it created another output fits file that I passed to astscript-zero -h1 ....
Do you by any chance know a practical tutorial for zero point computation and/or photometric calibration, in order to make sure I'm doing every step correctly ?

> astfits input.fits --copy=0 --output=output.fits


danc
Fri 03 Nov 2023 04:02:15 PM UTC, comment #2: 

I made it work by substracting the sky with noise chisel as in the tutorial. I didn't know I had to subtract the sky first.

danc
Thu 02 Nov 2023 06:44:03 PM UTC, comment #1: 

Thank you very much for the bug you cashed and reported here.

Fortunately, it was so easy and I could fix and implement it in the this commit: zeropoint-commit

But I should say that it up to Mohammad Akhlaghi to merge it into the main branch.

Until Mohammad merge it you can temporary fix your problem with following command and put your input in first extension. Because in Gnuastro programs by default it consider all the inputs are in first extension. After running the below command 'output.fits' has data in HDU 1 and you can use this program without problem.


astfits input.fits --copy=0 --output=output.fits


Sepideh Eskandarlou <sepideh>
Group Member
Wed 01 Nov 2023 07:45:13 PM UTC, original submission:  

I followed the online tutorial about 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....

The fits looks like:

astfits ARP_Solved.fits



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

What am I doing wrong?

danc

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by makhlaghi (Posted a comment)
  • -email is unavailable- added by sepideh (Posted a comment)
  • -email is unavailable- added by danc (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-11-03 makhlaghi StatusIn Progress Done
        Open/ClosedOpen Closed
        Summaryagstscript-zero errors on --hdu=0 astscript-zero errors on --hdu=0
    2023-11-03 makhlaghi StatusNone In Progress
        Assigned toNone sepideh

    Back to the top

    Powered by Savane 3.13-0329.
    Corresponding source code