[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 847a0fa: Format agnostic functions for reading
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 847a0fa: Format agnostic functions for reading arrays |
Date: |
Fri, 6 Apr 2018 09:45:29 -0400 (EDT) |
branch: master
commit 847a0facd52c6932f040d2feec8ae86b86babd42
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Format agnostic functions for reading arrays
Until now, all the programs would only read from FITS files, but with the
wrapper `lib/array.c' library, we can now read in data from any of the
recognized types (JPEG, TIFF, FITS, or even plain text). So the
`gal_array_read_one_ch' was defined to make sure that the read dataset
contains only a single channel (since TIFF and JPEG images can contain
multiple channels in each image). This function now replaces the
`gal_fits_img_read' function in all the programs for the main input. In
some cases, the kernels had a special function that needs to also be
corrected later (maybe in the convolution library).
---
NEWS | 6 ++++++
bin/arithmetic/arithmetic.c | 5 +++--
bin/arithmetic/operands.c | 3 ++-
bin/convolve/ui.c | 10 ++++++----
bin/mkcatalog/ui.c | 28 ++++++++++++++++------------
bin/mknoise/ui.c | 3 ++-
bin/mkprof/ui.c | 7 ++++---
bin/noisechisel/ui.c | 11 +++++++----
bin/segment/ui.c | 21 ++++++++++++---------
bin/statistics/ui.c | 3 ++-
bin/warp/ui.c | 6 ++++--
doc/gnuastro.texi | 17 +++++++++++++++++
lib/array.c | 38 ++++++++++++++++++++++++++++++++++++++
lib/gnuastro/array.h | 7 +++++++
lib/tiff.c | 6 +++---
lib/wcs.c | 4 ++++
16 files changed, 133 insertions(+), 42 deletions(-)
diff --git a/NEWS b/NEWS
index a426177..e34dbe0 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,10 @@ GNU Astronomy Utilities NEWS -*-
outline -*-
** New features
+ All programs:
+ - Input datasets can now be given in any of the formats recognized by
+ Gnuastro (and with libraries available on the system).
+
New program:
- Segment: new program in charge of segmentation over detections.
@@ -47,6 +51,8 @@ GNU Astronomy Utilities NEWS -*-
outline -*-
Libraries:
gal_array_read: read array from any of known formats (FITS,TIFF,JPEG,...).
gal_array_read_to_type: similar to `gal_array_read', but to given type.
+ gal_array_read_one_ch: Read in the data and make sure it is in one channel.
+ gal_array_read_one_ch_to_type: Make sure input is in one channel and type.
gal_blank_is: check to see if argument is blank in its type or not.
gal_eps_name_is_eps: Returns 1 if given filename is EPS.
gal_eps_suffix_is_eps: Returns 1 if given suffix is EPS.
diff --git a/bin/arithmetic/arithmetic.c b/bin/arithmetic/arithmetic.c
index 8e27afe..7be17cc 100644
--- a/bin/arithmetic/arithmetic.c
+++ b/bin/arithmetic/arithmetic.c
@@ -31,6 +31,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/wcs.h>
#include <gnuastro/fits.h>
+#include <gnuastro/array.h>
#include <gnuastro/threads.h>
#include <gnuastro/dimension.h>
#include <gnuastro/statistics.h>
@@ -773,8 +774,8 @@ reversepolish(struct arithmeticparams *p)
filename=p->operands->filename;
if( gal_fits_name_is_fits(filename) )
{
- p->operands->data=gal_fits_img_read(filename, hdu,
- p->cp.minmapsize);
+ p->operands->data=gal_array_read_one_ch(filename, hdu,
+ p->cp.minmapsize);
p->refdata.wcs=gal_wcs_read(filename, hdu, 0, 0, &p->refdata.nwcs);
if(!p->cp.quiet) printf(" - %s (hdu %s) is read.\n", filename, hdu);
}
diff --git a/bin/arithmetic/operands.c b/bin/arithmetic/operands.c
index d775071..bab5625 100644
--- a/bin/arithmetic/operands.c
+++ b/bin/arithmetic/operands.c
@@ -31,6 +31,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/wcs.h>
#include <gnuastro/fits.h>
+#include <gnuastro/array.h>
#include <gnuastro-internal/checkset.h>
#include "main.h"
@@ -122,7 +123,7 @@ operands_pop(struct arithmeticparams *p, char *operator)
filename=operands->filename;
/* Read the dataset. */
- data=gal_fits_img_read(filename, hdu, p->cp.minmapsize);
+ data=gal_array_read_one_ch(filename, hdu, p->cp.minmapsize);
/* In case this is the first image that is read, then keep the WCS
information in the `refdata' structure. */
diff --git a/bin/convolve/ui.c b/bin/convolve/ui.c
index 3dbfa85..75e4774 100644
--- a/bin/convolve/ui.c
+++ b/bin/convolve/ui.c
@@ -33,6 +33,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/tile.h>
#include <gnuastro/blank.h>
#include <gnuastro/table.h>
+#include <gnuastro/array.h>
#include <gnuastro/threads.h>
#include <gnuastro/arithmetic.h>
#include <gnuastro/statistics.h>
@@ -294,8 +295,9 @@ ui_read_kernel(struct convolveparams *p)
float *f, *ff;
/* Read the image into file. */
- p->kernel = gal_fits_img_read_to_type(p->kernelname, p->khdu,
- GAL_TYPE_FLOAT32, p->cp.minmapsize);
+ p->kernel = gal_array_read_one_ch_to_type(p->kernelname, p->khdu,
+ GAL_TYPE_FLOAT32,
+ p->cp.minmapsize);
/* Convert all the NaN pixels to zero if the kernel contains blank
pixels, also update the flags so it is not checked any more. */
@@ -341,8 +343,8 @@ ui_preparations(struct convolveparams *p)
/* Read the input image as a float64 array. */
- p->input=gal_fits_img_read_to_type(p->filename, cp->hdu,
- GAL_TYPE_FLOAT32, cp->minmapsize);
+ p->input=gal_array_read_one_ch_to_type(p->filename, cp->hdu,
+ GAL_TYPE_FLOAT32, cp->minmapsize);
p->input->wcs=gal_wcs_read(p->filename, cp->hdu, 0, 0, &p->input->nwcs);
diff --git a/bin/mkcatalog/ui.c b/bin/mkcatalog/ui.c
index 8f02eb4..25da469 100644
--- a/bin/mkcatalog/ui.c
+++ b/bin/mkcatalog/ui.c
@@ -32,6 +32,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/wcs.h>
#include <gnuastro/fits.h>
#include <gnuastro/blank.h>
+#include <gnuastro/array.h>
#include <gnuastro/threads.h>
#include <gnuastro/dimension.h>
#include <gnuastro/arithmetic.h>
@@ -503,8 +504,8 @@ ui_read_labels(struct mkcatalogparams *p)
gal_data_t *tmp, *keys=gal_data_array_calloc(2);
/* Read it into memory. */
- p->objects = gal_fits_img_read(p->objectsfile, p->cp.hdu,
- p->cp.minmapsize);
+ p->objects = gal_array_read_one_ch(p->objectsfile, p->cp.hdu,
+ p->cp.minmapsize);
/* Make sure it has an integer type. */
@@ -567,8 +568,8 @@ ui_read_labels(struct mkcatalogparams *p)
"configuration file", p->usedclumpsfile);
/* Read the clumps image. */
- p->clumps = gal_fits_img_read(p->usedclumpsfile, p->clumpshdu,
- p->cp.minmapsize);
+ p->clumps = gal_array_read_one_ch(p->usedclumpsfile, p->clumpshdu,
+ p->cp.minmapsize);
/* Check its size. */
if( gal_data_dsize_is_different(p->objects, p->clumps) )
@@ -864,8 +865,9 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
"give the filename", p->usedvaluesfile);
/* Read the values dataset. */
- p->values=gal_fits_img_read_to_type(p->usedvaluesfile, p->valueshdu,
- GAL_TYPE_FLOAT32, p->cp.minmapsize);
+ p->values=gal_array_read_one_ch_to_type(p->usedvaluesfile, p->valueshdu,
+ GAL_TYPE_FLOAT32,
+ p->cp.minmapsize);
/* Make sure it has the correct size. */
if( gal_data_dsize_is_different(p->objects, p->values) )
@@ -907,8 +909,9 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
"the filename", p->usedskyfile);
/* Read the sky image. */
- p->sky=gal_fits_img_read_to_type(p->usedskyfile, p->skyhdu,
- GAL_TYPE_FLOAT32, p->cp.minmapsize);
+ p->sky=gal_array_read_one_ch_to_type(p->usedskyfile, p->skyhdu,
+ GAL_TYPE_FLOAT32,
+ p->cp.minmapsize);
/* Check its size. */
ui_preparation_check_size_read_tiles(p, p->sky, p->usedskyfile,
@@ -945,8 +948,9 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
p->usedstdfile);
/* Read the Sky standard deviation image into memory. */
- p->std=gal_fits_img_read_to_type(p->usedstdfile, p->stdhdu,
- GAL_TYPE_FLOAT32, p->cp.minmapsize);
+ p->std=gal_array_read_one_ch_to_type(p->usedstdfile, p->stdhdu,
+ GAL_TYPE_FLOAT32,
+ p->cp.minmapsize);
/* Check its size. */
ui_preparation_check_size_read_tiles(p, p->std, p->usedstdfile,
@@ -978,8 +982,8 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
p->upmaskfile);
/* Read the mask image. */
- p->upmask = gal_fits_img_read(p->upmaskfile, p->upmaskhdu,
- p->cp.minmapsize);
+ p->upmask = gal_array_read_one_ch(p->upmaskfile, p->upmaskhdu,
+ p->cp.minmapsize);
/* Check its size. */
if( gal_data_dsize_is_different(p->objects, p->upmask) )
diff --git a/bin/mknoise/ui.c b/bin/mknoise/ui.c
index 2ff070d..f713784 100644
--- a/bin/mknoise/ui.c
+++ b/bin/mknoise/ui.c
@@ -30,6 +30,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/wcs.h>
#include <gnuastro/fits.h>
+#include <gnuastro/array.h>
#include <gnuastro/table.h>
#include <gnuastro-internal/timing.h>
@@ -281,7 +282,7 @@ void
ui_preparations(struct mknoiseparams *p)
{
/* Read the input image as a double type */
- p->input=gal_fits_img_read_to_type(p->inputname, p->cp.hdu,
+ p->input=gal_array_read_one_ch_to_type(p->inputname, p->cp.hdu,
GAL_TYPE_FLOAT64, p->cp.minmapsize);
p->input->wcs=gal_wcs_read(p->inputname, p->cp.hdu, 0, 0, &p->input->nwcs);
diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index eecbb47..ab0f695 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -31,6 +31,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/wcs.h>
#include <gnuastro/box.h>
#include <gnuastro/fits.h>
+#include <gnuastro/array.h>
#include <gnuastro/blank.h>
#include <gnuastro/table.h>
@@ -1030,9 +1031,9 @@ ui_prepare_canvas(struct mkprofparams *p)
else
{
/* Read the image. */
- p->out=gal_fits_img_read_to_type(p->backname, p->backhdu,
- GAL_TYPE_FLOAT32,
- p->cp.minmapsize);
+ p->out=gal_array_read_one_ch_to_type(p->backname, p->backhdu,
+ GAL_TYPE_FLOAT32,
+ p->cp.minmapsize);
p->out->wcs=gal_wcs_read(p->backname, p->backhdu, 0, 0,
&p->out->nwcs);
diff --git a/bin/noisechisel/ui.c b/bin/noisechisel/ui.c
index 6e60cca..00fa9cb 100644
--- a/bin/noisechisel/ui.c
+++ b/bin/noisechisel/ui.c
@@ -30,6 +30,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/wcs.h>
#include <gnuastro/fits.h>
+#include <gnuastro/array.h>
#include <gnuastro/blank.h>
#include <gnuastro/threads.h>
#include <gnuastro/dimension.h>
@@ -524,8 +525,9 @@ ui_preparations(struct noisechiselparams *p)
/* Read the input as a single precision floating point dataset. */
- p->input = gal_fits_img_read_to_type(p->inputname, p->cp.hdu,
- GAL_TYPE_FLOAT32, p->cp.minmapsize);
+ p->input = gal_array_read_one_ch_to_type(p->inputname, p->cp.hdu,
+ GAL_TYPE_FLOAT32,
+ p->cp.minmapsize);
p->input->wcs = gal_wcs_read(p->inputname, p->cp.hdu, 0, 0,
&p->input->nwcs);
if(p->input->name==NULL)
@@ -544,8 +546,9 @@ ui_preparations(struct noisechiselparams *p)
if(p->convolvedname)
{
/* Read the input convolved image. */
- p->conv = gal_fits_img_read_to_type(p->convolvedname, p->chdu,
- GAL_TYPE_FLOAT32, p->cp.minmapsize);
+ p->conv = gal_array_read_one_ch_to_type(p->convolvedname, p->chdu,
+ GAL_TYPE_FLOAT32,
+ p->cp.minmapsize);
/* Make sure the convolved image is the same size as the input. */
if( gal_data_dsize_is_different(p->input, p->conv) )
diff --git a/bin/segment/ui.c b/bin/segment/ui.c
index dd601fd..e8208df 100644
--- a/bin/segment/ui.c
+++ b/bin/segment/ui.c
@@ -30,6 +30,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/wcs.h>
#include <gnuastro/fits.h>
+#include <gnuastro/array.h>
#include <gnuastro/threads.h>
#include <gnuastro/dimension.h>
@@ -367,8 +368,9 @@ static void
ui_prepare_inputs(struct segmentparams *p)
{
/* Read the input as a single precision floating point dataset. */
- p->input = gal_fits_img_read_to_type(p->inputname, p->cp.hdu,
- GAL_TYPE_FLOAT32, p->cp.minmapsize);
+ p->input = gal_array_read_one_ch_to_type(p->inputname, p->cp.hdu,
+ GAL_TYPE_FLOAT32,
+ p->cp.minmapsize);
p->input->wcs = gal_wcs_read(p->inputname, p->cp.hdu, 0, 0,
&p->input->nwcs);
if(p->input->name) free(p->input->name);
@@ -390,8 +392,9 @@ ui_prepare_inputs(struct segmentparams *p)
if(p->convolvedname)
{
/* Read the input convolved image. */
- p->conv = gal_fits_img_read_to_type(p->convolvedname, p->chdu,
- GAL_TYPE_FLOAT32, p->cp.minmapsize);
+ p->conv = gal_array_read_one_ch_to_type(p->convolvedname, p->chdu,
+ GAL_TYPE_FLOAT32,
+ p->cp.minmapsize);
p->conv->wcs=gal_wcs_copy(p->input->wcs);
/* Make sure it is the same size as the input. */
@@ -403,8 +406,8 @@ ui_prepare_inputs(struct segmentparams *p)
/* Read the detected label image and check its type and size. */
- p->olabel = gal_fits_img_read(p->useddetectionname, p->dhdu,
- p->cp.minmapsize);
+ p->olabel = gal_array_read_one_ch(p->useddetectionname, p->dhdu,
+ p->cp.minmapsize);
if( gal_data_dsize_is_different(p->input, p->olabel) )
error(EXIT_FAILURE, 0, "`%s' (hdu: %s) and `%s' (hdu: %s) have a"
"different dimension/size", p->useddetectionname, p->dhdu,
@@ -609,7 +612,7 @@ ui_read_std(struct segmentparams *p)
gal_data_t *sky, *keys=gal_data_array_calloc(3);
/* The standard devitaion image. */
- p->std=gal_fits_img_read_to_type(p->usedstdname, p->stdhdu,
+ p->std=gal_array_read_one_ch_to_type(p->usedstdname, p->stdhdu,
GAL_TYPE_FLOAT32, p->cp.minmapsize);
ui_check_size(p->input, p->std, tl->tottiles, p->inputname, p->cp.hdu,
p->usedstdname, p->stdhdu);
@@ -620,8 +623,8 @@ ui_read_std(struct segmentparams *p)
if(p->skyname)
{
/* Read the Sky dataset. */
- sky=gal_fits_img_read_to_type(p->skyname, p->skyhdu, GAL_TYPE_FLOAT32,
- p->cp.minmapsize);
+ sky=gal_array_read_one_ch_to_type(p->skyname, p->skyhdu,
+ GAL_TYPE_FLOAT32, p->cp.minmapsize);
/* Check its size. */
ui_check_size(p->input, sky, tl->tottiles, p->inputname, p->cp.hdu,
diff --git a/bin/statistics/ui.c b/bin/statistics/ui.c
index 57a2aaf..0784419 100644
--- a/bin/statistics/ui.c
+++ b/bin/statistics/ui.c
@@ -30,6 +30,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/wcs.h>
#include <gnuastro/fits.h>
#include <gnuastro/tile.h>
+#include <gnuastro/array.h>
#include <gnuastro/qsort.h>
#include <gnuastro/blank.h>
#include <gnuastro/table.h>
@@ -797,7 +798,7 @@ ui_preparations(struct statisticsparams *p)
if(p->isfits && p->hdu_type==IMAGE_HDU)
{
p->inputformat=INPUT_FORMAT_IMAGE;
- p->input=gal_fits_img_read(p->inputname, cp->hdu, cp->minmapsize);
+ p->input=gal_array_read_one_ch(p->inputname, cp->hdu, cp->minmapsize);
p->input->wcs=gal_wcs_read(p->inputname, cp->hdu, 0, 0,
&p->input->nwcs);
}
diff --git a/bin/warp/ui.c b/bin/warp/ui.c
index adea832..085f828 100644
--- a/bin/warp/ui.c
+++ b/bin/warp/ui.c
@@ -30,6 +30,7 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <gnuastro/wcs.h>
#include <gnuastro/fits.h>
+#include <gnuastro/array.h>
#include <gnuastro/table.h>
#include <gnuastro/threads.h>
@@ -337,8 +338,9 @@ ui_check_options_and_arguments(struct warpparams *p)
"by CFITSIO)");
/* Read the input image as double type and its WCS structure. */
- p->input=gal_fits_img_read_to_type(p->inputname, p->cp.hdu,
- GAL_TYPE_FLOAT64, p->cp.minmapsize);
+ p->input=gal_array_read_one_ch_to_type(p->inputname, p->cp.hdu,
+ GAL_TYPE_FLOAT64,
+ p->cp.minmapsize);
p->input->wcs=gal_wcs_read(p->inputname, p->cp.hdu, p->hstartwcs,
p->hendwcs, &p->input->nwcs);
if(p->input->wcs)
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 9ca3f41..c2514f8 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -21967,7 +21967,24 @@ Similar to @code{gal_array_read}, but the output data
structure(s) will
have a numeric data type of @code{type}, see @ref{Numeric data types}.
@end deftypefun
address@hidden void gal_array_read_one_ch (char @code{*filename}, char
@code{*extension}, size_t @code{minmapsize})
address@hidden Channel
address@hidden Color channel
+Read the dataset within @code{filename} (extension/hdu/dir
address@hidden) and make sure it is only a single channel. Formats like
+JPEG or TIFF support multiple channels per input, but it may happen that
+your program only works on a single dataset. This function can be a
+convenient way to make sure that the data that comes into your program is
+only one channel. It is just a very simple wrapper around
address@hidden that checks if there was more than one dataset and
+aborts with an informative error if there is more than one channel in the
+dataset.
address@hidden deftypefun
address@hidden void gal_array_read_one_ch_to_type (char @code{*filename}, char
@code{*extension}, uint8_t @code{type}, size_t @code{minmapsize})
+Similar to @code{gal_array_read_one_ch}, but the output data structure will
+has a numeric data type of @code{type}, see @ref{Numeric data types}.
address@hidden deftypefun
@node Table input output, FITS files, Array input output, Gnuastro library
@subsection Table input output (@file{table.h})
diff --git a/lib/array.c b/lib/array.c
index 57effe9..62965bc 100644
--- a/lib/array.c
+++ b/lib/array.c
@@ -104,3 +104,41 @@ gal_array_read_to_type(char *filename, char *extension,
uint8_t type,
gal_list_data_reverse(&out);
return out;
}
+
+
+
+
+
+/* Read the input array and make sure it is only one channel. */
+gal_data_t *
+gal_array_read_one_ch(char *filename, char *extension, size_t minmapsize)
+{
+ gal_data_t *out;
+ out=gal_array_read(filename, extension, minmapsize);
+
+ if(out->next)
+ error(EXIT_FAILURE, 0, "%s (hdu %s): contains %zu channels (it isn't "
+ "monochrome).\n\n"
+ "You can use Gnuastro's ConvertType program to separate the "
+ "(color) channels into separate extensions of a FITS file, with "
+ "a command like this:\n\n"
+ " $ astconvertt %s -h%s --output=sep-ch.fits",
+ filename, extension, gal_list_data_number(out), filename,
+ extension);
+
+ return out;
+}
+
+
+
+
+
+/* Read a single-channel dataset into a specific type. */
+gal_data_t *
+gal_array_read_one_ch_to_type(char *filename, char *extension, uint8_t type,
+ size_t minmapsize)
+{
+ gal_data_t *out=gal_array_read_one_ch(filename, extension, minmapsize);
+
+ return gal_data_copy_to_new_type_free(out, type);
+}
diff --git a/lib/gnuastro/array.h b/lib/gnuastro/array.h
index 8b7d728..91a102c 100644
--- a/lib/gnuastro/array.h
+++ b/lib/gnuastro/array.h
@@ -59,6 +59,13 @@ gal_data_t *
gal_array_read_to_type(char *filename, char *extension, uint8_t type,
size_t minmapsize);
+gal_data_t *
+gal_array_read_one_ch(char *filename, char *extension, size_t minmapsize);
+
+gal_data_t *
+gal_array_read_one_ch_to_type(char *filename, char *extension, uint8_t type,
+ size_t minmapsize);
+
__END_C_DECLS /* From C++ preparations */
diff --git a/lib/tiff.c b/lib/tiff.c
index 418d2c0..450e55f 100644
--- a/lib/tiff.c
+++ b/lib/tiff.c
@@ -583,10 +583,10 @@ gal_tiff_read(char *filename, size_t dir, size_t
minmapsize)
/* Close the TIFF file and return. */
TIFFClose(tif);
- error(EXIT_FAILURE, 0, "%s: `%s' has %zu director%s, and "
- "directories are counted from 0. You have asked for "
+ error(EXIT_FAILURE, 0, "%s: `%s' has %zu director%s/extension%s, "
+ "and directories are counted from 0. You have asked for "
"directory %zu", __func__, filename, dircount,
- dircount==1?"y":"ies", dir);
+ dircount==1?"y":"ies", dircount==1?"":"s", dir);
}
}
diff --git a/lib/wcs.c b/lib/wcs.c
index ae606ef..a41393f 100644
--- a/lib/wcs.c
+++ b/lib/wcs.c
@@ -183,6 +183,10 @@ gal_wcs_read(char *filename, char *hdu, size_t hstartwcs,
fitsfile *fptr;
struct wcsprm *wcs;
+ /* Make sure we are dealing with a FITS file. */
+ if( gal_fits_name_is_fits(filename) == 0 )
+ return NULL;
+
/* Check HDU for realistic conditions: */
fptr=gal_fits_hdu_open_format(filename, hdu, 0);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 847a0fa: Format agnostic functions for reading arrays,
Mohammad Akhlaghi <=