Changeset 42699
- Timestamp:
- Jun 24, 2024, 9:16:02 AM (2 years ago)
- Location:
- branches/eam_branches/ipp-20230313/ippTools
- Files:
-
- 1 added
- 6 edited
-
share/Makefile.am (modified) (1 diff)
-
share/xcstacktool_addbyquery_select.sql (modified) (1 diff)
-
share/xcstacktool_definebyquery_select.sql (modified) (1 diff)
-
share/xcstacktool_definebyquery_select_XC.sql (added)
-
src/staticskytool.c (modified) (1 diff)
-
src/xcfftool.c (modified) (2 diffs)
-
src/xcstacktool.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20230313/ippTools/share/Makefile.am
r42596 r42699 556 556 fpcamtool_revertupdatedexp.sql \ 557 557 xcstacktool_definebyquery_select.sql \ 558 xcstacktool_definebyquery_select_XC.sql \ 558 559 xcstacktool_addbyquery_select.sql \ 559 560 xcstacktool_addcamera.sql \ -
branches/eam_branches/ipp-20230313/ippTools/share/xcstacktool_addbyquery_select.sql
r42541 r42699 26 26 ) AS TMP 27 27 LEFT JOIN xcstackInputSkyfile 28 ON (TMP. stack_id = xcstackInputSkyfile.stack_id)28 ON (TMP.xcstack_id = xcstackInputSkyfile.xcstack_id) 29 29 AND (camera_id = %d) 30 30 WHERE xcstackInputSkyfile.xcstack_id IS NULL -
branches/eam_branches/ipp-20230313/ippTools/share/xcstacktool_definebyquery_select.sql
r42541 r42699 5 5 xcstack_id, 6 6 stackRun.stack_id, 7 tess_id,8 s kycell_id,9 filter7 stackRun.tess_id, 8 stackRun.skycell_id, 9 stackRun.filter 10 10 FROM %s.stackRun 11 11 JOIN %s.stackSumSkyfile USING (stack_id) 12 LEFT JOIN xcstackInputSkyfile 13 ON (stackRun.stack_id = xcstackInputSkyfile.stack_id) 14 AND (xcstackInputSkyfile.camera_id = %d) 15 WHERE xcstack_id IS NULL 12 LEFT JOIN 13 -
branches/eam_branches/ipp-20230313/ippTools/src/staticskytool.c
r38561 r42699 1061 1061 PXOPT_COPY_S64(config->args, whereMD, "-select_sky_id", "staticskyRun.sky_id", "=="); 1062 1062 PXOPT_COPY_S64(config->args, whereMD, "-select_stack_id", "stackRun.stack_id", "=="); 1063 PXOPT_COPY_STR(config->args, whereMD, "-select_skycell_id", "stackRun.skycell_id", "==");1064 1063 PXOPT_COPY_STR(config->args, whereMD, "-select_tess_id", "stackRun.tess_id", "=="); 1064 PXOPT_COPY_STR(config->args, whereMD, "-select_skycell_id", "stackRun.skycell_id", "LIKE"); 1065 1065 pxAddLabelSearchArgs(config, whereMD, "-select_filter", "stackRun.filter", "LIKE"); 1066 1066 PXOPT_COPY_F32(config->args, whereMD, "-select_good_frac_min", "stackSumSkyfile.good_frac", ">="); -
branches/eam_branches/ipp-20230313/ippTools/src/xcfftool.c
r42597 r42699 180 180 PXOPT_COPY_S64(config->args, warpWhereMD, "-select_warp_id", "warpRun.warp_id", "=="); 181 181 PXOPT_COPY_F32(config->args, warpWhereMD, "-select_good_frac_min", "warpSkyfile.good_frac", ">="); 182 // XXX is is really necessary to limit the warps?182 // it is necessary to limit the warps otherwise the warpQueryTemplate (line 282) will be ill-formed 183 183 if (!psListLength(warpWhereMD->list)) { 184 184 psError(PXTOOLS_ERR_CONFIG, false, "warp search parameters are required"); … … 279 279 psString warpQueryTemplate = pxDataGet("xcfftool_definebyquery_select_warps.sql"); 280 280 281 // note the GROUP BY: if warpWhereMD is empty, this contruction 282 // will yield nonsense 281 283 whereClause = psDBGenerateWhereConditionSQL(warpWhereMD, NULL); 282 psStringAppend(&warpQueryTemplate, "\n AND %s ", whereClause);284 psStringAppend(&warpQueryTemplate, "\n AND %s GROUP BY warp_id", whereClause); 283 285 284 286 for (long i = 0; i < output->n; i++) { -
branches/eam_branches/ipp-20230313/ippTools/src/xcstacktool.c
r42541 r42699 139 139 PXOPT_LOOKUP_TIME(registered, config->args, "-set_registered", false, false); 140 140 141 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 142 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 143 144 // we want to be able to queue the same input stacks for multiple output xcstackRuns, 145 // but we do not want to duplicate entries which already exist for the same 146 // label & data_group (or just data_group??). 147 148 // the possible input stacks are matched to already existing xcstacks with the same 149 // label & data_group and only ones which do NOT match (xcstack_id is NULL) are queued. 150 151 // In order to speed the query operations, the possible matched xcstacks are selected 152 // based on the tess_id, skycell_id, data_group restrictions supplied 153 154 // SUBSET TABLE SQL statement: 155 156 psMetadata *where_XC = psMetadataAlloc(); 157 158 // also restrict the possible matched xcstackRuns based on these options: 159 pxAddLabelSearchArgs(config, where_XC, "-select_tess_id", "xcstackRun.tess_id", "=="); 160 pxAddLabelSearchArgs(config, where_XC, "-select_skycell_id", "xcstackRun.skycell_id", "LIKE"); 161 162 // generate the xcstackRun clause 163 if (!psListLength(where_XC->list)) { 164 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required (at least tess_id or skycell_id)"); 165 psFree(where_XC); 166 return false; 167 } 168 169 psString select_XC = pxDataGet("xcstacktool_definebyquery_select_XC.sql"); 170 if (!select_XC) { 171 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 172 psFree(where_XC); 173 return false; 174 } 175 176 psString whereClause_XC = psDBGenerateWhereConditionSQL(where_XC, NULL); 177 psStringAppend(&select_XC, " WHERE (xcstackInputSkyfile.camera_id = %d)\n AND %s", (int) camera_id, whereClause_XC); 178 psFree(whereClause_XC); 179 180 // add restrictions based on the output data_group and label 181 if (label) { psStringAppend(&select_XC, "\n AND (xcstackRun.label LIKE '%s')", label); } 182 if (data_group) { psStringAppend(&select_XC, "\n AND (xcstackRun.data_group LIKE '%s')", data_group); } 183 184 psFree(where_XC); 185 186 // MAIN SQL statement: 187 141 188 psMetadata *where = psMetadataAlloc(); 142 189 143 pxAddLabelSearchArgs (config, where, "-select_stack_id", "stackRun.stack_id", "=="); 190 // restrict the input stackRun based on these options: 191 pxAddLabelSearchArgs(config, where, "-select_stack_id", "stackRun.stack_id", "=="); 144 192 pxAddLabelSearchArgs(config, where, "-select_tess_id", "stackRun.tess_id", "=="); 145 193 pxAddLabelSearchArgs(config, where, "-select_skycell_id", "stackRun.skycell_id", "LIKE"); … … 150 198 PXOPT_COPY_F32(config->args, where, "-select_good_frac_min", "stackSumSkyfile.good_frac", ">="); 151 199 pxAddLabelSearchArgs(config, where, "-select_data_group", "stackRun.data_group", "LIKE"); 152 153 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);154 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);155 200 156 201 if (!psListLength(where->list)) { 157 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required ");202 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required (at least tess_id or skycell_id)"); 158 203 psFree(where); 159 204 return false; … … 167 212 } 168 213 169 if (psListLength(where->list)) { 170 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 171 psStringAppend(&select, " AND %s", whereClause); 172 psFree(whereClause); 173 } 214 // merge base select and select_XC 215 psStringAppend (&select, "(%s)\n AS xcstackRunData\n ON (stackRun.stack_id = xcstackRunData.stack_id)\n WHERE xcstack_id IS NULL", select_XC); 216 psFree (select_XC); 217 218 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 219 psStringAppend(&select, "\n AND %s", whereClause); 220 psFree(whereClause); 174 221 psFree(where); 175 222 176 223 // camera name is prepended to stackRun and stackSumSkyfile tables in query 177 if (!p_psDBRunQueryF(config->dbh, select, camera, camera , camera_id)) {224 if (!p_psDBRunQueryF(config->dbh, select, camera, camera)) { 178 225 psError(PS_ERR_UNKNOWN, false, "database error"); 179 226 psFree(select); … … 268 315 xcstackRunRow *run = xcstackRunRowAlloc( 269 316 0, // ID 270 " new",// state317 "wait", // state 271 318 workdir, 272 319 label,
Note:
See TracChangeset
for help on using the changeset viewer.
