gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 18c9823 094/125: Image created on second HDU,


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 18c9823 094/125: Image created on second HDU, common options to gnuastro.conf
Date: Sun, 23 Apr 2017 22:36:46 -0400 (EDT)

branch: master
commit 18c9823905d2ff85d121b262827ca4a3399a5616
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Image created on second HDU, common options to gnuastro.conf
    
    In the FITS standard, the primary HDU can only be an image. So when it
    makes tables, it puts them in the second HDU and makes a blank zero-sized
    first HDU before the table HDU. Since we are working on making all the
    programs work similarly on images and tables, this would easily confuse the
    users and make the programs hard to run.
    
    So now, when making a new FITS image, Gnuastro will also make a blank first
    HDU and then put the image in the next HDU. This has several great
    advantages besides the issue above: the user can use the blank header space
    to set any extra keywords they like. In the FITS standard a HDU must
    contain atleast 2880 characters or 36 keywords. There are 5 necessary
    keywords that must go in that space and CFITSIO puts two comments, so in
    total the user can put 36-7=29 keywords there without changing the file
    size! With the new Fits program (old name: Header), the user can write any
    extra information here. Another great side-effect is that when all the
    files follow this convention, then it will feel as though we are counting
    the HDUs from 1, not zero.
    
    Also, as part of this commit, the new file `lib/gnuastro.conf' file has
    been created which will also be installed as the system-wide common-option
    configuration file. So all the similar options in the program configuration
    files have been removed.
    
    Another strange thing was that until now the `gnuastro.conf' file would be
    read before each program's configuration file! This was contrary to the
    increasing generality principle behind the configuration files. So for
    example, if you wanted to use the `lastconfig' option for all the programs
    in one directory, you would have to put it in each programs config file! So
    now, it is reversed, and in each directory, first we read the program
    configuration file and then `gnuastro.conf'. So only one `lastconfig' in
    `gnuastro.conf' for example would be enough to stop all the programs from
    parsing other configuration files.
    
    Another small thing was that the `--quality' option of ConvertType wasn't
    initialized! So when it wasn't called the error message wasn't useful!
    
    Finally, `tests/prepconf.sh' and `tests/duringdev.sh' were also corrected
    to accommodate this change.
---
 bin/TEMPLATE/astTEMPLATE.conf              |  1 -
 bin/arithmetic/astarithmetic.conf          | 12 -----------
 bin/convertt/astconvertt.conf              |  4 +---
 bin/convertt/ui.c                          | 25 ++++++++++------------
 bin/convolve/astconvolve.conf              | 14 ++++++------
 bin/crop/astcrop.conf                      |  5 +----
 bin/crop/onecrop.c                         | 34 ++++++++++++++++++++----------
 bin/fits/astfits.conf                      |  5 -----
 bin/mkcatalog/astmkcatalog.conf            |  9 ++++----
 bin/mknoise/astmknoise.conf                |  4 +---
 bin/mkprof/astmkprof.conf                  |  7 +-----
 bin/noisechisel/astnoisechisel.conf        |  3 +--
 bin/statistics/aststatistics.conf          |  9 +-------
 bin/subtractsky/astsubtractsky.conf        |  3 +--
 bin/table/asttable.conf                    | 11 ----------
 bin/warp/astwarp.conf                      |  4 +---
 doc/gnuastro.texi                          | 16 +++++++-------
 lib/Makefile.am                            |  7 ++++++
 lib/fits.c                                 | 25 ++++++++++++++--------
 bin/warp/astwarp.conf => lib/gnuastro.conf | 15 +++++++------
 lib/options.c                              | 22 +++++++++----------
 tests/during-dev.sh                        | 10 ++++++---
 tests/prepconf.sh                          | 34 ++++++++----------------------
 23 files changed, 118 insertions(+), 161 deletions(-)

