[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 1072b2b 02/32: astscript-radial-profile: added
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 1072b2b 02/32: astscript-radial-profile: added the option -b for binning the data |
Date: |
Wed, 24 Feb 2021 22:36:14 -0500 (EST) |
branch: master
commit 1072b2b24936ad7d9c1f91664df42c23f7fdc5e2
Author: Raul Infante-Sainz <infantesainz@gmail.com>
Commit: Raul Infante-Sainz <infantesainz@gmail.com>
astscript-radial-profile: added the option -b for binning the data
Until this commit, the radial profiles were obtained in a pixel scale.
That is good for high resolution but sometimes it is necessary to have a
bigger bin size in order to increase the signal to noise ratio
(specially as far as you go from the center).
With this commit, this has been solved by averaging the already obtained
radial profiles in bins of a given size. To do that, a small `awk' code
has been included. Now, the script reads the bin size with the parameter
`-b', and gives as output a binned radial profile. Based on this post:
https://stackoverflow.com/a/30353074
---
bin/script/radial-profile.in | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index 4c4a75a..806dad5 100644
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -41,6 +41,7 @@ y=center
m=median
Q=0
p=0
+b=1
w=1
k=1
quiet=0
@@ -96,12 +97,12 @@ $scriptname options:
-Q, --qratio=FLT Axis ratio for ellipse apertures (A/B).
-p, --pangle=FLT Position angle for ellipse apertures.
-m, --measure=STR Operator for measuring the parameter (mean, median,
etc.).
+ -b, --binning=INT Size of the bin for averaging group of pixels.
-a, --cprofiles=STR Configuration file for astmkprof.
-c, --ccatalog=STR Configuration file for astmkcatalog.
Output:
-k, --keeptemp Keep temporal/auxiliar files.
- -k, --keeptemp Keep temporal/auxiliar files.
Operating mode:
-h, --help Print this help list.
@@ -216,6 +217,9 @@ do
-m|--measure) m="$2"; check_v "$1" "$m";
shift;shift;;
-m=*|--measure=*) m="${1#*=}"; check_v "$1" "$m";
shift;;
-m*) m=$(echo "$1" | sed -e's/-m//'); check_v "$1" "$m";
shift;;
+ -b|--binning) b="$2"; check_v "$1" "$b";
shift;shift;;
+ -b=*|--binning=*) b="${1#*=}"; check_v "$1" "$b";
shift;;
+ -b*) b=$(echo "$1" | sed -e's/-b//'); check_v "$1" "$b";
shift;;
-a|--caper) a="$2"; check_v "$1" "$a";
shift;shift;;
-a=*|--caper=*) a="${1#*=}"; check_v "$1" "$a";
shift;;
-a*) a=$(echo "$1" | sed -e's/-a//'); check_v "$1" "$a";
shift;;
@@ -309,21 +313,36 @@ astmkprof $aperturestxt --background=$inputs
--backhdu=$hdu \
# Construct the catalogue <-> Radial profile
fprofiles=$(echo $output | sed -e"s|.fits|-profile_"$mode"_$x-$y.fits|g")
-astmkcatalog $aperturesfits -h1 --valuesfile=$inputs -o$output \
+astmkcatalog $aperturesfits -h1 --valuesfile=$inputs -o$fprofiles \
--ids --$m --config=$c
+
+# Binning data
+asttable $fprofiles | awk -v b=$b 'BEGIN { N = b }
+ { for (i = 1; i <= NF; i++) sum[i] += $i }
+ NR % N == 0 { for (i = 1; i <= NF; i++)
+ {
+ printf("%.6f%s", sum[i]/N, (i == NF) ? "\n" : " ")
+ sum[i] = 0
+ }
+ }' | asttable -o$output
+
+
+
+
+
# Remove temporal files if the user has specified this option
if [ $k = 1 ]; then
- rm $aperturestxt $aperturesfits
+ rm $aperturestxt $aperturesfits $fprofiles
fi
-
+# Additional code for making surface brightness profiles. Not working yet
#zp=$(astfits $inputs -h$hdu | grep -w ZP | awk '{print $3}')
#pscale=0.389
#muprofile=$(echo $inputs | sed -e"s|.fits|-sbprofile_"$mode"_$x-$y.fits|g")
- [gnuastro-commits] master 87d68b0 12/32: astscript-radial-profile: removing --rmin option because it is not used, (continued)
- [gnuastro-commits] master 87d68b0 12/32: astscript-radial-profile: removing --rmin option because it is not used, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master aec3057 13/32: Book: describing most important options of radial profile script, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 1b505d1 21/32: Binning the S/N column, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 4294506 32/32: astscript-radial-profile: polished the script and book, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master ad7fb58 26/32: Central coordinates of the cropped image, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master d085379 22/32: Radial-profile script documentation, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 8089ea3 27/32: astscript-radial-profile: Samaeh's changes included, conflicts fixed, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 04a8bec 29/32: Book: simplifying documentation of astscript-radial-profile, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 362819c 30/32: astscript-radial-profile: fixed bug when creating the temporal directory, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master c9647b5 31/32: Imported work on the radial profile script, minor conflict fixed, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 1072b2b 02/32: astscript-radial-profile: added the option -b for binning the data,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 87f5383 23/32: astscript-radial-profile: minor corrections of previous commits, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master e41c2e4 24/32: astscript-radial-profile: sigma clip parameters for measurements added, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 337e46d 18/32: The half-light radii, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 2df5a22 19/32: Signal to noise ratio for each radius, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 846fc39 25/32: Radial profile script modifications, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 8e5ab9e 28/32: astscript-radial-profile: simplifying the script, Mohammad Akhlaghi, 2021/02/24