Changeset 12174
- Timestamp:
- Mar 1, 2007, 4:57:45 PM (19 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 2 added
- 8 edited
-
scripts/chiptest.sh (modified) (1 diff)
-
share/Makefile.am (modified) (1 diff)
-
share/chiptool_completely_processed_exp.sql (modified) (1 diff)
-
share/chiptool_find_unprocessed_imfile.pl (modified) (1 diff)
-
share/chiptool_pendingimfile.sql (modified) (1 diff)
-
share/chiptool_queuerawexp.sql (added)
-
share/chiptool_queuerawimfile.sql (added)
-
src/chiptool.c (modified) (7 diffs)
-
src/chiptoolConfig.c (modified) (2 diffs)
-
src/regtool.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/scripts/chiptest.sh
r12131 r12174 8 8 9 9 for ID in `seq 0 3`; do 10 chiptool -addprocessedimfile -chip_id 1 -class_id $ID -uri file://chipp-t10.$ID - recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -path_base file:///foo || exit 110 chiptool -addprocessedimfile -chip_id 1 -class_id $ID -uri file://chipp-t10.$ID -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -path_base file:///foo || exit 1 11 11 done; 12 12 13 13 for ID in `seq 0 3`; do 14 chiptool -addprocessedimfile -chip_id 2 -class_id $ID -uri file://chipp-t11.$ID - recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -path_base file:///foo || exit 114 chiptool -addprocessedimfile -chip_id 2 -class_id $ID -uri file://chipp-t11.$ID -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -path_base file:///foo || exit 1 15 15 done; 16 16 -
trunk/ippTools/share/Makefile.am
r12097 r12174 9 9 regtool_find_unprocessed_imfile.sql \ 10 10 regtool_processedimfile.sql \ 11 regtool_pendingexp.sql 11 regtool_pendingexp.sql \ 12 chiptool_queuerawexp.sql -
trunk/ippTools/share/chiptool_completely_processed_exp.sql
r12096 r12174 12 12 ON chipPendingExp.exp_tag = rawExp.exp_tag 13 13 LEFT JOIN chipProcessedExp 14 ON chipPendingExp. exp_tag = chipProcessedExp.exp_tag14 ON chipPendingExp.chip_id = chipProcessedExp.chip_id 15 15 LEFT JOIN chipPendingImfile 16 ON chipPendingExp. exp_tag = chipPendingImfile.exp_tag16 ON chipPendingExp.chip_id = chipPendingImfile.chip_id 17 17 LEFT JOIN chipProcessedImfile 18 ON chipPendingExp. exp_tag = chipProcessedImfile.exp_tag18 ON chipPendingExp.chip_id = chipProcessedImfile.chip_id 19 19 WHERE 20 chipProcessedExp. exp_tagIS NULL21 AND chipPendingImfile. exp_tagIS NULL22 AND chipProcessedImfile. exp_tagIS NOT NULL20 chipProcessedExp.chip_id IS NULL 21 AND chipPendingImfile.chip_id IS NULL 22 AND chipProcessedImfile.chip_id IS NOT NULL 23 23 GROUP BY 24 chipPendingExp. exp_tag24 chipPendingExp.chip_id 25 25 HAVING rawExp.imfiles = COUNT(chipProcessedImfile.class_id) -
trunk/ippTools/share/chiptool_find_unprocessed_imfile.pl
r12096 r12174 3 3 FROM chipPendingImfile 4 4 LEFT JOIN chipProcessedImfile 5 USING( exp_tag, class_id)5 USING(chip_id, class_id) 6 6 WHERE 7 chipProcessedImfile. exp_tagIS NULL7 chipProcessedImfile.chip_id IS NULL 8 8 AND chipProcessedImfile.class_id IS NULL -
trunk/ippTools/share/chiptool_pendingimfile.sql
r12096 r12174 5 5 FROM chipPendingImfile 6 6 JOIN chipPendingExp 7 USING( exp_tag)7 USING(chip_id) 8 8 JOIN rawExp 9 USING(exp_tag)9 ON chipPendingExp.exp_tag = rawExp.exp_tag 10 10 LEFT JOIN chipMask 11 11 ON chipPendingExp.label = chipMask.label -
trunk/ippTools/src/chiptool.c
r12131 r12174 111 111 { \ 112 112 bool status = false; \ 113 ps##type var = psMetadataLookup##type(&status, from, "-" #name); \113 ps##type var = psMetadataLookup##type(&status, from, "-" name); \ 114 114 if (!status) { \ 115 115 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -" name); \ … … 118 118 if (!isnan(var)) { \ 119 119 if (!psMetadataAdd##type(to, PS_LIST_TAIL, #name, 0, "==", var)) { \ 120 psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \120 psError(PS_ERR_UNKNOWN, false, "failed to add item " name); \ 121 121 psFree(to); \ 122 122 return false; \ … … 153 153 ADDPARAMSTR(config->args, where, "object"); 154 154 155 if ( config->where->list->n < 1) {156 psFree( config->where);157 config->where = NULL;155 if (where->list->n < 1) { 156 psFree(where); 157 where = NULL; 158 158 } 159 159 … … 165 165 } 166 166 167 // XXX this does not work!!! 167 psString recipe = psMetadataLookupStr(&status, config->args, "-set_recipe"); 168 if (!status) { 169 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_recipe"); 170 return false; 171 } 172 173 psString expgroup = psMetadataLookupStr(&status, config->args, "-set_expgroup"); 174 if (!status) { 175 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_expgroup"); 176 return false; 177 } 178 179 psString dvodb = psMetadataLookupStr(&status, config->args, "-set_dvodb"); 180 if (!status) { 181 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_dvodb"); 182 return false; 183 } 184 185 // find the exp_tag of all the exposures that we want to queue up. 168 186 psString query = psStringCopy( 169 "INSERT INTO chipPendingExp\n" 170 " SElECT\n" 171 " 0\n" // chip_id 172 " exp_tag,\n" 173 " 'my recipe',\n" // recipe 174 " 255\n" // guide_version 175 " 255\n" // chip_version 176 " %s\n" 177 " FROM rawExp" 178 " LEFT JOIN chipProcessedExp" 179 " USING(exp_tag)" 180 " WHERE" 181 " rawExp.fault = 0" 182 ); 183 184 if (config->where) { 185 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "rawExp"); 187 "SELECT exp_tag FROM rawExp WHERE rawExp.fault = 0"); 188 if (where) { 189 psString whereClause = psDBGenerateWhereConditionSQL(where, "rawExp"); 190 psFree(where); 186 191 psStringAppend(&query, " AND %s", whereClause); 187 192 psFree(whereClause); 188 193 } 189 194 190 if (!p_psDBRunQuery(config->dbh, query , label ? label : "NULL")) {195 if (!p_psDBRunQuery(config->dbh, query)) { 191 196 psError(PS_ERR_UNKNOWN, false, "database error"); 192 197 psFree(query); … … 201 206 } 202 207 if (!psArrayLength(output)) { 203 // XXX check psError here 204 psError(PS_ERR_UNKNOWN, false, "no chipPendingImfile rows found"); 205 psFree(output); 208 psTrace("chiptool", PS_LOG_INFO, "no rows found"); 209 psFree(output); 210 return true; 211 } 212 213 // load the SQL to enqueue our exp_tags from disk once 214 psString queuerawexp_query = pxDataGet("chiptool_queuerawexp.sql"); 215 if (!query) { 216 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 217 psFree(output); 218 return false; 219 } 220 221 psString queuerawimfile_query = pxDataGet("chiptool_queuerawimfile.sql"); 222 if (!query) { 223 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 224 psFree(queuerawexp_query); 225 psFree(output); 226 return false; 227 } 228 229 // start a transaction so we don't end up with an exp without any associted 230 // imfiles 231 if (!psDBTransaction(config->dbh)) { 232 psError(PS_ERR_UNKNOWN, false, "database error"); 233 psFree(queuerawimfile_query); 234 psFree(queuerawexp_query); 235 psFree(output); 236 return false; 237 } 238 239 // loop over our list of exp_tags 240 for (long i = 0; i < psArrayLength(output); i++) { 241 psMetadata *md = output->data[i]; 242 243 psString exp_tag = psMetadataLookupStr(&status, md, "exp_tag"); 244 if (!status) { 245 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag"); 246 psFree(queuerawimfile_query); 247 psFree(queuerawexp_query); 248 psFree(output); 249 return false; 250 } 251 252 // queue the exp 253 if (!p_psDBRunQuery(config->dbh, queuerawexp_query, 254 label ? label : "NULL", 255 recipe ? recipe : "NULL", 256 expgroup ? expgroup : "NULL", 257 dvodb ? dvodb : "NULL", 258 exp_tag 259 )) { 260 psError(PS_ERR_UNKNOWN, false, "database error"); 261 psFree(queuerawimfile_query); 262 psFree(queuerawexp_query); 263 psFree(output); 264 return false; 265 } 266 267 // just to be safe, we should have changed at least one row 268 if (psDBAffectedRows(config->dbh) < 1) { 269 if (!psDBRollback(config->dbh)) { 270 psError(PS_ERR_UNKNOWN, false, "database error"); 271 } 272 psError(PS_ERR_UNKNOWN, false, 273 "no rows affected - should have changed at least one row"); 274 psFree(queuerawimfile_query); 275 psFree(queuerawexp_query); 276 psFree(output); 277 return false; 278 } 279 280 // queue the imfiles for the exp we just queued 281 if (!p_psDBRunQuery(config->dbh, queuerawimfile_query)) { 282 psError(PS_ERR_UNKNOWN, false, "database error"); 283 psFree(queuerawimfile_query); 284 psFree(queuerawexp_query); 285 psFree(output); 286 return false; 287 } 288 289 // just to be safe, we should have changed at least one row 290 if (psDBAffectedRows(config->dbh) < 1) { 291 if (!psDBRollback(config->dbh)) { 292 psError(PS_ERR_UNKNOWN, false, "database error"); 293 } 294 psError(PS_ERR_UNKNOWN, false, 295 "no rows affected - should have changed at least one row"); 296 psFree(queuerawimfile_query); 297 psFree(queuerawexp_query); 298 psFree(output); 299 return false; 300 } 301 } 302 psFree(queuerawimfile_query); 303 psFree(queuerawexp_query); 304 psFree(output); 305 306 if (!psDBCommit(config->dbh)) { 307 psError(PS_ERR_UNKNOWN, false, "database error"); 206 308 return false; 207 309 } … … 776 878 } 777 879 778 psString recipe = psMetadataLookupStr(&status, config->args, "-recip");779 if (!status) {780 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -recip");781 return false;782 }783 if (!recipe) {784 psError(PS_ERR_UNKNOWN, true, "-recip is required");785 return false;786 }787 788 880 psF64 bg = psMetadataLookupF64(&status, config->args, "-bg"); 789 881 if (!status) { … … 820 912 return chipProcessedImfileRowAlloc( 821 913 imfile->chip_id, 822 imfile->exp_tag,823 imfile->guide_id,824 914 imfile->class_id, 825 recipe,826 915 uri, 827 916 bg, -
trunk/ippTools/src/chiptoolConfig.c
r12131 r12174 86 86 "search by exposure object", NULL); 87 87 psMetadataAddStr(queuerawexpArgs, PS_LIST_TAIL, "-set_label", 0, 88 "define label for phase 2 processing (non-detrend data only)", NULL); 88 "define label", NULL); 89 psMetadataAddStr(queuerawexpArgs, PS_LIST_TAIL, "-set_recipe", 0, 90 "define recipe", NULL); 91 psMetadataAddStr(queuerawexpArgs, PS_LIST_TAIL, "-set_expgroup", 0, 92 "define exposure group", NULL); 93 psMetadataAddStr(queuerawexpArgs, PS_LIST_TAIL, "-set_dvodb", 0, 94 "define DBO db", NULL); 89 95 90 96 … … 114 120 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-chip_id", 0, 115 121 "define chip ID (required)", NULL); 116 #if 0117 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag", 0,118 "define exposure tag (required) (XXX redudant with chip_id)", NULL);119 #endif120 122 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id", 0, 121 123 "define class ID", NULL); 122 124 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-uri", 0, 123 125 "define URL", NULL); 124 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-recip", 0,125 "define recipe (required)", NULL);126 126 psMetadataAddF64(addprocessedimfileArgs, PS_LIST_TAIL, "-bg", 0, 127 127 "define exposue background", NAN); -
trunk/ippTools/src/regtool.c
r12131 r12174 910 910 return chipPendingImfileRowAlloc( 911 911 chip_id, 912 rawImfile->exp_tag,913 0xdeadbeef, // guide version914 912 rawImfile->class_id, 915 "my recipe", // recipe916 913 rawImfile->uri 917 914 );
Note:
See TracChangeset
for help on using the changeset viewer.
