59#define MODULE_ID "XSH_CORRECT_VACUUM_TO_AIR"
68int main(
int argc,
char** argv)
72 cpl_table* table_names = NULL;
73 cpl_table* table_spect = NULL;
74 cpl_frame* std_catalog = NULL;
75 cpl_propertylist* phead = NULL;
76 cpl_propertylist* xhead = NULL;
79 const char* fname_out =
"catalog_new.fits";
80 const char* fname_inp;
88 double* plambda = NULL;
91 double c1 = 1.0002735182;
93 double c4 = 2.76249E8;
102 cpl_msg_set_level(CPL_MSG_DEBUG);
105 nb_frames = argc - optind;
106 if (nb_frames == 1) {
107 fname_inp = argv[optind];
109 xsh_msg(
"********** NOT ENOUGH INPUT FRAMES **********" );
113 std_catalog = cpl_frame_new();
114 cpl_frame_set_filename(std_catalog, fname_inp);
115 next = cpl_frame_get_nextensions(std_catalog);
116 phead = cpl_propertylist_load(fname_inp, 0);
117 table_names = cpl_table_load(fname_inp, 1, 0);
118 xhead = cpl_propertylist_load(fname_inp, 1);
119 cpl_table_save(table_names, phead, xhead, fname_out, CPL_IO_DEFAULT);
121 for (i = 2; i <= next; i++) {
123 table_spect = cpl_table_load(fname_inp, i, 0);
124 xhead = cpl_propertylist_load(fname_inp, i);
125 plambda = cpl_table_get_data_double(table_spect,
"LAMBDA");
126 nrow = cpl_table_get_nrow(table_spect);
128 if (i == 2 || i == 4) {
130 for (j = 0; j < nrow; j++) {
131 w = nm2AA * plambda[j];
134 wair = w / (c1 + c2 / w2 + c4 / w4 );
135 plambda[j] = wair / nm2AA;
139 xsh_msg(
"save out tab on file %s",fname_out);
140 check(cpl_table_save(table_spect, xhead, NULL, fname_out, CPL_IO_EXTEND));
153 if (cpl_error_get_code() != CPL_ERROR_NONE) {
int main()
Unit test of xsh_bspline_interpol.
#define xsh_error_dump(level)
#define xsh_msg(...)
Print a message on info level.
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
int xsh_debug_level_set(int level)
set debug level
void xsh_free_table(cpl_table **t)
Deallocate a table and set the pointer to NULL.
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
#define TESTS_INIT(DRL_ID)