diff --git a/bin/TEMPLATE/astTEMPLATE.conf b/bin/TEMPLATE/astTEMPLATE.conf
index 2fef1e9..c26309b 100644
--- a/bin/TEMPLATE/astTEMPLATE.conf
+++ b/bin/TEMPLATE/astTEMPLATE.conf
@@ -18,6 +18,5 @@
 # without any warranty.
 
 # Input:
- hdu            0
 
 # Output:
\ No newline at end of file
diff --git a/bin/arithmetic/astarithmetic.conf 
b/bin/arithmetic/astarithmetic.conf
index f9db547..ddb6ad1 100644
--- a/bin/arithmetic/astarithmetic.conf
+++ b/bin/arithmetic/astarithmetic.conf
@@ -16,15 +16,3 @@
 # are permitted in any medium without royalty provided the copyright
 # notice and this notice are preserved.  This file is offered as-is,
 # without any warranty.
-
-# Input image:
- hdu            0
- hdu            0
- hdu            0
- hdu            0
- hdu            0
- hdu            0
- hdu            0
-
-# Output:
- minmapsize    1000000000
diff --git a/bin/convertt/astconvertt.conf b/bin/convertt/astconvertt.conf
index f0072bb..a2f7d42 100644
--- a/bin/convertt/astconvertt.conf
+++ b/bin/convertt/astconvertt.conf
@@ -18,7 +18,6 @@
 # without any warranty.
 
 # Input:
- hdu                  0
 
 # Output:
  quality              100
@@ -29,5 +28,4 @@
 # Flux:
  invert               0
 
-# Common options
- minmapsize           1000000000
\ No newline at end of file
+# Common options
\ No newline at end of file
diff --git a/bin/convertt/ui.c b/bin/convertt/ui.c
index 5a2298c..770d1be 100644
--- a/bin/convertt/ui.c
+++ b/bin/convertt/ui.c
@@ -124,6 +124,7 @@ ui_initialize_options(struct converttparams *p,
   cp->coptions           = gal_commonopts_options;
 
   /* Program specific non-zero values. */
+  p->quality             = UINT8_MAX;
   p->maxbyte             = UINT8_MAX;
 
   /* Edit the common options. */
@@ -226,15 +227,6 @@ ui_read_check_only_options(struct converttparams *p)
 {
   gal_data_t *cond;
 
-
-  /* Check if quality is smaller and equal to 100 (we already checked if it
-     was greater than zero before. */
-  if(p->quality>100)
-    error(EXIT_FAILURE, 0, "`%u' is larger than 100. The value to the "
-          "`--quality' (`-u') option must be between 1 and 100 (inclusive)",
-          p->quality);
-
-
   /* Read the truncation values into a data structure and see if flux low
      is indeed smaller than fluxhigh. */
   if(p->fluxlowstr)
@@ -656,14 +648,19 @@ ui_set_output(struct converttparams *p)
             "Please install it and configure, make and install %s "
             "again", PACKAGE_STRING, PACKAGE_STRING);
 #else
+      /* Small sanity checks. */
+      if(p->quality == UINT8_MAX)
+        error(EXIT_FAILURE, 0, "the `--quality' (`-u') option is necessary for 
"
+              "jpeg outputs, but it has not been given");
+      if(p->quality > 100)
+        error(EXIT_FAILURE, 0, "`%u' is larger than 100. The value to the "
+              "`--quality' (`-u') option must be between 1 and 100 
(inclusive)",
+              p->quality);
+
+      /* Preparations. */
       p->outformat=OUT_FORMAT_JPEG;
       if( nameisjpegsuffix(cp->output) )
         ui_add_dot_use_automatic_output(p);
-      if(p->quality==0)
-        error(EXIT_FAILURE, 0, "no quality specified for %s, please use the "
-              "`--quality' (`-q') option with a value between 1 (low "
-              "quality) and 100 (high quality) to specify a level",
-              p->cp.output);
 #endif
     }
   else if(nameiseps(cp->output))
