GNU Astronomy Utilities


Next: , Previous: , Up: Common program behavior   [Contents][Index]


4.4 Final parameter values, reproduce previous results

The input parameters can be specified in many places, either on the command-line or in at least one of several configuration files, see Configuration files. Therefore, it often happens that before running a program on a certain data set, you want to see the values for the parameters that the program will use after it has read your command-line options and all the configuration files in their correct order. You might also want to save the list with the output so you can reproduce the same results at a later time, this is very important when you want to use your results in a report or paper.

If you call the --printparams option, all Gnuastro programs will read your command-line parameters and all the configuration files. If there is no problem (like a missing parameter or a value in the wrong format) and immediately before actually running, the programs will print the full list of parameter names and values sorted and grouped by context and quit. They will also report their version number, the date they were configured on your system and the time they were reported.

As an example, you can give your full command-line options and even the input and output file names and finally just add -P to check if all the parameters are finely set. If everything is ok, you can just run the same command (easily retrieved from the bash history, with the top arrow key) and simply remove the last two characters that showed this option.

Since no program will actually start its processing when this option is called, the otherwise mandatory arguments for each program (for example input image or catalog files) are no longer required when you call this option.

In case you want to store the list of parameters for later reproduction of the same results, you can do so with the GNU Bash re-direction tool. For example after you have produced the results you want to store, you can save all the parameters that were used in a file named parameters.txt in the following manner. Using shell history you can retrieve the last command you entered and simply add -P > parameters.txt to it, for example:

$ astimgcrop --racol=2 --deccol=3 IN.fits cat.txt -P > parameters.txt

All the parameters along with the extra data explained before will be stored in the plain text parameters.txt file through the shell’s redirection mechanism (>). The output of --printparams conforms with the configuration file formats47. By taking the following steps, you can use this file as a configuration file to reproduce your results at a later time.

  1. Set the file name based on the standard configuration file names, see Configuration file format.
  2. Later on (when ever you want to re-produce your results), copy the file in the ./.gnuastro/ directory of your current directory.

In this manner, this file will be read as a current directory configuration file and since all the parameters are defined in it, no other configuration file value will be used.


Footnotes

(47)

They are both written by the same function.


Next: , Previous: , Up: Common program behavior   [Contents][Index]