[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 4f3d70d 20/32: Binning data in some case
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 4f3d70d 20/32: Binning data in some case |
Date: |
Wed, 24 Feb 2021 22:36:18 -0500 (EST) |
branch: master
commit 4f3d70d21c8e35d9e30b48ebcdaa0494437ab9f3
Author: Zahra Sharbaf <zahra.sharbaf2@gmail.com>
Commit: Zahra Sharbaf <zahra.sharbaf2@gmail.com>
Binning data in some case
With this commit, I did some small change to do binning the data for the
time that user set binning variable except 1.
---
bin/script/radial-profile.in | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index 8f5559e..b192ecc 100644
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -398,23 +398,27 @@ astmkcatalog $aperturesfits -h1 --valuesfile=$inputs
--valueshdu=$hdu \
# ------------
#
# In order to increase the signal-to-noise ratio of the radial profile, it
-# is possible to bin the data. It is done in any case, if the user has not
-# changed the default value, the binning will be equal to 1 so the output
-# binned will be the same as the input. To do the binning of the data, a
-# small Awk script is used. Since the Awk script will print the columns as
-# float values, it is necessary to change the headers. To do that, Sed is
-# used to replace all ocurrences of i32 to f32.
+# is possible to bin the data. It is done in any case, if the user set the
+# default value of binning variable($b) except 1, because the binning will
+# be equal to 1 so the output binned will be the same as the input. To do
+# the binning of the data, a small Awk script is used. Since the Awk script
+# will print the columns as float values, it is necessary to change the
+# headers. To do that, Sed is used to replace all ocurrences of i32 to f32.
bprofile=$(echo $output | sed -e"s|.fits|_binned.fits|g")
-asttable $fprofile \
- | awk -v b=$b '/^#/{print} BEGIN { N = b }
{ for (i = 1; i <= 2; i++)
sum[i] += $i}
- { for (i = 3; i == 3; i++) sum[i] = $i ** 2 / $i ** 0.5}
+if [ $b != 1 ]; then
+
+ asttable $fprofile \
+ | awk -v b=$b '/^#/{print} BEGIN { N = b }
{ for (i = 1; i <= 2; i++) sum[i] += $i}
+ { for (i = 3; i == 3; i++) sum[i] += $i ** 2}
NR % N == 0 { for (i = 1; i <= NF; i++)
{
printf("%.6f%s",sum[i]/N, ( i == NF) ? "\n" : " ")
sum[i] = 0
}
}' | asttable -o$bprofile
-
+else
+ cp $fprofile $bprofile
+fi
- [gnuastro-commits] master 7eac053 03/32: astscript-radial-profile: improving comments and information, (continued)
- [gnuastro-commits] master 7eac053 03/32: astscript-radial-profile: improving comments and information, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 4e019cb 05/32: astscript-radial-profile: fixing some bugs and modifying metadata, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master dd4f925 06/32: astscript-radial-profile: adding documentation to the GNUASTRO book, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 5e84045 04/32: astscript-radial-profile: allowing to manipulate the final profile, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 82f8176 08/32: astscript-radial-profile: adding usage example to GNUASTRO book, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 0634f04 14/32: Book: describing remaining options of radial profile script, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 2f2970f 09/32: Adding Vim .swp temporal files to .gitignore, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 3fcd49a 10/32: astscript-radial-profile: setting name and version from the compilation, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master ebab496 15/32: Book: changed the place of radial profile script documentation, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 6400ca4 16/32: Some minor correction in description, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master 4f3d70d 20/32: Binning data in some case,
Mohammad Akhlaghi <=
- [gnuastro-commits] master b36c21f 17/32: astscript-radial-profile: modification to use $ instead of c in Table, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master e24caa6 07/32: astscript-radial-profile: user can now specify output column names, Mohammad Akhlaghi, 2021/02/24
- [gnuastro-commits] master e1ded16 11/32: Book: minor typos and corrections in radial profile script examples, Mohammad Akhlaghi, 2021/02/24
- [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