[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master a11e71c 003/113: Merged with recent changes in
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master a11e71c 003/113: Merged with recent changes in master |
Date: |
Fri, 16 Apr 2021 10:33:29 -0400 (EDT) |
branch: master
commit a11e71ce7785e5ed214d6d1e43d6748713295df1
Merge: 42e04b6 8eaede0
Author: Mohammad Akhlaghi <akhlaghi@gnu.org>
Commit: Mohammad Akhlaghi <akhlaghi@gnu.org>
Merged with recent changes in master
This part got a little dirty unfortunately. Mainly because of my lack of
experience. Some features were added on this branch that also needed to go
onto master. Then some bugs/issues were found that needed to be corrected
in master. Now that I want to continue back in this branch, I need to bring
all those changes in!
I will try to avoid such situations later: when a major change is needed
for this branch, I will first implement it in the general master branch,
then pull it in here and add its extra features here.
---
NEWS | 61 ++++++
THANKS | 2 +
bin/crop/args.h | 10 +-
bin/crop/crop.c | 1 -
bin/crop/main.h | 1 -
bin/crop/onecrop.c | 11 +-
bin/crop/onecrop.h | 6 +-
bin/crop/ui.c | 19 +-
bin/crop/ui.h | 3 +
bin/crop/wcsmode.c | 5 +-
bin/mkprof/args.h | 22 ++-
bin/mkprof/main.h | 3 +-
bin/mkprof/mkprof.c | 25 ++-
bin/mkprof/oneprofile.c | 2 +-
bin/mkprof/profiles.c | 4 +-
bin/mkprof/ui.c | 381 ++++++++++++++++++++++++++++++--------
bin/mkprof/ui.h | 3 +-
configure.ac | 8 +-
doc/gnuastro-top.html | 6 +-
doc/gnuastro.texi | 125 ++++++++-----
doc/release-checklist.txt | 20 +-
lib/Makefile.am | 1 +
lib/box.c | 1 +
lib/gnuastro-internal/config.h.in | 1 +
lib/gnuastro-internal/options.h | 3 +
lib/gnuastro/type.h | 25 ++-
lib/options.c | 35 +++-
lib/wcs.c | 3 +-
tests/Makefile.am | 2 +-
tests/crop/section.sh | 2 +-
30 files changed, 607 insertions(+), 184 deletions(-)
diff --git a/NEWS b/NEWS
index f231f95..eec8394 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,66 @@
GNU Astronomy Utilities NEWS -*- outline -*-
+* Noteworthy changes in release 0.3.XXX (library 2.0.0) (YYYY-MM-DD) [stable]
+
+** New features
+
+ `.fit' suffix is now also recognized as a FITS file extension in all
+ programs and libraries.
+
+ Arithmetic: now has a new `--globalhdu' (`-g') option which can be used
+ once for all the input images.
+
+ MakeProfiles: the new `--kernel' option can make a kernel image without
+ the need to define a catalog. With this option, a catalog (or
+ accompanying background image) must not be given.
+
+** Removed features
+
+** Changed features
+
+ Crop: The new `--center' option is now used to define the center of a
+ single crop. Hence the old `--ra', `--dec', `--xc', `--yc' have been
+ removed. This new option can take multiple values (one value for each
+ dimension). Fractions are also acceptable.
+
+ Crop: The new `--width' option is now used to define the width of a
+ single crop. Hence the old `--iwidth', `--wwidth' were removed. The units
+ to interpret the value to the option are specified by the `--mode'
+ option. With the new `--width' option it is also possible to define a
+ non-square crop (different widths along each dimension). In WCS mode, its
+ units are no longer arcseconds but are the same units of the WCS (degrees
+ for angles). `--width' can also accept fractions. So to set a width of 5
+ arcseconds, you can give it a value of `5/3600' for the angular
+ dimensions.
+
+ Crop: The new `--coordcol' option is now used to determine the catalog
+ columns that define coordinates. Hence the old `--racol', `--deccol',
+ `--xcol', and `--ycol' have been removed. This new option can be called
+ multiple times and the order of its calling will be used for the column
+ containing the center in the respective dimension (in FITS format).
+
+ `gal_fits_img_info' now also returns the name and units of the dataset
+ (if they aren't NULL). So it takes two extra arguments.
+
+ `gal_box_overlap' now works on data of any dimensionality and thus also
+ needs the number of dimensions (elements in each input array).
+
+ `gal_box_border_from_center' now accepts an array of coordinates as one
+ argument and the number of dimensions as another. This allows it to work
+ on any dimensionality.
+
+ `gal_wcs_pixel_scale' now replaces the old `gal_wcs_pixel_scale_deg',
+ since it doesn't only apply to degrees. The pixel scale units are defined
+ by the units of the WCS.
+
+** Bug fixes
+
+ MakeProfiles long options on 32bit big endian systems (bug #51341).
+
+
+
+
+
* Noteworthy changes in release 0.3 (library 1.0.0) (2017-06-01) [stable]
This is a full re-write of Gnuastro. Most importantly, Gnuastro now has a
diff --git a/THANKS b/THANKS
index 183b1d0..63651a2 100644
--- a/THANKS
+++ b/THANKS
@@ -18,6 +18,7 @@ support in Gnuastro. The list is ordered alphabetically.
Karl Berry karl@gnu.org
Roland Bacon roland.bacon@univ-lyon1.fr
Nicolas Bouché nicolas.bouche@irap.omp.eu
+ Adrian Bunk bunk@debian.org
Rosa Calvi rcalvi@iac.es
Antonio Diaz Diaz antonio@gnu.org
Takashi Ichikawa ichikawa@astr.tohoku.ac.jp
@@ -31,6 +32,7 @@ support in Gnuastro. The list is ordered alphabetically.
Yahya Sefidbakht y.sefidbakht@gmail.com
Richard Stallman rms@gnu.org
Ole Streicher olebole@debian.org
+ Ignacio Trujillo trujillo@iac.es
David Valls-Gabaud david.valls-gabaud@obspm.fr
Christopher Willmer cnaw@as.arizona.edu
diff --git a/bin/crop/args.h b/bin/crop/args.h
index 4272ae3..83f42fa 100644
--- a/bin/crop/args.h
+++ b/bin/crop/args.h
@@ -141,7 +141,7 @@ struct argp_option program_options[] =
{
"width",
UI_KEY_WIDTH,
- "FLT[, ...]",
+ "FLT[,...]",
0,
"Width when crop is defined by its center.",
ARGS_GROUP_CENTER_GENERAL,
@@ -155,9 +155,9 @@ struct argp_option program_options[] =
{
"center",
UI_KEY_CENTER,
- "FLT[, ...]",
+ "FLT[,...]",
0,
- "Center of a single crop.",
+ "Central coordinates of a single crop.",
ARGS_GROUP_CENTER_GENERAL,
&p->center,
GAL_TYPE_STRING,
@@ -175,7 +175,7 @@ struct argp_option program_options[] =
{
0, 0, 0, 0,
- "Crop by center (only for catalog)",
+ "Crop by center (when a catalog is given)",
ARGS_GROUP_CENTER_CATALOG
},
{
@@ -222,7 +222,7 @@ struct argp_option program_options[] =
UI_KEY_COORDCOL,
"STR/INT",
0,
- "Columns no./info containing coordinates.",
+ "Column no./info containing coordinates.",
ARGS_GROUP_CENTER_CATALOG,
&p->coordcol,
GAL_TYPE_STRLL,
diff --git a/bin/crop/crop.c b/bin/crop/crop.c
index 9cdc9b1..8173051 100644
--- a/bin/crop/crop.c
+++ b/bin/crop/crop.c
@@ -298,7 +298,6 @@ crop_mode_wcs(void *inparam)
/* If a name isn't set yet, set it. */
if(crp->name==NULL) onecrop_name(crp);
-
/* Increment the number of images used (necessary for the
header keywords that are written in `onecrop'). Then do the
crop. */
diff --git a/bin/crop/main.h b/bin/crop/main.h
index 556c8d5..515c75c 100644
--- a/bin/crop/main.h
+++ b/bin/crop/main.h
@@ -43,7 +43,6 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#define MAXDIM 3
-
/* Modes of operation. */
enum crop_modes
{
diff --git a/bin/crop/onecrop.c b/bin/crop/onecrop.c
index 64c9ada..97ec264 100644
--- a/bin/crop/onecrop.c
+++ b/bin/crop/onecrop.c
@@ -71,7 +71,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
/*******************************************************************/
/* Read the section string and set the starting and ending pixels
based on that. */
-static void
+void
onecrop_parse_section(struct cropparams *p, size_t *dsize,
long *fpixel, long *lpixel)
{
@@ -647,7 +647,7 @@ onecrop_make_array(struct onecropparams *crp, long
*fpixel_i,
update the header keywords. */
if(img->wcs)
{
- /* Write the WCS title and the common WCS information. */
+ /* Write the WCS title and common WCS information. */
if(fits_write_record(ofp, blankrec, &status))
gal_fits_io_error(status, NULL);
sprintf(titlerec, "%sWCS information", startblank);
@@ -656,6 +656,7 @@ onecrop_make_array(struct onecropparams *crp, long
*fpixel_i,
fits_write_record(ofp, titlerec, &status);
for(i=0;i<img->nwcskeys-1;++i)
fits_write_record(ofp, &img->wcstxt[i*80], &status);
+ gal_fits_io_error(status, NULL);
/* Correct the CRPIX keywords. */
for(i=0;i<ndim;++i)
@@ -700,7 +701,6 @@ onecrop(struct onecropparams *crp)
long fpixel_o[MAXDIM], lpixel_o[MAXDIM], inc[MAXDIM];
long naxes[MAXDIM], fpixel_i[MAXDIM], lpixel_i[MAXDIM];
-
/* Fill the `naxes' and `inc' arrays. */
for(i=0;i<ndim;++i)
{
@@ -726,8 +726,8 @@ onecrop(struct onecropparams *crp)
ofp=crp->outfits;
- /* Allocate an array to keep the desired crop region, then read the
- desired pixels into it. */
+ /* Allocate an array to keep the desired crop region, then read
+ the desired pixels into it. */
status=0;
for(i=0;i<ndim;++i) cropsize *= ( lpixel_i[i] - fpixel_i[i] + 1 );
array=gal_data_malloc_array(p->type, cropsize, __func__, "array");
@@ -778,6 +778,7 @@ onecrop(struct onecropparams *crp)
j += sprintf(®ion[j], "%ld:%ld,", fpixel_i[i], lpixel_i[i]);
region[j-1]='\0';
+
/* A section has been added to the cropped image from this input
image, so save the information of this image. */
sprintf(basename, "ICF%zu", crp->numimg);
diff --git a/bin/crop/onecrop.h b/bin/crop/onecrop.h
index eba6243..55b396e 100644
--- a/bin/crop/onecrop.h
+++ b/bin/crop/onecrop.h
@@ -65,13 +65,13 @@ onecrop_parse_polygon(struct cropparams *p);
void
onecrop_name(struct onecropparams *crp);
+void
+onecrop(struct onecropparams *crp);
+
int
onecrop_center_filled(struct onecropparams *crp);
void
crop_print_log(struct onecropparams *p);
-void
-onecrop(struct onecropparams *crp);
-
#endif
diff --git a/bin/crop/ui.c b/bin/crop/ui.c
index d60ea37..41eeb07 100644
--- a/bin/crop/ui.c
+++ b/bin/crop/ui.c
@@ -217,7 +217,7 @@ parse_opt(int key, char *arg, struct argp_state *state)
-
+/* Parse the mode to interpret the given coordinates. */
void *
ui_parse_coordinate_mode(struct argp_option *option, char *arg,
char *filename, size_t lineno, void *junk)
@@ -252,7 +252,6 @@ ui_parse_coordinate_mode(struct argp_option *option, char
*arg,
-
/* Parse the width and center coordinates from the comman-line or
configuration files. */
void *
@@ -346,7 +345,6 @@ ui_read_check_only_options(struct cropparams *p)
{
int checksum;
-
/* Make sure that only one of the crop definitions is given. */
checksum = ( (p->center!=NULL)
+ (p->catname!=NULL)
@@ -375,8 +373,11 @@ ui_read_check_only_options(struct cropparams *p)
}
- /* Section is currently only defined in image mode. */
- if(p->section) p->mode=IMGCROP_MODE_IMG;
+ /* Section is currentlyl only defined in Image mode. */
+ if(p->section && p->mode!=IMGCROP_MODE_IMG)
+ error(EXIT_FAILURE, 0, "The `--section' option is only available in "
+ "image coordinate mode, currently it doesn't work with WCS mode. "
+ "Please run with `--mode=img' and change the values accordingly");
/* Sanity checks and mode setting based on the desired crop. */
@@ -604,7 +605,6 @@ ui_read_cols(struct cropparams *p)
gal_data_t *cols, *tmp, *corrtype=NULL;
size_t ncoordcols, counter=0, dcounter=0, ndim=p->imgs->ndim;
-
/* See if the number of columns given for coordinates corresponds to the
number of dimensions of the input dataset. */
if(p->coordcol)
@@ -621,7 +621,7 @@ ui_read_cols(struct cropparams *p)
(p->numin==1?" has":"s have"), ndim);
}
else
- error(EXIT_FAILURE, 0, "no coordinate columns specified. When a "
+ error(EXIT_FAILURE, 0, "no coordinate columns specified. When a catalog"
"is given, it is necessary to identify which columns identify "
"the coordinate values in which dimension.\n\n"
"You can do this by calling `--coordcol' multiple times, the "
@@ -770,7 +770,7 @@ ui_make_log(struct cropparams *p)
/* Return if no long file was requested. */
if(p->cp.log==0) return;
- /* Column to specify if central pixels are filled. */
+ /* Column to specify if the central pixels are filled. */
asprintf(&comment, "Are the central pixels filled? (1: yes, 0: no, "
"%u: not checked)", GAL_BLANK_UINT8);
gal_list_data_add_alloc(&p->log, NULL, GAL_TYPE_UINT8, 1, &p->numout,
@@ -937,6 +937,7 @@ ui_preparations(struct cropparams *p)
+
/**************************************************************/
/************ Set the parameters *************/
/**************************************************************/
@@ -1043,7 +1044,7 @@ ui_free_report(struct cropparams *p, struct timeval *t1)
size_t i;
/* Free the simple arrays (if they were set). */
- if(p->center) free(p->center);
+ gal_data_free(p->center);
if(p->cp.hdu) free(p->cp.hdu);
if(p->cathdu) free(p->cathdu);
if(p->catname) free(p->catname);
diff --git a/bin/crop/ui.h b/bin/crop/ui.h
index c59a22d..46d520f 100644
--- a/bin/crop/ui.h
+++ b/bin/crop/ui.h
@@ -60,6 +60,9 @@ enum option_keys_enum
+
+
+
void
ui_read_check_inputs_setup(int argc, char *argv[], struct cropparams *p);
diff --git a/bin/crop/wcsmode.c b/bin/crop/wcsmode.c
index 7943638..e438dda 100644
--- a/bin/crop/wcsmode.c
+++ b/bin/crop/wcsmode.c
@@ -43,6 +43,8 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
+
+
/*******************************************************************/
/**************** Check for ui.c *********************/
/*******************************************************************/
@@ -592,13 +594,11 @@ point_in_dataset(double *p, double *i, double *s, double
*c, size_t ndim)
{
double n;
-
/* If there is a third dimension, then first check that. Note that the
third dimension is assumed to be indendent of the first two. */
if(ndim==3 && ( p[2]<i[2] || p[2]>i[2]+s[2] ) )
return 0;
-
/* In the RA and Dec checks, first check the declination. If it is not in
range, you can safely return 0. */
if(p[1]>=i[1] && p[1]<=i[1]+s[1])
@@ -625,6 +625,7 @@ point_in_dataset(double *p, double *i, double *s, double
*c, size_t ndim)
}
}
}
+
return 0;
}
diff --git a/bin/mkprof/args.h b/bin/mkprof/args.h
index 5922ea6..bfa8f5d 100644
--- a/bin/mkprof/args.h
+++ b/bin/mkprof/args.h
@@ -69,6 +69,20 @@ struct argp_option program_options[] =
GAL_OPTIONS_NOT_MANDATORY,
GAL_OPTIONS_NOT_SET
},
+ {
+ "kernel",
+ UI_KEY_KERNEL,
+ "STR",
+ 0,
+ "Parameters to only build one kernel.",
+ GAL_OPTIONS_GROUP_INPUT,
+ &p->kernel,
+ GAL_TYPE_STRING,
+ GAL_OPTIONS_RANGE_ANY,
+ GAL_OPTIONS_NOT_MANDATORY,
+ GAL_OPTIONS_NOT_SET,
+ ui_parse_kernel
+ },
@@ -82,7 +96,7 @@ struct argp_option program_options[] =
"Number of pixels along first FITS axis.",
GAL_OPTIONS_GROUP_OUTPUT,
&p->naxes[0],
- GAL_TYPE_UINT64,
+ GAL_TYPE_LONG,
GAL_OPTIONS_RANGE_GT_0,
GAL_OPTIONS_NOT_MANDATORY,
GAL_OPTIONS_NOT_SET
@@ -95,7 +109,7 @@ struct argp_option program_options[] =
"Number of pixels along second FITS axis.",
GAL_OPTIONS_GROUP_OUTPUT,
&p->naxes[1],
- GAL_TYPE_INT64,
+ GAL_TYPE_LONG,
GAL_OPTIONS_RANGE_GT_0,
GAL_OPTIONS_NOT_MANDATORY,
GAL_OPTIONS_NOT_SET
@@ -209,7 +223,7 @@ struct argp_option program_options[] =
"Shift profile centers and enlarge image, X axis.",
ARGS_GROUP_PROFILES,
&p->shift[0],
- GAL_TYPE_INT64,
+ GAL_TYPE_LONG,
GAL_OPTIONS_RANGE_GE_0,
GAL_OPTIONS_NOT_MANDATORY,
GAL_OPTIONS_NOT_SET
@@ -222,7 +236,7 @@ struct argp_option program_options[] =
"Shift profile centers and enlarge image, Y axis.",
ARGS_GROUP_PROFILES,
&p->shift[1],
- GAL_TYPE_INT64,
+ GAL_TYPE_LONG,
GAL_OPTIONS_RANGE_GE_0,
GAL_OPTIONS_NOT_MANDATORY,
GAL_OPTIONS_NOT_SET
diff --git a/bin/mkprof/main.h b/bin/mkprof/main.h
index 23767dc..5d62b98 100644
--- a/bin/mkprof/main.h
+++ b/bin/mkprof/main.h
@@ -108,6 +108,7 @@ struct mkprofparams
char *backhdu; /* HDU of background image. */
long naxes[2]; /* Size of the output image. */
uint8_t clearcanvas; /* Pixels in background image set to zero. */
+ gal_data_t *kernel; /* Parameters to define a kernel. */
uint8_t oversample; /* Oversampling scale. */
uint8_t psfinimg; /* ==1: Build PSF profiles in image. */
uint8_t individual; /* ==1: Build all catalog separately. */
@@ -150,7 +151,7 @@ struct mkprofparams
size_t num; /* The number of profiles. */
double *x; /* X axis position of profile center. */
double *y; /* Y axis position of profile center. */
- int *f; /* Profile function code. */
+ uint8_t *f; /* Profile function code. */
float *r; /* Radius of profile. */
float *n; /* Index of profile. */
float *p; /* Position angle of profile */
diff --git a/bin/mkprof/mkprof.c b/bin/mkprof/mkprof.c
index ddcc89a..1da73b7 100644
--- a/bin/mkprof/mkprof.c
+++ b/bin/mkprof/mkprof.c
@@ -126,14 +126,24 @@ saveindividual(struct mkonthread *mkp)
/* Note that `width' is in FITS format, not C. */
size_t dsize[2]={mkp->width[1], mkp->width[0]};
- /* Write the name and remove a similarly named file. */
- asprintf(&filename, "%s%zu_%s", outdir, ibq->id, p->basename);
- gal_checkset_check_remove_file(filename, 0, p->cp.dontdelete);
+
+ /* Write the name and remove a similarly named file when the `--kernel'
+ option wasn't called. If `--kernel' is called, then we should just use
+ the final merged filename. */
+ if(p->kernel)
+ filename=p->mergedimgname;
+ else
+ {
+ asprintf(&filename, "%s%zu_%s", outdir, ibq->id, p->basename);
+ gal_checkset_check_remove_file(filename, 0, p->cp.dontdelete);
+ }
+
/* Put the array into a data structure */
data=gal_data_alloc(ibq->img, GAL_TYPE_FLOAT32, 2, dsize, NULL, 0,
p->cp.minmapsize, "MockImage", "Brightness", NULL);
+
/* Write the array to file (a separately built PSF doesn't need WCS
coordinates). */
if(ibq->ispsf && p->psfinimg==0)
@@ -151,6 +161,7 @@ saveindividual(struct mkonthread *mkp)
}
ibq->indivcreated=1;
+
/* Report if in verbose mode. */
if(!p->cp.quiet)
{
@@ -158,7 +169,9 @@ saveindividual(struct mkonthread *mkp)
gal_timing_report(NULL, jobname, 2);
free(jobname);
}
- free(filename);
+
+ /* Clean up. */
+ if(p->kernel==NULL) free(filename);
}
@@ -490,10 +503,10 @@ mkprof_write(struct mkprofparams *p)
/* Report if in verbose mode. */
++complete;
- if(!p->cp.quiet)
+ if(!p->cp.quiet && p->num>1)
{
asprintf(&jobname, "row %zu complete, %zu left to go",
- ibq->id, num-complete);
+ ibq->id+1, num-complete);
gal_timing_report(NULL, jobname, 2);
free(jobname);
}
diff --git a/bin/mkprof/oneprofile.c b/bin/mkprof/oneprofile.c
index bf275c7..0faeb09 100644
--- a/bin/mkprof/oneprofile.c
+++ b/bin/mkprof/oneprofile.c
@@ -412,7 +412,7 @@ oneprof_set_prof_params(struct mkonthread *mkp)
mkp->s = sin( (90-p->p[id]) * DEGREESTORADIANS );
mkp->q = p->q[id];
mkp->brightness = pow( 10, (p->zeropoint - p->m[id]) / 2.5f );
- mkp->ibq->ispsf = oneprofile_ispsf(p->f[id]);
+ mkp->ibq->ispsf = p->kernel ? 1 : oneprofile_ispsf(p->f[id]);
mkp->func = mkp->ibq->func = p->f[id];
diff --git a/bin/mkprof/profiles.c b/bin/mkprof/profiles.c
index b9e980c..6ee0197 100644
--- a/bin/mkprof/profiles.c
+++ b/bin/mkprof/profiles.c
@@ -41,9 +41,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
/****************************************************************
***************** Profiles: ********************
****************************************************************/
-/* The Gaussian function at a point: junk is only used here to make it
- conform to the general format of functions in this file: like
- Sersic(). */
+/* The Gaussian function at a point. */
double
Gaussian(struct mkonthread *mkp)
{
diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index 98d8e03..29419f7 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -63,7 +63,7 @@ const char *
argp_program_bug_address = PACKAGE_BUGREPORT;
static char
-args_doc[] = "[BackgroundImage] Catalog";
+args_doc[] = "[Options] [Catalog]";
const char
doc[] = GAL_STRINGS_TOP_HELP_INFO PROGRAM_NAME" will create a FITS image "
@@ -109,6 +109,71 @@ enum program_args_groups
/**************************************************************/
/********* Initialize & Parse command-line **************/
/**************************************************************/
+static int
+ui_profile_name_read(char *string, size_t row)
+{
+ if( !strcmp("sersic", string) )
+ return PROFILE_SERSIC;
+
+ else if ( !strcmp("moffat", string) )
+ return PROFILE_MOFFAT;
+
+ else if ( !strcmp("gaussian", string) )
+ return PROFILE_GAUSSIAN;
+
+ else if ( !strcmp("point", string) )
+ return PROFILE_POINT;
+
+ else if ( !strcmp("flat", string) )
+ return PROFILE_FLAT;
+
+ else if ( !strcmp("circum", string) )
+ return PROFILE_CIRCUMFERENCE;
+
+ else if ( !strcmp(GAL_BLANK_STRING, string) )
+ error(EXIT_FAILURE, 0, "atleast one profile function is blank");
+
+ else
+ {
+ if(row)
+ error(EXIT_FAILURE, 0, "`%s' not recognized as a profile function "
+ "name in row %zu", string, row);
+ else
+ error(EXIT_FAILURE, 0, "`%s' not recognized as a profile function "
+ "name in values to `--kernel' option", string);
+ }
+
+ return PROFILE_INVALID;
+}
+
+
+
+
+
+static char *
+ui_profile_name_write(int profile_code)
+{
+ switch(profile_code)
+ {
+ case PROFILE_SERSIC: return "sersic";
+ case PROFILE_MOFFAT: return "moffat";
+ case PROFILE_GAUSSIAN: return "gaussian";
+ case PROFILE_POINT: return "point";
+ case PROFILE_FLAT: return "flat";
+ case PROFILE_CIRCUMFERENCE: return "circum";
+ default:
+ error(EXIT_FAILURE, 0, "%s: %d not recognized as a profile code",
+ __func__, profile_code);
+ }
+
+ return NULL;
+}
+
+
+
+
+
+
static void
ui_initialize_options(struct mkprofparams *p,
struct argp_option *program_options,
@@ -211,6 +276,116 @@ parse_opt(int key, char *arg, struct argp_state *state)
+/* Parse the kernel properties, the format is like this:
+
+ PROFILE_NAME,PARAM_1,PARAM_2,PARAM_3,...,PARAM_N */
+void *
+ui_parse_kernel(struct argp_option *option, char *arg,
+ char *filename, size_t lineno, void *junk)
+{
+ long profcode;
+ double *darray;
+ gal_data_t *kernel;
+ size_t i, nc, numneeded=0;
+ char *c, *profile, *tailptr;
+ char *str, sstr[GAL_OPTIONS_STATIC_MEM_FOR_VALUES];
+
+ /* We want to print the stored values. */
+ if(lineno==-1)
+ {
+ /* Set the value pointer to kernel. */
+ kernel=*(gal_data_t **)(option->value);
+ darray = kernel->array;
+
+ /* First write the profile function code into the output string. */
+ nc=0;
+ nc += sprintf(sstr+nc, "%s,", ui_profile_name_write(kernel->status));
+
+ /* Write the values into a string. */
+ for(i=0;i<kernel->size;++i)
+ {
+ if( nc > GAL_OPTIONS_STATIC_MEM_FOR_VALUES-100 )
+ error(EXIT_FAILURE, 0, "%s: a bug! please contact us at %s so we "
+ "can address the problem. The number of necessary "
+ "characters in the statically allocated string has become "
+ "too close to %d", __func__, PACKAGE_BUGREPORT,
+ GAL_OPTIONS_STATIC_MEM_FOR_VALUES);
+ nc += sprintf(sstr+nc, "%g,", darray[i]);
+ }
+ sstr[nc-1]='\0';
+
+ /* Copy the string into a dynamically allocated space, because it
+ will be freed later.*/
+ gal_checkset_allocate_copy(sstr, &str);
+ return str;
+ }
+ else
+ {
+ /* The first part of `arg' (before the first comma) is not
+ necessarily a number. So we need to separate the first part from
+ the rest.*/
+ c=arg;while(*c!='\0' && *c!=',') ++c;
+ profile=arg;
+ arg = (*c=='\0') ? NULL : c+1; /* `point' doesn't need any numbers. */
+ *c='\0';
+
+ /* Read the parameters. */
+ kernel=gal_options_parse_list_of_numbers(arg, filename, lineno);
+ *(gal_data_t **)(option->value) = kernel;
+
+ /* Write the profile type code into `kernel->status'. If it starts
+ with a digit, then the user might have given the code of the
+ profile directly. In that case, parse the number. Otherwise,
+ let `ui_profile_name_read' find the value. */
+ if( isdigit(*profile) )
+ {
+ profcode=strtol(profile, &tailptr, 0);
+ if(*tailptr!='\0')
+ error_at_line(EXIT_FAILURE, 0, filename, lineno, "`%s' "
+ "couldn't be read as a profile code", profile);
+ if(profcode<=0 || profcode>=PROFILE_MAXIMUM_CODE)
+ error_at_line(EXIT_FAILURE, 0, filename, lineno, "`%s' "
+ "isn't a valid profile code. Please run with "
+ "`--help' and see the acceptable codes in "
+ "explanation of the `--fcol' option", profile);
+ kernel->status=profcode;
+ }
+ else
+ kernel->status=ui_profile_name_read(profile, 0);
+
+ /* Make sure the number of parameters conforms with the profile. */
+ switch(kernel->status)
+ {
+ case PROFILE_SERSIC: numneeded=3; break;
+ case PROFILE_MOFFAT: numneeded=3; break;
+ case PROFILE_GAUSSIAN: numneeded=2; break;
+ case PROFILE_POINT: numneeded=0; break;
+ case PROFILE_FLAT: numneeded=1; break;
+ case PROFILE_CIRCUMFERENCE: numneeded=1; break;
+ default:
+ error_at_line(EXIT_FAILURE, 0, filename, lineno, "%s: a bug! "
+ "Please contact us at %s to correct the issue. "
+ "Profile code %d is not recognized", __func__,
+ PACKAGE_BUGREPORT, kernel->status);
+ }
+
+ /* Make sure the number of parameters given are the same number that
+ are needed. */
+ if( kernel->size != numneeded )
+ error_at_line(EXIT_FAILURE, 0, filename, lineno, "as a kernel, a "
+ "`%s' profile needs %zu parameters, but %zu is given",
+ ui_profile_name_write(kernel->status), numneeded,
+ kernel->size);
+
+ /* Our job is done, return NULL. */
+ return NULL;
+ }
+}
+
+
+
+
+
@@ -245,16 +420,20 @@ ui_read_check_only_options(struct mkprofparams *p)
neighter coordinates are specified there is no problem, the user might
have input the other coordinate standard. We'll also check for that
after this.*/
- if( ((p->xcol==NULL) + (p->ycol==NULL)) == 1 )
- error(EXIT_FAILURE, 0, "only `%s' has been given, please also specify "
- "a column for the position along the %s axis with the `%s' option",
- p->xcol?"xcol":"ycol", p->xcol?"Y":"X", p->xcol?"ycol":"xcol");
-
- if( ((p->racol==NULL) + (p->deccol==NULL)) == 1 )
- error(EXIT_FAILURE, 0, "only `%s' has been given, please also specify "
- "a column for the position along the %s axis with the `%s' option",
- p->racol?"racol":"deccol", p->racol?"Dec":"RA",
- p->xcol?"deccol":"racol");
+ if(p->kernel==NULL)
+ {
+ if( ((p->xcol==NULL) + (p->ycol==NULL)) == 1 )
+ error(EXIT_FAILURE, 0, "only `%s' has been given, please also "
+ "specify a column for the position along the %s axis with "
+ "the `%s' option", p->xcol?"xcol":"ycol", p->xcol?"Y":"X",
+ p->xcol?"ycol":"xcol");
+
+ if( ((p->racol==NULL) + (p->deccol==NULL)) == 1 )
+ error(EXIT_FAILURE, 0, "only `%s' has been given, please also "
+ "specify a column for the position along the %s axis with "
+ "the `%s' option", p->racol?"racol":"deccol",
+ p->racol?"Dec":"RA", p->xcol?"deccol":"racol");
+ }
}
@@ -269,19 +448,31 @@ ui_check_options_and_arguments(struct mkprofparams *p)
int d0f1;
char *tmpname;
- /* Make sure an input catalog is given, and if it is FITS, that the HDU
- is also provided. */
- if(p->catname)
+ /* If no kernel is given, make sure an input catalog is given, and if it
+ is FITS, that the HDU is also provided. When a kernel option, we will
+ set a fiducial catalog name called `kernel.txt' to automatic output
+ filename generation. */
+ if(p->kernel)
{
- if( gal_fits_name_is_fits(p->catname) && p->cp.hdu==NULL)
- error(EXIT_FAILURE, 0, "no `hdu' specified for the input FITS table "
- "'%s', to ", p->catname);
+ if(p->catname)
+ error(EXIT_FAILURE, 0, "`--kernel' cannot be called with an input "
+ "catalog (`%s'). The parameters necessary to build a single "
+ "kernel output should be given to `--kernel', not in a "
+ "catalog", p->catname);
+ p->catname="kernel.option";
}
else
{
- error(EXIT_FAILURE, 0, "no input catalog provided. To build profiles, "
- "you need to give a catalog/table containing the information of "
- "the profiles");
+ if(p->catname)
+ {
+ if( gal_fits_name_is_fits(p->catname) && p->cp.hdu==NULL)
+ error(EXIT_FAILURE, 0, "no `hdu' specified for the input FITS "
+ "table '%s', to ", p->catname);
+ }
+ else
+ error(EXIT_FAILURE, 0, "no input catalog provided. To build "
+ "profiles, you need to give a catalog/table containing "
+ "the information of the profiles");
}
@@ -309,8 +500,10 @@ ui_check_options_and_arguments(struct mkprofparams *p)
}
p->basename=gal_checkset_not_dir_part(p->mergedimgname);
- /* If a merged image is requested, then delete it if it exists. */
- if(p->nomerged==0)
+
+ /* If a merged image is requested (or `--kernel' the option is called),
+ then delete the final filename if it exists. */
+ if(p->nomerged==0 && p->kernel)
gal_checkset_check_remove_file(p->mergedimgname, p->cp.keep,
p->cp.dontdelete);
}
@@ -338,50 +531,11 @@ ui_check_options_and_arguments(struct mkprofparams *p)
/*************** Preparations *******************/
/**************************************************************/
static void
-ui_read_profile_function(struct mkprofparams *p, char **strarr)
-{
- size_t i;
-
- p->f=gal_data_malloc_array(GAL_TYPE_INT32, p->num, __func__, "p->f");
- for(i=0;i<p->num;++i)
- {
- if( !strcmp("sersic", strarr[i]) )
- p->f[i]=PROFILE_SERSIC;
-
- else if ( !strcmp("moffat", strarr[i]) )
- p->f[i]=PROFILE_MOFFAT;
-
- else if ( !strcmp("gaussian", strarr[i]) )
- p->f[i]=PROFILE_GAUSSIAN;
-
- else if ( !strcmp("point", strarr[i]) )
- p->f[i]=PROFILE_POINT;
-
- else if ( !strcmp("flat", strarr[i]) )
- p->f[i]=PROFILE_FLAT;
-
- else if ( !strcmp("circum", strarr[i]) )
- p->f[i]=PROFILE_CIRCUMFERENCE;
-
- else if ( !strcmp(GAL_BLANK_STRING, strarr[i]) )
- error(EXIT_FAILURE, 0, "profile function column has blank values. "
- "Input columns cannot contain blank values");
- else
- error(EXIT_FAILURE, 0, "`%s' not recognized as a profile function "
- "name in row %zu", strarr[i], i);
- }
-}
-
-
-
-
-
-static void
ui_read_cols(struct mkprofparams *p)
{
int checkblank;
- char *colname=NULL;
size_t counter=0, i;
+ char *colname=NULL, **strarr;
gal_list_str_t *colstrs=NULL;
gal_data_t *cols, *tmp, *corrtype=NULL;
char *ax1col=p->racol?p->racol:p->xcol;
@@ -436,7 +590,11 @@ ui_read_cols(struct mkprofparams *p)
case 7:
if(tmp->type==GAL_TYPE_STRING)
{
- ui_read_profile_function(p, tmp->array);
+ p->f=gal_data_malloc_array(GAL_TYPE_INT32, p->num,
+ __func__, "p->f");
+ strarr=tmp->array;
+ for(i=0;i<p->num;++i)
+ p->f[i]=ui_profile_name_read(strarr[i], i+1);
gal_data_free(tmp);
corrtype=NULL;
}
@@ -503,10 +661,10 @@ ui_read_cols(struct mkprofparams *p)
/* If the index isn't recognized, then it is larger, showing that
there was more than one match for the given criteria */
default:
- gal_tableintern_error_col_selection(p->catname, p->cp.hdu, "too many
"
- "columns were selected by the "
- "given values to the options "
- "ending in `col'.");
+ gal_tableintern_error_col_selection(p->catname, p->cp.hdu, "too "
+ "many columns were selected "
+ "by the given values to the "
+ "options ending in `col'.");
}
/* Sanity check and clean up. Note that it might happen that the
@@ -534,6 +692,61 @@ ui_read_cols(struct mkprofparams *p)
+/* It is possible to define the internal catalog through a catalog or the
+ `--kernel' option. This function will do the job. */
+static void
+ui_prepare_columns(struct mkprofparams *p)
+{
+ float r, n, t;
+ double *karr;
+
+ /* If the kernel option was called, then we need to build a series of
+ single element columns to create an internal catalog. */
+ if(p->kernel)
+ {
+ /* Number of profiles to be built. */
+ p->num=1;
+
+ /* Allocate the necessary columns. */
+ p->x=gal_data_malloc_array(GAL_TYPE_FLOAT64, 1, __func__, "p->x");
+ p->y=gal_data_malloc_array(GAL_TYPE_FLOAT64, 1, __func__, "p->y");
+ p->f=gal_data_malloc_array(GAL_TYPE_UINT8, 1, __func__, "p->f");
+ p->r=gal_data_malloc_array(GAL_TYPE_FLOAT32, 1, __func__, "p->r");
+ p->n=gal_data_malloc_array(GAL_TYPE_FLOAT32, 1, __func__, "p->n");
+ p->p=gal_data_malloc_array(GAL_TYPE_FLOAT32, 1, __func__, "p->p");
+ p->q=gal_data_malloc_array(GAL_TYPE_FLOAT32, 1, __func__, "p->q");
+ p->m=gal_data_malloc_array(GAL_TYPE_FLOAT32, 1, __func__, "p->m");
+ p->t=gal_data_malloc_array(GAL_TYPE_FLOAT32, 1, __func__, "p->t");
+
+ /* Set the values that need special consideration. */
+ if(p->kernel->size)
+ {
+ karr=p->kernel->array;
+ r = karr[0];
+ n = p->kernel->size==2 ? 0.0f : karr[1];
+ t = p->kernel->size==1 ? 1.0f : karr[ p->kernel->size - 1 ];
+ }
+ else r=n=t=0.0f;
+
+ /* Fill the allocated spaces. */
+ p->x[0] = 0.0f;
+ p->y[0] = 0.0f;
+ p->f[0] = p->kernel->status;
+ p->r[0] = r;
+ p->n[0] = n;
+ p->p[0] = 0.0f;
+ p->q[0] = 1.0f;
+ p->m[0] = 0.0f;
+ p->t[0] = t;
+ }
+ else
+ ui_read_cols(p);
+}
+
+
+
+
+
static void
ui_prepare_wcs(struct mkprofparams *p)
{
@@ -600,6 +813,11 @@ ui_prepare_canvas(struct mkprofparams *p)
image to build the profiles over. */
if(p->backname)
{
+ /* Make sure the kernel option is not called. */
+ if(p->kernel)
+ error(EXIT_FAILURE, 0, "the `--kernel' and `--background' options "
+ "cannot be called together");
+
/* Small sanity check. */
if(p->backhdu==NULL)
error(EXIT_FAILURE, 0, "no hdu specified for the background image "
@@ -636,7 +854,6 @@ ui_prepare_canvas(struct mkprofparams *p)
}
else
{
-
/* If any of xshift or yshift is non-zero, the other should be too!
Note that conditional operators return 1 if true and 0 if false,
so if one is non-zero while the other is zero, then sum will be
@@ -800,6 +1017,7 @@ ui_finalize_coordinates(struct mkprofparams *p)
+
/* Add all the columns of the log file. Just note that since this is a
linked list, we have to add them in the opposite order. */
static void
@@ -849,9 +1067,17 @@ ui_make_log(struct mkprofparams *p)
static void
ui_preparations(struct mkprofparams *p)
{
+ /* If the kernel option was given, some parameters need to be
+ over-written: */
+ if(p->kernel)
+ {
+ p->nomerged=1;
+ p->psfinimg=0;
+ p->individual=1;
+ }
/* Read in all the columns. */
- ui_read_cols(p);
+ ui_prepare_columns(p);
/* Prepare the output canvas. */
ui_prepare_canvas(p);
@@ -898,8 +1124,12 @@ ui_print_intro(struct mkprofparams *p)
printf(PROGRAM_NAME" started on %s", ctime(&p->rawtime));
- asprintf(&jobname, "%zu profile%sread from %s", p->num,
- p->num>1?"s ":" ", p->catname);
+ if(p->kernel)
+ asprintf(&jobname, "Building one %s kernel",
+ ui_profile_name_write(p->kernel->status));
+ else
+ asprintf(&jobname, "%zu profile%sread from %s", p->num,
+ p->num>1?"s ":" ", p->catname);
gal_timing_report(NULL, jobname, 1);
free(jobname);
@@ -926,9 +1156,12 @@ ui_print_intro(struct mkprofparams *p)
free(jobname);
}
- asprintf(&jobname, "Using %zu threads.", p->cp.numthreads);
- gal_timing_report(NULL, jobname, 1);
- free(jobname);
+ if(p->kernel==NULL)
+ {
+ asprintf(&jobname, "Using %zu threads.", p->cp.numthreads);
+ gal_timing_report(NULL, jobname, 1);
+ free(jobname);
+ }
}
diff --git a/bin/mkprof/ui.h b/bin/mkprof/ui.h
index 3b948b2..c7361cb 100644
--- a/bin/mkprof/ui.h
+++ b/bin/mkprof/ui.h
@@ -32,7 +32,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
Available letters (-V which is used by GNU is also removed):
a b d g j l n u v
- A E G H J L O Q W
+ A G H J L O Q W
*/
enum option_keys_enum
{
@@ -42,6 +42,7 @@ enum option_keys_enum
UI_KEY_NAXIS1 = 'x',
UI_KEY_NAXIS2 = 'y',
UI_KEY_CLEARCANVAS = 'C',
+ UI_KEY_KERNEL = 'E',
UI_KEY_OVERSAMPLE = 's',
UI_KEY_INDIVIDUAL = 'i',
UI_KEY_NOMERGED = 'm',
diff --git a/configure.ac b/configure.ac
index df71c67..4b9d39f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,7 +50,7 @@ AC_CONFIG_MACRO_DIRS([bootstrapped/m4])
# Library version, see the GNU Libtool manual ("Library interface versions"
# section for the exact definition of each) for
-GAL_CURRENT=1
+GAL_CURRENT=2
GAL_REVISION=0
GAL_AGE=0
GAL_LT_VERSION="${GAL_CURRENT}:${GAL_REVISION}:${GAL_AGE}"
@@ -121,11 +121,15 @@ AC_FUNC_MALLOC
-# Check the size of `size_t'.
+# Check the size of necessary system specific types.
AC_CHECK_SIZEOF([size_t])
AC_SUBST(SIZEOF_SIZE_T, [$ac_cv_sizeof_size_t])
AC_DEFINE_UNQUOTED([GAL_CONFIG_SIZEOF_SIZE_T], [$ac_cv_sizeof_size_t],
[On 32bit will be 4, on 64 bit, will be 8])
+AC_CHECK_SIZEOF([long])
+AC_SUBST(SIZEOF_LONG, [$ac_cv_sizeof_long])
+AC_DEFINE_UNQUOTED([GAL_CONFIG_SIZEOF_LONG], [$ac_cv_sizeof_long],
+ [Depends on bit length of system.])
diff --git a/doc/gnuastro-top.html b/doc/gnuastro-top.html
index a0dded7..73880ea 100644
--- a/doc/gnuastro-top.html
+++ b/doc/gnuastro-top.html
@@ -163,9 +163,9 @@ for entertaining and easy to read real world examples of
using
review of the Gnuastro's building and installation commands.</p>
<p>Gnuastro only has three mandatory
-dependencies: <a href="manual/html_node/CFITSIO.html">CFITSIO</a>, <a
href="manual/html_node/WCSLIB.html">WCSLIB</a>
-and <a href="manual/html_node/GNU-Scientific-Library.html">GNU Scientific
-Library</a> (GSL).</p>
+dependencies: <a href="manual/html_node/GNU-Scientific-Library.html">GNU
+Scientific
+Library</a>, <a href="manual/html_node/CFITSIO.html">CFITSIO</a>, <a
href="manual/html_node/WCSLIB.html">WCSLIB</a>.</p>
<p>For a more detailed description, see
the <a href="manual/html_node/Installation.html">Installation</a> chapter
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index ae2b02a..c36dac0 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -2565,8 +2565,8 @@ downloaded
@url{ftp://ftp.atnf.csiro.au/pub/software/wcslib/wcslib.tar.bz2,
@example
$ tar xf wcslib.tar.bz2
$ cd wcslib-X.X # Replace X.X with version number
-$ ./configure --without-pgplot LIBS="-pthread -lm"
-$ make -j8 # Replace 8 with no. CPU threads.
+$ ./configure --without-pgplot LIBS="-pthread -lm" --disable-fortran
+$ make
$ make check
$ sudo make install
@end example
@@ -8347,9 +8347,6 @@ checked and this column will be given a value of
@code{-1}.
-
-
-
@node Arithmetic, Convolve, Crop, Data manipulation
@section Arithmetic
@@ -14189,15 +14186,14 @@ familiar with these concepts.
@subsubsection Defining an ellipse
@cindex Ellipse
-The PSF, see @ref{PSF}, and galaxy radial profiles are generally
-defined on an ellipse so in this section first defining an ellipse on
-a pixelated 2D surface is discussed. Labeling the major axis of an
-ellipse @mymath{a}, and its minor axis with @mymath{b}, the axis ratio
-is defined as: @mymath{q\equiv b/a}. The major axis of an ellipse can
-be aligned in any direction, therefore define the angle of the major
-axis to the horizontal axis of the image is defined to be the position
-angle of the ellipse and in this book, we show it with
-@mymath{\theta}.
+The PSF, see @ref{PSF}, and galaxy radial profiles are generally defined on
+an ellipse so in this section first defining an ellipse on a pixelated 2D
+surface is discussed. Labeling the major axis of an ellipse @mymath{a}, and
+its minor axis with @mymath{b}, the axis ratio is defined as:
+@mymath{q\equiv b/a}. The major axis of an ellipse can be aligned in any
+direction, therefore the angle of the major axis with respect to the
+horizontal axis of the image is defined to be the position angle of the
+ellipse and in this book, we show it with @mymath{\theta}.
@cindex Radial profile on ellipse
Our aim is to put a radial profile of any functional form
@@ -14695,7 +14691,7 @@ either individually or in one image. The executable
name is
@file{astmkprof} with the following general template
@example
-$ astmkprof [OPTION ...] [BackgroundImage] Catalog
+$ astmkprof [OPTION ...] [Catalog]
@end example
@noindent
@@ -14708,6 +14704,9 @@ $ astmkprof catalog.txt
## Make the profiles in catalog.txt over image.fits:
$ astmkprof --background=image.fits catalog.txt
+## Make a Moffat PSF with FWHM 3pix, beta=2.8, truncation=5
+$ astmkprof --kernel=moffat,2.8,5 --oversample=1
+
## Make profiles in catalog, using RA and Dec in the given column:
$ astmkprof --racol=RA_CENTER --ycol=DEC_CENTER catalog.txt
@@ -14717,28 +14716,29 @@ $ astmkprof --individual --oversample 3 -x500 -y500
catalog.txt
@end example
@noindent
-If mock images are to be made, a catalog (which stores the parameters for
-each mock profile) is mandatory. The catalog can be in the FITS ASCII, FITS
-binary format, or plain text formats (see @ref{Tables}). The
-columns related to each parameter can be determined both by number, or by
-match/search criteria using the column names, units, or comments. with the
-options ending in @option{col}, see below. Without any file given to the
-@option{--background} option, MakeProfiles will make the fully zero-valued
-image and build the profiles on that (its size can be set with the
-@option{--naxis1} and @option{--naxis2} options, and its main WCS parameters
-can also be defined). Besides the main image containing all the profiles it
-is also possible to build on individual images (only enclosing one full
-profile to its truncation radius) with the @option{--individual}.
-
-If a data image file (see @ref{Arguments}) is given, the pixels of
-that image are used as the background value for every pixel. The flux
-value of each profile pixel will be added to the pixel in that
-background value. In this case the values to all options relating to
-the output size and WCS will be ignored if specified (for example
-@option{--naxis1}, @option{--naxis2} and @option{--prepforconv}) on
-the command-line or in the configuration files. Note that
-@option{--oversample} will remain active even if a background image is
-specified.
+The parameters of the mock profiles can either be given through a catalog
+(which stores the parameters of many mock profiles), or the
+@option{--kernel} option (see @ref{MakeProfiles options}). The catalog can
+be in the FITS ASCII, FITS binary format, or plain text formats (see
+@ref{Tables}). The columns related to each parameter can be determined both
+by number, or by match/search criteria using the column names, units, or
+comments. with the options ending in @option{col}, see below.
+
+Without any file given to the @option{--background} option, MakeProfiles
+will make a zero-valued image and build the profiles on that (its size and
+main WCS parameters can also be defined through the options). Besides the
+main/merged image containing all the profiles in the catalog, it is also
+possible to build individual images for each profile (only enclosing one
+full profile to its truncation radius) with the @option{--individual}
+option.
+
+If an image is given to the @option{--background} option, the pixels of
+that image are used as the background value for every pixel. The flux value
+of each profile pixel will be added to the pixel in that background
+value. In this case, the values to all options relating to the output size
+and WCS will be ignored if specified (for example @option{--oversample},
+@option{--naxis1}, @option{--naxis2} and @option{--prepforconv}) on the
+command-line or in the configuration files.
Please see @ref{Sufi simulates a detection} for a very complete tutorial
explaining how one could use MakeProfiles in conjunction with other
@@ -14804,6 +14804,41 @@ Output:
@table @option
+@item -E STR/INT,FLT[,FLT,[...]]
+@itemx --kernel=STR/INT,FLT[,FLT,[...]]
+Only build one kernel profile with the parameters given as the values to
+this option. The different values must be separated by a comma
+(@key{,}). The first value identifies the radial function of the profile,
+either through a string or through a number (see description of
+@option{--fcol} below). Each radial profile needs a different total number
+of parameters: S@'ersic and Moffat functions need 3 parameters: radial,
+S@'ersic index or Moffat @mymath{\beta}, and truncation radius. The
+Gaussian function needs two parameters: radial and truncation radius. The
+point function doesn't need any parameters and flat and circumference
+profiles just need one parameter (truncation radius).
+
+The PSF or kernel is a unique (and highly constrained) type of profile: the
+sum of its pixels must be one, its center must be the center of the central
+pixel (in an image with an odd number of pixels on each side), and commonly
+it is circular, so its axis ratio and position angle are one and zero
+respectively. Kernels are commonly necessary for various data analysis and
+data manipulation steps (for example see @ref{Convolve}, and
+@ref{NoiseChisel}. Because of this it is inconvenient to define a catalog
+with one row and many zero valued columns (for all the non-necessary
+parameters). Hence, with this option, it is possible to create a kernel
+with MakeProfiles without the need to create a catalog. Here are some
+examples:
+
+@table @option
+@item --kernel=moffat,3,2.8,5
+A Moffat kernel with FWHM of 3 pixels, @mymath{\beta=2.8} which is
+truncated at 5 times the FWHM.
+
+@item --kernel=gaussian,2,3
+A Gaussian kernel with FWHM of 2 pixels and truncated at 3 times the FWHM.
+@end table
+
+
@item -k STR
@itemx --background=STR
A background image FITS file to build the profiles on. The extension that
@@ -16922,11 +16957,12 @@ relevant for you if you intend to use the binary
operators of
@cindex 64-bit
@cindex bit-32
@cindex bit-64
-@deffn Macro GAL_CONFIG_SIZEOF_SIZE_T
-The size of (number of bytes in) the system's @code{size_t} type. Its value
-is either 4 or 8 for 32-bit and 64-bit systems. You can also get this value
-with the expression `@code{sizeof size_t}' without having to include this
-header.
+@deffn Macro GAL_CONFIG_SIZEOF_LONG
+@deffnx Macro GAL_CONFIG_SIZEOF_SIZE_T
+The size of (number of bytes in) the system's @code{long} and @code{size_t}
+types. Their values are commonly either 4 or 8 for 32-bit and 64-bit
+systems. You can also get this value with the expression `@code{sizeof
+size_t}' for example without having to include this header.
@end deffn
@node Multithreaded programming, Library data types, Configuration
information, Gnuastro library
@@ -17235,6 +17271,11 @@ Identifier for a @code{size_t} type. This is just an
alias to
respectively.
@end deffn
+@deffn {Global integer} GAL_TYPE_LONG
+Identifier for a @code{long} type. This is just an alias to @code{int32},
+or @code{int64} types for 32-bit, or 64-bit systems respectively.
+@end deffn
+
@deffn {Global integer} GAL_TYPE_FLOAT32
Identifier for a 32-bit single precision floating point type or
@code{float} in C.
diff --git a/doc/release-checklist.txt b/doc/release-checklist.txt
index 2a45564..3105b43 100644
--- a/doc/release-checklist.txt
+++ b/doc/release-checklist.txt
@@ -125,20 +125,21 @@ Packaging in Debian
Steps necessary to Package Gnuastro for Debian.
- - If you don't already have the Git repository, clone it with this
- command:
+ - If you don't already have the Git repository, clone it with the
+ following command. A `gnuastro' directory will be built, for the moment
+ don't go in it.
$ git clone git://anonscm.debian.org/debian-astro/packages/gnuastro.git
- - Pull any possible changes that already exist:
+ - If a Git directory exists, then pull any possible changes that already
+ exist:
$ cd gnuastro
$ git pull
$ cd ..
- - A `gnuastro' directory will be built, for the moment don't go in it,
- we'll keep all temporary files in this parent directory. Clean any
- existing ones (if this process was done earlier):
+ - Clean any existing files (if this process was already done for an
+ earlier version):
$ rm -f gnuastro_* gnuastro-*
@@ -203,6 +204,13 @@ Steps necessary to Package Gnuastro for Debian.
$ emacs debian/control
+ - If the soname of the shared libraries has changed:
+
+ - Rename the file `debain/libgnuastroX.install' (set `X' to the new
+ soname).
+
+ - In `debian control, change all the old sonames to the new value.
+
- Update your version of `pbuilder':
$ sudo pbuilder update
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d68448a..db56754 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -125,6 +125,7 @@ gnuastro/config.h: Makefile $(internaldir)/config.h.in
-e 's|@HAVE_BIN_OP_INT64[@]|$(HAVE_BIN_OP_INT64)|g' \
-e 's|@HAVE_BIN_OP_FLOAT32[@]|$(HAVE_BIN_OP_FLOAT32)|g' \
-e 's|@HAVE_BIN_OP_FLOAT64[@]|$(HAVE_BIN_OP_FLOAT64)|g' \
+ -e 's|@SIZEOF_LONG[@]|$(SIZEOF_LONG)|g' \
-e 's|@SIZEOF_SIZE_T[@]|$(SIZEOF_SIZE_T)|g' \
-e 's|@RESTRICT_REPLACEMENT[@]|$(RESTRICT_REPLACEMENT)|g' \
$(internaldir)/config.h.in >> $@.tmp
diff --git a/lib/box.c b/lib/box.c
index 1b085fd..d7d3386 100644
--- a/lib/box.c
+++ b/lib/box.c
@@ -129,6 +129,7 @@ gal_box_border_from_center(double *center, size_t ndim,
long *width,
+
/* Problem to solve: We have set the first and last pixels in an input
image (fpixel_i[2] and lpixel_i[2]). But those first and last
pixels don't necessarily have to lie within the image, they can be
diff --git a/lib/gnuastro-internal/config.h.in
b/lib/gnuastro-internal/config.h.in
index 600cf58..b40ad23 100644
--- a/lib/gnuastro-internal/config.h.in
+++ b/lib/gnuastro-internal/config.h.in
@@ -53,6 +53,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#define GAL_CONFIG_BIN_OP_FLOAT32 @HAVE_BIN_OP_FLOAT32@
#define GAL_CONFIG_BIN_OP_FLOAT64 @HAVE_BIN_OP_FLOAT64@
+#define GAL_CONFIG_SIZEOF_LONG @SIZEOF_LONG@
#define GAL_CONFIG_SIZEOF_SIZE_T @SIZEOF_SIZE_T@
diff --git a/lib/gnuastro-internal/options.h b/lib/gnuastro-internal/options.h
index 84b3978..20b16f6 100644
--- a/lib/gnuastro-internal/options.h
+++ b/lib/gnuastro-internal/options.h
@@ -48,6 +48,9 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
only applies to them. */
#define GAL_OPTIONS_MAX_VALUE_LEN 10
+/* Statically allocated space for printing option values. */
+#define GAL_OPTIONS_STATIC_MEM_FOR_VALUES 2000
+
/* Statically allocated space for printing option values. */
#define GAL_OPTIONS_STATIC_MEM_FOR_VALUES 2000
diff --git a/lib/gnuastro/type.h b/lib/gnuastro/type.h
index e40aca5..6f0090b 100644
--- a/lib/gnuastro/type.h
+++ b/lib/gnuastro/type.h
@@ -88,16 +88,31 @@ enum gal_types
GAL_TYPE_STRLL, /* Linked list of strings. */
};
-/* `size_t' is 4 and 8 bytes on 32 and 64 bit systems respectively. In both
- cases, the standard defines `size_t' to be unsigned. During
- `./configure' the sizeof size_t was found and is stored in
- `GAL_CONFIG_SIZEOF_SIZE_T'. */
+
+
+/* Define system specific types. For example `size_t' is 4 and 8 bytes on
+ 32 and 64 bit systems respectively. In both cases, the standard defines
+ `size_t' to be unsigned. A similar case exists for `long', but it is
+ signed. During `./configure' the sizeof `size_t' and `long' were found
+ and are used to define an alias for these system specific types.
+
+ Note: we are not using `else'. This is done because by any chance, if
+ the length of these types is not what is expected (4 or 8), then the
+ aliases are not defined and the compiler will crash. */
#if GAL_CONFIG_SIZEOF_SIZE_T == 4
#define GAL_TYPE_SIZE_T GAL_TYPE_UINT32
-#else
+#elif GAL_CONFIG_SIZEOF_SIZE_T == 8
#define GAL_TYPE_SIZE_T GAL_TYPE_UINT64
#endif
+#if GAL_CONFIG_SIZEOF_LONG == 4
+#define GAL_TYPE_LONG GAL_TYPE_INT32
+#elif GAL_CONFIG_SIZEOF_LONG == 8
+#define GAL_TYPE_LONG GAL_TYPE_INT64
+#endif
+
+
+
diff --git a/lib/options.c b/lib/options.c
index d3978a4..c90eb3c 100644
--- a/lib/options.c
+++ b/lib/options.c
@@ -175,9 +175,8 @@ gal_options_parse_list_of_numbers(char *string, char
*filename, size_t lineno)
(largest size_t number), so the values are kept in memory. */
size_t minmapsize=-1;
-
/* Go through the input character by character. */
- while(*c!='\0')
+ while(string && *c!='\0')
{
switch(*c)
{
@@ -210,6 +209,13 @@ gal_options_parse_list_of_numbers(char *string, char
*filename, size_t lineno)
++c;
break;
+ /* Extra dot is an error (cases like 2.5.5). Valid `.'s will be
+ read by `strtod'. */
+ case '.':
+ error_at_line(EXIT_FAILURE, 0, filename, lineno, "extra `.' in "
+ "`%s'", string);
+ break;
+
/* Read the number. */
default:
@@ -247,11 +253,26 @@ gal_options_parse_list_of_numbers(char *string, char
*filename, size_t lineno)
/* Allocate the output data structure and fill it up. */
- i=num;
- out=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 1, &num, NULL, 0,
- minmapsize, NULL, NULL, NULL);
- for(tdll=list;tdll!=NULL;tdll=tdll->next)
- ((double *)(out->array))[--i]=tdll->v;
+ if(num)
+ {
+ i=num;
+ out=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 1, &num, NULL, 0,
+ minmapsize, NULL, NULL, NULL);
+ for(tdll=list;tdll!=NULL;tdll=tdll->next)
+ ((double *)(out->array))[--i]=tdll->v;
+ }
+ else
+ {
+ /* It is not possible to allocate a dataset with a size of 0 along
+ any dimension (in C it's possible, but conceptually it isn't). So,
+ we'll allocate space for one element, then free it. */
+ i=1;
+ out=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 1, &i, NULL, 0,
+ minmapsize, NULL, NULL, NULL);
+ out->size=out->dsize[0]=0;
+ free(out->array);
+ out->array=NULL;
+ }
/* Clean up and return. */
diff --git a/lib/wcs.c b/lib/wcs.c
index d27282c..14fdedc 100644
--- a/lib/wcs.c
+++ b/lib/wcs.c
@@ -431,7 +431,8 @@ gal_wcs_angular_distance_deg(double r1, double d1, double
r2, double d2)
-/* Return the pixel scale of the image (in the units of the input dataset). */
+
+/* Return the pixel scale of the dataset in units of the WCS. */
double *
gal_wcs_pixel_scale(struct wcsprm *wcs)
{
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 11ab1ee..4050a2b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -234,7 +234,7 @@ EXTRA_DIST = $(TESTS) during-dev.sh buildprog/simpleio.c
crop/cat.txt \
# Files that must be cleaned with `make clean'.
-CLEANFILES = *.log *.txt *.jpg *.fits *.pdf *.eps
+CLEANFILES = *.log *.txt *.jpg *.fits *.pdf *.eps simpleio
diff --git a/tests/crop/section.sh b/tests/crop/section.sh
index 5df61bf..efcc623 100755
--- a/tests/crop/section.sh
+++ b/tests/crop/section.sh
@@ -53,4 +53,4 @@ if [ ! -f $img ]; then echo "$img does not exist.";
exit 77; fi
# enable multithreaded access to files, the tests pass. It is the
# users choice to enable this feature.
$execname $img --section=-10:*+10,:250 --output=crop_section.fits \
- --numthreads=1
+ --numthreads=1 --mode=img
- [gnuastro-commits] master updated (89db01d -> dd4d43e), Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 17d6f65 004/113: Merged recent corrections in master, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 42e04b6 002/113: Recent changes in master merged, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master f25b55e 005/113: Merged with recent changes in master, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master a11e71c 003/113: Merged with recent changes in master,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 3df6490 001/113: Crop works in 3D, except for --polygon, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master d14384a 007/113: Minor corrections in MakeProfiles manual, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 5abb468 008/113: Other minor corrections in the documentation, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 3e76e1f 010/113: MakeProfiles --kernel builds 3D kernels also, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 81f3f65 023/113: More --coordcol options acceptable in Crop, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master e47f8db 024/113: Merged recent work in master, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 8fa5ff1 026/113: Minor edit in book (part added in last commit), Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 40f0a56 013/113: Minor corrections to MakeProfiles continued, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 8372486 020/113: NoiseChisel's detection complete in 3D, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 6cc3d25 027/113: No 3D projections in function to inspect NoiseChisel outputs, Mohammad Akhlaghi, 2021/04/16