From f8944a48c10e1cbaf7effd8fb1027b64d1305a17 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:27:17 -0500 Subject: [PATCH 1/3] Remove C++ loading and saving --- CMakeLists.txt | 5 - include/fitsio.h | 1967 ------------------ include/longnam.h | 593 ------ src/kbmod/data_interface.py | 113 +- src/kbmod/fake_data/fake_data_creator.py | 66 +- src/kbmod/search/image_stack.cpp | 23 - src/kbmod/search/image_stack.h | 2 - src/kbmod/search/layered_image.cpp | 78 - src/kbmod/search/layered_image.h | 9 - src/kbmod/search/pydocs/layered_image_docs.h | 39 +- src/kbmod/search/pydocs/raw_image_docs.h | 29 - src/kbmod/search/raw_image.cpp | 130 -- src/kbmod/search/raw_image.h | 10 - tests/manual_test_fake_orbits.py | 3 +- tests/test_bilinear_interp.py | 4 +- tests/test_image_stack.py | 4 +- tests/test_layered_image.py | 31 +- tests/test_masking.py | 5 +- tests/test_psi_phi_array.py | 3 +- tests/test_raw_image.py | 39 - tests/test_regression_test.py | 9 +- tests/test_search.py | 14 +- tests/test_work_unit.py | 3 +- 23 files changed, 214 insertions(+), 2965 deletions(-) delete mode 100644 include/fitsio.h delete mode 100644 include/longnam.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 250c1d5d8..ab1d56746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,11 +32,6 @@ check_ipo_supported(RESULT ipo_supported) find_package(Python3 COMPONENTS Interpreter Development REQUIRED) -find_library(CFITSIO_LIBRARY - NAMES fitsio cfitsio libcfitsio - HINTS lib/ -) - add_subdirectory(lib/pybind11) set(CMAKE_CXX_STANDARD 17) diff --git a/include/fitsio.h b/include/fitsio.h deleted file mode 100644 index ad4825ccd..000000000 --- a/include/fitsio.h +++ /dev/null @@ -1,1967 +0,0 @@ -/* The FITSIO software was written by William Pence at the High Energy */ -/* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ -/* Goddard Space Flight Center. */ -/* - -Copyright (Unpublished--all rights reserved under the copyright laws of -the United States), U.S. Government as represented by the Administrator -of the National Aeronautics and Space Administration. No copyright is -claimed in the United States under Title 17, U.S. Code. - -Permission to freely use, copy, modify, and distribute this software -and its documentation without fee is hereby granted, provided that this -copyright notice and disclaimer of warranty appears in all copies. - -DISCLAIMER: - -THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, -EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, -ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY -IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE -DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE -SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NASA BE LIABLE FOR ANY -DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR -CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY -CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY, -CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY -PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED -FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR -SERVICES PROVIDED HEREUNDER." - -*/ - -#ifndef _FITSIO_H -#define _FITSIO_H - -#define CFITSIO_VERSION 3.37 -#define CFITSIO_MINOR 37 -#define CFITSIO_MAJOR 3 -#define CFITSIO_SONAME 2 - -/* the SONAME is incremented in a new release if the binary shared */ -/* library (on linux and Mac systems) is not backward compatible */ -/* with the previous release of CFITSIO */ - - -/* CFITS_API is defined below for use on Windows systems. */ -/* It is used to identify the public functions which should be exported. */ -/* This has no effect on non-windows platforms where "WIN32" is not defined */ - -#if defined (WIN32) - #if defined(cfitsio_EXPORTS) - #define CFITS_API __declspec(dllexport) - #else - #define CFITS_API /* __declspec(dllimport) */ - #endif /* CFITS_API */ -#else /* defined (WIN32) */ - #define CFITS_API -#endif - -#include - -/* the following was provided by Michael Greason (GSFC) to fix a */ -/* C/Fortran compatibility problem on an SGI Altix system running */ -/* SGI ProPack 4 [this is a Novell SuSE Enterprise 9 derivative] */ -/* and using the Intel C++ and Fortran compilers (version 9.1) */ -#if defined(__INTEL_COMPILER) && defined(__itanium__) -# define mipsFortran 1 -# define _MIPS_SZLONG 64 -#endif - -#if defined(linux) || defined(__APPLE__) || defined(__sgi) -# include /* apparently needed on debian linux systems */ -#endif /* to define off_t */ - -#include /* apparently needed to define size_t with gcc 2.8.1 */ -#include /* needed for LLONG_MAX and INT64_MAX definitions */ - -/* Define the datatype for variables which store file offset values. */ -/* The newer 'off_t' datatype should be used for this purpose, but some */ -/* older compilers do not recognize this type, in which case we use 'long' */ -/* instead. Note that _OFF_T is defined (or not) in stdio.h depending */ -/* on whether _LARGEFILE_SOURCE is defined in sys/feature_tests.h */ -/* (at least on Solaris platforms using cc) */ - -/* Debian systems require: "(defined(linux) && defined(__off_t_defined))" */ -/* the mingw-w64 compiler requires: "(defined(__MINGW32__) && defined(_OFF_T_DEFINED))" */ -#if defined(_OFF_T) \ - || (defined(linux) && defined(__off_t_defined)) \ - || (defined(__MINGW32__) && defined(_OFF_T_DEFINED)) \ - || defined(_MIPS_SZLONG) || defined(__APPLE__) || defined(_AIX) -# define OFF_T off_t -#elif defined(_MSC_VER) && (_MSC_VER>= 1400) -# define OFF_T long long -#else -# define OFF_T long -#endif - -/* this block determines if the the string function name is - strtol or strtoll, and whether to use %ld or %lld in printf statements */ - -/* - The following 2 cases for that Athon64 were removed on 4 Jan 2006; - they appear to be incorrect now that LONGLONG is always typedef'ed - to 'long long' - || defined(__ia64__) \ - || defined(__x86_64__) \ -*/ -#if (defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )) \ - || defined(__sparcv9) || (defined(__sparc__) && defined(__arch64__)) \ - || defined(__powerpc64__) || defined(__64BIT__) \ - || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64) \ - || defined( _MSC_VER)|| defined(__BORLANDC__) - -# define USE_LL_SUFFIX 0 -#else -# define USE_LL_SUFFIX 1 -#endif - -/* - Determine what 8-byte integer data type is available. - 'long long' is now supported by most compilers, but - older MS Visual C++ compilers before V7.0 use '__int64' instead. -*/ - -#ifndef LONGLONG_TYPE /* this may have been previously defined */ -#if defined(_MSC_VER) /* Microsoft Visual C++ */ - -#if (_MSC_VER < 1300) /* versions earlier than V7.0 do not have 'long long' */ - typedef __int64 LONGLONG; -#else /* newer versions do support 'long long' */ - typedef long long LONGLONG; -#endif - -#elif defined( __BORLANDC__) /* for the Borland 5.5 compiler, in particular */ - typedef __int64 LONGLONG; -#else - typedef long long LONGLONG; -#endif - -#define LONGLONG_TYPE -#endif - -#ifndef LONGLONG_MAX - -#ifdef LLONG_MAX -/* Linux and Solaris definition */ -#define LONGLONG_MAX LLONG_MAX -#define LONGLONG_MIN LLONG_MIN - -#elif defined(LONG_LONG_MAX) -#define LONGLONG_MAX LONG_LONG_MAX -#define LONGLONG_MIN LONG_LONG_MIN - -#elif defined(__LONG_LONG_MAX__) -/* Mac OS X & CYGWIN defintion */ -#define LONGLONG_MAX __LONG_LONG_MAX__ -#define LONGLONG_MIN (-LONGLONG_MAX -1LL) - -#elif defined(INT64_MAX) -/* windows definition */ -#define LONGLONG_MAX INT64_MAX -#define LONGLONG_MIN INT64_MIN - -#elif defined(_I64_MAX) -/* windows definition */ -#define LONGLONG_MAX _I64_MAX -#define LONGLONG_MIN _I64_MIN - -#elif (defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )) \ - || defined(__sparcv9) \ - || defined(__ia64__) \ - || defined(__x86_64__) \ - || defined(_SX) \ - || defined(__powerpc64__) || defined(__64BIT__) \ - || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64) -/* sizeof(long) = 64 */ -#define LONGLONG_MAX 9223372036854775807L /* max 64-bit integer */ -#define LONGLONG_MIN (-LONGLONG_MAX -1L) /* min 64-bit integer */ - -#else -/* define a default value, even if it is never used */ -#define LONGLONG_MAX 9223372036854775807LL /* max 64-bit integer */ -#define LONGLONG_MIN (-LONGLONG_MAX -1LL) /* min 64-bit integer */ - -#endif -#endif /* end of ndef LONGLONG_MAX section */ - - -/* ================================================================= */ - - -/* The following exclusion if __CINT__ is defined is needed for ROOT */ -#ifndef __CINT__ -#include "longnam.h" -#endif - -#define NIOBUF 40 /* number of IO buffers to create (default = 40) */ - /* !! Significantly increasing NIOBUF may degrade performance !! */ - -#define IOBUFLEN 2880 /* size in bytes of each IO buffer (DONT CHANGE!) */ - -/* global variables */ - -#define FLEN_FILENAME 1025 /* max length of a filename */ -#define FLEN_KEYWORD 72 /* max length of a keyword (HIERARCH convention) */ -#define FLEN_CARD 81 /* length of a FITS header card */ -#define FLEN_VALUE 71 /* max length of a keyword value string */ -#define FLEN_COMMENT 73 /* max length of a keyword comment string */ -#define FLEN_ERRMSG 81 /* max length of a FITSIO error message */ -#define FLEN_STATUS 31 /* max length of a FITSIO status text string */ - -#define TBIT 1 /* codes for FITS table data types */ -#define TBYTE 11 -#define TSBYTE 12 -#define TLOGICAL 14 -#define TSTRING 16 -#define TUSHORT 20 -#define TSHORT 21 -#define TUINT 30 -#define TINT 31 -#define TULONG 40 -#define TLONG 41 -#define TINT32BIT 41 /* used when returning datatype of a column */ -#define TFLOAT 42 -#define TLONGLONG 81 -#define TDOUBLE 82 -#define TCOMPLEX 83 -#define TDBLCOMPLEX 163 - -#define TYP_STRUC_KEY 10 -#define TYP_CMPRS_KEY 20 -#define TYP_SCAL_KEY 30 -#define TYP_NULL_KEY 40 -#define TYP_DIM_KEY 50 -#define TYP_RANG_KEY 60 -#define TYP_UNIT_KEY 70 -#define TYP_DISP_KEY 80 -#define TYP_HDUID_KEY 90 -#define TYP_CKSUM_KEY 100 -#define TYP_WCS_KEY 110 -#define TYP_REFSYS_KEY 120 -#define TYP_COMM_KEY 130 -#define TYP_CONT_KEY 140 -#define TYP_USER_KEY 150 - - -#define INT32BIT int /* 32-bit integer datatype. Currently this */ - /* datatype is an 'int' on all useful platforms */ - /* however, it is possible that that are cases */ - /* where 'int' is a 2-byte integer, in which case */ - /* INT32BIT would need to be defined as 'long'. */ - -#define BYTE_IMG 8 /* BITPIX code values for FITS image types */ -#define SHORT_IMG 16 -#define LONG_IMG 32 -#define LONGLONG_IMG 64 -#define FLOAT_IMG -32 -#define DOUBLE_IMG -64 - /* The following 2 codes are not true FITS */ - /* datatypes; these codes are only used internally */ - /* within cfitsio to make it easier for users */ - /* to deal with unsigned integers. */ -#define SBYTE_IMG 10 -#define USHORT_IMG 20 -#define ULONG_IMG 40 - -#define IMAGE_HDU 0 /* Primary Array or IMAGE HDU */ -#define ASCII_TBL 1 /* ASCII table HDU */ -#define BINARY_TBL 2 /* Binary table HDU */ -#define ANY_HDU -1 /* matches any HDU type */ - -#define READONLY 0 /* options when opening a file */ -#define READWRITE 1 - -/* adopt a hopefully obscure number to use as a null value flag */ -/* could be problems if the FITS files contain data with these values */ -#define FLOATNULLVALUE -9.11912E-36F -#define DOUBLENULLVALUE -9.1191291391491E-36 - -/* compression algorithm codes */ -#define NO_DITHER -1 -#define SUBTRACTIVE_DITHER_1 1 -#define SUBTRACTIVE_DITHER_2 2 -#define MAX_COMPRESS_DIM 6 -#define RICE_1 11 -#define GZIP_1 21 -#define GZIP_2 22 -#define PLIO_1 31 -#define HCOMPRESS_1 41 -#define BZIP2_1 51 /* not publicly supported; only for test purposes */ -#define NOCOMPRESS -1 - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#define CASESEN 1 /* do case-sensitive string match */ -#define CASEINSEN 0 /* do case-insensitive string match */ - -#define GT_ID_ALL_URI 0 /* hierarchical grouping parameters */ -#define GT_ID_REF 1 -#define GT_ID_POS 2 -#define GT_ID_ALL 3 -#define GT_ID_REF_URI 11 -#define GT_ID_POS_URI 12 - -#define OPT_RM_GPT 0 -#define OPT_RM_ENTRY 1 -#define OPT_RM_MBR 2 -#define OPT_RM_ALL 3 - -#define OPT_GCP_GPT 0 -#define OPT_GCP_MBR 1 -#define OPT_GCP_ALL 2 - -#define OPT_MCP_ADD 0 -#define OPT_MCP_NADD 1 -#define OPT_MCP_REPL 2 -#define OPT_MCP_MOV 3 - -#define OPT_MRG_COPY 0 -#define OPT_MRG_MOV 1 - -#define OPT_CMT_MBR 1 -#define OPT_CMT_MBR_DEL 11 - -typedef struct /* structure used to store table column information */ -{ - char ttype[70]; /* column name = FITS TTYPEn keyword; */ - LONGLONG tbcol; /* offset in row to first byte of each column */ - int tdatatype; /* datatype code of each column */ - LONGLONG trepeat; /* repeat count of column; number of elements */ - double tscale; /* FITS TSCALn linear scaling factor */ - double tzero; /* FITS TZEROn linear scaling zero point */ - LONGLONG tnull; /* FITS null value for int image or binary table cols */ - char strnull[20]; /* FITS null value string for ASCII table columns */ - char tform[10]; /* FITS tform keyword value */ - long twidth; /* width of each ASCII table column */ -}tcolumn; - -#define VALIDSTRUC 555 /* magic value used to identify if structure is valid */ - -typedef struct /* structure used to store basic FITS file information */ -{ - int filehandle; /* handle returned by the file open function */ - int driver; /* defines which set of I/O drivers should be used */ - int open_count; /* number of opened 'fitsfiles' using this structure */ - char *filename; /* file name */ - int validcode; /* magic value used to verify that structure is valid */ - int only_one; /* flag meaning only copy the specified extension */ - LONGLONG filesize; /* current size of the physical disk file in bytes */ - LONGLONG logfilesize; /* logical size of file, including unflushed buffers */ - int lasthdu; /* is this the last HDU in the file? 0 = no, else yes */ - LONGLONG bytepos; /* current logical I/O pointer position in file */ - LONGLONG io_pos; /* current I/O pointer position in the physical file */ - int curbuf; /* number of I/O buffer currently in use */ - int curhdu; /* current HDU number; 0 = primary array */ - int hdutype; /* 0 = primary array, 1 = ASCII table, 2 = binary table */ - int writemode; /* 0 = readonly, 1 = readwrite */ - int maxhdu; /* highest numbered HDU known to exist in the file */ - int MAXHDU; /* dynamically allocated dimension of headstart array */ - LONGLONG *headstart; /* byte offset in file to start of each HDU */ - LONGLONG headend; /* byte offest in file to end of the current HDU header */ - LONGLONG ENDpos; /* byte offest to where the END keyword was last written */ - LONGLONG nextkey; /* byte offset in file to beginning of next keyword */ - LONGLONG datastart; /* byte offset in file to start of the current data unit */ - int imgdim; /* dimension of image; cached for fast access */ - LONGLONG imgnaxis[99]; /* length of each axis; cached for fast access */ - int tfield; /* number of fields in the table (primary array has 2 */ - int startcol; /* used by ffgcnn to record starting column number */ - LONGLONG origrows; /* original number of rows (value of NAXIS2 keyword) */ - LONGLONG numrows; /* number of rows in the table (dynamically updated) */ - LONGLONG rowlength; /* length of a table row or image size (bytes) */ - tcolumn *tableptr; /* pointer to the table structure */ - LONGLONG heapstart; /* heap start byte relative to start of data unit */ - LONGLONG heapsize; /* size of the heap, in bytes */ - - /* the following elements are related to compressed images */ - - /* these record the 'requested' options to be used when the image is compressed */ - int request_compress_type; /* requested image compression algorithm */ - long request_tilesize[MAX_COMPRESS_DIM]; /* requested tiling size */ - float request_quantize_level; /* requested quantize level */ - int request_quantize_method ; /* requested quantizing method */ - int request_dither_seed; /* starting offset into the array of random dithering */ - int request_lossy_int_compress; /* lossy compress integer image as if float image? */ - int request_huge_hdu; /* use '1Q' rather then '1P' variable length arrays */ - float request_hcomp_scale; /* requested HCOMPRESS scale factor */ - int request_hcomp_smooth; /* requested HCOMPRESS smooth parameter */ - - /* these record the actual options that were used when the image was compressed */ - int compress_type; /* type of compression algorithm */ - long tilesize[MAX_COMPRESS_DIM]; /* size of compression tiles */ - float quantize_level; /* floating point quantization level */ - int quantize_method; /* floating point pixel quantization algorithm */ - int dither_seed; /* starting offset into the array of random dithering */ - - /* other compression parameters */ - int compressimg; /* 1 if HDU contains a compressed image, else 0 */ - char zcmptype[12]; /* compression type string */ - int zbitpix; /* FITS data type of image (BITPIX) */ - int zndim; /* dimension of image */ - long znaxis[MAX_COMPRESS_DIM]; /* length of each axis */ - long maxtilelen; /* max number of pixels in each image tile */ - long maxelem; /* maximum byte length of tile compressed arrays */ - - int cn_compressed; /* column number for COMPRESSED_DATA column */ - int cn_uncompressed; /* column number for UNCOMPRESSED_DATA column */ - int cn_gzip_data; /* column number for GZIP2 lossless compressed data */ - int cn_zscale; /* column number for ZSCALE column */ - int cn_zzero; /* column number for ZZERO column */ - int cn_zblank; /* column number for the ZBLANK column */ - - double zscale; /* scaling value, if same for all tiles */ - double zzero; /* zero pt, if same for all tiles */ - double cn_bscale; /* value of the BSCALE keyword in header */ - double cn_bzero; /* value of the BZERO keyword (may be reset) */ - double cn_actual_bzero; /* actual value of the BZERO keyword */ - int zblank; /* value for null pixels, if not a column */ - - int rice_blocksize; /* first compression parameter: Rice pixels/block */ - int rice_bytepix; /* 2nd compression parameter: Rice bytes/pixel */ - float hcomp_scale; /* 1st hcompress compression parameter */ - int hcomp_smooth; /* 2nd hcompress compression parameter */ - - int *tilerow; /* row number of the array of uncompressed tiledata */ - long *tiledatasize; /* length of the array of tile data in bytes */ - int *tiletype; /* datatype of the array of tile (TINT, TSHORT, etc) */ - void **tiledata; /* array of uncompressed tile of data, for row *tilerow */ - void **tilenullarray; /* array of optional array of null value flags */ - int *tileanynull; /* anynulls in the array of tile? */ - - char *iobuffer; /* pointer to FITS file I/O buffers */ - long bufrecnum[NIOBUF]; /* file record number of each of the buffers */ - int dirty[NIOBUF]; /* has the corresponding buffer been modified? */ - int ageindex[NIOBUF]; /* relative age of each buffer */ -} FITSfile; - -typedef struct /* structure used to store basic HDU information */ -{ - int HDUposition; /* HDU position in file; 0 = first HDU */ - FITSfile *Fptr; /* pointer to FITS file structure */ -}fitsfile; - -typedef struct /* structure for the iterator function column information */ -{ - /* elements required as input to fits_iterate_data: */ - - fitsfile *fptr; /* pointer to the HDU containing the column */ - int colnum; /* column number in the table (use name if < 1) */ - char colname[70]; /* name (= TTYPEn value) of the column (optional) */ - int datatype; /* output datatype (converted if necessary */ - int iotype; /* = InputCol, InputOutputCol, or OutputCol */ - - /* output elements that may be useful for the work function: */ - - void *array; /* pointer to the array (and the null value) */ - long repeat; /* binary table vector repeat value */ - long tlmin; /* legal minimum data value */ - long tlmax; /* legal maximum data value */ - char tunit[70]; /* physical unit string */ - char tdisp[70]; /* suggested display format */ - -} iteratorCol; - -#define InputCol 0 /* flag for input only iterator column */ -#define InputOutputCol 1 /* flag for input and output iterator column */ -#define OutputCol 2 /* flag for output only iterator column */ - -/*============================================================================= -* -* The following wtbarr typedef is used in the fits_read_wcstab() routine, -* which is intended for use with the WCSLIB library written by Mark -* Calabretta, http://www.atnf.csiro.au/~mcalabre/index.html -* -* In order to maintain WCSLIB and CFITSIO as independent libraries it -* was not permissible for any CFITSIO library code to include WCSLIB -* header files, or vice versa. However, the CFITSIO function -* fits_read_wcstab() accepts an array of structs defined by wcs.h within -* WCSLIB. The problem then was to define this struct within fitsio.h -* without including wcs.h, especially noting that wcs.h will often (but -* not always) be included together with fitsio.h in an applications -* program that uses fits_read_wcstab(). -* -* Of the various possibilities, the solution adopted was for WCSLIB to -* define "struct wtbarr" while fitsio.h defines "typedef wtbarr", a -* untagged struct with identical members. This allows both wcs.h and -* fitsio.h to define a wtbarr data type without conflict by virtue of -* the fact that structure tags and typedef names share different -* namespaces in C. Therefore, declarations within WCSLIB look like -* -* struct wtbarr *w; -* -* while within CFITSIO they are simply -* -* wtbarr *w; -* -* but as suggested by the commonality of the names, these are really the -* same aggregate data type. However, in passing a (struct wtbarr *) to -* fits_read_wcstab() a cast to (wtbarr *) is formally required. -*===========================================================================*/ - -#ifndef WCSLIB_GETWCSTAB -#define WCSLIB_GETWCSTAB - -typedef struct { - int i; /* Image axis number. */ - int m; /* Array axis number for index vectors. */ - int kind; /* Array type, 'c' (coord) or 'i' (index). */ - char extnam[72]; /* EXTNAME of binary table extension. */ - int extver; /* EXTVER of binary table extension. */ - int extlev; /* EXTLEV of binary table extension. */ - char ttype[72]; /* TTYPEn of column containing the array. */ - long row; /* Table row number. */ - int ndim; /* Expected array dimensionality. */ - int *dimlen; /* Where to write the array axis lengths. */ - double **arrayp; /* Where to write the address of the array */ - /* allocated to store the array. */ -} wtbarr; - -int CFITS_API fits_read_wcstab(fitsfile *fptr, int nwtb, wtbarr *wtb, int *status); - -#endif /* WCSLIB_GETWCSTAB */ - -/* error status codes */ - -#define CREATE_DISK_FILE -106 /* create disk file, without extended filename syntax */ -#define OPEN_DISK_FILE -105 /* open disk file, without extended filename syntax */ -#define SKIP_TABLE -104 /* move to 1st image when opening file */ -#define SKIP_IMAGE -103 /* move to 1st table when opening file */ -#define SKIP_NULL_PRIMARY -102 /* skip null primary array when opening file */ -#define USE_MEM_BUFF -101 /* use memory buffer when opening file */ -#define OVERFLOW_ERR -11 /* overflow during datatype conversion */ -#define PREPEND_PRIMARY -9 /* used in ffiimg to insert new primary array */ -#define SAME_FILE 101 /* input and output files are the same */ -#define TOO_MANY_FILES 103 /* tried to open too many FITS files */ -#define FILE_NOT_OPENED 104 /* could not open the named file */ -#define FILE_NOT_CREATED 105 /* could not create the named file */ -#define WRITE_ERROR 106 /* error writing to FITS file */ -#define END_OF_FILE 107 /* tried to move past end of file */ -#define READ_ERROR 108 /* error reading from FITS file */ -#define FILE_NOT_CLOSED 110 /* could not close the file */ -#define ARRAY_TOO_BIG 111 /* array dimensions exceed internal limit */ -#define READONLY_FILE 112 /* Cannot write to readonly file */ -#define MEMORY_ALLOCATION 113 /* Could not allocate memory */ -#define BAD_FILEPTR 114 /* invalid fitsfile pointer */ -#define NULL_INPUT_PTR 115 /* NULL input pointer to routine */ -#define SEEK_ERROR 116 /* error seeking position in file */ - -#define BAD_URL_PREFIX 121 /* invalid URL prefix on file name */ -#define TOO_MANY_DRIVERS 122 /* tried to register too many IO drivers */ -#define DRIVER_INIT_FAILED 123 /* driver initialization failed */ -#define NO_MATCHING_DRIVER 124 /* matching driver is not registered */ -#define URL_PARSE_ERROR 125 /* failed to parse input file URL */ -#define RANGE_PARSE_ERROR 126 /* failed to parse input file URL */ - -#define SHARED_ERRBASE (150) -#define SHARED_BADARG (SHARED_ERRBASE + 1) -#define SHARED_NULPTR (SHARED_ERRBASE + 2) -#define SHARED_TABFULL (SHARED_ERRBASE + 3) -#define SHARED_NOTINIT (SHARED_ERRBASE + 4) -#define SHARED_IPCERR (SHARED_ERRBASE + 5) -#define SHARED_NOMEM (SHARED_ERRBASE + 6) -#define SHARED_AGAIN (SHARED_ERRBASE + 7) -#define SHARED_NOFILE (SHARED_ERRBASE + 8) -#define SHARED_NORESIZE (SHARED_ERRBASE + 9) - -#define HEADER_NOT_EMPTY 201 /* header already contains keywords */ -#define KEY_NO_EXIST 202 /* keyword not found in header */ -#define KEY_OUT_BOUNDS 203 /* keyword record number is out of bounds */ -#define VALUE_UNDEFINED 204 /* keyword value field is blank */ -#define NO_QUOTE 205 /* string is missing the closing quote */ -#define BAD_INDEX_KEY 206 /* illegal indexed keyword name */ -#define BAD_KEYCHAR 207 /* illegal character in keyword name or card */ -#define BAD_ORDER 208 /* required keywords out of order */ -#define NOT_POS_INT 209 /* keyword value is not a positive integer */ -#define NO_END 210 /* couldn't find END keyword */ -#define BAD_BITPIX 211 /* illegal BITPIX keyword value*/ -#define BAD_NAXIS 212 /* illegal NAXIS keyword value */ -#define BAD_NAXES 213 /* illegal NAXISn keyword value */ -#define BAD_PCOUNT 214 /* illegal PCOUNT keyword value */ -#define BAD_GCOUNT 215 /* illegal GCOUNT keyword value */ -#define BAD_TFIELDS 216 /* illegal TFIELDS keyword value */ -#define NEG_WIDTH 217 /* negative table row size */ -#define NEG_ROWS 218 /* negative number of rows in table */ -#define COL_NOT_FOUND 219 /* column with this name not found in table */ -#define BAD_SIMPLE 220 /* illegal value of SIMPLE keyword */ -#define NO_SIMPLE 221 /* Primary array doesn't start with SIMPLE */ -#define NO_BITPIX 222 /* Second keyword not BITPIX */ -#define NO_NAXIS 223 /* Third keyword not NAXIS */ -#define NO_NAXES 224 /* Couldn't find all the NAXISn keywords */ -#define NO_XTENSION 225 /* HDU doesn't start with XTENSION keyword */ -#define NOT_ATABLE 226 /* the CHDU is not an ASCII table extension */ -#define NOT_BTABLE 227 /* the CHDU is not a binary table extension */ -#define NO_PCOUNT 228 /* couldn't find PCOUNT keyword */ -#define NO_GCOUNT 229 /* couldn't find GCOUNT keyword */ -#define NO_TFIELDS 230 /* couldn't find TFIELDS keyword */ -#define NO_TBCOL 231 /* couldn't find TBCOLn keyword */ -#define NO_TFORM 232 /* couldn't find TFORMn keyword */ -#define NOT_IMAGE 233 /* the CHDU is not an IMAGE extension */ -#define BAD_TBCOL 234 /* TBCOLn keyword value < 0 or > rowlength */ -#define NOT_TABLE 235 /* the CHDU is not a table */ -#define COL_TOO_WIDE 236 /* column is too wide to fit in table */ -#define COL_NOT_UNIQUE 237 /* more than 1 column name matches template */ -#define BAD_ROW_WIDTH 241 /* sum of column widths not = NAXIS1 */ -#define UNKNOWN_EXT 251 /* unrecognizable FITS extension type */ -#define UNKNOWN_REC 252 /* unrecognizable FITS record */ -#define END_JUNK 253 /* END keyword is not blank */ -#define BAD_HEADER_FILL 254 /* Header fill area not blank */ -#define BAD_DATA_FILL 255 /* Data fill area not blank or zero */ -#define BAD_TFORM 261 /* illegal TFORM format code */ -#define BAD_TFORM_DTYPE 262 /* unrecognizable TFORM datatype code */ -#define BAD_TDIM 263 /* illegal TDIMn keyword value */ -#define BAD_HEAP_PTR 264 /* invalid BINTABLE heap address */ - -#define BAD_HDU_NUM 301 /* HDU number < 1 or > MAXHDU */ -#define BAD_COL_NUM 302 /* column number < 1 or > tfields */ -#define NEG_FILE_POS 304 /* tried to move before beginning of file */ -#define NEG_BYTES 306 /* tried to read or write negative bytes */ -#define BAD_ROW_NUM 307 /* illegal starting row number in table */ -#define BAD_ELEM_NUM 308 /* illegal starting element number in vector */ -#define NOT_ASCII_COL 309 /* this is not an ASCII string column */ -#define NOT_LOGICAL_COL 310 /* this is not a logical datatype column */ -#define BAD_ATABLE_FORMAT 311 /* ASCII table column has wrong format */ -#define BAD_BTABLE_FORMAT 312 /* Binary table column has wrong format */ -#define NO_NULL 314 /* null value has not been defined */ -#define NOT_VARI_LEN 317 /* this is not a variable length column */ -#define BAD_DIMEN 320 /* illegal number of dimensions in array */ -#define BAD_PIX_NUM 321 /* first pixel number greater than last pixel */ -#define ZERO_SCALE 322 /* illegal BSCALE or TSCALn keyword = 0 */ -#define NEG_AXIS 323 /* illegal axis length < 1 */ - -#define NOT_GROUP_TABLE 340 -#define HDU_ALREADY_MEMBER 341 -#define MEMBER_NOT_FOUND 342 -#define GROUP_NOT_FOUND 343 -#define BAD_GROUP_ID 344 -#define TOO_MANY_HDUS_TRACKED 345 -#define HDU_ALREADY_TRACKED 346 -#define BAD_OPTION 347 -#define IDENTICAL_POINTERS 348 -#define BAD_GROUP_ATTACH 349 -#define BAD_GROUP_DETACH 350 - -#define BAD_I2C 401 /* bad int to formatted string conversion */ -#define BAD_F2C 402 /* bad float to formatted string conversion */ -#define BAD_INTKEY 403 /* can't interprete keyword value as integer */ -#define BAD_LOGICALKEY 404 /* can't interprete keyword value as logical */ -#define BAD_FLOATKEY 405 /* can't interprete keyword value as float */ -#define BAD_DOUBLEKEY 406 /* can't interprete keyword value as double */ -#define BAD_C2I 407 /* bad formatted string to int conversion */ -#define BAD_C2F 408 /* bad formatted string to float conversion */ -#define BAD_C2D 409 /* bad formatted string to double conversion */ -#define BAD_DATATYPE 410 /* bad keyword datatype code */ -#define BAD_DECIM 411 /* bad number of decimal places specified */ -#define NUM_OVERFLOW 412 /* overflow during datatype conversion */ - -# define DATA_COMPRESSION_ERR 413 /* error in imcompress routines */ -# define DATA_DECOMPRESSION_ERR 414 /* error in imcompress routines */ -# define NO_COMPRESSED_TILE 415 /* compressed tile doesn't exist */ - -#define BAD_DATE 420 /* error in date or time conversion */ - -#define PARSE_SYNTAX_ERR 431 /* syntax error in parser expression */ -#define PARSE_BAD_TYPE 432 /* expression did not evaluate to desired type */ -#define PARSE_LRG_VECTOR 433 /* vector result too large to return in array */ -#define PARSE_NO_OUTPUT 434 /* data parser failed not sent an out column */ -#define PARSE_BAD_COL 435 /* bad data encounter while parsing column */ -#define PARSE_BAD_OUTPUT 436 /* Output file not of proper type */ - -#define ANGLE_TOO_BIG 501 /* celestial angle too large for projection */ -#define BAD_WCS_VAL 502 /* bad celestial coordinate or pixel value */ -#define WCS_ERROR 503 /* error in celestial coordinate calculation */ -#define BAD_WCS_PROJ 504 /* unsupported type of celestial projection */ -#define NO_WCS_KEY 505 /* celestial coordinate keywords not found */ -#define APPROX_WCS_KEY 506 /* approximate WCS keywords were calculated */ - -#define NO_CLOSE_ERROR 999 /* special value used internally to switch off */ - /* the error message from ffclos and ffchdu */ - -/*------- following error codes are used in the grparser.c file -----------*/ -#define NGP_ERRBASE (360) /* base chosen so not to interfere with CFITSIO */ -#define NGP_OK (0) -#define NGP_NO_MEMORY (NGP_ERRBASE + 0) /* malloc failed */ -#define NGP_READ_ERR (NGP_ERRBASE + 1) /* read error from file */ -#define NGP_NUL_PTR (NGP_ERRBASE + 2) /* null pointer passed as argument */ -#define NGP_EMPTY_CURLINE (NGP_ERRBASE + 3) /* line read seems to be empty */ -#define NGP_UNREAD_QUEUE_FULL (NGP_ERRBASE + 4) /* cannot unread more then 1 line (or single line twice) */ -#define NGP_INC_NESTING (NGP_ERRBASE + 5) /* too deep include file nesting (inf. loop ?) */ -#define NGP_ERR_FOPEN (NGP_ERRBASE + 6) /* fopen() failed, cannot open file */ -#define NGP_EOF (NGP_ERRBASE + 7) /* end of file encountered */ -#define NGP_BAD_ARG (NGP_ERRBASE + 8) /* bad arguments passed */ -#define NGP_TOKEN_NOT_EXPECT (NGP_ERRBASE + 9) /* token not expected here */ - -/* The following exclusion if __CINT__ is defined is needed for ROOT */ -#ifndef __CINT__ -/* the following 3 lines are needed to support C++ compilers */ -#ifdef __cplusplus -extern "C" { -#endif -#endif - -int CFITS2Unit( fitsfile *fptr ); -CFITS_API fitsfile* CUnit2FITS(int unit); - -/*---------------- FITS file URL parsing routines -------------*/ -int CFITS_API fits_get_token (char **ptr, char *delimiter, char *token, int *isanumber); -int CFITS_API fits_get_token2(char **ptr, char *delimiter, char **token, int *isanumber, int *status); -char CFITS_API *fits_split_names(char *list); -int CFITS_API ffiurl( char *url, char *urltype, char *infile, - char *outfile, char *extspec, char *rowfilter, - char *binspec, char *colspec, int *status); -int CFITS_API ffifile (char *url, char *urltype, char *infile, - char *outfile, char *extspec, char *rowfilter, - char *binspec, char *colspec, char *pixfilter, int *status); -int CFITS_API ffifile2 (char *url, char *urltype, char *infile, - char *outfile, char *extspec, char *rowfilter, - char *binspec, char *colspec, char *pixfilter, char *compspec, int *status); -int CFITS_API ffrtnm(char *url, char *rootname, int *status); -int CFITS_API ffexist(const char *infile, int *exists, int *status); -int CFITS_API ffexts(char *extspec, int *extnum, char *extname, int *extvers, - int *hdutype, char *colname, char *rowexpress, int *status); -int CFITS_API ffextn(char *url, int *extension_num, int *status); -int CFITS_API ffurlt(fitsfile *fptr, char *urlType, int *status); -int CFITS_API ffbins(char *binspec, int *imagetype, int *haxis, - char colname[4][FLEN_VALUE], double *minin, - double *maxin, double *binsizein, - char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE], - char binname[4][FLEN_VALUE], double *weight, char *wtname, - int *recip, int *status); -int CFITS_API ffbinr(char **binspec, char *colname, double *minin, - double *maxin, double *binsizein, char *minname, - char *maxname, char *binname, int *status); -int CFITS_API fits_copy_cell2image(fitsfile *fptr, fitsfile *newptr, char *colname, - long rownum, int *status); -int CFITS_API fits_copy_image2cell(fitsfile *fptr, fitsfile *newptr, char *colname, - long rownum, int copykeyflag, int *status); -int CFITS_API fits_copy_pixlist2image(fitsfile *infptr, fitsfile *outfptr, int firstkey, /* I - first HDU record number to start with */ - int naxis, int *colnum, int *status); -int CFITS_API ffimport_file( char *filename, char **contents, int *status ); -int CFITS_API ffrwrg( char *rowlist, LONGLONG maxrows, int maxranges, int *numranges, - long *minrow, long *maxrow, int *status); -int CFITS_API ffrwrgll( char *rowlist, LONGLONG maxrows, int maxranges, int *numranges, - LONGLONG *minrow, LONGLONG *maxrow, int *status); -/*---------------- FITS file I/O routines -------------*/ -int CFITS_API fits_init_cfitsio(void); -int CFITS_API ffomem(fitsfile **fptr, const char *name, int mode, void **buffptr, - size_t *buffsize, size_t deltasize, - void *(*mem_realloc)(void *p, size_t newsize), - int *status); -int CFITS_API ffopen(fitsfile **fptr, const char *filename, int iomode, int *status); -int CFITS_API ffopentest(int soname, fitsfile **fptr, const char *filename, int iomode, int *status); - -int CFITS_API ffdopn(fitsfile **fptr, const char *filename, int iomode, int *status); -int CFITS_API fftopn(fitsfile **fptr, const char *filename, int iomode, int *status); -int CFITS_API ffiopn(fitsfile **fptr, const char *filename, int iomode, int *status); -int CFITS_API ffdkopn(fitsfile **fptr, const char *filename, int iomode, int *status); -int CFITS_API ffreopen(fitsfile *openfptr, fitsfile **newfptr, int *status); -int CFITS_API ffinit( fitsfile **fptr, const char *filename, int *status); -int CFITS_API ffdkinit(fitsfile **fptr, const char *filename, int *status); -int CFITS_API ffimem(fitsfile **fptr, void **buffptr, - size_t *buffsize, size_t deltasize, - void *(*mem_realloc)(void *p, size_t newsize), - int *status); -int CFITS_API fftplt(fitsfile **fptr, const char *filename, const char *tempname, - int *status); -int CFITS_API ffflus(fitsfile *fptr, int *status); -int CFITS_API ffflsh(fitsfile *fptr, int clearbuf, int *status); -int CFITS_API ffclos(fitsfile *fptr, int *status); -int CFITS_API ffdelt(fitsfile *fptr, int *status); -int CFITS_API ffflnm(fitsfile *fptr, char *filename, int *status); -int CFITS_API ffflmd(fitsfile *fptr, int *filemode, int *status); -int CFITS_API fits_delete_iraf_file(const char *filename, int *status); - -/*---------------- utility routines -------------*/ - -float CFITS_API ffvers(float *version); -void CFITS_API ffupch(char *string); -void CFITS_API ffgerr(int status, char *errtext); -void CFITS_API ffpmsg(const char *err_message); -void CFITS_API ffpmrk(void); -int CFITS_API ffgmsg(char *err_message); -void CFITS_API ffcmsg(void); -void CFITS_API ffcmrk(void); -void CFITS_API ffrprt(FILE *stream, int status); -void CFITS_API ffcmps(char *templt, char *colname, int casesen, int *match, - int *exact); -int CFITS_API fftkey(const char *keyword, int *status); -int CFITS_API fftrec(char *card, int *status); -int CFITS_API ffnchk(fitsfile *fptr, int *status); -int CFITS_API ffkeyn(const char *keyroot, int value, char *keyname, int *status); -int CFITS_API ffnkey(int value, const char *keyroot, char *keyname, int *status); -int CFITS_API ffgkcl(char *card); -int CFITS_API ffdtyp(const char *cval, char *dtype, int *status); -int CFITS_API ffinttyp(char *cval, int *datatype, int *negative, int *status); -int CFITS_API ffpsvc(char *card, char *value, char *comm, int *status); -int CFITS_API ffgknm(char *card, char *name, int *length, int *status); -int CFITS_API ffgthd(char *tmplt, char *card, int *hdtype, int *status); -int CFITS_API ffmkky(const char *keyname, char *keyval, const char *comm, char *card, int *status); -int CFITS_API fits_translate_keyword(char *inrec, char *outrec, char *patterns[][2], - int npat, int n_value, int n_offset, int n_range, int *pat_num, - int *i, int *j, int *m, int *n, int *status); -int CFITS_API fits_translate_keywords(fitsfile *infptr, fitsfile *outfptr, - int firstkey, char *patterns[][2], - int npat, int n_value, int n_offset, int n_range, int *status); -int CFITS_API ffasfm(char *tform, int *datacode, long *width, int *decim, int *status); -int CFITS_API ffbnfm(char *tform, int *datacode, long *repeat, long *width, int *status); -int CFITS_API ffbnfmll(char *tform, int *datacode, LONGLONG *repeat, long *width, int *status); -int CFITS_API ffgabc(int tfields, char **tform, int space, long *rowlen, long *tbcol, - int *status); -int CFITS_API fits_get_section_range(char **ptr,long *secmin,long *secmax,long *incre, - int *status); -/* ffmbyt should not normally be used in application programs, but it is - defined here as a publicly available routine because there are a few - rare cases where it is needed -*/ -int CFITS_API ffmbyt(fitsfile *fptr, LONGLONG bytpos, int ignore_err, int *status); -/*----------------- write single keywords --------------*/ -int CFITS_API ffpky(fitsfile *fptr, int datatype, const char *keyname, void *value, - const char *comm, int *status); -int CFITS_API ffprec(fitsfile *fptr, const char *card, int *status); -int CFITS_API ffpcom(fitsfile *fptr, const char *comm, int *status); -int CFITS_API ffpunt(fitsfile *fptr, const char *keyname, const char *unit, int *status); -int CFITS_API ffphis(fitsfile *fptr, const char *history, int *status); -int CFITS_API ffpdat(fitsfile *fptr, int *status); -int CFITS_API ffverifydate(int year, int month, int day, int *status); -int CFITS_API ffgstm(char *timestr, int *timeref, int *status); -int CFITS_API ffgsdt(int *day, int *month, int *year, int *status); -int CFITS_API ffdt2s(int year, int month, int day, char *datestr, int *status); -int CFITS_API fftm2s(int year, int month, int day, int hour, int minute, double second, - int decimals, char *datestr, int *status); -int CFITS_API ffs2dt(char *datestr, int *year, int *month, int *day, int *status); -int CFITS_API ffs2tm(char *datestr, int *year, int *month, int *day, int *hour, - int *minute, double *second, int *status); -int CFITS_API ffpkyu(fitsfile *fptr, const char *keyname, const char *comm, int *status); -int CFITS_API ffpkys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); -int CFITS_API ffpkls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); -int CFITS_API ffplsw(fitsfile *fptr, int *status); -int CFITS_API ffpkyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status); -int CFITS_API ffpkyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status); -int CFITS_API ffpkyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, - int *status); -int CFITS_API ffpkye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, - int *status); -int CFITS_API ffpkyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, - int *status); -int CFITS_API ffpkyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, - int *status); -int CFITS_API ffpkyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, - int *status); -int CFITS_API ffpkym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, - int *status); -int CFITS_API ffpkfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, - int *status); -int CFITS_API ffpkfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, - int *status); -int CFITS_API ffpkyt(fitsfile *fptr, const char *keyname, long intval, double frac, const char *comm, - int *status); -int CFITS_API ffptdm( fitsfile *fptr, int colnum, int naxis, long naxes[], int *status); -int CFITS_API ffptdmll( fitsfile *fptr, int colnum, int naxis, LONGLONG naxes[], int *status); - -/*----------------- write array of keywords --------------*/ -int CFITS_API ffpkns(fitsfile *fptr, const char *keyroot, int nstart, int nkey, char *value[], - char *comm[], int *status); -int CFITS_API ffpknl(fitsfile *fptr, const char *keyroot, int nstart, int nkey, int *value, - char *comm[], int *status); -int CFITS_API ffpknj(fitsfile *fptr, const char *keyroot, int nstart, int nkey, long *value, - char *comm[], int *status); -int CFITS_API ffpknjj(fitsfile *fptr, const char *keyroot, int nstart, int nkey, LONGLONG *value, - char *comm[], int *status); -int CFITS_API ffpknf(fitsfile *fptr, const char *keyroot, int nstart, int nkey, float *value, - int decim, char *comm[], int *status); -int CFITS_API ffpkne(fitsfile *fptr, const char *keyroot, int nstart, int nkey, float *value, - int decim, char *comm[], int *status); -int CFITS_API ffpkng(fitsfile *fptr, const char *keyroot, int nstart, int nkey, double *value, - int decim, char *comm[], int *status); -int CFITS_API ffpknd(fitsfile *fptr, const char *keyroot, int nstart, int nkey, double *value, - int decim, char *comm[], int *status); -int CFITS_API ffcpky(fitsfile *infptr,fitsfile *outfptr,int incol,int outcol, - char *rootname, int *status); - -/*----------------- write required header keywords --------------*/ -int CFITS_API ffphps( fitsfile *fptr, int bitpix, int naxis, long naxes[], int *status); -int CFITS_API ffphpsll( fitsfile *fptr, int bitpix, int naxis, LONGLONG naxes[], int *status); -int CFITS_API ffphpr( fitsfile *fptr, int simple, int bitpix, int naxis, long naxes[], - LONGLONG pcount, LONGLONG gcount, int extend, int *status); -int CFITS_API ffphprll( fitsfile *fptr, int simple, int bitpix, int naxis, LONGLONG naxes[], - LONGLONG pcount, LONGLONG gcount, int extend, int *status); -int CFITS_API ffphtb(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, int tfields, char **ttype, - long *tbcol, char **tform, char **tunit, const char *extname, int *status); -int CFITS_API ffphbn(fitsfile *fptr, LONGLONG naxis2, int tfields, char **ttype, - char **tform, char **tunit, const char *extname, LONGLONG pcount, int *status); -int CFITS_API ffphext( fitsfile *fptr, const char *xtension, int bitpix, int naxis, long naxes[], - LONGLONG pcount, LONGLONG gcount, int *status); -/*----------------- write template keywords --------------*/ -int CFITS_API ffpktp(fitsfile *fptr, const char *filename, int *status); - -/*------------------ get header information --------------*/ -int CFITS_API ffghsp(fitsfile *fptr, int *nexist, int *nmore, int *status); -int CFITS_API ffghps(fitsfile *fptr, int *nexist, int *position, int *status); - -/*------------------ move position in header -------------*/ -int CFITS_API ffmaky(fitsfile *fptr, int nrec, int *status); -int CFITS_API ffmrky(fitsfile *fptr, int nrec, int *status); - -/*------------------ read single keywords -----------------*/ -int CFITS_API ffgnxk(fitsfile *fptr, char **inclist, int ninc, char **exclist, - int nexc, char *card, int *status); -int CFITS_API ffgrec(fitsfile *fptr, int nrec, char *card, int *status); -int CFITS_API ffgcrd(fitsfile *fptr, const char *keyname, char *card, int *status); -int CFITS_API ffgstr(fitsfile *fptr, const char *string, char *card, int *status); -int CFITS_API ffgunt(fitsfile *fptr, const char *keyname, char *unit, int *status); -int CFITS_API ffgkyn(fitsfile *fptr, int nkey, char *keyname, char *keyval, char *comm, - int *status); -int CFITS_API ffgkey(fitsfile *fptr, const char *keyname, char *keyval, char *comm, - int *status); - -int CFITS_API ffgky( fitsfile *fptr, int datatype, const char *keyname, void *value, - char *comm, int *status); -int CFITS_API ffgkys(fitsfile *fptr, const char *keyname, char *value, char *comm, int *status); -int CFITS_API ffgkls(fitsfile *fptr, const char *keyname, char **value, char *comm, int *status); -int CFITS_API fffree(void *value, int *status); -int CFITS_API fffkls(char *value, int *status); -int CFITS_API ffgkyl(fitsfile *fptr, const char *keyname, int *value, char *comm, int *status); -int CFITS_API ffgkyj(fitsfile *fptr, const char *keyname, long *value, char *comm, int *status); -int CFITS_API ffgkyjj(fitsfile *fptr, const char *keyname, LONGLONG *value, char *comm, int *status); -int CFITS_API ffgkye(fitsfile *fptr, const char *keyname, float *value, char *comm,int *status); -int CFITS_API ffgkyd(fitsfile *fptr, const char *keyname, double *value,char *comm,int *status); -int CFITS_API ffgkyc(fitsfile *fptr, const char *keyname, float *value, char *comm,int *status); -int CFITS_API ffgkym(fitsfile *fptr, const char *keyname, double *value,char *comm,int *status); -int CFITS_API ffgkyt(fitsfile *fptr, const char *keyname, long *ivalue, double *dvalue, - char *comm, int *status); -int CFITS_API ffgtdm(fitsfile *fptr, int colnum, int maxdim, int *naxis, long naxes[], - int *status); -int CFITS_API ffgtdmll(fitsfile *fptr, int colnum, int maxdim, int *naxis, LONGLONG naxes[], - int *status); -int CFITS_API ffdtdm(fitsfile *fptr, char *tdimstr, int colnum, int maxdim, - int *naxis, long naxes[], int *status); -int CFITS_API ffdtdmll(fitsfile *fptr, char *tdimstr, int colnum, int maxdim, - int *naxis, LONGLONG naxes[], int *status); - -/*------------------ read array of keywords -----------------*/ -int CFITS_API ffgkns(fitsfile *fptr, const char *keyname, int nstart, int nmax, char *value[], - int *nfound, int *status); -int CFITS_API ffgknl(fitsfile *fptr, const char *keyname, int nstart, int nmax, int *value, - int *nfound, int *status); -int CFITS_API ffgknj(fitsfile *fptr, const char *keyname, int nstart, int nmax, long *value, - int *nfound, int *status); -int CFITS_API ffgknjj(fitsfile *fptr, const char *keyname, int nstart, int nmax, LONGLONG *value, - int *nfound, int *status); -int CFITS_API ffgkne(fitsfile *fptr, const char *keyname, int nstart, int nmax, float *value, - int *nfound, int *status); -int CFITS_API ffgknd(fitsfile *fptr, const char *keyname, int nstart, int nmax, double *value, - int *nfound, int *status); -int CFITS_API ffh2st(fitsfile *fptr, char **header, int *status); -int CFITS_API ffhdr2str( fitsfile *fptr, int exclude_comm, char **exclist, - int nexc, char **header, int *nkeys, int *status); -int CFITS_API ffcnvthdr2str( fitsfile *fptr, int exclude_comm, char **exclist, - int nexc, char **header, int *nkeys, int *status); - -/*----------------- read required header keywords --------------*/ -int CFITS_API ffghpr(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis, - long naxes[], long *pcount, long *gcount, int *extend, int *status); - -int CFITS_API ffghprll(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis, - LONGLONG naxes[], long *pcount, long *gcount, int *extend, int *status); - -int CFITS_API ffghtb(fitsfile *fptr,int maxfield, long *naxis1, long *naxis2, - int *tfields, char **ttype, long *tbcol, char **tform, char **tunit, - char *extname, int *status); - -int CFITS_API ffghtbll(fitsfile *fptr,int maxfield, LONGLONG *naxis1, LONGLONG *naxis2, - int *tfields, char **ttype, LONGLONG *tbcol, char **tform, char **tunit, - char *extname, int *status); - - -int CFITS_API ffghbn(fitsfile *fptr, int maxfield, long *naxis2, int *tfields, - char **ttype, char **tform, char **tunit, char *extname, - long *pcount, int *status); - -int CFITS_API ffghbnll(fitsfile *fptr, int maxfield, LONGLONG *naxis2, int *tfields, - char **ttype, char **tform, char **tunit, char *extname, - LONGLONG *pcount, int *status); - -/*--------------------- update keywords ---------------*/ -int CFITS_API ffuky(fitsfile *fptr, int datatype, const char *keyname, void *value, - const char *comm, int *status); -int CFITS_API ffucrd(fitsfile *fptr, const char *keyname, const char *card, int *status); -int CFITS_API ffukyu(fitsfile *fptr, const char *keyname, const char *comm, int *status); -int CFITS_API ffukys(fitsfile *fptr, const char *keyname, const char *value, const char *comm, int *status); -int CFITS_API ffukls(fitsfile *fptr, const char *keyname, const char *value, const char *comm, int *status); -int CFITS_API ffukyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status); -int CFITS_API ffukyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status); -int CFITS_API ffukyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, - int *status); -int CFITS_API ffukye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, - int *status); -int CFITS_API ffukyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, - int *status); -int CFITS_API ffukyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, - int *status); -int CFITS_API ffukyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, - int *status); -int CFITS_API ffukym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, - int *status); -int CFITS_API ffukfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, - int *status); -int CFITS_API ffukfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, - int *status); - -/*--------------------- modify keywords ---------------*/ -int CFITS_API ffmrec(fitsfile *fptr, int nkey, const char *card, int *status); -int CFITS_API ffmcrd(fitsfile *fptr, const char *keyname, const char *card, int *status); -int CFITS_API ffmnam(fitsfile *fptr, const char *oldname, const char *newname, int *status); -int CFITS_API ffmcom(fitsfile *fptr, const char *keyname, const char *comm, int *status); -int CFITS_API ffmkyu(fitsfile *fptr, const char *keyname, const char *comm, int *status); -int CFITS_API ffmkys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); -int CFITS_API ffmkls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); -int CFITS_API ffmkyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status); -int CFITS_API ffmkyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status); -int CFITS_API ffmkyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, - int *status); -int CFITS_API ffmkye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, - int *status); -int CFITS_API ffmkyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, - int *status); -int CFITS_API ffmkyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, - int *status); -int CFITS_API ffmkyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, - int *status); -int CFITS_API ffmkym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, - int *status); -int CFITS_API ffmkfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, - int *status); -int CFITS_API ffmkfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, - int *status); - -/*--------------------- insert keywords ---------------*/ -int CFITS_API ffirec(fitsfile *fptr, int nkey, const char *card, int *status); -int CFITS_API ffikey(fitsfile *fptr, const char *card, int *status); -int CFITS_API ffikyu(fitsfile *fptr, const char *keyname, const char *comm, int *status); -int CFITS_API ffikys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); -int CFITS_API ffikls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); -int CFITS_API ffikyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status); -int CFITS_API ffikyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status); -int CFITS_API ffikyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, - int *status); -int CFITS_API ffikye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, - int *status); -int CFITS_API ffikyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, - int *status); -int CFITS_API ffikyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, - int *status); -int CFITS_API ffikyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, - int *status); -int CFITS_API ffikym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, - int *status); -int CFITS_API ffikfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, - int *status); -int CFITS_API ffikfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, - int *status); - -/*--------------------- delete keywords ---------------*/ -int CFITS_API ffdkey(fitsfile *fptr, const char *keyname, int *status); -int CFITS_API ffdstr(fitsfile *fptr, const char *string, int *status); -int CFITS_API ffdrec(fitsfile *fptr, int keypos, int *status); - -/*--------------------- get HDU information -------------*/ -int CFITS_API ffghdn(fitsfile *fptr, int *chdunum); -int CFITS_API ffghdt(fitsfile *fptr, int *exttype, int *status); -int CFITS_API ffghad(fitsfile *fptr, long *headstart, long *datastart, long *dataend, - int *status); -int CFITS_API ffghadll(fitsfile *fptr, LONGLONG *headstart, LONGLONG *datastart, - LONGLONG *dataend, int *status); -int CFITS_API ffghof(fitsfile *fptr, OFF_T *headstart, OFF_T *datastart, OFF_T *dataend, - int *status); -int CFITS_API ffgipr(fitsfile *fptr, int maxaxis, int *imgtype, int *naxis, - long *naxes, int *status); -int CFITS_API ffgiprll(fitsfile *fptr, int maxaxis, int *imgtype, int *naxis, - LONGLONG *naxes, int *status); -int CFITS_API ffgidt(fitsfile *fptr, int *imgtype, int *status); -int CFITS_API ffgiet(fitsfile *fptr, int *imgtype, int *status); -int CFITS_API ffgidm(fitsfile *fptr, int *naxis, int *status); -int CFITS_API ffgisz(fitsfile *fptr, int nlen, long *naxes, int *status); -int CFITS_API ffgiszll(fitsfile *fptr, int nlen, LONGLONG *naxes, int *status); - -/*--------------------- HDU operations -------------*/ -int CFITS_API ffmahd(fitsfile *fptr, int hdunum, int *exttype, int *status); -int CFITS_API ffmrhd(fitsfile *fptr, int hdumov, int *exttype, int *status); -int CFITS_API ffmnhd(fitsfile *fptr, int exttype, char *hduname, int hduvers, - int *status); -int CFITS_API ffthdu(fitsfile *fptr, int *nhdu, int *status); -int CFITS_API ffcrhd(fitsfile *fptr, int *status); -int CFITS_API ffcrim(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status); -int CFITS_API ffcrimll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status); -int CFITS_API ffcrtb(fitsfile *fptr, int tbltype, LONGLONG naxis2, int tfields, char **ttype, - char **tform, char **tunit, const char *extname, int *status); -int CFITS_API ffiimg(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status); -int CFITS_API ffiimgll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status); -int CFITS_API ffitab(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, int tfields, char **ttype, - long *tbcol, char **tform, char **tunit, const char *extname, int *status); -int CFITS_API ffibin(fitsfile *fptr, LONGLONG naxis2, int tfields, char **ttype, char **tform, - char **tunit, const char *extname, LONGLONG pcount, int *status); -int CFITS_API ffrsim(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status); -int CFITS_API ffrsimll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status); -int CFITS_API ffdhdu(fitsfile *fptr, int *hdutype, int *status); -int CFITS_API ffcopy(fitsfile *infptr, fitsfile *outfptr, int morekeys, int *status); -int CFITS_API ffcpfl(fitsfile *infptr, fitsfile *outfptr, int prev, int cur, int follow, - int *status); -int CFITS_API ffcphd(fitsfile *infptr, fitsfile *outfptr, int *status); -int CFITS_API ffcpdt(fitsfile *infptr, fitsfile *outfptr, int *status); -int CFITS_API ffchfl(fitsfile *fptr, int *status); -int CFITS_API ffcdfl(fitsfile *fptr, int *status); -int CFITS_API ffwrhdu(fitsfile *fptr, FILE *outstream, int *status); - -int CFITS_API ffrdef(fitsfile *fptr, int *status); -int CFITS_API ffhdef(fitsfile *fptr, int morekeys, int *status); -int CFITS_API ffpthp(fitsfile *fptr, long theap, int *status); - -int CFITS_API ffcsum(fitsfile *fptr, long nrec, unsigned long *sum, int *status); -void CFITS_API ffesum(unsigned long sum, int complm, char *ascii); -unsigned long CFITS_API ffdsum(char *ascii, int complm, unsigned long *sum); -int CFITS_API ffpcks(fitsfile *fptr, int *status); -int CFITS_API ffupck(fitsfile *fptr, int *status); -int CFITS_API ffvcks(fitsfile *fptr, int *datastatus, int *hdustatus, int *status); -int CFITS_API ffgcks(fitsfile *fptr, unsigned long *datasum, unsigned long *hdusum, - int *status); - -/*--------------------- define scaling or null values -------------*/ -int CFITS_API ffpscl(fitsfile *fptr, double scale, double zero, int *status); -int CFITS_API ffpnul(fitsfile *fptr, LONGLONG nulvalue, int *status); -int CFITS_API fftscl(fitsfile *fptr, int colnum, double scale, double zero, int *status); -int CFITS_API fftnul(fitsfile *fptr, int colnum, LONGLONG nulvalue, int *status); -int CFITS_API ffsnul(fitsfile *fptr, int colnum, char *nulstring, int *status); - -/*--------------------- get column information -------------*/ -int CFITS_API ffgcno(fitsfile *fptr, int casesen, char *templt, int *colnum, - int *status); -int CFITS_API ffgcnn(fitsfile *fptr, int casesen, char *templt, char *colname, - int *colnum, int *status); - -int CFITS_API ffgtcl(fitsfile *fptr, int colnum, int *typecode, long *repeat, - long *width, int *status); -int CFITS_API ffgtclll(fitsfile *fptr, int colnum, int *typecode, LONGLONG *repeat, - LONGLONG *width, int *status); -int CFITS_API ffeqty(fitsfile *fptr, int colnum, int *typecode, long *repeat, - long *width, int *status); -int CFITS_API ffeqtyll(fitsfile *fptr, int colnum, int *typecode, LONGLONG *repeat, - LONGLONG *width, int *status); -int CFITS_API ffgncl(fitsfile *fptr, int *ncols, int *status); -int CFITS_API ffgnrw(fitsfile *fptr, long *nrows, int *status); -int CFITS_API ffgnrwll(fitsfile *fptr, LONGLONG *nrows, int *status); -int CFITS_API ffgacl(fitsfile *fptr, int colnum, char *ttype, long *tbcol, - char *tunit, char *tform, double *tscal, double *tzero, - char *tnull, char *tdisp, int *status); -int CFITS_API ffgbcl(fitsfile *fptr, int colnum, char *ttype, char *tunit, - char *dtype, long *repeat, double *tscal, double *tzero, - long *tnull, char *tdisp, int *status); -int CFITS_API ffgbclll(fitsfile *fptr, int colnum, char *ttype, char *tunit, - char *dtype, LONGLONG *repeat, double *tscal, double *tzero, - LONGLONG *tnull, char *tdisp, int *status); -int CFITS_API ffgrsz(fitsfile *fptr, long *nrows, int *status); -int CFITS_API ffgcdw(fitsfile *fptr, int colnum, int *width, int *status); - -/*--------------------- read primary array or image elements -------------*/ -int CFITS_API ffgpxv(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem, - void *nulval, void *array, int *anynul, int *status); -int CFITS_API ffgpxvll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem, - void *nulval, void *array, int *anynul, int *status); -int CFITS_API ffgpxf(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem, - void *array, char *nullarray, int *anynul, int *status); -int CFITS_API ffgpxfll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem, - void *array, char *nullarray, int *anynul, int *status); -int CFITS_API ffgsv(fitsfile *fptr, int datatype, long *blc, long *trc, long *inc, - void *nulval, void *array, int *anynul, int *status); - -int CFITS_API ffgpv(fitsfile *fptr, int datatype, LONGLONG firstelem, LONGLONG nelem, - void *nulval, void *array, int *anynul, int *status); -int CFITS_API ffgpf(fitsfile *fptr, int datatype, LONGLONG firstelem, LONGLONG nelem, - void *array, char *nullarray, int *anynul, int *status); -int CFITS_API ffgpvb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned - char nulval, unsigned char *array, int *anynul, int *status); -int CFITS_API ffgpvsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, signed - char nulval, signed char *array, int *anynul, int *status); -int CFITS_API ffgpvui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned short nulval, unsigned short *array, int *anynul, - int *status); -int CFITS_API ffgpvi(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - short nulval, short *array, int *anynul, int *status); -int CFITS_API ffgpvuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned long nulval, unsigned long *array, int *anynul, - int *status); -int CFITS_API ffgpvj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - long nulval, long *array, int *anynul, int *status); -int CFITS_API ffgpvjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - LONGLONG nulval, LONGLONG *array, int *anynul, int *status); -int CFITS_API ffgpvuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned int nulval, unsigned int *array, int *anynul, int *status); -int CFITS_API ffgpvk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - int nulval, int *array, int *anynul, int *status); -int CFITS_API ffgpve(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - float nulval, float *array, int *anynul, int *status); -int CFITS_API ffgpvd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - double nulval, double *array, int *anynul, int *status); - -int CFITS_API ffgpfb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned char *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - signed char *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned short *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfi(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - short *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned long *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - long *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - LONGLONG *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned int *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - int *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfe(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - float *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgpfd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - double *array, char *nularray, int *anynul, int *status); - -int CFITS_API ffg2db(fitsfile *fptr, long group, unsigned char nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, unsigned char *array, - int *anynul, int *status); -int CFITS_API ffg2dsb(fitsfile *fptr, long group, signed char nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, signed char *array, - int *anynul, int *status); -int CFITS_API ffg2dui(fitsfile *fptr, long group, unsigned short nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, unsigned short *array, - int *anynul, int *status); -int CFITS_API ffg2di(fitsfile *fptr, long group, short nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, short *array, - int *anynul, int *status); -int CFITS_API ffg2duj(fitsfile *fptr, long group, unsigned long nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, unsigned long *array, - int *anynul, int *status); -int CFITS_API ffg2dj(fitsfile *fptr, long group, long nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, long *array, - int *anynul, int *status); -int CFITS_API ffg2djj(fitsfile *fptr, long group, LONGLONG nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, LONGLONG *array, - int *anynul, int *status); -int CFITS_API ffg2duk(fitsfile *fptr, long group, unsigned int nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, unsigned int *array, - int *anynul, int *status); -int CFITS_API ffg2dk(fitsfile *fptr, long group, int nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, int *array, - int *anynul, int *status); -int CFITS_API ffg2de(fitsfile *fptr, long group, float nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, float *array, - int *anynul, int *status); -int CFITS_API ffg2dd(fitsfile *fptr, long group, double nulval, LONGLONG ncols, - LONGLONG naxis1, LONGLONG naxis2, double *array, - int *anynul, int *status); - -int CFITS_API ffg3db(fitsfile *fptr, long group, unsigned char nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - unsigned char *array, int *anynul, int *status); -int CFITS_API ffg3dsb(fitsfile *fptr, long group, signed char nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - signed char *array, int *anynul, int *status); -int CFITS_API ffg3dui(fitsfile *fptr, long group, unsigned short nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - unsigned short *array, int *anynul, int *status); -int CFITS_API ffg3di(fitsfile *fptr, long group, short nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - short *array, int *anynul, int *status); -int CFITS_API ffg3duj(fitsfile *fptr, long group, unsigned long nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - unsigned long *array, int *anynul, int *status); -int CFITS_API ffg3dj(fitsfile *fptr, long group, long nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - long *array, int *anynul, int *status); -int CFITS_API ffg3djj(fitsfile *fptr, long group, LONGLONG nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - LONGLONG *array, int *anynul, int *status); -int CFITS_API ffg3duk(fitsfile *fptr, long group, unsigned int nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - unsigned int *array, int *anynul, int *status); -int CFITS_API ffg3dk(fitsfile *fptr, long group, int nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - int *array, int *anynul, int *status); -int CFITS_API ffg3de(fitsfile *fptr, long group, float nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - float *array, int *anynul, int *status); -int CFITS_API ffg3dd(fitsfile *fptr, long group, double nulval, LONGLONG ncols, - LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, - double *array, int *anynul, int *status); - -int CFITS_API ffgsvb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, unsigned char nulval, unsigned char *array, - int *anynul, int *status); -int CFITS_API ffgsvsb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, signed char nulval, signed char *array, - int *anynul, int *status); -int CFITS_API ffgsvui(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, unsigned short nulval, unsigned short *array, - int *anynul, int *status); -int CFITS_API ffgsvi(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, short nulval, short *array, int *anynul, int *status); -int CFITS_API ffgsvuj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, unsigned long nulval, unsigned long *array, - int *anynul, int *status); -int CFITS_API ffgsvj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, long nulval, long *array, int *anynul, int *status); -int CFITS_API ffgsvjj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, LONGLONG nulval, LONGLONG *array, int *anynul, - int *status); -int CFITS_API ffgsvuk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, unsigned int nulval, unsigned int *array, - int *anynul, int *status); -int CFITS_API ffgsvk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, int nulval, int *array, int *anynul, int *status); -int CFITS_API ffgsve(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, float nulval, float *array, int *anynul, int *status); -int CFITS_API ffgsvd(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, double nulval, double *array, int *anynul, - int *status); - -int CFITS_API ffgsfb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, unsigned char *array, char *flagval, - int *anynul, int *status); -int CFITS_API ffgsfsb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, signed char *array, char *flagval, - int *anynul, int *status); -int CFITS_API ffgsfui(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, unsigned short *array, char *flagval, int *anynul, - int *status); -int CFITS_API ffgsfi(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, short *array, char *flagval, int *anynul, int *status); -int CFITS_API ffgsfuj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, unsigned long *array, char *flagval, int *anynul, - int *status); -int CFITS_API ffgsfj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, long *array, char *flagval, int *anynul, int *status); -int CFITS_API ffgsfjj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, LONGLONG *array, char *flagval, int *anynul, - int *status); -int CFITS_API ffgsfuk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, unsigned int *array, char *flagval, int *anynul, - int *status); -int CFITS_API ffgsfk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, int *array, char *flagval, int *anynul, int *status); -int CFITS_API ffgsfe(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, float *array, char *flagval, int *anynul, int *status); -int CFITS_API ffgsfd(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, - long *trc, long *inc, double *array, char *flagval, int *anynul, - int *status); - -int CFITS_API ffggpb(fitsfile *fptr, long group, long firstelem, long nelem, - unsigned char *array, int *status); -int CFITS_API ffggpsb(fitsfile *fptr, long group, long firstelem, long nelem, - signed char *array, int *status); -int CFITS_API ffggpui(fitsfile *fptr, long group, long firstelem, long nelem, - unsigned short *array, int *status); -int CFITS_API ffggpi(fitsfile *fptr, long group, long firstelem, long nelem, - short *array, int *status); -int CFITS_API ffggpuj(fitsfile *fptr, long group, long firstelem, long nelem, - unsigned long *array, int *status); -int CFITS_API ffggpj(fitsfile *fptr, long group, long firstelem, long nelem, - long *array, int *status); -int CFITS_API ffggpjj(fitsfile *fptr, long group, long firstelem, long nelem, - LONGLONG *array, int *status); -int CFITS_API ffggpuk(fitsfile *fptr, long group, long firstelem, long nelem, - unsigned int *array, int *status); -int CFITS_API ffggpk(fitsfile *fptr, long group, long firstelem, long nelem, - int *array, int *status); -int CFITS_API ffggpe(fitsfile *fptr, long group, long firstelem, long nelem, - float *array, int *status); -int CFITS_API ffggpd(fitsfile *fptr, long group, long firstelem, long nelem, - double *array, int *status); - -/*--------------------- read column elements -------------*/ -int CFITS_API ffgcv( fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, - LONGLONG firstelem, LONGLONG nelem, void *nulval, void *array, int *anynul, - int *status); -int CFITS_API ffgcf( fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, - LONGLONG firstelem, LONGLONG nelem, void *array, char *nullarray, - int *anynul, int *status); -int CFITS_API ffgcvs(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, char *nulval, char **array, int *anynul, int *status); -int CFITS_API ffgcl (fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, char *array, int *status); -int CFITS_API ffgcvl (fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, char nulval, char *array, int *anynul, int *status); -int CFITS_API ffgcvb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned char nulval, unsigned char *array, - int *anynul, int *status); -int CFITS_API ffgcvsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, signed char nulval, signed char *array, - int *anynul, int *status); -int CFITS_API ffgcvui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned short nulval, unsigned short *array, - int *anynul, int *status); -int CFITS_API ffgcvi(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, short nulval, short *array, int *anynul, int *status); -int CFITS_API ffgcvuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned long nulval, unsigned long *array, int *anynul, - int *status); -int CFITS_API ffgcvj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, long nulval, long *array, int *anynul, int *status); -int CFITS_API ffgcvjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, LONGLONG nulval, LONGLONG *array, int *anynul, - int *status); -int CFITS_API ffgcvuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned int nulval, unsigned int *array, int *anynul, - int *status); -int CFITS_API ffgcvk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, int nulval, int *array, int *anynul, int *status); -int CFITS_API ffgcve(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, float nulval, float *array, int *anynul, int *status); -int CFITS_API ffgcvd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, double nulval, double *array, int *anynul, int *status); -int CFITS_API ffgcvc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, float nulval, float *array, int *anynul, int *status); -int CFITS_API ffgcvm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, double nulval, double *array, int *anynul, int *status); - -int CFITS_API ffgcx(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstbit, - LONGLONG nbits, char *larray, int *status); -int CFITS_API ffgcxui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, - long firstbit, int nbits, unsigned short *array, int *status); -int CFITS_API ffgcxuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, - long firstbit, int nbits, unsigned int *array, int *status); - -int CFITS_API ffgcfs(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, char **array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfl(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, char *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned char *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, signed char *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned short *array, char *nularray, int *anynul, - int *status); -int CFITS_API ffgcfi(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, short *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned long *array, char *nularray, int *anynul, - int *status); -int CFITS_API ffgcfj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, long *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, LONGLONG *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned int *array, char *nularray, int *anynul, - int *status); -int CFITS_API ffgcfk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, int *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfe(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, float *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, double *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, float *array, char *nularray, int *anynul, int *status); -int CFITS_API ffgcfm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, double *array, char *nularray, int *anynul, int *status); - -int CFITS_API ffgdes(fitsfile *fptr, int colnum, LONGLONG rownum, long *length, - long *heapaddr, int *status); -int CFITS_API ffgdesll(fitsfile *fptr, int colnum, LONGLONG rownum, LONGLONG *length, - LONGLONG *heapaddr, int *status); -int CFITS_API ffgdess(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, long *length, - long *heapaddr, int *status); -int CFITS_API ffgdessll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, LONGLONG *length, - LONGLONG *heapaddr, int *status); -int CFITS_API ffpdes(fitsfile *fptr, int colnum, LONGLONG rownum, LONGLONG length, - LONGLONG heapaddr, int *status); -int CFITS_API fftheap(fitsfile *fptr, LONGLONG *heapsize, LONGLONG *unused, LONGLONG *overlap, - int *valid, int *status); -int CFITS_API ffcmph(fitsfile *fptr, int *status); - -int CFITS_API ffgtbb(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars, - unsigned char *values, int *status); - -int CFITS_API ffgextn(fitsfile *fptr, LONGLONG offset, LONGLONG nelem, void *array, int *status); -int CFITS_API ffpextn(fitsfile *fptr, LONGLONG offset, LONGLONG nelem, void *array, int *status); - -/*------------ write primary array or image elements -------------*/ -int CFITS_API ffppx(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem, - void *array, int *status); -int CFITS_API ffppxll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem, - void *array, int *status); -int CFITS_API ffppxn(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem, - void *array, void *nulval, int *status); -int CFITS_API ffppxnll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem, - void *array, void *nulval, int *status); -int CFITS_API ffppr(fitsfile *fptr, int datatype, LONGLONG firstelem, - LONGLONG nelem, void *array, int *status); -int CFITS_API ffpprb(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, unsigned char *array, int *status); -int CFITS_API ffpprsb(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, signed char *array, int *status); -int CFITS_API ffpprui(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, unsigned short *array, int *status); -int CFITS_API ffppri(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, short *array, int *status); -int CFITS_API ffppruj(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, unsigned long *array, int *status); -int CFITS_API ffpprj(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, long *array, int *status); -int CFITS_API ffppruk(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, unsigned int *array, int *status); -int CFITS_API ffpprk(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, int *array, int *status); -int CFITS_API ffppre(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, float *array, int *status); -int CFITS_API ffpprd(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, double *array, int *status); -int CFITS_API ffpprjj(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, LONGLONG *array, int *status); - -int CFITS_API ffppru(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - int *status); -int CFITS_API ffpprn(fitsfile *fptr, LONGLONG firstelem, LONGLONG nelem, int *status); - -int CFITS_API ffppn(fitsfile *fptr, int datatype, LONGLONG firstelem, LONGLONG nelem, - void *array, void *nulval, int *status); -int CFITS_API ffppnb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned char *array, unsigned char nulval, int *status); -int CFITS_API ffppnsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - signed char *array, signed char nulval, int *status); -int CFITS_API ffppnui(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, unsigned short *array, unsigned short nulval, - int *status); -int CFITS_API ffppni(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, short *array, short nulval, int *status); -int CFITS_API ffppnj(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, long *array, long nulval, int *status); -int CFITS_API ffppnuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned long *array, unsigned long nulval, int *status); -int CFITS_API ffppnuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, - unsigned int *array, unsigned int nulval, int *status); -int CFITS_API ffppnk(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, int *array, int nulval, int *status); -int CFITS_API ffppne(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, float *array, float nulval, int *status); -int CFITS_API ffppnd(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, double *array, double nulval, int *status); -int CFITS_API ffppnjj(fitsfile *fptr, long group, LONGLONG firstelem, - LONGLONG nelem, LONGLONG *array, LONGLONG nulval, int *status); - -int CFITS_API ffp2db(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, unsigned char *array, int *status); -int CFITS_API ffp2dsb(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, signed char *array, int *status); -int CFITS_API ffp2dui(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, unsigned short *array, int *status); -int CFITS_API ffp2di(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, short *array, int *status); -int CFITS_API ffp2duj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, unsigned long *array, int *status); -int CFITS_API ffp2dj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, long *array, int *status); -int CFITS_API ffp2duk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, unsigned int *array, int *status); -int CFITS_API ffp2dk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, int *array, int *status); -int CFITS_API ffp2de(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, float *array, int *status); -int CFITS_API ffp2dd(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, double *array, int *status); -int CFITS_API ffp2djj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG *array, int *status); - -int CFITS_API ffp3db(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, unsigned char *array, int *status); -int CFITS_API ffp3dsb(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, signed char *array, int *status); -int CFITS_API ffp3dui(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, unsigned short *array, int *status); -int CFITS_API ffp3di(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, short *array, int *status); -int CFITS_API ffp3duj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, unsigned long *array, int *status); -int CFITS_API ffp3dj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, long *array, int *status); -int CFITS_API ffp3duk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, unsigned int *array, int *status); -int CFITS_API ffp3dk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, int *array, int *status); -int CFITS_API ffp3de(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, float *array, int *status); -int CFITS_API ffp3dd(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, double *array, int *status); -int CFITS_API ffp3djj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, - LONGLONG naxis2, LONGLONG naxis3, LONGLONG *array, int *status); - -int CFITS_API ffpss(fitsfile *fptr, int datatype, - long *fpixel, long *lpixel, void *array, int *status); -int CFITS_API ffpssb(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, unsigned char *array, int *status); -int CFITS_API ffpsssb(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, signed char *array, int *status); -int CFITS_API ffpssui(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, unsigned short *array, int *status); -int CFITS_API ffpssi(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, short *array, int *status); -int CFITS_API ffpssuj(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, unsigned long *array, int *status); -int CFITS_API ffpssj(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, long *array, int *status); -int CFITS_API ffpssuk(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, unsigned int *array, int *status); -int CFITS_API ffpssk(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, int *array, int *status); -int CFITS_API ffpsse(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, float *array, int *status); -int CFITS_API ffpssd(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, double *array, int *status); -int CFITS_API ffpssjj(fitsfile *fptr, long group, long naxis, long *naxes, - long *fpixel, long *lpixel, LONGLONG *array, int *status); - -int CFITS_API ffpgpb(fitsfile *fptr, long group, long firstelem, - long nelem, unsigned char *array, int *status); -int CFITS_API ffpgpsb(fitsfile *fptr, long group, long firstelem, - long nelem, signed char *array, int *status); -int CFITS_API ffpgpui(fitsfile *fptr, long group, long firstelem, - long nelem, unsigned short *array, int *status); -int CFITS_API ffpgpi(fitsfile *fptr, long group, long firstelem, - long nelem, short *array, int *status); -int CFITS_API ffpgpuj(fitsfile *fptr, long group, long firstelem, - long nelem, unsigned long *array, int *status); -int CFITS_API ffpgpj(fitsfile *fptr, long group, long firstelem, - long nelem, long *array, int *status); -int CFITS_API ffpgpuk(fitsfile *fptr, long group, long firstelem, - long nelem, unsigned int *array, int *status); -int CFITS_API ffpgpk(fitsfile *fptr, long group, long firstelem, - long nelem, int *array, int *status); -int CFITS_API ffpgpe(fitsfile *fptr, long group, long firstelem, - long nelem, float *array, int *status); -int CFITS_API ffpgpd(fitsfile *fptr, long group, long firstelem, - long nelem, double *array, int *status); -int CFITS_API ffpgpjj(fitsfile *fptr, long group, long firstelem, - long nelem, LONGLONG *array, int *status); - -/*--------------------- iterator functions -------------*/ -int CFITS_API fits_iter_set_by_name(iteratorCol *col, fitsfile *fptr, char *colname, - int datatype, int iotype); -int CFITS_API fits_iter_set_by_num(iteratorCol *col, fitsfile *fptr, int colnum, - int datatype, int iotype); -int CFITS_API fits_iter_set_file(iteratorCol *col, fitsfile *fptr); -int CFITS_API fits_iter_set_colname(iteratorCol *col, char *colname); -int CFITS_API fits_iter_set_colnum(iteratorCol *col, int colnum); -int CFITS_API fits_iter_set_datatype(iteratorCol *col, int datatype); -int CFITS_API fits_iter_set_iotype(iteratorCol *col, int iotype); - -CFITS_API fitsfile * fits_iter_get_file(iteratorCol *col); -char CFITS_API * fits_iter_get_colname(iteratorCol *col); -int CFITS_API fits_iter_get_colnum(iteratorCol *col); -int CFITS_API fits_iter_get_datatype(iteratorCol *col); -int CFITS_API fits_iter_get_iotype(iteratorCol *col); -void CFITS_API *fits_iter_get_array(iteratorCol *col); -long CFITS_API fits_iter_get_tlmin(iteratorCol *col); -long CFITS_API fits_iter_get_tlmax(iteratorCol *col); -long CFITS_API fits_iter_get_repeat(iteratorCol *col); -char CFITS_API *fits_iter_get_tunit(iteratorCol *col); -char CFITS_API *fits_iter_get_tdisp(iteratorCol *col); - -int CFITS_API ffiter(int ncols, iteratorCol *data, long offset, long nPerLoop, - int (*workFn)( long totaln, long offset, long firstn, - long nvalues, int narrays, iteratorCol *data, void *userPointer), - void *userPointer, int *status); - -/*--------------------- write column elements -------------*/ -int CFITS_API ffpcl(fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, - LONGLONG firstelem, LONGLONG nelem, void *array, int *status); -int CFITS_API ffpcls(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, char **array, int *status); -int CFITS_API ffpcll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, char *array, int *status); -int CFITS_API ffpclb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned char *array, int *status); -int CFITS_API ffpclsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, signed char *array, int *status); -int CFITS_API ffpclui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned short *array, int *status); -int CFITS_API ffpcli(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, short *array, int *status); -int CFITS_API ffpcluj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned long *array, int *status); -int CFITS_API ffpclj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, long *array, int *status); -int CFITS_API ffpcluk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned int *array, int *status); -int CFITS_API ffpclk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, int *array, int *status); -int CFITS_API ffpcle(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, float *array, int *status); -int CFITS_API ffpcld(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, double *array, int *status); -int CFITS_API ffpclc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, float *array, int *status); -int CFITS_API ffpclm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, double *array, int *status); -int CFITS_API ffpclu(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, int *status); -int CFITS_API ffprwu(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status); -int CFITS_API ffpcljj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, LONGLONG *array, int *status); -int CFITS_API ffpclx(fitsfile *fptr, int colnum, LONGLONG frow, long fbit, long nbit, - char *larray, int *status); - -int CFITS_API ffpcn(fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, void *array, void *nulval, int *status); -int CFITS_API ffpcns( fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, char **array, char *nulvalue, int *status); -int CFITS_API ffpcnl( fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, char *array, char nulvalue, int *status); -int CFITS_API ffpcnb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned char *array, unsigned char nulvalue, - int *status); -int CFITS_API ffpcnsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, signed char *array, signed char nulvalue, - int *status); -int CFITS_API ffpcnui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned short *array, unsigned short nulvalue, - int *status); -int CFITS_API ffpcni(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, short *array, short nulvalue, int *status); -int CFITS_API ffpcnuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned long *array, unsigned long nulvalue, - int *status); -int CFITS_API ffpcnj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, long *array, long nulvalue, int *status); -int CFITS_API ffpcnuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, unsigned int *array, unsigned int nulvalue, - int *status); -int CFITS_API ffpcnk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, int *array, int nulvalue, int *status); -int CFITS_API ffpcne(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, float *array, float nulvalue, int *status); -int CFITS_API ffpcnd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, double *array, double nulvalue, int *status); -int CFITS_API ffpcnjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, - LONGLONG nelem, LONGLONG *array, LONGLONG nulvalue, int *status); -int CFITS_API ffptbb(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars, - unsigned char *values, int *status); - -int CFITS_API ffirow(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status); -int CFITS_API ffdrow(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status); -int CFITS_API ffdrrg(fitsfile *fptr, char *ranges, int *status); -int CFITS_API ffdrws(fitsfile *fptr, long *rownum, long nrows, int *status); -int CFITS_API ffdrwsll(fitsfile *fptr, LONGLONG *rownum, LONGLONG nrows, int *status); -int CFITS_API fficol(fitsfile *fptr, int numcol, char *ttype, char *tform, int *status); -int CFITS_API fficls(fitsfile *fptr, int firstcol, int ncols, char **ttype, - char **tform, int *status); -int CFITS_API ffmvec(fitsfile *fptr, int colnum, LONGLONG newveclen, int *status); -int CFITS_API ffdcol(fitsfile *fptr, int numcol, int *status); -int CFITS_API ffcpcl(fitsfile *infptr, fitsfile *outfptr, int incol, int outcol, - int create_col, int *status); -int CFITS_API ffcprw(fitsfile *infptr, fitsfile *outfptr, LONGLONG firstrow, - LONGLONG nrows, int *status); - -/*--------------------- WCS Utilities ------------------*/ -int CFITS_API ffgics(fitsfile *fptr, double *xrval, double *yrval, double *xrpix, - double *yrpix, double *xinc, double *yinc, double *rot, - char *type, int *status); -int CFITS_API ffgicsa(fitsfile *fptr, char version, double *xrval, double *yrval, double *xrpix, - double *yrpix, double *xinc, double *yinc, double *rot, - char *type, int *status); -int CFITS_API ffgtcs(fitsfile *fptr, int xcol, int ycol, double *xrval, - double *yrval, double *xrpix, double *yrpix, double *xinc, - double *yinc, double *rot, char *type, int *status); -int CFITS_API ffwldp(double xpix, double ypix, double xref, double yref, - double xrefpix, double yrefpix, double xinc, double yinc, - double rot, char *type, double *xpos, double *ypos, int *status); -int CFITS_API ffxypx(double xpos, double ypos, double xref, double yref, - double xrefpix, double yrefpix, double xinc, double yinc, - double rot, char *type, double *xpix, double *ypix, int *status); - -/* WCS support routines (provide interface to Doug Mink's WCS library */ -int CFITS_API ffgiwcs(fitsfile *fptr, char **header, int *status); -int CFITS_API ffgtwcs(fitsfile *fptr, int xcol, int ycol, char **header, int *status); - -/*--------------------- lexical parsing routines ------------------*/ -int CFITS_API fftexp( fitsfile *fptr, char *expr, int maxdim, - int *datatype, long *nelem, int *naxis, - long *naxes, int *status ); - -int CFITS_API fffrow( fitsfile *infptr, char *expr, - long firstrow, long nrows, - long *n_good_rows, char *row_status, int *status); - -int CFITS_API ffffrw( fitsfile *fptr, char *expr, long *rownum, int *status); - -int CFITS_API fffrwc( fitsfile *fptr, char *expr, char *timeCol, - char *parCol, char *valCol, long ntimes, - double *times, char *time_status, int *status ); - -int CFITS_API ffsrow( fitsfile *infptr, fitsfile *outfptr, char *expr, - int *status); - -int CFITS_API ffcrow( fitsfile *fptr, int datatype, char *expr, - long firstrow, long nelements, void *nulval, - void *array, int *anynul, int *status ); - -int CFITS_API ffcalc_rng( fitsfile *infptr, char *expr, fitsfile *outfptr, - char *parName, char *parInfo, int nRngs, - long *start, long *end, int *status ); - -int CFITS_API ffcalc( fitsfile *infptr, char *expr, fitsfile *outfptr, - char *parName, char *parInfo, int *status ); - - /* ffhist is not really intended as a user-callable routine */ - /* but it may be useful for some specialized applications */ - /* ffhist2 is a newer version which is strongly recommended instead of ffhist */ - -int CFITS_API ffhist(fitsfile **fptr, char *outfile, int imagetype, int naxis, - char colname[4][FLEN_VALUE], - double *minin, double *maxin, double *binsizein, - char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE], - char binname[4][FLEN_VALUE], - double weightin, char wtcol[FLEN_VALUE], - int recip, char *rowselect, int *status); -int CFITS_API ffhist2(fitsfile **fptr, char *outfile, int imagetype, int naxis, - char colname[4][FLEN_VALUE], - double *minin, double *maxin, double *binsizein, - char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE], - char binname[4][FLEN_VALUE], - double weightin, char wtcol[FLEN_VALUE], - int recip, char *rowselect, int *status); - -int CFITS_API fits_select_image_section(fitsfile **fptr, char *outfile, - char *imagesection, int *status); -int CFITS_API fits_copy_image_section(fitsfile *infptr, fitsfile *outfile, - char *imagesection, int *status); - -int CFITS_API fits_calc_binning(fitsfile *fptr, int naxis, char colname[4][FLEN_VALUE], - double *minin, double *maxin, double *binsizein, - char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE], - char binname[4][FLEN_VALUE], int *colnum, long *haxes, float *amin, - float *amax, float *binsize, int *status); - -int CFITS_API fits_write_keys_histo(fitsfile *fptr, fitsfile *histptr, - int naxis, int *colnum, int *status); -int CFITS_API fits_rebin_wcs( fitsfile *fptr, int naxis, float *amin, float *binsize, - int *status); -int CFITS_API fits_make_hist(fitsfile *fptr, fitsfile *histptr, int bitpix,int naxis, - long *naxes, int *colnum, float *amin, float *amax, float *binsize, - float weight, int wtcolnum, int recip, char *selectrow, int *status); - -typedef struct -{ - /* input(s) */ - int count; - char ** path; - char ** tag; - fitsfile ** ifptr; - - char * expression; - - /* output control */ - int bitpix; - long blank; - fitsfile * ofptr; - char keyword[FLEN_KEYWORD]; - char comment[FLEN_COMMENT]; -} PixelFilter; - - -int CFITS_API fits_pixel_filter (PixelFilter * filter, int * status); - - -/*--------------------- grouping routines ------------------*/ - -int CFITS_API ffgtcr(fitsfile *fptr, char *grpname, int grouptype, int *status); -int CFITS_API ffgtis(fitsfile *fptr, char *grpname, int grouptype, int *status); -int CFITS_API ffgtch(fitsfile *gfptr, int grouptype, int *status); -int CFITS_API ffgtrm(fitsfile *gfptr, int rmopt, int *status); -int CFITS_API ffgtcp(fitsfile *infptr, fitsfile *outfptr, int cpopt, int *status); -int CFITS_API ffgtmg(fitsfile *infptr, fitsfile *outfptr, int mgopt, int *status); -int CFITS_API ffgtcm(fitsfile *gfptr, int cmopt, int *status); -int CFITS_API ffgtvf(fitsfile *gfptr, long *firstfailed, int *status); -int CFITS_API ffgtop(fitsfile *mfptr,int group,fitsfile **gfptr,int *status); -int CFITS_API ffgtam(fitsfile *gfptr, fitsfile *mfptr, int hdupos, int *status); -int CFITS_API ffgtnm(fitsfile *gfptr, long *nmembers, int *status); -int CFITS_API ffgmng(fitsfile *mfptr, long *nmembers, int *status); -int CFITS_API ffgmop(fitsfile *gfptr, long member, fitsfile **mfptr, int *status); -int CFITS_API ffgmcp(fitsfile *gfptr, fitsfile *mfptr, long member, int cpopt, - int *status); -int CFITS_API ffgmtf(fitsfile *infptr, fitsfile *outfptr, long member, int tfopt, - int *status); -int CFITS_API ffgmrm(fitsfile *fptr, long member, int rmopt, int *status); - -/*--------------------- group template parser routines ------------------*/ - -int CFITS_API fits_execute_template(fitsfile *ff, char *ngp_template, int *status); - -int CFITS_API fits_img_stats_short(short *array,long nx, long ny, int nullcheck, - short nullvalue,long *ngoodpix, short *minvalue, short *maxvalue, double *mean, - double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status); -int CFITS_API fits_img_stats_int(int *array,long nx, long ny, int nullcheck, - int nullvalue,long *ngoodpix, int *minvalue, int *maxvalue, double *mean, - double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status); -int CFITS_API fits_img_stats_float(float *array, long nx, long ny, int nullcheck, - float nullvalue,long *ngoodpix, float *minvalue, float *maxvalue, double *mean, - double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status); - -/*--------------------- image compression routines ------------------*/ - -int CFITS_API fits_set_compression_type(fitsfile *fptr, int ctype, int *status); -int CFITS_API fits_set_tile_dim(fitsfile *fptr, int ndim, long *dims, int *status); -int CFITS_API fits_set_noise_bits(fitsfile *fptr, int noisebits, int *status); -int CFITS_API fits_set_quantize_level(fitsfile *fptr, float qlevel, int *status); -int CFITS_API fits_set_hcomp_scale(fitsfile *fptr, float scale, int *status); -int CFITS_API fits_set_hcomp_smooth(fitsfile *fptr, int smooth, int *status); -int CFITS_API fits_set_quantize_method(fitsfile *fptr, int method, int *status); -int CFITS_API fits_set_quantize_dither(fitsfile *fptr, int dither, int *status); -int CFITS_API fits_set_dither_seed(fitsfile *fptr, int seed, int *status); -int CFITS_API fits_set_dither_offset(fitsfile *fptr, int offset, int *status); -int CFITS_API fits_set_lossy_int(fitsfile *fptr, int lossy_int, int *status); -int CFITS_API fits_set_huge_hdu(fitsfile *fptr, int huge, int *status); -int CFITS_API fits_set_compression_pref(fitsfile *infptr, fitsfile *outfptr, int *status); - -int CFITS_API fits_get_compression_type(fitsfile *fptr, int *ctype, int *status); -int CFITS_API fits_get_tile_dim(fitsfile *fptr, int ndim, long *dims, int *status); -int CFITS_API fits_get_quantize_level(fitsfile *fptr, float *qlevel, int *status); -int CFITS_API fits_get_noise_bits(fitsfile *fptr, int *noisebits, int *status); -int CFITS_API fits_get_hcomp_scale(fitsfile *fptr, float *scale, int *status); -int CFITS_API fits_get_hcomp_smooth(fitsfile *fptr, int *smooth, int *status); -int CFITS_API fits_get_dither_seed(fitsfile *fptr, int *seed, int *status); - -int CFITS_API fits_img_compress(fitsfile *infptr, fitsfile *outfptr, int *status); -int CFITS_API fits_compress_img(fitsfile *infptr, fitsfile *outfptr, int compress_type, - long *tilesize, int parm1, int parm2, int *status); -int CFITS_API fits_is_compressed_image(fitsfile *fptr, int *status); -int CFITS_API fits_is_reentrant(void); -int CFITS_API fits_decompress_img (fitsfile *infptr, fitsfile *outfptr, int *status); -int CFITS_API fits_img_decompress_header(fitsfile *infptr, fitsfile *outfptr, int *status); -int CFITS_API fits_img_decompress (fitsfile *infptr, fitsfile *outfptr, int *status); - -/* H-compress routines */ -int CFITS_API fits_hcompress(int *a, int nx, int ny, int scale, char *output, - long *nbytes, int *status); -int CFITS_API fits_hcompress64(LONGLONG *a, int nx, int ny, int scale, char *output, - long *nbytes, int *status); -int CFITS_API fits_hdecompress(unsigned char *input, int smooth, int *a, int *nx, - int *ny, int *scale, int *status); -int CFITS_API fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *nx, - int *ny, int *scale, int *status); - -int CFITS_API fits_compress_table (fitsfile *infptr, fitsfile *outfptr, int *status); -int CFITS_API fits_uncompress_table(fitsfile *infptr, fitsfile *outfptr, int *status); - -/* The following exclusion if __CINT__ is defined is needed for ROOT */ -#ifndef __CINT__ -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff --git a/include/longnam.h b/include/longnam.h deleted file mode 100644 index 81a6a4f32..000000000 --- a/include/longnam.h +++ /dev/null @@ -1,593 +0,0 @@ -#ifndef _LONGNAME_H -#define _LONGNAME_H - -#define fits_parse_input_url ffiurl -#define fits_parse_input_filename ffifile -#define fits_parse_rootname ffrtnm -#define fits_file_exists ffexist -#define fits_parse_output_url ffourl -#define fits_parse_extspec ffexts -#define fits_parse_extnum ffextn -#define fits_parse_binspec ffbins -#define fits_parse_binrange ffbinr -#define fits_parse_range ffrwrg -#define fits_parse_rangell ffrwrgll -#define fits_open_memfile ffomem - -/* - use the following special macro to test that the fitsio.h include file - that was used to build the CFITSIO library is compatible with the version - as included when compiling the application program -*/ -#define fits_open_file(A, B, C, D) ffopentest( CFITSIO_SONAME, A, B, C, D) - -#define fits_open_data ffdopn -#define fits_open_table fftopn -#define fits_open_image ffiopn -#define fits_open_diskfile ffdkopn -#define fits_reopen_file ffreopen -#define fits_create_file ffinit -#define fits_create_diskfile ffdkinit -#define fits_create_memfile ffimem -#define fits_create_template fftplt -#define fits_flush_file ffflus -#define fits_flush_buffer ffflsh -#define fits_close_file ffclos -#define fits_delete_file ffdelt -#define fits_file_name ffflnm -#define fits_file_mode ffflmd -#define fits_url_type ffurlt - -#define fits_get_version ffvers -#define fits_uppercase ffupch -#define fits_get_errstatus ffgerr -#define fits_write_errmsg ffpmsg -#define fits_write_errmark ffpmrk -#define fits_read_errmsg ffgmsg -#define fits_clear_errmsg ffcmsg -#define fits_clear_errmark ffcmrk -#define fits_report_error ffrprt -#define fits_compare_str ffcmps -#define fits_test_keyword fftkey -#define fits_test_record fftrec -#define fits_null_check ffnchk -#define fits_make_keyn ffkeyn -#define fits_make_nkey ffnkey -#define fits_make_key ffmkky -#define fits_get_keyclass ffgkcl -#define fits_get_keytype ffdtyp -#define fits_get_inttype ffinttyp -#define fits_parse_value ffpsvc -#define fits_get_keyname ffgknm -#define fits_parse_template ffgthd -#define fits_ascii_tform ffasfm -#define fits_binary_tform ffbnfm -#define fits_binary_tformll ffbnfmll -#define fits_get_tbcol ffgabc -#define fits_get_rowsize ffgrsz -#define fits_get_col_display_width ffgcdw - -#define fits_write_record ffprec -#define fits_write_key ffpky -#define fits_write_key_unit ffpunt -#define fits_write_comment ffpcom -#define fits_write_history ffphis -#define fits_write_date ffpdat -#define fits_get_system_time ffgstm -#define fits_get_system_date ffgsdt -#define fits_date2str ffdt2s -#define fits_time2str fftm2s -#define fits_str2date ffs2dt -#define fits_str2time ffs2tm -#define fits_write_key_longstr ffpkls -#define fits_write_key_longwarn ffplsw -#define fits_write_key_null ffpkyu -#define fits_write_key_str ffpkys -#define fits_write_key_log ffpkyl -#define fits_write_key_lng ffpkyj -#define fits_write_key_fixflt ffpkyf -#define fits_write_key_flt ffpkye -#define fits_write_key_fixdbl ffpkyg -#define fits_write_key_dbl ffpkyd -#define fits_write_key_fixcmp ffpkfc -#define fits_write_key_cmp ffpkyc -#define fits_write_key_fixdblcmp ffpkfm -#define fits_write_key_dblcmp ffpkym -#define fits_write_key_triple ffpkyt -#define fits_write_tdim ffptdm -#define fits_write_tdimll ffptdmll -#define fits_write_keys_str ffpkns -#define fits_write_keys_log ffpknl -#define fits_write_keys_lng ffpknj -#define fits_write_keys_fixflt ffpknf -#define fits_write_keys_flt ffpkne -#define fits_write_keys_fixdbl ffpkng -#define fits_write_keys_dbl ffpknd -#define fits_copy_key ffcpky -#define fits_write_imghdr ffphps -#define fits_write_imghdrll ffphpsll -#define fits_write_grphdr ffphpr -#define fits_write_grphdrll ffphprll -#define fits_write_atblhdr ffphtb -#define fits_write_btblhdr ffphbn -#define fits_write_exthdr ffphext -#define fits_write_key_template ffpktp - -#define fits_get_hdrspace ffghsp -#define fits_get_hdrpos ffghps -#define fits_movabs_key ffmaky -#define fits_movrel_key ffmrky -#define fits_find_nextkey ffgnxk - -#define fits_read_record ffgrec -#define fits_read_card ffgcrd -#define fits_read_str ffgstr -#define fits_read_key_unit ffgunt -#define fits_read_keyn ffgkyn -#define fits_read_key ffgky -#define fits_read_keyword ffgkey -#define fits_read_key_str ffgkys -#define fits_read_key_log ffgkyl -#define fits_read_key_lng ffgkyj -#define fits_read_key_lnglng ffgkyjj -#define fits_read_key_flt ffgkye -#define fits_read_key_dbl ffgkyd -#define fits_read_key_cmp ffgkyc -#define fits_read_key_dblcmp ffgkym -#define fits_read_key_triple ffgkyt -#define fits_read_key_longstr ffgkls -#define fits_free_memory fffree -#define fits_read_tdim ffgtdm -#define fits_read_tdimll ffgtdmll -#define fits_decode_tdim ffdtdm -#define fits_decode_tdimll ffdtdmll -#define fits_read_keys_str ffgkns -#define fits_read_keys_log ffgknl -#define fits_read_keys_lng ffgknj -#define fits_read_keys_lnglng ffgknjj -#define fits_read_keys_flt ffgkne -#define fits_read_keys_dbl ffgknd -#define fits_read_imghdr ffghpr -#define fits_read_imghdrll ffghprll -#define fits_read_atblhdr ffghtb -#define fits_read_btblhdr ffghbn -#define fits_read_atblhdrll ffghtbll -#define fits_read_btblhdrll ffghbnll -#define fits_hdr2str ffhdr2str -#define fits_convert_hdr2str ffcnvthdr2str - -#define fits_update_card ffucrd -#define fits_update_key ffuky -#define fits_update_key_null ffukyu -#define fits_update_key_str ffukys -#define fits_update_key_longstr ffukls -#define fits_update_key_log ffukyl -#define fits_update_key_lng ffukyj -#define fits_update_key_fixflt ffukyf -#define fits_update_key_flt ffukye -#define fits_update_key_fixdbl ffukyg -#define fits_update_key_dbl ffukyd -#define fits_update_key_fixcmp ffukfc -#define fits_update_key_cmp ffukyc -#define fits_update_key_fixdblcmp ffukfm -#define fits_update_key_dblcmp ffukym - -#define fits_modify_record ffmrec -#define fits_modify_card ffmcrd -#define fits_modify_name ffmnam -#define fits_modify_comment ffmcom -#define fits_modify_key_null ffmkyu -#define fits_modify_key_str ffmkys -#define fits_modify_key_longstr ffmkls -#define fits_modify_key_log ffmkyl -#define fits_modify_key_lng ffmkyj -#define fits_modify_key_fixflt ffmkyf -#define fits_modify_key_flt ffmkye -#define fits_modify_key_fixdbl ffmkyg -#define fits_modify_key_dbl ffmkyd -#define fits_modify_key_fixcmp ffmkfc -#define fits_modify_key_cmp ffmkyc -#define fits_modify_key_fixdblcmp ffmkfm -#define fits_modify_key_dblcmp ffmkym - -#define fits_insert_record ffirec -#define fits_insert_card ffikey -#define fits_insert_key_null ffikyu -#define fits_insert_key_str ffikys -#define fits_insert_key_longstr ffikls -#define fits_insert_key_log ffikyl -#define fits_insert_key_lng ffikyj -#define fits_insert_key_fixflt ffikyf -#define fits_insert_key_flt ffikye -#define fits_insert_key_fixdbl ffikyg -#define fits_insert_key_dbl ffikyd -#define fits_insert_key_fixcmp ffikfc -#define fits_insert_key_cmp ffikyc -#define fits_insert_key_fixdblcmp ffikfm -#define fits_insert_key_dblcmp ffikym - -#define fits_delete_key ffdkey -#define fits_delete_str ffdstr -#define fits_delete_record ffdrec -#define fits_get_hdu_num ffghdn -#define fits_get_hdu_type ffghdt -#define fits_get_hduaddr ffghad -#define fits_get_hduaddrll ffghadll -#define fits_get_hduoff ffghof - -#define fits_get_img_param ffgipr -#define fits_get_img_paramll ffgiprll - -#define fits_get_img_type ffgidt -#define fits_get_img_equivtype ffgiet -#define fits_get_img_dim ffgidm -#define fits_get_img_size ffgisz -#define fits_get_img_sizell ffgiszll - -#define fits_movabs_hdu ffmahd -#define fits_movrel_hdu ffmrhd -#define fits_movnam_hdu ffmnhd -#define fits_get_num_hdus ffthdu -#define fits_create_img ffcrim -#define fits_create_imgll ffcrimll -#define fits_create_tbl ffcrtb -#define fits_create_hdu ffcrhd -#define fits_insert_img ffiimg -#define fits_insert_imgll ffiimgll -#define fits_insert_atbl ffitab -#define fits_insert_btbl ffibin -#define fits_resize_img ffrsim -#define fits_resize_imgll ffrsimll - -#define fits_delete_hdu ffdhdu -#define fits_copy_hdu ffcopy -#define fits_copy_file ffcpfl -#define fits_copy_header ffcphd -#define fits_copy_data ffcpdt -#define fits_write_hdu ffwrhdu - -#define fits_set_hdustruc ffrdef -#define fits_set_hdrsize ffhdef -#define fits_write_theap ffpthp - -#define fits_encode_chksum ffesum -#define fits_decode_chksum ffdsum -#define fits_write_chksum ffpcks -#define fits_update_chksum ffupck -#define fits_verify_chksum ffvcks -#define fits_get_chksum ffgcks - -#define fits_set_bscale ffpscl -#define fits_set_tscale fftscl -#define fits_set_imgnull ffpnul -#define fits_set_btblnull fftnul -#define fits_set_atblnull ffsnul - -#define fits_get_colnum ffgcno -#define fits_get_colname ffgcnn -#define fits_get_coltype ffgtcl -#define fits_get_coltypell ffgtclll -#define fits_get_eqcoltype ffeqty -#define fits_get_eqcoltypell ffeqtyll -#define fits_get_num_rows ffgnrw -#define fits_get_num_rowsll ffgnrwll -#define fits_get_num_cols ffgncl -#define fits_get_acolparms ffgacl -#define fits_get_bcolparms ffgbcl -#define fits_get_bcolparmsll ffgbclll - -#define fits_iterate_data ffiter - -#define fits_read_grppar_byt ffggpb -#define fits_read_grppar_sbyt ffggpsb -#define fits_read_grppar_usht ffggpui -#define fits_read_grppar_ulng ffggpuj -#define fits_read_grppar_sht ffggpi -#define fits_read_grppar_lng ffggpj -#define fits_read_grppar_lnglng ffggpjj -#define fits_read_grppar_int ffggpk -#define fits_read_grppar_uint ffggpuk -#define fits_read_grppar_flt ffggpe -#define fits_read_grppar_dbl ffggpd - -#define fits_read_pix ffgpxv -#define fits_read_pixll ffgpxvll -#define fits_read_pixnull ffgpxf -#define fits_read_pixnullll ffgpxfll -#define fits_read_img ffgpv -#define fits_read_imgnull ffgpf -#define fits_read_img_byt ffgpvb -#define fits_read_img_sbyt ffgpvsb -#define fits_read_img_usht ffgpvui -#define fits_read_img_ulng ffgpvuj -#define fits_read_img_sht ffgpvi -#define fits_read_img_lng ffgpvj -#define fits_read_img_lnglng ffgpvjj -#define fits_read_img_uint ffgpvuk -#define fits_read_img_int ffgpvk -#define fits_read_img_flt ffgpve -#define fits_read_img_dbl ffgpvd - -#define fits_read_imgnull_byt ffgpfb -#define fits_read_imgnull_sbyt ffgpfsb -#define fits_read_imgnull_usht ffgpfui -#define fits_read_imgnull_ulng ffgpfuj -#define fits_read_imgnull_sht ffgpfi -#define fits_read_imgnull_lng ffgpfj -#define fits_read_imgnull_lnglng ffgpfjj -#define fits_read_imgnull_uint ffgpfuk -#define fits_read_imgnull_int ffgpfk -#define fits_read_imgnull_flt ffgpfe -#define fits_read_imgnull_dbl ffgpfd - -#define fits_read_2d_byt ffg2db -#define fits_read_2d_sbyt ffg2dsb -#define fits_read_2d_usht ffg2dui -#define fits_read_2d_ulng ffg2duj -#define fits_read_2d_sht ffg2di -#define fits_read_2d_lng ffg2dj -#define fits_read_2d_lnglng ffg2djj -#define fits_read_2d_uint ffg2duk -#define fits_read_2d_int ffg2dk -#define fits_read_2d_flt ffg2de -#define fits_read_2d_dbl ffg2dd - -#define fits_read_3d_byt ffg3db -#define fits_read_3d_sbyt ffg3dsb -#define fits_read_3d_usht ffg3dui -#define fits_read_3d_ulng ffg3duj -#define fits_read_3d_sht ffg3di -#define fits_read_3d_lng ffg3dj -#define fits_read_3d_lnglng ffg3djj -#define fits_read_3d_uint ffg3duk -#define fits_read_3d_int ffg3dk -#define fits_read_3d_flt ffg3de -#define fits_read_3d_dbl ffg3dd - -#define fits_read_subset ffgsv -#define fits_read_subset_byt ffgsvb -#define fits_read_subset_sbyt ffgsvsb -#define fits_read_subset_usht ffgsvui -#define fits_read_subset_ulng ffgsvuj -#define fits_read_subset_sht ffgsvi -#define fits_read_subset_lng ffgsvj -#define fits_read_subset_lnglng ffgsvjj -#define fits_read_subset_uint ffgsvuk -#define fits_read_subset_int ffgsvk -#define fits_read_subset_flt ffgsve -#define fits_read_subset_dbl ffgsvd - -#define fits_read_subsetnull_byt ffgsfb -#define fits_read_subsetnull_sbyt ffgsfsb -#define fits_read_subsetnull_usht ffgsfui -#define fits_read_subsetnull_ulng ffgsfuj -#define fits_read_subsetnull_sht ffgsfi -#define fits_read_subsetnull_lng ffgsfj -#define fits_read_subsetnull_lnglng ffgsfjj -#define fits_read_subsetnull_uint ffgsfuk -#define fits_read_subsetnull_int ffgsfk -#define fits_read_subsetnull_flt ffgsfe -#define fits_read_subsetnull_dbl ffgsfd - -#define ffcpimg fits_copy_image_section -#define fits_compress_img fits_comp_img -#define fits_decompress_img fits_decomp_img - -#define fits_read_col ffgcv -#define fits_read_colnull ffgcf -#define fits_read_col_str ffgcvs -#define fits_read_col_log ffgcvl -#define fits_read_col_byt ffgcvb -#define fits_read_col_sbyt ffgcvsb -#define fits_read_col_usht ffgcvui -#define fits_read_col_ulng ffgcvuj -#define fits_read_col_sht ffgcvi -#define fits_read_col_lng ffgcvj -#define fits_read_col_lnglng ffgcvjj -#define fits_read_col_uint ffgcvuk -#define fits_read_col_int ffgcvk -#define fits_read_col_flt ffgcve -#define fits_read_col_dbl ffgcvd -#define fits_read_col_cmp ffgcvc -#define fits_read_col_dblcmp ffgcvm -#define fits_read_col_bit ffgcx -#define fits_read_col_bit_usht ffgcxui -#define fits_read_col_bit_uint ffgcxuk - -#define fits_read_colnull_str ffgcfs -#define fits_read_colnull_log ffgcfl -#define fits_read_colnull_byt ffgcfb -#define fits_read_colnull_sbyt ffgcfsb -#define fits_read_colnull_usht ffgcfui -#define fits_read_colnull_ulng ffgcfuj -#define fits_read_colnull_sht ffgcfi -#define fits_read_colnull_lng ffgcfj -#define fits_read_colnull_lnglng ffgcfjj -#define fits_read_colnull_uint ffgcfuk -#define fits_read_colnull_int ffgcfk -#define fits_read_colnull_flt ffgcfe -#define fits_read_colnull_dbl ffgcfd -#define fits_read_colnull_cmp ffgcfc -#define fits_read_colnull_dblcmp ffgcfm - -#define fits_read_descript ffgdes -#define fits_read_descriptll ffgdesll -#define fits_read_descripts ffgdess -#define fits_read_descriptsll ffgdessll -#define fits_read_tblbytes ffgtbb - -#define fits_write_grppar_byt ffpgpb -#define fits_write_grppar_sbyt ffpgpsb -#define fits_write_grppar_usht ffpgpui -#define fits_write_grppar_ulng ffpgpuj -#define fits_write_grppar_sht ffpgpi -#define fits_write_grppar_lng ffpgpj -#define fits_write_grppar_lnglng ffpgpjj -#define fits_write_grppar_uint ffpgpuk -#define fits_write_grppar_int ffpgpk -#define fits_write_grppar_flt ffpgpe -#define fits_write_grppar_dbl ffpgpd - -#define fits_write_pix ffppx -#define fits_write_pixll ffppxll -#define fits_write_pixnull ffppxn -#define fits_write_pixnullll ffppxnll -#define fits_write_img ffppr -#define fits_write_img_byt ffpprb -#define fits_write_img_sbyt ffpprsb -#define fits_write_img_usht ffpprui -#define fits_write_img_ulng ffppruj -#define fits_write_img_sht ffppri -#define fits_write_img_lng ffpprj -#define fits_write_img_lnglng ffpprjj -#define fits_write_img_uint ffppruk -#define fits_write_img_int ffpprk -#define fits_write_img_flt ffppre -#define fits_write_img_dbl ffpprd - -#define fits_write_imgnull ffppn -#define fits_write_imgnull_byt ffppnb -#define fits_write_imgnull_sbyt ffppnsb -#define fits_write_imgnull_usht ffppnui -#define fits_write_imgnull_ulng ffppnuj -#define fits_write_imgnull_sht ffppni -#define fits_write_imgnull_lng ffppnj -#define fits_write_imgnull_lnglng ffppnjj -#define fits_write_imgnull_uint ffppnuk -#define fits_write_imgnull_int ffppnk -#define fits_write_imgnull_flt ffppne -#define fits_write_imgnull_dbl ffppnd - -#define fits_write_img_null ffppru -#define fits_write_null_img ffpprn - -#define fits_write_2d_byt ffp2db -#define fits_write_2d_sbyt ffp2dsb -#define fits_write_2d_usht ffp2dui -#define fits_write_2d_ulng ffp2duj -#define fits_write_2d_sht ffp2di -#define fits_write_2d_lng ffp2dj -#define fits_write_2d_lnglng ffp2djj -#define fits_write_2d_uint ffp2duk -#define fits_write_2d_int ffp2dk -#define fits_write_2d_flt ffp2de -#define fits_write_2d_dbl ffp2dd - -#define fits_write_3d_byt ffp3db -#define fits_write_3d_sbyt ffp3dsb -#define fits_write_3d_usht ffp3dui -#define fits_write_3d_ulng ffp3duj -#define fits_write_3d_sht ffp3di -#define fits_write_3d_lng ffp3dj -#define fits_write_3d_lnglng ffp3djj -#define fits_write_3d_uint ffp3duk -#define fits_write_3d_int ffp3dk -#define fits_write_3d_flt ffp3de -#define fits_write_3d_dbl ffp3dd - -#define fits_write_subset ffpss -#define fits_write_subset_byt ffpssb -#define fits_write_subset_sbyt ffpsssb -#define fits_write_subset_usht ffpssui -#define fits_write_subset_ulng ffpssuj -#define fits_write_subset_sht ffpssi -#define fits_write_subset_lng ffpssj -#define fits_write_subset_lnglng ffpssjj -#define fits_write_subset_uint ffpssuk -#define fits_write_subset_int ffpssk -#define fits_write_subset_flt ffpsse -#define fits_write_subset_dbl ffpssd - -#define fits_write_col ffpcl -#define fits_write_col_str ffpcls -#define fits_write_col_log ffpcll -#define fits_write_col_byt ffpclb -#define fits_write_col_sbyt ffpclsb -#define fits_write_col_usht ffpclui -#define fits_write_col_ulng ffpcluj -#define fits_write_col_sht ffpcli -#define fits_write_col_lng ffpclj -#define fits_write_col_lnglng ffpcljj -#define fits_write_col_uint ffpcluk -#define fits_write_col_int ffpclk -#define fits_write_col_flt ffpcle -#define fits_write_col_dbl ffpcld -#define fits_write_col_cmp ffpclc -#define fits_write_col_dblcmp ffpclm -#define fits_write_col_null ffpclu -#define fits_write_col_bit ffpclx -#define fits_write_nulrows ffprwu -#define fits_write_nullrows ffprwu - -#define fits_write_colnull ffpcn -#define fits_write_colnull_str ffpcns -#define fits_write_colnull_log ffpcnl -#define fits_write_colnull_byt ffpcnb -#define fits_write_colnull_sbyt ffpcnsb -#define fits_write_colnull_usht ffpcnui -#define fits_write_colnull_ulng ffpcnuj -#define fits_write_colnull_sht ffpcni -#define fits_write_colnull_lng ffpcnj -#define fits_write_colnull_lnglng ffpcnjj -#define fits_write_colnull_uint ffpcnuk -#define fits_write_colnull_int ffpcnk -#define fits_write_colnull_flt ffpcne -#define fits_write_colnull_dbl ffpcnd - -#define fits_write_ext ffpextn -#define fits_read_ext ffgextn - -#define fits_write_descript ffpdes -#define fits_compress_heap ffcmph -#define fits_test_heap fftheap - -#define fits_write_tblbytes ffptbb -#define fits_insert_rows ffirow -#define fits_delete_rows ffdrow -#define fits_delete_rowrange ffdrrg -#define fits_delete_rowlist ffdrws -#define fits_delete_rowlistll ffdrwsll -#define fits_insert_col fficol -#define fits_insert_cols fficls -#define fits_delete_col ffdcol -#define fits_copy_col ffcpcl -#define fits_copy_rows ffcprw -#define fits_modify_vector_len ffmvec - -#define fits_read_img_coord ffgics -#define fits_read_img_coord_version ffgicsa -#define fits_read_tbl_coord ffgtcs -#define fits_pix_to_world ffwldp -#define fits_world_to_pix ffxypx - -#define fits_get_image_wcs_keys ffgiwcs -#define fits_get_table_wcs_keys ffgtwcs - -#define fits_find_rows fffrow -#define fits_find_first_row ffffrw -#define fits_find_rows_cmp fffrwc -#define fits_select_rows ffsrow -#define fits_calc_rows ffcrow -#define fits_calculator ffcalc -#define fits_calculator_rng ffcalc_rng -#define fits_test_expr fftexp - -#define fits_create_group ffgtcr -#define fits_insert_group ffgtis -#define fits_change_group ffgtch -#define fits_remove_group ffgtrm -#define fits_copy_group ffgtcp -#define fits_merge_groups ffgtmg -#define fits_compact_group ffgtcm -#define fits_verify_group ffgtvf -#define fits_open_group ffgtop -#define fits_add_group_member ffgtam -#define fits_get_num_members ffgtnm - -#define fits_get_num_groups ffgmng -#define fits_open_member ffgmop -#define fits_copy_member ffgmcp -#define fits_transfer_member ffgmtf -#define fits_remove_member ffgmrm - -#endif diff --git a/src/kbmod/data_interface.py b/src/kbmod/data_interface.py index 416965a85..af008bde9 100644 --- a/src/kbmod/data_interface.py +++ b/src/kbmod/data_interface.py @@ -3,12 +3,111 @@ from astropy.io import fits from astropy.wcs import WCS import numpy as np - -import kbmod.search as kb +from pathlib import Path from kbmod.configuration import SearchConfiguration from kbmod.file_utils import * -from kbmod.work_unit import WorkUnit +from kbmod.search import ( + ImageStack, + LayeredImage, + PSF, + RawImage, +) +from kbmod.wcs_utils import append_wcs_to_hdu_header +from kbmod.work_unit import WorkUnit, raw_image_to_hdu + + +def load_deccam_layered_image(filename, psf): + """Load a layered image from the legacy deccam format. + + Parameters + ---------- + filename : `str` + The name of the file to load. + psf : `PSF` + The PSF to use for the image. + + Returns + ------- + img : `LayeredImage` + The loaded image. + + Raises + ------ + Raises a ``FileNotFoundError`` if the file does not exist. + Raises a ``ValueError`` if any of the validation checks fail. + """ + if not Path(filename).is_file(): + raise FileNotFoundError(f"{filename} not found") + + img = None + with fits.open(filename) as hdul: + if len(hdul) < 4: + raise ValueError("Not enough extensions for legacy deccam format") + + # Extract the obstime trying from a few keys and a few extensions. + obstime = 0.0 + if "MJD" in hdul[0].header: + obstime = hdul[0].header["MJD"] + elif "MJD" in hdul[1].header: + obstime = hdul[1].header["MJD"] + + img = LayeredImage( + RawImage(hdul[1].data.astype(np.float32), obstime), # Science + RawImage(hdul[3].data.astype(np.float32), obstime), # Variance + RawImage(hdul[2].data.astype(np.float32), obstime), # Mask + psf, + ) + + return img + + +def save_deccam_layered_image(img, filename, wcs=None, overwrite=True): + """Save a layered image to the legacy deccam format. + + Parameters + ---------- + img : `LayeredImage` + The image to save. + filename : `str` + The name of the file to save. + wcs : `astropy.wcs.WCS`, optional + The WCS of the image. If provided appends this information to the header. + overwrite : `bool` + Indicates whether to overwrite the current file if it exists. + + Raises + ------ + Raises a ``ValueError`` if the file exists and ``overwrite`` is ``False``. + """ + if Path(filename).is_file() and not overwrite: + raise ValueError(f"{filename} already exists") + + hdul = fits.HDUList() + + # Create the primary header. + pri = fits.PrimaryHDU() + pri.header["MJD"] = img.get_obstime() + if wcs is not None: + append_wcs_to_hdu_header(wcs, pri.header) + hdul.append(pri) + + # Append the science layer. + sci_hdu = raw_image_to_hdu(img.get_science(), wcs) + sci_hdu.name = f"science" + hdul.append(sci_hdu) + + # Append the mask layer. + msk_hdu = raw_image_to_hdu(img.get_mask(), wcs) + msk_hdu.name = f"mask" + hdul.append(msk_hdu) + + # Append the variance layer. + var_hdu = raw_image_to_hdu(img.get_variance(), wcs) + var_hdu.name = f"variance" + hdul.append(var_hdu) + + hdul.writeto(filename, overwrite=overwrite) def load_input_from_individual_files( @@ -102,12 +201,12 @@ def load_input_from_individual_files( # Check if the image has a specific PSF. psf = default_psf if visit_id in image_psf_dict: - psf = kb.PSF(image_psf_dict[visit_id]) + psf = PSF(image_psf_dict[visit_id]) # Load the image file and set its time. if verbose: print(f"Loading file: {full_file_path}") - img = kb.LayeredImage(full_file_path, psf) + img = load_deccam_layered_image(full_file_path, psf) time_stamp = img.get_obstime() # Overload the header's time stamp if needed. @@ -132,7 +231,7 @@ def load_input_from_individual_files( wcs_list.append(curr_wcs) print(f"Loaded {len(images)} images") - stack = kb.ImageStack(images) + stack = ImageStack(images) return (stack, wcs_list, visit_times) @@ -157,7 +256,7 @@ def load_input_from_config(config, verbose=False): config["time_file"], config["psf_file"], config["mjd_lims"], - kb.PSF(config["psf_val"]), # Default PSF. + PSF(config["psf_val"]), # Default PSF. verbose=verbose, ) return WorkUnit(stack, config, None, wcs_list) diff --git a/src/kbmod/fake_data/fake_data_creator.py b/src/kbmod/fake_data/fake_data_creator.py index 3cd3d492c..022d0ec63 100644 --- a/src/kbmod/fake_data/fake_data_creator.py +++ b/src/kbmod/fake_data/fake_data_creator.py @@ -8,16 +8,71 @@ import os import random +import numpy as np from pathlib import Path from astropy.io import fits from kbmod.configuration import SearchConfiguration +from kbmod.data_interface import save_deccam_layered_image from kbmod.file_utils import * from kbmod.search import * from kbmod.wcs_utils import append_wcs_to_hdu_header from kbmod.work_unit import WorkUnit +def make_fake_layered_image( + width, + height, + noise_stdev, + pixel_variance, + obstime, + psf, + seed=None, +): + """Create a fake LayeredImage with a noisy background. + + Parameters + ---------- + width : `int` + Width of the images (in pixels). + height : `int + Height of the images (in pixels). + noise_stdev: `float` + Standard deviation of the image. + pixel_variance: `float` + Variance of the pixels, assumed uniform. + obstime : `float` + Observation time. + psf : `PSF` + The PSF for the image. + seed : `int`, optional + The seed for the pseudorandom number generator. + + Returns + ------- + img : `LayeredImage` + The fake image. + + Raises + ------ + Raises ``ValueError`` if any of the parameters are invalid. + """ + if width <= 0 or height <= 0: + raise ValueError(f"Invalid dimensions width={width}, height={height}") + if noise_stdev < 0 or pixel_variance < 0: + raise ValueError(f"Invalid noise parameters.") + + # Use a set seed if needed. + if seed is None or seed == -1: + seed = int.from_bytes(os.urandom(4), "big") + rng = np.random.default_rng(seed) + + sci = RawImage(rng.normal(0.0, noise_stdev, (height, width)).astype(np.float32), obstime) + var = RawImage(np.full((height, width), pixel_variance).astype(np.float32), obstime) + msk = RawImage(np.zeros((height, width)).astype(np.float32), obstime) + img = LayeredImage(sci, var, msk, psf) + return img + def add_fake_object(img, x, y, flux, psf=None): """Add a fake object to a LayeredImage or RawImage @@ -145,7 +200,7 @@ def make_fake_ImageStack(self): image_list = [] for i in range(self.num_times): - img = LayeredImage( + img = make_fake_layered_image( self.width, self.height, self.noise_level, @@ -237,14 +292,7 @@ def save_fake_data_to_dir(self, data_dir): os.remove(filename) # Save the file. - img.save_layers(filename) - - # Open the file and insert fake WCS data. - if self.fake_wcs is not None: - hdul = fits.open(filename) - append_wcs_to_hdu_header(self.fake_wcs, hdul[1].header) - hdul.writeto(filename, overwrite=True) - hdul.close() + save_deccam_layered_image(img, filename, wcs=self.fake_wcs) def save_time_file(self, file_name): """Save the mapping of visit ID -> timestamp to a file. diff --git a/src/kbmod/search/image_stack.cpp b/src/kbmod/search/image_stack.cpp index 0ba33319c..90afdbe09 100644 --- a/src/kbmod/search/image_stack.cpp +++ b/src/kbmod/search/image_stack.cpp @@ -1,34 +1,12 @@ #include "image_stack.h" namespace search { -ImageStack::ImageStack(const std::vector& filenames, const std::vector& psfs) { - verbose = true; - images = std::vector(); - load_images(filenames, psfs); -} ImageStack::ImageStack(const std::vector& imgs) { verbose = true; images = imgs; } -void ImageStack::load_images(const std::vector& filenames, const std::vector& psfs) { - const int num_files = filenames.size(); - if (num_files == 0) { - std::cout << "No files provided" - << "\n"; - } - - if (psfs.size() != num_files) throw std::runtime_error("Mismatched PSF array in ImageStack creation."); - - // Load images from file - for (int i = 0; i < num_files; ++i) { - images.push_back(LayeredImage(filenames[i], psfs[i])); - if (verbose) std::cout << "." << std::flush; - } - if (verbose) std::cout << "\n"; -} - LayeredImage& ImageStack::get_single_image(int index) { if (index < 0 || index > images.size()) throw std::out_of_range("ImageStack index out of bounds."); return images[index]; @@ -93,7 +71,6 @@ static void image_stack_bindings(py::module& m) { using pf = search::PSF; py::class_(m, "ImageStack", pydocs::DOC_ImageStack) - .def(py::init, std::vector>()) .def(py::init>()) .def("get_images", &is::get_images, pydocs::DOC_ImageStack_get_images) .def("get_single_image", &is::get_single_image, py::return_value_policy::reference_internal, diff --git a/src/kbmod/search/image_stack.h b/src/kbmod/search/image_stack.h index c4e4be1f7..886bdb5c8 100644 --- a/src/kbmod/search/image_stack.h +++ b/src/kbmod/search/image_stack.h @@ -13,7 +13,6 @@ namespace search { class ImageStack { public: - ImageStack(const std::vector& filenames, const std::vector& psfs); ImageStack(const std::vector& imgs); // Simple getters. @@ -37,7 +36,6 @@ class ImageStack { virtual ~ImageStack(){}; private: - void load_images(const std::vector& filenames, const std::vector& psfs); std::vector images; bool verbose; }; diff --git a/src/kbmod/search/layered_image.cpp b/src/kbmod/search/layered_image.cpp index ba7efbb06..efe20474d 100644 --- a/src/kbmod/search/layered_image.cpp +++ b/src/kbmod/search/layered_image.cpp @@ -2,27 +2,6 @@ namespace search { -LayeredImage::LayeredImage(std::string path, const PSF& psf) : psf(psf) { - int f_begin = path.find_last_of("/"); - int f_end = path.find_last_of(".fits") - 4; - - science = RawImage(); - science.from_fits(path, 1); - width = science.get_width(); - height = science.get_height(); - - mask = RawImage(); - mask.from_fits(path, 2); - - variance = RawImage(); - variance.from_fits(path, 3); - - if (width != variance.get_width() or height != variance.get_height()) - throw std::runtime_error("Science and Variance layers are not the same size."); - if (width != mask.get_width() or height != mask.get_height()) - throw std::runtime_error("Science and Mask layers are not the same size."); -} - LayeredImage::LayeredImage(const RawImage& sci, const RawImage& var, const RawImage& msk, const PSF& psf) : psf(psf) { // Get the dimensions of the science layer and check for consistency with @@ -40,30 +19,6 @@ LayeredImage::LayeredImage(const RawImage& sci, const RawImage& var, const RawIm variance = var; } -LayeredImage::LayeredImage(unsigned w, unsigned h, float noise_stdev, float pixel_variance, double time, - const PSF& psf) - : LayeredImage(w, h, noise_stdev, pixel_variance, time, psf, -1) {} - -LayeredImage::LayeredImage(unsigned w, unsigned h, float noise_stdev, float pixel_variance, double time, - const PSF& psf, int seed) - : psf(psf), width(w), height(h) { - std::random_device r; - std::default_random_engine generator(r()); - if (seed >= 0) { - generator.seed(seed); - } - std::normal_distribution distrib(0.0, noise_stdev); - auto gaussian = [&distrib, &generator](float) { return distrib(generator); }; - - // Evaluate gaussian for each of HxW matrix, no input needed, - // ergo "nullary" expr. We have to eval the Nullary to be able to give - // an lvalue to the constructor. - search::Image tmp = search::Image::NullaryExpr(height, width, gaussian); - science = RawImage(tmp, time); - mask = RawImage(width, height, 0.0); - variance = RawImage(width, height, pixel_variance); -} - void LayeredImage::set_psf(const PSF& new_psf) { psf = new_psf; } void LayeredImage::convolve_given_psf(const PSF& given_psf) { @@ -169,35 +124,6 @@ void LayeredImage::subtract_template(RawImage& sub_template) { } } -void LayeredImage::save_layers(const std::string& filename) { - fitsfile* fptr; - int status = 0; - long naxes[2] = {0, 0}; - double obstime = science.get_obstime(); - - fits_create_file(&fptr, filename.c_str(), &status); - - // If we are unable to create the file, check if it already exists - // and, if so, delete it and retry the create. - if (status == 105) { - status = 0; - fits_open_file(&fptr, filename.c_str(), READWRITE, &status); - if (status == 0) { - fits_delete_file(fptr, &status); - fits_create_file(&fptr, filename.c_str(), &status); - } - } - - fits_create_img(fptr, SHORT_IMG, 0, naxes, &status); - fits_update_key(fptr, TDOUBLE, "MJD", &obstime, "[d] Generated Image time", &status); - fits_close_file(fptr, &status); - fits_report_error(stderr, status); - - science.append_to_fits(filename); - mask.append_to_fits(filename); - variance.append_to_fits(filename); -} - void LayeredImage::set_science(RawImage& im) { check_dims(im); science = im; @@ -272,10 +198,7 @@ static void layered_image_bindings(py::module& m) { using pf = search::PSF; py::class_
  • (m, "LayeredImage", pydocs::DOC_LayeredImage) - .def(py::init()) .def(py::init()) - .def(py::init()) - .def(py::init()) .def("contains", &li::contains, pydocs::DOC_LayeredImage_cointains) .def("get_science_pixel", &li::get_science_pixel, pydocs::DOC_LayeredImage_get_science_pixel) .def("get_variance_pixel", &li::get_variance_pixel, pydocs::DOC_LayeredImage_get_variance_pixel) @@ -300,7 +223,6 @@ static void layered_image_bindings(py::module& m) { .def("union_threshold_masking", &li::union_threshold_masking, pydocs::DOC_LayeredImage_union_threshold_masking) .def("sub_template", &li::subtract_template, pydocs::DOC_LayeredImage_sub_template) - .def("save_layers", &li::save_layers, pydocs::DOC_LayeredImage_save_layers) .def("get_science", &li::get_science, py::return_value_policy::reference_internal, pydocs::DOC_LayeredImage_get_science) .def("get_mask", &li::get_mask, py::return_value_policy::reference_internal, diff --git a/src/kbmod/search/layered_image.h b/src/kbmod/search/layered_image.h index a389679b8..ab0cc7990 100644 --- a/src/kbmod/search/layered_image.h +++ b/src/kbmod/search/layered_image.h @@ -2,7 +2,6 @@ #define LAYEREDIMAGE_H_ #include -#include #include #include #include @@ -15,12 +14,7 @@ namespace search { class LayeredImage { public: - explicit LayeredImage(std::string path, const PSF& psf); explicit LayeredImage(const RawImage& sci, const RawImage& var, const RawImage& msk, const PSF& psf); - explicit LayeredImage(unsigned width, unsigned height, float noise_stdev, float pixel_variance, - double time, const PSF& psf); - explicit LayeredImage(unsigned width, unsigned height, float noise_stdev, float pixel_variance, - double time, const PSF& psf, int seed); // Set an image specific point spread function. void set_psf(const PSF& psf); @@ -64,9 +58,6 @@ class LayeredImage { // Subtracts a template image from the science layer. void subtract_template(RawImage& sub_template); - // Saves the data in each later to a file. - void save_layers(const std::string& filename); - // Setter functions for the individual layers. void set_science(RawImage& im); void set_mask(RawImage& im); diff --git a/src/kbmod/search/pydocs/layered_image_docs.h b/src/kbmod/search/pydocs/layered_image_docs.h index 1158181ef..833a30c63 100644 --- a/src/kbmod/search/pydocs/layered_image_docs.h +++ b/src/kbmod/search/pydocs/layered_image_docs.h @@ -7,28 +7,12 @@ static const auto DOC_LayeredImage = R"doc( Parameters ---------- - path : `str`, optional - Path to a FITS file containing ``science``, ``mask`` and ``variance`` - extensions. - sci : `RawImage`, optional + sci : `RawImage` The `RawImage` for the science layer. - var : `RawImage`, optional + var : `RawImage` The `RawImage` for the cariance layer. - msk : `RawImage`, optional + msk : `RawImage` The `RawImage` for the mask layer. - width : `int`, optional - Width of the images (in pixels). - height : `int`, optional - Height of the images (in pixels). - std: `float`, optional - Standard deviation of the image. - var: `float`, optional - Variance of the pixels, assumed uniform. - time : `float`, optional - Observation time. - seed : `int`, optional - Pseudorandom number generator. - psf : `PSF` The PSF for the image. @@ -36,13 +20,6 @@ static const auto DOC_LayeredImage = R"doc( ------ RuntimeError: If the science, variance and mask are not the same size. - - Notes - ----- - Class can be instantiated from a file, or from 3 `RawImage` (science, mask, - variance) objects, or by providing the name, dimensions, standard deviation, - variance, observation time to which, additionally, a random seed generator can - be provided. PSF is always required. )doc"; static const auto DOC_LayeredImage_set_psf = R"doc( @@ -99,16 +76,6 @@ static const auto DOC_LayeredImage_sub_template = R"doc( Subtract given image template )doc"; -static const auto DOC_LayeredImage_save_layers = R"doc( - Saves the LayeredImage to a FITS file with layers for the science, - mask, and variance. - - Parameters - ---------- - filename : `str` - The full file path and name to use. - )doc"; - static const auto DOC_LayeredImage_get_science = R"doc( Returns the science layer raw_image. )doc"; diff --git a/src/kbmod/search/pydocs/raw_image_docs.h b/src/kbmod/search/pydocs/raw_image_docs.h index 09ad76190..3ea55b465 100644 --- a/src/kbmod/search/pydocs/raw_image_docs.h +++ b/src/kbmod/search/pydocs/raw_image_docs.h @@ -298,35 +298,6 @@ static const auto DOC_RawImage_convolve_cpu = R"doc( Point Spread Function. )doc"; -static const auto DOC_RawImage_load_fits = R"doc( - Load the image data from a FITS file. - - Parameters - ---------- - path : `str` - Path to an existing FITS file. - ext : `int`, optional - Extension index. Default: 0. - )doc"; - -static const auto DOC_RawImage_save_fits = R"doc( - Save the image to a FITS file. - - Parameters - ---------- - path : `str` - Path to the new file. - )doc"; - -static const auto DOC_RawImage_append_to_fits = R"doc( - Append the image as a layer in a FITS file. - - Parameters - ---------- - path : `str` - Path to an existing file. - )doc"; - } /* namespace pydocs */ #endif /* RAWIMAGE_DOCS */ diff --git a/src/kbmod/search/raw_image.cpp b/src/kbmod/search/raw_image.cpp index 739c576c8..4334061c8 100644 --- a/src/kbmod/search/raw_image.cpp +++ b/src/kbmod/search/raw_image.cpp @@ -332,133 +332,6 @@ bool RawImage::center_is_local_max(double flux_thresh, bool local_max) const { return center_val / sum >= flux_thresh; } -void RawImage::load_time_from_file(fitsfile* fptr) { - int mjd_status = 0; - - // Set object's obstime directly to -1 to indicate no time found. - obstime = -1.0; - - // Read image observation time, trying the MJD field first and DATE-AVG second. - // Ignore error if does not exist. - if (fits_read_key(fptr, TDOUBLE, "MJD", &obstime, NULL, &mjd_status)) { - // Reset the status flag and try with DATE-AVG. - mjd_status = 0; - if (fits_read_key(fptr, TDOUBLE, "DATE-AVG", &obstime, NULL, &mjd_status)) { - obstime = -1.0; - } - } -} - -// Load the image data from a specific layer of a FITS file. -void RawImage::from_fits(const std::string& file_path, int layer_num) { - // Open the file's header and read in the obstime and the dimensions. - fitsfile* fptr; - int status = 0; - int mjdStatus = 0; - int file_not_found; - int nullval = 0; - int anynull = 0; - - // Open the correct layer to extract the RawImage. - std::string layerPath = file_path + "[" + std::to_string(layer_num) + "]"; - if (fits_open_file(&fptr, layerPath.c_str(), READONLY, &status)) { - fits_report_error(stderr, status); - throw std::runtime_error("Could not open FITS file to read RawImage"); - } - - // Read image dimensions. - long dimensions[2]; - if (fits_read_keys_lng(fptr, "NAXIS", 1, 2, dimensions, &file_not_found, &status)) - fits_report_error(stderr, status); - width = dimensions[0]; - height = dimensions[1]; - - // Read in the image. - // array = std::vector(width * height); - image = Image(height, width); - if (fits_read_img(fptr, TFLOAT, 1, get_npixels(), &nullval, image.data(), &anynull, &status)) - fits_report_error(stderr, status); - - // Read image observation time, ignore error if does not exist - load_time_from_file(fptr); - if (fits_close_file(fptr, &status)) fits_report_error(stderr, status); - - // If we are reading from a sublayer and did not find a time, try the overall header. - if (obstime < 0.0) { - if (fits_open_file(&fptr, file_path.c_str(), READONLY, &status)) - throw std::runtime_error("Could not open FITS file to read RawImage"); - fits_read_key(fptr, TDOUBLE, "MJD", &obstime, NULL, &mjdStatus); - if (fits_close_file(fptr, &status)) fits_report_error(stderr, status); - } -} - -void RawImage::to_fits(const std::string& filename) { - fitsfile* fptr; - int status = 0; - long naxes[2] = {0, 0}; - - fits_create_file(&fptr, filename.c_str(), &status); - - // If we are unable to create the file, check if it already exists - // and, if so, delete it and retry the create. - if (status == 105) { - status = 0; - fits_open_file(&fptr, filename.c_str(), READWRITE, &status); - if (status == 0) { - fits_delete_file(fptr, &status); - fits_create_file(&fptr, filename.c_str(), &status); - } - } - - // Create the primary array image (32-bit float array) - long dimensions[2]; - dimensions[0] = width; - dimensions[1] = height; - fits_create_img(fptr, FLOAT_IMG, 2 /*naxis*/, dimensions, &status); - fits_report_error(stderr, status); - - /* Write the array of floats to the image */ - fits_write_img(fptr, TFLOAT, 1, get_npixels(), image.data(), &status); - fits_report_error(stderr, status); - - // Add the basic header data. - fits_update_key(fptr, TDOUBLE, "MJD", &obstime, "[d] Generated Image time", &status); - fits_report_error(stderr, status); - - fits_close_file(fptr, &status); - fits_report_error(stderr, status); -} - -void RawImage::append_to_fits(const std::string& filename) { - int status = 0; - fitsfile* f; - - // Check that we can open the file. - if (fits_open_file(&f, filename.c_str(), READWRITE, &status)) { - fits_report_error(stderr, status); - throw std::runtime_error("Unable to open FITS file for appending."); - } - - // This appends a layer (extension) if the file exists) - /* Create the primary array image (32-bit float array) */ - long dimensions[2]; - dimensions[0] = width; - dimensions[1] = height; - fits_create_img(f, FLOAT_IMG, 2 /*naxis*/, dimensions, &status); - fits_report_error(stderr, status); - - /* Write the array of floats to the image */ - fits_write_img(f, TFLOAT, 1, get_npixels(), image.data(), &status); - fits_report_error(stderr, status); - - // Save the image time in the header. - fits_update_key(f, TDOUBLE, "MJD", &obstime, "[d] Generated Image time", &status); - fits_report_error(stderr, status); - - fits_close_file(f, &status); - fits_report_error(stderr, status); -} - // it makes no sense to return RawImage here because there is no // obstime by definition of operation, but I guess it's out of // scope for this PR because it requires updating layered_image @@ -616,9 +489,6 @@ static void raw_image_bindings(py::module& m) { .def("apply_mask", &rie::apply_mask, pydocs::DOC_RawImage_apply_mask) .def("convolve_gpu", &rie::convolve, pydocs::DOC_RawImage_convolve_gpu) .def("convolve_cpu", &rie::convolve_cpu, pydocs::DOC_RawImage_convolve_cpu) - .def("save_fits", &rie::to_fits, pydocs::DOC_RawImage_save_fits) - .def("append_fits_extension", &rie::append_to_fits, pydocs::DOC_RawImage_append_to_fits) - .def("load_fits", &rie::from_fits, pydocs::DOC_RawImage_load_fits) // python interface adapters .def("create_stamp", [](rie& cls, float x, float y, int radius, bool keep_no_data) { diff --git a/src/kbmod/search/raw_image.h b/src/kbmod/search/raw_image.h index 43cec9d53..5c24a4382 100644 --- a/src/kbmod/search/raw_image.h +++ b/src/kbmod/search/raw_image.h @@ -2,7 +2,6 @@ #define RAWIMAGEEIGEN_H_ #include -#include #include #include #include @@ -110,18 +109,9 @@ class RawImage { bool center_is_local_max(double flux_thresh, bool local_max) const; - // Load the image data from a specific layer of a FITS file. - // Overwrites the current image data. - void from_fits(const std::string& file_path, int layer_num); - - // Save the RawImage to a file (single layer) or append the layer to an existing file. - void to_fits(const std::string& filename); - void append_to_fits(const std::string& filename); - virtual ~RawImage(){}; private: - void load_time_from_file(fitsfile* fptr); unsigned width; unsigned height; double obstime; diff --git a/tests/manual_test_fake_orbits.py b/tests/manual_test_fake_orbits.py index 9f0212cc1..1e02bb331 100644 --- a/tests/manual_test_fake_orbits.py +++ b/tests/manual_test_fake_orbits.py @@ -49,8 +49,7 @@ # Create the fake images. Set slightly different PSFs per image. images = [None] * num_images for i in range(num_images): - images[i] = kb.LayeredImage( - ("layered_test_%i" % i), + images[i] = make_fake_layered_image( width, height, 2.0, # noise_level diff --git a/tests/test_bilinear_interp.py b/tests/test_bilinear_interp.py index cfe1f20f3..be18e9965 100644 --- a/tests/test_bilinear_interp.py +++ b/tests/test_bilinear_interp.py @@ -2,7 +2,7 @@ import numpy as np -from kbmod.fake_data.fake_data_creator import add_fake_object +from kbmod.fake_data.fake_data_creator import add_fake_object, make_fake_layered_image import kbmod.search as kb @@ -12,7 +12,7 @@ def setUp(self): p = kb.PSF(0.05) self.images = [] for c in range(self.im_count): - im = kb.LayeredImage(10, 10, 0.0, 1.0, c, p) + im = make_fake_layered_image(10, 10, 0.0, 1.0, c, p) add_fake_object(im, 2 + c * 0.5 + 0.5, 2 + c * 0.5 + 0.5, 1, p) self.images.append(im) diff --git a/tests/test_image_stack.py b/tests/test_image_stack.py index 64706bf3d..1887e17b6 100644 --- a/tests/test_image_stack.py +++ b/tests/test_image_stack.py @@ -1,7 +1,7 @@ import tempfile import unittest -from kbmod.fake_data.fake_data_creator import add_fake_object +from kbmod.fake_data.fake_data_creator import add_fake_object, make_fake_layered_image from kbmod.search import * @@ -13,7 +13,7 @@ def setUp(self): self.p = [None] * self.num_images for i in range(self.num_images): self.p[i] = PSF(5.0 / float(2 * i + 1)) - self.images[i] = LayeredImage( + self.images[i] = make_fake_layered_image( 60, # dim_x = 60 pixels, 80, # dim_y = 80 pixels, 2.0, # noise_level diff --git a/tests/test_layered_image.py b/tests/test_layered_image.py index dbc1633dc..f0d511a34 100644 --- a/tests/test_layered_image.py +++ b/tests/test_layered_image.py @@ -4,7 +4,8 @@ from astropy.io import fits -from kbmod.fake_data.fake_data_creator import add_fake_object +from kbmod.data_interface import load_deccam_layered_image, save_deccam_layered_image +from kbmod.fake_data.fake_data_creator import add_fake_object, make_fake_layered_image from kbmod.search import * @@ -13,7 +14,7 @@ def setUp(self): self.p = PSF(1.0) # Create a fake layered image to use. - self.image = LayeredImage( + self.image = make_fake_layered_image( 60, # dim_x = 60 pixels, 80, # dim_y = 80 pixels, 2.0, # noise_level @@ -298,7 +299,7 @@ def test_grow_mask_mult(self): def test_psi_and_phi_image(self): p = PSF(0.00000001) # A point function. - img = LayeredImage(6, 5, 2.0, 4.0, 10.0, p) + img = make_fake_layered_image(6, 5, 2.0, 4.0, 10.0, p) # Create fake science and variance images. sci = img.get_science() @@ -357,7 +358,7 @@ def test_subtract_template(self): def test_read_write_files(self): with tempfile.TemporaryDirectory() as dir_name: - im1 = LayeredImage( + im1 = make_fake_layered_image( 15, # dim_x = 15 pixels, 20, # dim_y = 20 pixels, 2.0, # noise_level @@ -374,10 +375,10 @@ def test_read_write_files(self): # Save the test data. full_path = os.path.join(dir_name, "tmp_layered_test_data.fits") - im1.save_layers(full_path) + save_deccam_layered_image(im1, full_path) # Reload the test data and check that it matches. - im2 = LayeredImage(full_path, self.p) + im2 = load_deccam_layered_image(full_path, self.p) self.assertEqual(im1.get_height(), im2.get_height()) self.assertEqual(im1.get_width(), im2.get_width()) self.assertEqual(im1.get_npixels(), im2.get_npixels()) @@ -402,8 +403,8 @@ def test_overwrite_files(self): full_path = os.path.join(dir_name, "tmp_layered_test_data2.fits") # Save the test image. - img1 = LayeredImage(15, 20, 2.0, 4.0, 10.0, self.p) - img1.save_layers(full_path) + img1 = make_fake_layered_image(15, 20, 2.0, 4.0, 10.0, self.p) + save_deccam_layered_image(img1, full_path) with fits.open(full_path) as hdulist: self.assertEqual(len(hdulist), 4) self.assertEqual(hdulist[1].header["NAXIS1"], 15) @@ -411,13 +412,23 @@ def test_overwrite_files(self): # Save a new test image over the first and check # that it replaces it. - img2 = LayeredImage(25, 40, 2.0, 4.0, 10.0, self.p) - img2.save_layers(full_path) + img2 = make_fake_layered_image(25, 40, 2.0, 4.0, 10.0, self.p) + save_deccam_layered_image(img2, full_path) with fits.open(full_path) as hdulist2: self.assertEqual(len(hdulist2), 4) self.assertEqual(hdulist2[1].header["NAXIS1"], 25) self.assertEqual(hdulist2[1].header["NAXIS2"], 40) + # Check that we get an error if we set overwrite = False + self.assertRaises( + ValueError, + save_deccam_layered_image, + img1, + full_path, + None, + False, + ) + if __name__ == "__main__": unittest.main() diff --git a/tests/test_masking.py b/tests/test_masking.py index 1c31f2bc5..302d14f49 100644 --- a/tests/test_masking.py +++ b/tests/test_masking.py @@ -1,6 +1,7 @@ import unittest from kbmod.configuration import SearchConfiguration +from kbmod.fake_data.fake_data_creator import make_fake_layered_image from kbmod.masking import apply_mask_operations from kbmod.search import * @@ -19,7 +20,9 @@ def setUp(self): for i in range(self.img_count): time = i / self.img_count self.time_list.append(time) - im = LayeredImage(self.dim_x, self.dim_y, self.noise_level, self.variance, time, self.p, i) + im = make_fake_layered_image( + self.dim_x, self.dim_y, self.noise_level, self.variance, time, self.p, seed=i + ) self.imlist.append(im) self.stack = ImageStack(self.imlist) diff --git a/tests/test_psi_phi_array.py b/tests/test_psi_phi_array.py index c261e4edb..b75a0a463 100644 --- a/tests/test_psi_phi_array.py +++ b/tests/test_psi_phi_array.py @@ -2,6 +2,7 @@ import numpy as np +from kbmod.fake_data.fake_data_creator import make_fake_layered_image from kbmod.search import ( HAS_GPU, KB_NO_DATA, @@ -181,7 +182,7 @@ def test_fill_psi_phi_array_from_image_stack(self): images = [None] * num_times p = PSF(1.0) for i in range(num_times): - images[i] = LayeredImage( + images[i] = make_fake_layered_image( width, height, 2.0, # noise_level diff --git a/tests/test_raw_image.py b/tests/test_raw_image.py index 6d70434ca..2c7a9bc7a 100644 --- a/tests/test_raw_image.py +++ b/tests/test_raw_image.py @@ -390,45 +390,6 @@ def test_make_stamp(self): ) self.assertTrue((stamp.image == expected).all()) - def test_read_write_file(self): - """Test file writes and reads correctly.""" - img = RawImage(self.array, 10.0) - with tempfile.TemporaryDirectory() as dir_name: - full_path = os.path.join(dir_name, "tmp_RawImage.fits") - img.save_fits(full_path) - - # Reload the file. - img2 = RawImage(0, 0) - img2.load_fits(full_path, 0) - self.assertEqual(img2.width, self.width) - self.assertEqual(img2.height, self.height) - self.assertEqual(img2.npixels, self.width * self.height) - self.assertEqual(img2.obstime, 10.0) - self.assertTrue(np.allclose(img.image, img2.image, atol=1e-5)) - - def test_stack_file(self): - """Test multi-extension FITS files write and read correctly.""" - img = RawImage(self.array, 10.0) - with tempfile.TemporaryDirectory() as dir_name: - full_path = os.path.join(dir_name, "tmp_RawImage.fits") - img.save_fits(full_path) - - # Add 4 more layers at different times. - for i in range(1, 5): - img.obstime = 10.0 + 2.0 * i - img.append_fits_extension(full_path) - - # Check that we get 5 layers with the correct times. - img2 = RawImage(0, 0) - for i in range(5): - img2.load_fits(full_path, i) - - self.assertEqual(img2.width, self.width) - self.assertEqual(img2.height, self.height) - self.assertEqual(img2.npixels, self.width * self.height) - self.assertEqual(img2.obstime, 10.0 + 2.0 * i) - self.assertTrue(np.allclose(img.image, img2.image, 1e-5)) - def test_create_median_image(self): """Tests median image coaddition.""" arrs = np.array( diff --git a/tests/test_regression_test.py b/tests/test_regression_test.py index ad9c614c1..3f9996eb5 100644 --- a/tests/test_regression_test.py +++ b/tests/test_regression_test.py @@ -13,7 +13,8 @@ import numpy as np from astropy.io import fits -from kbmod.fake_data.fake_data_creator import add_fake_object +from kbmod.data_interface import save_deccam_layered_image +from kbmod.fake_data.fake_data_creator import add_fake_object, make_fake_layered_image from kbmod.file_utils import * from kbmod.result_list import ResultList from kbmod.run_search import SearchRunner @@ -174,7 +175,7 @@ def make_fake_ImageStack(times, trjs, psf_vals): t0 = times[0] dim_x = 512 dim_y = 1024 - noise_level = 8.0 + noise_level = 4.0 variance = noise_level**2 imlist = [] @@ -187,7 +188,7 @@ def make_fake_ImageStack(times, trjs, psf_vals): if i % 2 == 1: saved_time = 0.0 - img = LayeredImage(dim_x, dim_y, noise_level, variance, saved_time, p, i) + img = make_fake_layered_image(dim_x, dim_y, noise_level, variance, saved_time, p, seed=i) for trj in trjs: px = trj.x + time * trj.vx + 0.5 @@ -265,7 +266,7 @@ def save_fake_data(data_dir, stack, times, psf_vals, default_psf_val=1.0): os.remove(filename) # Save the file. - img.save_layers(filename) + save_deccam_layered_image(img, filename) # Open the file and insert fake WCS data. add_wcs_header_data(filename) diff --git a/tests/test_search.py b/tests/test_search.py index a60b7457e..19b2d1965 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -2,7 +2,7 @@ import numpy as np -from kbmod.fake_data.fake_data_creator import add_fake_object +from kbmod.fake_data.fake_data_creator import add_fake_object, make_fake_layered_image from kbmod.search import * from kbmod.trajectory_utils import make_trajectory @@ -56,7 +56,9 @@ def setUp(self): self.imlist = [] for i in range(self.img_count): time = i / self.img_count - im = LayeredImage(self.dim_x, self.dim_y, self.noise_level, self.variance, time, self.p, i) + im = make_fake_layered_image( + self.dim_x, self.dim_y, self.noise_level, self.variance, time, self.p, seed=i + ) add_fake_object( im, self.start_x + time * self.vxel + 0.5, @@ -236,7 +238,9 @@ def test_results_off_chip(self): imlist = [] for i in range(self.img_count): time = i / self.img_count - im = LayeredImage(self.dim_x, self.dim_y, self.noise_level, self.variance, time, self.p, i) + im = make_fake_layered_image( + self.dim_x, self.dim_y, self.noise_level, self.variance, time, self.p, seed=i + ) add_fake_object( im, trj.x + time * trj.vx + 0.5, @@ -480,7 +484,7 @@ def test_coadd_cpu_simple(self): imlist = [] for i in range(3): time = i - im = LayeredImage(3, 3, 0.1, 0.01, i, self.p, i) + im = make_fake_layered_image(3, 3, 0.1, 0.01, i, self.p, seed=i) # Overwrite the middle row to be i + 1. sci = im.get_science() @@ -536,7 +540,7 @@ def test_coadd_gpu_simple(self): imlist = [] for i in range(3): time = i - im = LayeredImage(3, 3, 0.1, 0.01, i, self.p, i) + im = make_fake_layered_image(3, 3, 0.1, 0.01, i, self.p, seed=i) # Overwrite the middle row to be i + 1. sci = im.get_science() diff --git a/tests/test_work_unit.py b/tests/test_work_unit.py index 9c3b753e0..a56f80589 100644 --- a/tests/test_work_unit.py +++ b/tests/test_work_unit.py @@ -9,6 +9,7 @@ import warnings from kbmod.configuration import SearchConfiguration +from kbmod.fake_data.fake_data_creator import make_fake_layered_image import kbmod.search as kb from kbmod.wcs_utils import make_fake_wcs, wcs_fits_equal from kbmod.work_unit import hdu_to_raw_image, raw_image_to_hdu, WorkUnit @@ -23,7 +24,7 @@ def setUp(self): self.p = [None] * self.num_images for i in range(self.num_images): self.p[i] = kb.PSF(5.0 / float(2 * i + 1)) - self.images[i] = kb.LayeredImage( + self.images[i] = make_fake_layered_image( self.width, self.height, 2.0, # noise_level From 1cc181adfba39c29d8ebc3c76f3e9746409622b7 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:46:10 -0500 Subject: [PATCH 2/3] Update CMakeLists.txt --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab1d56746..c3b78b726 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,6 @@ target_compile_options(search PRIVATE $<$: >) target_link_libraries(search PRIVATE - ${CFITSIO_LIBRARY} -lgomp ) From c1a6e203b59f014659c633be8386632e483ba168 Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Thu, 22 Feb 2024 12:30:51 -0500 Subject: [PATCH 3/3] Update data_interface.py --- src/kbmod/data_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kbmod/data_interface.py b/src/kbmod/data_interface.py index af008bde9..f51f7e06a 100644 --- a/src/kbmod/data_interface.py +++ b/src/kbmod/data_interface.py @@ -46,7 +46,7 @@ def load_deccam_layered_image(filename, psf): raise ValueError("Not enough extensions for legacy deccam format") # Extract the obstime trying from a few keys and a few extensions. - obstime = 0.0 + obstime = -1.0 if "MJD" in hdul[0].header: obstime = hdul[0].header["MJD"] elif "MJD" in hdul[1].header: