Changeset 9057
- Timestamp:
- Sep 28, 2006, 5:25:54 PM (20 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 25 edited
-
Makefile.am (modified) (1 diff)
-
configure.ac (modified) (1 diff)
-
scripts/dettest.sh (modified) (2 diffs)
-
scripts/regtest.sh (modified) (1 diff)
-
src/chiptool.c (modified) (10 diffs)
-
src/chiptoolConfig.c (modified) (3 diffs)
-
src/dettool.c (modified) (77 diffs)
-
src/dettoolConfig.c (modified) (13 diffs)
-
src/guidetool.c (modified) (1 diff)
-
src/guidetoolConfig.c (modified) (3 diffs)
-
src/p2insertPendingFrames.c (modified) (3 diffs)
-
src/p2pendingToDone.c (modified) (3 diffs)
-
src/p2rawToPending.c (modified) (2 diffs)
-
src/p2searchDoneFrames.c (modified) (1 diff)
-
src/p2searchPendingFrames.c (modified) (2 diffs)
-
src/p2updatePending.c (modified) (1 diff)
-
src/pxframes.c (modified) (5 diffs)
-
src/pxinject.c (modified) (4 diffs)
-
src/pxinjectConfig.c (modified) (3 diffs)
-
src/pzgetimfiles.c (modified) (2 diffs)
-
src/pzgetimfilesConfig.c (modified) (1 diff)
-
src/pztool.c (modified) (1 diff)
-
src/pztoolConfig.c (modified) (4 diffs)
-
src/regtool.c (modified) (12 diffs)
-
src/regtoolConfig.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/Makefile.am
r8697 r9057 2 2 3 3 CLEANFILES = *~ core core.* 4 5 ACLOCAL_AMFLAGS = -I m4 -
trunk/ippTools/configure.ac
r9046 r9057 16 16 PKG_CHECK_MODULES([PSLIB], [pslib >= 0.12.99]) 17 17 PKG_CHECK_MODULES([PSMODULES], [psmodules >= 0.12.0]) 18 PKG_CHECK_MODULES([IPPDB], [ippdb >= 0.0.3 7])18 PKG_CHECK_MODULES([IPPDB], [ippdb >= 0.0.38]) 19 19 20 20 AC_PROG_PERL_MODULES( -
trunk/ippTools/scripts/dettest.sh
r8755 r9057 9 9 10 10 for ID in `seq 0 3` ; do 11 dettool -addprocessed -det_id 1 -exp_id10 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 111 dettool -addprocessedimfile -det_id 1 -exp_tag t10 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1 12 12 done; 13 13 14 14 for ID in `seq 0 3` ; do 15 dettool -addprocessed -det_id 1 -exp_id11 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 115 dettool -addprocessedimfile -det_id 1 -exp_tag t11 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1 16 16 done; 17 17 … … 34 34 35 35 for ID in `seq 0 3` ; do 36 dettool -addresidimfile -det_id 1 -exp_ id10 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 136 dettool -addresidimfile -det_id 1 -exp_tag t10 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1 37 37 done; 38 38 for ID in `seq 0 3` ; do 39 dettool -addresidimfile -det_id 1 -exp_ id11 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 139 dettool -addresidimfile -det_id 1 -exp_tag t11 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1 40 40 done; 41 41 42 42 dettool -toresidexp || exit 1 43 dettool -addresidexp -det_id 1 -exp_ id10 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2 || exit 144 dettool -addresidexp -det_id 1 -exp_ id11 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2 -reject || exit 143 dettool -addresidexp -det_id 1 -exp_tag t10 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2 || exit 1 44 dettool -addresidexp -det_id 1 -exp_tag t11 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2 -reject || exit 1 45 45 46 46 dettool -residdetrun || exit 1 47 47 dettool -residexp || exit 1 48 48 dettool -updateresidexp -det_id 1 -iteration 0 -recip yourrecipe || exit 1 49 dettool -updateresidexp -det_id 1 -iteration 0 -exp_ id10 -reject || exit 150 dettool -updateresidexp -det_id 1 -iteration 0 -exp_ id11 || exit 149 dettool -updateresidexp -det_id 1 -iteration 0 -exp_tag t10 -reject || exit 1 50 dettool -updateresidexp -det_id 1 -iteration 0 -exp_tag t11 || exit 1 51 51 dettool -residexp || exit 1 52 52 dettool -updatedetrun -det_id 1 -again || exit 1 -
trunk/ippTools/scripts/regtest.sh
r8755 r9057 8 8 echo -e "YES\nipp\n\n" | pxadmin -recreate || exit 1 9 9 10 $inject -newExp -exp_ id 10 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 110 $inject -newExp -exp_tag t10 -exp_id 10 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1 11 11 12 12 for ID in `seq 0 3`; do 13 $inject -newImfile -exp_ id10 -class OTA -class_id $ID -uri file://$ID || exit 113 $inject -newImfile -exp_tag t10 -class OTA -class_id $ID -uri file://$ID || exit 1 14 14 done; 15 15 16 $inject -newExp -exp_ id 11 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 116 $inject -newExp -exp_tag t11 -exp_id 11 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1 17 17 18 18 for ID in `seq 0 3`; do 19 $inject -newImfile -exp_ id11 -class OTA -class_id $ID -uri file://$ID || exit 119 $inject -newImfile -exp_tag t11 -class OTA -class_id $ID -uri file://$ID || exit 1 20 20 done; 21 21 22 22 for ID in `seq 0 3`; do 23 $p0tool -updateimfile -exp_ id10 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 123 $p0tool -updateimfile -exp_tag t10 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1 24 24 done; 25 25 26 $p0tool -updateexp -exp_ id10 -filter r -airmass 10 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 $* || exit 126 $p0tool -updateexp -exp_tag t10 -filter r -airmass 10 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 $* || exit 1 27 27 28 28 for ID in `seq 0 3`; do 29 $p0tool -updateimfile -exp_ id11 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 129 $p0tool -updateimfile -exp_tag t11 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1 30 30 done; 31 31 32 $p0tool -updateexp -exp_ id11 -filter r -airmass 11 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 $* || exit 132 $p0tool -updateexp -exp_tag t11 -filter r -airmass 11 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 $* || exit 1 -
trunk/ippTools/src/chiptool.c
r8849 r9057 92 92 for (long j = 0; j < pendingFrames->n; j++) { 93 93 p2PendingFrame *pendingFrame = pendingFrames->data[j]; 94 if (strcmp(rawFrame->exposure->exp_ id,95 pendingFrame->exposure->exp_ id) == 0) {94 if (strcmp(rawFrame->exposure->exp_tag, 95 pendingFrame->exposure->exp_tag) == 0) { 96 96 psArrayRemove(rawFrames, rawFrame); 97 97 // dec the counter as the array just got shorter … … 111 111 for (long j = 0; j < pendingFrames->n; j++) { 112 112 p2DoneFrame *doneFrame = pendingFrames->data[j]; 113 if (strcmp(rawFrame->exposure->exp_ id,114 doneFrame->exposure->exp_ id) == 0) {113 if (strcmp(rawFrame->exposure->exp_tag, 114 doneFrame->exposure->exp_tag) == 0) { 115 115 psArrayRemove(rawFrames, rawFrame); 116 116 // dec the counter as the array just got shorter … … 178 178 // select * from p2ProcessedImfiles 179 179 // where 180 // exp_ id& class_id are not in p2PendingImfile180 // exp_tag & class_id are not in p2PendingImfile 181 181 182 182 // add the completed imfile to … … 193 193 " FROM p2PendingImfile " 194 194 " LEFT JOIN p2ProcessedImfile" 195 " USING(exp_ id, class_id)"195 " USING(exp_tag, class_id)" 196 196 " WHERE" 197 " p2ProcessedImfile.exp_ idIS NULL"197 " p2ProcessedImfile.exp_tag IS NULL" 198 198 " AND p2ProcessedImfile.class_id IS NULL" 199 199 ); … … 201 201 psMetadata *where = psMetadataAlloc(); 202 202 bool status = false; 203 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id"); if (!status) {204 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");203 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); if (!status) { 204 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 205 205 psFree(query); 206 206 return false; 207 207 } 208 if (exp_ id) {209 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", 0, "==", exp_id)) {210 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");208 if (exp_tag) { 209 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) { 210 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 211 211 psFree(where); 212 212 psFree(query); … … 339 339 340 340 // select * from p2PendingExp 341 // where exp_ idis not in p2ProcessedExp342 // where exp_ idis not in p2PendingImfile341 // where exp_tag is not in p2ProcessedExp 342 // where exp_tag is not in p2PendingImfile 343 343 // where the number of entries in p2ProccessedImfile matches the .imfiles 344 344 // entry in rawScienceExp … … 350 350 " FROM p2PendingExp" 351 351 " JOIN rawScienceExp" 352 " ON p2PendingExp.exp_ id = rawScienceExp.exp_id"352 " ON p2PendingExp.exp_tag = rawScienceExp.exp_tag" 353 353 " LEFT JOIN p2ProcessedExp" 354 " ON p2PendingExp.exp_ id = p2ProcessedExp.exp_id"354 " ON p2PendingExp.exp_tag = p2ProcessedExp.exp_tag" 355 355 " LEFT JOIN p2PendingImfile" 356 " ON p2PendingExp.exp_ id = p2PendingImfile.exp_id"356 " ON p2PendingExp.exp_tag = p2PendingImfile.exp_tag" 357 357 " LEFT JOIN p2ProcessedImfile" 358 " ON p2PendingExp.exp_ id = p2ProcessedImfile.exp_id"358 " ON p2PendingExp.exp_tag = p2ProcessedImfile.exp_tag" 359 359 " WHERE" 360 " p2ProcessedExp.exp_ idIS NULL"361 " AND p2PendingImfile.exp_ idIS NULL"362 " AND p2ProcessedImfile.exp_ idIS NOT NULL"360 " p2ProcessedExp.exp_tag IS NULL" 361 " AND p2PendingImfile.exp_tag IS NULL" 362 " AND p2ProcessedImfile.exp_tag IS NOT NULL" 363 363 " GROUP BY" 364 " p2PendingExp.exp_ id"364 " p2PendingExp.exp_tag" 365 365 " HAVING rawScienceExp.imfiles = COUNT(p2ProcessedImfile.class_id)" 366 366 ); … … 514 514 515 515 return p2ProcessedImfileRowAlloc( 516 imfile->exp_ id,516 imfile->exp_tag, 517 517 imfile->class_id, 518 518 uri, … … 533 533 534 534 return p2ProcessedExpRowAlloc( 535 pendingExp->exp_ id,535 pendingExp->exp_tag, 536 536 pendingExp->p1_version, 537 537 pendingExp->p2_version … … 544 544 545 545 return p3PendingExpRowAlloc( 546 pendingExp->exp_ id,546 pendingExp->exp_tag, 547 547 pendingExp->p1_version, 548 548 pendingExp->p2_version -
trunk/ippTools/src/chiptoolConfig.c
r8658 r9057 32 32 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-filter", 0, 33 33 "define filter of interest", NULL); 34 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_ id", 0,34 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 35 35 "define exposure ID", NULL); 36 36 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class", 0, … … 45 45 // -addprocessedimfile 46 46 psMetadata *addprocessedimfileArgs = psMetadataAlloc(); 47 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_ id", 0,48 "define exp_ id(required)", NULL);47 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 48 "define exp_tag (required)", NULL); 49 49 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id", 0, 50 50 "define class ID", NULL); … … 138 138 config->where = psMetadataAlloc(); 139 139 140 addWhereStr(exp_ id);140 addWhereStr(exp_tag); 141 141 // convert '-inst' to 'camera' 142 142 { -
trunk/ippTools/src/dettool.c
r9046 r9057 127 127 128 128 psString query = psStringCopy("SELECT rawDetrendExp.* FROM rawDetrendExp" 129 " LEFT JOIN detInputExp ON rawDetrendExp.exp_ id = detInputExp.exp_id"130 " WHERE detInputExp.exp_ idIS NULL");129 " LEFT JOIN detInputExp ON rawDetrendExp.exp_tag = detInputExp.exp_tag" 130 " WHERE detInputExp.exp_tag IS NULL"); 131 131 132 132 if (config->where) { … … 190 190 } 191 191 192 // we have to support multipe exp_ ids193 psMetadataItem *item = psMetadataLookup(config->args, "-exp_ id");192 // we have to support multipe exp_tags 193 psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag"); 194 194 if (!item) { 195 195 // this shouldn't actually happen when using psArgs 196 psError(PS_ERR_UNKNOWN, true, "-exp_ idis required");196 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required"); 197 197 return false; 198 198 } 199 199 psMetadata *where = psMetadataAlloc(); 200 200 201 // make sure that -exp_ idwas parsed correctly201 // make sure that -exp_tag was parsed correctly 202 202 // XXX this can be removed someday 203 203 if (item->type == PS_DATA_METADATA_MULTI) { … … 205 205 psMetadataItem *mItem = NULL; 206 206 while ((mItem = psListGetAndIncrement(iter))) { 207 psString exp_ id= mItem->data.V;208 // if exp_ id is NULL then it means that -exp_idhas not been207 psString exp_tag = mItem->data.V; 208 // if exp_tag is NULL then it means that -exp_tag has not been 209 209 // specified 210 if (!exp_ id) {210 if (!exp_tag) { 211 211 psError(PS_ERR_UNKNOWN, true, 212 "at least one -exp_ idis required");212 "at least one -exp_tag is required"); 213 213 psFree(where); 214 214 return false; 215 215 } 216 216 217 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id",218 PS_META_DUPLICATE_OK, "==", exp_ id)) {219 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");217 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 218 PS_META_DUPLICATE_OK, "==", exp_tag)) { 219 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 220 220 psFree(iter); 221 221 psFree(where); … … 226 226 } else { 227 227 psAbort(config->argv[0], 228 "-exp_ idwas not parsed correctly (this should not happen");228 "-exp_tag was not parsed correctly (this should not happen"); 229 229 } 230 230 … … 234 234 } 235 235 236 // check that the specified exp_ ids actually exist236 // check that the specified exp_tags actually exist 237 237 psArray *detrendExps = rawDetrendExpSelectRowObjects(config->dbh, where, 0); 238 238 psFree(where); … … 242 242 } 243 243 244 // we should have one rawDetrendExp row per exp_ idspecified244 // we should have one rawDetrendExp row per exp_tag specified 245 245 if (psListLength(item->data.list) != psArrayLength(detrendExps)) { 246 246 psAbort(config->argv[0], 247 "an -exp_ idmatched more then one rawDetrendExp (this should not happen");247 "an -exp_tag matched more then one rawDetrendExp (this should not happen"); 248 248 249 249 } … … 717 717 det_id, 718 718 iteration, 719 rawExp->exp_ id,719 rawExp->exp_tag, 720 720 true // use 721 721 ); … … 729 729 // select rawDetrendExp.* 730 730 // by: 731 // exp_ id731 // exp_tag 732 732 733 733 psString query = psStringCopy( … … 735 735 " FROM detInputExp" 736 736 " JOIN rawDetrendExp" 737 " USING(exp_ id)"737 " USING(exp_tag)" 738 738 ); 739 739 … … 789 789 // 790 790 // det_id is in detInputExp 791 // exp_ idis in detInputExp791 // exp_tag is in detInputExp 792 792 // det_id is not in detProccessedImfile 793 // exp_ idis not in detProccessedImfile793 // exp_tag is not in detProccessedImfile 794 794 // class_is is not in detProccessedImfile 795 795 psString query = psStringCopy( 796 796 "SELECT detInputExp.det_id, detRun.det_type, rawImfile.*" 797 797 " FROM rawImfile" 798 " LEFT JOIN detInputExp USING(exp_ id) "798 " LEFT JOIN detInputExp USING(exp_tag) " 799 799 " LEFT JOIN detRun ON detInputExp.det_id = detRun.position" 800 800 " LEFT JOIN detProcessedImfile" 801 801 " ON detInputExp.det_id = detProcessedImfile.det_id" 802 " AND rawImfile.exp_ id = detProcessedImfile.exp_id"802 " AND rawImfile.exp_tag = detProcessedImfile.exp_tag" 803 803 " AND rawImfile.class_id = detProcessedImfile.class_id" 804 804 " WHERE" 805 805 " detInputExp.det_id IS NOT NULL" 806 " AND detInputExp.exp_ idIS NOT NULL"806 " AND detInputExp.exp_tag IS NOT NULL" 807 807 " AND detProcessedImfile.det_id IS NULL" 808 " AND detProcessedImfile.exp_ idIS NULL"808 " AND detProcessedImfile.exp_tag IS NULL" 809 809 " AND detProcessedImfile.class_id IS NULL" 810 810 ); … … 861 861 } 862 862 863 // select exp_ ids from detInputExp matching det_idp863 // select exp_tags from detInputExp matching det_idp 864 864 // where query should be pre-generated 865 865 psArray *detInputExp = … … 870 870 } 871 871 872 // generate where query with just the exp_ ids873 psMetadata *where_exp_ ids = psMetadataAlloc();872 // generate where query with just the exp_tags 873 psMetadata *where_exp_tags = psMetadataAlloc(); 874 874 for (long i = 0; i < psArrayLength(detInputExp); i++) { 875 875 detInputExpRow *row = detInputExp->data[i]; 876 if (!psMetadataAddStr(where_exp_ ids, PS_LIST_TAIL, "exp_id",877 PS_META_DUPLICATE_OK, "==", row->exp_ id)876 if (!psMetadataAddStr(where_exp_tags, PS_LIST_TAIL, "exp_tag", 877 PS_META_DUPLICATE_OK, "==", row->exp_tag) 878 878 ) { 879 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");879 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 880 880 psFree(detInputExp); 881 psFree(where_exp_ ids);881 psFree(where_exp_tags); 882 882 return NULL; 883 883 } … … 885 885 psFree(detInputExp); 886 886 887 // select rawImfiles with matching exp_ ids887 // select rawImfiles with matching exp_tags 888 888 psArray *rawImfiles = 889 rawImfileSelectRowObjects(config->dbh, where_exp_ ids, 0);890 psFree(where_exp_ ids);889 rawImfileSelectRowObjects(config->dbh, where_exp_tags, 0); 890 psFree(where_exp_tags); 891 891 if (!rawImfiles) { 892 892 psError(PS_ERR_UNKNOWN, false, "no rawImfile rows found"); … … 901 901 PS_ASSERT_PTR_NON_NULL(config, false); 902 902 903 // det_id, exp_ id, class_id, uri, recipe, -bg, -bg_stdev, & -bg_mean_stdev903 // det_id, exp_tag, class_id, uri, recipe, -bg, -bg_stdev, & -bg_mean_stdev 904 904 // are required 905 905 bool status = false; … … 913 913 return false; 914 914 } 915 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");916 if (!status) { 917 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");918 return false; 919 } 920 if (!exp_ id) {921 psError(PS_ERR_UNKNOWN, true, "-exp_ idis required");915 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 916 if (!status) { 917 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 918 return false; 919 } 920 if (!exp_tag) { 921 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required"); 922 922 return false; 923 923 } … … 988 988 } 989 989 990 // find the matching rawImfile by exp_ id/class_id990 // find the matching rawImfile by exp_tag/class_id 991 991 psMetadata *where = psMetadataAlloc(); 992 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", 0, "==", exp_id)) {993 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");992 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) { 993 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 994 994 psFree(where); 995 995 return false; … … 1011 1011 detProcessedImfileRow *detRow = detProcessedImfileRowAlloc( 1012 1012 (psS32)atol(det_id), 1013 exp_ id,1013 exp_tag, 1014 1014 class_id, 1015 1015 uri, … … 1044 1044 // by: 1045 1045 // find the current iteration bassed on det_id 1046 // find all exp_ ids in the current det_id/iteration from detInputExp1047 // find all rawImfiles in the current exp_ ids1048 // compare to detProcessedImfiles by det_id/exp_ id1046 // find all exp_tags in the current det_id/iteration from detInputExp 1047 // find all rawImfiles in the current exp_tags 1048 // compare to detProcessedImfiles by det_id/exp_tag 1049 1049 // found how many imfile there are in each class_id 1050 1050 // and: … … 1065 1065 " AND detRun.iteration = detInputExp.iteration" 1066 1066 " JOIN rawDetrendExp" 1067 " ON detInputExp.exp_ id = rawDetrendExp.exp_id"1067 " ON detInputExp.exp_tag = rawDetrendExp.exp_tag" 1068 1068 " JOIN detProcessedImfile" 1069 1069 " ON detInputExp.det_id = detProcessedImfile.det_id" 1070 " AND detInputExp.exp_ id = detProcessedImfile.exp_id"1070 " AND detInputExp.exp_tag = detProcessedImfile.exp_tag" 1071 1071 " LEFT JOIN detStackedImfile" 1072 1072 " ON detInputExp.det_id = detStackedImfile.det_id" … … 1074 1074 " AND detProcessedImfile.class_id = detStackedImfile.class_id" 1075 1075 " LEFT JOIN rawImfile" 1076 " ON detInputExp.exp_ id = rawImfile.exp_id"1076 " ON detInputExp.exp_tag = rawImfile.exp_tag" 1077 1077 " AND detProcessedImfile.class_id = rawImfile.class_id" 1078 1078 " WHERE" … … 1165 1165 // det_id is not in detStackedImfile 1166 1166 // iteration is not in detStackedImfile 1167 // detProcessedImfile.exp_ idis not in detStackedImfile1167 // detProcessedImfile.exp_tag is not in detStackedImfile 1168 1168 // detProcessedImfile.class_id is not in detStackedImfile 1169 1169 // and detInputExp.include is 1 … … 1180 1180 " ON detRun.position = detInputExp.det_id" 1181 1181 " AND detRun.iteration = detInputExp.iteration" 1182 " AND detProcessedImfile.exp_ id = detInputExp.exp_id"1182 " AND detProcessedImfile.exp_tag = detInputExp.exp_tag" 1183 1183 " LEFT JOIN detStackedImfile" 1184 1184 " ON detRun.position = detStackedImfile.det_id" … … 1267 1267 // remove detStackedImfiles unless -unmask 1268 1268 if (!psMetadataLookupBool(&status, config->args, "-unmask")) { 1269 // detStackedImfiles doesn't have an exp_ idso we have to generate the1269 // detStackedImfiles doesn't have an exp_tag so we have to generate the 1270 1270 // where query ourselves 1271 1271 bool status = false; … … 1293 1293 if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", 1294 1294 (psS32)atoi(det_id))) { 1295 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");1295 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 1296 1296 psFree(where); 1297 1297 return false; … … 1582 1582 if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", 1583 1583 (psS32)atoi(det_id))) { 1584 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");1584 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 1585 1585 psFree(where); 1586 1586 return false; … … 1794 1794 // by: 1795 1795 // find the current iteration bassed on det_id 1796 // find all exp_ ids in the current det_id/iteration from detInputExp1796 // find all exp_tags in the current det_id/iteration from detInputExp 1797 1797 // sort to detInputExp.imfiles to find the largest value per det_id/iter 1798 1798 // compare imfiles to the number of detStackedImfiles by class_id … … 1812 1812 " AND detRun.iteration = detInputExp.iteration" 1813 1813 " LEFT JOIN rawDetrendExp" 1814 " ON detInputExp.exp_ id = rawDetrendExp.exp_id"1814 " ON detInputExp.exp_tag = rawDetrendExp.exp_tag" 1815 1815 " LEFT JOIN detStackedImfile" 1816 1816 " ON detInputExp.det_id = detStackedImfile.det_id" … … 1819 1819 " detStackedImfile.normalize = 1" 1820 1820 " GROUP BY" 1821 " rawDetrendExp.exp_ id"1821 " rawDetrendExp.exp_tag" 1822 1822 " HAVING MAX(rawDetrendExp.imfiles) = COUNT(detStackedImfile.class_id)" 1823 1823 ); … … 2106 2106 psMetadata *where = psMetadataAlloc(); 2107 2107 for (long i = 0; i < psArrayLength(inputExps); i++) { 2108 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id",2108 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 2109 2109 PS_META_DUPLICATE_OK, "==", 2110 ((detInputExpRow *)inputExps->data[i])->exp_ id)) {2111 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");2110 ((detInputExpRow *)inputExps->data[i])->exp_tag)) { 2111 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 2112 2112 psFree(inputExps); 2113 2113 psFree(where); … … 2312 2312 " JOIN detProcessedImfile" 2313 2313 " ON detRun.position = detProcessedImfile.det_id" 2314 " AND detInputExp.exp_ id = detProcessedImfile.exp_id"2314 " AND detInputExp.exp_tag = detProcessedImfile.exp_tag" 2315 2315 " JOIN detNormalizedImfile" 2316 2316 " ON detRun.position = detNormalizedImfile.det_id" … … 2320 2320 " ON detRun.position = detResidImfile.det_id" 2321 2321 " AND detRun.iteration = detResidImfile.iteration" 2322 " AND detProcessedImfile.exp_ id = detResidImfile.exp_id"2322 " AND detProcessedImfile.exp_tag = detResidImfile.exp_tag" 2323 2323 " AND detProcessedImfile.class_id = detResidImfile.class_id" 2324 2324 " WHERE" 2325 2325 " detResidImfile.det_id IS NULL" 2326 2326 " AND detResidImfile.iteration IS NULL" 2327 " AND detResidImfile.exp_ idIS NULL"2327 " AND detResidImfile.exp_tag IS NULL" 2328 2328 " AND detResidImfile.class_id IS NULL" 2329 2329 " UNION" … … 2339 2339 " JOIN detProcessedImfile" 2340 2340 " ON detRun.position = detProcessedImfile.det_id" 2341 " AND detInputExp.exp_ id = detProcessedImfile.exp_id"2341 " AND detInputExp.exp_tag = detProcessedImfile.exp_tag" 2342 2342 " JOIN detStackedImfile" 2343 2343 " ON detRun.position = detStackedImfile.det_id" … … 2347 2347 " ON detRun.position = detResidImfile.det_id" 2348 2348 " AND detRun.iteration = detResidImfile.iteration" 2349 " AND detProcessedImfile.exp_ id = detResidImfile.exp_id"2349 " AND detProcessedImfile.exp_tag = detResidImfile.exp_tag" 2350 2350 " AND detStackedImfile.class_id = detResidImfile.class_id" 2351 2351 " WHERE" 2352 2352 " detResidImfile.det_id IS NULL" 2353 2353 " AND detResidImfile.iteration IS NULL" 2354 " AND detResidImfile.exp_ idIS NULL"2354 " AND detResidImfile.exp_tag IS NULL" 2355 2355 " AND detResidImfile.class_id IS NULL" 2356 2356 " AND detStackedImfile.normalize = 0" … … 2571 2571 2572 2572 // make sure that there is a coresponding entry in detNormalizedImfile 2573 // and the exp_ idspecified is valid2573 // and the exp_tag specified is valid 2574 2574 // select * from detNormalizedImfile 2575 2575 // by det_id, iteration, class_id … … 2588 2588 " ON detNormalizedImfile.det_id = detResidImfile.det_id" 2589 2589 " AND detNormalizedImfile.iteration= detResidImfile.iteration" 2590 " AND detInputExp.exp_ id = detResidImfile.exp_id"2590 " AND detInputExp.exp_tag = detResidImfile.exp_tag" 2591 2591 " AND detNormalizedImfile.class_id = detResidImfile.class_id" 2592 2592 " WHERE" 2593 2593 " detResidImfile.det_id IS NULL" 2594 2594 " AND detResidImfile.iteration IS NULL" 2595 " AND detResidImfile.exp_ idIS NULL"2595 " AND detResidImfile.exp_tag IS NULL" 2596 2596 " AND detResidImfile.class_id IS NULL" 2597 " AND detInputExp.exp_ id= '%s'"2597 " AND detInputExp.exp_tag = '%s'" 2598 2598 " UNION" 2599 2599 " SELECT" … … 2608 2608 " ON detStackedImfile.det_id = detResidImfile.det_id" 2609 2609 " AND detStackedImfile.iteration= detResidImfile.iteration" 2610 " AND detInputExp.exp_ id = detResidImfile.exp_id"2610 " AND detInputExp.exp_tag = detResidImfile.exp_tag" 2611 2611 " AND detStackedImfile.class_id = detResidImfile.class_id" 2612 2612 " WHERE" 2613 2613 " detResidImfile.det_id IS NULL" 2614 2614 " AND detResidImfile.iteration IS NULL" 2615 " AND detResidImfile.exp_ idIS NULL"2615 " AND detResidImfile.exp_tag IS NULL" 2616 2616 " AND detResidImfile.class_id IS NULL" 2617 " AND detInputExp.exp_ id= '%s'"2617 " AND detInputExp.exp_tag = '%s'" 2618 2618 " AND detStackedImfile.normalize = 0" 2619 2619 " ) as detNormStackedImfile" … … 2678 2678 } 2679 2679 2680 // exp_ id is manadatory to cross check that this is a exp_idfor this2680 // exp_tag is manadatory to cross check that this is a exp_tag for this 2681 2681 // detRUn 2682 2682 bool status = false; 2683 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");2684 if (!status) { 2685 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");2683 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 2684 if (!status) { 2685 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 2686 2686 psFree(query); 2687 2687 return false; 2688 2688 } 2689 if (!exp_ id) {2690 psError(PS_ERR_UNKNOWN, true, "-exp_ idis required");2689 if (!exp_tag) { 2690 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required"); 2691 2691 psFree(query); 2692 2692 return false; 2693 2693 } 2694 2694 2695 if (!p_psDBRunQuery(config->dbh, query, exp_ id, exp_id)) {2695 if (!p_psDBRunQuery(config->dbh, query, exp_tag, exp_tag)) { 2696 2696 psError(PS_ERR_UNKNOWN, false, "database error"); 2697 2697 psFree(query); … … 2757 2757 2758 2758 bool status = false; 2759 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");2760 if (!status) { 2761 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");2762 return false; 2763 } 2764 if (!exp_ id) {2765 psError(PS_ERR_UNKNOWN, true, "-exp_ idis required");2759 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 2760 if (!status) { 2761 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 2762 return false; 2763 } 2764 if (!exp_tag) { 2765 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required"); 2766 2766 return false; 2767 2767 } … … 2827 2827 normalizedImfile->det_id, 2828 2828 normalizedImfile->iteration, 2829 exp_ id,2829 exp_tag, 2830 2830 normalizedImfile->class_id, 2831 2831 uri, … … 2845 2845 // select detResidImfile.* 2846 2846 // by: 2847 // where det_id, iteration, exp_ idis not in detResidExp;2847 // where det_id, iteration, exp_tag is not in detResidExp; 2848 2848 2849 2849 psString query = psStringCopy( … … 2852 2852 " FROM detResidImfile" 2853 2853 " LEFT JOIN detResidExp" 2854 " USING(det_id, iteration, exp_ id)"2854 " USING(det_id, iteration, exp_tag)" 2855 2855 " WHERE" 2856 2856 " detResidExp.det_id IS NULL" 2857 2857 " AND detResidExp.iteration IS NULL" 2858 " AnD detResidExp.exp_ idIS NULL"2858 " AnD detResidExp.exp_tag IS NULL" 2859 2859 ); 2860 2860 … … 2917 2917 // select detRun.iteration 2918 2918 // select detRun.det_type 2919 // select detInputExp.exp_ id2919 // select detInputExp.exp_tag 2920 2920 // select detInputExp.include 2921 2921 // by: 2922 2922 // find the current iteration bassed on det_id 2923 // find all exp_ ids in the current det_id/iteration from detInputExp2923 // find all exp_tags in the current det_id/iteration from detInputExp 2924 2924 // compare to detInputExp.imfiles to derResidImfile by class_id 2925 2925 // and: 2926 // detResidImfile.{det_id, iteration, exp_ id} is not in detResidExp2926 // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp 2927 2927 2928 2928 psString query = psStringCopy( … … 2931 2931 " iteration," 2932 2932 " det_type," 2933 " exp_ id,"2933 " exp_tag," 2934 2934 " include" 2935 2935 " FROM" … … 2938 2938 " detRun.iteration," 2939 2939 " detRun.det_type," 2940 " detInputExp.exp_ id,"2940 " detInputExp.exp_tag," 2941 2941 " detInputExp.include," 2942 2942 " rawDetrendExp.imfiles" … … 2946 2946 " AND detRun.iteration = detInputExp.iteration" 2947 2947 " LEFT JOIN rawDetrendExp" 2948 " ON detInputExp.exp_ id = rawDetrendExp.exp_id"2948 " ON detInputExp.exp_tag = rawDetrendExp.exp_tag" 2949 2949 " LEFT JOIN detResidImfile" 2950 2950 " ON detRun.position = detResidImfile.det_id" 2951 2951 " AND detRun.iteration = detResidImfile.iteration" 2952 " AND detInputExp.exp_ id = detResidImfile.exp_id"2952 " AND detInputExp.exp_tag = detResidImfile.exp_tag" 2953 2953 " LEFT JOIN detResidExp" 2954 2954 " ON detRun.position = detResidExp.det_id" 2955 2955 " AND detRun.iteration = detResidExp.iteration" 2956 " AND detInputExp.exp_ id = detResidExp.exp_id"2956 " AND detInputExp.exp_tag = detResidExp.exp_tag" 2957 2957 " WHERE" 2958 2958 " detResidExp.det_id IS NULL" 2959 2959 " AND detResidExp.iteration IS NULL" 2960 " AND detResidExp.exp_ idIS NULL"2960 " AND detResidExp.exp_tag IS NULL" 2961 2961 " GROUP BY" 2962 " detInputExp.exp_ id"2962 " detInputExp.exp_tag" 2963 2963 " HAVING" 2964 2964 " rawDetrendExp.imfiles = COUNT(detResidImfile.class_id)" … … 3026 3026 // select detRun.iteration 3027 3027 // select detRun.det_type 3028 // select detInputExp.exp_ id3028 // select detInputExp.exp_tag 3029 3029 // select detInputExp.include 3030 3030 // by: 3031 3031 // find the current iteration bassed on det_id 3032 // find all exp_ ids in the current det_id/iteration from detInputExp3032 // find all exp_tags in the current det_id/iteration from detInputExp 3033 3033 // compare to detInputExp.imfiles to derResidImfile by class_id 3034 3034 // and: 3035 // detResidImfile.{det_id, iteration, exp_ id} is not in detResidExp3035 // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp 3036 3036 3037 3037 psString query = psStringCopy( … … 3039 3039 " det_id," 3040 3040 " iteration," 3041 " exp_ id,"3041 " exp_tag," 3042 3042 " include" 3043 3043 " FROM" … … 3046 3046 " detRun.iteration," 3047 3047 " detRun.det_type," 3048 " detInputExp.exp_ id,"3048 " detInputExp.exp_tag," 3049 3049 " detInputExp.include," 3050 3050 " rawDetrendExp.imfiles" … … 3054 3054 " AND detRun.iteration = detInputExp.iteration" 3055 3055 " LEFT JOIN rawDetrendExp" 3056 " ON detInputExp.exp_ id = rawDetrendExp.exp_id"3056 " ON detInputExp.exp_tag = rawDetrendExp.exp_tag" 3057 3057 " LEFT JOIN detResidImfile" 3058 3058 " ON detRun.position = detResidImfile.det_id" 3059 3059 " AND detRun.iteration = detResidImfile.iteration" 3060 " AND detInputExp.exp_ id = detResidImfile.exp_id"3060 " AND detInputExp.exp_tag = detResidImfile.exp_tag" 3061 3061 " LEFT JOIN detResidExp" 3062 3062 " ON detRun.position = detResidExp.det_id" 3063 3063 " AND detRun.iteration = detResidExp.iteration" 3064 " AND detInputExp.exp_ id = detResidExp.exp_id"3064 " AND detInputExp.exp_tag = detResidExp.exp_tag" 3065 3065 " WHERE" 3066 3066 " detResidExp.det_id IS NULL" 3067 3067 " AND detResidExp.iteration IS NULL" 3068 " AND detResidExp.exp_ idIS NULL"3068 " AND detResidExp.exp_tag IS NULL" 3069 3069 " GROUP BY" 3070 " detInputExp.exp_ id"3070 " detInputExp.exp_tag" 3071 3071 " HAVING" 3072 3072 " rawDetrendExp.imfiles = COUNT(detResidImfile.class_id)" … … 3075 3075 3076 3076 { 3077 // build a query to search by det_id, iteration, exp_ id3077 // build a query to search by det_id, iteration, exp_tag 3078 3078 psMetadata *where = psMetadataAlloc(); 3079 3079 bool status = false; … … 3107 3107 return false; 3108 3108 } 3109 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");3110 if (!status) { 3111 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");3109 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 3110 if (!status) { 3111 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 3112 3112 psFree(where); 3113 3113 psFree(query); 3114 3114 return false; 3115 3115 } 3116 if (exp_ id) {3117 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", 0, "==", exp_id)) {3118 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");3116 if (exp_tag) { 3117 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) { 3118 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 3119 3119 psFree(where); 3120 3120 psFree(query); … … 3208 3208 return false; 3209 3209 } 3210 psString exp_ id = psMetadataLookupStr(&status, row, "exp_id");3211 if (!status) { 3212 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_ id");3213 return false; 3214 } 3215 if (!exp_ id) {3216 psError(PS_ERR_UNKNOWN, true, "exp_ idis required");3210 psString exp_tag = psMetadataLookupStr(&status, row, "exp_tag"); 3211 if (!status) { 3212 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag"); 3213 return false; 3214 } 3215 if (!exp_tag) { 3216 psError(PS_ERR_UNKNOWN, true, "exp_tag is required"); 3217 3217 return false; 3218 3218 } … … 3283 3283 det_id, 3284 3284 iteration, 3285 exp_ id,3285 exp_tag, 3286 3286 recipe, 3287 3287 bg, … … 3343 3343 // by: 3344 3344 // find the current iteration bassed on det_id 3345 // find all exp_ ids in the current det_id/iteration from detInputExp3346 // find all exp_ ids in the current det_id/iteration from detResidExp3347 // compare the counts of exp_ ids3345 // find all exp_tags in the current det_id/iteration from detInputExp 3346 // find all exp_tags in the current det_id/iteration from detResidExp 3347 // compare the counts of exp_tags 3348 3348 3349 3349 psString query = psStringCopy( … … 3357 3357 " detRun.iteration," 3358 3358 " detRun.det_type," 3359 " detInputExp.exp_ id"3359 " detInputExp.exp_tag" 3360 3360 " FROM detRun" 3361 3361 " LEFT JOIN detInputExp" … … 3363 3363 " AND detRun.iteration = detInputExp.iteration" 3364 3364 " LEFT JOIN rawDetrendExp" 3365 " ON detInputExp.exp_ id = rawDetrendExp.exp_id"3365 " ON detInputExp.exp_tag = rawDetrendExp.exp_tag" 3366 3366 " LEFT JOIN detResidExp" 3367 3367 " ON detRun.position = detResidExp.det_id" 3368 3368 " AND detRun.iteration = detResidExp.iteration" 3369 " AND detInputExp.exp_ id = detResidExp.exp_id"3369 " AND detInputExp.exp_tag = detResidExp.exp_tag" 3370 3370 " GROUP BY" 3371 3371 " detRun.position," 3372 3372 " detRun.iteration" 3373 3373 " HAVING" 3374 " COUNT(detResidExp.exp_ id) = COUNT(detInputExp.exp_id)"3374 " COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)" 3375 3375 " ) AS residdetrun" 3376 3376 ); … … 3425 3425 PS_ASSERT_PTR_NON_NULL(config, false); 3426 3426 3427 // build a query to search by det_id, iteration, exp_ id3427 // build a query to search by det_id, iteration, exp_tag 3428 3428 psMetadata *where = psMetadataAlloc(); 3429 3429 bool status = false; … … 3453 3453 return false; 3454 3454 } 3455 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");3456 if (!status) { 3457 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");3455 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 3456 if (!status) { 3457 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 3458 3458 psFree(where); 3459 3459 return false; 3460 3460 } 3461 if (exp_ id) {3462 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", 0, "==", exp_id)) {3463 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");3461 if (exp_tag) { 3462 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) { 3463 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 3464 3464 psFree(where); 3465 3465 return false; … … 3468 3468 3469 3469 // find the values we're going to set 3470 // copy everything but det_id, iteration, & exp_ idfrom the args and3470 // copy everything but det_id, iteration, & exp_tag from the args and 3471 3471 // remove the '-' prefix 3472 3472 psMetadata *set = psMetadataAlloc(); … … 3601 3601 // by: 3602 3602 // find the current iteration bassed on det_id 3603 // find all exp_ ids in the current det_id/iteration from detInputExp3604 // find all exp_ ids in the current det_id/iteration from detResidExp3605 // compare the counts of exp_ ids3603 // find all exp_tags in the current det_id/iteration from detInputExp 3604 // find all exp_tags in the current det_id/iteration from detResidExp 3605 // compare the counts of exp_tags 3606 3606 3607 3607 psString query = psStringCopy( … … 3613 3613 " detRun.position AS det_id," 3614 3614 " detRun.iteration," 3615 " detInputExp.exp_ id"3615 " detInputExp.exp_tag" 3616 3616 " FROM detRun" 3617 3617 " LEFT JOIN detInputExp" … … 3619 3619 " AND detRun.iteration = detInputExp.iteration" 3620 3620 " LEFT JOIN rawDetrendExp" 3621 " ON detInputExp.exp_ id = rawDetrendExp.exp_id"3621 " ON detInputExp.exp_tag = rawDetrendExp.exp_tag" 3622 3622 " LEFT JOIN detResidExp" 3623 3623 " ON detRun.position = detResidExp.det_id" 3624 3624 " AND detRun.iteration = detResidExp.iteration" 3625 " AND detInputExp.exp_ id = detResidExp.exp_id"3625 " AND detInputExp.exp_tag = detResidExp.exp_tag" 3626 3626 " GROUP BY" 3627 3627 " detRun.position," 3628 3628 " detRun.iteration" 3629 3629 " HAVING" 3630 " COUNT(detResidExp.exp_ id) = COUNT(detInputExp.exp_id)"3630 " COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)" 3631 3631 " ) AS residdetrun" 3632 3632 ); 3633 3633 3634 3634 { 3635 // build a query to search by det_id, iteration, exp_ id3635 // build a query to search by det_id, iteration, exp_tag 3636 3636 psMetadata *where = psMetadataAlloc(); 3637 3637 bool status = false; … … 3839 3839 // select detRun.position 3840 3840 // select detRun.iteration 3841 // select detInputExp.exp_ id3841 // select detInputExp.exp_tag 3842 3842 // select detResidExp.accept 3843 3843 // by: 3844 3844 // find the current iteration bassed on det_id 3845 // find all exp_ ids in the current det_id/iteration from detInputExp3846 // find all exp_ ids in the current det_id/iteration from detResidExp3847 // compare the counts of exp_ ids3845 // find all exp_tags in the current det_id/iteration from detInputExp 3846 // find all exp_tags in the current det_id/iteration from detResidExp 3847 // compare the counts of exp_tags 3848 3848 3849 3849 psString query = psStringCopy( … … 3851 3851 " detRun.position AS det_id," 3852 3852 " detRun.iteration," 3853 " detInputExp.exp_ id,"3853 " detInputExp.exp_tag," 3854 3854 " detResidExp.accept" 3855 3855 " FROM detRun" … … 3860 3860 " ON detRun.position = detResidExp.det_id" 3861 3861 " AND detRun.iteration = detResidExp.iteration" 3862 " AND detInputExp.exp_ id = detResidExp.exp_id"3862 " AND detInputExp.exp_tag = detResidExp.exp_tag" 3863 3863 " WHERE" 3864 " detInputExp.exp_ idIS NOT NULL"3864 " detInputExp.exp_tag IS NOT NULL" 3865 3865 " AND detResidExp.accept IS NOT NULL" 3866 3866 " GROUP BY" 3867 3867 " detRun.position," 3868 3868 " detRun.iteration," 3869 " detInputExp.exp_ id"3869 " detInputExp.exp_tag" 3870 3870 " HAVING" 3871 " COUNT(detResidExp.exp_ id) = COUNT(detInputExp.exp_id)"3871 " COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)" 3872 3872 ); 3873 3873 … … 3910 3910 for (long i = 0; i < psArrayLength(output); i++) { 3911 3911 psMetadata *row = output->data[i]; 3912 psString exp_ id = psMetadataLookupStr(&status, row, "exp_id");3912 psString exp_tag = psMetadataLookupStr(&status, row, "exp_tag"); 3913 3913 if (!status) { 3914 3914 // rollback … … 3916 3916 psError(PS_ERR_UNKNOWN, false, "database error"); 3917 3917 } 3918 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_ id");3918 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag"); 3919 3919 psFree(output); 3920 3920 return false; … … 3936 3936 (psS32)atol(det_id), 3937 3937 newIteration, 3938 exp_ id,3938 exp_tag, 3939 3939 accept 3940 3940 ) … … 4098 4098 } 4099 4099 4100 // we have to support multipe exp_ ids4101 psMetadataItem *item = psMetadataLookup(config->args, "-exp_ id");4100 // we have to support multipe exp_tags 4101 psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag"); 4102 4102 if (!item) { 4103 4103 // this shouldn't actually happen when using psArgs 4104 psError(PS_ERR_UNKNOWN, true, "-exp_ idis required");4105 return false; 4106 } 4107 4108 psList *exp_ id_list = item->data.list;4104 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required"); 4105 return false; 4106 } 4107 4108 psList *exp_tag_list = item->data.list; 4109 4109 psMetadata *where = psMetadataAlloc(); 4110 // make sure that -exp_ idwas parsed correctly4110 // make sure that -exp_tag was parsed correctly 4111 4111 // XXX this can be removed someday 4112 4112 if (item->type == PS_DATA_METADATA_MULTI) { … … 4114 4114 psMetadataItem *mItem = NULL; 4115 4115 while ((mItem = psListGetAndIncrement(iter))) { 4116 psString exp_ id= mItem->data.V;4117 // if exp_ id is NULL then it means that -exp_idhas not been4116 psString exp_tag = mItem->data.V; 4117 // if exp_tag is NULL then it means that -exp_tag has not been 4118 4118 // specified 4119 if (!exp_ id) {4119 if (!exp_tag) { 4120 4120 psError(PS_ERR_UNKNOWN, true, 4121 "at least one -exp_ idis required");4121 "at least one -exp_tag is required"); 4122 4122 psFree(where); 4123 4123 return false; 4124 4124 } 4125 4125 4126 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id",4127 PS_META_DUPLICATE_OK, "==", exp_ id)) {4128 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");4126 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 4127 PS_META_DUPLICATE_OK, "==", exp_tag)) { 4128 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 4129 4129 psFree(iter); 4130 4130 psFree(where); … … 4135 4135 } else { 4136 4136 psAbort(config->argv[0], 4137 "-exp_ idwas not parsed correctly (this should not happen");4138 } 4139 4140 // check that the specified exp_ ids actually exist in the iteration zero4137 "-exp_tag was not parsed correctly (this should not happen"); 4138 } 4139 4140 // check that the specified exp_tags actually exist in the iteration zero 4141 4141 // detInputExp set 4142 4142 … … 4162 4162 } 4163 4163 4164 // build a hash for the valid exp_ ids4165 psHash *valid_exp_ ids = psHashAlloc(psArrayLength(detrendExps));4164 // build a hash for the valid exp_tags 4165 psHash *valid_exp_tags = psHashAlloc(psArrayLength(detrendExps)); 4166 4166 for (long i = 0; i < psArrayLength(detrendExps); i++) { 4167 psHashAdd(valid_exp_ ids,4168 ((detInputExpRow *)detrendExps->data[i])->exp_ id,4167 psHashAdd(valid_exp_tags, 4168 ((detInputExpRow *)detrendExps->data[i])->exp_tag, 4169 4169 detrendExps->data[i] 4170 4170 ); … … 4176 4176 if (!psDBTransaction(config->dbh)) { 4177 4177 psError(PS_ERR_UNKNOWN, false, "database error"); 4178 psFree(valid_exp_ ids);4178 psFree(valid_exp_tags); 4179 4179 return false; 4180 4180 } … … 4187 4187 psError(PS_ERR_UNKNOWN, false, "database error"); 4188 4188 } 4189 psFree(valid_exp_ ids);4190 return false; 4191 } 4192 4193 // check exp_ ids and build up an array of new detInputExp rows at the same4189 psFree(valid_exp_tags); 4190 return false; 4191 } 4192 4193 // check exp_tags and build up an array of new detInputExp rows at the same 4194 4194 // time 4195 psListIterator *iter = psListIteratorAlloc(exp_ id_list, 0, false);4195 psListIterator *iter = psListIteratorAlloc(exp_tag_list, 0, false); 4196 4196 psMetadataItem *mItem = NULL; 4197 psArray *newInputExps = psArrayAlloc(psListLength(exp_ id_list));4197 psArray *newInputExps = psArrayAlloc(psListLength(exp_tag_list)); 4198 4198 while ((mItem = psListGetAndIncrement(iter))) { 4199 detInputExpRow *inputExp = psHashLookup(valid_exp_ ids,4199 detInputExpRow *inputExp = psHashLookup(valid_exp_tags, 4200 4200 (char *)mItem->data.V); 4201 4201 if (!inputExp) { … … 4204 4204 psError(PS_ERR_UNKNOWN, false, "database error"); 4205 4205 } 4206 // invalid exp_ id4207 psError(PS_ERR_UNKNOWN, false, "exp_ id%s is invalid for det_id %s",4206 // invalid exp_tag 4207 psError(PS_ERR_UNKNOWN, false, "exp_tag %s is invalid for det_id %s", 4208 4208 (char *)mItem->data.V, det_id); 4209 4209 psFree(iter); 4210 psFree(valid_exp_ ids);4210 psFree(valid_exp_tags); 4211 4211 return false; 4212 4212 } … … 4214 4214 (psS32)atol(det_id), 4215 4215 newIteration, 4216 inputExp->exp_ id,4216 inputExp->exp_tag, 4217 4217 true // use 4218 4218 ); … … 4221 4221 } 4222 4222 psFree(iter); 4223 psFree(valid_exp_ ids);4223 psFree(valid_exp_tags); 4224 4224 4225 4225 for (long i = 0; i < psArrayLength(newInputExps); i++) { -
trunk/ippTools/src/dettoolConfig.c
r9046 r9057 23 23 // -pending 24 24 psMetadata *pendingArgs = psMetadataAlloc(); 25 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_ id", 0,25 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag", 0, 26 26 "search by exposure ID", NULL); 27 27 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_type", 0, … … 40 40 // -definebyexp 41 41 psMetadata *definebyexpArgs = psMetadataAlloc(); 42 psMetadataAddStr(definebyexpArgs, PS_LIST_TAIL, "-exp_ id",42 psMetadataAddStr(definebyexpArgs, PS_LIST_TAIL, "-exp_tag", 43 43 PS_META_DUPLICATE_OK, 44 44 "include this exposure (multiple OK, required)", NULL); … … 100 100 psMetadataAddS32(inputArgs, PS_LIST_TAIL, "-iteration", 0, 101 101 "define iteration number", 0); 102 psMetadataAddStr(inputArgs, PS_LIST_TAIL, "-exp_ id", 0,102 psMetadataAddStr(inputArgs, PS_LIST_TAIL, "-exp_tag", 0, 103 103 "search for exp ID", NULL); 104 104 psMetadataAddBool(inputArgs, PS_LIST_TAIL, "-simple", 0, … … 109 109 psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-det_id", 0, 110 110 "search for detrend ID", NULL); 111 psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-exp_ id", 0,111 psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-exp_tag", 0, 112 112 "search for exp ID", NULL); 113 113 psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-class_id", 0, … … 120 120 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-det_id", 0, 121 121 "define detrend ID (required)", NULL); 122 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_ id", 0,122 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 123 123 "define exp ID (required)", NULL); 124 124 psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id", 0, … … 150 150 psMetadataAddS32(procArgs, PS_LIST_TAIL, "-iteration", 0, 151 151 "searchfor iteration number", 0); 152 psMetadataAddStr(procArgs, PS_LIST_TAIL, "-exp_ id", 0,152 psMetadataAddStr(procArgs, PS_LIST_TAIL, "-exp_tag", 0, 153 153 "search for exp ID", NULL); 154 154 psMetadataAddStr(procArgs, PS_LIST_TAIL, "-class_id", 0, … … 290 290 psMetadataAddS32(addresidimfileArgs, PS_LIST_TAIL, "-iteration", 0, 291 291 "define iteration number", 0); 292 psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-exp_ id", 0,292 psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 293 293 "define detrend ID (required)", NULL); 294 294 psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-class_id", 0, … … 315 315 psMetadataAddS32(residimfileArgs, PS_LIST_TAIL, "-iteration", 0, 316 316 "search for iteration number", 0); 317 psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-exp_ id", 0,317 psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 318 318 "define detrend ID (required)", NULL); 319 319 psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-class_id", 0, … … 330 330 psMetadataAddS32(addresidexpArgs, PS_LIST_TAIL, "-iteration", 0, 331 331 "define iteration number", 0); 332 psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_ id", 0,332 psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_tag", 0, 333 333 "define detrend ID (required)", NULL); 334 334 psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-recip", 0, … … 353 353 psMetadataAddS32(residexpArgs, PS_LIST_TAIL, "-iteration", 0, 354 354 "search for iteration number", 0); 355 psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-exp_ id", 0,355 psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-exp_tag", 0, 356 356 "search for exp ID", NULL); 357 357 psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-recip", 0, … … 373 373 psMetadataAddS32(updateresidexpArgs, PS_LIST_TAIL, "-iteration", 0, 374 374 "define iteration number", 0); 375 psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-exp_ id", 0,375 psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-exp_tag", 0, 376 376 "define exp ID", NULL); 377 377 psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-recip", 0, … … 448 448 psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-det_id", 0, 449 449 "search for detrend master for detrend ID (required)", NULL); 450 psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-exp_ id", PS_META_DUPLICATE_OK,450 psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-exp_tag", PS_META_DUPLICATE_OK, 451 451 "include this exposure (multiple OK, required)", NULL); 452 452 … … 567 567 } 568 568 addWhereStr(det_type); 569 addWhereStr(exp_ id);569 addWhereStr(exp_tag); 570 570 addWhereStr(class_id); 571 571 // convert '-inst' to 'camera' -
trunk/ippTools/src/guidetool.c
r8537 r9057 166 166 167 167 return p1PendingExpRowAlloc( 168 exp->exp_ id,168 exp->exp_tag, 169 169 exp->camera, 170 170 exp->telescope, -
trunk/ippTools/src/guidetoolConfig.c
r8537 r9057 31 31 // -pending search 32 32 psMetadata *pendingArgs = psMetadataAlloc(); 33 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_ id", 0,33 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag", 0, 34 34 "define exposure ID", NULL); 35 35 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst", 0, … … 50 50 // -define inputs 51 51 psMetadata *defineArgs = psMetadataAlloc(); 52 psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-exp_ id", 0,52 psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-exp_tag", 0, 53 53 "define class", NULL); 54 54 psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-inst", 0, … … 142 142 bool status = false; 143 143 144 addWhereStr(exp_ id);144 addWhereStr(exp_tag); 145 145 // convert '-inst' to 'camera' 146 146 if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) { -
trunk/ippTools/src/p2insertPendingFrames.c
r8279 r9057 21 21 psMetadata *where = psMetadataAlloc(); 22 22 23 psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", PS_META_REPLACE, "==",24 rawFrame->exposure->exp_ id);23 psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==", 24 rawFrame->exposure->exp_tag); 25 25 psArray *exposures = p2PendingExpSelectRowObjects(config->dbh, 26 26 where, MAX_ROWS); … … 40 40 41 41 p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc( 42 rawFrame->exposure->exp_ id,42 rawFrame->exposure->exp_tag, 43 43 "my recipe", 44 44 0xff, … … 51 51 rawImfileRow *rawImage = rawFrame->images->data[j]; 52 52 p2PendingImfileRow *pendingImage = p2PendingImfileRowAlloc( 53 rawImage->exp_ id,53 rawImage->exp_tag, 54 54 rawImage->class_id, 55 55 rawImage->uri, -
trunk/ippTools/src/p2pendingToDone.c
r8279 r9057 17 17 18 18 p2DoneExpRow *doneExposure = p2DoneExpRowAlloc( 19 pendingFrame->exposure->exp_ id,19 pendingFrame->exposure->exp_tag, 20 20 "my recipe", 21 21 pendingFrame->exposure->p1_version, … … 34 34 35 35 p2DoneImfileRow *doneImage = p2DoneImfileRowAlloc( 36 pendingImage->exp_ id,36 pendingImage->exp_tag, 37 37 pendingImage->class_id, 38 38 pendingImage->uri, … … 59 59 60 60 p2DoneExpRow *doneExp = p2DoneExpRowAlloc( 61 pendingExp->exp_ id,61 pendingExp->exp_tag, 62 62 "my recipe", 63 63 pendingExp->p1_version, -
trunk/ippTools/src/p2rawToPending.c
r8121 r9057 16 16 17 17 p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc( 18 rawFrame->exposure->exp_ id,18 rawFrame->exposure->exp_tag, 19 19 rawFrame->exposure->camera, 20 20 rawFrame->exposure->telescope, … … 36 36 rawImfileRow *rawImage = rawFrame->images->data[j]; 37 37 p2PendingImfileRow *pendingImage = p2PendingImfileRowAlloc( 38 rawImage->exp_ id,38 rawImage->exp_tag, 39 39 rawImage->class_id, 40 40 rawImage->uri, -
trunk/ippTools/src/p2searchDoneFrames.c
r8121 r9057 25 25 // 'where' to select each exposure 26 26 psMetadata *where = psMetadataAlloc (); 27 psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", PS_META_REPLACE, "==",28 exposure->exp_ id);27 psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==", 28 exposure->exp_tag); 29 29 30 30 psArray *images = p2DoneImfileSelectRowObjects(config->dbh, where, -
trunk/ippTools/src/p2searchPendingFrames.c
r8121 r9057 25 25 p2PendingExpRow *exposure = exposures->data[i]; 26 26 27 psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", PS_META_REPLACE, "==", exposure->exp_id);27 psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==", exposure->exp_tag); 28 28 psMetadataAddS32(where, PS_LIST_TAIL, "p2_version", PS_META_REPLACE, "==", exposure->p2_version); 29 29 … … 61 61 PS_ASSERT_PTR_NON_NULL(config, NULL); 62 62 63 // exp_ idis optional63 // exp_tag is optional 64 64 bool status = false; 65 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");65 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 66 66 if (!status) { 67 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");67 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 68 68 return false; 69 69 } 70 70 71 // search only based on exp_ id-- either they specified it or not71 // search only based on exp_tag -- either they specified it or not 72 72 psMetadata *where = NULL; 73 if (exp_ id) {73 if (exp_tag) { 74 74 where = psMetadataAlloc(); 75 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", 0, "==", exp_id)) {76 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");75 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) { 76 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 77 77 psFree(where); 78 78 return false; -
trunk/ippTools/src/p2updatePending.c
r8062 r9057 22 22 23 23 // find the next available version numbers 24 psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID", PS_META_REPLACE, "==", exposure->exp_ id);24 psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID", PS_META_REPLACE, "==", exposure->exp_tag); 25 25 psMetadataAddS32 (where, PS_LIST_TAIL, "P2_VERSION", PS_META_REPLACE, "==", exposure->p2_version); 26 26 psArray *images = p2PendingImfileSelectRowObjects (config->dbh, where, MAX_ROWS); -
trunk/ippTools/src/pxframes.c
r8661 r9057 80 80 81 81 // XXX fix the exposure search so that it doesn't dump the entire table 82 #define PX_FRAME_SEARCH(frametype, exptype, imfiletype ) \82 #define PX_FRAME_SEARCH(frametype, exptype, imfiletype, key) \ 83 83 psArray *frametype##Search(pxConfig *config) \ 84 84 { \ … … 98 98 \ 99 99 psMetadata *where = psMetadataAlloc(); \ 100 psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==", \101 exposure-> exp_id); \100 psMetadataAddStr(where, PS_LIST_TAIL, #key, PS_META_REPLACE, "==", \ 101 exposure->key); \ 102 102 \ 103 103 psArray *images = imfiletype##SelectRowObjects(config->dbh, where, \ … … 105 105 psFree(where); \ 106 106 if (!images) { \ 107 psError(PS_ERR_UNKNOWN, false, "no " #imfiletype " rows found for exp_id %s", exposure->exp_id); \107 psError(PS_ERR_UNKNOWN, false, "no " #imfiletype " rows found for key %s", exposure->key); \ 108 108 \ 109 109 continue; \ … … 126 126 } 127 127 128 PX_FRAME_SEARCH(pzPendingFrame, pzPendingExp, pzPendingImfile );129 PX_FRAME_SEARCH(newFrame, newExp, newImfile);130 PX_FRAME_SEARCH(rawDetrendFrame, rawDetrendExp, rawImfile );131 PX_FRAME_SEARCH(rawScienceFrame, rawScienceExp, rawImfile );132 PX_FRAME_SEARCH(p2PendingFrame, p2PendingExp, p2PendingImfile );128 PX_FRAME_SEARCH(pzPendingFrame, pzPendingExp, pzPendingImfile, exp_id); 129 //PX_FRAME_SEARCH(newFrame, newExp, newImfile); 130 PX_FRAME_SEARCH(rawDetrendFrame, rawDetrendExp, rawImfile, exp_tag); 131 PX_FRAME_SEARCH(rawScienceFrame, rawScienceExp, rawImfile, exp_tag); 132 PX_FRAME_SEARCH(p2PendingFrame, p2PendingExp, p2PendingImfile, exp_tag); 133 133 134 134 … … 172 172 newImfileRow *newImfile = newImages->data[i]; 173 173 rawImfileRow *rawImfile = rawImfileRowAlloc( 174 newImfile->exp_ id,174 newImfile->exp_tag, 175 175 newImfile->class, 176 176 newImfile->class_id, -
trunk/ippTools/src/pxinject.c
r9028 r9057 52 52 bool status = false; 53 53 54 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 55 if (!status) { 56 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 57 return false; 58 } 59 if (!exp_tag) { 60 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required"); 61 return false; 62 } 54 63 psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id"); 55 64 if (!status) { … … 98 107 } 99 108 100 if (!newExpInsert(config->dbh, exp_ id, camera, telescope, exp_type, imfiles)) {109 if (!newExpInsert(config->dbh, exp_tag, exp_id, camera, telescope, exp_type, imfiles)) { 101 110 psError(PS_ERR_UNKNOWN, false, "database error"); 102 111 return false; … … 110 119 bool status = false; 111 120 112 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");121 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 113 122 if (!status) { 114 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");123 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 115 124 return false; 116 125 } 117 if (!exp_ id) {118 psError(PS_ERR_UNKNOWN, true, "-exp_ idis required");126 if (!exp_tag) { 127 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required"); 119 128 return false; 120 129 } … … 147 156 } 148 157 149 if (!newImfileInsert(config->dbh, exp_ id, class, class_id, uri)) {158 if (!newImfileInsert(config->dbh, exp_tag, class, class_id, uri)) { 150 159 psError(PS_ERR_UNKNOWN, false, "database error"); 151 160 return false; -
trunk/ippTools/src/pxinjectConfig.c
r8459 r9057 23 23 // -newExp 24 24 psMetadata *newExpArgs = psMetadataAlloc(); 25 psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_tag", 0, 26 "define the exp_tag (required)", NULL); 25 27 psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_id", 0, 26 28 "define the exp_id (required)", NULL); … … 36 38 // -newImfile 37 39 psMetadata *newImfileArgs = psMetadataAlloc(); 38 psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_ id", 0,39 "define the exp_ id(required)", NULL);40 psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 41 "define the exp_tag (required)", NULL); 40 42 psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-class", 0, 41 43 "define the class (required)", NULL); … … 116 118 } 117 119 addWhereStr(det_type); 118 addWhereStr(exp_ id);120 addWhereStr(exp_tag); 119 121 addWhereStr(class_id); 120 122 // convert '-inst' to 'camera' -
trunk/ippTools/src/pzgetimfiles.c
r8849 r9057 152 152 PS_ASSERT_PTR_NON_NULL(str, NULL); 153 153 154 bool status = false; 155 psString camera = psMetadataLookupStr(&status, config->args, "-inst"); 156 psString telescope = psMetadataLookupStr(&status, config->args, "-telescope"); 157 154 158 psList *doc = psStringSplit(str, "\n", false); 155 159 … … 192 196 pzPendingImfileRow *row = pzPendingImfileRowAlloc( 193 197 exp_id, 198 camera, 199 telescope, 194 200 (psS32)atol(bytes), 195 201 md5sum, -
trunk/ippTools/src/pzgetimfilesConfig.c
r8849 r9057 24 24 psMetadata *args = psMetadataAlloc(); 25 25 psMetadataAddStr(args , PS_LIST_TAIL, "-uri", 0, 26 "DataStore FileSet URI", "");26 "DataStore FileSet URI", ""); 27 27 psMetadataAddStr(args , PS_LIST_TAIL, "-filesetid", 0, 28 "FileSet ID", ""); 28 "FileSet ID", ""); 29 psMetadataAddStr(args, PS_LIST_TAIL, "-inst", 0, 30 "search by camera", NULL); 31 psMetadataAddStr(args, PS_LIST_TAIL, "-telescope", 0, 32 "search by telescope", NULL); 33 29 34 30 35 bool status = false; -
trunk/ippTools/src/pztool.c
r8849 r9057 253 253 if (!newExpInsert( 254 254 config->dbh, 255 // XXX exp_tag needs to be generated 256 "FIXME exp_tag", 255 257 pendingExp->exp_id, 256 258 pendingExp->camera, -
trunk/ippTools/src/pztoolConfig.c
r8536 r9057 23 23 // -seen 24 24 psMetadata *seenArgs = psMetadataAlloc(); 25 psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_ id", 0,25 psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_tag", 0, 26 26 "define exposure ID", NULL); 27 27 psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-inst", 0, … … 34 34 // -pending 35 35 psMetadata *pendingArgs = psMetadataAlloc(); 36 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_ id", 0,36 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag", 0, 37 37 "define exposure ID", NULL); 38 38 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst", 0, … … 45 45 // -copydone 46 46 psMetadata *copydoneArgs = psMetadataAlloc(); 47 psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_ id", 0,47 psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_tag", 0, 48 48 "define exposure ID", NULL); 49 49 psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-class", 0, … … 120 120 config->where = psMetadataAlloc(); 121 121 122 addWhereStr(exp_ id);122 addWhereStr(exp_tag); 123 123 addWhereStr(class); 124 124 addWhereStr(class_id); -
trunk/ippTools/src/regtool.c
r9028 r9057 72 72 "SELECT newExp.*" 73 73 " FROM newExp" 74 " LEFT JOIN newImfile USING(exp_ id)"75 " LEFT JOIN rawScienceExp USING(exp_ id)"76 " LEFT JOIN rawDetrendExp USING(exp_ id)"74 " LEFT JOIN newImfile USING(exp_tag)" 75 " LEFT JOIN rawScienceExp USING(exp_tag)" 76 " LEFT JOIN rawDetrendExp USING(exp_tag)" 77 77 " WHERE" 78 " newExp.exp_ idIS NOT NULL"79 " AND newImfile.exp_ idIS NULL"80 " AND rawScienceExp.exp_ idIS NULL"78 " newExp.exp_tag IS NOT NULL" 79 " AND newImfile.exp_tag IS NULL" 80 " AND rawScienceExp.exp_tag IS NULL" 81 81 " AND newExp.imfiles =" 82 " (SELECT COUNT(exp_ id) FROM rawImfile"83 " WHERE rawImfile.exp_ id = newExp.exp_id)"82 " (SELECT COUNT(exp_tag) FROM rawImfile" 83 " WHERE rawImfile.exp_tag = newExp.exp_tag)" 84 84 ; 85 85 … … 123 123 124 124 // select newImfiles that: 125 // exp_ idis in newExp126 // don't have their exp_ idin rawScienceExp127 // don't have their exp_ idin rawDetrendExp128 // XXX having the same exp_ idin newExp and raw*Exp is probably an error125 // exp_tag is in newExp 126 // don't have their exp_tag in rawScienceExp 127 // don't have their exp_tag in rawDetrendExp 128 // XXX having the same exp_tag in newExp and raw*Exp is probably an error 129 129 // that should be checked for 130 130 char *query = 131 131 "SELECT newImfile.* FROM newImfile" 132 " LEFT JOIN newExp USING(exp_ id)"133 " LEFT JOIN rawScienceExp USING(exp_ id)"134 " LEFT JOIN rawDetrendExp USING (exp_ id)"135 " WHERE newExp.exp_ idis NOT NULL"136 " AND rawScienceExp.exp_ idIS NULL"137 " AND rawDetrendExp.exp_ idIS NULL";132 " LEFT JOIN newExp USING(exp_tag)" 133 " LEFT JOIN rawScienceExp USING(exp_tag)" 134 " LEFT JOIN rawDetrendExp USING (exp_tag)" 135 " WHERE newExp.exp_tag is NOT NULL" 136 " AND rawScienceExp.exp_tag IS NULL" 137 " AND rawDetrendExp.exp_tag IS NULL"; 138 138 139 139 if (!p_psDBRunQuery(config->dbh, query)) { … … 175 175 PS_ASSERT_PTR_NON_NULL(config, false); 176 176 177 // make sure that the exp_ id(s) are ready to be updated based on:178 // exp_ idis not in rawScienceExp179 // exp_ idis not in rawDetrendExp180 // exp_ idis not in newImfile177 // make sure that the exp_tag(s) are ready to be updated based on: 178 // exp_tag is not in rawScienceExp 179 // exp_tag is not in rawDetrendExp 180 // exp_tag is not in newImfile 181 181 // that the correct count of imfiles is in rawImfile 182 182 … … 184 184 "SELECT newExp.*" 185 185 " FROM newExp" 186 " LEFT JOIN newImfile USING(exp_ id)"187 " LEFT JOIN rawScienceExp USING(exp_ id)"188 " LEFT JOIN rawDetrendExp USING(exp_ id)"186 " LEFT JOIN newImfile USING(exp_tag)" 187 " LEFT JOIN rawScienceExp USING(exp_tag)" 188 " LEFT JOIN rawDetrendExp USING(exp_tag)" 189 189 " WHERE" 190 " newExp.exp_ idIS NOT NULL"191 " AND newImfile.exp_ idIS NULL"192 " AND rawScienceExp.exp_ idIS NULL"190 " newExp.exp_tag IS NOT NULL" 191 " AND newImfile.exp_tag IS NULL" 192 " AND rawScienceExp.exp_tag IS NULL" 193 193 " AND newExp.imfiles =" 194 " (SELECT COUNT(exp_ id) FROM rawImfile"195 " WHERE rawImfile.exp_ id = newExp.exp_id)"194 " (SELECT COUNT(exp_tag) FROM rawImfile" 195 " WHERE rawImfile.exp_tag = newExp.exp_tag)" 196 196 ); 197 197 198 198 { 199 199 bool status = false; 200 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");200 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 201 201 if (!status) { 202 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");202 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 203 203 psFree(query); 204 204 return false; 205 205 } 206 if (exp_ id) {207 psStringAppend(&query, " AND newExp.exp_ id = '%s'", exp_id);206 if (exp_tag) { 207 psStringAppend(&query, " AND newExp.exp_tag = '%s'", exp_tag); 208 208 } 209 209 } … … 359 359 psArray *rawImfiles = NULL; 360 360 { 361 // build a query to search by exp_ id361 // build a query to search by exp_tag 362 362 psMetadata *where = psMetadataAlloc(); 363 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", 0, "==", newExp->exp_id)) {363 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", newExp->exp_tag)) { 364 364 // rollback 365 365 if (!psDBRollback(config->dbh)) { 366 366 psError(PS_ERR_UNKNOWN, false, "database error"); 367 367 } 368 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");368 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 369 369 psFree(where); 370 370 psFree(newExp); … … 381 381 psError(PS_ERR_UNKNOWN, false, "database error"); 382 382 } 383 psError(PS_ERR_UNKNOWN, false, "found no rawImfiles associated with exp_ id %s", newExp->exp_id);383 psError(PS_ERR_UNKNOWN, false, "found no rawImfiles associated with exp_tag %s", newExp->exp_tag); 384 384 psFree(newExp); 385 385 psFree(output); … … 439 439 "SELECT * FROM" 440 440 " (SELECT newImfile.* FROM newImfile" 441 " LEFT JOIN newExp USING(exp_ id)"442 " LEFT JOIN rawScienceExp USING(exp_ id)"443 " LEFT JOIN rawDetrendExp USING (exp_ id)"444 " WHERE newExp.exp_ idIS NOT NULL"445 " AND rawScienceExp.exp_ idIS NULL"446 " AND rawDetrendExp.exp_ idIS NULL) AS foo"447 ); // WHERE class is generated from exp_ id, class, & class_id441 " LEFT JOIN newExp USING(exp_tag)" 442 " LEFT JOIN rawScienceExp USING(exp_tag)" 443 " LEFT JOIN rawDetrendExp USING (exp_tag)" 444 " WHERE newExp.exp_tag IS NOT NULL" 445 " AND rawScienceExp.exp_tag IS NULL" 446 " AND rawDetrendExp.exp_tag IS NULL) AS foo" 447 ); // WHERE class is generated from exp_tag, class, & class_id 448 448 449 449 { 450 // build a query to search by exp_ id, class, class_id450 // build a query to search by exp_tag, class, class_id 451 451 psMetadata *where = psMetadataAlloc(); 452 452 bool status = false; 453 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");453 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 454 454 if (!status) { 455 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");455 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 456 456 psFree(query); 457 457 return false; 458 458 } 459 if (exp_ id) {460 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", 0, "==", exp_id)) {461 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");459 if (exp_tag) { 460 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) { 461 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 462 462 psFree(where); 463 463 psFree(query); … … 619 619 { 620 620 return p1PendingExpRowAlloc( 621 newExp->exp_ id,621 newExp->exp_tag, 622 622 newExp->camera, 623 623 newExp->telescope, … … 642 642 643 643 return p2PendingExpRowAlloc( 644 exp->exp_ id,644 exp->exp_tag, 645 645 "my recipe", 646 646 0xff, // XXX calc version number … … 652 652 { 653 653 return p2PendingImfileRowAlloc( 654 rawImfile->exp_ id,654 rawImfile->exp_tag, 655 655 rawImfile->class_id, 656 656 rawImfile->uri, … … 796 796 797 797 return rawDetrendExpRowAlloc( 798 exp->exp_ id,798 exp->exp_tag, 799 799 exp->camera, 800 800 exp->telescope, … … 941 941 942 942 return rawImfileRowAlloc( 943 imfile->exp_ id,943 imfile->exp_tag, 944 944 imfile->class, 945 945 imfile->class_id, -
trunk/ippTools/src/regtoolConfig.c
r8711 r9057 24 24 // -pendingexp 25 25 psMetadata *pendingexpArgs = psMetadataAlloc(); 26 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_ id", 0,26 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag", 0, 27 27 "search by exposure ID", NULL); 28 28 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst", 0, … … 39 39 // -pendingimfile 40 40 psMetadata *pendingimfileArgs = psMetadataAlloc(); 41 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_ id", 0,41 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 42 42 "search by exposure ID", NULL); 43 43 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class", 0, … … 51 51 // -updateexp 52 52 psMetadata *updateexpArgs = psMetadataAlloc(); 53 psMetadataAddStr(updateexpArgs, PS_LIST_TAIL, "-exp_ id", 0,54 "exp_ idto operate on", NULL);53 psMetadataAddStr(updateexpArgs, PS_LIST_TAIL, "-exp_tag", 0, 54 "exp_tag to operate on", NULL); 55 55 psMetadataAddStr(updateexpArgs, PS_LIST_TAIL, "-exp_type", 0, 56 56 "define exposure type", NULL); … … 90 90 // -updateimfile 91 91 psMetadata *updateimfileArgs = psMetadataAlloc(); 92 psMetadataAddStr(updateimfileArgs, PS_LIST_TAIL, "-exp_ id", 0,92 psMetadataAddStr(updateimfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 93 93 "search by exposure ID", NULL); 94 94 psMetadataAddStr(updateimfileArgs, PS_LIST_TAIL, "-class", 0, … … 125 125 // -rawimfile 126 126 psMetadata *rawimfileArgs = psMetadataAlloc(); 127 psMetadataAddStr(rawimfileArgs, PS_LIST_TAIL, "-exp_ id", 0,127 psMetadataAddStr(rawimfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 128 128 "search by exposure ID", NULL); 129 129 psMetadataAddStr(rawimfileArgs, PS_LIST_TAIL, "-class_id", 0, … … 205 205 config->where = psMetadataAlloc(); 206 206 207 addWhereStr(exp_ id);207 addWhereStr(exp_tag); 208 208 // convert '-inst' to 'camera' 209 209 {
Note:
See TracChangeset
for help on using the changeset viewer.
