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
84//<group name=ReadFITS>
85// blabla
86Array<Float> ReadFITS(const char *FileName, Bool &ok, String &ErrorMessage,
87 String *unitName = 0,
88 Vector<String> *axisNames = 0,
89 Vector<Float> *refPixel = 0,
90 Vector<Float> *refLocation = 0,
91 Vector<Float> *delta = 0,
92 std::map<String, Double> *keywords = 0,
93 String *objectName = 0);
94//</group>
95
96//<summary> write a FITS file to a Casacore array</summary>
97// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
98// </reviewed>
99//<linkfrom anchor=WriteFITS classes=FitsOutput>
100// <here>WriteFITS</here> Casacore interface routines.
101//</linkfrom>
102//<synopsis>
103// Write a FITS file from a Casacore Array. Returns False if there is any
104// proglem. The data is written into the primary data array, and the data
105// is written in floating point (BITPIX=-32). If the operation fails,
106// ErrorMessage will contain an informative error. At the moment this
107// probably isn't bulletproof enough at finding errors on output.
108//
109// If any of unitName, axisNames, refPixel, refLocation, or delta are
110// non-null, the corresponding FITS keywords (BUNIT, CTYPEn, CRPIXn,
111// CRVALn, CDELTn) are set. CRVALn is corrected for the difference in
112// addressing between FITS and Casacore (1 vs. 0). If a Vector pointer
113// is non-null, then that vector must be the correct length.
114//
115// If keywords is non-null, the contents are written out as FITS keywords.
116// The names are upper-cased and truncated to 8 characters (yuck). No other
117// validation is done (e.g. that SIMPLE or NAXIS is not in the map).
118//
119// If objectName is non-null, the OBJECT keyword is set.
120//
121// BITPIX can presently be set to -32 or 16 only. When BITPIX is 16 it will
122// write BSCALE and BZERO into the FITS file. If minPix is greater than maxPix
123// the minimum and maximum pixel values will be determined from the array,
124// otherwise the supplied values will be used and pixels outside that range
125// will be truncated to the minimum and maximum pixel values (note that this
126// truncation does not occur for BITPIX=-32).
127//</synopsis>
128
129//<group name=WriteFITS>
130// blabla
131Bool WriteFITS(const char *FileName, const Array<Float> &array,
132 String &ErrorMessage,
133 const char *unitName = 0,
134 const Vector<String> *axisNames = 0,
135 const Vector<Float> *refPixel = 0,
136 const Vector<Float> *refLocation = 0,
137 const Vector<Float> *delta = 0,
138 const std::map<String, Double> *keywords = 0,
139 const char *objectName = 0,
140 Int BITPIX=-32,
141 Float minPix = 1.0, Float maxPix = -1.0);
142//</group>
143
144} //# NAMESPACE CASACORE - END
145
146#endif
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition ExprNode.h:1933
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:130
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