[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master c484fc5: CosmicCalculator: --setdirconf and --
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master c484fc5: CosmicCalculator: --setdirconf and --setuserconf work with no redshift |
Date: |
Sat, 10 Apr 2021 14:33:32 -0400 (EDT) |
branch: master
commit c484fc5ad7952ab30d6aad4797068dd019ce1814
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
CosmicCalculator: --setdirconf and --setuserconf work with no redshift
Until now, when either of these two options was given without the redshift,
CosmicCalculator would crash, complaining that there is no redshift. But
these operations don't need any redshift!
With this commit, the check (to see if redshift/velocity) has been given or
not, is been moved after all low-level option-related actions have been
done (in 'ui_preparations'). Because options like '--printparams',
'--setdirconf' or '--setuserconf' abort the program immediately after they
finish. So when the program reaches 'ui_preparations', there is no need to
worry about them any more (they haven't been called).
This fixes bug #60368.
This bug was reported by Sepideh Eskandarlou.
---
NEWS | 1 +
bin/cosmiccal/ui.c | 23 +++++++++++------------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/NEWS b/NEWS
index 7a5ac38..f3e7fea 100644
--- a/NEWS
+++ b/NEWS
@@ -180,6 +180,7 @@ See the end of the file for license conditions.
** Bugs fixed
bug #60082: Arithmetic library crash for integer operators like modulo
bug #60121: Arithmetic segfault when multi-operand output given to set-
+ bug #60368: CosmicCalculator fails --setdirconf when redshift isn't given
diff --git a/bin/cosmiccal/ui.c b/bin/cosmiccal/ui.c
index 5d516ec..641dc98 100644
--- a/bin/cosmiccal/ui.c
+++ b/bin/cosmiccal/ui.c
@@ -398,18 +398,6 @@ ui_read_check_only_options(struct cosmiccalparams *p)
error(EXIT_FAILURE, 0, "'--listlines' and '--listlinesatz' can't be "
"called together");
- /* Make sure that atleast one of '--redshift', '--obsline', or
- '--velocity' are given (different ways to set/estimate the
- redshift). However, when '--listlines' and/or '--printparams' are
- called (i.e., when they have a non-zero value) we don't need a
- redshift all and the program can run without any of the three options
- above. */
- if(isnan(p->redshift) && p->obsline==NULL && isnan(p->velocity)
- && p->listlines==0 && p->cp.printparams==0)
- error(EXIT_FAILURE, 0, "no redshift/velocity specified! Please use "
- "'--redshift', '--velocity' (in km/s), or '--obsline' to specify "
- "a redshift, run with '--help' for more");
-
/* Make sure that '--redshift' and '--obsline' aren't called together. */
if( (hasredshift + hasvelocity + hasobsline) > 1 )
error(EXIT_FAILURE, 0, "only one of '--redshift', '--velocity', or "
@@ -477,6 +465,17 @@ ui_preparations(struct cosmiccalparams *p)
{
double *obsline = p->obsline ? p->obsline->array : NULL;
+ /* Make sure that atleast one of '--redshift', '--obsline', or
+ '--velocity' are given (different ways to set/estimate the
+ redshift). However, when '--listlines' is called we don't need a
+ redshift and the program can run without any of the three options
+ above. */
+ if(isnan(p->redshift) && p->obsline==NULL && isnan(p->velocity)
+ && p->listlines==0 )
+ error(EXIT_FAILURE, 0, "no redshift/velocity specified! Please use "
+ "'--redshift', '--velocity' (in km/s), or '--obsline' to specify "
+ "a redshift, run with '--help' for more");
+
/* If '--listlines' is given, print them and abort the program
successfully, don't continue with the preparations. Note that
'--listlines' is the rest-frame lines. So we don't need any
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master c484fc5: CosmicCalculator: --setdirconf and --setuserconf work with no redshift,
Mohammad Akhlaghi <=