int ardlib_initialize (char *mission, char *obsinfo_file);
Initialize the library for a particular mission. The second
parameter specifies the name of a fits file containing observation
specific information, e.g., an events file. Zero is returned upon
success, or -1 upon error.
The library may be used for only one mission at a time. To use it
with another mission within the same program instance, close the
library with the ardlib_finalize function and then re-open it
with the specified mission.
Supported missions include: "CHANDRA".
int ardlib_finalize (void);
De-initialize the library and free any allocated memory acquired by
the library. If for some reason this function fails, it will return
-1, otherwise it returns 0.
Ardlib_Det_QE_Type *ardlib_open_det_qe (char *detsubsys);
Returns a detector QE object for the specified detector subsystem, or
NULL upon failure. The ardlib_close_det_qe function
must be used to delete the returned object.
int ardlib_close_det_qe (Ardlib_Det_QE_Type *q);
Deletes the memory associated with a Ardlib_Det_QE_Type
object. If for some reason this function fails, -1 will be
returned, otherwise it returns 0.
int ardlib_compute_det_qe (Ardlib_Det_QE_Type *q,
double x, double y,
float *energies, unsigned int num,
float *qes);
This function computes the quantum efficiency at the pixel position
(x,y) for the list of num energies and returns
the results via the last parameter (qes), which is assumed to
point to num floats. The function returns 0 upon success, or
-1 upon error.
Ardlib_Mirror_EA_Type *ardlib_open_mirror_ea (char *mirror);
Acquire a pointer to the specified mirror. The value of the mirror
parameter will vary with the mission and may include qualifiers.
The function returns 0 upon success, or -1 otherwise.
int ardlib_close_mirror_ea (Ardlib_Mirror_EA_Type *);
Delete the specified mirror effective-area object. If the object
cannot be deleted, -1 will be returned, otherwise it will return 0.
int ardlib_compute_mirror_ea (Ardlib_Mirror_EA_Type *object,
double theta, double phi,
float *energies,
unsigned int num_energies,
float *eff_areas);
Computes the mirror effective areas for the specified object at the
specified off-axis angle and list of energies. The off-axis angle
is specified by the polar angle theta and azimuthal angle
phi. The function returns 0 upon success, or -1 otherwise.
Ardlib_Grating_Eff_Type *
ardlib_open_grating_eff (char *grating, int order);
Acquire a pointer to the specified grating and diffraction order.
Upon failure, NULL will be returned. After the pointer is no
longer needed, it must be freed via a call to
ardlib_close_grating_eff.
int ardlib_close_grating_eff (Ardlib_Grating_Eff_Type *g);
Delete the specified grating object. Upon failure, -1 will be
returned, otherwise 0 will be returned.
int ardlib_compute_grating_eff (Ardlib_Grating_Eff_Type *g,
float *energies,
unsigned int num,
float *eff);
This function computes num grating efficiencies for the
grating object g and energy list energies. The
efficiencies are returned via the pointer eff, which is
assumed to contain enough space for num values.
Upon success, 0 will be returned, otherwise -1 will be returned to
indicate an error.
Ardlib_Det_BadPix_Type *ardlib_open_det_badpix (char *det);
This function returns a pointer to a bad-pixel object for the
specified detector, which may include qualifiers. Upon error, the
function will return NULL. When the pointer is no longer
needed, it should be freed via the ardlib_close_det_badpix
function.
int ardlib_close_det_badpix (Ardlib_Det_BadPix_Type *b);
Delete the specified bad-pixel object.
int ardlib_det_is_badpix (Ardlib_Det_BadPix_Type *b,
double x, double y);
This function may be used to determine whether or not the detector
represented by the bad-pixel object b contains a bad-pixel
at (x, y). It returns 1 is the pixel is bad, 0 if
good, or -1 if an error occurs.
int Ardlib_Version;
This variable contains the ardlib version number encoded as an
integer.
char *ardlib_get_version_string (void);
Returns a string representation of the ardlib version number.
int ardlib_set_parfile (char *file);
This function allows the application to specify an alternative
parameter file to be used by the library. If this function is used,
then it must be called before the library is initialized via the
ardlib_initialize function. It returns 0 upon success, or -1
upon failure.
int ardlib_set_verbosity (int verbose);
This function may be used to set the verbosity level for ardlib
messages.
int ardlib_is_option_present (char *instrum,
char *qualifier_name,
char **valuep);
This function may be used to determine whether or not an instrument
specification contains a specified qualifier. If the qualifier is
present, the function returns 1, otherwise it returns 0 if the
qualifier is not present. If an error occurs, the function will
return -1. If the pointer valuep is non-NULL and the
specified qualifier exists, then the qualifier's value will be
returned via valuep. It is up to the caller to free this
pointer.
int ardlib_write_history (int (*callback)(void *, char *),
void *client_data);
This function writes out the ardlib history records using the
specified callback function. It returns 0 upon success, or -1
upon error. The callback function is passed client_data as
its first argument and an ardlib history record as is second. The
callback function is assumed to return 0 if successful, or
-1 upon failure. If callback is NULL, then the history
records will be written to a file represented by
(FILE*)client_data. If in addition client_data is
NULL, the history will be written to stdout.
As an example of the use of the ardlib_write_history function,
suppose that one simply wants to write the history to a fits file
represented by a dmBlock pointer. The following code fragment
illustrates how this may be accomplished:
static int dmblock_callback (void *b, char *str)
{
if (0 == dmBlockWriteComment ((dmBlock *) b, dmHISTORY, str))
return -1;
return 0;
}
int main (int argc, char **argv)
{
dmBlock *b;
.
.
(void) ardlib_write_history (dmblock_callback, (void *) b);
.
.
}