Main Page | Class List | Directories | File List | Class Members | File Members

fitsoutput.c File Reference

Writing data into FITS files. More...

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdarg.h>
#include "fitsoutput.h"
#include "logfile.h"
#include "fitsio.h"
#include "iniconfig.h"
#include "background.h"
#include "acquisition.h"
#include "telescope.h"
#include "ccu.h"
#include "gui.h"
#include "sid.h"
#include <gsl/gsl_statistics.h>
#include <gsl/gsl_sort.h>

Functions

void fitsoutput_error (char *msg)
 is called whenever something went wrong in fitsoutput.c
void fitsfile_compile_ccd ()
 Calculates the astrometric coefficients to be writen into the fits file.
int init_fitsfile ()
 Open a fitsfile and set header keywords.
int fitsfile_shutter_opening ()
 called when the shutter is just opening
int fitsfile_shutter_closing ()
 called when the shutter is just closing
int fitsfile_create_image (int xsize, int ysize)
 creates an image to be written into the fits file. And write the header keywords.
int init_fitsfile_noheader (int xsize, int ysize)
 Open a fitsfile and without setting header keywords.
void fitsoutput_postproc (char *filename)
 postprocesses the fits file
void fitsoutput_stat ()
 calculates the averiage value and the standard deviation of the overscan region of the image.
int close_fitsfile (void)
 Closes a fitsfile.
void write_fitsfile (unsigned char *data, int size)
 writes data into a fitsfile
fitsoutput_status_struct fitsoutput_get_status (void)
 returns a structure describing the current status of fitsoutput.
void fitsoutput_set_dap (struct dap_struct dap)
 sets the Data Associated Parameters.
dap_struct fitsoutput_get_dap (void)
 returns a structure describing the current Data Associated Parameters.
char * fitsoutput_get_filename (void)
 returns the current filename.
void fitsoutput_set_ccd (struct ccd_struct ccd)
 sets the CCD parameters.

Variables

fitsfile * fitsoutput_file
int ii
int jj
volatile int fitsoutput_is_open = 0
long fitsoutput_fpixel = 1
long fitsoutput_naxis = 2
long fitsoutput_nelements
long fitsoutput_naxes [2]
unsigned short * fitsoutput_data
int status
fitsoutput_status_struct fitsoutput_status
ccd_compiled_struct fitsoutput_ccd_compiled
int fitsoutput_filenum
char fitsoutput_filename [1000]
fitsoutput_devices_struct fitsoutput_shutter_opened
fitsoutput_devices_struct fitsoutput_shutter_closed
int fitsoutput_simlation_mode = 0
volatile int fitsoutput_write_file = 1


Detailed Description

Writing data into FITS files.

Copyright (C) 2001-2003 Dirk Huenniger (dhun@astro.uni-bonn.de)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.


Function Documentation

int close_fitsfile void   ) 
 

Closes a fitsfile.

Returns:
int the fitsio status code of the fitsfile closed or 0 if the file was not open
This function closes a fitsfile. It returns 0 if the fitsfile is not open.

void fitsfile_compile_ccd  ) 
 

Calculates the astrometric coefficients to be writen into the fits file.

Returns:
void
This function calculates the astrometric coefficients to be writen into the fits file

int fitsfile_create_image int  xsize,
int  ysize
 

creates an image to be written into the fits file. And write the header keywords.

Returns:
int status code This function creates an image to be written into the fits file. Futhermore it write all header keywords.

int fitsfile_shutter_closing  ) 
 

called when the shutter is just closing

Returns:
int 0
This functión is called whenever the shutter is just closing. It stores some parameters of the system to be writting into the fits file later on.

int fitsfile_shutter_opening  ) 
 

called when the shutter is just opening

Returns:
int 0
This functión is called whenever the shutter is just opening. It stores some parameters of the system to be writting into the fits file later on.

void fitsoutput_error char *  msg  ) 
 

is called whenever something went wrong in fitsoutput.c

Parameters:
msg a string describing what went wrong
Returns:
void
This function is called whenever something went wrong in fitsoutput.c. It writes a message to stderr and to the logfile

struct dap_struct fitsoutput_get_dap void   ) 
 

returns a structure describing the current Data Associated Parameters.

Returns:
dap_struct a struct descibing the current Data Associated Parameters
This function returns a structure describing the current Data Associated Parameters.

char* fitsoutput_get_filename void   ) 
 

returns the current filename.

Returns:
char* a string containing the current filename
This function returns the current filename.

