Changeset 19106
- Timestamp:
- Aug 17, 2008, 2:57:11 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/stacktool.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/stacktool.c
r19092 r19106 105 105 PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false); 106 106 107 psMetadata *whereRE = psMetadataAlloc(); // rawExp where 108 psMetadata *whereWSF = psMetadataAlloc(); // warpSkyfile where 107 psMetadata *where = psMetadataAlloc(); 109 108 psMetadata *having = psMetadataAlloc(); // HAVING clause 110 // map -inst -> camera, etc 111 PXOPT_COPY_STR(config->args, whereRE, "-select_inst", "camera", "=="); 112 PXOPT_COPY_STR(config->args, whereRE, "-select_telescope", "telescope", "=="); 113 PXOPT_COPY_STR(config->args, whereRE, "-select_filter", "filter", "=="); 114 PXOPT_COPY_STR(config->args, whereRE, "-select_uri", "uri", "=="); 115 PXOPT_COPY_TIME(config->args, whereRE, "-select_dateobs_begin", "dateobs", ">="); 116 PXOPT_COPY_TIME(config->args, whereRE, "-select_dateobs_end", "dateobs", "<="); 117 PXOPT_COPY_F32(config->args, whereRE, "-select_airmass_min", "airmass", ">="); 118 PXOPT_COPY_F32(config->args, whereRE, "-select_airmass_max", "airmass", "<="); 119 PXOPT_COPY_F32(config->args, whereRE, "-select_sat_pixel_frac_max", "sat_pixel_frac", "<="); 120 PXOPT_COPY_F32(config->args, whereRE, "-select_exp_time_min", "exp_time", ">="); 121 PXOPT_COPY_F32(config->args, whereRE, "-select_exp_time_max", "exp_time", "<="); 122 PXOPT_COPY_F32(config->args, whereRE, "-select_ccd_temp_min", "ccd_temp", ">="); 123 PXOPT_COPY_F32(config->args, whereRE, "-select_ccd_temp_max", "ccd_temp", "<="); 124 PXOPT_COPY_F32(config->args, whereRE, "-select_posang_min", "posang", ">="); 125 PXOPT_COPY_F32(config->args, whereRE, "-select_posang_max", "posang", "<="); 126 PXOPT_COPY_F32(config->args, whereRE, "-select_solang_min", "solang", ">="); 127 PXOPT_COPY_F32(config->args, whereRE, "-select_solang_max", "solang", "<="); 128 129 PXOPT_COPY_STR(config->args, having, "-select_skycell_id", "skycell_id", "=="); 109 110 // select based on properties of the raw exposures 111 PXOPT_COPY_STR(config->args, where, "-select_inst", "rawExp.camera", "=="); 112 PXOPT_COPY_STR(config->args, where, "-select_telescope", "rawExp.telescope", "=="); 113 PXOPT_COPY_STR(config->args, where, "-select_filter", "rawExp.filter", "=="); 114 PXOPT_COPY_STR(config->args, where, "-select_uri", "rawExp.uri", "=="); 115 PXOPT_COPY_TIME(config->args, where, "-select_dateobs_begin", "rawExp.dateobs", ">="); 116 PXOPT_COPY_TIME(config->args, where, "-select_dateobs_end", "rawExp.dateobs", "<="); 117 PXOPT_COPY_F32(config->args, where, "-select_airmass_min", "rawExp.airmass", ">="); 118 PXOPT_COPY_F32(config->args, where, "-select_airmass_max", "rawExp.airmass", "<="); 119 PXOPT_COPY_F32(config->args, where, "-select_sat_pixel_frac_max", "rawExp.sat_pixel_frac", "<="); 120 PXOPT_COPY_F32(config->args, where, "-select_exp_time_min", "rawExp.exp_time", ">="); 121 PXOPT_COPY_F32(config->args, where, "-select_exp_time_max", "rawExp.exp_time", "<="); 122 PXOPT_COPY_F32(config->args, where, "-select_ccd_temp_min", "rawExp.ccd_temp", ">="); 123 PXOPT_COPY_F32(config->args, where, "-select_ccd_temp_max", "rawExp.ccd_temp", "<="); 124 PXOPT_COPY_F32(config->args, where, "-select_posang_min", "rawExp.posang", ">="); 125 PXOPT_COPY_F32(config->args, where, "-select_posang_max", "rawExp.posang", "<="); 126 PXOPT_COPY_F32(config->args, where, "-select_solang_min", "rawExp.solang", ">="); 127 PXOPT_COPY_F32(config->args, where, "-select_solang_max", "rawExp.solang", "<="); 128 PXOPT_COPY_STR(config->args, where, "-select_exp_type", "rawExp.exp_type", "=="); 129 PXOPT_COPY_F32(config->args, where, "-select_good_frac_min", "warpSkyfile.good_frac", ">="); 130 PXOPT_COPY_STR(config->args, where, "-select_skycell_id", "warpSkyfile.skycell_id", "=="); 131 132 // these are used to build the HAVING restriction 130 133 PXOPT_COPY_S32(config->args, having, "-min_num", "num_warp", ">="); 131 134 132 PXOPT_LOOKUP_S32(randomLimit, config->args, "-random", false, false); 133 134 PXOPT_LOOKUP_S32(min_new, config->args, "-min_new", false, false); 135 PXOPT_LOOKUP_F32(min_frac, config->args, "-min_frac", false, false); 136 137 if (!psListLength(whereRE->list) && !psListLength(whereWSF->list) && 138 !psMetadataLookupBool(NULL, config->args, "-all")) { 139 psFree(whereRE); 140 psFree(whereWSF); 141 psError(PXTOOLS_ERR_DATA, false, "search parameters are required"); 142 return false; 143 } 144 145 // default 135 // other options applied outside of the WHERE 136 PXOPT_LOOKUP_S32(randomLimit, config->args, "-random", false, false); 137 PXOPT_LOOKUP_S32(min_new, config->args, "-min_new", false, false); 138 PXOPT_LOOKUP_F32(min_frac, config->args, "-min_frac", false, false); 139 146 140 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 147 141 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); 148 PXOPT_COPY_STR(config->args, whereRE, "-select_exp_type", "exp_type", "=="); 149 PXOPT_COPY_F32(config->args, whereWSF, "-select_good_frac_min", "good_frac", ">="); 142 143 if (!psListLength(where->list) && 144 !psMetadataLookupBool(NULL, config->args, "-all")) { 145 psFree(where); 146 psError(PXTOOLS_ERR_DATA, false, "search parameters are required"); 147 return false; 148 } 150 149 151 150 psString select = pxDataGet("stacktool_definebyquery_part1.sql"); … … 155 154 } 156 155 157 if (psListLength(where RE->list)) {158 psString whereClause = psDBGenerateWhereConditionSQL(where RE, "rawExp");156 if (psListLength(where->list)) { 157 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 159 158 psStringAppend(&select, " AND %s", whereClause); 160 159 psFree(whereClause); 161 160 } 162 psFree(whereRE); 163 164 if (psListLength(whereWSF->list)) { 165 psString whereClause = psDBGenerateWhereConditionSQL(whereWSF, "warpSkyfile"); 166 psStringAppend(&select, " AND %s", whereClause); 167 psFree(whereClause); 168 } 169 psFree(whereWSF); 161 psFree(where); 170 162 171 163 psString groupby = pxDataGet("stacktool_definebyquery_part2.sql"); … … 206 198 } 207 199 psFree(having); 208 209 200 210 201 if (!p_psDBRunQuery(config->dbh, select)) { … … 295 286 // create a new stackRun for this stack 296 287 stackRunRow *run = stackRunRowAlloc( 297 0,// ID298 "new",// state299 workdir,300 NULL,// workdir_state301 registered,302 skycell_id,303 tess_id,304 filter);288 0, // ID 289 "new", // state 290 workdir, 291 NULL, // workdir_state 292 registered, 293 skycell_id, 294 tess_id, 295 filter); 305 296 306 297 if (!stackRunInsertObject(config->dbh, run)) { … … 333 324 psFree(idString); 334 325 326 // XXX this insert uses a select to generate the list of warp_ids for the stack, 327 // we have applied a set of criteria above (WHERE) to select the relevant warps 328 // this insert needs to use exactly the same restrictions (race condition is probably not critical) 329 // the insert below seems to only restrict matches to the skycell, tess, and filter 335 330 if ((randomLimit > 0 && !p_psDBRunQuery(config->dbh, thisInsert, skycell_id, tess_id, filter, 336 331 randomLimit)) ||
Note:
See TracChangeset
for help on using the changeset viewer.
