[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master a9c73da 1/3: Radial profile: new an undersampl
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master a9c73da 1/3: Radial profile: new an undersampling option |
Date: |
Thu, 15 Jul 2021 15:03:26 -0400 (EDT) |
branch: master
commit a9c73da5053199a649b19ccfb191588290bbee1f
Author: Zahra Sharbaf <zahra.sharbaf2@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Radial profile: new an undersampling option
Until now, to create an aperture image and do the calculation, the actual
pixel size of the image was just considered.
With this commit, one block of code has been added, which allows the user
to define the bin size as the number of pixels and do the calculation
through the rebinned image.
---
bin/script/radial-profile.in | 31 ++++++++++++++++++++++++++-----
doc/gnuastro.texi | 4 ++++
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index 39cd6de..0abe0ed 100755
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -96,6 +96,7 @@ $scriptname options:
-p, --positionangle=FLT Position angle for ellipse profiles.
-s, --sigmaclip=FLT,FLT Sigma-clip multiple and tolerance.
--zeropoint=FLT Zeropoint magnitude of input dataset.
+ --undersample=INT Number of pixels to consider for re-binning.
Output:
-t, --tmpdir Directory to keep temporary files.
@@ -216,6 +217,7 @@ do
-s=*|--sigmaclip=*) sigmaclip="${1#*=}"; check_v
"$1" "$sigmaclip"; shift;;
-s*) sigmaclip=$(echo "$1" | sed -e's/-s//'); check_v
"$1" "$sigmaclip"; shift;;
--zeropoint=*) zeropoint="${1#*=}"; check_v
"$1" "$zeropoint"; shift;;
+ --undersample=*) undersample="${1#*=}"; check_v
"$1" "$undersample"; shift;;
# Output parameters
-k|--keeptmp) keeptmp=1; shift;;
@@ -286,7 +288,7 @@ if [ x"$center" != x ]; then
fi
fi
-# Make sure the value to '--mode' is either 'wcs' or 'img'.
+# Make sure the value to '--mode' is either 'wcs' or 'img'.
if [ $mode = "wcs" ] || [ $mode = "img" ]; then
junk=1
else
@@ -546,6 +548,20 @@ astarithmetic $aperturesraw set-i \
+# Re-bin the aperture image if necessary
+# -------------------------
+#
+# The re-binning scenario is done if the user asked.
+rebinapertures=$tmpdir/rebin-apertures.fits
+if [ x"$undersample" != x ]; then
+ astarithmetic $apertures $undersample / -o$rebinapertures
+ cp $rebinapertures $apertures
+fi
+
+
+
+
+
# Extract each measurement column(s)
# ----------------------------------
#
@@ -599,17 +615,22 @@ astmkcatalog $apertures -h1 --valuesfile=$values
--valueshdu=1 --ids \
# The raw MakeCatalog output isn't clear for the users of this script (for
# example the radius column is called 'OBJ_ID'!). Also, when oversampling
# is requested we need to divide the radii by the over-sampling factor.
+# Also, when re-binning(undersampling) is requested we need to multiple the
+# radii by the undersample factor.
#
# But before anything, we need to set the options to print the other
# columns untouched (we only want to change the first column).
restcols=$(astfits $cat -h1 \
| awk '/^TFIELDS/{for(i=2;i<=$3;++i) printf "-c%d ", i}')
-if [ x"$oversample" = x ]; then
- asttable $cat -c'arith OBJ_ID float32 1 -' $restcols -o$output \
- --colmetadata=1,RADIUS,pix,"Radial distance"
-else
+if [ x"$oversample" != x ]; then
asttable $cat -c'arith OBJ_ID float32 '$oversample' /' $restcols \
-o$output --colmetadata=ARITH_2,RADIUS,pix,"Radial distance"
+elif [ x"$undersample" != x ]; then
+ asttable $cat -c'arith OBJ_ID float32 '$undersample' x' $restcols \
+ -o$output --colmetadata=ARITH_2,RADIUS,pix,"Radial distance"
+else
+ asttable $cat -c'arith OBJ_ID float32 1 -' $restcols -o$output \
+ --colmetadata=1,RADIUS,pix,"Radial distance"
fi
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 9bda624..56e05f1 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -22051,6 +22051,10 @@ Oversample the input dataset to the fraction given to
this option.
Therefore if you set @option{--rmax=20} for example and
@option{--oversample=5}, your output will have 100 rows (without
@option{--oversample} it will only have 20 rows).
Unless the object is heavily undersampled (the pixels are larger than the
actual object), this method provides a much more accurate result and there are
sufficient number of pixels to get the profile accurately.
+@item --undersample=INT
+Undersample the input dataset.
+If you define this option, the size which gave to this option considers as a
re-bin size to do rebinning and do the calculation on the rebinned image, which
allow you to decrease the noise.
+
@item --instd=FLT/STR
Sky standard deviation as a single number (FLT) or as the filename (STR)
containing the image with the std value for each pixel (the HDU within the file
should be given to the @option{--stdhdu} option mentioned below).
This is only necessary when the requested measurement (value given to
@option{--measure}) by MakeCatalog needs the Standard deviation (for example
the signal-to-noise ratio or magnitude error).