Changeset 16170 for trunk/ippTools/src/flatcorr.c
- Timestamp:
- Jan 20, 2008, 3:48:37 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/flatcorr.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/flatcorr.c
r15765 r16170 84 84 85 85 86 #define ADDRENAMEPARAMSTR(from, to, oldname, newname, comment) \87 { \88 bool status = false; \89 psString str = psMetadataLookupStr(&status, from, "-" oldname); \90 if (!status) { \91 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -" oldname); \92 return false; \93 } \94 if (str) { \95 if (!psMetadataAddStr(to, PS_LIST_TAIL, newname, PS_META_DUPLICATE_OK, comment, str)) { \96 psError(PS_ERR_UNKNOWN, false, "failed to add item " newname); \97 psFree(to); \98 return false; \99 } \100 } \101 }102 103 #define ADDPARAMSTR(from, to, name) \104 ADDRENAMEPARAMSTR(from, to, name, name, "==")105 106 #define ADDRENAMEPARAMF(from, to, type, oldname, newname, comment) \107 { \108 bool status = false; \109 ps##type var = psMetadataLookup##type(&status, from, "-" oldname); \110 if (!status) { \111 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -" oldname); \112 return false; \113 } \114 if (!isnan(var)) { \115 if (!psMetadataAdd##type(to, PS_LIST_TAIL, newname, PS_META_DUPLICATE_OK, comment, var)) { \116 psError(PS_ERR_UNKNOWN, false, "failed to add item " newname); \117 psFree(to); \118 return false; \119 } \120 } \121 }122 123 #define ADDPARAMF(from, to, type, name) \124 ADDRENAMEPARAMF(from, to, type, name, name, "==")125 126 86 static bool newrunMode(pxConfig *config) 127 87 { 128 88 PS_ASSERT_PTR_NON_NULL(config, false); 89 90 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false); 129 91 130 92 psMetadata *where = psMetadataAlloc(); 131 93 // convert exp_id into a psS64 132 { 133 bool status = false; 134 psString var = psMetadataLookupStr(&status, config->args, "-exp_id"); 135 if (!status) { 136 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id"); 137 return false; 138 } 139 if (var) { 140 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(var))) { 94 if (exp_id) { 95 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) { 141 96 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 142 97 psFree(where); … … 144 99 } 145 100 } 146 } 147 ADDPARAMSTR(config->args, where, "exp_name");148 ADDRENAMEPARAMSTR(config->args, where, "inst", "camera", "==");149 ADDPARAMSTR(config->args, where, "telescope");150 ADDPARAMSTR(config->args, where, "dateobs_begin");151 ADDPARAMSTR(config->args, where, "dateobs_end");152 ADDPARAMSTR(config->args, where, "exp_tag");153 ADDPARAMSTR(config->args, where, "exp_type");154 ADDPARAMSTR(config->args, where, "filelevel");155 ADDPARAMSTR(config->args, where, "reduction");156 ADDPARAMSTR(config->args, where, "filter");157 ADDRENAMEPARAMF(config->args, where, F64, "airmass_min", "airmass", ">=");158 ADDRENAMEPARAMF(config->args, where, F64, "airmass_max", "airmass", "<");159 ADDRENAMEPARAMF(config->args, where, F64, "ra_min", "ra", ">=");160 ADDRENAMEPARAMF(config->args, where, F64, "ra_max", "ra", "<");161 ADDRENAMEPARAMF(config->args, where, F64, "decl_min", "decl", ">=");162 ADDRENAMEPARAMF(config->args, where, F64, "decl_max", "decl", "<");163 ADDRENAMEPARAMF(config->args, where, F32, "exp_time_min", "exp_time", ">=");164 ADDRENAMEPARAMF(config->args, where, F32, "exp_time_max", "exp_time", "<");165 ADDRENAMEPARAMF(config->args, where, F32, "sat_pixel_frac_min", "sat_pixel_frac", ">=");166 ADDRENAMEPARAMF(config->args, where, F32, "sat_pixel_frac_max", "sat_pixel_frac", "<");167 ADDRENAMEPARAMF(config->args, where, F64, "bg_min", "bt", ">=");168 ADDRENAMEPARAMF(config->args, where, F64, "bg_max", "bt", "<");169 ADDRENAMEPARAMF(config->args, where, F64, "bg_stdev_min", "bg_stdev", ">=");170 ADDRENAMEPARAMF(config->args, where, F64, "bg_stdev_max", "bg_stdev", "<");171 ADDRENAMEPARAMF(config->args, where, F64, "bg_mean_stdev_min", "bg_mean_stdev", ">=");172 ADDRENAMEPARAMF(config->args, where, F64, "bg_mean_stdev_max", "bg_mean_stdev", "<");173 ADDRENAMEPARAMF(config->args, where, F64, "alt_min", "alt", ">=");174 ADDRENAMEPARAMF(config->args, where, F64, "alt_max", "alt", "<");175 ADDRENAMEPARAMF(config->args, where, F64, "az_min", "az", ">=");176 ADDRENAMEPARAMF(config->args, where, F64, "az_max", "az", "<");177 ADDRENAMEPARAMF(config->args, where, F32, "ccd_temp_min", "ccd_temp", ">=");178 ADDRENAMEPARAMF(config->args, where, F32, "ccd_temp_max", "ccd_temp", "<");179 ADDRENAMEPARAMF(config->args, where, F64, "posang_min", "posang", ">=");180 ADDRENAMEPARAMF(config->args, where, F64, "posang_max", "posang", "<");181 ADDPARAMSTR(config->args, where, "object");182 ADDRENAMEPARAMF(config->args, where, F32, "solang_min", "solang", ">=");183 ADDRENAMEPARAMF(config->args, where, F32, "solang_max", "solang", "<");101 102 PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "=="); 103 PXOPT_COPY_STR(config->args, where, "-inst", "camera", "=="); 104 PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "=="); 105 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs", ">="); 106 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<="); 107 PXOPT_COPY_STR(config->args, where, "-exp_tag", "exp_tag", "=="); 108 PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "=="); 109 PXOPT_COPY_STR(config->args, where, "-filelevel", "filelvel", "=="); 110 PXOPT_COPY_STR(config->args, where, "-reduction", "reduction", "=="); 111 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 112 PXOPT_COPY_F64(config->args, where, "-airmass_min", "airmass", ">="); 113 PXOPT_COPY_F64(config->args, where, "-airmass_max", "airmass", "<"); 114 PXOPT_COPY_F64(config->args, where, "-ra_min", "ra", ">="); 115 PXOPT_COPY_F64(config->args, where, "-ra_max", "ra", "<"); 116 PXOPT_COPY_F64(config->args, where, "-decl_min", "decl", ">="); 117 PXOPT_COPY_F64(config->args, where, "-decl_max", "decl", "<"); 118 PXOPT_COPY_F32(config->args, where, "-exp_time_min", "exp_time", ">="); 119 PXOPT_COPY_F32(config->args, where, "-exp_time_max", "exp_time", "<"); 120 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_min", "sat_pixel_frac", ">="); 121 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_max", "sat_pixel_frac", "<"); 122 PXOPT_COPY_F64(config->args, where, "-bg_min", "bt", ">="); 123 PXOPT_COPY_F64(config->args, where, "-bg_max", "bt", "<"); 124 PXOPT_COPY_F64(config->args, where, "-bg_stdev_min", "bg_stdev", ">="); 125 PXOPT_COPY_F64(config->args, where, "-bg_stdev_max", "bg_stdev", "<"); 126 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_min", "bg_mean_stdev", ">="); 127 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_max", "bg_mean_stdev", "<"); 128 PXOPT_COPY_F64(config->args, where, "-alt_min", "alt", ">="); 129 PXOPT_COPY_F64(config->args, where, "-alt_max", "alt", "<"); 130 PXOPT_COPY_F64(config->args, where, "-az_min", "az", ">="); 131 PXOPT_COPY_F64(config->args, where, "-az_max", "az", "<"); 132 PXOPT_COPY_F32(config->args, where, "-ccd_temp_min", "ccd_temp", ">="); 133 PXOPT_COPY_F32(config->args, where, "-ccd_temp_max", "ccd_temp", "<"); 134 PXOPT_COPY_F64(config->args, where, "-posang_min", "posang", ">="); 135 PXOPT_COPY_F64(config->args, where, "-posang_max", "posang", "<"); 136 PXOPT_COPY_STR(config->args, where, "-object", "object", "=="); 137 PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">="); 138 PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<"); 184 139 185 140 if (where->list->n < 1) { … … 188 143 } 189 144 190 bool status = false; 191 psString workdir = psMetadataLookupStr(&status, config->args, "-set_workdir"); 192 if (!status) { 193 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_workdir"); 194 return false; 195 } 196 197 psString label = psMetadataLookupStr(&status, config->args, "-set_label"); 198 if (!status) { 199 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_label"); 200 return false; 201 } 202 203 psString reduction = psMetadataLookupStr(&status, config->args, "-set_reduction"); 204 if (!status) { 205 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_reduction"); 206 return false; 207 } 208 209 psString expgroup = psMetadataLookupStr(&status, config->args, "-set_expgroup"); 210 if (!status) { 211 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_expgroup"); 212 return false; 213 } 214 215 psString dvodb = psMetadataLookupStr(&status, config->args, "-set_dvodb"); 216 if (!status) { 217 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_dvodb"); 218 return false; 219 } 145 PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", false, false); 146 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 147 PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false); 148 PXOPT_LOOKUP_STR(expgroup, config->args, "-set_expgroup", false, false); 149 PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", false, false); 150 PXOPT_LOOKUP_STR(tess_id, config->args, "-set_tess_id", false, false); 151 PXOPT_LOOKUP_STR(end_stage, config->args, "-set_end_stage", false, false); 220 152 221 153 // find the exp_id of all the exposures that we want to queue up. … … 282 214 psMetadata *md = output->data[i]; 283 215 216 bool status; 284 217 psS64 exp_id = psMetadataLookupS64(&status, md, "exp_id"); 285 218 if (!status) { … … 293 226 294 227 // queue the exp 295 psS64 chip_id = pxchipQueueByExpTag(config, exp_id, workdir, label, reduction, expgroup, dvodb );228 psS64 chip_id = pxchipQueueByExpTag(config, exp_id, workdir, label, reduction, expgroup, dvodb, tess_id, end_stage); 296 229 if (!chip_id) { 297 230 if (!psDBRollback(config->dbh)) { … … 339 272 { 340 273 PS_ASSERT_PTR_NON_NULL(config, false); 274 275 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 341 276 342 277 // create a temp table to hold completely processed chipRuns … … 408 343 } 409 344 410 bool simple = false;411 {412 bool status = false;413 simple = psMetadataLookupBool(&status, config->args, "-simple");414 if (!status) {415 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");416 return false;417 }418 }419 420 345 if (psArrayLength(output)) { 421 346 // negative simple so the default is true … … 437 362 PS_ASSERT_PTR_NON_NULL(config, false); 438 363 439 440 bool status = false; 441 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 442 if (!status) { 443 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 444 return false; 445 } 364 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 365 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 446 366 447 367 // find all rawImfiles matching the default query … … 492 412 } 493 413 494 bool simple = false;495 {496 bool status = false;497 simple = psMetadataLookupBool(&status, config->args, "-simple");498 if (!status) { psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");499 return false;500 }501 }502 503 414 if (psArrayLength(output)) { 504 415 if (!convertIdToStr(output)) { … … 526 437 PS_ASSERT_PTR_NON_NULL(config, false); 527 438 528 bool status = false; 529 psString corr_id = psMetadataLookupStr(&status, config->args, "-corr_id"); 530 if (!status) { 531 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -corr_id"); 532 return false; 533 } 534 535 psString stats = psMetadataLookupStr(&status, config->args, "-stats"); 536 if (!status) { 537 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -stats"); 538 return false; 539 } 439 PXOPT_LOOKUP_STR(corr_id, config->args, "-corr_id", true, false); 440 PXOPT_LOOKUP_STR(stats, config->args, "-stats", true, false); 540 441 541 442 if (!psDBTransaction(config->dbh)) {
Note:
See TracChangeset
for help on using the changeset viewer.
