cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Macros | Functions | Variables
save_fits.cpp File Reference
#include "cddefines.h"
#include "save.h"
#include "cddrive.h"
#include "grid.h"
#include "rfield.h"
#include "prt.h"
#include "input.h"
#include "version.h"
#include "service.h"
Include dependency graph for save_fits.cpp:

Go to the source code of this file.

Macros

#define HtoNL(A)
 
#define ByteSwap5(x)   ByteSwap((unsigned char *) &x,sizeof(x))
 
#define LOG2LINEAR   0
 

Functions

STATIC void ByteSwap (unsigned char *b, int n)
 
STATIC void punchFITS_PrimaryHeader (bool lgAddModel, bool lgNormalize)
 
STATIC void punchFITS_ParamHeader (long nintparm, long naddparm)
 
STATIC void punchFITS_ParamData (char **paramNames, long *paramMethods, realnum **paramRange, realnum **paramData, long nintparm, long naddparm, long *numParamValues)
 
STATIC void punchFITS_EnergyHeader (long numEnergies)
 
STATIC void punchFITS_EnergyData (long ipLo, long ipHi)
 
STATIC void punchFITS_SpectraHeader (bool lgAdditiveModel, bool lgNormalize, long nintparm, long naddparm, long totNumModels, long numEnergies)
 
STATIC void punchFITS_SpectraData (realnum **interpParameters, multi_arr< realnum, 3 > &theSpectrum, int option, long totNumModels, long ipLo, long ipHi, long ipNorm, long nintparm, long naddparm)
 
STATIC void punchFITS_GenericHeader ()
 
STATIC void punchFITS_GenericData ()
 
STATIC void writeCloudyDetails (void)
 
STATIC long addComment (const string &CommentToAdd)
 
STATIC long addKeyword_txt (const char *theKeyword, const void *theValue, const char *theComment, long Str_Or_Log)
 
STATIC long addKeyword_num (const char *theKeyword, long theValue, const char *theComment)
 
string int2string (int val)
 
void saveFITSfile (FILE *ioPUN, int option, realnum Elo, realnum Ehi, realnum Enorm)
 

Variables

static const int RECORDSIZE = 2880
 
static const int LINESIZE = 80
 
static FILE * ioFITS_OUTPUT
 
static long bytesAdded = 0
 
static long bitpix = 8
 
static long pcount = 0
 
static long gcount = 1
 
static long maxParamValues = 0
 
const char ModelUnits [2][17] = {"'dimensionless '", "'photons/cm^2/s'" }
 

Macro Definition Documentation

#define ByteSwap5 (   x)    ByteSwap((unsigned char *) &x,sizeof(x))
#define HtoNL (   A)
Value:
((((A) & 0xff000000) >> 24) | \
(((A) & 0x00ff0000) >> 8) | \
(((A) & 0x0000ff00) << 8) | \
(((A) & 0x000000ff) << 24))

Definition at line 27 of file save_fits.cpp.

Referenced by punchFITS_ParamData().

#define LOG2LINEAR   0

Function Documentation

long addComment ( const string &  CommentToAdd)

Definition at line 782 of file save_fits.cpp.

References ASSERT, DEBUG_ENTRY, fprintf(), ioFITS_OUTPUT, and LINESIZE.

Referenced by writeCloudyDetails().

Here is the call graph for this function:

STATIC long addKeyword_num ( const char *  theKeyword,
long  theValue,
const char *  theComment 
)

Definition at line 765 of file save_fits.cpp.

References ASSERT, DEBUG_ENTRY, fprintf(), ioFITS_OUTPUT, and LINESIZE.

Referenced by punchFITS_EnergyHeader(), punchFITS_GenericHeader(), punchFITS_ParamHeader(), punchFITS_PrimaryHeader(), and punchFITS_SpectraHeader().

Here is the call graph for this function:

STATIC long addKeyword_txt ( const char *  theKeyword,
const void *  theValue,
const char *  theComment,
long  Str_Or_Log 
)