diff --git a/bin/convolve/astconvolve.conf b/bin/convolve/astconvolve.conf
index 8354f88..34f746f 100644
--- a/bin/convolve/astconvolve.conf
+++ b/bin/convolve/astconvolve.conf
@@ -17,15 +17,9 @@
 # notice and this notice are preserved.  This file is offered as-is,
 # without any warranty.
 
-# Operating mode:
- domain             frequency
- makekernel         0
- minsharpspec       0.005
-
 # Input:
- hdu                0
  kernel             kernel.fits
- khdu               0
+ khdu               1
 
 # Output:
 
@@ -35,4 +29,8 @@
  nch2               1
  lastmeshfrac       0.6
  fullconvolution    0
- minmapsize         500000000
\ No newline at end of file
+
+# Operating mode:
+ domain             frequency
+ makekernel         0
+ minsharpspec       0.005
\ No newline at end of file
diff --git a/bin/crop/astcrop.conf b/bin/crop/astcrop.conf
index 261966f..123e602 100644
--- a/bin/crop/astcrop.conf
+++ b/bin/crop/astcrop.conf
@@ -18,7 +18,6 @@
 # without any warranty.
 
 # Input image and catalog parameters:
- hdu            0
  cathdu         1
  iwidth         201
  wwidth         3
@@ -30,6 +29,4 @@
  suffix         _cropped.fits
 
 # Operating mode:
- mode          wcs
- searchin      name
- minmapsize    1000000000
\ No newline at end of file
+ mode          wcs
\ No newline at end of file
diff --git a/bin/crop/onecrop.c b/bin/crop/onecrop.c
index 3ea6fae..b9508ca 100644
--- a/bin/crop/onecrop.c
+++ b/bin/crop/onecrop.c
@@ -605,23 +605,35 @@ firstcropmakearray(struct onecropparams *crp, long 
*fpixel_i,
     }
 
 
-  /* Create the FITS image extension and array and fill it with null
-     values. About the COMMENTs: when CFITSIO creates a FITS extension it
-     adds two comments linking to the FITS paper. Since we are mentioning
-     the version of CFITSIO and only use its ruitines to read/write from/to
-     FITS files, this is redundant. If `status!=0', then
-     `gal_fits_io_error' will abort, but in case CFITSIO doesn't write the
-     comments, status will become non-zero. So we are resetting it to zero
-     after these (because not being able to delete them isn't an error).*/
-  if(fits_create_file(&crp->outfits, outname, &status))
+  /* Create the FITS file with a blank first extension, then close it, so
+     with the next `fits_open_file', we build the image in the second
+     extension. This way, atleast for Gnuastro's outputs, we can
+     consistently use `-h1' (something like how you count columns, or
+     generally everything from 1). */
+  if(fits_create_file(&ofp, outname, &status))
     gal_fits_io_error(status, "creating file");
