MOONS Pipeline Reference Manual 0.13.2
moo_single.h
1/*
2 * This file is part of the MOONS Pipeline
3 * Copyright (C) 2002-2016 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#ifndef MOO_SINGLE_H
21#define MOO_SINGLE_H
22
23
24/*-----------------------------------------------------------------------------
25 Includes
26 -----------------------------------------------------------------------------*/
27
28#include <cpl.h>
29#include <hdrl.h>
30#include "moo_detector.h"
31
32#define MOO_SINGLE_CUNIT1 "pixel"
33/*-----------------------------------------------------------------------------
34 Types
35 -----------------------------------------------------------------------------*/
36typedef struct
37{
38 cpl_propertylist *header;
39 hdrl_image *image;
40 cpl_image *qual;
41 cpl_mask *mask;
42 /* conversion from eletcrons to ADU */
43 float gain;
44 /* exposure time */
45 float exptime;
46 /* ron */
47 double ron;
48 /* conad */
49 double conad;
50 const char *filename;
51 const char *extname;
52 unsigned int badpix_mask;
54 int ntas;
55} moo_single;
56
57
58/*-----------------------------------------------------------------------------
59 Functions prototypes
60 -----------------------------------------------------------------------------*/
61moo_single *moo_single_new(moo_detector_type type, int ntas);
62moo_single *
63moo_single_create(const char *filename, moo_detector_type type, int ntas);
64cpl_error_code moo_single_load(moo_single *self, unsigned int level);
65
66cpl_error_code moo_single_free(moo_single *self);
67void moo_single_delete(moo_single *self);
68
69hdrl_image *moo_single_get_image(moo_single *self);
70cpl_image *moo_single_get_data(moo_single *self);
71cpl_image *moo_single_get_qual(moo_single *self);
72
73cpl_error_code
74moo_single_apply_mask(moo_single *self, cpl_mask *mask, unsigned int level);
75
76void moo_single_save(moo_single *self,
77 const char *filename,
79 int ntas);
80
81cpl_error_code moo_single_dump(const moo_single *self, FILE *stream);
82
83cpl_error_code moo_single_sub(moo_single *a, moo_single *b);
84cpl_error_code moo_single_divide(moo_single *a, moo_single *b);
85cpl_error_code moo_single_multiply_scalar(moo_single *a, double scalar);
86cpl_error_code moo_single_sum(moo_single *a, moo_single *b);
87cpl_error_code moo_single_mean(moo_single *a, moo_single *b);
88cpl_error_code moo_single_div_image(moo_single *a, cpl_image *b);
89cpl_error_code moo_single_filter_snr(moo_single *self, double min_snr);
90
91moo_single *moo_single_add_create(moo_single *a, moo_single *b);
92
93cpl_propertylist *moo_single_get_header(moo_single *self);
94double moo_single_get_exptime(moo_single *self);
95cpl_error_code moo_single_set_exptime(moo_single *self, double val);
96#endif
enum _moo_detector_type_ moo_detector_type
The type code type.
Definition: moo_detector.h:64
hdrl_image * moo_single_get_image(moo_single *self)
Get the IMAGE part (DATA,ERR) of single DET.
Definition: moo_single.c:330
cpl_error_code moo_single_load(moo_single *self, unsigned int level)
Load data in a single structure.
Definition: moo_single.c:152
cpl_error_code moo_single_mean(moo_single *a, moo_single *b)
Mean of two single DET.
Definition: moo_single.c:618
cpl_image * moo_single_get_data(moo_single *self)
Get the DATA part of single DET.
Definition: moo_single.c:239
cpl_error_code moo_single_sub(moo_single *a, moo_single *b)
Subtract two single DET.
Definition: moo_single.c:502
cpl_error_code moo_single_apply_mask(moo_single *self, cpl_mask *mask, unsigned int level)
Apply the given mask on the QUAL part.
Definition: moo_single.c:287
void moo_single_delete(moo_single *self)
Delete a moo_single.
Definition: moo_single.c:211
moo_single * moo_single_create(const char *filename, moo_detector_type type, int ntas)
Create a new moo_single from the given filename.
Definition: moo_single.c:105
cpl_error_code moo_single_dump(const moo_single *self, FILE *stream)
Dump structural information of a Single DET.
Definition: moo_single.c:460
cpl_error_code moo_single_free(moo_single *self)
Free memory associate to this single DET.
Definition: moo_single.c:349
cpl_error_code moo_single_sum(moo_single *a, moo_single *b)
Add two single DET.
Definition: moo_single.c:588
moo_single * moo_single_new(moo_detector_type type, int ntas)
Create a new moo_single.
Definition: moo_single.c:73
cpl_image * moo_single_get_qual(moo_single *self)
Get the QUAL part of single DET.
Definition: moo_single.c:312
cpl_error_code moo_single_divide(moo_single *a, moo_single *b)
Divide two single DET.
Definition: moo_single.c:532
cpl_error_code moo_single_multiply_scalar(moo_single *a, double scalar)
Elementwise multiplication of a single with a scalar.
Definition: moo_single.c:562
void moo_single_save(moo_single *self, const char *filename, moo_detector_type type, int ntas)
Save a moo_single to a FITS file.
Definition: moo_single.c:384
cpl_error_code moo_single_filter_snr(moo_single *self, double min_snr)
Flag low snr pixels from single DET structure.
Definition: moo_single.c:652