MOONS Pipeline Reference Manual 0.13.2
moo_s1d.c
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#ifdef HAVE_CONFIG_H
21#include <config.h>
22#endif
23
24/*-----------------------------------------------------------------------------
25 Includes
26 -----------------------------------------------------------------------------*/
27#include <math.h>
28#include <string.h>
29#include <cpl.h>
30
31#include "moo_s1d.h"
32#include "moo_fits.h"
33#include "moo_pfits.h"
34#include "moo_badpix.h"
35#include "moo_utils.h"
36#include "moo_dfs.h"
37
38/*----------------------------------------------------------------------------*/
53/*----------------------------------------------------------------------------*/
56/*-----------------------------------------------------------------------------
57 Function codes
58 -----------------------------------------------------------------------------*/
59
60/*----------------------------------------------------------------------------*/
68/*----------------------------------------------------------------------------*/
69moo_s1d *
71{
72 moo_s1d *res = cpl_calloc(1, sizeof(moo_s1d));
73 return res;
74}
75
76/*----------------------------------------------------------------------------*/
85/*----------------------------------------------------------------------------*/
86
87void
88moo_s1d_delete(moo_s1d *self)
89{
90 if (self != NULL) {
91 if (self->primary_header != NULL) {
92 cpl_propertylist_delete(self->primary_header);
93 }
94 if (self->header != NULL) {
95 cpl_propertylist_delete(self->header);
96 }
97 if (self->data != NULL) {
98 cpl_table_delete(self->data);
99 }
100
101 cpl_free(self->filename);
102 cpl_free(self);
103 }
104}
105
106/*----------------------------------------------------------------------------*/
115/*----------------------------------------------------------------------------*/
116void
117moo_s1d_save(moo_s1d *self)
118{
119 if (self != NULL) {
120 cpl_table_save(self->data, self->primary_header, self->header,
121 self->filename, CPL_IO_CREATE);
122 }
123}
124
125
moo_s1d * moo_s1d_new(void)
Create a new moo_cube.
Definition: moo_s1d.c:70
void moo_s1d_save(moo_s1d *self)
Save a moo_s1d to a FITS file.
Definition: moo_s1d.c:117
void moo_s1d_delete(moo_s1d *self)
Delete a moo_s1d.
Definition: moo_s1d.c:88