-  ofp=crp->outfits;
-  fits_create_img(ofp, gal_fits_type_to_bitpix(type),
+  fits_create_img(ofp, SHORT_IMG, 0, naxes, &status);
+  fits_close_file(ofp, &status);
+
+  /* Create the output crop image. */
+  fits_open_file(&crp->outfits, outname, READWRITE, &status);
+  fits_create_img(crp->outfits, gal_fits_type_to_bitpix(type),
                   naxis, naxes, &status);
   gal_fits_io_error(status, "creating image");
+  ofp=crp->outfits;
+
+  /* When CFITSIO creates a FITS extension it adds two comments linking to
+     the FITS paper. Since we are mentioning the version of CFITSIO and
+     only use its ruitines to read/write from/to FITS files, this is
+     redundant. If `status!=0', then `gal_fits_io_error' will abort, but in
+     case CFITSIO doesn't write the comments, status will become
+     non-zero. So we are resetting it to zero after these (because not
+     being able to delete them isn't an error). */
   fits_delete_key(ofp, "COMMENT", &status);
   fits_delete_key(ofp, "COMMENT", &status);
   status=0;
+
+  /* Write the blank value if necessary. */
   if( type!=GAL_DATA_TYPE_FLOAT32 && type!=GAL_DATA_TYPE_FLOAT64 )
     if(fits_write_key(ofp, gal_fits_type_to_datatype(crp->p->type), "BLANK",
                       crp->p->bitnul, "pixels with no data", &status) )
diff --git a/bin/fits/astfits.conf b/bin/fits/astfits.conf
index 978bfa1..c375bf8 100644
--- a/bin/fits/astfits.conf
+++ b/bin/fits/astfits.conf
@@ -16,8 +16,3 @@
 # are permitted in any medium without royalty provided the copyright
 # notice and this notice are preserved.  This file is offered as-is,
 # without any warranty.
-
-# Input:
- hdu            0
-
-# Output:
\ No newline at end of file
diff --git a/bin/mkcatalog/astmkcatalog.conf b/bin/mkcatalog/astmkcatalog.conf
index c552bcc..89e5e96 100644
--- a/bin/mkcatalog/astmkcatalog.conf
+++ b/bin/mkcatalog/astmkcatalog.conf
@@ -18,11 +18,10 @@
 # without any warranty.
 
 # Input:
- hdu             0
- objhdu          1
- clumphdu        2
- skyhdu          3
- stdhdu          4
+ objhdu          2
+ clumphdu        3
+ skyhdu          4
+ stdhdu          5
  zeropoint     0.0
  skysubtracted   0
 
diff --git a/bin/mknoise/astmknoise.conf b/bin/mknoise/astmknoise.conf
index ea8a6e0..3cac69f 100644
--- a/bin/mknoise/astmknoise.conf
+++ b/bin/mknoise/astmknoise.conf
@@ -18,7 +18,6 @@
 # without any warranty.
 
 # Input:
- hdu            0
  background     -10.00
  stdadd         0.000
  zeropoint      0.00
@@ -26,5 +25,4 @@
 # Output:
  type           float32
 
-# Common options
- minmapsize     1000000000
\ No newline at end of file
+# Common options
\ No newline at end of file
diff --git a/bin/mkprof/astmkprof.conf b/bin/mkprof/astmkprof.conf
index 386c0a5..b894d74 100644
--- a/bin/mkprof/astmkprof.conf
+++ b/bin/mkprof/astmkprof.conf
@@ -18,9 +18,7 @@
 # without any warranty.
 
 #input
- hdu                   0
- backhdu               0
- searchin           name
+ backhdu               1
 
 # Output:
  naxis1             1000
@@ -55,6 +53,3 @@
  crval1                1
  crval2                1
  resolution         0.03
-
-# Common options
- minmapsize    100000000
diff --git a/bin/noisechisel/astnoisechisel.conf 
b/bin/noisechisel/astnoisechisel.conf
index 8c13931..7b952bc 100644
--- a/bin/noisechisel/astnoisechisel.conf
+++ b/bin/noisechisel/astnoisechisel.conf
@@ -18,8 +18,7 @@
 # without any warranty.
 
 # Input:
- hdu                0
- khdu               0
+ khdu               1
  skysubtracted      0
  minbfrac         0.5
  minnumfalse      100
diff --git a/bin/statistics/aststatistics.conf 
b/bin/statistics/aststatistics.conf
index f6a6c46..46903fe 100644
--- a/bin/statistics/aststatistics.conf
+++ b/bin/statistics/aststatistics.conf
@@ -18,15 +18,8 @@
 # without any warranty.
 
 # Input image:
- hdu                 0
 
 # Histogram and CFP settings
  numasciibins        70
  asciiheight         10
- numbins            100
-
-
-# Common options
- minmapsize          1000000000
- tableformat         fits-binary
- searchin            name
\ No newline at end of file
+ numbins            100
\ No newline at end of file
diff --git a/bin/subtractsky/astsubtractsky.conf 
b/bin/subtractsky/astsubtractsky.conf
index c9bf3e6..14f8aa7 100644
--- a/bin/subtractsky/astsubtractsky.conf
+++ b/bin/subtractsky/astsubtractsky.conf
@@ -18,8 +18,7 @@
 # without any warranty.
 
 # Input:
- hdu                0
- khdu               0
+ khdu               1
 
 # Output:
 
diff --git a/bin/table/asttable.conf b/bin/table/asttable.conf
index 5c44c8a..393aca5 100644
--- a/bin/table/asttable.conf
+++ b/bin/table/asttable.conf
@@ -16,14 +16,3 @@
 # are permitted in any medium without royalty provided the copyright
 # notice and this notice are preserved.  This file is offered as-is,
 # without any warranty.
-
-# Input:
- hdu              1
- searchin         name
- ignorecase       0
-
-# Output:
- tableformat      fits-binary
-
-# Common options
- minmapsize       1000000000
\ No newline at end of file
diff --git a/bin/warp/astwarp.conf b/bin/warp/astwarp.conf
index 871f5a8..67a7c7d 100644
--- a/bin/warp/astwarp.conf
+++ b/bin/warp/astwarp.conf
@@ -18,11 +18,9 @@
 # without any warranty.
 
 # Input:
- hdu           0
 
 # Output:
  coveredfrac   1.0
 
 # Common parameters
- type          float32
- minmapsize    1000000000
\ No newline at end of file
+ type          float32
\ No newline at end of file
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 107758a..0bfccf7 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -4759,28 +4759,28 @@ configuration file).
 Command-line options, for a particular run of ProgramName.
 
 @item