struct fitsoutput_status_struct fitsoutput_get_status void   ) 
 

returns a structure describing the current status of fitsoutput.

Returns:
fitsoutput_status_struct a struct descibing the current status of fitsoutput
This function returns a structure describing the current status of fitsoutput.

void fitsoutput_postproc char *  filename  ) 
 

postprocesses the fits file

Returns:
void
This function postprecesses the fits file. It runs sextractor, calculates the median of the FWHMs and add it to this image statistics. Futhermore it write the image statistics to the tex logfile, and informs the automated mode about the finished calculation. Appart from that it also calculates the MD5 sum of the image in order to detect transfer errors

void fitsoutput_set_ccd struct ccd_struct  ccd  ) 
 

sets the CCD parameters.

Parameters:
dap a struct containing the CCD parameters to be set
Returns:
void
This function sets the CCD parameters.

void fitsoutput_set_dap struct dap_struct  dap  ) 
 

sets the Data Associated Parameters.

Parameters:
dap a struct containing the Data Associated Parameters to be set
Returns:
void
This function sets the Data Associated Parameters.

void fitsoutput_stat  ) 
 

calculates the averiage value and the standard deviation of the overscan region of the image.

Returns:
void
This function calculates the averiage value and the standard deviation of the overscan region of the image. Futhemore is writes the current acquisiton struct, and the current filenumber to the current image statistics struct

int init_fitsfile void   ) 
 

Open a fitsfile and set header keywords.

Returns:
int the fitsio status code of the fitsfile opened or -1 if the file could not be opened
This function opens a fitsfile. The the filenumber in the conguration file is used to create the filename. If the file allready exsists the filenumber is increased up to 10000 time to find a free filename. The header keywords are set up.

int init_fitsfile_noheader int  xsize,
int  ysize
 

Open a fitsfile and without setting header keywords.

Parameters:
xsize the size of the image in x direction.
ysize the size of the image in y direction.
Returns:
int the fitsio status code of the fitsfile opened or -1 if the file could not be opened
This function opens a fitsfile. The the filenumber in the conguration file is used to create the filename. If the file allready exsists the filenumber is increased up to 10000 time to find a free filename. No header keywords are set up. This function is only used if and exposure is requested by a user command in the CCU termninal window.

the current filename

void write_fitsfile unsigned char *  data,
int  size
 

writes data into a fitsfile

Parameters:
data a pointer to a region in memory containing the data to be writen.
size the number of bytes to be writen
Returns:
void
This function writes data into a fitsfile. The fitsfile has to be opend using init_fitsfile before any data can be writen.


Variable Documentation

struct ccd_compiled_struct fitsoutput_ccd_compiled
 

a stuct keeping the paramters of the ccd corrected for the current binning mode and ready for storage the fits header

unsigned short* fitsoutput_data
 

a pointer to a structure containing the data to be writen into the fitsfile

fitsfile* fitsoutput_file
 

a pointer to a structure definded in fitsio.h it is used to store the fitsfile

char fitsoutput_filename[1000]
 

the current filename

int fitsoutput_filenum
 

the serial number of the current file

long fitsoutput_fpixel = 1
 

dunno (not documented in cfitio documentation while writing this docu)

volatile int fitsoutput_is_open = 0
 

1 if a fitsfile is open for writing, 0 otherwise

long fitsoutput_naxes[2]
 

number of pixels in x and y direction in the fitsfile

long fitsoutput_naxis = 2
 

number of axis in fitsfile

long fitsoutput_nelements
 

number of pixels in the fitsfile

struct fitsoutput_devices_struct fitsoutput_shutter_closed
 

a stuct representing the status of the attacted devices when the sutter just closed

struct fitsoutput_devices_struct fitsoutput_shutter_opened
 

a stuct representing the status of the attacted devices when the sutter just opened

int fitsoutput_simlation_mode = 0
 

if set to one no fitsfile will be writen, no stasicis willbe calcualted, just funny numbers will be created for debugging puposes only

struct fitsoutput_status_struct fitsoutput_status
 

a stuct representing the current status of fitsoutput

volatile int fitsoutput_write_file = 1
 

1 if the current fitsfile shall actually be writen to disk. Set to 0 if you just want to perform operation in memmory

int ii
 

the x writing position in the current image

int jj
 

the y writing position in the current image

int status
 

the status of cfitsio (fitsio.h)


Generated on Fri Dec 16 22:23:37 2005 for gboccia by  doxygen 1.4.2