[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master e9cbeef: MakeCatalog: new --areaarcsec2 option
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master e9cbeef: MakeCatalog: new --areaarcsec2 option for area in arcsec squared |
Date: |
Sat, 17 Oct 2020 11:32:11 -0400 (EDT) |
branch: master
commit e9cbeef038bc319c422c14832f0bde70ee47a33e
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
MakeCatalog: new --areaarcsec2 option for area in arcsec squared
Until now, it was annoying to get the pixel scale separately, then multiply
its squared value to the area column to have the area in a more portable
unit of arcsec^2.
With this commit, this can now be done internally and the user can ask for
it with the new '--areaarcsec2'.
---
NEWS | 1 +
bin/mkcatalog/args.h | 14 ++++++++++++++
bin/mkcatalog/columns.c | 31 +++++++++++++++++++++++++++++++
bin/mkcatalog/main.h | 1 +
bin/mkcatalog/ui.c | 1 +
bin/mkcatalog/ui.h | 1 +
doc/gnuastro.texi | 5 +++++
7 files changed, 54 insertions(+)
diff --git a/NEWS b/NEWS
index 9ddfb75..6dd8ad6 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,7 @@ See the end of the file for license conditions.
within the image.
MakeCatalog:
+ --areaarcsec2: area of labeled region (clump/object) in arcsec^2.
--fwhmobs: The observed FWHM in pixels, along the major axis.
--fracsum: fractions to use in '--fracsumarea1' or '--fracsumarea2'.
--fracsumarea1: area of given fraction of the summed object or clump values.
diff --git a/bin/mkcatalog/args.h b/bin/mkcatalog/args.h
index c534152..35ee8f0 100644
--- a/bin/mkcatalog/args.h
+++ b/bin/mkcatalog/args.h
@@ -1435,6 +1435,20 @@ struct argp_option program_options[] =
ui_column_codes_ll
},
{
+ "areaarcsec2",
+ UI_KEY_AREAARCSEC2,
+ 0,
+ 0,
+ "Area of labeled region in arcsec^2.",
+ UI_GROUP_COLUMNS_MORPHOLOGY,
+ 0,
+ GAL_TYPE_INVALID,
+ GAL_OPTIONS_RANGE_ANY,
+ GAL_OPTIONS_NOT_MANDATORY,
+ GAL_OPTIONS_NOT_SET,
+ ui_column_codes_ll
+ },
+ {
"areaxy",
UI_KEY_AREAXY,
0,
diff --git a/bin/mkcatalog/columns.c b/bin/mkcatalog/columns.c
index 49f8cfa..932bdb5 100644
--- a/bin/mkcatalog/columns.c
+++ b/bin/mkcatalog/columns.c
@@ -30,6 +30,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <string.h>
#include <pthread.h>
+#include <gnuastro/wcs.h>
#include <gnuastro/pointer.h>
#include <gnuastro-internal/checkset.h>
@@ -189,6 +190,7 @@ static void
columns_wcs_preparation(struct mkcatalogparams *p)
{
size_t i;
+ double *pixscale;
gal_list_i32_t *colcode;
int continue_wcs_check=1;
@@ -202,6 +204,7 @@ columns_wcs_preparation(struct mkcatalogparams *p)
/* High-level. */
case UI_KEY_RA:
case UI_KEY_DEC:
+ case UI_KEY_AREAARCSEC2:
/* Low-level. */
case UI_KEY_W1:
@@ -246,6 +249,13 @@ columns_wcs_preparation(struct mkcatalogparams *p)
"the WCS axis types (CTYPE)", p->objectsfile, p->cp.hdu,
colcode->v==UI_KEY_RA ? "RA" : "DEC");
break;
+
+ /* Calculate the pixel area if necessary. */
+ case UI_KEY_AREAARCSEC2:
+ pixscale=gal_wcs_pixel_scale(p->objects->wcs);
+ p->pixelarea=pixscale[0]*pixscale[1];
+ free(pixscale);
+ break;
}
}
@@ -440,6 +450,19 @@ columns_define_alloc(struct mkcatalogparams *p)
oiflag[ OCOL_NUM ] = ciflag[ CCOL_NUM ] = 1;
break;
+ case UI_KEY_AREAARCSEC2:
+ name = "AREA_ARCSEC2";
+ unit = "arcsec2";
+ ocomment = "Number of non-blank pixels in arcsec^2";
+ ccomment = ocomment;
+ otype = GAL_TYPE_FLOAT32;
+ ctype = GAL_TYPE_FLOAT32;
+ disp_fmt = 0;
+ disp_width = 6;
+ disp_precision = 0;
+ oiflag[ OCOL_NUM ] = ciflag[ CCOL_NUM ] = 1;
+ break;
+
case UI_KEY_AREAXY:
name = "AREAXY";
unit = "counter";
@@ -2138,6 +2161,10 @@ columns_fill(struct mkcatalog_passparams *pp)
((int32_t *)colarr)[oind] = oi[OCOL_NUM];
break;
+ case UI_KEY_AREAARCSEC2:
+ ((float *)colarr)[oind] = oi[OCOL_NUM]*p->pixelarea*(3600*3600);
+ break;
+
case UI_KEY_AREAXY:
((int32_t *)colarr)[oind] = oi[OCOL_NUMXY];
break;
@@ -2488,6 +2515,10 @@ columns_fill(struct mkcatalog_passparams *pp)
((int32_t *)colarr)[cind]=ci[CCOL_NUM];
break;
+ case UI_KEY_AREAARCSEC2:
+ ((float *)colarr)[cind]=ci[CCOL_NUM]*p->pixelarea*(3600*3600);
+ break;
+
case UI_KEY_AREAXY:
((int32_t *)colarr)[cind]=ci[CCOL_NUMXY];
break;
diff --git a/bin/mkcatalog/main.h b/bin/mkcatalog/main.h
index 54b5e42..7801679 100644
--- a/bin/mkcatalog/main.h
+++ b/bin/mkcatalog/main.h
@@ -268,6 +268,7 @@ struct mkcatalogparams
size_t *numclumps_c; /* To sort the clumps table by Obj.ID. */
gal_data_t *specsliceinfo; /* Slice information for spectra. */
gal_data_t *spectra; /* Array of datasets containing spectra.*/
+ double pixelarea; /* Area of input's pixels. */
char *usedvaluesfile; /* Ptr to final name used for values. */
char *usedclumpsfile; /* Ptr to final name used for clumps. */
diff --git a/bin/mkcatalog/ui.c b/bin/mkcatalog/ui.c
index c9ed56f..0fdb289 100644
--- a/bin/mkcatalog/ui.c
+++ b/bin/mkcatalog/ui.c
@@ -126,6 +126,7 @@ ui_initialize_options(struct mkcatalogparams *p,
p->sfmagarea = NAN;
p->upnsigma = NAN;
p->zeropoint = NAN;
+ p->pixelarea = NAN;
p->sigmaclip[0] = NAN;
p->sigmaclip[1] = NAN;
p->upsigmaclip[0] = NAN;
diff --git a/bin/mkcatalog/ui.h b/bin/mkcatalog/ui.h
index d7a2303..d139016 100644
--- a/bin/mkcatalog/ui.h
+++ b/bin/mkcatalog/ui.h
@@ -105,6 +105,7 @@ enum option_keys_enum
UI_KEY_CHECKUPLIM,
UI_KEY_NOCLUMPSORT,
UI_KEY_FRACSUM,
+ UI_KEY_AREAARCSEC2,
UI_KEY_OBJID, /* Catalog columns. */
UI_KEY_IDINHOSTOBJ,
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 44934e7..bb14c01 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -16262,6 +16262,11 @@ This is the square root of the mean variance under the
object, or the root mean
@itemx --area
The raw area (number of pixels/voxels) in any clump or object independent of
what pixel it lies over (if it is NaN/blank or unused for example).
+@item --areaarcsec2
+The used (non-blank in values image) area of the labeled region in units of
arcsec squared.
+This column is just the value of the @option{--area} column, multiplied by the
area of each pixel in the input image (in units of arcsec^2).
+Similar to the @option{--ra} or @option{--dec} columns, for this option to
work, the objects extension used has to have a WCS structure.
+
@item --areaxy
@cindex IFU: Integral Field Unit
@cindex Integral Field Unit
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master e9cbeef: MakeCatalog: new --areaarcsec2 option for area in arcsec squared,
Mohammad Akhlaghi <=