[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master f3e87321: astscript-radial-profile: dealing wi
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master f3e87321: astscript-radial-profile: dealing with all possible azimuth angle values |
Date: |
Wed, 28 Feb 2024 07:03:05 -0500 (EST) |
branch: master
commit f3e87321c85342c28d7bdb2cb0bab356bd13133e
Author: Raul Infante-Sainz <infantesainz@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
astscript-radial-profile: dealing with all possible azimuth angle values
Until now, when providing azimuth angles that were not in the range 0-360
deg, the script provided wrong results. For example, when providing
--azimuth=337,367, it creates the wedgle between 337-360 degrees. So, it
stops the wedgle at 360 degrees. Same would happen with negative or
arbitrary large angle values.
With this commit, a function is added to correct the input azimuthal range
in case it is outside the range of 0 to 360 degrees before any further
azimuthal angle work is done.
This bug was reported by Fernando Buitrago Alonso.
This fixes bug #65382.
---
NEWS | 4 ++++
bin/script/radial-profile.sh | 19 ++++++++++++++++---
doc/announce-acknowledge.txt | 1 +
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index a21fb5ff..a586a9fb 100644
--- a/NEWS
+++ b/NEWS
@@ -131,6 +131,10 @@ See the end of the file for license conditions.
negative values (and MakeCatalog crashes) is wrong. Reported by Zahra
Sharbaf.
+ - bug #65382: Radial profile script truncates the azimuthal angle when
+ the maximum requested azimuthal range is above 360 degrees. Reported by
+ Fernando Buitrago Alonso and fixed by Raul Infante-Sainz.
+
diff --git a/bin/script/radial-profile.sh b/bin/script/radial-profile.sh
index d69a351b..8ac1a70e 100644
--- a/bin/script/radial-profile.sh
+++ b/bin/script/radial-profile.sh
@@ -700,9 +700,22 @@ aperturesrawbase=apertures-raw.fits
aperturesraw=$tmpdir/$aperturesrawbase
if [ x"$azimuth" != x ]; then
+ # Function to normalize angles to the range [0, 360) For example, if
+ # --azimuth=337,367, then the angle to be used should be azimuth=337,7.
+ # Here, this conversion is done. Negative angles are also considered.
+ transform_angle() {
+ angle=$1
+ new_angle=$(awk "BEGIN { print ($angle % 360 + 360) % 360 }")
+ echo $new_angle
+ }
+
# Get the initial and final azimuth angles
- azimuth_ini=$(echo "$azimuth" | awk 'BEGIN{FS=","} {print $1}')
- azimuth_fin=$(echo "$azimuth" | awk 'BEGIN{FS=","} {print $2}')
+ raw_azimuth_ini=$(echo "$azimuth" | awk 'BEGIN{FS=","} {print $1}')
+ raw_azimuth_fin=$(echo "$azimuth" | awk 'BEGIN{FS=","} {print $2}')
+
+ # Transform the azimuth angles to [0, 360) range
+ azimuth_ini=$(transform_angle $raw_azimuth_ini)
+ azimuth_fin=$(transform_angle $raw_azimuth_fin)
# Generate the azimuthal apertures
azimuthaperturesbase=azimuth-raw.fits
@@ -723,7 +736,7 @@ if [ x"$azimuth" != x ]; then
# the regions of each angle so the user gets the region between the
# two angles.
#
- # - The first is smaller than the second (for example
+ # - The first is greater than the second (for example
# '--azimuth=355,5') In this case, we assume that the user wants an
# azimuthal range outside the two angles. In the example above, its
# the 10 degrees around the azimuthal angle 0. For this case, we
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 25216c7f..463ccf07 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,6 +1,7 @@
Alphabetically ordered list to acknowledge in the next release.
Dennis Williamson
+Fernando Buitrago Alonso
Greg Wooledge
Hamed Altafi
Jesús Vega
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master f3e87321: astscript-radial-profile: dealing with all possible azimuth angle values,
Mohammad Akhlaghi <=