Changeset 14227
- Timestamp:
- Jul 16, 2007, 11:56:49 AM (19 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 4 edited
-
share/camtool_find_chip_id.sql (modified) (1 diff)
-
src/camtool.c (modified) (9 diffs)
-
src/camtoolConfig.c (modified) (2 diffs)
-
src/chiptoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/camtool_find_chip_id.sql
r14031 r14227 1 -- this query is used by both camtool -pendingexp & camtool -addprocessedexp it2 -- does a little more work then is necessary for -addprocessed but it seems3 -- "cleaner" to use the same query for both cases4 1 SELECT 5 2 * 6 3 FROM 7 4 (SELECT DISTINCT 8 chipRun.* 5 chipRun.*, 6 rawExp.camera, 7 rawExp.telescope, 8 rawExp.dateobs, 9 rawExp.exp_tag, 10 rawExp.exp_type, 11 rawExp.filelevel, 12 rawExp.filter, 13 rawExp.airmass, 14 rawExp.ra, 15 rawExp.decl, 16 rawExp.exp_time, 17 rawExp.sat_pixel_frac, 18 rawExp.bg, 19 rawExp.bg_stdev, 20 rawExp.bg_mean_stdev, 21 rawExp.alt, 22 rawExp.az, 23 rawExp.ccd_temp, 24 rawExp.posang, 25 rawExp.object, 26 rawExp.solang 9 27 FROM chipRun 28 JOIN rawExp 29 using(exp_id) 10 30 WHERE 11 31 chipRun.state = 'stop') as Foo -
trunk/ippTools/src/camtool.c
r14147 r14227 89 89 } 90 90 91 92 #define ADDPARAMSTR(from, to, name) \ 91 #define ADDRENAMEPARAMSTR(from, to, oldname, newname, comment) \ 93 92 { \ 94 93 bool status = false; \ 95 psString str = psMetadataLookupStr(&status, from, "-" name); \94 psString str = psMetadataLookupStr(&status, from, "-" oldname); \ 96 95 if (!status) { \ 97 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -" name); \96 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -" oldname); \ 98 97 return false; \ 99 98 } \ 100 99 if (str) { \ 101 if (!psMetadataAddStr(to, PS_LIST_TAIL, n ame, 0, "==", str)) { \102 psError(PS_ERR_UNKNOWN, false, "failed to add item " n ame); \100 if (!psMetadataAddStr(to, PS_LIST_TAIL, newname, PS_META_DUPLICATE_OK, comment, str)) { \ 101 psError(PS_ERR_UNKNOWN, false, "failed to add item " newname); \ 103 102 psFree(to); \ 104 103 return false; \ … … 107 106 } 108 107 109 110 #define ADDPARAMF(from, to, type, name) \ 108 #define ADDPARAMSTR(from, to, name) \ 109 ADDRENAMEPARAMSTR(from, to, name, name, "==") 110 111 #define ADDRENAMEPARAMF(from, to, type, oldname, newname, comment) \ 111 112 { \ 112 113 bool status = false; \ 113 ps##type var = psMetadataLookup##type(&status, from, "-" name); \114 ps##type var = psMetadataLookup##type(&status, from, "-" oldname); \ 114 115 if (!status) { \ 115 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -" name); \116 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -" oldname); \ 116 117 return false; \ 117 118 } \ 118 119 if (!isnan(var)) { \ 119 if (!psMetadataAdd##type(to, PS_LIST_TAIL, #name, 0, "==", var)) { \120 psError(PS_ERR_UNKNOWN, false, "failed to add item " n ame); \120 if (!psMetadataAdd##type(to, PS_LIST_TAIL, newname, PS_META_DUPLICATE_OK, comment, var)) { \ 121 psError(PS_ERR_UNKNOWN, false, "failed to add item " newname); \ 121 122 psFree(to); \ 122 123 return false; \ … … 125 126 } 126 127 128 #define ADDPARAMF(from, to, type, name) \ 129 ADDRENAMEPARAMF(from, to, type, name, name, "==") 130 127 131 static bool queueMode(pxConfig *config) 128 132 { … … 130 134 131 135 psMetadata *where = psMetadataAlloc(); 136 // convert chip_id into a psS64 132 137 { 133 138 bool status = false; … … 145 150 } 146 151 } 147 148 ADDPARAMSTR(config->args, where, "exp_id"); 152 // convert exp_id into a psS64 153 { 154 bool status = false; 155 psString var = psMetadataLookupStr(&status, config->args, "-exp_id"); 156 if (!status) { 157 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id"); 158 return false; 159 } 160 if (var) { 161 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(var))) { 162 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 163 psFree(where); 164 return false; 165 } 166 } 167 } 149 168 ADDPARAMSTR(config->args, where, "exp_name"); 150 ADD PARAMSTR(config->args, where, "inst");169 ADDRENAMEPARAMSTR(config->args, where, "inst", "camera", "=="); 151 170 ADDPARAMSTR(config->args, where, "telescope"); 152 ADDPARAMSTR(config->args, where, "dateobs"); 171 ADDPARAMSTR(config->args, where, "dateobs_begin"); 172 ADDPARAMSTR(config->args, where, "dateobs_end"); 173 ADDPARAMSTR(config->args, where, "exp_tag"); 153 174 ADDPARAMSTR(config->args, where, "exp_type"); 154 ADDPARAMSTR(config->args, where, " imfiles");155 ADDPARAMSTR(config->args, where, " workdir");175 ADDPARAMSTR(config->args, where, "filelevel"); 176 ADDPARAMSTR(config->args, where, "reduction"); 156 177 ADDPARAMSTR(config->args, where, "filter"); 157 ADDPARAMF(config->args, where, F32, "airmass"); 158 ADDPARAMF(config->args, where, F32, "ra"); 159 ADDPARAMF(config->args, where, F32, "decl"); 160 ADDPARAMF(config->args, where, F32, "exp_time"); 161 ADDPARAMF(config->args, where, F64, "bg"); 162 ADDPARAMF(config->args, where, F64, "bg_stdev"); 163 ADDPARAMF(config->args, where, F64, "bg_mean_stdev"); 164 ADDPARAMF(config->args, where, F64, "alt"); 165 ADDPARAMF(config->args, where, F64, "az"); 166 ADDPARAMF(config->args, where, F32, "ccd_temp"); 167 ADDPARAMF(config->args, where, F64, "posang"); 178 ADDRENAMEPARAMF(config->args, where, F64, "airmass_min", "airmass", ">="); 179 ADDRENAMEPARAMF(config->args, where, F64, "airmass_max", "airmass", "<"); 180 ADDRENAMEPARAMF(config->args, where, F64, "ra_min", "ra", ">="); 181 ADDRENAMEPARAMF(config->args, where, F64, "ra_max", "ra", "<"); 182 ADDRENAMEPARAMF(config->args, where, F64, "decl_min", "decl", ">="); 183 ADDRENAMEPARAMF(config->args, where, F64, "decl_max", "decl", "<"); 184 ADDRENAMEPARAMF(config->args, where, F32, "exp_time_min", "exp_time", ">="); 185 ADDRENAMEPARAMF(config->args, where, F32, "exp_time_max", "exp_time", "<"); 186 ADDRENAMEPARAMF(config->args, where, F32, "sat_pixel_frac_min", "sat_pixel_frac", ">="); 187 ADDRENAMEPARAMF(config->args, where, F32, "sat_pixel_frac_max", "sat_pixel_frac", "<"); 188 ADDRENAMEPARAMF(config->args, where, F64, "bg_min", "bt", ">="); 189 ADDRENAMEPARAMF(config->args, where, F64, "bg_max", "bt", "<"); 190 ADDRENAMEPARAMF(config->args, where, F64, "bg_stdev_min", "bg_stdev", ">="); 191 ADDRENAMEPARAMF(config->args, where, F64, "bg_stdev_max", "bg_stdev", "<"); 192 ADDRENAMEPARAMF(config->args, where, F64, "bg_mean_stdev_min", "bg_mean_stdev", ">="); 193 ADDRENAMEPARAMF(config->args, where, F64, "bg_mean_stdev_max", "bg_mean_stdev", "<"); 194 ADDRENAMEPARAMF(config->args, where, F64, "alt_min", "alt", ">="); 195 ADDRENAMEPARAMF(config->args, where, F64, "alt_max", "alt", "<"); 196 ADDRENAMEPARAMF(config->args, where, F64, "az_min", "az", ">="); 197 ADDRENAMEPARAMF(config->args, where, F64, "az_max", "az", "<"); 198 ADDRENAMEPARAMF(config->args, where, F32, "ccd_temp_min", "ccd_temp", ">="); 199 ADDRENAMEPARAMF(config->args, where, F32, "ccd_temp_max", "ccd_temp", "<"); 200 ADDRENAMEPARAMF(config->args, where, F64, "posang_min", "posang", ">="); 201 ADDRENAMEPARAMF(config->args, where, F64, "posang_max", "posang", "<"); 168 202 ADDPARAMSTR(config->args, where, "object"); 203 ADDRENAMEPARAMF(config->args, where, F32, "solang_min", "solang", ">="); 204 ADDRENAMEPARAMF(config->args, where, F32, "solang_max", "solang", "<"); 169 205 170 206 if (where->list->n < 1) { … … 204 240 } 205 241 206 // find the chipProcessedExp exposures that we want to queue up. 207 // psString query = psStringCopy("SELECT * FROM chipRun WHERE chipRun.state = 'stop'"); 242 // find the exp_id of all the exposures that we want to queue up. 208 243 psString query = pxDataGet("camtool_find_chip_id.sql"); 209 244 if (!query) { … … 213 248 214 249 if (where) { 215 psString whereClause = psDBGenerateWhere SQL(where, "");250 psString whereClause = psDBGenerateWhereConditionSQL(where, ""); 216 251 psFree(where); 217 psStringAppend(&query, " %s", whereClause);252 psStringAppend(&query, " AND %s", whereClause); 218 253 psFree(whereClause); 219 254 } … … 232 267 } 233 268 if (!psArrayLength(output)) { 234 psTrace("c hiptool", PS_LOG_INFO, "no rows found");269 psTrace("camtool", PS_LOG_INFO, "no rows found"); 235 270 psFree(output); 236 271 return true; 237 272 } 238 273 274 // start a transaction so we don't end up with an exp without any associted 275 // imfiles 239 276 if (!psDBTransaction(config->dbh)) { 240 277 psError(PS_ERR_UNKNOWN, false, "database error"); … … 248 285 // old values in place (i.e., passing the values through). 249 286 250 // loop over our list of chip ProcessedExprows287 // loop over our list of chipRun rows 251 288 for (long i = 0; i < psArrayLength(output); i++) { 252 289 psMetadata *md = output->data[i]; -
trunk/ippTools/src/camtoolConfig.c
r14119 r14227 48 48 // -queue 49 49 psMetadata *queueArgs = psMetadataAlloc(); 50 // XXX need to allow multiple chip_ids 50 51 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-chip_id", 0, 51 52 "search by chip_id", NULL); 53 // XXX need to allow multiple exp_ids 52 54 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_id", 0, 53 55 "search by exp_id", NULL); … … 55 57 "search by exp_name", NULL); 56 58 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-inst", 0, 57 "search bycamera", NULL);59 "search for camera", NULL); 58 60 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-telescope", 0, 59 "search by telescope", NULL); 60 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-dateobs", 0, 61 "search by observation time", NULL); 61 "search for telescope", NULL); 62 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-dateobs_begin", 0, 63 "search for exposures by time (>=)", NULL); 64 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-dateobs_end", 0, 65 "search for exposures by time (<)", NULL); 66 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_tag", 0, 67 "search by exp_tag", NULL); 62 68 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_type", 0, 63 "search by exp osuretype", NULL);64 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "- imfiles", 0,65 "search by number of imfiles", NULL);66 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "- workdir", 0,67 "search by workdir", NULL);69 "search by exp_type", NULL); 70 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-filelevel", 0, 71 "search by filelevel", NULL); 72 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-reduction", 0, 73 "search by reduction class", NULL); 68 74 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-filter", 0, 69 "search by filter ", NULL); 70 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-airmass", 0, 71 "search by airmass", NAN); 72 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-ra", 0, 73 "search by RA", NAN); 74 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-decl", 0, 75 "search by DEC", NAN); 76 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-exp_time", 0, 77 "search by exposure time", NAN); 78 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-bg", 0, 79 "search by exposure background", NAN); 80 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-bg_stdev", 0, 81 "search by exposure background stdev", NAN); 82 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-bg_mean_stdev", 0, 83 "search by exposure background mean stdev", NAN); 84 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-alt", 0, 85 "search by altitute", NAN); 86 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-az", 0, 87 "search by azimuth", NAN); 88 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-ccd_temp", 0, 89 "search by ccd tempature", NAN); 90 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-posang", 0, 91 "search by rotator position angle", NAN); 75 "search for filter", NULL); 76 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-airmass_min", 0, 77 "define min airmass", NAN); 78 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-airmass_max", 0, 79 "define max airmass", NAN); 80 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-ra_min", 0, 81 "define min", NAN); 82 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-ra_max", 0, 83 "define max", NAN); 84 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-decl_min", 0, 85 "define min", NAN); 86 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-decl_max", 0, 87 "define max", NAN); 88 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-exp_time_min", 0, 89 "define min", NAN); 90 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-exp_time_max", 0, 91 "define max", NAN); 92 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-sat_pixel_frac_min", 0, 93 "define max fraction of saturated pixels", NAN); 94 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-sat_pixel_frac_max", 0, 95 "define min fraction of saturated pixels", NAN); 96 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-bg_min", 0, 97 "define max", NAN); 98 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-bg_max", 0, 99 "define max", NAN); 100 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-bg_stdev_min", 0, 101 "define max", NAN); 102 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-bg_stdev_max", 0, 103 "define max", NAN); 104 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-bg_mean_stdev_min", 0, 105 "define max", NAN); 106 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-bg_mean_stdev_max", 0, 107 "define max", NAN); 108 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-alt_min", 0, 109 "define min", NAN); 110 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-alt_max", 0, 111 "define max", NAN); 112 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-az_min", 0, 113 "define min", NAN); 114 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-az_max", 0, 115 "define max", NAN); 116 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-ccd_temp_min", 0, 117 "define min ccd tempature", NAN); 118 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-ccd_temp_max", 0, 119 "define max ccd tempature", NAN); 120 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-posang_min", 0, 121 "define min rotator position angle", NAN); 122 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-posang_max", 0, 123 "define max rotator position angle", NAN); 92 124 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-object", 0, 93 125 "search by exposure object", NULL); 126 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-solang_min", 0, 127 "define min solar angle", NAN); 128 psMetadataAddF32(queueArgs, PS_LIST_TAIL, "-solang_max", 0, 129 "define max solar angle", NAN); 94 130 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_workdir", 0, 95 131 "define workdir", NULL); -
trunk/ippTools/src/chiptoolConfig.c
r14218 r14227 46 46 // -queue 47 47 psMetadata *queueArgs = psMetadataAlloc(); 48 // XXX need to allow multiple exp_ids 48 49 psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_id", 0, 49 50 "search by exp_id", NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
