[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master d6063f52 10/11: Book: some parts PSF section w
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master d6063f52 10/11: Book: some parts PSF section with new scale-factor are changed |
Date: |
Fri, 17 May 2024 08:01:32 -0400 (EDT) |
branch: master
commit d6063f52efa3b5fea7727bfba0d09f9a5d999621
Author: Sepideh Eskandarlou <sepideh.eskandarlou@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Book: some parts PSF section with new scale-factor are changed
Until now, Raul changed the scale-factor and subtraction scripts of
PSF. Some parts of the book in stacking steps and subtracting PSF in bright
stars did not explaine properly. Also, some commands had to fixed.
With this commit, all of them are fixed and implemented.
---
bin/script/psf-scale-factor.sh | 0
bin/script/psf-subtract.sh | 0
doc/gnuastro.texi | 55 ++++++++++++++++++++++++++----------------
3 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/bin/script/psf-scale-factor.sh b/bin/script/psf-scale-factor.sh
old mode 100644
new mode 100755
diff --git a/bin/script/psf-subtract.sh b/bin/script/psf-subtract.sh
old mode 100644
new mode 100755
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 9ca6db6d..a4e75785 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -6770,9 +6770,17 @@ Just recall that we need to specify the number of inputs
into the stacking opera
@example
$ numimgs=$(echo outer/stamps/*.fits | wc -w)
$ astarithmetic outer/stamps/*.fits $numimgs 3 0.2 sigclip-mean \
- -g1 --output=outer/stack.fits --wcsfile=none
+ -g1 --output=outer/stack.fits --wcsfile=none --writeall
@end example
+Now opent the output of the stack image with following command.
+
+@example
+$ astscript-fits-view outer/stack.fits
+@end example
+
+The first extension represents the stack's output, whereas the second
extension indicates the number of images included in the final stack in each
pixel due to the @option{--writeall} option.
+
@noindent
Did you notice the @option{--wcsfile=none} option above?
With it, the stacked image no longer has any WCS information.
@@ -6847,7 +6855,7 @@ $ asttable inner/67510-12-13.fits \
$ numimgs=$(echo inner/stamps/*.fits | wc -w)
$ astarithmetic inner/stamps/*.fits $numimgs 3 0.2 sigclip-mean \
- -g1 --output=inner/stack.fits --wcsfile=none
+ -g1 --output=inner/stack.fits --wcsfile=none --writeall
$ astscript-fits-view inner/stack.fits inner/stamps/*.fits
@end example
@@ -6982,8 +6990,8 @@ Also, remove the temporary directory used previously.
$ mkdir uniting
$ rm -r stack_psfmodelscalefactor
$ astscript-psf-scale-factor outer/stack.fits \
- --psf=inner/stack.fits --center=501,501 \
- --mode=img --normradii=10,15 --output=uniting/scale.txt --quiet
+ --psf=inner/stack.fits --center=501,501 --quiet \
+ --mode=img --normradii=10,15 --output=uniting/scale.txt
$ cat uniting/scale.txt
@end example
@@ -6996,10 +7004,9 @@ To do that, we will use the script
@file{astscript-psf-unite} with the command b
The basic parameters are the inner part of the PSF (given to
@option{--inner}), the inner part's scale factor (@option{--scale}), and the
junction radius (@option{--radius}).
The inner part is first scaled, and all the pixels of the outer image within
the given radius are replaced with the pixels of the inner image.
Since the flux factor was computed for a ring of pixels between 10 and 15
pixels, let's set the junction radius to be 12 pixels (roughly in between 10
and 15):
-Note that we need to avoid the header line (that starts with "#") and get only
the first column (the scaling factor), to do that we use AWK.
@example
-scale=$(cat uniting/scale.txt | awk '!/^#/{print $1}')
+$ scale=$(cat uniting/scale.txt | awk '!/^#/@{print $1@}')
$ astscript-psf-unite outer/stack.fits \
--inner=inner/stack.fits --radius=12 \
--scale=$scale --output=psf.fits
@@ -7024,10 +7031,11 @@ The last command will open the two PSFs together in
DS9, you should be able to i
@example
$ astscript-psf-scale-factor outer/stack.fits \
- --psf=inner/stack.fits --center=501,501 \
- --mode=img --normradii=50,60 --output=uniting/scale-bad.txt
--quiet
+ --mode=img --normradii=50,60 \
+ --output=uniting/scale-bad.txt --quiet \
+ --psf=inner/stack.fits --center=501,501
-scale_bad=$(cat uniting/scale-bad.txt | awk '!/^#/{print $1}')
+$ scale_bad=$(cat uniting/scale-bad.txt | awk '!/^#/@{print $1@}')
$ astscript-psf-unite outer/stack.fits \
--inner=inner/stack.fits --radius=55 \
--scale=$scale_bad --output=psf-bad.fits
@@ -7085,7 +7093,7 @@ With the following command we obtain the coordinates (RA
and DEC) of the fainter
$ mkdir single-star
$ center=$(asttable outer/67510-6-10.fits --sort phot_g_mean_mag \
--column=ra,dec --tail 1 \
- | awk '{printf "%.8f,%.8f", $1, $2}')
+ | awk '@{printf "%.8f,%.8f\n", $1, $2@}')
$ echo $center
@end example
@@ -7098,7 +7106,7 @@ $ astscript-psf-scale-factor label/67510-seg.fits \
--center=$center \
--normradii=10,15 \
--segment=label/67510-seg.fits \
- --output=single-star/scale.txt
+ --output=single-star/scale.txt
@end example
Let's have a look at the file generated, it contains three columns.
@@ -7130,7 +7138,7 @@ $ astscript-fits-view label/67510-seg.fits
single-star/subtracted.fits \
@end example
After opening the two images at the same time, you will realize that the star
at the center has been modeled and subtracted.
-There are some residuals that remains as par of the natural subtraction
because the PSF is an averaged model of several stars, while each star has a
particular shape.
+There are some residuals that remains as part of the natural subtraction
because the PSF is an averaged model of several stars, while each star has a
particular shape.
But so far, with just a few stars we have been able to model this star and
subtract it quite accurately.
Now, let's see a couple of interesting parameters that we skip in the steps
above.
@@ -7146,7 +7154,9 @@ The pixel scale of this image is 0.55 arcsec/pixel, so
with the line below we sh
@example
$ original_center=$center
-$ modified_center=$(echo $center | awk -F',' '@{printf "%.8f,%.8f",
$1+0.55/3600.0, $2@}')
+$ modified_center=$(echo $center \
+ | awk -F',' '@{printf "%.8f,%.8f\n", \
+ $1+0.55/3600.0, $2@}')
$ echo $original_center
$ echo $modified_center
@@ -7163,7 +7173,8 @@ $ astscript-psf-subtract label/67510-seg.fits \
--center=$modified_center \
--output=single-star/subtracted-modified-center.fits
-$ astscript-fits-view single-star/subtracted.fits
single-star/subtracted-modified-center.fits \
+$ astscript-fits-view single-star/subtracted.fits \
+ single-star/subtracted-modified-center.fits \
--ds9center=$center --ds9mode=wcs --ds9extra="-zoom 4"
@end example
@@ -7174,7 +7185,7 @@ Which one is a better subtraction?
It is difficult to say because they are very similar.
In fact, since this is a real observation, there is not such thing as the
correct center of the star, but different centers computed using different
techniques (Gaia, NoiseChisel+Segment+Catalog), etc.
To select the best value we could shift the center position along the x and y
directions several times, make the subtraction of all of them, and finally
check which one gives the "better subtraction".
-This is actually the goal of the options @options{--xshift} and
@option{--yshifts}.
+This is actually the goal of the options @option{--xshift} and
@option{--yshifts}.
These two options allow you to consider shifts along the two axis for the
center position in the computation of the scaling flux factor.
Let's see this in practice.
@@ -7219,9 +7230,9 @@ Take them with the following lines.
In order to avoid the first line that is the header (starting with a #), we
use AWK.
@example
-$ scale=$(cat single-star/scale-shifts.txt | awk '!/^#/{print $1}')
-$ xcenter=$(cat single-star/scale-shifts.txt | awk '!/^#/{print $2}')
-$ ycenter=$(cat single-star/scale-shifts.txt | awk '!/^#/{print $3}')
+$ scale=$(cat single-star/scale-shifts.txt | awk '!/^#/@{print $1@}')
+$ xcenter=$(cat single-star/scale-shifts.txt | awk '!/^#/@{print $2@}')
+$ ycenter=$(cat single-star/scale-shifts.txt | awk '!/^#/@{print $3@}')
@end example
Once we got the necessary parameters, it is possible to subtract the star, but
this time with the shifted (and hopefully better) position.
@@ -7235,7 +7246,8 @@ $ astscript-psf-subtract label/67510-seg.fits \
--center=$xcenter,$ycenter \
--output=single-star/subtracted-shifted.fits
-$ astscript-fits-view single-star/subtracted.fits
single-star/subtracted-shifted.fits \
+$ astscript-fits-view single-star/subtracted.fits \
+ single-star/subtracted-shifted.fits \
--ds9center=$center --ds9mode=wcs --ds9extra="-zoom 4"
@end example
@@ -7261,7 +7273,7 @@ $ astscript-psf-scale-factor label/67510-seg.fits \
--center=$center \
--normradii=10,15 \
--segment=label/67510-seg.fits \
- --output=single-star/scale.txt
+ --output=single-star/scale.txt
$ scale=$(cat single-star/scale.txt | awk '!/^#/@{print $1@}')
@@ -7297,8 +7309,9 @@ We had 8 images for the outer part, so the S/N has only
improved by a factor of
When we multiply the final stacked PSF with 19, we are also scaling up the
noise by that same factor (most importantly: in the outer most regions where
there is almost no signal).
So the stacked image's noise-level is @mymath{19/3=6.3} times larger than the
noise of the input image.
This terrible noise-level is what you clearly see as the footprint of the PSF.
+In this case, to address the issue, we require additional stars to create the
outer part of the PSF and resolve the problem.
-To confirm this, let's use the commands below to subtract the faintest of the
bright-stars catalog (note the use of @option{--tail} when finding the central
position).
+Let's use the commands below to subtract the faintest of the bright-stars
catalog (note the use of @option{--tail} when finding the central position).
You will notice that the scale factor (@mymath{\sim1.3}) is now smaller than 3.
So when we multiply the PSF with this factor, the PSF's noise level is lower
than our input image and we should not see any footprint like before.
Note also that we are using a larger zoom factor, because this star is smaller
in the image.
- [gnuastro-commits] master 5671d24d 07/11: psf-stamp: creating the stamps by Warp instead of Crop, (continued)
- [gnuastro-commits] master 5671d24d 07/11: psf-stamp: creating the stamps by Warp instead of Crop, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master 844fe9f2 08/11: Book: adding new information to the PSF subtraction tutorial, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master 32e46fb6 02/11: psf-scale-factor: estimating a better center position, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master c85f8100 04/11: psf-subtract: positioning the PSF image by Warp instead of Crop, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master 365c926f 09/11: Book: adding the new PSF script features into the options information, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master fca894c0 01/11: psf-scale-factor: image and PSF are cropped using Warp instead of Crop, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master 694e60a4 05/11: psf-scale-factor: considering a background value in the scaling of the PSF, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master cad6503d 11/11: psf-scale-factor: minor stylistic polishing, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master 60a2a2ed 06/11: psf-scale-factor: improving the efficiency of the background estimation, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master 2c7758e6 03/11: psf-scale-factor: checking that x and y-shifts inputs, Mohammad Akhlaghi, 2024/05/17
- [gnuastro-commits] master d6063f52 10/11: Book: some parts PSF section with new scale-factor are changed,
Mohammad Akhlaghi <=