Changeset 27397
- Timestamp:
- Mar 22, 2010, 4:54:49 PM (16 years ago)
- Location:
- branches/eam_branches/largefiles.20100314/Ohana/src
- Files:
-
- 1 added
- 6 edited
-
addstar/test/dvomerge.dvo (modified) (3 diffs)
-
dvomerge/Makefile (modified) (1 diff)
-
dvomerge/include/dvomerge.h (modified) (2 diffs)
-
dvomerge/src/dvo_image_merge_dbs.c (added)
-
dvomerge/src/dvomergeCreate.c (modified) (8 diffs)
-
dvomerge/src/dvomergeUpdate.c (modified) (4 diffs)
-
dvomerge/src/merge_catalogs_new.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/test/dvomerge.dvo
r27390 r27397 73 73 tapOK {abs($SIGMA) < 0.001} "ra (in - 0) vs ra (out - 0) (SIGMA)" 74 74 75 exec rm test.in.txt test.cmf 76 exec rm -rf catdir.test1 77 exec rm -rf catdir.test2 78 exec rm -rf catdir.test3 75 # check on updates to imageID 76 catdir catdir.test3 77 imextract imageID 78 sort imageID 79 tapOK {imageID[] == 4} "image IDs exist" 80 tapOK {imageID[0] == 1} "updated image IDs" 81 tapOK {imageID[1] == 2} "updated image IDs" 82 tapOK {imageID[2] == 3} "updated image IDs" 83 tapOK {imageID[3] == 4} "updated image IDs" 84 85 catdir catdir.test3 86 mextract imageID, time 87 set id = imageID 88 set t = time 89 imextract imageID, time 90 91 for i 0 time[] 92 subset T = t if (id == imageID[$i]) 93 set dT = T - time[$i] 94 vstat -q dT 95 tapOK {abs($MEAN) < 0.00001} "time for measure ID $i (MEAN)" 96 tapOK {abs($SIGMA) < 0.00001} "time for measure ID $i (SIGMA)" 97 end 98 99 # exec rm test.in.txt test.cmf 100 # exec rm -rf catdir.test1 101 # exec rm -rf catdir.test2 102 # exec rm -rf catdir.test3 79 103 80 104 tapDONE … … 84 108 macro test.dvomerge.create 85 109 86 tapPLAN 51110 tapPLAN 21 87 111 88 112 exec rm -rf catdir.test1 … … 148 172 tapOK {abs($MEAN) < 0.001} "ra (in - 0) vs ra (out - 0) (MEAN)" 149 173 tapOK {abs($SIGMA) < 0.001} "ra (in - 0) vs ra (out - 0) (SIGMA)" 174 175 # check on updates to imageID 176 catdir catdir.test3 177 imextract imageID 178 sort imageID 179 tapOK {imageID[] == 4} "image IDs exist" 180 tapOK {imageID[0] == 1} "updated image IDs" 181 tapOK {imageID[1] == 2} "updated image IDs" 182 tapOK {imageID[2] == 3} "updated image IDs" 183 tapOK {imageID[3] == 4} "updated image IDs" 184 185 catdir catdir.test3 186 mextract imageID, time 187 set id = imageID 188 set t = time 189 imextract imageID, time 190 191 for i 0 time[] 192 subset T = t if (id == imageID[$i]) 193 set dT = T - time[$i] 194 vstat -q dT 195 tapOK {abs($MEAN) < 0.00001} "time for measure ID $i (MEAN)" 196 tapOK {abs($SIGMA) < 0.00001} "time for measure ID $i (SIGMA)" 197 end 198 199 # exec rm test.in.txt test.cmf 200 # exec rm -rf catdir.test1 201 # exec rm -rf catdir.test2 202 # exec rm -rf catdir.test3 150 203 151 204 tapDONE -
branches/eam_branches/largefiles.20100314/Ohana/src/dvomerge/Makefile
r27384 r27397 24 24 $(SRC)/dvomergeUpdate.$(ARCH).o \ 25 25 $(SRC)/dvomergeCreate.$(ARCH).o \ 26 $(SRC)/dvo_image_merge_dbs.$(ARCH).o \ 26 27 $(SRC)/SetSignals.$(ARCH).o \ 27 28 $(SRC)/ConfigInit.$(ARCH).o \ -
branches/eam_branches/largefiles.20100314/Ohana/src/dvomerge/include/dvomerge.h
r27384 r27397 27 27 28 28 SkyRegion UserPatch; // used by MODE CAT 29 30 typedef struct { 31 off_t Nmap; 32 off_t *old; 33 off_t *new; 34 } IDmapType; 29 35 30 36 int main PROTO((int argc, char **argv)); … … 65 71 uint64_t CreatePSPSObjectID PROTO((double ra, double dec)); 66 72 67 int dvo_image_merge_dbs PROTO((FITS_DB *out, FITS_DB *in)); 68 73 int dvomergeImagesCreate PROTO((IDmapType *IDmap1, char *input1, IDmapType *IDmap2, char *input2, char *output)); 74 int dvomergeImagesUpdate PROTO((IDmapType *IDmap, char *input, char *output)); 75 int dvo_image_merge_dbs PROTO((IDmapType *IDmap, FITS_DB *out, FITS_DB *in)); 76 off_t dvo_map_image_ID PROTO((IDmapType *IDmap, off_t oldID)); 77 int dvo_update_image_IDs PROTO((IDmapType *IDmap, Catalog *catalog)); -
branches/eam_branches/largefiles.20100314/Ohana/src/dvomerge/src/dvomergeCreate.c
r27384 r27397 11 11 Catalog incatalog, outcatalog; 12 12 char filename[256], *input1, *input2, *output; 13 IDmapType IDmap1, IDmap2; 13 14 14 15 if (strcasecmp (argv[2], "and")) usage(); … … 18 19 input2 = argv[3]; 19 20 output = argv[5]; 21 22 dvomergeImagesCreate (&IDmap1, input1, &IDmap2, input2, output); 20 23 21 24 // the first input defines the photcode table & db layout … … 80 83 continue; 81 84 } 85 dvo_update_image_IDs (&IDmap1, &incatalog); 82 86 merge_catalogs_new (&outsky[0].regions[i], &outcatalog, &incatalog); 83 87 dvo_catalog_unlock (&incatalog); … … 100 104 continue; 101 105 } 106 dvo_update_image_IDs (&IDmap2, &incatalog); 102 107 merge_catalogs_old (&outsky[0].regions[i], &outcatalog, &incatalog, RADIUS); 103 108 dvo_catalog_unlock (&incatalog); … … 120 125 } 121 126 127 exit (0); 128 } 129 122 130 /*** update the image table ***/ 123 { 131 int dvomergeImagesCreate (IDmapType *IDmap1, char *input1, IDmapType *IDmap2, char *input2, char *output) { 132 124 133 FITS_DB in1DB; 125 134 FITS_DB in2DB; … … 157 166 158 167 // convert database table to internal structure & add to output image db 159 dvo_image_merge_dbs( &outDB, &in1DB);168 dvo_image_merge_dbs(IDmap1, &outDB, &in1DB); 160 169 dvo_image_unlock (&in1DB); // unlock input1 161 170 … … 177 186 178 187 // convert database table to internal structure & add to output image db 179 dvo_image_merge_dbs( &outDB, &in2DB);188 dvo_image_merge_dbs(IDmap2, &outDB, &in2DB); 180 189 dvo_image_unlock (&in2DB); // unlock input2 181 190 … … 185 194 SetProtect (FALSE); 186 195 dvo_image_unlock (&outDB); // unlock output 196 197 return TRUE; 187 198 } 188 199 189 exit (0);190 }191 192 // merge db2 into db1193 int dvo_image_merge_dbs (FITS_DB *out, FITS_DB *in) {194 195 Image *images;196 off_t Nimages;197 off_t Nout;198 199 images = gfits_table_get_Image (&in[0].ftable, &Nimages, &in[0].swapped);200 201 /* adjust header */202 Nout = 0;203 gfits_scan (&out[0].header, "NIMAGES", "%lld", 1, (long long *) &Nout);204 205 if (!out[0].swapped) {206 gfits_convert_Image ((Image *) out[0].ftable.buffer, sizeof(Image), Nout);207 out[0].swapped = TRUE;208 }209 210 Nout += Nimages;211 gfits_modify (&out[0].header, "NIMAGES", "%lld", 1, (long long) Nout);212 213 gfits_add_rows (&out[0].ftable, (char *) images, Nimages, sizeof(Image));214 return TRUE;215 } -
branches/eam_branches/largefiles.20100314/Ohana/src/dvomerge/src/dvomergeUpdate.c
r27384 r27397 9 9 Catalog incatalog, outcatalog; 10 10 char filename[256], *input, *output; 11 IDmapType IDmap; 11 12 12 13 if (strcasecmp (argv[2], "into")) usage(); … … 21 22 exit (1); 22 23 } 24 25 dvomergeImagesUpdate (&IDmap, input, output); 23 26 24 27 // load the sky table for the existing database … … 59 62 continue; 60 63 } 64 dvo_update_image_IDs (&IDmap, &incatalog); 61 65 merge_catalogs_old (&outsky[0].regions[i], &outcatalog, &incatalog, RADIUS); 62 66 dvo_catalog_unlock (&incatalog); … … 79 83 } 80 84 81 /*** update the image table ***/82 {83 FITS_DB inDB;84 FITS_DB outDB;85 int status;86 87 /*** load input1/Images.dat ***/88 sprintf (ImageCat, "%s/Images.dat", input);89 inDB.mode = dvo_catalog_catmode (CATMODE);90 inDB.format = dvo_catalog_catformat (CATFORMAT);91 status = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout?92 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", inDB.filename);93 94 // load the image table95 if (inDB.dbstate == LCK_EMPTY) {96 Shutdown ("can't find input (1) image catalog %s", inDB.filename);97 }98 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) {99 Shutdown ("can't read input (1) image catalog %s", inDB.filename);100 }101 102 /*** load output/Images.dat ***/103 sprintf (ImageCat, "%s/Images.dat", output);104 outDB.mode = dvo_catalog_catmode (CATMODE);105 outDB.format = dvo_catalog_catformat (CATFORMAT);106 status = dvo_image_lock (&outDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout?107 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", outDB.filename);108 109 /* load the image table */110 if (outDB.dbstate == LCK_EMPTY) {111 Shutdown ("can't find input (2) image catalog %s", outDB.filename);112 }113 if (!dvo_image_load (&outDB, VERBOSE, TRUE)) {114 Shutdown ("can't read input (2) image catalog %s", outDB.filename);115 }116 117 // convert database table to internal structure & add to output image db118 dvo_image_merge_dbs(&outDB, &inDB);119 dvo_image_unlock (&inDB); // unlock input120 121 SetProtect (TRUE);122 dvo_image_save (&outDB, VERBOSE);123 SetProtect (FALSE);124 dvo_image_unlock (&outDB); // unlock output125 }126 127 85 exit (0); 128 86 } 129 87 130 /* 88 /*** update the image table ***/ 89 int dvomergeImagesUpdate (IDmapType *IDmap, char *input, char *output) { 131 90 132 for the upgrade of the synth database, at a minimum I need to use an output format that uses133 doubles for the astrometry. Optionally I should merge in the 2MASS photometry measurements, since that134 would be quite useful for comparison.91 FITS_DB inDB; 92 FITS_DB outDB; 93 int status; 135 94 136 generality questions: 137 * optional 95 /*** load input1/Images.dat ***/ 96 sprintf (ImageCat, "%s/Images.dat", input); 97 inDB.mode = dvo_catalog_catmode (CATMODE); 98 inDB.format = dvo_catalog_catformat (CATFORMAT); 99 status = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout? 100 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", inDB.filename); 138 101 102 // load the image table 103 if (inDB.dbstate == LCK_EMPTY) { 104 Shutdown ("can't find input (1) image catalog %s", inDB.filename); 105 } 106 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) { 107 Shutdown ("can't read input (1) image catalog %s", inDB.filename); 108 } 139 109 110 /*** load output/Images.dat ***/ 111 sprintf (ImageCat, "%s/Images.dat", output); 112 outDB.mode = dvo_catalog_catmode (CATMODE); 113 outDB.format = dvo_catalog_catformat (CATFORMAT); 114 status = dvo_image_lock (&outDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout? 115 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", outDB.filename); 140 116 141 */ 117 /* load the image table */ 118 if (outDB.dbstate == LCK_EMPTY) { 119 Shutdown ("can't find input (2) image catalog %s", outDB.filename); 120 } 121 if (!dvo_image_load (&outDB, VERBOSE, TRUE)) { 122 Shutdown ("can't read input (2) image catalog %s", outDB.filename); 123 } 142 124 125 // convert database table to internal structure & add to output image db 126 dvo_image_merge_dbs(IDmap, &outDB, &inDB); 127 dvo_image_unlock (&inDB); // unlock input 128 129 SetProtect (TRUE); 130 dvo_image_save (&outDB, VERBOSE); 131 SetProtect (FALSE); 132 dvo_image_unlock (&outDB); // unlock output 133 134 return TRUE; 135 } -
branches/eam_branches/largefiles.20100314/Ohana/src/dvomerge/src/merge_catalogs_new.c
r27384 r27397 64 64 output[0].Nmeasure = Nmeasure; 65 65 output[0].Nsecf_mem = Naverage * Nsecfilt; 66 67 // If we are using dvomergeCreate to split an existing catalog, then the max objID in 68 // each of the new subdivisions of the original catalog is the max objID of the original 69 // catalog. It is not allowed to use dvomerge to unify catalogs to a lower-resolution 70 // partition. 71 output[0].objID = input[0].objID; // new max value, save on catalog close 66 72 67 73 if (VERBOSE) {
Note:
See TracChangeset
for help on using the changeset viewer.