address@hidden/gnuastro.conf} is parsed by all Gnuastro programs in the
-current directory.
-
address@hidden
 @file{.gnuastro/astprogname.conf} is parsed by ProgramName in the current
 directory.
 
 @item
address@hidden/.local/etc/gnuastro.conf} is parsed by all Gnuastro programs in
-the user's home directory (see @ref{Current directory and User wide}).
address@hidden/gnuastro.conf} is parsed by all Gnuastro programs in the
+current directory.
 
 @item
 @file{$HOME/.local/etc/astprogname.conf} is parsed by ProgramName in the
 user's home directory (see @ref{Current directory and User wide}).
 
 @item
address@hidden/etc/gnuastro.conf} is parsed by all Gnuastro programs in the
address@hidden/.local/etc/gnuastro.conf} is parsed by all Gnuastro programs in
+the user's home directory (see @ref{Current directory and User wide}).
+
address@hidden
address@hidden/etc/astprogname.conf} is parsed by ProgramName in the
 system-wide installation directory (see @ref{System wide} for
 @file{prefix}).
 
 @item
address@hidden/etc/astprogname.conf} is parsed by ProgramName in the
address@hidden/etc/gnuastro.conf} is parsed by all Gnuastro programs in the
 system-wide installation directory (see @ref{System wide} for
 @file{prefix}).
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 0d2eefa..5c40f9b 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -87,6 +87,13 @@ EXTRA_DIST = $(headersdir)/README gnuastro.pc.in 
arithmetic-binary.h    \
 
 
 
+# Common options to all Gnuastro programs.
+dist_sysconf_DATA = gnuastro.conf
+
+
+
+
+
 # Definitions for Gnuastro's the pkg-config file (inspired from GSL's
 # Makefile.am)
 pkgconfig_DATA = gnuastro.pc
diff --git a/lib/fits.c b/lib/fits.c
index 30b569e..373fc81 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -1308,20 +1308,27 @@ gal_fits_img_write_to_ptr(gal_data_t *data, char 
*filename)
   long fpixel=1, *naxes;
   int nkeyrec, status=0, datatype=gal_fits_type_to_datatype(data->type);
 
