Changeset 16105
- Timestamp:
- Jan 16, 2008, 5:28:06 PM (18 years ago)
- File:
-
- 1 edited
-
branches/end_stage/ippTools/src/detselect.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/end_stage/ippTools/src/detselect.c
r15857 r16105 71 71 } 72 72 73 #define ADDRENAMEPARAMF(from, to, type, oldname, newname, comment) \ 74 { \ 75 bool status = false; \ 76 ps##type var = psMetadataLookup##type(&status, from, oldname); \ 77 if (!status) { \ 78 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for " oldname); \ 79 return false; \ 80 } \ 81 if (!isnan(var)) { \ 82 if (!psMetadataAdd##type(to, PS_LIST_TAIL, newname, PS_META_DUPLICATE_OK, comment, var)) { \ 83 psError(PS_ERR_UNKNOWN, false, "failed to add item " newname); \ 84 psFree(to); \ 85 return false; \ 86 } \ 87 } \ 88 } 89 90 #define ADDPARAMF(from, to, type, name) \ 91 ADDRENAMEPARAMF(from, to, type, name, name, "==") 92 93 73 94 static bool searchMode(pxConfig *config) 74 95 { 75 96 PS_ASSERT_PTR_NON_NULL(config, false); 76 97 98 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 99 PXOPT_LOOKUP_BOOL(unlimit, config->args, "-unlimit", false); 100 77 101 psMetadata *where = psMetadataAlloc(); 78 102 79 103 // airmass_min < airmass < airmass_max 80 { 81 bool status = false; 82 psF32 airmass = psMetadataLookupF32(&status, config->args, "-airmass"); 83 if (!status) { 84 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -airmass"); 85 psFree(where); 86 return false; 87 } 88 89 if (!isnan(airmass)) { 90 psMetadataAddF32(where, PS_LIST_TAIL, "airmass_min", 0, "<=", airmass); 91 psMetadataAddF32(where, PS_LIST_TAIL, "airmass_max", 0, ">=", airmass); 92 } 93 } 104 ADDRENAMEPARAMF(config->args, where, F32, "-airmass", "airmass_min", "<="); 105 ADDRENAMEPARAMF(config->args, where, F32, "-airmass", "airmass_max", ">="); 94 106 95 107 // exp_time_min < exp_time < exp_time_max 96 { 97 bool status = false; 98 psF32 exp_time = psMetadataLookupF32(&status, config->args, "-exp_time"); 99 if (!status) { 100 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_time"); 101 psFree(where); 102 return false; 103 } 104 105 if (!isnan(exp_time)) { 106 psMetadataAddF32(where, PS_LIST_TAIL, "exp_time_min", 0, "<=", exp_time); 107 psMetadataAddF32(where, PS_LIST_TAIL, "exp_time_max", 0, ">=", exp_time); 108 } 109 } 108 ADDRENAMEPARAMF(config->args, where, F32, "-exp_time", "exp_time_min", "<="); 109 ADDRENAMEPARAMF(config->args, where, F32, "-exp_time", "exp_time_max", ">="); 110 110 111 111 // ccd_temp_min < ccd_temp < ccd_temp_max 112 { 113 bool status = false; 114 psF32 ccd_temp = psMetadataLookupF32(&status, config->args, "-ccd_temp"); 115 if (!status) { 116 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ccd_temp"); 117 psFree(where); 118 return false; 119 } 120 121 if (!isnan(ccd_temp)) { 122 psMetadataAddF32(where, PS_LIST_TAIL, "ccd_temp_min", 0, "<=", ccd_temp); 123 psMetadataAddF32(where, PS_LIST_TAIL, "ccd_temp_max", 0, ">=", ccd_temp); 124 } 125 } 126 127 { 128 bool status = false; 129 psF64 posang = psMetadataLookupF64(&status, config->args, "-posang"); 130 if (!status) { 131 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -posang"); 132 psFree(where); 133 return false; 134 } 135 136 if (!isnan(posang)) { 137 psMetadataAddF32(where, PS_LIST_TAIL, "posang_min", 0, "<=", posang); 138 psMetadataAddF32(where, PS_LIST_TAIL, "posang_max", 0, ">=", posang); 139 } 140 } 112 ADDRENAMEPARAMF(config->args, where, F32, "-ccd_temp", "ccd_temp_min", "<="); 113 ADDRENAMEPARAMF(config->args, where, F32, "-ccd_temp", "ccd_temp_max", ">="); 114 115 ADDRENAMEPARAMF(config->args, where, F64, "-posang", "posang_min", "<="); 116 ADDRENAMEPARAMF(config->args, where, F64, "-posang", "posang_max", ">="); 141 117 142 118 // time_begin < time < time_end … … 189 165 } 190 166 191 // we choose the single detrend image which matches all criteria and has the latest192 // insertion date167 // we choose the single detrend image which matches all criteria and has 168 // the latest insertion date 193 169 194 170 // unless explicitly specified by the user, list all possible matches 195 if (! psMetadataLookupBool(NULL, config->args, "-unlimit")) {196 psStringAppend(&query, " ORDER BY registered DESC LIMIT 1");171 if (!unlimit) { 172 psStringAppend(&query, " ORDER BY registered DESC LIMIT 1"); 197 173 } 198 174 … … 216 192 } 217 193 218 bool simple = false;219 {220 bool status = false;221 simple = psMetadataLookupBool(&status, config->args, "-simple");222 if (!status) {223 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");224 return false;225 }226 }227 228 194 // negate simple so the default is true 229 195 if (!ippdbPrintMetadatas(stdout, output, "detExp", !simple)) { … … 241 207 { 242 208 PS_ASSERT_PTR_NON_NULL(config, false); 209 210 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 243 211 244 212 psString query = pxDataGet("detselect_select.sql"); … … 274 242 } 275 243 276 bool simple = false;277 {278 bool status = false;279 simple = psMetadataLookupBool(&status, config->args, "-simple");280 if (!status) {281 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");282 return false;283 }284 }285 286 244 // negative simple so the default is true 287 245 if (!ippdbPrintMetadatas(stdout, output, "detNormalizedImfile", !simple)) {
Note:
See TracChangeset
for help on using the changeset viewer.
