MOONS Pipeline Reference Manual 0.13.2
moo_target_table.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_TARGET_TABLE_H
21#define MOO_TARGET_TABLE_H
22
23
24/*-----------------------------------------------------------------------------
25 Includes
26 -----------------------------------------------------------------------------*/
27#include <cpl.h>
28#include <hdrl.h>
29#include "moo_params.h"
30#include "moo_rbn.h"
31#include "moo_ext.h"
32#include "moo_map.h"
33#include "moo_sky_lines_list.h"
34
35#define MOO_TARGET_TABLE_INDEXTARG "INDEXTARG"
36#define MOO_TARGET_TABLE_TARGNAME "TARGNAME"
37#define MOO_TARGET_TABLE_TARGALPHA "TARGALPHA"
38#define MOO_TARGET_TABLE_TARGDELTA "TARGDELTA"
39#define MOO_TARGET_TABLE_TYPE "TYPE"
40#define MOO_TARGET_TABLE_TYPENOD "TYPE_NOD"
41#define MOO_TARGET_TABLE_FIBRE "FIBRE"
42#define MOO_TARGET_TABLE_INDEX "INDEX"
43#define MOO_TARGET_TABLE_PAIREDFIBRE "PAIREDFIBRE"
44#define MOO_TARGET_TABLE_INDEXRBN "INDEXRBN"
45#define MOO_TARGET_TABLE_PAIREDINDEXRBN "PAIREDINDEXRBN"
46#define MOO_TARGET_TABLE_OBSTYPE "OBSTYPE"
47#define MOO_TARGET_TABLE_SUBSKYMODE "SUBSKYMODE"
48#define MOO_TARGET_TABLE_SUBSKY_NOD "NOD"
49#define MOO_TARGET_TABLE_SUBSKY_STARE "STARE"
50#define MOO_TARGET_TABLE_SUBSKY_MIXED "MIXED"
51#define MOO_TARGET_TABLE_SPECTRO "SPECTRO"
52
53#define MOO_OBSTYPE_SKYSTARE "SKY_STARE"
54#define MOO_OBSTYPE_OBSSTARE "OBS_STARE"
55#define MOO_OBSTYPE_SKYRESSTARE "SKYRES_STARE"
56#define MOO_OBSTYPE_SKYRESPSTARE "SKYRES_P_STARE"
57#define MOO_OBSTYPE_OBSPSTARE "OBS_P_STARE"
58#define MOO_OBSTYPE_OBSNOD "OBS_NOD"
59#define MOO_OBSTYPE_SKYRESNOD "SKYRES_NOD"
60#define MOO_OBSTYPE_OBSSWITCH "OBS_SWITCH"
61#define MOO_OBSTYPE_OBSSWITCHSTARE "OBS_SWITCHSTARE"
62#define MOO_OBSTYPE_OBSNODSTARE "OBS_NODSTARE"
63
64#define MOO_OBSTYPE_OBSPNOD "OBS_P_NOD"
65#define MOO_OBSTYPE_OBSPNODSTARE "OBS_P_NODSTARE"
66
67#define MOO_TARGET_TABLE_EXPTIMERI "EXPTIMERI"
68#define MOO_TARGET_TABLE_EXPTIMEYJ "EXPTIMEYJ"
69#define MOO_TARGET_TABLE_EXPTIMEH "EXPTIMEH"
70
71#define MOO_TARGET_TABLE_MAG "MAG"
72
73#define MOO_TARGET_TABLE_NBSKY "NSKY_FIBRES"
74#define MOO_TARGET_TABLE_MAX_DIST_SLIT "MAX_DIST_SLIT"
75#define MOO_TARGET_TABLE_MAX_DIST_SKY "MAX_DIST_SKY"
76#define MOO_TARGET_TABLE_PNBSKY "PNSKY_FIBRES"
77#define MOO_TARGET_TABLE_PMAX_DIST_SLIT "PMAX_DIST_SLIT"
78#define MOO_TARGET_TABLE_PMAX_DIST_SKY "PMAX_DIST_SKY"
79
80#define MOO_TARGET_TABLE_TRANSRI "TRANSRI"
81#define MOO_TARGET_TABLE_TRANSYJ "TRANSYJ"
82#define MOO_TARGET_TABLE_TRANSH "TRANSH"
83#define MOO_TARGET_TABLE_PTRANSRI "PTRANSRI"
84#define MOO_TARGET_TABLE_PTRANSYJ "PTRANSYJ"
85#define MOO_TARGET_TABLE_PTRANSH "PTRANSH"
86
87#define MOO_TARGET_TABLE_MEDSNRRI_EXT "MEDIAN_SNR_RI_EXT"
88#define MOO_TARGET_TABLE_MEDSNRYJ_EXT "MEDIAN_SNR_YJ_EXT"
89#define MOO_TARGET_TABLE_MEDSNRH_EXT "MEDIAN_SNR_H_EXT"
90
91#define MOO_TARGET_TABLE_DERSNRRI_EXT "DERSNR_RI_EXT"
92#define MOO_TARGET_TABLE_DERSNRYJ_EXT "DERSNR_YJ_EXT"
93#define MOO_TARGET_TABLE_DERSNRH_EXT "DERSNR_H_EXT"
94
95#define MOO_TARGET_TABLE_MEDSNRRI_RBN "MEDIAN_SNR_RI_RBN"
96#define MOO_TARGET_TABLE_MEDSNRYJ_RBN "MEDIAN_SNR_YJ_RBN"
97#define MOO_TARGET_TABLE_MEDSNRH_RBN "MEDIAN_SNR_H_RBN"
98
99#define MOO_TARGET_TABLE_PMEDSNRRI_EXT "PMEDIAN_SNR_RI_EXT"
100#define MOO_TARGET_TABLE_PMEDSNRYJ_EXT "PMEDIAN_SNR_YJ_EXT"
101#define MOO_TARGET_TABLE_PMEDSNRH_EXT "PMEDIAN_SNR_H_EXT"
102
103#define MOO_TARGET_TABLE_PDERSNRRI_EXT "PDERSNR_RI_EXT"
104#define MOO_TARGET_TABLE_PDERSNRYJ_EXT "PDERSNR_YJ_EXT"
105#define MOO_TARGET_TABLE_PDERSNRH_EXT "PDERSNR_H_EXT"
106
107#define MOO_TARGET_TABLE_PMEDSNRRI_RBN "PMEDIAN_SNR_RI_RBN"
108#define MOO_TARGET_TABLE_PMEDSNRYJ_RBN "PMEDIAN_SNR_YJ_RBN"
109#define MOO_TARGET_TABLE_PMEDSNRH_RBN "PMEDIAN_SNR_H_RBN"
110
111#define MOO_TARGET_TABLE_MEDSNRRI_SCI "MEDIAN_SNR_RI_SCI"
112#define MOO_TARGET_TABLE_MEDSNRYJ_SCI "MEDIAN_SNR_YJ_SCI"
113#define MOO_TARGET_TABLE_MEDSNRH_SCI "MEDIAN_SNR_H_SCI"
114
115#define MOO_TARGET_TABLE_EXTNAME "TARGET_TABLE"
123typedef struct
124{
125 const char *filename;
126 cpl_propertylist *primary_header;
127 cpl_table *table;
129
130enum _moo_target_table_mode_
131{
132 /* type */
133
137 MOO_MODE_STARE,
141 MOO_MODE_STARENOD,
145 MOO_MODE_XSWITCH
146};
147
156typedef enum _moo_target_table_mode_ moo_target_table_mode;
157
160moo_target_table *moo_create_empty_target_table(void);
162 moo_rbn *rbnB,
164 moo_target_table_params *params);
166
167cpl_array *
173cpl_array *
175cpl_array *moo_target_table_select_obj_index_qlook(moo_target_table *self);
176cpl_error_code
177moo_target_table_save(moo_target_table *self, const char *filename);
178
179moo_target_table *moo_target_table_load(const cpl_frame *frame);
181cpl_error_code
183int moo_target_table_find_target(moo_target_table *self, const char *targname);
184int moo_target_table_find_index(moo_target_table *self, const char *targname);
185const char *moo_target_table_get_std_name(moo_target_table *self);
186cpl_error_code moo_target_table_set_exptimes(moo_target_table *self,
187 double *exptimeA,
188 double *exptimeB);
189cpl_error_code moo_target_table_set_exptime(moo_target_table *self,
190 int i,
191 int j,
192 double exptime);
193double moo_target_table_get_exptime(moo_target_table *self, int i, int j);
195cpl_error_code moo_target_table_set_snr(moo_target_table *self,
196 int idx,
197 cpl_table *ft,
198 int ft_idx);
199cpl_error_code moo_target_table_set_ft_psnr(moo_target_table *self,
200 int idx,
201 cpl_table *ft,
202 int ft_idx);
203cpl_error_code moo_target_table_set_psnr(moo_target_table *self,
204 int idx,
205 moo_target_table *tcopy,
206 int ft_idx);
207cpl_error_code moo_target_table_copy_row(moo_target_table *self,
208 int idx,
209 moo_target_table *tocopy,
210 int ft_idx);
211int moo_is_obstype_stare(const char *obstype);
213#endif
cpl_array * moo_target_table_select_sky_index(moo_target_table *self, moo_rbn *sky_rbn)
get the index of the sky in the target table sort by indexspec
cpl_error_code moo_target_table_select_pstare(moo_target_table *self)
select PSTARE object in trget table
void moo_target_table_delete(moo_target_table *self)
Delete a moo_target_table.
double moo_target_table_get_exptime(moo_target_table *self, int i, int j)
rget the exptime of a target
moo_target_table * moo_target_table_load(const cpl_frame *frame)
Load a TARGET_TABLE frame and create a moo_target_table.
moo_target_table * moo_target_table_new(void)
Create a new moo_target_table.
moo_target_table * moo_target_table_duplicate(moo_target_table *self)
Duplicate an existing target_table.
enum _moo_target_table_mode_ moo_target_table_mode
The type code type.
cpl_error_code moo_target_table_merge(moo_target_table *self, moo_target_table *tomerge)
Merge two TARGET_TABLE.
cpl_error_code moo_target_table_select_stare(moo_target_table *self)
select STARE object in trget table
int moo_target_table_find_index(moo_target_table *self, const char *targname)
find target indexspec in TARGET_TABLE
int moo_target_table_find_target(moo_target_table *self, const char *targname)
find target targindex in TARGET_TABLE
moo_target_table * moo_create_target_table(moo_rbn *rbnA, moo_rbn *rbnB, moo_target_table_mode mode, moo_target_table_params *params)
Prepare target table for SCI frames using their attached fibre.
cpl_error_code moo_target_table_select_nod(moo_target_table *self)
select STARE object in trget table
cpl_error_code moo_target_table_select_pnod(moo_target_table *self)
select STARE object in trget table
int moo_target_table_xswitch_paired(moo_target_table *self)
get the index of the object in the target table sort by indexrbn
cpl_array * moo_target_table_select_obj_index(moo_target_table *self, int ispaired)
get the index of the object in the target table sort by indexrbn
const char * moo_target_table_mode_get_name(moo_target_table_mode m)
Get the name of target mode.
cpl_error_code moo_target_table_remove_coadd_cols(moo_target_table *self)
remove columns for coadd in target_table
the different type of detectors