C-Munipack 1.2 / Application programming interface / API reference

Functions for reading and writing read-all files.

cmpack_allfile.h

Type definitions

CmpackAllFileRead-all file.

Functions

cmpack_all_initCreate a new read-all file.
cmpack_all_loadLoad the read-all file.
cmpack_all_saveSave the read-all file.
cmpack_all_copyCopy a file.
cmpack_all_clearClear all data.
cmpack_all_testTest if given file seems to be a readall file.
cmpack_all_test_bufferTest if the content of the buffer might be a readall file.
cmpack_all_set_apertureSet aperture identifier.
cmpack_all_get_apertureGet aperture identifier.
cmpack_all_set_filterSet filter name.
cmpack_all_get_filterGet filter name.
cmpack_all_set_helcorSet heliocentric correction flag.
cmpack_all_get_helcorGet heliocentric correction flag.
cmpack_all_nframesGet number of frames defined in the file.
cmpack_all_nstarsGet number of stars defined in the file.
cmpack_all_add_frameAdd new frame to the file.
cmpack_all_get_jdGet date of observation.
cmpack_all_setAdd measurement to the file.
cmpack_all_getGet measurement from the file.
cmpack_all_lightcurveMake table of differential intrumental magnitudes.

Description

The read-all file contains simplified result of photometry for a set of frames. Use cmpack-readall object to make a read-all file from a set of photometry files. You can pass it to the cmpack-list object to make an output table.

This file format was inherited from the varfind project and because it not extensible without breaking the compatibility it's planed to be replaced in C-Munipack version 2. Please, do not use this functions in newly written code.

CmpackAllFile (data type)

Read-all file.

Synopsis

typedef struct _CmpackAllFile CmpackAllFile

Description

This private structure holds the content of the read-all file.

cmpack_all_init (function)

Create a new read-all file.

Synopsis

CmpackAllFile * cmpack_all_init (void)

Description

This function makes an empty read-all file and returns pointer to it.

Return value

pointer a new reference to the file

cmpack_all_load (function)

Load the read-all file.

Synopsis

int cmpack_all_load (CmpackAllFile ** file, const char * filename, CmpackLoadMode flags)

Parameters

file[out] new file context
filename[in] path + file name
flags[in] reserved, use always zero

Return value

zero on success, error code on failure

cmpack_all_save (function)

Save the read-all file.

Synopsis

int cmpack_all_save (CmpackAllFile * file, const char * filename)

Parameters

file[in] file context
filename[in] path + file name

Return value

zero on success, error code on failure

cmpack_all_copy (function)

Copy a file.

Synopsis

int cmpack_all_copy (CmpackAllFile * dstfile, const CmpackAllFile * srcfile)

Description

Makes a copy of source file to the destination file. All content of the destination file will be deleted.

Parameters

dstfile[in] destination file context
srcfile[in] source file context

Return value

zero on success, error code on failure

cmpack_all_clear (function)

Clear all data.

Synopsis

void cmpack_all_clear (CmpackAllFile * file)

Parameters

file[in] file context

cmpack_all_test (function)

Test if given file seems to be a readall file.

Synopsis

int cmpack_all_test (const char * filename)

Return value

nonzero if the file is a photometry file, zero otherwise

cmpack_all_test_buffer (function)

Test if the content of the buffer might be a readall file.

Synopsis

int cmpack_all_test_buffer (const char * buffer, int buflen, int filesize)

Description

The function checks the data in the buffer and returns nonzero, when the buffer contain first 'buflen' bytes from a readall file. This function is used for file format autodetection.

Return value

nonzero if the file is a photometry file, zero otherwise

cmpack_all_set_aperture (function)

Set aperture identifier.

Synopsis

void cmpack_all_set_aperture (CmpackAllFile * file, int aperture)

Parameters

file[in] file context
aperture[in] aperture identifier

cmpack_all_get_aperture (function)

Get aperture identifier.

Synopsis

int cmpack_all_get_aperture (CmpackAllFile * file)

Parameters

file[in] file context

Return value

aperture identifier or zero on failure

cmpack_all_set_filter (function)

Set filter name.

Synopsis

void cmpack_all_set_filter (CmpackAllFile * file, const char * filter)

Parameters

file[in] file context
filter[in] filter name

cmpack_all_get_filter (function)

Get filter name.

Synopsis

const char * cmpack_all_get_filter (CmpackAllFile * file)

Parameters

file[in] file context

Return value

pointer to internal memory buffer or NULL of failure

cmpack_all_set_helcor (function)

Set heliocentric correction flag.

Synopsis

void cmpack_all_set_helcor (CmpackAllFile * file, int helcor)

Description

Set the flag to false if the julian dates are geocentric, set the flag to true if the julian dates are heliocentric.

Parameters

file[in] file context
helcor[in] heliocentric correction flag

cmpack_all_get_helcor (function)

Get heliocentric correction flag.

Synopsis

int cmpack_all_get_helcor (CmpackAllFile * file)

Description

if the value is nonzero, julian dates are heliocentric, otherwise, they are geocentric.

Parameters

file[in] file context

Return value

value of heliocentric correction flag

cmpack_all_nframes (function)

Get number of frames defined in the file.

Synopsis

int cmpack_all_nframes (CmpackAllFile * file)

Parameters

file[in] file context

Return value

number of frames or zero if the file is not valid context or if it is empty.

cmpack_all_nstars (function)

Get number of stars defined in the file.

Synopsis

int cmpack_all_nstars (CmpackAllFile * file)

Parameters

file[in] file context

Return value

number of stars or zero if the file is not valid context or if it is empty.

cmpack_all_add_frame (function)

Add new frame to the file.

Synopsis

int cmpack_all_add_frame (CmpackAllFile * file, double jd)

Parameters

file[in] file context
jd[in] date of observation

Return value

frame index or negative value on failure.

cmpack_all_get_jd (function)

Get date of observation.

Synopsis

double cmpack_all_get_jd (CmpackAllFile * file, int frame)

Parameters

file[in] file context
frame[in] frame index

Return value

julian date of observation or zero on failure

cmpack_all_set (function)

Add measurement to the file.

Synopsis

void cmpack_all_set (CmpackAllFile * file, int frame, int star, int mask, double mag, double err)

Parameters

file[in] file context
frame[in] frame index
star[in] star index
mask[in] bitmask of valid fields
mag[in] magnitude
err[in] magnitude error

cmpack_all_get (function)

Get measurement from the file.

Synopsis

int cmpack_all_get (CmpackAllFile * file, int frame, int star, int * mask, double * mag, double * err)

Parameters

file[in] file context
frame[in] frame index
star[in] star index
mask[out] bitmask of valid fields
mag[out] magnitude
err[out] magnitude error

Return value

zero on success, error code on failure

cmpack_all_lightcurve (function)

Make table of differential intrumental magnitudes.

Synopsis

int cmpack_all_lightcurve (CmpackAllFile * file, int var, int comp, CmpackTable * tab)

Parameters

file[in] file context
var[in] index of variable star
comp[in] index of comparison star
tab[out] light curve

Return value

zero on success, error code on failure