+  /* Allocate the naxis area. */
+  naxes=gal_data_malloc_array( ( sizeof(long)==8
+                                 ? GAL_DATA_TYPE_INT64
+                                 : GAL_DATA_TYPE_INT32 ), data->ndim);
+
+  /* When the file exists, add this image as an extension. Otherwise,
+     create the file. But we want to leave the first extension as a blank
+     extension and put the image in the next extension. */
+  if(access(filename,F_OK) == -1 )
+    {
+      fits_create_file(&fptr, filename, &status);
+      fits_create_img(fptr, SHORT_IMG, 0, naxes, &status);
+      fits_close_file(fptr, &status);
+    }
+
   /* Fill the `naxes' array (in opposite order, and `long' type): */
-  naxes=gal_data_malloc_array(GAL_DATA_TYPE_INT64, data->ndim);
   for(i=0;i<data->ndim;++i)
     naxes[data->ndim-1-i]=data->dsize[i];
-
-  /* Check if the file already exists. If it does, we want to add the array
-     as a new extension. */
-  if(access(filename,F_OK) != -1 )
-    fits_open_file(&fptr,filename, READWRITE, &status);
-  else
-    fits_create_file(&fptr, filename, &status);
+  fits_open_file(&fptr,filename, READWRITE, &status);
 
   /* Create the FITS file. */
-
   fits_create_img(fptr, gal_fits_type_to_bitpix(data->type),
                   data->ndim, naxes, &status);
   gal_fits_io_error(status, NULL);
diff --git a/bin/warp/astwarp.conf b/lib/gnuastro.conf
similarity index 74%
copy from bin/warp/astwarp.conf
copy to lib/gnuastro.conf
index 871f5a8..9be17a9 100644
--- a/bin/warp/astwarp.conf
+++ b/lib/gnuastro.conf
@@ -1,5 +1,5 @@
-# Default parameters (System) for Warp.
-# Warp is part of GNU Astronomy Utitlies.
+# Default values for the common options to all the programs in GNU
+# Astronomy Utitlies.
 #
 # Use the long option name of each paramter followed by
 # a value. The name and value should be separated by
@@ -18,11 +18,12 @@
 # without any warranty.
 
 # Input:
- hdu           0
+ hdu            1
+ ignorecase     1
+ searchin       name
 
 # Output:
- coveredfrac   1.0
+ tableformat    fits-binary
 
-# Common parameters
- type          float32
- minmapsize    1000000000
\ No newline at end of file
+# Operating mode
+ minmapsize     1000000000
\ No newline at end of file
diff --git a/lib/options.c b/lib/options.c
index 0cd0c7c..08ef4b0 100644
--- a/lib/options.c
+++ b/lib/options.c
@@ -1165,32 +1165,27 @@ gal_options_parse_config_files(struct 
gal_options_common_params *cp)
           "`unsigned char' type. But",
           PACKAGE_BUGREPORT);
 
-  /* Common options configuration file. */
-  asprintf(&filename, ".%s/%s.conf", PACKAGE, PACKAGE);
+  /* The program's current directory configuration file. */
+  asprintf(&filename, ".%s/%s.conf", PACKAGE, cp->program_exec);
   options_parse_file(filename, cp, 0);
   free(filename);
 
-  /* The program's current directory configuration file. */
-  asprintf(&filename, ".%s/%s.conf", PACKAGE, cp->program_exec);
+  /* Common options configuration file. */
+  asprintf(&filename, ".%s/%s.conf", PACKAGE, PACKAGE);
   options_parse_file(filename, cp, 0);
   free(filename);
 
   /* Read the home environment variable. */
   home=options_get_home();
 
-  /* Common options user-wide configuration file. */
-  asprintf(&filename, "%s/%s/%s.conf", home, USERCONFIG_DIR, PACKAGE);
-  options_parse_file(filename, cp, 0);
-  free(filename);
-
   /* The program's user-wide configuration file. */
   asprintf(&filename, "%s/%s/%s.conf", home, USERCONFIG_DIR,
            cp->program_exec);
   options_parse_file(filename, cp, 0);
   free(filename);
 