Definition at line 734 of file save_fits.cpp.

References ASSERT, DEBUG_ENTRY, fprintf(), ioFITS_OUTPUT, and LINESIZE.

Referenced by punchFITS_EnergyHeader(), punchFITS_GenericHeader(), punchFITS_ParamHeader(), punchFITS_PrimaryHeader(), and punchFITS_SpectraHeader().

Here is the call graph for this function:

STATIC void ByteSwap ( unsigned char *  b,
int  n 
)

Definition at line 43 of file save_fits.cpp.

string int2string ( int  val)
inline

Definition at line 804 of file save_fits.cpp.

References DEBUG_ENTRY.

Referenced by punchFITS_ParamHeader(), and punchFITS_SpectraHeader().

STATIC void punchFITS_EnergyData ( long  ipLo,
long  ipHi 
)

Definition at line 425 of file save_fits.cpp.

References t_mesh::anumax(), t_mesh::anumin(), bytesAdded, ByteSwap5, DEBUG_ENTRY, ioFITS_OUTPUT, RECORDSIZE, and rfield.

Referenced by saveFITSfile().

Here is the call graph for this function:

STATIC void punchFITS_EnergyHeader ( long  numEnergies)

Definition at line 382 of file save_fits.cpp.

References addKeyword_num(), addKeyword_txt(), ASSERT, bitpix, bytesAdded, DEBUG_ENTRY, fprintf(), gcount, ioFITS_OUTPUT, LINESIZE, pcount, and RECORDSIZE.

Referenced by saveFITSfile().

Here is the call graph for this function:

STATIC void punchFITS_GenericData ( )

Definition at line 645 of file save_fits.cpp.

References t_mesh::anu(), bytesAdded, ByteSwap5, cdSPEC2(), DEBUG_ENTRY, get_ptr(), ioFITS_OUTPUT, t_rfield::nflux, RECORDSIZE, and rfield.

Referenced by saveFITSfile().

Here is the call graph for this function:

STATIC void punchFITS_GenericHeader ( )

Definition at line 602 of file save_fits.cpp.

References addKeyword_num(), addKeyword_txt(), ASSERT, bitpix, bytesAdded, DEBUG_ENTRY, fprintf(), gcount, ioFITS_OUTPUT, LINESIZE, t_rfield::nflux, pcount, RECORDSIZE, and rfield.

Referenced by saveFITSfile().

Here is the call graph for this function:

STATIC void punchFITS_ParamData ( char **  paramNames,
long *  paramMethods,
realnum **  paramRange,
realnum **  paramData,
long  nintparm,
long  naddparm,
long *  numParamValues 
)

Definition at line 280 of file save_fits.cpp.

References ASSERT, bytesAdded, ByteSwap5, DEBUG_ENTRY, exp10(), fprintf(), HtoNL, ioFITS_OUTPUT, LIMPAR, maxParamValues, and RECORDSIZE.

Referenced by saveFITSfile().

Here is the call graph for this function:

STATIC void punchFITS_ParamHeader ( long  nintparm,
long  naddparm 
)

Definition at line 210 of file save_fits.cpp.

References addKeyword_num(), addKeyword_txt(), ASSERT, bitpix, bytesAdded, DEBUG_ENTRY, fprintf(), gcount, int2string(), ioFITS_OUTPUT, LIMPAR, LINESIZE, maxParamValues, pcount, and RECORDSIZE.

Referenced by saveFITSfile().

Here is the call graph for this function:

STATIC void punchFITS_PrimaryHeader ( bool  lgAddModel,
bool  lgNormalize 
)

Definition at line 162 of file save_fits.cpp.

References addKeyword_num(), addKeyword_txt(), ASSERT, bitpix, bytesAdded, DEBUG_ENTRY, fixit, fprintf(), ioFITS_OUTPUT, LINESIZE, ModelUnits, RECORDSIZE, and writeCloudyDetails().

