62 cpl_ensure(set != NULL, CPL_ERROR_NULL_INPUT, NULL);
64 res = cpl_calloc(
sizeof(cpl_frameset *), 2);
65 res[0] = cpl_frameset_new();
66 res[1] = cpl_frameset_new();
70 for (i = 0; i < cpl_frameset_get_size(set); ++i) {
71 const cpl_frame *frame = cpl_frameset_get_position_const(set, i);
72 const char *filename = cpl_frame_get_filename(frame);
73 cpl_propertylist *list = cpl_propertylist_load(filename, 0);
77 if (fabs(offset - MOONS_SLIT_OFFSET_POS1) <=
78 MOONS_SLIT_OFFSET_EPSILON) {
79 cpl_frameset_insert(res[0], cpl_frame_duplicate(frame));
81 else if (fabs(offset - MOONS_SLIT_OFFSET_POS2) <=
82 MOONS_SLIT_OFFSET_EPSILON) {
83 cpl_frameset_insert(res[1], cpl_frame_duplicate(frame));
85 cpl_propertylist_delete(list);
106 cpl_errorstate prestate = cpl_errorstate_get();
110 cpl_frameset_iterator *it = cpl_frameset_iterator_new(set);
113 cpl_frame *frame = NULL;
114 while ((frame = cpl_frameset_iterator_get(it)) != NULL) {
115 const char *tag = cpl_frame_get_tag(frame);
118 cpl_msg_warning(cpl_func,
"Frame %d has no tag", i);
120 else if (!strcmp(tag, MOONS_TAG_BIAS) ||
121 !strcmp(tag, MOONS_TAG_LINEARITY) ||
122 !strcmp(tag, MOONS_TAG_LINEARITY_OFF) ||
123 !strcmp(tag, MOONS_TAG_OBJECT) ||
124 !strcmp(tag, MOONS_TAG_DARK_VIS) ||
125 !strcmp(tag, MOONS_TAG_DARK_NIR) ||
126 !strcmp(tag, MOONS_TAG_FLAT) ||
127 !strcmp(tag, MOONS_TAG_FLAT_ATTACHED) ||
128 !strcmp(tag, MOONS_TAG_FLAT_OFF) ||
129 !strcmp(tag, MOONS_TAG_ARC) ||
130 !strcmp(tag, MOONS_TAG_ARC_OFF) ||
131 !strcmp(tag, MOONS_TAG_STD_FLUX) ||
132 !strcmp(tag, MOONS_TAG_STD_TELL) ||
133 !strcmp(tag, MOONS_TAG_OBJECT_STARE) ||
134 !strcmp(tag, MOONS_TAG_OBJECT_STARENOD) ||
135 !strcmp(tag, MOONS_TAG_SKY_STARENOD) ||
136 !strcmp(tag, MOONS_TAG_OBJECT_XSWITCH) ||
137 !strcmp(tag, MOONS_TAG_MOLECFIT_SCI)) {
139 cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
141 else if (!strcmp(tag, MOONS_TAG_LINE_CATALOG) ||
142 !strcmp(tag, MOONS_TAG_FLUX_STD_CATALOG) ||
143 !strcmp(tag, MOONS_TAG_ATMOS_EXT) ||
144 !strcmp(tag, MOONS_TAG_ARC_LINE_LIST) ||
145 !strcmp(tag, MOONS_TAG_SKY_LINE_LIST) ||
146 !strcmp(tag, MOONS_TAG_MASTER_BIAS) ||
147 !strcmp(tag, MOONS_TAG_MASTER_DARK_VIS) ||
148 !strcmp(tag, MOONS_TAG_MASTER_DARK_NIR) ||
149 !strcmp(tag, MOONS_TAG_BP_MAP_RP) ||
150 !strcmp(tag, MOONS_TAG_BP_MAP_NL) ||
151 !strcmp(tag, MOONS_TAG_FF_TRACE_GUESS) ||
152 !strcmp(tag, MOONS_TAG_FF_TRACE) ||
153 !strcmp(tag, MOONS_TAG_P2P_MAP) ||
154 !strcmp(tag, MOONS_TAG_SPECTRAL_FORMAT) ||
155 !strcmp(tag, MOONS_TAG_LAYOUT) ||
156 !strcmp(tag, MOONS_TAG_WAVEMAP_GUESS) ||
157 !strcmp(tag, MOONS_TAG_WAVEMAP) ||
158 !strcmp(tag, MOONS_TAG_F2F_TABLE) ||
159 !strcmp(tag, MOONS_TAG_FF_EXTSPECTRA) ||
160 !strcmp(tag, MOONS_TAG_LINEARITY_COEFF_CUBE) ||
161 !strcmp(tag, MOONS_TAG_TELLURIC_CORR) ||
162 !strcmp(tag, MOONS_TAG_RESPONSE) ||
163 !strcmp(tag, MOONS_TAG_MOLECFIT_MOLECULES) ||
164 !strcmp(tag, MOONS_TAG_MOLECFIT_ATM_PARAMS) ||
165 !strcmp(tag, MOONS_TAG_MOLECFIT_BEST_FIT_PARAMS) ||
166 !strcmp(tag, MOONS_TAG_MOLECFIT_KERNEL_LIBRARY) ||
167 !strcmp(tag, MOONS_TAG_MOLECFIT_WINCLUDE)) {
169 cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
172 cpl_frameset_iterator_advance(it, 1);
175 cpl_frameset_iterator_delete(it);
177 if (!cpl_errorstate_is_equal(prestate)) {
178 return cpl_error_set_message(cpl_func, cpl_error_get_code(),
179 "Could not identify RAW and CALIB "
183 return CPL_ERROR_NONE;
201 cpl_ensure(set != NULL, CPL_ERROR_NULL_INPUT, NULL);
202 int size = cpl_frameset_get_size(set);
203 res = cpl_malloc(
sizeof(
double) * size);
207 for (i = 0; i < size; i++) {
208 const cpl_frame *frame = cpl_frameset_get_position_const(set, i);
209 const char *filename = cpl_frame_get_filename(frame);
210 cpl_propertylist *list = cpl_propertylist_load(filename, 0);
212 cpl_propertylist_delete(list);
double * moo_dfs_get_exptime(cpl_frameset *set)
Get the EXPTIME from the frameset.
cpl_error_code moo_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
cpl_frameset ** moo_dfs_split_by_offset(cpl_frameset *set)
Get the EXPTIME from the frameset.
int moo_pfits_get_slit_offset(const cpl_propertylist *plist)
find out the INS SLIT OFFSET value
double moo_pfits_get_exptime(const cpl_propertylist *plist)
find out the EXPTIME value