Focal Plane transformation routines


fp2ccd


SUMMARY:
transforms from focal plane to ccd coordinates
USAGE:
fp2ccd(float xfp, float yfp, float* xccd, float* yccd, float lambda, char
                cam[])


xfp, yfp        focal plane coordinates
xccd, yccd   ccd coordinates
lambda             wavelength
cam                    camera = LONG/SHORT
RETURN:
ccd chip #. 0 => position not on a ccd

Readcdf


SUMMARY:
Reads in camera definition file. Must be called before first call to fp2ccd, Getchipdat, ccd8, or mspos.
USAGE:
Readcd(char filename[])

filename  name of camera definition file (e.g. 'SITE')
RETURN:
0  if successful
1  if unsuccessful

Readcof


SUMMARY:
Reads in dewar offset file. Must be called before first call to fp2ccd, Getchipdat, ccd8, or mspos
USAGE:
Readcof(char filename[])

filename  name of dewar offset file
RETURN:
0  if successful
1  if unsuccessful

Getchipdat


SUMMARY:
Returns data on chip arrangement and dewar offset
USAGE:
Getchipdat(int* nc, int* xc, int* yc, float* scale, float* theta,
                          int* sx14, int* sy14, int* sx58, int* sy58)


nc          number of chips
xc,yc    
x,y coordinates of chip corners
scale     scale
theta
            dewar rotation angle
sx,y14          x,y coordinate sign for chips 1-4
sx,y58          x,y coordinate sign for chips 5-8
RETURN:
none

ccd8


SUMMARY:
Transforms pixel coordinates to accurate full 8-chip scale
USAGE:
ccd8( int chip, float xccd, float yccd, float* x8, float* y8)

chip        
chip
xccd,yccd   pixel coordinate on chip
x8,y8
                8-chip coordinates
RETURN:
0

mspos


SUMMARY:
Transforms pixel coordinates to mosaic coordinates
USAGE:
ccd8( int chip, float xccd, float yccd, float* x8, float* y8)

chip        
chip
xccd,yccd   pixel coordinate on chip
x8,y8
                 mosaic  coordinates
RETURN:
0




Other Routines


interpol


SUMMARY:
Interpolates within a 2-d data array. f_interpol interpolates in a float array, i_interpol in an integer array.
USAGE:
f_interpol(float** array, long naxes[], float xpos, float ypos)
i_interpol(int** array, long naxes[], float xpos, float ypos
)

naxes is an array containing axis dimensions
    
RETURN:
interpolated value



OpenCosParm


SUMMARY:
Opens COSMOS parameter files, looking in a series of locations:
  1. current directory
  2. $HOME/uparm
  3. $COSMOSHOME/uparm
USAGE:
OpenCosParm(char* program-name)
read in parameter values with ReadParm_x
                 
RETURN:
0 if successful
1 if unsuccessful


ReadParm

SUMMARY:
Reads parameter values from parameter file opened with OpenCosParm
USAGE:
ReadParm_s(char* paramname, char* paramval)  for strings
ReadParm_i(char* paramname, int* paramval)    for integers
Readparm_r(char* paramname, float* paramval) for reals

RETURN:
0 if successful
1 if unsuccessful


OpenFitsFile

SUMMARY:
Uses fitsio routines to open a fits file. Returns a file pointer, and a data structure with file information.
USAGE:
OpenFitsFile(char* filename, fitsfile* fileptr,
            
fitsdef* fitsdata);

fitsdef containes the following elements:
int   naxis       number of axes
int   naxes[n]    size of each axis
int   bitpix          bits/pixel
int   binning     binning
int   subrstr     subraster? 1=yes 0=no
int   subx[2]    
x subraster indices
int   suby[2]     y subraster indices
int   overscan    number of overscan columns
int   biaslins    number of bias rows
char  dewarori[2]   dewar orientation Nor NS
int   nshuffle          # of pixels of shuffle 0 if not n&s mode
float ranod                ra nod, in arc sec
float decnod             dec nod, in arc sec

RETURN:
0 if successful
1 if unsuccessful

ReadObsDef

SUMMARY:
Reads data from an observation definition file and returns in a data structure
USAGE:
ReadobsDef(char* obsdeffilename, obsdef* obssdata);

obsdef containes the following elements:
int   gr_order      number of axes
int   gr_angle     size of each axis
float temp                temperature
char  grating[20]  grating
char  dewoff[80]  
dewar offset filename
char  camera[6]    LONG or SHORT
char  mode[7]       DIRECT or SPEC
char  mask[80]     SMF filename
char  dewar[5]         SITE
int   nshuffle          # of pixels of shuffle 0 if not n&s mode
float ranod                ra nod, in arc sec
float decnod             dec nod, in arc sec

RETURN:
0 if successful
1 if unsuccessful