Referenced by saveFITSfile().

Here is the call graph for this function:

STATIC void punchFITS_SpectraData ( realnum **  interpParameters,
multi_arr< realnum, 3 > &  theSpectrum,
int  option,
long  totNumModels,
long  ipLo,
long  ipHi,
long  ipNorm,
long  nintparm,
long  naddparm 
)

Definition at line 534 of file save_fits.cpp.

References ASSERT, bytesAdded, ByteSwap5, cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), ioFITS_OUTPUT, ioQQQ, LIMPAR, RECORDSIZE, rfield, and t_mesh::widflx().

Referenced by saveFITSfile().

Here is the call graph for this function:

STATIC void punchFITS_SpectraHeader ( bool  lgAdditiveModel,
bool  lgNormalize,
long  nintparm,
long  naddparm,
long  totNumModels,
long  numEnergies 
)

Definition at line 450 of file save_fits.cpp.

References addKeyword_num(), addKeyword_txt(), ASSERT, bitpix, bytesAdded, DEBUG_ENTRY, fprintf(), gcount, int2string(), ioFITS_OUTPUT, LIMPAR, LINESIZE, ModelUnits, pcount, and RECORDSIZE.

Referenced by saveFITSfile().

Here is the call graph for this function:

void saveFITSfile ( FILE *  io,
int  option,
realnum  Elo = 0.f,
realnum  Ehi = 0.f,
realnum  Enorm = 0.f 
)
Save spectra to a FITS compatible file. 
Parameters
iothe file we will write to
optionchoose type of spectrum to save
Eloif set, lower bound of spectrum to save
Ehiif set, upper bound of spectrum to save
Enormif set, normalize spectrum to 1 at this frequency

Definition at line 86 of file save_fits.cpp.

References t_mesh::anu(), ASSERT, DEBUG_ENTRY, fprintf(), grid, GridRetrieveXSPECData(), t_grid::interpParameters, ioFITS_OUTPUT, t_mesh::ipointC(), t_grid::lgGridDone, MAX2, maxParamValues, t_grid::naddparm, t_rfield::nflux, t_grid::nintparm, t_optimize::nOptimiz, NUM_OUTPUT_TYPES, t_grid::numParamValues, open_data(), optimize, t_grid::paramData, t_grid::paramMethods, t_grid::paramNames, t_grid::paramRange, punchFITS_EnergyData(), punchFITS_EnergyHeader(), punchFITS_GenericData(), punchFITS_GenericHeader(), punchFITS_ParamData(), punchFITS_ParamHeader(), punchFITS_PrimaryHeader(), punchFITS_SpectraData(), punchFITS_SpectraHeader(), rfield, t_grid::Spectra, t_grid::totNumModels, and wr_block().

Referenced by process_output(), and SaveDo().

Here is the call graph for this function:

STATIC void writeCloudyDetails ( void  )

Definition at line 672 of file save_fits.cpp.

References addComment(), bytesAdded, t_input::chCardSav, t_input::InclLevel, input, Singleton< t_version >::Inst(), t_prt::lgPrintTime, t_input::nSave, and prt.

Referenced by punchFITS_PrimaryHeader().

Here is the call graph for this function:

Variable Documentation

long bitpix = 8
static
long bytesAdded = 0
static
long gcount = 1
static
FILE* ioFITS_OUTPUT
static
const int LINESIZE = 80
static
long maxParamValues = 0
static

Definition at line 64 of file save_fits.cpp.

Referenced by punchFITS_ParamData(), punchFITS_ParamHeader(), and saveFITSfile().

const char ModelUnits[2][17] = {"'dimensionless '", "'photons/cm^2/s'" }

Definition at line 65 of file save_fits.cpp.

Referenced by punchFITS_PrimaryHeader(), and punchFITS_SpectraHeader().

long pcount = 0
static
const int RECORDSIZE = 2880
static