[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 96137885 09/39: Zeropoint: keep Mag-vs-Zeropoi
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 96137885 09/39: Zeropoint: keep Mag-vs-Zeropoint for best aperture in output |
Date: |
Wed, 19 Apr 2023 12:18:23 -0400 (EDT) |
branch: master
commit 96137885426be82afcdbe9cf173154ed3e1bfff4
Author: Sepideh Eskandarlou <sepideh.eskandarlou@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Zeropoint: keep Mag-vs-Zeropoint for best aperture in output
Until now, if the user did not use the '--keepzpap' option best aperture
and its zeropoint just was written in header of output. Although, for input
image we did not consider any value for the input Zeropoint.
With this commit, even if user do not use the '--keepzpap' option the
Magnitude versus Zeropoint table is saved in the second extension of the
output. On the other hand, in making the catalog Zeropoint of the input
image consider as zero.
---
bin/script/zeropoint.in | 20 +++++++++++++-------
bin/script/zeropoint.mk | 44 +++++++++++++++++++++++++++++++++-----------
2 files changed, 46 insertions(+), 18 deletions(-)
diff --git a/bin/script/zeropoint.in b/bin/script/zeropoint.in
index f52b76ac..0bb04f80 100644
--- a/bin/script/zeropoint.in
+++ b/bin/script/zeropoint.in
@@ -388,10 +388,11 @@ fi
# At first the user wants to compute the Zeropoint for input image based on
# the images or catalog.
config=$tmpdir/zeropoint.conf
-echo "input = $inputs" > $config
-echo "output =$output" >> $config
-echo "hduinput = $hdu" >> $config
-echo "tmpdir = $tmpdir" >> $config
+echo "input = $inputs" > $config
+echo "output = $output" >> $config
+echo "hduinput = $hdu" >> $config
+echo "zpinput = 0" >> $config
+echo "tmpdir = $tmpdir" >> $config
# Obtain the magnitude range from the command line arguments.
if [ x$magnituderange = x ]; then
@@ -443,9 +444,9 @@ fi
# If user specify to keep the zeropoint of the different appeertures it
# will be saved in the different extension of the output.
if [ x"$keepzpap" = x ]; then
- echo "zeropointap = " >> $config
+ echo "keepzpap = " >> $config
else
- echo "zeropointap = keep" >> $config
+ echo "keepzpap = keep" >> $config
fi
@@ -453,7 +454,12 @@ fi
# Call the Makefile
-make -f zeropoint.mk tmpdir=$tmpdir
+if [ x$installdir = x ]; then
+ mksrc=zeropoint.mk
+else
+ mksrc=$installdir/zeropoint.mk
+fi
+make -f $mksrc tmpdir=$tmpdir
diff --git a/bin/script/zeropoint.mk b/bin/script/zeropoint.mk
index b3f4c22b..8a87552b 100644
--- a/bin/script/zeropoint.mk
+++ b/bin/script/zeropoint.mk
@@ -219,6 +219,7 @@ $(aperzeropoint): $(tmpdir)/zeropoint-%.txt: \
# Merge all the rows from all the reference images into one.
merged=$(subst .txt,-merged.fits,$@)
asttable $(tmpdir)/ref1-$*-magdiff.fits $$opts -o$$merged
+ astfits $$merged --update=EXTNAME,APER-$*
# If the user requested a certain magnitude range, use it.
rangeopt=""
@@ -243,6 +244,8 @@ $(aperzeropoint): $(tmpdir)/zeropoint-%.txt: \
# select the one with the least scatter.
zeropoint=$(output)
$(zeropoint): $(aperzeropoint)
+
+# Obtained the zeropoint and zeropoint std of each apertures.
zp=$(subst .fits,-tmp.txt,$@)
echo "# Column 1: APERTURE [arcsec,f32,]" > $$zp
echo "# Column 2: ZEROPOINT [mag,f32,]" >> $$zp
@@ -250,20 +253,39 @@ $(zeropoint): $(aperzeropoint)
for a in $(aper-arcsec); do
cat $(tmpdir)/zeropoint-$$a.txt >> $$zp
done
- asttable $$zp --output=$@.fits
- bestzpaper=$$(asttable $$zp --sort=ZPSTD --head=1 \
- --column=APERTURE,ZEROPOINT)
- astfits $@.fits --write=BESTAPZE,"$$bestzpaper","Beat aperture and
zeropoitn."
-
- if [ x"$(zeropointap)" = x ]; then
+# Find the best aperture and its zeropoint and write in the header of
+# the output.
+ asttable $$zp --output=$@.fits
+ bestaper=$$(asttable $$zp --sort=ZPSTD --head=1 --column=APERTURE)
+ bestzp=$$(asttable $$zp --sort=ZPSTD --head=1 --column=ZEROPOINT)
+ beststd=$$(asttable $$zp --sort=ZPSTD --head=1 --column=ZPSTD)
+ astfits $@.fits --write=/,"Zeropoint properties"
+ astfits $@.fits --write=ZPAPER,"$$bestaper","Best aperture."
+ astfits $@.fits --write=ZPVALUE,"$$bestzp","Best zeropoint."
+ astfits $@.fits --write=ZPSTD,"$$beststd","Best standard deviation of
zeropoint."
+
+ if [ x"$(keepzpap)" = x ]; then
+
+# The 'bestaper' above is returned from 'asttable', so (which is
+# saved as a floating point), so the extra digits in reading
+# floating points
+ for a in $(aper-arcsec); do
+ check=$$(echo $$a \
+ | awk -vb=$$bestaper \
+ '$$1>b-1e-6 && $$1<b+1e-6{print "yes"}')
+ if [ x$$check == xyes ]; then bestaperstr=$$a; fi
+ done
+
+# Move the main table to the output and copy the Mag-vs-Zeroppoint
+# plot for the best aperture.
+ astfits $(tmpdir)/zeropoint-$$bestaperstr-merged.fits --copy=1
-o$@.fits
mv $@.fits $@
else
- counter=1
- for i in $(aper-arcsec); do
- counter=$$((counter+1))
- astfits $(tmpdir)/zeropoint-$$i-merged.fits --copy=1 -o$@.fits
- astfits $@.fits -h$$counter --update=EXTNAME,APER-$$i
+# Move the main table to the output and copy the Mag-vs-Zeroppoint
+# plot for the whole aperture.
+ for a in $(aper-arcsec); do
+ astfits $(tmpdir)/zeropoint-$$a-merged.fits --copy=1 -o$@.fits
done
mv $@.fits $@
fi
- [gnuastro-commits] master dddb483f 01/39: zeropoint: First make file for obtainaing the zeropoint photometry, (continued)
- [gnuastro-commits] master dddb483f 01/39: zeropoint: First make file for obtainaing the zeropoint photometry, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master a841d3f2 02/39: zeropoint: catalogs can be used as reference, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 2c027224 08/39: Zeropoint: change the output file, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master ea79c2ba 14/39: Book: tutorial of zero point; removing the sky and running the script, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 48edcd91 13/39: Book: tutorial of zero point; preparing images for using the script, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 88b4c298 23/39: Book: tutorial of zero point; subsection catalog reference, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master aeb507b8 22/39: Book: correct the info format menus, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 069e12f4 24/39: Zeropoint: a bug about the matching of reference and main catalog, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master c4af3dfc 25/39: Book: tutorial of zero point; completing the catalog reference, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 536052fb 35/39: astscript-zeropoint: writting all receipes as in one shell, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 96137885 09/39: Zeropoint: keep Mag-vs-Zeropoint for best aperture in output,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 151e8bfc 20/39: Book: editing zero point estimation section, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 85a5ad67 21/39: zeropoint: using single equal instead of the double for checking, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master ea82d80a 29/39: Book: Use suggestive instead of imperative word, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 4bf867d3 26/39: Book: open imge by 'zscale' scale and options are written as code format, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 3cc85d96 34/39: astscript-zeropoint: new option --matchradius added, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 83e74d09 38/39: astscript-zeropoint: the name of some options are modified, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 21cd71bf 39/39: astscript-zeropoint: edits for merging into master branch, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 0fabd68e 30/39: Zeropoint: add an option for doing many jobs and check overlapping, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master 0e982706 33/39: astscript-zeropoint: polishing and improving the comments of the scripts, Mohammad Akhlaghi, 2023/04/19
- [gnuastro-commits] master fcf00960 37/39: astscript-zeropoint: Content of temorary file have been removed, Mohammad Akhlaghi, 2023/04/19