30#include "moo_detector.h"
48moo_outputs_new(
int nb)
50 moo_outputs *res = cpl_calloc(1,
sizeof(moo_outputs));
52 res->outputs = cpl_calloc(nb,
sizeof(moo_output));
58moo_outputs_delete(moo_outputs *res)
61 cpl_free(res->outputs);
69 moo_outputs *outputs = NULL;
70 cpl_ensure(header != NULL, CPL_ERROR_NULL_INPUT, NULL);
76 cpl_errorstate prestate = cpl_errorstate_get();
77 moo_try_check(outputs = moo_outputs_new(nbout),
" ");
82 for (
int i = 1; i <= nbout; i++) {
85 int nx, ny, x, y, prscx, prscy, ovscx, ovscy;
111 outputs->outputs[i - 1].nx = nx;
112 outputs->outputs[i - 1].ny = ny;
113 outputs->outputs[i - 1].x = x;
114 if (outputs->minx > x) {
117 if (outputs->miny > y) {
123 outputs->outputs[i - 1].dx = 1;
126 outputs->outputs[i - 1].dx = x - (nx - 1);
128 outputs->outputs[i - 1].dy = 1;
131 int oldx = outputs->outputs[i - 2].x;
132 int oldy = outputs->outputs[i - 2].y;
133 int onx = outputs->outputs[i - 2].nx;
134 int ony = outputs->outputs[i - 2].ny;
137 outputs->outputs[i - 1].dx = outputs->outputs[i - 2].dx;
140 outputs->outputs[i - 1].dx = outputs->outputs[i - 2].dx + onx;
143 outputs->outputs[i - 1].dx = outputs->outputs[i - 2].dx - onx;
147 outputs->outputs[i - 1].dy = outputs->outputs[i - 2].dy;
150 outputs->outputs[i - 1].dy = outputs->outputs[i - 2].dy + ony;
153 outputs->outputs[i - 1].dy = outputs->outputs[i - 2].dy - ony;
157 outputs->outputs[i - 1].y = y;
158 outputs->outputs[i - 1].ron = roni;
159 outputs->outputs[i - 1].gain = gaini;
160 outputs->outputs[i - 1].prscx = prscx;
161 outputs->outputs[i - 1].prscy = prscy;
162 outputs->outputs[i - 1].ovscx = ovscx;
163 outputs->outputs[i - 1].ovscy = ovscy;
167 if (!cpl_errorstate_is_equal(prestate)) {
168 moo_outputs_delete(outputs);
176moo_outputs_get_det_size(moo_outputs *self,
int *nx,
int *ny)
178 cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
179 cpl_ensure_code(nx != NULL, CPL_ERROR_NULL_INPUT);
180 cpl_ensure_code(ny != NULL, CPL_ERROR_NULL_INPUT);
182 int nbout = self->nb;
183 int minx = self->minx;
184 int miny = self->miny;
189 for (
int i = 0; i < nbout; i++) {
190 int x = self->outputs[i].x;
191 int y = self->outputs[i].y;
194 sy += self->outputs[i].ny;
197 sx += self->outputs[i].nx;
204 return CPL_ERROR_NONE;
224 cpl_image *result = NULL;
226 cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL);
227 cpl_ensure(raw != NULL, CPL_ERROR_NULL_INPUT, NULL);
229 cpl_type type = cpl_image_get_type(raw);
230 int naxis1 = cpl_image_get_size_x(raw);
231 int naxis2 = cpl_image_get_size_y(raw);
233 result = cpl_image_new(nx, ny, type);
235 for (
int i = 0; i < self->nb; i++) {
236 int rx = self->outputs[i].x;
237 int ry = self->outputs[i].y;
238 int prscx = self->outputs[i].prscx;
239 int prscy = self->outputs[i].prscy;
240 int rnx = self->outputs[i].nx;
241 int rny = self->outputs[i].ny;
244 rx = naxis1 - prscx - rnx + 1;
251 ry = naxis2 - prscy - rny + 1;
257 int x = self->outputs[i].dx;
258 int y = self->outputs[i].dy;
263 cpl_image_extract(raw, rx, ry, rx + rnx - 1, ry + rny - 1);
266 cpl_image_copy(result, extract, x, y);
267 cpl_image_delete(extract);
281 const char *value = cpl_propertylist_get_string(plist, MOO_PFITS_ARCFILE);
283 cpl_ensure(value != NULL, cpl_error_get_code(), NULL);
297 const char *value = cpl_propertylist_get_string(plist, MOO_PFITS_DATE);
299 cpl_ensure(value != NULL, cpl_error_get_code(), NULL);
313 const char *value = cpl_propertylist_get_string(plist, MOO_PFITS_DATEOBS);
315 cpl_ensure(value != NULL, cpl_error_get_code(), NULL);
330 cpl_errorstate prestate = cpl_errorstate_get();
331 double value = cpl_propertylist_get_double(plist, MOO_PFITS_MJDOBS);
332 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
347 const char *value = cpl_propertylist_get_string(plist, MOO_PFITS_EXTNAME);
349 cpl_ensure(value != NULL, cpl_error_get_code(), NULL);
364 cpl_errorstate prestate = cpl_errorstate_get();
365 const double value = cpl_propertylist_get_double(plist, MOO_PFITS_DET_DIT);
369 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
384 cpl_errorstate prestate = cpl_errorstate_get();
385 const int value = cpl_propertylist_get_int(plist, MOO_PFITS_DET_NDIT);
389 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
404 cpl_errorstate prestate = cpl_errorstate_get();
405 const int value = cpl_propertylist_get_bool(plist, MOO_PFITS_DET_LIVE);
409 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
424 cpl_errorstate prestate = cpl_errorstate_get();
425 const int value = cpl_propertylist_get_int(plist, MOO_PFITS_DET_OUTPUTS);
429 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
445 cpl_errorstate prestate = cpl_errorstate_get();
446 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_RON, i);
447 const float value = cpl_propertylist_get_float(plist, kw);
451 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
466 cpl_errorstate prestate = cpl_errorstate_get();
468 cpl_propertylist_get_float(plist, MOO_PFITS_DET_CHIP_RON);
471 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
487 cpl_errorstate prestate = cpl_errorstate_get();
488 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_GAIN, i);
489 const float value = cpl_propertylist_get_float(plist, kw);
493 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
509 cpl_errorstate prestate = cpl_errorstate_get();
510 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_GAIN, i);
511 const float value = cpl_propertylist_get_float(plist, kw);
515 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
531 cpl_errorstate prestate = cpl_errorstate_get();
532 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_NX, i);
533 const int value = cpl_propertylist_get_int(plist, kw);
537 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
553 cpl_errorstate prestate = cpl_errorstate_get();
554 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_NX, i);
555 const int value = cpl_propertylist_get_int(plist, kw);
559 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
575 cpl_errorstate prestate = cpl_errorstate_get();
576 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_NY, i);
577 const int value = cpl_propertylist_get_int(plist, kw);
581 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
597 cpl_errorstate prestate = cpl_errorstate_get();
598 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_NY, i);
599 const int value = cpl_propertylist_get_int(plist, kw);
603 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
619 cpl_errorstate prestate = cpl_errorstate_get();
620 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_X, i);
621 const int value = cpl_propertylist_get_int(plist, kw);
625 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
641 cpl_errorstate prestate = cpl_errorstate_get();
642 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_X, i);
643 const int value = cpl_propertylist_get_int(plist, kw);
647 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
663 cpl_errorstate prestate = cpl_errorstate_get();
664 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_Y, i);
665 const int value = cpl_propertylist_get_int(plist, kw);
669 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
685 cpl_errorstate prestate = cpl_errorstate_get();
686 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_Y, i);
687 const int value = cpl_propertylist_get_int(plist, kw);
691 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
697moo_pfits_set_det_outi_x(cpl_propertylist *plist,
int i,
int v)
699 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_X, i);
700 cpl_error_code code = cpl_propertylist_set_int(plist, kw, v);
707moo_pfits_set_det_chip_outi_x(cpl_propertylist *plist,
int i,
int v)
709 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_X, i);
710 cpl_error_code code = cpl_propertylist_set_int(plist, kw, v);
717moo_pfits_set_det_outi_y(cpl_propertylist *plist,
int i,
int v)
719 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_Y, i);
720 cpl_error_code code = cpl_propertylist_set_int(plist, kw, v);
727moo_pfits_set_det_chip_outi_y(cpl_propertylist *plist,
int i,
int v)
729 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_Y, i);
730 cpl_error_code code = cpl_propertylist_set_int(plist, kw, v);
747 cpl_errorstate prestate = cpl_errorstate_get();
748 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_PRSCX, i);
749 const int value = cpl_propertylist_get_int(plist, kw);
753 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
769 cpl_errorstate prestate = cpl_errorstate_get();
770 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_PRSCX, i);
771 const int value = cpl_propertylist_get_int(plist, kw);
775 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
791 cpl_errorstate prestate = cpl_errorstate_get();
792 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_PRSCY, i);
793 const int value = cpl_propertylist_get_int(plist, kw);
797 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
813 cpl_errorstate prestate = cpl_errorstate_get();
814 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_PRSCY, i);
815 const int value = cpl_propertylist_get_int(plist, kw);
819 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
835 cpl_errorstate prestate = cpl_errorstate_get();
836 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_OVSCX, i);
837 const int value = cpl_propertylist_get_int(plist, kw);
841 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
857 cpl_errorstate prestate = cpl_errorstate_get();
858 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_OVSCX, i);
859 const int value = cpl_propertylist_get_int(plist, kw);
863 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
879 cpl_errorstate prestate = cpl_errorstate_get();
880 char *kw = cpl_sprintf(MOO_PFITS_DET_OUTI_OVSCY, i);
881 const int value = cpl_propertylist_get_int(plist, kw);
885 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
901 cpl_errorstate prestate = cpl_errorstate_get();
902 char *kw = cpl_sprintf(MOO_PFITS_DET_CHIP_OUTI_OVSCY, i);
903 const int value = cpl_propertylist_get_int(plist, kw);
907 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
922 cpl_errorstate prestate = cpl_errorstate_get();
923 const int value = cpl_propertylist_get_int(plist, MOO_PFITS_DET_CHIP_NX);
927 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
942 cpl_errorstate prestate = cpl_errorstate_get();
943 const int value = cpl_propertylist_get_int(plist, MOO_PFITS_DET_CHIP_NY);
947 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
962 cpl_errorstate prestate = cpl_errorstate_get();
963 const int value = cpl_propertylist_get_bool(plist, MOO_PFITS_DET_CHIP_LIVE);
967 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
982 cpl_errorstate prestate = cpl_errorstate_get();
983 const int value = cpl_propertylist_get_int(plist, MOO_PFITS_NAXIS);
987 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1002 cpl_errorstate prestate = cpl_errorstate_get();
1003 const int value = cpl_propertylist_get_int(plist, MOO_PFITS_NAXIS1);
1007 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1022 cpl_errorstate prestate = cpl_errorstate_get();
1023 const int value = cpl_propertylist_get_int(plist, MOO_PFITS_NAXIS2);
1027 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1041 cpl_errorstate prestate = cpl_errorstate_get();
1042 const double value = cpl_propertylist_get_double(plist, MOO_PFITS_EXPTIME);
1046 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1062 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1063 cpl_propertylist_update_double(plist, MOO_PFITS_EXPTIME, value);
1065 return CPL_ERROR_NONE;
1079 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1080 cpl_propertylist_update_double(plist, MOO_PFITS_RA, value);
1082 return CPL_ERROR_NONE;
1096 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1097 cpl_propertylist_update_double(plist, MOO_PFITS_DEC, value);
1099 return CPL_ERROR_NONE;
1112 cpl_errorstate prestate = cpl_errorstate_get();
1114 cpl_propertylist_get_int(plist, MOO_PFITS_INS_SLIT_OFFSET);
1118 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
1133 moo_mode_type result = MOO_MODE_LR;
1134 cpl_errorstate prestate = cpl_errorstate_get();
1135 const char *value = cpl_propertylist_get_string(plist, MOO_PFITS_INS_MODE);
1138 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(),
1141 if (strcmp(value, MOO_MODE_HR_NAME) == 0) {
1142 result = MOO_MODE_HR;
1158 cpl_errorstate prestate = cpl_errorstate_get();
1159 const double value = cpl_propertylist_get_double(plist, MOO_PFITS_CRPIX2);
1163 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1178 cpl_errorstate prestate = cpl_errorstate_get();
1179 const double value = cpl_propertylist_get_double(plist, MOO_PFITS_CRVAL1);
1183 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1198 cpl_errorstate prestate = cpl_errorstate_get();
1199 const double value = cpl_propertylist_get_double(plist, MOO_PFITS_CRPIX1);
1203 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1218 cpl_errorstate prestate = cpl_errorstate_get();
1219 const double value = cpl_propertylist_get_double(plist, MOO_PFITS_CDELT2);
1223 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1238 cpl_errorstate prestate = cpl_errorstate_get();
1239 const double value = cpl_propertylist_get_double(plist, MOO_PFITS_CDELT1);
1243 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1258 cpl_errorstate prestate = cpl_errorstate_get();
1259 const double value = cpl_propertylist_get_double(plist, MOO_PFITS_CD1_1);
1263 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1278 cpl_errorstate prestate = cpl_errorstate_get();
1279 const double value = cpl_propertylist_get_double(plist, MOO_PFITS_CD2_2);
1283 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1297 cpl_errorstate prestate = cpl_errorstate_get();
1298 const double value =
1299 cpl_propertylist_get_double(plist, MOO_PFITS_TEL_AIRM_START);
1302 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1317 cpl_errorstate prestate = cpl_errorstate_get();
1318 const double value =
1319 cpl_propertylist_get_double(plist, MOO_PFITS_TEL_AIRM_END);
1322 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
1338 cpl_error_code code =
1339 cpl_propertylist_update_int(plist, MOO_PFITS_PRO_NCOADD, v);
1353 cpl_errorstate prestate = cpl_errorstate_get();
1355 const int value = cpl_propertylist_get_int(plist, MOO_PFITS_PRO_NCOADD);
1358 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
1372 cpl_errorstate prestate = cpl_errorstate_get();
1374 cpl_propertylist_get_string(plist, MOO_PFITS_PRO_WAVESOL_MODEL);
1377 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), NULL);
1392 cpl_errorstate prestate = cpl_errorstate_get();
1393 const char *value = cpl_propertylist_get_string(plist, MOO_PFITS_OBS_START);
1396 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), NULL);
1411 cpl_errorstate prestate = cpl_errorstate_get();
1412 const char *value =
"";
1414 if (cpl_propertylist_has(plist, MOO_PFITS_PRO_REC1_ID)) {
1415 value = cpl_propertylist_get_string(plist, MOO_PFITS_PRO_REC1_ID);
1419 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
1434 cpl_errorstate prestate = cpl_errorstate_get();
1436 cpl_propertylist_get_string(plist, MOO_PFITS_PRO_WAVESOL_DEGX);
1439 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
1454 cpl_errorstate prestate = cpl_errorstate_get();
1455 int value = cpl_propertylist_get_int(plist, MOO_PFITS_PRO_WAVESOL_DEGY);
1458 cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0);
1472 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1474 cpl_propertylist_append_string(plist, MOO_PFITS_HDUCLASS,
1475 MOO_PFITS_HDUCLASS_V);
1476 cpl_propertylist_set_comment(plist, MOO_PFITS_HDUCLASS,
1477 MOO_PFITS_HDUCLASS_C);
1479 cpl_propertylist_append_string(plist, MOO_PFITS_HDUDOC, MOO_PFITS_HDUDOC_V);
1480 cpl_propertylist_set_comment(plist, MOO_PFITS_HDUDOC, MOO_PFITS_HDUDOC_C);
1482 cpl_propertylist_append_string(plist, MOO_PFITS_HDUVERS,
1483 MOO_PFITS_HDUVERS_V);
1484 cpl_propertylist_set_comment(plist, MOO_PFITS_HDUVERS, MOO_PFITS_HDUVERS_C);
1486 cpl_propertylist_append_string(plist, MOO_PFITS_HDUCLAS1,
1487 MOO_PFITS_HDUCLAS1_V);
1488 cpl_propertylist_set_comment(plist, MOO_PFITS_HDUCLAS1,
1489 MOO_PFITS_HDUCLAS1_C);
1491 return CPL_ERROR_NONE;
1508 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1512 cpl_propertylist_append_string(plist, MOO_PFITS_HDUCLAS2,
1513 MOO_PFITS_HDUCLAS2_DATA);
1514 cpl_propertylist_set_comment(plist, MOO_PFITS_HDUCLAS2,
1515 MOO_PFITS_HDUCLAS2_DATA_C);
1517 cpl_propertylist_append_string(plist, MOO_PFITS_ERRDATA, err_extname);
1518 cpl_propertylist_set_comment(plist, MOO_PFITS_ERRDATA, MOO_PFITS_ERRDATA_C);
1520 cpl_propertylist_append_string(plist, MOO_PFITS_QUALDATA, qual_extname);
1521 cpl_propertylist_set_comment(plist, MOO_PFITS_QUALDATA,
1522 MOO_PFITS_QUALDATA_C);
1523 return cpl_error_get_code();
1540 const cpl_propertylist *sci_header)
1542 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1546 cpl_propertylist_append_string(plist, MOO_PFITS_HDUCLAS2,
1547 MOO_PFITS_HDUCLAS2_ERROR);
1548 cpl_propertylist_set_comment(plist, MOO_PFITS_HDUCLAS2,
1549 MOO_PFITS_HDUCLAS2_ERROR_C);
1550 cpl_propertylist_append_string(plist, MOO_PFITS_HDUCLAS3,
1551 MOO_PFITS_HDUCLAS3_ERROR_MSE);
1552 cpl_propertylist_set_comment(plist, MOO_PFITS_HDUCLAS3,
1553 MOO_PFITS_HDUCLAS3_ERROR_MSE_C);
1556 cpl_propertylist_append_string(plist, MOO_PFITS_SCIDATA, extname);
1557 cpl_propertylist_set_comment(plist, MOO_PFITS_SCIDATA, MOO_PFITS_SCIDATA_C);
1560 cpl_propertylist_append_string(plist, MOO_PFITS_QUALDATA, qual_extname);
1561 cpl_propertylist_set_comment(plist, MOO_PFITS_QUALDATA,
1562 MOO_PFITS_QUALDATA_C);
1563 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CRPIX1);
1564 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CRVAL1);
1565 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CTYPE1);
1566 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CD1_1);
1567 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CUNIT1);
1569 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CRPIX2);
1570 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CRVAL2);
1572 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CTYPE2);
1573 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CD2_2);
1575 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_BUNIT);
1576 return cpl_error_get_code();
1594 const cpl_propertylist *sci_header,
1597 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1601 cpl_propertylist_append_string(plist, MOO_PFITS_HDUCLAS2,
1602 MOO_PFITS_HDUCLAS2_QUALITY);
1603 cpl_propertylist_set_comment(plist, MOO_PFITS_HDUCLAS2,
1604 MOO_PFITS_HDUCLAS2_QUALITY_C);
1605 cpl_propertylist_append_string(plist, MOO_PFITS_HDUCLAS3,
1606 MOO_PFITS_HDUCLAS3_QUALITY_FLAG32);
1607 cpl_propertylist_set_comment(plist, MOO_PFITS_HDUCLAS3,
1608 MOO_PFITS_HDUCLAS3_QUALITY_FLAG32_C);
1610 cpl_propertylist_append_string(plist, MOO_PFITS_SCIDATA, extname);
1611 cpl_propertylist_set_comment(plist, MOO_PFITS_SCIDATA, MOO_PFITS_SCIDATA_C);
1613 cpl_propertylist_append_string(plist, MOO_PFITS_ERRDATA, err_extname);
1614 cpl_propertylist_set_comment(plist, MOO_PFITS_ERRDATA, MOO_PFITS_ERRDATA_C);
1615 cpl_propertylist_append_int(plist, MOO_PFITS_QUALMASK, mask);
1616 cpl_propertylist_set_comment(plist, MOO_PFITS_QUALMASK,
1617 MOO_PFITS_QUALMASK_C);
1618 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CRPIX1);
1619 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CRPIX2);
1620 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CRVAL1);
1621 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CRVAL2);
1622 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CTYPE1);
1623 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CUNIT1);
1625 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CTYPE2);
1626 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CD1_1);
1627 cpl_propertylist_copy_property(plist, sci_header, MOO_PFITS_CD2_2);
1629 return cpl_error_get_code();
1642 const char *keyname = MOO_PFITS_FLUXCAL;
1643 const char *keycomment = MOO_PFITS_FLUXCAL_C;
1644 cpl_error_code status = CPL_ERROR_NONE;
1645 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1647 if (cpl_propertylist_has(plist, keyname)) {
1648 status = cpl_propertylist_set_string(plist, keyname, val);
1651 cpl_propertylist_append_string(plist, keyname, val);
1652 cpl_propertylist_set_comment(plist, keyname, keycomment);
1668 const char *keyname = MOO_PFITS_WAVELMIN;
1669 const char *keycomment = MOO_PFITS_WAVELMIN_C;
1670 cpl_error_code status = CPL_ERROR_NONE;
1671 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1673 if (cpl_propertylist_has(plist, keyname)) {
1674 status = cpl_propertylist_set_double(plist, keyname, val);
1677 cpl_propertylist_append_double(plist, keyname, val);
1678 cpl_propertylist_set_comment(plist, keyname, keycomment);
1694 const char *keyname = MOO_PFITS_WAVELMAX;
1695 const char *keycomment = MOO_PFITS_WAVELMAX_C;
1696 cpl_error_code status = CPL_ERROR_NONE;
1697 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1699 if (cpl_propertylist_has(plist, keyname)) {
1700 status = cpl_propertylist_set_double(plist, keyname, val);
1703 cpl_propertylist_append_double(plist, keyname, val);
1704 cpl_propertylist_set_comment(plist, keyname, keycomment);
1720 const char *keyname = MOO_PFITS_SPECBIN;
1721 const char *keycomment = MOO_PFITS_SPECBIN_C;
1722 cpl_error_code status = CPL_ERROR_NONE;
1723 cpl_ensure_code(plist != NULL, CPL_ERROR_NULL_INPUT);
1725 if (cpl_propertylist_has(plist, keyname)) {
1726 status = cpl_propertylist_set_double(plist, keyname, val);
1729 cpl_propertylist_append_double(plist, keyname, val);
1730 cpl_propertylist_set_comment(plist, keyname, keycomment);
const char * moo_detector_get_err_extname(moo_detector_type type, int ntas)
Get the ERROR extension name of a detector.
const char * moo_detector_get_extname(moo_detector_type type, int ntas)
Get the extension name of a detector.
enum _moo_detector_type_ moo_detector_type
The type code type.
const char * moo_detector_get_qual_extname(moo_detector_type type, int ntas)
Get the QUAL extension name of a detector.
double moo_pfits_get_tel_airm_end(const cpl_propertylist *plist)
find out the TEL.AIRM.END value
int moo_pfits_get_pro_ncoadd(const cpl_propertylist *plist)
find out the PRO.NOCAODD value
int moo_pfits_get_det_chip_outi_ovscx(const cpl_propertylist *plist, int i)
find out the ESO DET CHIP OUTI OVSCX value
int moo_pfits_get_det_outputs(const cpl_propertylist *plist)
find out the ESO DET OUTPUTS value
double moo_pfits_get_cdelt1(const cpl_propertylist *plist)
find out the CDELT1 value
int moo_pfits_get_det_outi_prscy(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI PRSCY value
int moo_pfits_get_ndit(const cpl_propertylist *plist)
find out the ESO DET NDIT value
int moo_pfits_get_det_chip_outi_y(const cpl_propertylist *plist, int i)
find out the ESO DET CHIP OUTI Y value
double moo_pfits_get_cd1_1(const cpl_propertylist *plist)
find out the CD1_1 value
const char * moo_pfits_get_pro_wavesol_degx(const cpl_propertylist *plist)
find out the PRO.WAVESOL.DEGX value
int moo_pfits_get_det_outi_ovscx(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI OVSCX value
int moo_pfits_get_det_chip_outi_prscy(const cpl_propertylist *plist, int i)
find out the ESO DET CHIP OUTI PRSCY value
int moo_pfits_get_det_outi_ny(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI NY value
const char * moo_pfits_get_pro_wavesol_model(const cpl_propertylist *plist)
find out the PRO.WAVESOL.MODEL value
cpl_error_code moo_pfits_append_hduclass_quality(cpl_propertylist *plist, moo_detector_type type, int ntas, const cpl_propertylist *sci_header, int mask)
Set the HDUCLASS QUALITY Keyword.
int moo_pfits_get_det_outi_ovscy(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI OVSCY value
int moo_pfits_get_det_chip_outi_ovscy(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI CHIP OVSCY value
int moo_pfits_get_det_chip_ny(const cpl_propertylist *plist)
find out the ESO DET CHIP NY value
const char * moo_pfits_get_date(const cpl_propertylist *plist)
find out the date
int moo_pfits_get_det_chip_outi_prscx(const cpl_propertylist *plist, int i)
find out the ESO DET CHIP OUTI PRSCX value
int moo_pfits_get_pro_wavesol_degy(const cpl_propertylist *plist)
find out the PRO.WAVESOL.DEGY value
int moo_pfits_get_det_chip_live(const cpl_propertylist *plist)
find out the ESO DET CHIP LIVE value
moo_mode_type moo_pfits_get_mode(const cpl_propertylist *plist)
find out the INS SLIT MODE value
int moo_pfits_get_det_chip_outi_nx(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI CHIP NX value
cpl_error_code moo_pfits_set_spec_bin(cpl_propertylist *plist, double val)
Set the SPEC_BIN Keyword.
float moo_pfits_get_det_chip_ron(const cpl_propertylist *plist)
find out the ESO DET CHIP RON value
int moo_pfits_get_naxis1(const cpl_propertylist *plist)
find out the NAXIS1 value
double moo_pfits_get_tel_airm_start(const cpl_propertylist *plist)
find out the TEL.AIRM.START value
cpl_error_code moo_pfits_update_exptime(cpl_propertylist *plist, double value)
Set the EXPTIME value.
int moo_pfits_get_det_outi_prscx(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI PRSCX value
cpl_error_code moo_pfits_append_hduclass_error(cpl_propertylist *plist, moo_detector_type type, int ntas, const cpl_propertylist *sci_header)
Set the HDUCLASS ERROR Keyword.
const char * moo_pfits_get_pro_rec1_id(const cpl_propertylist *plist)
find out the PRO.REC1.ID value
cpl_error_code moo_pfits_set_wlmin(cpl_propertylist *plist, double val)
Set the WAVELMIN Keyword.
double moo_pfits_get_dit(const cpl_propertylist *plist)
find out the DIT value
cpl_error_code moo_pfits_update_dec(cpl_propertylist *plist, double value)
Set the DEC value.
double moo_pfits_get_crpix2(const cpl_propertylist *plist)
find out the CRPIX2 value
cpl_error_code moo_pfits_append_hduclass_data(cpl_propertylist *plist, moo_detector_type type, int ntas)
Set the HDUCLASS DATA Keyword.
cpl_error_code moo_pfits_set_wlmax(cpl_propertylist *plist, double val)
Set the WAVELMAX Keyword.
float moo_pfits_get_det_chip_outi_gain(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI CHIP GAIN value
int moo_pfits_get_live(const cpl_propertylist *plist)
find out the ESO DET LIVE value
double moo_pfits_get_mjdobs(const cpl_propertylist *plist)
find out the MJD-OBS
int moo_pfits_get_slit_offset(const cpl_propertylist *plist)
find out the INS SLIT OFFSET value
double moo_pfits_get_crval1(const cpl_propertylist *plist)
find out the CRVAL1 value
const char * moo_pfits_get_dateobs(const cpl_propertylist *plist)
find out the DATE-OBS
int moo_pfits_get_det_chip_nx(const cpl_propertylist *plist)
find out the ESO DET CHIP NX value
const char * moo_pfits_get_extname(const cpl_propertylist *plist)
find out the EXTNAME
int moo_pfits_get_det_chip_outi_x(const cpl_propertylist *plist, int i)
find out the ESO DET CHIP OUTI X value
cpl_error_code moo_pfits_update_ra(cpl_propertylist *plist, double value)
Set the RA value.
float moo_pfits_get_det_outi_ron(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI RON value
int moo_pfits_get_naxis2(const cpl_propertylist *plist)
find out the NAXIS2 value
double moo_pfits_get_crpix1(const cpl_propertylist *plist)
find out the CRPIX1 value
cpl_image * moo_outputs_create_det(moo_outputs *self, cpl_image *raw, int nx, int ny, moo_detector_type dtype)
Create the DET data from RAW header and DATA.
int moo_pfits_get_det_outi_nx(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI NX value
double moo_pfits_get_cdelt2(const cpl_propertylist *plist)
find out the CDELT2 value
int moo_pfits_get_det_outi_y(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI Y value
float moo_pfits_get_det_outi_gain(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI GAIN value
int moo_pfits_get_det_outi_x(const cpl_propertylist *plist, int i)
find out the ESO DET OUTI X value
cpl_error_code moo_pfits_append_hduclass(cpl_propertylist *plist)
Set the HDUCLASS Keyword.
double moo_pfits_get_cd2_2(const cpl_propertylist *plist)
find out the CD2_2 value
cpl_error_code moo_pfits_update_ncoadd(cpl_propertylist *plist, int v)
set the ESO PRO NCOADD value
int moo_pfits_get_det_chip_outi_ny(const cpl_propertylist *plist, int i)
find out the ESO DET CHIP OUTI NY value
const char * moo_pfits_get_obs_start(const cpl_propertylist *plist)
find out the PRO.WAVESOL.MODEL value
cpl_error_code moo_pfits_set_fluxcal(cpl_propertylist *plist, const char *val)
Set the FLUXCAL Keyword.
const char * moo_pfits_get_arcfile(const cpl_propertylist *plist)
find out the arcfile
double moo_pfits_get_exptime(const cpl_propertylist *plist)
find out the EXPTIME value
int moo_pfits_get_naxis(const cpl_propertylist *plist)
find out the NAXIS value