help-gnuastro
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: R: command: astsubtractsky and astnoisechisel


From: Mohammad Akhlaghi
Subject: Re: R: command: astsubtractsky and astnoisechisel
Date: Mon, 15 May 2023 20:08:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

Thanks Gabriele,

From your email, the main error message is in [1] below.

If you run the following command in a terminal (as the error message suggests) you will see the list of HDUs in 'kernel.fits':

astfits /media/sf_Tesi/DatiInput/HighStellarDensity/NISP_Images/kernel.fits

You will see that this file only has a single HDU.

The default '--hdu=0' option that is suggested in the error message is for the main input ('input_file' in your code). To specify the HDU for reading the kernel, you should use '--khdu', it is described in this part of the book:

https://www.gnu.org/software/gnuastro/manual/html_node/NoiseChisel-input.html

So if you add '--khdu=0' to your run of NoiseChisel, this error should be fixed and you won't face a problem about the zero values on the edges (with '--hdu=3', you were changing the main input's HDU!).

It is great that you are comparing NoiseChisel! Just be careful that both NoiseChisel and SExtractor (as in any science software!) are highly customizable and it is advised to read their manuals to understand your results and optimize them for your science scenario. In the case of NoiseChisel after doing the tutorial of the previous email, read this tutorial to

https://www.gnu.org/software/gnuastro/manual/html_node/Detecting-large-extended-targets.html

Generally, it is easier to first test your commands on the command-line, and then put them in a script ;-).

Another small tip: With Gnuastro's MakeProfiles command, you can easily create any Gaussian kernel image. For example the output of the command above is a 2D Gaussian profile with a FWHM of 2 pixels and trucated at 5 times the FWHM.

astmkprof --kernel=gaussian,2,5 --oversample=1 --output=kernel.fits

For more on this option, see:

https://www.gnu.org/software/gnuastro/manual//html_node/MakeProfiles-output-dataset.html

Cheers,
Mohammad







[1] Main error message
```
astnoisechisel: /media/sf_Tesi/DatiInput/HighStellarDensity/NISP_Images/kernel.fits: only has one HDU.

You should tell Gnuastro's command-line programs to look for data in the primary HDU with the '--hdu=0' option (or '-h0'). For library users, you can put "0" (a string literal) for the function's HDU argument. 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 /media/sf_Tesi/DatiInput/HighStellarDensity/NISP_Images/kernel.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.
```




reply via email to

[Prev in Thread] Current Thread [Next in Thread]