-  /* Common options system-wide configuration file. */
-  asprintf(&filename, "%s/%s.conf", SYSCONFIG_DIR, PACKAGE);
+  /* Common options user-wide configuration file. */
+  asprintf(&filename, "%s/%s/%s.conf", home, USERCONFIG_DIR, PACKAGE);
   options_parse_file(filename, cp, 0);
   free(filename);
 
@@ -1198,6 +1193,11 @@ gal_options_parse_config_files(struct 
gal_options_common_params *cp)
   asprintf(&filename, "%s/%s.conf", SYSCONFIG_DIR, cp->program_exec);
   options_parse_file(filename, cp, 0);
   free(filename);
+
+  /* Common options system-wide configuration file. */
+  asprintf(&filename, "%s/%s.conf", SYSCONFIG_DIR, PACKAGE);
+  options_parse_file(filename, cp, 0);
+  free(filename);
 }
 
 
diff --git a/tests/during-dev.sh b/tests/during-dev.sh
index 012caa1..5918d10 100755
--- a/tests/during-dev.sh
+++ b/tests/during-dev.sh
@@ -140,10 +140,14 @@ if make -C "$builddir"; then
     # the last line in the configuration file doesn't actualy end with a
     # new line (in which case the appended string will be added to the end
     # of the last line).
-    cp "$srcdir/bin/$utilname/ast$utilname.conf" .gnuastro/
-    echo ""               >> .gnuastro/ast$utilname.conf
-    echo " lastconfig 1"  >> .gnuastro/ast$utilname.conf
+    cp "$srcdir/lib/gnuastro.conf" "$srcdir/bin/$utilname/ast$utilname.conf" \
+       .gnuastro/
+    echo ""               >> .gnuastro/gnuastro.conf
+    echo " lastconfig 1"  >> .gnuastro/gnuastro.conf
 
     # Run the built utility with the given arguments and options.
     "$utility" $arguments $options
+
+    # Clean up.
+    rm -rf .gnuastro
 fi
diff --git a/tests/prepconf.sh b/tests/prepconf.sh
index b568c1b..f62f105 100755
--- a/tests/prepconf.sh
+++ b/tests/prepconf.sh
@@ -35,13 +35,11 @@ fi
 
 
 
-# Add options for `make check'
-# ----------------------------
+# Common options for all programs
+# -------------------------------
 #
-# It might be necessary to add specific options to all the programs during
-# `make check'. Therefore we have defined the file `addedoptions.txt' to
-# keep these extra options and append them to the configuration file in the
-# source directory of the utility.
+# Copy the common options while adding the following optios only for make
+# check.
 #
 #   - The onlydirconf option is added so the utilities don't go looking
 #     into the user's home and system wide directories (which might contain
@@ -63,7 +61,8 @@ cat > addedoptions.txt <<EOF
  lastconfig            1
  log                   0
 EOF
-
+cat $topsrc/lib/gnuastro.conf addedoptions.txt > .gnuastro/gnuastro.conf
+rm addedoptions.txt
 
 
 
@@ -75,23 +74,8 @@ EOF
 # addedoptions.txt file to create the configuration file which will be used
 # by `make check'.
 for prog in arithmetic convertt convolve cosmiccal crop fits      \
-            warp mkcatalog mknoise mkprof noisechisel statistics  \
-            subtractsky table
+            mkcatalog mknoise mkprof noisechisel statistics       \
+            subtractsky table warp
 do
-
-    # Copy the configuration file from the utility source and add the
-    # options added here.
-    cat $topsrc/bin/$prog/ast$prog.conf addedoptions.txt          \
-        > .gnuastro/ast$prog.conf
-
+    cp $topsrc/bin/$prog/ast$prog.conf .gnuastro/ast$prog.conf
 done
-
-
-
-
-
-# Clean up
-# --------
-#
-# Delete the `addedoptions.txt' file that was generated here.
-rm addedoptions.txt



reply via email to

[Prev in Thread] Current Thread [Next in Thread]