[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 8f7c582: CosmicCalculator: fix bug in calling
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 8f7c582: CosmicCalculator: fix bug in calling --printparams |
Date: |
Mon, 23 Nov 2020 13:58:12 -0500 (EST) |
branch: master
commit 8f7c58270acf6c5565338c28fdc24784cdff9cf1
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
CosmicCalculator: fix bug in calling --printparams
Until now, when CosmicCalculator was called with the '--printparams' or
'-P' option it aborted with an error about not setting the redshift. Whilst
the redshift value is not mandatory when the user is asking for checking
the configured parameters.
With this commit, a condition has been added on the check for redshifts at
the start of the program to let the program continue.
This fixes bug #59400.
---
NEWS | 1 +
bin/cosmiccal/ui.c | 13 ++++++++-----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 1bd79f5..8623e68 100644
--- a/NEWS
+++ b/NEWS
@@ -148,6 +148,7 @@ See the end of the file for license conditions.
bug #59136: Makeprofiles with --replace is not thread-safe.
bug #59155: Match cannot find the proper row when coordinates have NaN.
bug #59371: MakeCatalog crash with clumps on non-contiguous object labels.
+ bug #59400: CosmicCalculator fails --printparams when redshift isn't given.
diff --git a/bin/cosmiccal/ui.c b/bin/cosmiccal/ui.c
index 5d77c93..93c85ca 100644
--- a/bin/cosmiccal/ui.c
+++ b/bin/cosmiccal/ui.c
@@ -398,11 +398,14 @@ 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 for the running redshift. Except when '--listlines' is used
- (that doesn't need any redshift). */
- if(isnan(p->redshift) && isnan(p->velocity) && p->obsline==NULL
- && p->listlines==0)
+ /* 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");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 8f7c582: CosmicCalculator: fix bug in calling --printparams,
Mohammad Akhlaghi <=