casacore
Loading...
Searching...
No Matches
BasicFITS.h
Go to the documentation of this file.
1// # FITS.h: Transform a Casacore Array to or from a FITS disk file.
2// # Copyright (C) 1993,1994,1995,1999
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef FITS_BASICFITS_H
27#define FITS_BASICFITS_H
28
29#include <casacore/casa/aips.h>
30// # Would like to forward declare
31#include <casacore/casa/Arrays/Vector.h>
32#include <map>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36class String; // Forward declarations
37
38//<summary> read a FITS file from a Casacore array</summary>
39// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
40// </reviewed>
41//<linkfrom anchor=ReadFITS classes=FitsInput>
42// <here>ReadFITS</here> Casacore interface routines.
43//</linkfrom>
44
45//<motivation>
46// Quick and dirty interface to the FITS classes for turning Casacore
47// arrays into FITS files and back. N.B. this will have many more features
48// in the future, also some files should be renamed since we now have
49// FITS.h and fits.h.
50//</motivation>
51//<synopsis>
52// Read FITS from a file into a Casacore Array. Sets "ok" to False if there
53// is any problem. We only deal with data in the primary data array.
54// If ReadFITS fails, the state of array is undefined. Trailing
55// degenerate (length==1) axes are NOT removed. If desired, you may do
56// this yourself with the nonDegenerate array member function.
57// If ok is false, ErrorMessage will contain an information error message.
58// If necessary, the data is converted from whatever type it is stored as
59// to Float. BSCALE and BZERO are applied. Blanks are not handled.
60//
61// If unitName is non-null, the string it points to is filled with the FITS
62// BUNIT keyword. If axisNames is name of the axes (CTYPEn).
63// If refPixel is non-null, it is set to the reference pixel of the FITS file
64// (CRPIX). Similarly refLocation is set to the position
65// (image coordinates) of the reference pixel (CRVALn) and delta is
66// set to the increment along each axis (CDELTn). All
67// the vectors are resized if necessary. Note that FITS pixel indexing is
68// one-based, Casacore is 0-based, this correction is made. unitName and
69// axisNames have trailing blanks (a FITS "feature") removed.
70//
71// If "keywords" is non-null, the integral and floating point keywords
72// (excluding NAXIS*, BSCALE, BZERO) are read into keywords. Case is not
73// changed.
74//</synopsis>
75//
76// If objectName is non-null, the string it points to is set to the
77// value of the FITS OBJECT keyword.
78//
79//<note role=caution> This will only work properly on an IEEE big-endian
80// machine at the moment.
81//</note>
82
83//<group name=ReadFITS>
84// blabla
85Array<Float> ReadFITS(const char *FileName, Bool &ok, String &ErrorMessage, String *unitName = 0,
86 Vector<String> *axisNames = 0, Vector<Float> *refPixel = 0,
87 Vector<Float> *refLocation = 0, Vector<Float> *delta = 0,
88 std::map<String, Double> *keywords = 0, String *objectName = 0);
89//</group>
90
91//<summary> write a FITS file to a Casacore array</summary>
92// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
93// </reviewed>
94//<linkfrom anchor=WriteFITS classes=FitsOutput>
95// <here>WriteFITS</here> Casacore interface routines.
96//</linkfrom>
97//<synopsis>
98// Write a FITS file from a Casacore Array. Returns False if there is any
99// proglem. The data is written into the primary data array, and the data
100// is written in floating point (BITPIX=-32). If the operation fails,
101// ErrorMessage will contain an informative error. At the moment this
102// probably isn't bulletproof enough at finding errors on output.
103//
104// If any of unitName, axisNames, refPixel, refLocation, or delta are
105// non-null, the corresponding FITS keywords (BUNIT, CTYPEn, CRPIXn,
106// CRVALn, CDELTn) are set. CRVALn is corrected for the difference in
107// addressing between FITS and Casacore (1 vs. 0). If a Vector pointer
108// is non-null, then that vector must be the correct length.
109//
110// If keywords is non-null, the contents are written out as FITS keywords.
111// The names are upper-cased and truncated to 8 characters (yuck). No other
112// validation is done (e.g. that SIMPLE or NAXIS is not in the map).
113//
114// If objectName is non-null, the OBJECT keyword is set.
115//
116// BITPIX can presently be set to -32 or 16 only. When BITPIX is 16 it will
117// write BSCALE and BZERO into the FITS file. If minPix is greater than maxPix
118// the minimum and maximum pixel values will be determined from the array,
119// otherwise the supplied values will be used and pixels outside that range
120// will be truncated to the minimum and maximum pixel values (note that this
121// truncation does not occur for BITPIX=-32).
122//</synopsis>
123
124//<group name=WriteFITS>
125// blabla
126Bool WriteFITS(const char *FileName, const Array<Float> &array, String &ErrorMessage,
127 const char *unitName = 0, const Vector<String> *axisNames = 0,
128 const Vector<Float> *refPixel = 0, const Vector<Float> *refLocation = 0,
129 const Vector<Float> *delta = 0, const std::map<String, Double> *keywords = 0,
130 const char *objectName = 0, Int BITPIX = -32, Float minPix = 1.0,
131 Float maxPix = -1.0);
132//</group>
133
134} // namespace casacore
135
136#endif
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
T * array
The actual storage.
Definition Block.h:689
float Float
Definition aipstype.h:52
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Array< Float > ReadFITS(const char *FileName, Bool &ok, String &ErrorMessage, String *unitName=0, Vector< String > *axisNames=0, Vector< Float > *refPixel=0, Vector< Float > *refLocation=0, Vector< Float > *delta=0, std::map< String, Double > *keywords=0, String *objectName=0)
blabla
write a FITS file to a Casacore array
Definition BasicFITS.h:125
Bool WriteFITS(const char *FileName, const Array< Float > &array, String &ErrorMessage, const char *unitName=0, const Vector< String > *axisNames=0, const Vector< Float > *refPixel=0, const Vector< Float > *refLocation=0, const Vector< Float > *delta=0, const std::map< String, Double > *keywords=0, const char *objectName=0, Int BITPIX=-32, Float minPix=1.0, Float maxPix=-1.0)
blabla