Changeset 15743
- Timestamp:
- Dec 5, 2007, 3:29:29 PM (18 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 11 added
- 49 edited
-
Makefile.in (modified) (1 diff)
-
src/addstar/src/SEDfit.c (modified) (1 diff)
-
src/addstar/src/UpdateDatabase_Image.c (modified) (4 diffs)
-
src/addstar/src/UpdateDatabase_Refcat.c (modified) (3 diffs)
-
src/addstar/src/UpdateDatabase_Reflist.c (modified) (3 diffs)
-
src/addstar/src/addstar.c (modified) (3 diffs)
-
src/addstar/src/find_matches.c (modified) (1 diff)
-
src/addstar/src/find_matches_closest.c (modified) (1 diff)
-
src/addstar/src/find_matches_refstars.c (modified) (1 diff)
-
src/addstar/src/load2mass_catalog.c (modified) (1 diff)
-
src/addstar/src/sedstar.c (modified) (1 diff)
-
src/delstar/src/delete_imagefile.c (modified) (1 diff)
-
src/delstar/src/delete_imagename.c (modified) (1 diff)
-
src/delstar/src/delete_orphans.c (modified) (1 diff)
-
src/delstar/src/delete_times.c (modified) (1 diff)
-
src/delstar/src/find_matches.c (modified) (1 diff)
-
src/dvosplit/Makefile (added)
-
src/dvosplit/include (added)
-
src/dvosplit/include/dvosplit.h (added)
-
src/dvosplit/src/ConfigInit.c (added)
-
src/dvosplit/src/SetSignals.c (added)
-
src/dvosplit/src/Shutdown.c (added)
-
src/dvosplit/src/args.c (added)
-
src/dvosplit/src/dvosplit.c (modified) (5 diffs)
-
src/dvosplit/src/open_output_catalogs.c (added)
-
src/dvosplit/src/split_averages.c (added)
-
src/dvosplit/src/split_measures.c (added)
-
src/dvosplit/src/split_missings.c (added)
-
src/gastro/src/getptolemy.c (modified) (1 diff)
-
src/gastro2/src/getptolemy.c (modified) (1 diff)
-
src/getstar/src/getstar.c (modified) (3 diffs)
-
src/getstar/src/select_by_region.c (modified) (1 diff)
-
src/libdvo/doc/dvo-catalogs.txt (modified) (3 diffs)
-
src/libdvo/include/dvo.h (modified) (2 diffs)
-
src/libdvo/src/dvo_catalog.c (modified) (11 diffs)
-
src/libdvo/src/dvo_catalog_create.c (modified) (1 diff)
-
src/libdvo/src/dvo_catalog_mef.c (modified) (6 diffs)
-
src/libdvo/src/dvo_catalog_raw.c (modified) (2 diffs)
-
src/libdvo/src/dvo_catalog_split.c (modified) (10 diffs)
-
src/libfits/header/F_read_H.c (modified) (1 diff)
-
src/libfits/include/gfitsio.h (modified) (3 diffs)
-
src/libfits/matrix/F_load_M.c (modified) (1 diff)
-
src/libfits/matrix/F_read_portion.c (modified) (1 diff)
-
src/libfits/matrix/F_read_segment.c (modified) (1 diff)
-
src/libfits/table/F_read_T.c (modified) (3 diffs)
-
src/libfits/table/F_read_TH.c (modified) (1 diff)
-
src/libfits/table/F_write_T.c (modified) (1 diff)
-
src/markrock/src/markrock.c (modified) (1 diff)
-
src/markstar/src/markstar.c (modified) (1 diff)
-
src/mosastro/src/getptolemy.c (modified) (1 diff)
-
src/photdbc/src/join_stars.c (modified) (2 diffs)
-
src/photdbc/src/make_subcatalog.c (modified) (2 diffs)
-
src/photdbc/src/photdbc.c (modified) (1 diff)
-
src/relastro/src/bcatalog.c (modified) (2 diffs)
-
src/relastro/src/load_catalogs.c (modified) (2 diffs)
-
src/relastro/src/reload_catalogs.c (modified) (1 diff)
-
src/relphot/src/bcatalog.c (modified) (2 diffs)
-
src/relphot/src/load_catalogs.c (modified) (1 diff)
-
src/relphot/src/reload_catalogs.c (modified) (1 diff)
-
src/uniphot/src/update.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/Makefile.in
r15129 r15743 30 30 addstar \ 31 31 delstar \ 32 dvosplit \ 32 33 elixir \ 33 34 gastro \ -
trunk/Ohana/src/addstar/src/SEDfit.c
r15509 r15743 210 210 } 211 211 } 212 outcat[0].Naverage = Nave; 213 outcat[0].Nmeasure = Nmeas; 212 outcat[0].Naverage = Nave; 213 outcat[0].Nmeasure = Nmeas; 214 outcat[0].Nsecf_mem = Nave*Nsec; 214 215 215 216 free (sourceValue.mags); -
trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c
r15036 r15743 13 13 14 14 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 15 if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_M EAS_META | LOAD_MISS | LOAD_SECF;15 if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF; 16 16 17 17 // XXX this is probably not needed anymore … … 49 49 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 50 50 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 51 if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_M EAS_META | LOAD_MISS | LOAD_SECF;51 if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF; 52 52 53 53 // an error exit status here is a significant error … … 57 57 } 58 58 59 // Nave _disk == 0 implies an empty catalog file59 // Naves_disk == 0 implies an empty catalog file 60 60 // for only_match, skip empty catalogs 61 if ((catalog.Nave _disk == 0) && options[0].only_match) {61 if ((catalog.Naves_disk == 0) && options[0].only_match) { 62 62 dvo_catalog_unlock (&catalog); 63 63 dvo_catalog_free (&catalog); … … 73 73 if (!options[0].only_images) { 74 74 SetProtect (TRUE); 75 dvo_catalog_save (&catalog, VERBOSE); 75 if (options[0].update) { 76 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 77 dvo_catalog_update (&catalog, VERBOSE); 78 } else { 79 dvo_catalog_save (&catalog, VERBOSE); 80 } 76 81 SetProtect (FALSE); 77 82 } -
trunk/Ohana/src/addstar/src/UpdateDatabase_Refcat.c
r14401 r15743 37 37 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 38 38 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 39 if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_M EAS_META | LOAD_MISS | LOAD_SECF;39 if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF; 40 40 41 41 // an error exit status here is a significant error … … 45 45 } 46 46 47 // Nave _disk == 0 implies an empty catalog file47 // Naves_disk == 0 implies an empty catalog file 48 48 // for only_match, skip empty catalogs 49 if ((catalog.Nave _disk == 0) && options[0].only_match) {49 if ((catalog.Naves_disk == 0) && options[0].only_match) { 50 50 dvo_catalog_unlock (&catalog); 51 51 dvo_catalog_free (&catalog); … … 62 62 if (!options[0].only_images) { 63 63 SetProtect (TRUE); 64 dvo_catalog_save (&catalog, VERBOSE); 64 if (options[0].update) { 65 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 66 dvo_catalog_update (&catalog, VERBOSE); 67 } else { 68 dvo_catalog_save (&catalog, VERBOSE); 69 } 65 70 SetProtect (FALSE); 66 71 } -
trunk/Ohana/src/addstar/src/UpdateDatabase_Reflist.c
r14401 r15743 37 37 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 38 38 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 39 if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_M EAS_META | LOAD_MISS | LOAD_SECF;39 if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF; 40 40 41 41 // an error exit status here is a significant error … … 46 46 47 47 /* for only_match, skip empty catalogs XXX EAM : this leaves behind empty files */ 48 if ((catalog.Nave _disk == 0) && options[0].only_match) {48 if ((catalog.Naves_disk == 0) && options[0].only_match) { 49 49 dvo_catalog_unlock (&catalog); 50 50 dvo_catalog_free (&catalog); … … 58 58 if (!options[0].only_images) { 59 59 SetProtect (TRUE); 60 dvo_catalog_save (&catalog, VERBOSE); 60 if (options[0].update) { 61 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 62 dvo_catalog_update (&catalog, VERBOSE); 63 } else { 64 dvo_catalog_save (&catalog, VERBOSE); 65 } 61 66 SetProtect (FALSE); 62 67 } -
trunk/Ohana/src/addstar/src/addstar.c
r15209 r15743 90 90 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 91 91 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 92 if (options.update) catalog.catflags = LOAD_AVES | LOAD_M EAS_META | LOAD_MISS | LOAD_SECF;92 if (options.update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF; 93 93 94 94 // open as read or write, depending on desire … … 105 105 } 106 106 107 // Nave _disk == 0 implies an empty catalog file107 // Naves_disk == 0 implies an empty catalog file 108 108 // for only_match, skip empty catalogs 109 if ((catalog.Nave _disk == 0) && options.only_match) {109 if ((catalog.Naves_disk == 0) && options.only_match) { 110 110 dvo_catalog_unlock (&catalog); 111 111 dvo_catalog_free (&catalog); … … 142 142 if (Nsubset && !options.only_images) { 143 143 SetProtect (TRUE); 144 dvo_catalog_save (&catalog, VERBOSE); 144 if (options.update) { 145 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 146 dvo_catalog_update (&catalog, VERBOSE); 147 } else { 148 dvo_catalog_save (&catalog, VERBOSE); 149 } 145 150 SetProtect (FALSE); 146 151 } -
trunk/Ohana/src/addstar/src/find_matches.c
r15509 r15743 361 361 catalog[0].Naverage = Nave; 362 362 catalog[0].Nmeasure = Nmeas; 363 catalog[0].Nsecf_mem = Nave*Nsecfilt; 363 364 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d %d %d, (%d matches)\n", Nstars, Nave, Nmeas, Nmatch); 364 365 -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r15509 r15743 362 362 catalog[0].Naverage = Nave; 363 363 catalog[0].Nmeasure = Nmeas; 364 catalog[0].Nsecf_mem = Nave*Nsecfilt; 364 365 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d %d %d, (%d matches)\n", Nstars, Nave, Nmeas, Nmatch); 365 366 -
trunk/Ohana/src/addstar/src/find_matches_refstars.c
r15509 r15743 372 372 catalog[0].Nmeasure = Nmeas; 373 373 catalog[0].Nmissing = Nmiss; 374 catalog[0].Nsecf_mem = Nave*Nsecfilt; 374 375 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nmiss: %d %d %d %d, (%d matches)\n", Nstars, Nave, Nmeas, Nmiss, Nmatch); 375 376 return (Nmatch); -
trunk/Ohana/src/addstar/src/load2mass_catalog.c
r15509 r15743 79 79 catalog[0].Naverage = Nave; 80 80 catalog[0].Nmeasure = Nmeas; 81 catalog[0].Nsecf_mem = Nave*Nsec; 81 82 return (TRUE); 82 83 } -
trunk/Ohana/src/addstar/src/sedstar.c
r8361 r15743 34 34 } 35 35 36 // Nave _disk == 0 implies an empty catalog file37 if ((incatalog.Nave _disk == 0) && options.only_match) {36 // Naves_disk == 0 implies an empty catalog file 37 if ((incatalog.Naves_disk == 0) && options.only_match) { 38 38 if (VERBOSE) fprintf (stderr, "skipping empty region\n"); 39 39 dvo_catalog_unlock (&incatalog); -
trunk/Ohana/src/delstar/src/delete_imagefile.c
r12332 r15743 33 33 exit (2); 34 34 } 35 if (!catalog.Nave _disk) {35 if (!catalog.Naves_disk) { 36 36 dvo_catalog_unlock (&catalog); 37 37 dvo_catalog_free (&catalog); -
trunk/Ohana/src/delstar/src/delete_imagename.c
r14590 r15743 44 44 exit (2); 45 45 } 46 if (!catalog.Nave _disk) {46 if (!catalog.Naves_disk) { 47 47 dvo_catalog_unlock (&catalog); 48 48 dvo_catalog_free (&catalog); -
trunk/Ohana/src/delstar/src/delete_orphans.c
r8386 r15743 252 252 catalog.Nmeasure = Nmeas; 253 253 catalog.Nmissing = Nmiss; 254 catalog.Nsecf_mem = Nave*Nsecfilt; 255 254 256 if (VERBOSE) fprintf (stderr, " ending with Nave, Nmeas, Nmiss: %d %d %d\n", Nave, Nmeas, Nmiss); 255 257 -
trunk/Ohana/src/delstar/src/delete_times.c
r14401 r15743 64 64 exit (2); 65 65 } 66 if (!catalog.Nave _disk) {66 if (!catalog.Naves_disk) { 67 67 dvo_catalog_unlock (&catalog); 68 68 dvo_catalog_free (&catalog); -
trunk/Ohana/src/delstar/src/find_matches.c
r12332 r15743 234 234 catalog[0].Nmeasure = Nmeas; 235 235 catalog[0].Nmissing = Nmiss; 236 catalog[0].Nsecf_mem = Nave*Nsecfilt; 237 236 238 if (VERBOSE) fprintf (stderr, " ending with Nave, Nmeas, Nmiss: %d %d %d\n", Nave, Nmeas, Nmiss); 237 239 -
trunk/Ohana/src/dvosplit/src/dvosplit.c
r15722 r15743 1 1 # include "dvosplit.h" 2 # define NROWS 100000 /* ~10MB per row for measures */3 2 3 // dvosplit (outlevel) [-region Rmin Rmax Dmin Dmax] 4 4 int main (int argc, char **argv) { 5 5 6 // USAGE: dvosplit (outlevel) [-region RA RA DEC DEC] 6 int i, j, OUT_DEPTH; 7 SkyTable *sky; 8 SkyList *skylist, *outlist; 9 Catalog incatalog, *outcatalogs; 10 AveLinks *avelinks; 11 char filename[256]; 7 12 8 // the output catalog needs to inherit the SKY_DEPTH of the input catalog. 9 // if the CATDIR/SkyTable.fits is not found, assume the HST layout (old default) 13 SetSignals (); 14 ConfigInit (&argc, argv); 15 args (argc, argv); 16 17 OUT_DEPTH = atoi (argv[1]); 10 18 11 19 // load the sky table for the existing database … … 13 21 SkyTableSetFilenames (sky, CATDIR, "cpt"); 14 22 15 // XXX I should just be copying the input sky and setting the output names on that16 // load the sky table for the existing database, generate output names17 outsky = SkyTableLoadOptimal (CATDIR, NULL, NULL, SKY_DEPTH_HST, VERBOSE);18 SkyTableSetFilenames (outsky, OUTDIR, "cpt");19 20 23 // get the list of populated regions 21 skylist = SkyListByPatch (sky, -1, & REGION);24 skylist = SkyListByPatch (sky, -1, &UserPatch); 22 25 23 26 for (i = 0; i < skylist[0].Nregions; i++) { … … 27 30 // if (current level == out level) skip: no action is needed 28 31 if (skylist[0].regions[i][0].depth >= OUT_DEPTH) continue; 29 30 outlist = SkyListByPatch (outsky, OUT_DEPTH, skylist[0].regions[i]);31 32 32 33 // set the parameters which guide catalog open/load/create … … 42 43 43 44 // skip empty input catalogs 44 if (!incatalog.Nave _disk) {45 if (!incatalog.Naves_disk) { 45 46 dvo_catalog_unlock (&incatalog); 46 47 dvo_catalog_free (&incatalog); … … 48 49 } 49 50 50 outcatalog = SkyTableSubdivide (&incatalog, &Noutcatalog); 51 // change sky.regions[i].depth for these regions 52 outlist = SkyListByPatch (sky, OUT_DEPTH, skylist[0].regions[i]); 51 53 52 // split out the average entries: 53 incatalog.catflags = LOAD_AVES; 54 Nblocks = incatalog.Nave_disk / NROWS; 55 for (j = 0; j < Nblocks; j++) { 54 outcatalogs = open_output_catalogs (outlist); 56 55 57 // read up to NROWS at a time 58 dvo_catalog_load_segment (&incatalog, VERBOSE, j*NROWS, NROWS); 56 avelinks = split_averages (&incatalog, outlist, outcatalogs); 59 57 60 for (k = 0; k < incatalog.Naverage; k++) { 61 averef = j*NROWS + k; 62 63 inR = incatalog.average[k].R; 64 inD = incatalog.average[k].D; 58 split_measures (&incatalog, outlist, outcatalogs, avelinks); 65 59 66 // which of the outcatalogs contains this coordinate? 60 // XXX missing entries have to be reconstructed if they are desired 61 // split_missings (&incatalog, outlist, outcatalogs, avelinks); 67 62 68 N = -1; 69 for (n = 0; n < Noutcatalog; n++) { 70 if (inR < outregions[n].Rmin) continue; 71 if (inR > outregions[n].Rmax) continue; 72 if (inD < outregions[n].Dmin) continue; 73 if (inD > outregions[n].Dmax) continue; 74 Ncat = n; 75 break; 76 } 77 if (Ncat == -1) continue; 63 dvo_catalog_unlock (&incatalog); 78 64 79 // XXX this probably needs to be Nave_disk so we can have partial saves 80 Nout = outcatalog[Ncat].Naverage; 81 outref[averef] = Nout; 82 outcat[averef] = Ncat; 83 84 outcatalog[Ncat].average[Nout] = incatalog.average[k]; 85 outcatalog[Ncat].Naverage++; 86 } 87 88 for (n = 0; n < Noutcatalog; n++) { 89 dvo_catalog_save_segment (&outcatalog[Ncat], VERBOSE, outcatalog[Ncat].Nave_disk, outcatalog[Ncat].Naverage); 90 } 65 for (j = 0; j < outlist[0].Nregions; j++) { 66 dvo_catalog_unlock (&outcatalogs[j]); 91 67 } 92 68 93 // split out the measure entries: 94 incatalog.catflags = LOAD_MEAS; 95 Nblocks = incatalog.Nmeas_disk / NROWS; 96 for (j = 0; j < Nblocks; j++) { 97 98 // read up to NROWS at a time 99 dvo_catalog_load_segment (&incatalog, VERBOSE, j*NROWS, NROWS); 100 101 for (k = 0; k < incatalog.Nmeasure; k++) { 102 103 averef = incatalog.measure[k].averef; 104 Ncat = outcat[averef]; 105 106 Nout = outcatalog[Ncat].Nmeasure; 107 outcatalog[Ncat].measure[Nout] = incatalog.measure[k]; 108 outcatalog[Ncat].measure[Nout].averef = outref[averef]; 109 outcatalog[Ncat].Nmeasure++; 110 } 111 112 for (n = 0; n < Noutcatalog; n++) { 113 dvo_catalog_save_segment (&outcatalog[N], VERBOSE, outcatalog[N].Nmeas_disk, outcatalog[N].Nmeasure); 114 } 69 // adjust depth 70 skylist[0].regions[i][0].table = FALSE; 71 for (j = 0; j < outlist[0].Nregions; j++) { 72 outlist[0].regions[j][0].table = TRUE; 115 73 } 116 74 117 // split out the secfilt entries: 118 incatalog.catflags = LOAD_SECF; 119 Nblocks = incatalog.Nsecfilt_disk / NROWS; 120 for (j = 0; j < Nblocks; j++) { 75 } 121 76 122 // read up to NROWS at a time 123 dvo_catalog_load_segment (&incatalog, VERBOSE, j*NROWS, NROWS); 77 // save sky table copy 78 sprintf (filename, "%s/SkyTable.fits", CATDIR); 79 check_file_access (filename, FALSE, VERBOSE); 80 if (!SkyTableSave (sky, filename)) { 81 fprintf (stderr, "ERROR: failed to save sky table for %s\n", CATDIR); 82 exit (1); 83 } 124 84 125 for (k = 0; k < incatalog.Naverage; k++) { 126 127 averef = j*NROWS + k; 128 Ncat = outcat[averef]; 129 Nout = outref[averef] * Nsecfilt; 130 131 for (n = 0; n < Nsecfilt; n++) { 132 outcatalog[Ncat].secfilt[Nout + n] = incatalog.measure[k*Nsecfilt + n]; 133 } 134 } 135 136 for (n = 0; n < Noutcatalog; n++) { 137 dvo_catalog_save_segment (&outcatalog[N], VERBOSE, outcatalog[N].Nmeas_disk, outcatalog[N].Nmeasure); 138 } 139 } 140 85 exit (0); 86 } -
trunk/Ohana/src/gastro/src/getptolemy.c
r12332 r15743 36 36 dvo_catalog_unlock (&catalog); 37 37 38 // Nave _disk == 0 implies an empty catalog file38 // Naves_disk == 0 implies an empty catalog file 39 39 // for only_match, skip empty catalogs 40 if (!catalog.Nave _disk) {40 if (!catalog.Naves_disk) { 41 41 dvo_catalog_free (&catalog); 42 42 continue; -
trunk/Ohana/src/gastro2/src/getptolemy.c
r12332 r15743 38 38 dvo_catalog_unlock (&catalog); 39 39 40 // Nave _disk == 0 implies an empty catalog file40 // Naves_disk == 0 implies an empty catalog file 41 41 // for only_match, skip empty catalogs 42 if (!catalog.Nave _disk) {42 if (!catalog.Naves_disk) { 43 43 dvo_catalog_free (&catalog); 44 44 continue; -
trunk/Ohana/src/getstar/src/getstar.c
r15540 r15743 21 21 output.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 22 22 output.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 23 output.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; 23 24 output.Nsecfilt = GetPhotcodeNsecfilt (); 24 25 … … 47 48 exit (2); 48 49 } 49 if (!catalog.Nave _disk) {50 if (!catalog.Naves_disk) { 50 51 dvo_catalog_unlock (&catalog); 51 52 dvo_catalog_free (&catalog); … … 78 79 } 79 80 /* skip empty catalogs */ 80 if (!catalog.Nave _disk) continue;81 if (!catalog.Naves_disk) continue; 81 82 stars = select_by_image (&catalog, &image, 0, 0, stars, &Nstars); 82 83 } -
trunk/Ohana/src/getstar/src/select_by_region.c
r15543 r15743 91 91 output[0].Naverage = Nave; 92 92 output[0].Nmeasure = Nmeas; 93 output[0].Nsecf_mem = Nave*Nsecfilt; 94 93 95 fprintf (stderr, "output catalog has %d stars (%d measures, %d secfilt)\n", 94 96 output[0].Naverage, output[0].Nmeasure, output[0].Nsecfilt); -
trunk/Ohana/src/libdvo/doc/dvo-catalogs.txt
r8328 r15743 2 2 // APIs related to the DVO catalogs: 3 3 4 // XXX change name5 // XXX add SORTED test to load6 // XXX add Nsecfilt test? or add an API?7 4 load_catalog (Catalog *catalog, int VERBOSE); 8 // returns9 // 0: failure to lock catalog10 // 1: success: file is locked and opened11 // 2: success: file is locked but empty12 5 13 6 dvo_catalog_lock (Catalog *catalog, int lockmode); … … 20 13 // layout: RAW, MEF, SPLIT 21 14 // mode: READ, WRITE 15 16 // returns 17 // DVO_CAT_OPEN_FAIL: failure to lock catalog 18 // DVO_CAT_OPEN_OK: success: file is locked and opened 19 // DVO_CAT_OPEN_EMPTY: success: file is locked but empty 20 21 the catalog is opened and the data for each of the elements (average, 22 measure, etc) is loaded if requested. Whether or not the data is 23 loaded, the values of catalog.Naves_disk,Naves_off,Naverage are set 24 to match the segment of data loaded. this API always loads either 25 the entire data set, or none. If none, the offset value is set to 26 point at the end of the table. 22 27 23 28 dvo_catalog_save (Catalog *catalog, int VERBOSE); … … 43 48 - open and read an existing catalog / error if missing (can be ignored) 44 49 50 dvo_catalog_open (Catalog *catalog, int mode); 45 51 46 dvo_catalog_open (Catalog *catalog, int mode); 52 dvo_catalog_load_segment_average (Catalog *catalog, int start, int Nrows) 53 54 this function reads in the requested number of rows from the catalog 55 for the Average and SecFilt tables only. It is possible within the 56 DVO framework to examine the average values in slices. 57 58 dvo_catalog_load_segment_measure (Catalog *catalog, int start, int Nrows) 59 60 this function reads in the requested number of rows from the catalog 61 for the Measure table only. It is not guaranteed to be possible to 62 examine the measure values in slices if reference is needed to their 63 average values. 64 65 dvo_catalog_load_segment_missing (Catalog *catalog, int start, int Nrows) 66 67 this function reads in the requested number of rows from the catalog 68 for the Missing table only. It is not guaranteed to be possible to 69 examine the missing values in slices if reference is needed to their 70 average values. -
trunk/Ohana/src/libdvo/include/dvo.h
r15722 r15743 22 22 typedef enum {T_UNDEF = -1, T_NONE, T_OBJECT, T_DARK, T_BIAS, T_FLAT, T_MASK, T_FRINGE, T_SCATTER, T_MODES, T_FRINGEPTS, T_ANY, N_TYPE} ElixirDetrendTypes; 23 23 typedef enum {M_UNDEF = -1, M_NONE, M_MEF, M_SPLIT, M_SINGLE, M_CUBE, M_SLICE, M_MODES, N_MODE} ElixirDetrendModes; 24 25 typedef enum {DVO_CAT_OPEN_FAIL, DVO_CAT_OPEN_OK, DVO_CAT_OPEN_EMPTY} DVOCatalogOpenModes; 24 26 25 27 typedef enum { … … 195 197 Missing *missing; 196 198 SecFilt *secfilt; 197 int Naverage, Nmeasure, Nmissing, Nsecfilt; /* current number of each component */ 198 int Nave_disk, Nmeas_disk, Nmiss_disk; /* number of component on disk */ 199 int Nmeas_off; /* dist seq of first loaded data value */ 200 /* note the different counting for Nsecfilt */ 199 200 int Nsecfilt; /* number of secfilt entries for each average entry */ 201 int Naverage, Nmeasure, Nmissing, Nsecf_mem; /* current number of each component in memory */ 202 int Naves_disk, Nmeas_disk, Nmiss_disk, Nsecf_disk; /* current number of each component on disk */ 203 int Naves_off, Nmeas_off, Nmiss_off, Nsecf_off; /* index of first loaded data value */ 204 205 /* note the different counting for Nsecfilt: 206 number of secfilt rows on disk is: Nave_disk * Nsecfilt 207 number of secfilt rows in mem is: Naverage * Nsecfilt 208 *** that is just silly, and bad: convert to using Nsec_mem, Nsec_disk, Nsec_off. 209 *** unless we always require the secfilt and average entries to be loaded sychronously. 210 */ 201 211 202 212 /* pointers to split data files */ -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r15509 r15743 90 90 catalog[0].Nmeasure = 0; 91 91 catalog[0].Nmissing = 0; 92 93 catalog[0].Nave_disk = 0; 92 catalog[0].Nsecf_mem = 0; 93 94 catalog[0].Naves_disk = 0; 94 95 catalog[0].Nmeas_disk = 0; 95 96 catalog[0].Nmiss_disk = 0; 97 catalog[0].Nsecf_disk = 0; 98 99 catalog[0].Naves_off = 0; 96 100 catalog[0].Nmeas_off = 0; 101 catalog[0].Nmiss_off = 0; 102 catalog[0].Nsecf_off = 0; 97 103 98 104 /* pointers to SPLIT data files */ … … 110 116 111 117 /* possible exit status for lock_catalog: 112 0- failure (including lock failure)113 1- success114 2- empty file (file may be open or closed!)118 DVO_CAT_OPEN_FAIL - failure (including lock failure) 119 DVO_CAT_OPEN_OK - success 120 DVO_CAT_OPEN_EMPTY - empty file (file may be open or closed!) 115 121 */ 116 122 int dvo_catalog_lock (Catalog *catalog, int lockmode) { … … 125 131 catalog[0].f = fsetlockfile (catalog[0].filename, 3600.0, catalog[0].lockmode, &dbstate); 126 132 127 if (dbstate == LCK_MISSING) return ( 2);128 if (dbstate == LCK_EMPTY) return ( 2);129 if (catalog[0].f == NULL) return ( 0);133 if (dbstate == LCK_MISSING) return (DVO_CAT_OPEN_EMPTY); 134 if (dbstate == LCK_EMPTY) return (DVO_CAT_OPEN_EMPTY); 135 if (catalog[0].f == NULL) return (DVO_CAT_OPEN_FAIL); 130 136 131 137 fseek (catalog[0].f, 0, SEEK_SET); 132 return ( 1);138 return (DVO_CAT_OPEN_OK); 133 139 } 134 140 … … 192 198 193 199 switch (dvo_catalog_lock (catalog, catalog[0].lockmode)) { 194 case 0:200 case DVO_CAT_OPEN_FAIL: 195 201 if (VERBOSE) fprintf (stderr, "can't lock file %s\n", catalog[0].filename); 196 202 return (FALSE); 197 case 1:203 case DVO_CAT_OPEN_OK: 198 204 if (!dvo_catalog_load (catalog, VERBOSE)) { 199 205 if (VERBOSE) fprintf (stderr, "failure loading catalog\n"); … … 206 212 if (VERBOSE) fprintf (stderr, "loaded existing file %s\n", catalog[0].filename); 207 213 break; 208 case 2:214 case DVO_CAT_OPEN_EMPTY: 209 215 if ((mode == DVO_OPEN_READ) || (mode == DVO_OPEN_UPDATE)) return (TRUE); 210 216 catalog[0].Nsecfilt = Nsecfilt; … … 235 241 if (!status) catalog[0].sorted = TRUE; 236 242 237 // even if the data is sorted on disk, if we only load the MEAS_META, we are238 // treating it as unsorted (eg, append only)239 if (catalog[0].catflags & LOAD_MEAS_META) {240 catalog[0].sorted = FALSE;241 }242 243 243 // determine catmode 244 244 if (!gfits_scan (&catalog[0].header, "NAXIS", "%d", 1, &Naxis)) { … … 275 275 } 276 276 277 // write out the data, unlink if empty? 277 // write out the data, unlink if empty? 'save' means: write out all data currently in 278 // memory. NOTE: this is currently not always possible: for non-SPLIT moe files, this 279 // operation may require expanding the file size, which does not automatically happen 278 280 int dvo_catalog_save (Catalog *catalog, char VERBOSE) { 279 281 … … 281 283 gfits_modify (&catalog[0].header, "SORTED", "%t", 1, catalog[0].sorted); 282 284 283 if (catalog[0].Nmeas_off != 0) { 284 if (!dvo_catalog_update (catalog, VERBOSE)) { 285 return (FALSE); 286 } 287 return (TRUE); 288 } 289 285 // XXX handle return status 290 286 switch (catalog[0].catmode) { 291 287 case DVO_MODE_RAW: … … 305 301 } 306 302 303 // write out the in-memory data which extends beyond the data on disk. NOTE: this is 304 // currently only possible for the SPLIT mode. 307 305 int dvo_catalog_update (Catalog *catalog, char VERBOSE) { 306 307 // set the 'sorted' header keyword 308 catalog[0].sorted = FALSE; 309 gfits_modify (&catalog[0].header, "SORTED", "%t", 1, catalog[0].sorted); 308 310 309 311 /* update is only valid for catmode SPLIT */ 310 312 switch (catalog[0].catmode) { 311 313 case DVO_MODE_RAW: 312 dvo_catalog_save_raw (catalog, VERBOSE);314 fprintf (stderr, "not allowed for RAW mode\n"); 313 315 break; 314 316 case DVO_MODE_MEF: 315 dvo_catalog_save_mef (catalog, VERBOSE);317 fprintf (stderr, "not allowed for MEF mode\n"); 316 318 break; 317 319 case DVO_MODE_SPLIT: 318 /* new file needs to use save_catalog_split */ 319 if (catalog[0].Nave_disk == 0) { 320 dvo_catalog_save_split (catalog, VERBOSE); 321 } else { 322 dvo_catalog_update_split (catalog, VERBOSE); 323 } 320 dvo_catalog_update_split (catalog, VERBOSE); 324 321 break; 325 322 default: … … 360 357 catalog[0].secfilt = outsec; 361 358 catalog[0].Nsecfilt = Nsecfilt; 359 catalog[0].Nsecf_mem = Nsecfilt * catalog[0].Naverage; 362 360 } 363 361 return (TRUE); … … 396 394 style : raw, mef, split, mysql 397 395 */ 396 397 int dvo_catalog_load_segment (Catalog *catalog, int VERBOSE, int start, int Nrows) { 398 399 int Naxis, split, status; 400 char measure[80]; 401 402 // catformat determined in dvo_catalog_load_XXX function 403 catalog[0].catformat = DVO_FORMAT_UNDEF; 404 405 switch (catalog[0].catmode) { 406 case DVO_MODE_RAW: 407 if (VERBOSE) fprintf (stderr, "reading catalog (mode DVO_MODE_RAW)\n"); 408 fprintf (stderr, "cannot do this in raw mode\n"); 409 // dvo_catalog_load_segment_raw (catalog, VERBOSE, start, Nrows); 410 break; 411 case DVO_MODE_MEF: 412 if (VERBOSE) fprintf (stderr, "reading catalog (mode DVO_MODE_MEF)\n"); 413 fprintf (stderr, "cannot do this in mef mode\n"); 414 // dvo_catalog_load_segment_mef (catalog, VERBOSE, start, Nrows); 415 break; 416 case DVO_MODE_SPLIT: 417 if (VERBOSE) fprintf (stderr, "reading catalog (mode DVO_MODE_SPLIT)\n"); 418 dvo_catalog_load_segment_split (catalog, VERBOSE, start, Nrows); 419 break; 420 default: 421 fprintf (stderr, "error getting catalog mode\n"); 422 exit (2); 423 } 424 return (TRUE); 425 } 426 -
trunk/Ohana/src/libdvo/src/dvo_catalog_create.c
r14590 r15743 73 73 // lock the additional split files 74 74 // XXX clear residual locks if we fail 75 if (dvo_catalog_lock (catalog[0].measure_catalog, catalog[0].lockmode) != 2) {75 if (dvo_catalog_lock (catalog[0].measure_catalog, catalog[0].lockmode) != DVO_CAT_OPEN_EMPTY) { 76 76 fprintf (stderr, "error with file lock\n"); 77 77 exit (2); 78 78 } 79 if (dvo_catalog_lock (catalog[0].missing_catalog, catalog[0].lockmode) != 2) {79 if (dvo_catalog_lock (catalog[0].missing_catalog, catalog[0].lockmode) != DVO_CAT_OPEN_EMPTY) { 80 80 fprintf (stderr, "error with file lock\n"); 81 81 exit (2); 82 82 } 83 if (dvo_catalog_lock (catalog[0].secfilt_catalog, catalog[0].lockmode) != 2) {83 if (dvo_catalog_lock (catalog[0].secfilt_catalog, catalog[0].lockmode) != DVO_CAT_OPEN_EMPTY) { 84 84 fprintf (stderr, "error with file lock\n"); 85 85 exit (2); -
trunk/Ohana/src/libdvo/src/dvo_catalog_mef.c
r15487 r15743 28 28 if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d", 1, &Nsecfilt)) Nsecfilt = 0; 29 29 30 /* save the current number so we can do partial updates */ 31 catalog[0].Naves_disk = Naverage; 32 catalog[0].Nmeas_disk = Nmeasure; 33 catalog[0].Nmiss_disk = Nmissing; 34 catalog[0].Nsecf_disk = Naverage * Nsecfilt; 35 30 36 /** Nsecfilt is unusual: it does not list the number of data items in the table 31 37 instead, the number of items is Nsecfilt * Naverage. **/ 32 38 catalog[0].Nsecfilt = Nsecfilt; 39 40 /* default values, but we will assign these a valid value before we exit (even if empty) */ 41 catalog[0].average = NULL; 42 catalog[0].measure = NULL; 43 catalog[0].missing = NULL; 44 catalog[0].secfilt = NULL; 33 45 34 46 /* validate table mode */ … … 46 58 } 47 59 /* old versions of DVO stored one of the average magnitudes in Average. we save this if needed */ 48 catalog[0].average = FtableToAverage (&ftable, &catalog[0].Naverage, &catalog[0].catformat, &primary); 49 if (Naverage != catalog[0].Naverage) { 50 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%d vs %d)\n", Naverage, catalog[0].Naverage); 51 } 60 catalog[0].average = FtableToAverage (&ftable, &Naverage, &catalog[0].catformat, &primary); 61 if (Naverage != catalog[0].Naves_disk) { 62 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%d vs %d)\n", Naverage, catalog[0].Naves_disk); 63 } 64 catalog[0].Naverage = catalog[0].Naves_disk; 65 catalog[0].Naves_off = 0; 52 66 } else { 53 67 Nbytes = gfits_data_size (&header); 54 68 fseek (f, Nbytes, SEEK_CUR); 69 ALLOCATE (catalog[0].average, Average, 1); 70 catalog[0].Naverage = 0; 71 catalog[0].Naves_off = catalog[0].Naves_disk; 55 72 } 56 73 gfits_free_header (&header); … … 69 86 } 70 87 catalog[0].measure = FtableToMeasure (&ftable, &catalog[0].Nmeasure, &catalog[0].catformat); 71 if (Nmeasure != catalog[0].Nmeasure) { 72 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%d vs %d)\n", Nmeasure, catalog[0].Nmeasure); 73 } 88 if (Nmeasure != catalog[0].Nmeas_disk) { 89 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%d vs %d)\n", Nmeasure, catalog[0].Nmeas_disk); 90 } 91 catalog[0].Nmeasure = catalog[0].Nmeas_disk; 92 catalog[0].Nmeas_off = 0; 74 93 } else { 75 94 Nbytes = gfits_data_size (&header); 76 95 fseek (f, Nbytes, SEEK_CUR); 96 ALLOCATE (catalog[0].measure, Measure, 1); 97 catalog[0].Nmeasure = 0; 98 catalog[0].Nmeas_off = catalog[0].Nmeas_disk; 77 99 } 78 100 … … 90 112 /* no conversions currently defined */ 91 113 catalog[0].missing = gfits_table_get_Missing (&ftable, &catalog[0].Nmissing, NULL); 92 if (Nmissing != catalog[0].Nmissing) { 93 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%d vs %d)\n", Nmissing, catalog[0].Nmissing); 94 } 114 if (Nmissing != catalog[0].Nmiss_disk) { 115 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%d vs %d)\n", Nmissing, catalog[0].Nmiss_disk); 116 } 117 catalog[0].Nmissing = catalog[0].Nmiss_disk; 118 catalog[0].Nmiss_off = 0; 95 119 } else { 96 120 Nbytes = gfits_data_size (&header); 97 121 fseek (f, Nbytes, SEEK_CUR); 122 ALLOCATE (catalog[0].missing, Missing, 1); 123 catalog[0].Nmissing = 0; 124 catalog[0].Nmiss_off = catalog[0].Nmiss_disk; 98 125 } 99 126 … … 125 152 Ntmpfilt = catalog[0].Nsecfilt; 126 153 Nsecfilt = catalog[0].Nsecfilt + 1; 127 Ntotal = Nsecfilt * catalog[0].Nave rage;154 Ntotal = Nsecfilt * catalog[0].Naves_disk; 128 155 ALLOCATE (catalog[0].secfilt, SecFilt, Ntotal); 129 for (i = 0; i < catalog[0].Nave rage; i++) {156 for (i = 0; i < catalog[0].Naves_disk; i++) { 130 157 catalog[0].secfilt[i*Nsecfilt + 0] = primary[i]; 131 158 for (j = 0; j < Ntmpfilt; j++) { … … 134 161 } 135 162 catalog[0].Nsecfilt = Nsecfilt; 163 catalog[0].Nsecf_disk = Ntotal; 136 164 free (primary); 137 165 } 138 166 catalog[0].Nsecf_mem = catalog[0].Nsecf_disk; 167 catalog[0].Nsecf_off = 0; 139 168 } else { 140 169 /* no real need to skip the data array here... */ 141 170 Nbytes = gfits_data_size (&header); 142 171 fseek (f, Nbytes, SEEK_CUR); 143 if (primary != NULL) free (primary); 144 } 145 146 /* save the current number so we can do partial updates */ 147 catalog[0].Nave_disk = catalog[0].Naverage; 148 catalog[0].Nmeas_disk = catalog[0].Nmeasure; 149 catalog[0].Nmiss_disk = catalog[0].Nmissing; 172 if (primary != NULL) { 173 free (primary); 174 catalog[0].Nsecfilt ++; 175 catalog[0].Nsecf_disk = catalog[0].Nsecfilt * catalog[0].Naves_disk; 176 } 177 ALLOCATE (catalog[0].secfilt, SecFilt, 1); 178 catalog[0].Nsecf_mem = 0; 179 catalog[0].Nsecf_off = catalog[0].Nsecf_disk; 180 } 150 181 151 182 return (TRUE); -
trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
r15035 r15743 171 171 } 172 172 catalog[0].Nsecfilt = Nsecfilt; 173 catalog[0].Nsecf_mem = Ntotal; 173 174 free (primary); 174 175 } … … 201 202 202 203 /* save the current number so we can do partial updates */ 203 catalog[0].Nave _disk= catalog[0].Naverage;204 catalog[0].Naves_disk = catalog[0].Naverage; 204 205 catalog[0].Nmeas_disk = catalog[0].Nmeasure; 205 206 catalog[0].Nmiss_disk = catalog[0].Nmissing; -
trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
r15487 r15743 1 1 # include <dvo.h> 2 3 // return options: 4 // * error (cannot lock, open, read, etc) 5 // * empty (file is not found) 6 // * ok 7 8 int dvo_catalog_secfilt_to_primary (Catalog *catalog, SecFilt **myPrimary, SecFilt **mySecfilt, int *myNsecfilt) { 9 10 int i, j, Nallfilt, Nsecfilt, Ntotal; 11 12 SecFilt *primary; 13 SecFilt *secfilt; 14 15 if (catalog[0].secfilt == NULL) { 16 fprintf (stderr, "missing secfilt, cannot build output averages (dvo_catalog_split.c)\n"); 17 exit (1); 18 } 19 secfilt = catalog[0].secfilt; 20 21 // XXX this translation only works if we have loaded / created a matched average/secfilt set 22 assert (catalog[0].Nsecf_mem == catalog[0].Nsecfilt*catalog[0].Naverage); 23 24 Nallfilt = catalog[0].Nsecfilt; 25 Nsecfilt = catalog[0].Nsecfilt - 1; 26 Ntotal = Nsecfilt * catalog[0].Naverage; 27 ALLOCATE (primary, SecFilt, catalog[0].Naverage); 28 ALLOCATE (secfilt, SecFilt, Ntotal); 29 30 for (i = 0; i < catalog[0].Naverage; i++) { 31 primary[i] = secfilt[i*Nallfilt + 0]; 32 for (j = 0; j < Nsecfilt; j++) { 33 secfilt[i*Nsecfilt + j] = catalog[0].secfilt[i*Nallfilt + j + 1]; 34 } 35 } 36 catalog[0].Nsecfilt --; 37 catalog[0].Nsecf_mem = catalog[0].Naverage*catalog[0].Nsecfilt; 38 39 *myPrimary = primary; 40 *mySecfilt = secfilt; 41 *myNsecfilt = Nsecfilt; 42 } 43 44 int dvo_catalog_primary_to_secfilt (Catalog *catalog, SecFilt *primary, int Naves) { 45 46 int Ntmpfilt, Nsecfilt, Ntotal, i, j; 47 SecFilt *tmpfilt; 48 49 tmpfilt = catalog[0].secfilt; 50 Ntmpfilt = catalog[0].Nsecfilt; 51 52 // we do NOT modify Nsecf_disk; this operation only modifies in in-memory values 53 54 catalog[0].Nsecfilt ++; 55 Nsecfilt = catalog[0].Nsecfilt; 56 Ntotal = Nsecfilt * Naves; 57 58 catalog[0].Nsecf_mem = Ntotal; 59 60 ALLOCATE (catalog[0].secfilt, SecFilt, Ntotal); 61 for (i = 0; i < Naves; i++) { 62 catalog[0].secfilt[i*Nsecfilt + 0] = primary[i]; 63 for (j = 0; j < Ntmpfilt; j++) { 64 catalog[0].secfilt[i*Nsecfilt + j + 1] = tmpfilt[i*Ntmpfilt + j]; 65 } 66 } 67 free (primary); 68 return (TRUE); 69 } 70 71 int dvo_catalog_save_subcat (Catalog *catalog, FTable *ftable, int start, int Nrows, int Ndisk, int Ntotal) { 72 73 Matrix matrix; 74 75 /* rewind file pointers and truncate (file is still open) */ 76 fseek (catalog->f, 0, SEEK_SET); 77 78 // write PHU header 79 if (!gfits_fwrite_header (catalog->f, &catalog->header)) { 80 fprintf (stderr, "can't write primary header"); 81 return (FALSE); 82 } 83 84 // write the PHU matrix; this is probably a NOP, do I have to keep it in? 85 gfits_create_matrix (&catalog->header, &matrix); 86 if (!gfits_fwrite_matrix (catalog->f, &matrix)) { 87 fprintf (stderr, "can't write primary matrix"); 88 gfits_free_matrix (&matrix); 89 return (FALSE); 90 } 91 gfits_free_matrix (&matrix); 92 93 // write the table data 94 if (!gfits_fwrite_ftable_range (catalog->f, ftable, start, Nrows, Ndisk, Ntotal)) { 95 fprintf (stderr, "can't write table data"); 96 return (FALSE); 97 } 98 return (TRUE); 99 } 100 101 int dvo_catalog_open_subcat (Catalog *catalog, Catalog **Subcat, Header *header, char *name, int VERBOSE) { 102 103 int status; 104 char *path, string[80]; 105 Catalog *subcat; 106 Matrix matrix; 107 108 /* in split mode, we need to init & open the corresponding measure file (even if we do not read 109 * any data in at this stage) */ 110 ALLOCATE (subcat, Catalog, 1); 111 dvo_catalog_init (subcat, TRUE); 112 113 /* needed to find the split files below */ 114 path = pathname (catalog[0].filename); 115 116 /* get split filename from main header (paths relative to cpt file) */ 117 if (!gfits_scan (&catalog[0].header, name, "%s", 1, string)) return (DVO_CAT_OPEN_FAIL); 118 ALLOCATE (subcat[0].filename, char, strlen(path) + strlen(string) + 2); 119 sprintf (subcat[0].filename, "%s/%s", path, string); 120 121 /* lock & open catalog file */ 122 status = dvo_catalog_lock (subcat, catalog[0].lockmode); 123 if (status != DVO_CAT_OPEN_OK) { 124 if (VERBOSE) { 125 if (status == DVO_CAT_OPEN_EMPTY) { 126 fprintf (stderr, "%s (%s) is empty\n", name, subcat[0].filename); 127 } else { 128 fprintf (stderr, "failure to lock %s (%s)\n", name, subcat[0].filename); 129 } 130 } 131 return (status); 132 } 133 134 /* read PHU */ 135 if (!gfits_load_header (subcat[0].f, &subcat[0].header)) { 136 if (VERBOSE) fprintf (stderr, "error reading %s header: %s\n", name, subcat[0].filename); 137 return (DVO_CAT_OPEN_FAIL); 138 } 139 /* matrix should be empty : XXX skip the matrix data? */ 140 if (!gfits_fread_matrix (subcat[0].f, &matrix, &subcat[0].header)) { 141 if (VERBOSE) fprintf (stderr, "can't read primary matrix for %s\n", name); 142 return (DVO_CAT_OPEN_FAIL); 143 } 144 gfits_free_matrix (&matrix); 145 /* read Measure table header */ 146 if (!gfits_fread_header (subcat[0].f, header)) { 147 if (VERBOSE) fprintf (stderr, "can't read %s PHU header\n", name); 148 return (DVO_CAT_OPEN_FAIL); 149 } 150 151 *Subcat = subcat; 152 return (DVO_CAT_OPEN_OK); 153 } 2 154 3 155 int dvo_catalog_load_split (Catalog *catalog, int VERBOSE) { … … 9 161 FTable ftable; 10 162 SecFilt *primary; 11 Catalog *measure, *missing, *secfilt;12 163 13 164 /* ftable header storage for below */ 14 165 ftable.header = &header; 166 ftable.buffer = NULL; 167 header.buffer = NULL; 168 primary = NULL; 15 169 16 170 /* needed to find the split files below */ … … 23 177 if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d", 1, &Nsecfilt)) Nsecfilt = 0; 24 178 179 /* save the current number so we can do partial updates */ 180 catalog[0].Naves_disk = Naverage; 181 catalog[0].Nmeas_disk = Nmeasure; 182 catalog[0].Nmiss_disk = Nmissing; 183 catalog[0].Nsecf_disk = Naverage * Nsecfilt; 184 25 185 /** Nsecfilt is unusual: it does not list the number of data items in the table 26 186 instead, the number of items is Nsecfilt * Naverage. **/ 27 catalog[0].Nsecfilt = Nsecfilt;28 29 /* default values */187 catalog[0].Nsecfilt = Nsecfilt; 188 189 /* default values, but we will assign these a valid value before we exit (even if empty) */ 30 190 catalog[0].average = NULL; 31 191 catalog[0].measure = NULL; … … 33 193 catalog[0].secfilt = NULL; 34 194 35 /* XXX EAM : validate table mode */36 37 195 /*** Average Table ***/ 38 39 196 if (catalog[0].catflags & LOAD_AVES) { 40 197 /* move pointer past header -- must be already read (load_catalog) */ 41 198 fseek (catalog[0].f, catalog[0].header.size, SEEK_SET); 42 /* matrix should be empty */199 /* matrix should be empty : XXX should we drop this step and skip the data? */ 43 200 if (!gfits_fread_matrix (catalog[0].f, &matrix, &catalog[0].header)) { 44 201 if (VERBOSE) fprintf (stderr, "can't read primary matrix"); … … 50 207 return (FALSE); 51 208 } 52 /* read Average table data */209 /* read Average table data : format is irrelevant here */ 53 210 if (!gfits_fread_ftable_data (catalog[0].f, &ftable)) { 54 211 if (VERBOSE) fprintf (stderr, "can't read table average data"); 55 212 return (FALSE); 56 213 } 57 /* old versions of DVO stored one of the average magnitudes in Average. we save this if needed */ 58 catalog[0].average = FtableToAverage (&ftable, &catalog[0].Naverage, &catalog[0].catformat, &primary); 59 if (Naverage != catalog[0].Naverage) { 60 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%d vs %d)\n", Naverage, catalog[0].Naverage); 61 } 62 gfits_free_header (&header); 63 } 214 /* convert the saved version of the table to the internal version. Old versions of DVO stored 215 * one of the average magnitudes in Average. We save this in case it is needed below. NOTE: 216 * primary is only used if we read in the secfilt table, otherwise it should be freed */ 217 catalog[0].average = FtableToAverage (&ftable, &Naverage, &catalog[0].catformat, &primary); 218 if (Naverage != catalog[0].Naves_disk) { 219 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%d vs %d)\n", Naverage, catalog[0].Naves_disk); 220 } 221 gfits_free_header (&header); 222 catalog[0].Naverage = catalog[0].Naves_disk; 223 catalog[0].Naves_off = 0; 224 } else { 225 ALLOCATE (catalog[0].average, Average, 1); 226 catalog[0].Naverage = 0; 227 catalog[0].Naves_off = catalog[0].Naves_disk; 228 } 64 229 65 230 /*** Measure Table ***/ 66 67 measure = NULL; 68 69 /* (Full Load) */ 70 if (catalog[0].catflags & LOAD_MEAS) { 71 ALLOCATE (measure, Catalog, 1); 72 dvo_catalog_init (measure, TRUE); 73 74 /* get split filename from main header (paths relative to cpt file) */ 75 if (!gfits_scan (&catalog[0].header, "MEASURE", "%s", 1, string)) return (FALSE); 76 ALLOCATE (measure[0].filename, char, strlen(path) + strlen(string) + 2); 77 sprintf (measure[0].filename, "%s/%s", path, string); 78 79 /* lock & open catalog file */ 80 if (dvo_catalog_lock (measure, catalog[0].lockmode) != 1) { 81 fprintf (stderr, "cannot access measure file %s\n", measure[0].filename); 82 exit (2); 83 } 84 85 /* read PHU */ 86 if (!gfits_load_header (measure[0].f, &measure[0].header)) { 87 if (VERBOSE) fprintf (stderr, "catalog file does not exist: %s\n", measure[0].filename); 88 return (FALSE); 89 } 90 /* matrix should be empty */ 91 if (!gfits_fread_matrix (measure[0].f, &matrix, &measure[0].header)) { 92 if (VERBOSE) fprintf (stderr, "can't read primary matrix\n"); 93 return (FALSE); 94 } 95 /* read Measure table header */ 96 if (!gfits_fread_header (measure[0].f, &header)) { 97 if (VERBOSE) fprintf (stderr, "can't read measure PHU header\n"); 98 return (FALSE); 99 } 231 status = dvo_catalog_open_subcat (catalog, &catalog[0].measure_catalog, ftable.header, "MEASURE", VERBOSE); 232 if (status == DVO_CAT_OPEN_FAIL) { 233 return (FALSE); 234 } 235 if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nmeas_disk > 0)) { 236 return (FALSE); 237 } 238 if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_MEAS)) { 239 // XXX this allows an empty Measure catalog with non-empty Average catalog : is that OK? 100 240 /* read Measure table data */ 101 if (!gfits_fread_ftable_data ( measure[0].f, &ftable)) {241 if (!gfits_fread_ftable_data (catalog[0].measure_catalog[0].f, &ftable)) { 102 242 if (VERBOSE) fprintf (stderr, "can't read table measure data\n"); 103 243 return (FALSE); 104 244 } 105 /* convert data format to internal */ 106 catalog[0].measure = FtableToMeasure (&ftable, &catalog[0].Nmeasure, &catalog[0].catformat); 107 if (Nmeasure != catalog[0].Nmeasure) { 108 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%d vs %d)\n", Nmeasure, catalog[0].Nmeasure); 109 } 245 /* convert data format to internal : returns number of row read in Nmeasure */ 246 catalog[0].measure = FtableToMeasure (&ftable, &Nmeasure, &catalog[0].catformat); 247 if (Nmeasure != catalog[0].Nmeas_disk) { 248 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%d vs %d)\n", Nmeasure, catalog[0].Nmeas_disk); 249 } 250 catalog[0].Nmeasure = catalog[0].Nmeas_disk; 110 251 catalog[0].Nmeas_off = 0; 111 gfits_free_header (&header); 112 gfits_free_matrix (&matrix); 113 } 114 115 /* (Meta Load) */ 116 if (catalog[0].catflags & LOAD_MEAS_META) { 117 ALLOCATE (measure, Catalog, 1); 118 dvo_catalog_init (measure, TRUE); 119 120 /* get split filename from main header (paths relative to cpt file) */ 121 if (!gfits_scan (&catalog[0].header, "MEASURE", "%s", 1, string)) return (FALSE); 122 ALLOCATE (measure[0].filename, char, strlen(path) + strlen(string) + 2); 123 sprintf (measure[0].filename, "%s/%s", path, string); 124 125 /* lock & open catalog file */ 126 if (dvo_catalog_lock (measure, catalog[0].lockmode) != 1) { 127 fprintf (stderr, "cannot access measure file %s\n", measure[0].filename); 128 exit (2); 129 } 130 131 /* read PHU */ 132 if (!gfits_load_header (measure[0].f, &measure[0].header)) { 133 if (VERBOSE) fprintf (stderr, "catalog file does not exist: %s\n", measure[0].filename); 134 return (FALSE); 135 } 136 137 /* allocate dummy data for valid realloc */ 252 } else { 253 // XXX is it necessary to generate a template header here? 254 gfits_create_header (&catalog[0].measure_catalog[0].header); 138 255 ALLOCATE (catalog[0].measure, Measure, 1); 139 140 /* set up the table size information */ 141 catalog[0].Nmeasure = 0; /* no rows loaded */ 142 catalog[0].Nmeas_off = Nmeasure; /* start of new entries */ 143 } 144 catalog[0].measure_catalog = measure; 256 catalog[0].Nmeasure = 0; 257 catalog[0].Nmeas_off = catalog[0].Nmeas_disk; 258 } 259 gfits_free_header (ftable.header); 145 260 146 261 /*** Missing Table ***/ 147 148 missing = NULL; 149 if (catalog[0].catflags & LOAD_MISS) { 150 ALLOCATE (missing, Catalog, 1); 151 dvo_catalog_init (missing, TRUE); 152 153 /* get split filename from main header (paths relative to cpt file) */ 154 if (!gfits_scan (&catalog[0].header, "MISSING", "%s", 1, string)) return (FALSE); 155 ALLOCATE (missing[0].filename, char, strlen(path) + strlen(string) + 2); 156 sprintf (missing[0].filename, "%s/%s", path, string); 157 158 /* lock & open catalog file */ 159 status = dvo_catalog_lock (missing, catalog[0].lockmode); 160 if (!status) { 161 fprintf (stderr, "ERROR: cannot access missing file %s\n", missing[0].filename); 162 exit (2); 163 } 164 if (status == 2) { 165 /* MISSING table is empty (this is not an error) */ 166 gfits_create_header (&missing[0].header); 167 goto missing_empty; 168 } 169 170 /* read PHU */ 171 if (!gfits_load_header (missing[0].f, &missing[0].header)) { 172 if (VERBOSE) fprintf (stderr, "catalog file does not exist: %s\n", missing[0].filename); 173 return (FALSE); 174 } 175 /* matrix should be empty */ 176 if (!gfits_fread_matrix (missing[0].f, &matrix, &missing[0].header)) { 177 if (VERBOSE) fprintf (stderr, "can't read primary matrix\n"); 178 return (FALSE); 179 } 180 /* read Missing table header */ 181 if (!gfits_fread_header (missing[0].f, &header)) { 182 if (VERBOSE) fprintf (stderr, "can't read table missing header\n"); 183 return (FALSE); 184 } 262 status = dvo_catalog_open_subcat (catalog, &catalog[0].missing_catalog, ftable.header, "MISSING", VERBOSE); 263 if (status == DVO_CAT_OPEN_FAIL) { 264 return (FALSE); 265 } 266 if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nmiss_disk > 0)) { 267 return (FALSE); 268 } 269 if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_MISS)) { 185 270 /* read Missing table data */ 186 if (!gfits_fread_ftable_data ( missing[0].f, &ftable)) {271 if (!gfits_fread_ftable_data (catalog[0].missing_catalog[0].f, &ftable)) { 187 272 if (VERBOSE) fprintf (stderr, "can't read table missing data\n"); 188 273 return (FALSE); 189 274 } 190 /* no conversions currently defined */ 191 catalog[0].missing = gfits_table_get_Missing (&ftable, &catalog[0].Nmissing, NULL); 192 if (Nmissing != catalog[0].Nmissing) { 193 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%d vs %d)\n", Nmissing, catalog[0].Nmissing); 194 } 195 gfits_free_header (&header); 196 gfits_free_matrix (&matrix); 197 } 198 missing_empty: 199 catalog[0].missing_catalog = missing; 275 /* no conversions currently defined : this just does the byte swap */ 276 catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL); 277 if (Nmissing != catalog[0].Nmiss_disk) { 278 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%d vs %d)\n", Nmissing, catalog[0].Nmiss_disk); 279 } 280 catalog[0].Nmissing = catalog[0].Nmiss_disk; 281 catalog[0].Nmiss_off = 0; 282 } else { 283 // XXX is it necessary to generate a template header here? 284 gfits_create_header (&catalog[0].missing_catalog[0].header); 285 ALLOCATE (catalog[0].missing, Missing, 1); 286 catalog[0].Nmissing = 0; 287 catalog[0].Nmiss_off = catalog[0].Nmiss_disk; 288 } 289 gfits_free_header (ftable.header); 200 290 201 291 /*** Secfilt Table ***/ 202 203 secfilt = NULL; 204 if (catalog[0].catflags & LOAD_SECF) { 205 ALLOCATE (secfilt, Catalog, 1); 206 dvo_catalog_init (secfilt, TRUE); 207 208 /* get split filename from main header (paths relative to cpt file) */ 209 if (!gfits_scan (&catalog[0].header, "SECFILT", "%s", 1, string)) return (FALSE); 210 ALLOCATE (secfilt[0].filename, char, strlen(path) + strlen(string) + 2); 211 sprintf (secfilt[0].filename, "%s/%s", path, string); 212 213 /* lock & open catalog file */ 214 if (dvo_catalog_lock (secfilt, catalog[0].lockmode) != 1) { 215 fprintf (stderr, "cannot access secfilt file %s\n", secfilt[0].filename); 216 exit (2); 217 } 218 219 /* read PHU */ 220 if (!gfits_load_header (secfilt[0].f, &secfilt[0].header)) { 221 if (VERBOSE) fprintf (stderr, "catalog file does not exist: %s\n", secfilt[0].filename); 222 return (FALSE); 223 } 224 /* matrix should be empty */ 225 if (!gfits_fread_matrix (secfilt[0].f, &matrix, &secfilt[0].header)) { 226 if (VERBOSE) fprintf (stderr, "can't read primary matrix\n"); 227 return (FALSE); 228 } 229 /* read secfilt table header */ 230 if (!gfits_fread_header (secfilt[0].f, &header)) { 231 if (VERBOSE) fprintf (stderr, "can't read table secfilt header\n"); 232 return (FALSE); 233 } 292 status = dvo_catalog_open_subcat (catalog, &catalog[0].secfilt_catalog, ftable.header, "SECFILT", VERBOSE); 293 if (status == DVO_CAT_OPEN_FAIL) { 294 return (FALSE); 295 } 296 if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nsecf_disk > 0)) { 297 return (FALSE); 298 } 299 if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_SECF)) { 234 300 /* read secfilt table data */ 235 if (!gfits_fread_ftable_data ( secfilt[0].f, &ftable)) {301 if (!gfits_fread_ftable_data (catalog[0].secfilt_catalog[0].f, &ftable)) { 236 302 if (VERBOSE) fprintf (stderr, "can't read table secfilt data\n"); 237 303 return (FALSE); 238 304 } 239 Nexpect = catalog[0].Nsecfilt * catalog[0].Naverage;240 305 catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat); 241 if (Nexpect != Nitems) { 242 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%d vs %d)\n", Nexpect, Nitems); 243 } 306 if (Nitems != catalog[0].Nsecf_disk) { 307 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%d vs %d)\n", Nitems, catalog[0].Nsecf_disk); 308 } 309 catalog[0].Nsecf_mem = catalog[0].Nsecf_disk; 310 catalog[0].Nsecf_off = 0; 244 311 245 312 /* if primary is defined, we were supplied with one additional average magnitude from Average 246 313 we need to interleave these magnitudes with the secfilt entries just loaded */ 247 314 if (primary != NULL) { 248 int Ntmpfilt, Ntotal, i, j; 249 SecFilt *tmpfilt; 250 tmpfilt = catalog[0].secfilt; 251 Ntmpfilt = catalog[0].Nsecfilt; 252 Nsecfilt = catalog[0].Nsecfilt + 1; 253 Ntotal = Nsecfilt * catalog[0].Naverage; 254 ALLOCATE (catalog[0].secfilt, SecFilt, Ntotal); 255 for (i = 0; i < catalog[0].Naverage; i++) { 256 catalog[0].secfilt[i*Nsecfilt + 0] = primary[i]; 257 for (j = 0; j < Ntmpfilt; j++) { 258 catalog[0].secfilt[i*Nsecfilt + j + 1] = tmpfilt[i*Ntmpfilt + j]; 259 } 260 } 261 catalog[0].Nsecfilt = Nsecfilt; 315 // this modifies catalog.Nsecf_mem,Nsecfilt 316 dvo_catalog_primary_to_secfilt (catalog, primary, catalog[0].Naves_disk); 317 } 318 } else { 319 if (primary != NULL) { 262 320 free (primary); 263 } 264 265 266 gfits_free_header (&header); 267 gfits_free_matrix (&matrix); 268 } else { 269 if (primary != NULL) free (primary); 270 } 271 272 catalog[0].secfilt_catalog = secfilt; 273 274 /* save the current number so we can do partial updates */ 275 catalog[0].Nave_disk = Naverage; 276 catalog[0].Nmeas_disk = Nmeasure; 277 catalog[0].Nmiss_disk = Nmissing; 321 catalog[0].Nsecfilt ++; 322 } 323 gfits_create_header (&catalog[0].secfilt_catalog[0].header); 324 ALLOCATE (catalog[0].secfilt, SecFilt, 1); 325 catalog[0].Nsecf_mem = 0; 326 catalog[0].Nsecf_off = catalog[0].Nsecf_disk; 327 } 328 gfits_free_header (ftable.header); 278 329 279 330 return (TRUE); 280 331 } 281 332 282 /* save_catalog_split writes complete new files from scratch */ 333 // I need to always read both average and secfilt at the same time to correctly manage the 334 // primary secfilt values... 335 int dvo_catalog_load_segment_split (Catalog *catalog, int VERBOSE, int start, int Nrows) { 336 337 int Naverage, Nsecfilt, Nexpect, Nitems, Nmeasure, Nmissing; 338 Header header; 339 Matrix matrix; 340 FTable ftable; 341 SecFilt *primary; 342 343 /* ftable header storage for below */ 344 ftable.header = &header; 345 ftable.buffer = NULL; 346 header.buffer = NULL; 347 primary = NULL; 348 349 /*** Average (& SecFilt) Table ***/ 350 if (catalog[0].catflags & LOAD_AVES) { 351 352 /*** load the Average data ***/ 353 /* move pointer past header -- must be already read (load_catalog) */ 354 fseek (catalog[0].f, catalog[0].header.size, SEEK_SET); 355 /* matrix should be empty : XXX should we drop this step and skip the data? */ 356 if (!gfits_fread_matrix (catalog[0].f, &matrix, &catalog[0].header)) { 357 if (VERBOSE) fprintf (stderr, "can't read primary matrix"); 358 return (FALSE); 359 } 360 /* read Average table header */ 361 if (!gfits_fread_header (catalog[0].f, &header)) { 362 if (VERBOSE) fprintf (stderr, "can't read table average header"); 363 return (FALSE); 364 } 365 /* read Average table data : format is irrelevant here */ 366 if (!gfits_fread_ftable_range (catalog[0].f, &ftable, start, Nrows)) { 367 if (VERBOSE) fprintf (stderr, "can't read table average data"); 368 return (FALSE); 369 } 370 371 /* convert the saved version of the table to the internal version. Old versions of DVO stored 372 * one of the average magnitudes in Average. We save this in case it is needed below. NOTE: 373 * primary is only used if we read in the secfilt table, otherwise it should be freed */ 374 catalog[0].average = FtableToAverage (&ftable, &Naverage, &catalog[0].catformat, &primary); 375 if (Naverage != Nrows) { 376 // XXX this condition denotes the eof has been reached; not an error or a warning 377 // fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%d vs %d)\n", Naverage, Nrows); 378 } 379 gfits_free_header (&header); 380 catalog[0].Naverage = Naverage; 381 catalog[0].Naves_off = start; 382 383 /*** load the secfilt data ***/ 384 Catalog *subcat = catalog[0].secfilt_catalog; 385 386 /* move pointer past header -- must be already read (load_catalog) */ 387 fseek (subcat[0].f, subcat[0].header.size, SEEK_SET); 388 /* matrix should be empty : XXX should we drop this step and skip the data? */ 389 if (!gfits_fread_matrix (subcat[0].f, &matrix, &subcat[0].header)) { 390 if (VERBOSE) fprintf (stderr, "can't read primary matrix"); 391 return (FALSE); 392 } 393 /* read Secfilt table header */ 394 if (!gfits_fread_header (subcat[0].f, &header)) { 395 if (VERBOSE) fprintf (stderr, "can't read table measure header"); 396 return (FALSE); 397 } 398 /* read Secfilt table data : format is irrelevant here */ 399 if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start*catalog[0].Nsecfilt, catalog[0].Naverage*catalog[0].Nsecfilt)) { 400 if (VERBOSE) fprintf (stderr, "can't read table measure data"); 401 return (FALSE); 402 } 403 404 Nexpect = catalog[0].Naverage * catalog[0].Nsecfilt; 405 catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat); 406 if (Nitems != Nexpect) { 407 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%d vs %d)\n", Nitems, Nexpect); 408 } 409 catalog[0].Nsecf_mem = catalog[0].Naverage * catalog[0].Nsecfilt; 410 catalog[0].Nsecf_off = start * catalog[0].Nsecfilt; 411 412 /* if primary is defined, we were supplied with one additional average magnitude from Average 413 we need to interleave these magnitudes with the secfilt entries just loaded */ 414 if (primary != NULL) { 415 dvo_catalog_primary_to_secfilt (catalog, primary, Nrows); 416 } 417 gfits_free_header (&header); 418 gfits_free_matrix (&matrix); 419 } 420 421 // XXX check the open status of the catalog 422 if (catalog[0].catflags & LOAD_MEAS) { 423 424 Catalog *subcat = catalog[0].measure_catalog; 425 426 /* move pointer past header -- must be already read (load_catalog) */ 427 fseek (subcat[0].f, subcat[0].header.size, SEEK_SET); 428 /* matrix should be empty : XXX should we drop this step and skip the data? */ 429 if (!gfits_fread_matrix (subcat[0].f, &matrix, &subcat[0].header)) { 430 if (VERBOSE) fprintf (stderr, "can't read primary matrix"); 431 return (FALSE); 432 } 433 /* read Measure table header */ 434 if (!gfits_fread_header (subcat[0].f, &header)) { 435 if (VERBOSE) fprintf (stderr, "can't read table measure header"); 436 return (FALSE); 437 } 438 /* read Measure table data : format is irrelevant here */ 439 if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start, Nrows)) { 440 if (VERBOSE) fprintf (stderr, "can't read table measure data"); 441 return (FALSE); 442 } 443 444 /* convert data format to internal : returns number of row read in Nmeasure */ 445 catalog[0].measure = FtableToMeasure (&ftable, &Nmeasure, &catalog[0].catformat); 446 if (Nmeasure != Nrows) { 447 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%d vs %d)\n", Nmeasure, Nrows); 448 } 449 gfits_free_header (&header); 450 gfits_free_matrix (&matrix); 451 catalog[0].Nmeasure = Nmeasure; 452 catalog[0].Nmeas_off = start; 453 } 454 455 // XXX check the open status of the catalog? 456 if (catalog[0].catflags & LOAD_MISS) { 457 458 Catalog *subcat = catalog[0].missing_catalog; 459 460 /* move pointer past header -- must be already read (load_catalog) */ 461 fseek (subcat[0].f, subcat[0].header.size, SEEK_SET); 462 /* matrix should be empty : XXX should we drop this step and skip the data? */ 463 if (!gfits_fread_matrix (subcat[0].f, &matrix, &subcat[0].header)) { 464 if (VERBOSE) fprintf (stderr, "can't read primary matrix"); 465 return (FALSE); 466 } 467 /* read Missing table header */ 468 if (!gfits_fread_header (subcat[0].f, &header)) { 469 if (VERBOSE) fprintf (stderr, "can't read table missing header"); 470 return (FALSE); 471 } 472 /* read Missing table data : format is irrelevant here */ 473 if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start, Nrows)) { 474 if (VERBOSE) fprintf (stderr, "can't read table missing data"); 475 return (FALSE); 476 } 477 478 /* no conversions currently defined : this just does the byte swap */ 479 catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL); 480 if (Nmissing != Nrows) { 481 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%d vs %d)\n", Nmissing, Nrows); 482 } 483 gfits_free_header (&header); 484 gfits_free_matrix (&matrix); 485 catalog[0].Nmissing = Nmissing; 486 catalog[0].Nmiss_off = start; 487 } 488 return (TRUE); 489 } 490 491 /* save_catalog_split writes all data currently in memory to disk */ 283 492 int dvo_catalog_save_split (Catalog *catalog, char VERBOSE) { 284 493 … … 290 499 SecFilt *primary, *secfilt; 291 500 int i, j, Nsecfilt, Nallfilt, Ntotal; 501 int Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new; 502 int first, start, Nrows; 292 503 293 504 ftable.header = &header; 294 295 if (catalog[0].Naverage == 0) { 505 ftable.buffer = NULL; 506 header.buffer = NULL; 507 primary = NULL; 508 509 // skip empty catalogs: it is illegal to have Measures without corresponding Averages 510 Naves_disk_new = MAX (catalog[0].Naves_disk, catalog[0].Naverage + catalog[0].Naves_off); 511 if (Naves_disk_new == 0) { 296 512 if (VERBOSE) fprintf (stderr, "no stars in catalog, skipping\n"); 297 513 return (TRUE); 298 514 } 299 515 300 /* for the appropriate types, pull out the first secfilt and pass to AverageToFtable as primary */ 301 if ((catalog[0].catformat == DVO_FORMAT_ELIXIR) || // special case for ELIXIR 302 (catalog[0].catformat == DVO_FORMAT_LONEOS)) { // special case for LONEOS 303 if (catalog[0].secfilt == NULL) { 304 fprintf (stderr, "missing secfilt, cannot build output averages (dvo_catalog_split.c:544)\n"); 305 exit (1); 306 } 307 secfilt = catalog[0].secfilt; 308 309 Nallfilt = catalog[0].Nsecfilt; 310 Nsecfilt = catalog[0].Nsecfilt - 1; 311 Ntotal = Nsecfilt * catalog[0].Naverage; 312 ALLOCATE (primary, SecFilt, catalog[0].Naverage); 313 ALLOCATE (secfilt, SecFilt, Ntotal); 314 315 for (i = 0; i < catalog[0].Naverage; i++) { 316 primary[i] = secfilt[i*Nallfilt + 0]; 317 for (j = 0; j < Nsecfilt; j++) { 318 secfilt[i*Nsecfilt + j] = catalog[0].secfilt[i*Nallfilt + j + 1]; 319 } 320 } 321 } else { 322 primary = NULL; 323 secfilt = catalog[0].secfilt; 324 Nsecfilt = catalog[0].Nsecfilt; 325 } 516 // for the appropriate types, pull out the first secfilt and pass to AverageToFtable as primary 517 switch (catalog[0].catformat) { 518 case DVO_FORMAT_ELIXIR: // special case for ELIXIR 519 case DVO_FORMAT_LONEOS: // special case for LONEOS 520 dvo_catalog_secfilt_to_primary (catalog, &primary, &secfilt, &Nsecfilt); 521 break; 522 default: 523 primary = NULL; 524 secfilt = catalog[0].secfilt; 525 Nsecfilt = catalog[0].Nsecfilt; 526 break; 527 } 528 529 Nmeas_disk_new = MAX (catalog[0].Nmeas_disk, catalog[0].Nmeasure + catalog[0].Nmeas_off); 530 Nmiss_disk_new = MAX (catalog[0].Nmiss_disk, catalog[0].Nmissing + catalog[0].Nmiss_off); 531 Nsecf_disk_new = MAX (catalog[0].Nsecf_disk, catalog[0].Naverage*Nsecfilt + catalog[0].Nsecf_off); 326 532 327 533 /* make sure header is consistent with data */ 328 gfits_modify (&catalog[0].header, "NSTARS", "%d", 1, catalog[0].Naverage);329 gfits_modify (&catalog[0].header, "NMEAS", "%d", 1, catalog[0].Nmeasure);330 gfits_modify (&catalog[0].header, "NMISS", "%d", 1, catalog[0].Nmissing);534 gfits_modify (&catalog[0].header, "NSTARS", "%d", 1, Naves_disk_new); 535 gfits_modify (&catalog[0].header, "NMEAS", "%d", 1, Nmeas_disk_new); 536 gfits_modify (&catalog[0].header, "NMISS", "%d", 1, Nmiss_disk_new); 331 537 gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, Nsecfilt); 332 538 gfits_modify (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 333 539 334 /* rewind file pointers and truncate (file is still open) */335 fseek (catalog[0].f, 0, SEEK_SET);336 337 /* write table PHU header - always write this out */338 /* XXX EAM : check if disk file size has changed */339 if (!gfits_fwrite_header (catalog[0].f, &catalog[0].header)) {340 fprintf (stderr, "can't write primary header");341 goto failure;342 }343 344 540 /* in split mode, we can save only part of the data */ 345 541 346 542 /*** Average Table ***/ 347 543 if ((catalog[0].catflags & LOAD_AVES) && (catalog[0].average != NULL)) { 544 545 first = 0; // first row in memory to write 546 start = catalog[0].Naves_off; // first disk row to write 547 Nrows = catalog[0].Naverage - first; 548 549 assert (Nrows >= 0); 550 assert (first >= 0); 551 assert (first < catalog[0].Naverage); 552 assert (catalog[0].Naves_disk >= catalog[0].Naves_off); 553 554 /* convert internal to external format */ 555 if (!AverageToFtable (&ftable, &catalog[0].average[first], Nrows, catalog[0].catformat, primary)) { 556 fprintf (stderr, "trouble converting format\n"); 557 goto failure; 558 } 559 560 if (!dvo_catalog_save_subcat (catalog, &ftable, start, Nrows, catalog[0].Naves_disk, Naves_disk_new)) { 561 fprintf (stderr, "failure writing Average table\n"); 562 goto failure; 563 } 564 gfits_free_header (&header); 565 gfits_free_table (&ftable); 566 } else { 567 // even if we do not save the average table, we need to keep the header in sync 568 /* rewind file pointers and truncate (file is still open) */ 569 fseek (catalog[0].f, 0, SEEK_SET); 570 571 /* write table PHU header - always write this out */ 572 /* XXX EAM : check if disk file size has changed */ 573 if (!gfits_fwrite_header (catalog[0].f, &catalog[0].header)) { 574 fprintf (stderr, "can't write primary header"); 575 goto failure; 576 } 577 } 578 579 /*** Measure Table ***/ 580 if ((catalog[0].catflags & LOAD_MEAS) && (catalog[0].measure != NULL)) { 581 582 first = 0; // first row in memory to write 583 start = catalog[0].Nmeas_off; // first disk row to write 584 Nrows = catalog[0].Nmeasure - first; 585 586 assert (Nrows >= 0); 587 assert (first >= 0); 588 assert (first < catalog[0].Nmeasure); 589 assert (catalog[0].Nmeas_disk >= catalog[0].Nmeas_off); 590 591 // convert to external table format 592 if (!MeasureToFtable (&ftable, &catalog[0].measure[first], Nrows, catalog[0].catformat)) { 593 fprintf (stderr, "trouble converting format\n"); 594 goto failure; 595 } 596 597 // write out Measure table 598 if (!dvo_catalog_save_subcat (catalog[0].measure_catalog, &ftable, start, Nrows, catalog[0].Nmeas_disk, Nmeas_disk_new)) { 599 fprintf (stderr, "trouble writing Measure table\n"); 600 goto failure; 601 } 602 gfits_free_header (&header); 603 gfits_free_table (&ftable); 604 } 605 606 /*** Missing Table ***/ 607 if ((catalog[0].catflags & LOAD_MISS) && (catalog[0].missing != NULL)) { 608 609 if (catalog[0].Nmiss_off != 0) { 610 fprintf (stderr, "inconsistency: Missing table cannot be written in segments\n"); 611 goto failure; 612 } 613 614 // convert to external table format 615 if (!gfits_table_set_Missing (&ftable, catalog[0].missing, catalog[0].Nmissing)) { 616 fprintf (stderr, "trouble converting format\n"); 617 goto failure; 618 } 619 620 // write out Missing table (must write out entire table) 621 if (!dvo_catalog_save_subcat (catalog[0].missing_catalog, &ftable, 0, catalog[0].Nmissing, catalog[0].Nmissing, catalog[0].Nmissing)) { 622 fprintf (stderr, "trouble writing Missing Table\n"); 623 goto failure; 624 } 625 gfits_free_header (&header); 626 gfits_free_table (&ftable); 627 } 628 629 /*** Secfilt Table ***/ 630 if ((catalog[0].catflags & LOAD_SECF) && (catalog[0].secfilt != NULL)) { 631 632 first = 0; // first row in memory to write 633 start = catalog[0].Nsecf_off; // first disk row to write 634 Nitems = catalog[0].Nsecf_mem; 635 Nrows = Nitems - first; 636 637 assert (Nrows >= 0); 638 assert (first >= 0); 639 assert (first < Nitems); 640 assert (catalog[0].Nsecf_disk >= catalog[0].Nsecf_off); 641 // XXX check these for consistency... 642 643 // convert to external table format 644 SecFiltToFtable (&ftable, &secfilt[first], Nrows, catalog[0].catformat); 645 646 // write out SecFilt table 647 if (!dvo_catalog_save_subcat (catalog[0].secfilt_catalog, &ftable, start, Nrows, catalog[0].Nsecf_disk, Nsecf_disk_new)) { 648 fprintf (stderr, "failure writing SecFilt table\n"); 649 goto failure; 650 } 651 gfits_free_header (&header); 652 gfits_free_table (&ftable); 653 } 654 655 /* free temp storage */ 656 if (primary != NULL) { 657 free (primary); 658 free (secfilt); 659 } 660 return (TRUE); 661 662 failure: 663 /* free temp storage */ 664 gfits_free_header (&header); 665 gfits_free_table (&ftable); 666 if (primary != NULL) { 667 free (primary); 668 free (secfilt); 669 } 670 return (FALSE); 671 } 672 673 /* update_catalog_split only writes new lines to file. */ 674 int dvo_catalog_update_split (Catalog *catalog, char VERBOSE) { 675 676 int i, Nx, Ny, Nlines; 677 int Nitems, Nskip, Nout, Ndisk, Nstart; 678 Matrix matrix; 679 Header header; 680 FTable ftable; 681 Catalog *catfile; 682 SecFilt *primary, *secfilt; 683 int j, Nsecfilt, Nallfilt, Ntotal; 684 int Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new; 685 int first, start, Nrows; 686 687 ftable.header = &header; 688 ftable.buffer = NULL; 689 header.buffer = NULL; 690 691 // skip empty catalogs: it is illegal to have Measures without corresponding Averages 692 Naves_disk_new = MAX (catalog[0].Naves_disk, catalog[0].Naverage + catalog[0].Naves_off); 693 if (Naves_disk_new == 0) { 694 if (VERBOSE) fprintf (stderr, "no stars in catalog, skipping\n"); 695 return (TRUE); 696 } 697 698 // for the appropriate types, pull out the first secfilt and pass to AverageToFtable as primary 699 switch (catalog[0].catformat) { 700 case DVO_FORMAT_ELIXIR: // special case for ELIXIR 701 case DVO_FORMAT_LONEOS: // special case for LONEOS 702 dvo_catalog_secfilt_to_primary (catalog, &primary, &secfilt, &Nsecfilt); 703 break; 704 default: 705 primary = NULL; 706 secfilt = catalog[0].secfilt; 707 Nsecfilt = catalog[0].Nsecfilt; 708 break; 709 } 710 711 Nmeas_disk_new = MAX (catalog[0].Nmeas_disk, catalog[0].Nmeasure + catalog[0].Nmeas_off); 712 Nmiss_disk_new = MAX (catalog[0].Nmiss_disk, catalog[0].Nmissing + catalog[0].Nmiss_off); 713 Nsecf_disk_new = MAX (catalog[0].Nsecf_disk, catalog[0].Naverage*Nsecfilt + catalog[0].Nsecf_off); 714 715 /* make sure header is consistent with data */ 716 gfits_modify (&catalog[0].header, "NSTARS", "%d", 1, Naves_disk_new); 717 gfits_modify (&catalog[0].header, "NMEAS", "%d", 1, Nmeas_disk_new); 718 gfits_modify (&catalog[0].header, "NMISS", "%d", 1, Nmiss_disk_new); 719 gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, Nsecfilt); 720 gfits_modify (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 721 722 /* in split mode, we can save only part of the data */ 723 724 /*** Average Table ***/ 348 725 if (catalog[0].average != NULL) { 349 ftruncate (fileno (catalog[0].f), catalog[0].header.size); 350 351 /* this is probably a NOP, do I have to keep it in? */ 352 gfits_create_matrix (&catalog[0].header, &matrix); 353 if (!gfits_fwrite_matrix (catalog[0].f, &matrix)) { 354 fprintf (stderr, "can't write primary matrix"); 355 goto failure; 356 } 357 gfits_free_matrix (&matrix); 358 359 /* write out Average table (convert to FITS table format) */ 360 if (!AverageToFtable (&ftable, catalog[0].average, catalog[0].Naverage, catalog[0].catformat, primary)) { 361 fprintf (stderr, "trouble converting format\n"); 362 goto failure; 363 } 364 if (!gfits_fwrite_Theader (catalog[0].f, &header)) { 365 fprintf (stderr, "can't write table header"); 366 goto failure; 367 } 368 if (!gfits_fwrite_table (catalog[0].f, &ftable)) { 369 fprintf (stderr, "can't write table data"); 370 goto failure; 371 } 726 727 first = catalog[0].Naves_disk - catalog[0].Naves_off; // first row to write (memory) 728 start = catalog[0].Naves_disk; // first row to write (disk) 729 Nrows = catalog[0].Naverage - first; 730 731 assert (Nrows >= 0); 732 assert (first >= 0); 733 assert (first < catalog[0].Naverage); 734 assert (catalog[0].Naves_disk >= catalog[0].Naves_off); 735 736 /* convert internal to external format */ 737 if (!AverageToFtable (&ftable, &catalog[0].average[first], Nrows, catalog[0].catformat, primary)) { 738 fprintf (stderr, "trouble converting format\n"); 739 goto failure; 740 } 741 742 if (!dvo_catalog_save_subcat (catalog, &ftable, start, Nrows, catalog[0].Naves_disk, Naves_disk_new)) { 743 fprintf (stderr, "failure writing Average table\n"); 744 goto failure; 745 } 746 gfits_free_header (&header); 372 747 gfits_free_table (&ftable); 373 gfits_free_header (&header); 748 } else { 749 // even if we do not save the average table, we need to keep the header in sync 750 /* rewind file pointers and truncate (file is still open) */ 751 fseek (catalog[0].f, 0, SEEK_SET); 752 753 /* write table PHU header - always write this out */ 754 /* XXX EAM : check if disk file size has changed */ 755 if (!gfits_fwrite_header (catalog[0].f, &catalog[0].header)) { 756 fprintf (stderr, "can't write primary header"); 757 goto failure; 758 } 374 759 } 375 760 … … 377 762 if (catalog[0].measure != NULL) { 378 763 379 /* catalog file data is stored in separate structure */ 380 catfile = catalog[0].measure_catalog; 381 382 /* XXX EAM : warn about this condition; add code to handle? */ 383 if (catalog[0].Nmeas_off != 0) { 384 fprintf (stderr, "WARNING: LOAD_MEAS_META mixed with save??\n"); 385 fprintf (stderr, "WARNING: this should not be allowed to happen!\n"); 386 } 387 388 /* rewind file pointers and truncate (file is still open) */ 389 fseek (catfile[0].f, 0, SEEK_SET); 390 ftruncate (fileno (catfile[0].f), 0); 391 392 /* write table PHU header */ 393 if (!gfits_fwrite_header (catfile[0].f, &catfile[0].header)) { 394 fprintf (stderr, "can't write primary header"); 395 goto failure; 396 } 397 398 /* this is probably a NOP, do I have to keep it in? */ 399 gfits_create_matrix (&catfile[0].header, &matrix); 400 if (!gfits_fwrite_matrix (catfile[0].f, &matrix)) { 401 fprintf (stderr, "can't write primary matrix"); 402 goto failure; 403 } 404 gfits_free_matrix (&matrix); 405 406 /* write out Measure table (convert to FITS table format) */ 407 MeasureToFtable (&ftable, catalog[0].measure, catalog[0].Nmeasure, catalog[0].catformat); 408 if (!gfits_fwrite_Theader (catfile[0].f, &header)) { 409 fprintf (stderr, "can't write table header"); 410 goto failure; 411 } 412 if (!gfits_fwrite_table (catfile[0].f, &ftable)) { 413 fprintf (stderr, "can't write table data"); 414 goto failure; 415 } 764 first = catalog[0].Nmeas_disk - catalog[0].Nmeas_off; // first row in memory to write 765 start = catalog[0].Nmeas_off; // first disk row to write 766 Nrows = catalog[0].Nmeasure - first; 767 768 assert (Nrows >= 0); 769 assert (first >= 0); 770 assert (first < catalog[0].Nmeasure); 771 assert (catalog[0].Nmeas_disk >= catalog[0].Nmeas_off); 772 773 // convert to external table format 774 if (!MeasureToFtable (&ftable, &catalog[0].measure[first], Nrows, catalog[0].catformat)) { 775 fprintf (stderr, "trouble converting format\n"); 776 goto failure; 777 } 778 779 // write out Measure table 780 if (!dvo_catalog_save_subcat (catalog[0].measure_catalog, &ftable, start, Nrows, catalog[0].Nmeas_disk, Nmeas_disk_new)) { 781 fprintf (stderr, "trouble writing Measure table\n"); 782 goto failure; 783 } 784 gfits_free_header (&header); 416 785 gfits_free_table (&ftable); 417 gfits_free_header (&header); 418 } 786 } 787 788 /* missing table CANNOT be written unsorted, thus it is always written 789 out in full */ 419 790 420 791 /*** Missing Table ***/ 792 421 793 if (catalog[0].missing != NULL) { 422 794 423 /* catalog data is stored in separate catalog */ 424 catfile = catalog[0].missing_catalog; 425 426 /* rewind file pointers and truncate (file is still open) */ 427 fseek (catfile[0].f, 0, SEEK_SET); 428 ftruncate (fileno (catfile[0].f), 0); 429 430 /* write table PHU header */ 431 if (!gfits_fwrite_header (catfile[0].f, &catfile[0].header)) { 432 fprintf (stderr, "can't write primary header"); 433 goto failure; 434 } 435 436 /* this is probably a NOP, do I have to keep it in? */ 437 gfits_create_matrix (&catfile[0].header, &matrix); 438 if (!gfits_fwrite_matrix (catfile[0].f, &matrix)) { 439 fprintf (stderr, "can't write primary matrix"); 440 goto failure; 441 } 442 gfits_free_matrix (&matrix); 443 444 /* write out Missing table (convert to FITS table format) */ 445 gfits_table_set_Missing (&ftable, catalog[0].missing, catalog[0].Nmissing); 446 if (!gfits_fwrite_Theader (catfile[0].f, &header)) { 447 fprintf (stderr, "can't write table header"); 448 goto failure; 449 } 450 if (!gfits_fwrite_table (catfile[0].f, &ftable)) { 451 fprintf (stderr, "can't write table data"); 452 goto failure; 453 } 795 if (catalog[0].Nmiss_off != 0) { 796 fprintf (stderr, "inconsistency: Missing table cannot be written in segments\n"); 797 goto failure; 798 } 799 800 // convert to external table format 801 if (!gfits_table_set_Missing (&ftable, catalog[0].missing, catalog[0].Nmissing)) { 802 fprintf (stderr, "trouble converting format\n"); 803 goto failure; 804 } 805 806 // write out Missing table (must write out entire table) 807 if (!dvo_catalog_save_subcat (catalog[0].missing_catalog, &ftable, 0, catalog[0].Nmissing, catalog[0].Nmissing, catalog[0].Nmissing)) { 808 fprintf (stderr, "trouble writing Missing Table\n"); 809 goto failure; 810 } 811 gfits_free_header (&header); 454 812 gfits_free_table (&ftable); 455 gfits_free_header (&header);456 813 } 457 814 … … 459 816 if (catalog[0].secfilt != NULL) { 460 817 461 /* catalog file data is stored in a separate catalog structure */ 462 catfile = catalog[0].secfilt_catalog; 463 464 /* rewind file pointers and truncate (file is still open) */ 465 fseek (catfile[0].f, 0, SEEK_SET); 466 ftruncate (fileno (catfile[0].f), 0); 467 468 /* write table PHU header */ 469 if (!gfits_fwrite_header (catfile[0].f, &catfile[0].header)) { 470 fprintf (stderr, "can't write primary header"); 471 goto failure; 472 } 473 474 /* this is probably a NOP, do I have to keep it in? */ 475 gfits_create_matrix (&catfile[0].header, &matrix); 476 if (!gfits_fwrite_matrix (catfile[0].f, &matrix)) { 477 fprintf (stderr, "can't write primary matrix"); 478 goto failure; 479 } 480 gfits_free_matrix (&matrix); 481 482 /* write out SecFilt table (convert to FITS table format) */ 483 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt; 484 SecFiltToFtable (&ftable, secfilt, Nitems, catalog[0].catformat); 485 if (!gfits_fwrite_Theader (catfile[0].f, &header)) { 486 fprintf (stderr, "can't write table header"); 487 goto failure; 488 } 489 if (!gfits_fwrite_table (catfile[0].f, &ftable)) { 490 fprintf (stderr, "can't write table data"); 491 goto failure; 492 } 818 first = catalog[0].Nsecf_disk - catalog[0].Nsecf_off; // first row in memory to write 819 start = catalog[0].Nsecf_off; // first disk row to write 820 Nitems = catalog[0].Nsecf_mem; 821 Nrows = Nitems - first; 822 823 assert (Nrows >= 0); 824 assert (first >= 0); 825 assert (first < Nitems); 826 assert (catalog[0].Nmeas_disk >= catalog[0].Nmeas_off); 827 828 // convert to external table format 829 SecFiltToFtable (&ftable, &secfilt[first], Nrows, catalog[0].catformat); 830 831 // write out SecFilt table 832 if (!dvo_catalog_save_subcat (catalog[0].secfilt_catalog, &ftable, start, Nrows, catalog[0].Nsecf_disk, Nsecf_disk_new)) { 833 fprintf (stderr, "failure writing SecFilt table\n"); 834 goto failure; 835 } 836 gfits_free_header (&header); 493 837 gfits_free_table (&ftable); 494 gfits_free_header (&header);495 838 } 496 839 … … 512 855 } 513 856 514 /* update_catalog_split only writes new lines to file.515 * if file is empty, call save_catalog_split instead.516 * XXX EAM : save_catalog SHOULD do this517 */518 519 int dvo_catalog_update_split (Catalog *catalog, char VERBOSE) {520 521 int i, Nx, Ny, Nlines;522 int Nitems, Nskip, Nout, Ndisk, Nstart;523 Matrix matrix;524 Header header;525 FTable ftable;526 VTable vtable;527 Catalog *catfile;528 SecFilt *primary, *secfilt;529 int j, Nsecfilt, Nallfilt, Ntotal;530 531 ftable.header = &header;532 vtable.header = &header;533 534 if (catalog[0].Naverage == 0) {535 if (VERBOSE) fprintf (stderr, "no stars in catalog, skipping\n");536 return (TRUE);537 }538 539 /** for the appropriate types, pull out the first secfilt and pass to AverageToFtable as primary **/540 if ((catalog[0].catformat == DVO_FORMAT_ELIXIR) || // special case for ELIXIR541 (catalog[0].catformat == DVO_FORMAT_LONEOS)) { // special case for LONEOS542 if (catalog[0].secfilt == NULL) {543 fprintf (stderr, "missing secfilt, cannot build output averages (dvo_catalog_split.c:544)\n");544 exit (1);545 }546 secfilt = catalog[0].secfilt;547 548 Nallfilt = catalog[0].Nsecfilt;549 Nsecfilt = catalog[0].Nsecfilt - 1;550 Ntotal = Nsecfilt * catalog[0].Naverage;551 ALLOCATE (primary, SecFilt, catalog[0].Naverage);552 ALLOCATE (secfilt, SecFilt, Ntotal);553 554 for (i = 0; i < catalog[0].Naverage; i++) {555 primary[i] = secfilt[i*Nallfilt + 0];556 for (j = 0; j < Nsecfilt; j++) {557 secfilt[i*Nsecfilt + j] = catalog[0].secfilt[i*Nallfilt + j + 1];558 }559 }560 } else {561 primary = NULL;562 secfilt = catalog[0].secfilt;563 Nsecfilt = catalog[0].Nsecfilt;564 }565 566 /* make sure header is consistent with data */567 gfits_modify (&catalog[0].header, "NSTARS", "%d", 1, catalog[0].Naverage);568 gfits_modify (&catalog[0].header, "NMEAS", "%d", 1, catalog[0].Nmeasure + catalog[0].Nmeas_off);569 gfits_modify (&catalog[0].header, "NMISS", "%d", 1, catalog[0].Nmissing);570 gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, Nsecfilt);571 gfits_modify (&catalog[0].header, "EXTEND", "%t", 1, TRUE);572 573 /* rewind file pointers and truncate (file is still open) */574 fseek (catalog[0].f, 0, SEEK_SET);575 576 /* write table PHU header - always write this out */577 /* XXX EAM : check if disk file size has changed */578 if (!gfits_fwrite_header (catalog[0].f, &catalog[0].header)) {579 fprintf (stderr, "can't write primary header");580 goto failure;581 }582 583 /*** Average Table ***/584 if (catalog[0].average != NULL) {585 586 /* skip past matrix (already at end of header) */587 Nskip = gfits_data_size (&catalog[0].header);588 fseek (catalog[0].f, Nskip, SEEK_CUR);589 590 /* how many lines to write out? */591 Nout = catalog[0].Naverage - catalog[0].Nave_disk;592 593 /* write out Average table (convert to FITS table format) */594 AverageToFtable (&ftable, catalog[0].average, catalog[0].Naverage, catalog[0].catformat, primary);595 /* convert only output rows to vtable */596 gfits_table_to_vtable (&ftable, &vtable, catalog[0].Nave_disk, Nout);597 598 if (!gfits_fwrite_Theader (catalog[0].f, &header)) {599 fprintf (stderr, "can't write table header");600 goto failure;601 }602 if (!gfits_fwrite_vtable (catalog[0].f, &vtable)) {603 fprintf (stderr, "can't write table data");604 goto failure;605 }606 gfits_free_vtable (&vtable);607 gfits_free_table (&ftable);608 gfits_free_header (&header);609 }610 611 /*** Measure Table ***/612 if (catalog[0].measure != NULL) {613 614 catfile = catalog[0].measure_catalog;615 616 /* skip past PHU header and matrix */617 Nskip = catfile[0].header.size + gfits_data_size (&catfile[0].header);618 fseek (catfile[0].f, Nskip, SEEK_SET);619 620 Ndisk = catalog[0].Nmeas_disk;621 Nstart = catalog[0].Nmeas_disk - catalog[0].Nmeas_off; /* where is first new line? */622 Nout = catalog[0].Nmeasure - Nstart; /* how many lines to write out? */623 Nlines = catalog[0].Nmeasure + catalog[0].Nmeas_off; /* how many lines total in file */624 625 /* convert to output format FITS table (only rows for output : 0 - Nout) */626 MeasureToFtable (&ftable, &catalog[0].measure[Nstart], Nout, catalog[0].catformat);627 628 gfits_scan (&header, "NAXIS1", "%d", 1, &Nx);629 gfits_scan (&header, "NAXIS2", "%d", 1, &Ny);630 631 /* convert all output rows to vtable */632 ALLOCATE (vtable.row, int, MAX (1, Nout));633 ALLOCATE (vtable.buffer, char *, MAX (1, Nout));634 for (i = 0; i < Nout; i++) {635 ALLOCATE (vtable.buffer[i], char, MAX (1, Nx));636 memcpy (vtable.buffer[i], &ftable.buffer[i*Nx], Nx);637 vtable.row[i] = i + Ndisk;638 }639 640 /* modify vtable to represent full disk table */641 gfits_modify (&header, "NAXIS2", "%d", 1, Nlines);642 header.Naxis[1] = Nlines;643 644 vtable.size = gfits_data_size (&header);645 vtable.Nrow = Nout;646 vtable.pad = vtable.size - Nx*Ny;647 648 if (!gfits_fwrite_Theader (catfile[0].f, &header)) {649 fprintf (stderr, "can't write table header");650 goto failure;651 }652 if (!gfits_fwrite_vtable (catfile[0].f, &vtable)) {653 fprintf (stderr, "can't write table data");654 goto failure;655 }656 gfits_free_vtable (&vtable);657 gfits_free_table (&ftable);658 gfits_free_header (&header);659 }660 661 /*** Missing Table ***/662 /* missing table CANNOT be written unsorted, thus it is always written663 out in full */664 665 if (catalog[0].missing != NULL) {666 667 catfile = catalog[0].missing_catalog;668 669 /* rewind file pointers and truncate (file is still open) */670 fseek (catfile[0].f, 0, SEEK_SET);671 ftruncate (fileno (catfile[0].f), 0);672 673 /* write table PHU header */674 if (!gfits_fwrite_header (catfile[0].f, &catfile[0].header)) {675 fprintf (stderr, "can't write primary header");676 goto failure;677 }678 679 /* this is probably a NOP, do I have to keep it in? */680 gfits_create_matrix (&catfile[0].header, &matrix);681 if (!gfits_fwrite_matrix (catfile[0].f, &matrix)) {682 fprintf (stderr, "can't write primary matrix");683 goto failure;684 }685 gfits_free_matrix (&matrix);686 687 /* write out Missing table (convert to FITS table format) */688 gfits_table_set_Missing (&ftable, catalog[0].missing, catalog[0].Nmissing);689 if (!gfits_fwrite_Theader (catfile[0].f, &header)) {690 fprintf (stderr, "can't write table header");691 goto failure;692 }693 if (!gfits_fwrite_table (catfile[0].f, &ftable)) {694 fprintf (stderr, "can't write table data");695 goto failure;696 }697 gfits_free_table (&ftable);698 gfits_free_header (&header);699 }700 701 /*** Secfilt Table ***/702 if (catalog[0].secfilt != NULL) {703 704 catfile = catalog[0].secfilt_catalog;705 706 /* skip past PHU header and matrix */707 Nskip = catfile[0].header.size + gfits_data_size (&catfile[0].header);708 fseek (catfile[0].f, Nskip, SEEK_SET);709 710 /* how many lines to write out? */711 Nout = catalog[0].Nsecfilt * (catalog[0].Naverage - catalog[0].Nave_disk);712 Ndisk = catalog[0].Nsecfilt * catalog[0].Nave_disk;713 714 /* convert to output format FITS table */715 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt;716 SecFiltToFtable (&ftable, secfilt, Nitems, catalog[0].catformat);717 /* convert only output rows to vtable */718 gfits_table_to_vtable (&ftable, &vtable, Ndisk, Nout);719 720 if (!gfits_fwrite_Theader (catfile[0].f, &header)) {721 fprintf (stderr, "can't write table header");722 goto failure;723 }724 if (!gfits_fwrite_vtable (catfile[0].f, &vtable)) {725 fprintf (stderr, "can't write table data");726 goto failure;727 }728 gfits_free_vtable (&vtable);729 gfits_free_table (&ftable);730 gfits_free_header (&header);731 }732 733 /* free temp storage */734 if (primary != NULL) {735 free (primary);736 free (secfilt);737 }738 739 return (TRUE);740 741 failure:742 /* free temp storage */743 if (primary != NULL) {744 free (primary);745 free (secfilt);746 }747 return (FALSE);748 }749 750 857 /* in split mode, extra files are linked to catalog->measure_catalog, etc. Each 751 858 has a valid filename, f, header. The primary catalog data pointers are set … … 758 865 /* XXX EAM : update is not efficient. MeasureToFtable should only 759 866 convert the new rows (Nmeas_disk to Nmeasure). the resulting 760 table represents the end rows of the vtable. we need to define867 table represents the end rows of the ftable. we need to define 761 868 the vtable based on the ftable, but with Ny = Nmeasure */ 762 869 870 871 872 // * convert to an ftable 873 // * optionally write the PHU header/matrix 874 // * advance to the start of the output data block: 875 // ** Nx * catalog[0].Nmeas_off 876 // * write out the ftable data block 877 // * if Nmeas_off + Nmeasure >= Nmeas_disk, update padding 878 // ** start = Nmeas_off 879 // ** Nrows = Nmeasure 880 -
trunk/Ohana/src/libfits/header/F_read_H.c
r15487 r15743 34 34 Nbytes = fread (&header[0].buffer[i*FT_RECORD_SIZE], 35 35 sizeof(char), FT_RECORD_SIZE, f); 36 if (Nbytes != FT_RECORD_SIZE) { 37 perror ("fits read error"); 38 } 39 36 40 header[0].size += Nbytes; 37 41 if (Nbytes != FT_RECORD_SIZE) { -
trunk/Ohana/src/libfits/include/gfitsio.h
r15656 r15743 2 2 3 3 # include <assert.h> 4 # include <errno.h> 4 5 5 6 # ifndef GFITSIO … … 172 173 int gfits_fread_ftable PROTO((FILE *f, FTable *ftable, char *extname)); 173 174 int gfits_fread_ftable_data PROTO((FILE *f, FTable *ftable)); 175 int gfits_fread_ftable_range PROTO((FILE *f, FTable *ftable, int start, int Nrows)); 174 176 int gfits_fread_vtable PROTO((FILE *f, VTable *vtable, char *extname, int Nrow, int *row)); 175 177 int gfits_fread_vtable_range PROTO((FILE *f, VTable *vtable, int start, int Nrows)); … … 178 180 int gfits_fwrite_table PROTO((FILE *f, FTable *table)); 179 181 int gfits_fwrite_vtable PROTO((FILE *f, VTable *table)); 182 int gfits_fwrite_ftable_range PROTO((FILE *f, FTable *table, int start, int Nrows, int Ndisk, int Ntotal)); 180 183 int gfits_get_bintable_column PROTO((Header *header, FTable *table, char *label, void **data)); 181 184 int gfits_get_bintable_column_type PROTO((Header *header, char *label, char *type, int *Nval)); -
trunk/Ohana/src/libfits/matrix/F_load_M.c
r15487 r15743 30 30 31 31 nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f); 32 if (nbytes != Nbytes) { 33 perror ("fits matrix read error"); 34 } 32 35 33 36 # ifdef BYTE_SWAP -
trunk/Ohana/src/libfits/matrix/F_read_portion.c
r7054 r15743 47 47 fseek (f, header.size + Nskip, SEEK_SET); 48 48 nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f); 49 if (nbytes != Nbytes) { 50 perror ("fits matrix read error"); 51 } 52 49 53 fclose (f); 50 54 -
trunk/Ohana/src/libfits/matrix/F_read_segment.c
r13039 r15743 90 90 fseek (f, Nskip, SEEK_CUR); 91 91 nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f); 92 if (nbytes != Nbytes) { 93 perror ("fits matrix read error"); 94 } 95 92 96 matrix[0].size = Nbytes; 93 97 -
trunk/Ohana/src/libfits/table/F_read_T.c
r15487 r15743 59 59 Nread = fread (table[0].buffer, sizeof (char), Nbytes, f); 60 60 if (Nread != Nbytes) { 61 perror ("fits read error"); 61 62 gfits_free_table (table); 62 63 return (FALSE); 63 64 } 64 65 table[0].size = Nbytes; 66 return (TRUE); 67 } 68 69 /*********************** fits read ftable data ***********************************/ 70 int gfits_fread_ftable_range (FILE *f, FTable *table, int start, int Nrows) { 71 72 int Nbytes, Nread, Nskip, Nx, Ny; 73 74 /* find disk table size */ 75 Nx = table[0].header[0].Naxis[0]; 76 Ny = table[0].header[0].Naxis[1]; 77 78 // it is an error to ask for data starting out-of-bounds 79 if (start < 0) return (FALSE); 80 if (start >= Ny) return (FALSE); 81 82 // if we request more data than is available, we will stop at the table end. 83 Nrows = MIN (Nrows, Ny - start); 84 85 Nskip = start * Nx; 86 Nbytes = Nrows * Nx; 87 ALLOCATE (table[0].buffer, char, MAX (Nbytes, 1)); 88 89 fseek (f, Nskip, SEEK_CUR); 90 91 Nread = fread (table[0].buffer, sizeof (char), Nbytes, f); 92 if (Nread != Nbytes) { 93 if (ferror (f)) { 94 perror ("fits read error"); 95 } else { 96 fprintf (stderr, "unexpected eof\n"); 97 } 98 free (table[0].buffer); 99 return (FALSE); 100 } 101 102 /* modify structure and header to match actual read rows Ny */ 103 table[0].header[0].Naxis[1] = Nrows; 104 gfits_modify (table[0].header, "NAXIS2", "%d", 1, Nrows); 105 table[0].size = gfits_data_size (table[0].header); 106 65 107 return (TRUE); 66 108 } … … 88 130 Nread = fread (buffer, sizeof (char), Nbytes, f); 89 131 if (Nread != Nbytes) { 132 perror ("fits read error"); 90 133 free (buffer); 91 134 return (FALSE); … … 146 189 fseek (f, offset, SEEK_SET); 147 190 Nread = fread (table[0].buffer[i], sizeof (char), Nx, f); 148 if (Nread != Nx) { return (FALSE); } 191 if (Nread != Nx) { 192 perror ("fits read error"); 193 return (FALSE); 194 } 149 195 } 150 196 -
trunk/Ohana/src/libfits/table/F_read_TH.c
r15487 r15743 46 46 Nbytes = fread (&Theader[0].buffer[i*FT_RECORD_SIZE], 47 47 sizeof(char), FT_RECORD_SIZE, f); 48 if (Nbytes != FT_RECORD_SIZE) { 49 perror ("fits matrix read error"); 50 } 51 48 52 Theader[0].size += Nbytes; 49 53 if (Nbytes != FT_RECORD_SIZE) -
trunk/Ohana/src/libfits/table/F_write_T.c
r7054 r15743 69 69 /* this will add data beyond the end of the table in the file if needed, 70 70 filling intervening gap with 0 */ 71 72 /*********************** fits read ftable data ***********************************/ 73 int gfits_fwrite_ftable_range (FILE *f, FTable *ftable, int start, int Nrows, int Ndisk, int Ntotal) { 74 75 int Nbytes, Nwrite, Nskip, Nx, Npad; 76 char *pad; 77 78 if (start < 0) return (FALSE); 79 80 /* modify vtable to represent full disk table */ 81 gfits_modify (ftable[0].header, "NAXIS2", "%d", 1, Ntotal); 82 ftable[0].header[0].Naxis[1] = Ntotal; 83 84 Nx = ftable[0].header[0].Naxis[0]; // final output table size on disk 85 ftable[0].size = gfits_data_size (ftable[0].header); 86 87 Nskip = start * Nx; 88 Nbytes = Nrows * Nx; 89 90 // cursor must be at start of the table header 91 if (!gfits_fwrite_Theader (f, ftable[0].header)) { 92 fprintf (stderr, "can't write table header"); 93 return (FALSE); 94 } 95 96 // cursor must be at start of the table (after table header) 97 fseek (f, Nskip, SEEK_CUR); 98 Nwrite = fwrite (ftable[0].buffer, sizeof (char), Nbytes, f); 99 if (Nwrite != Nbytes) { 100 return (FALSE); 101 } 102 103 if (Ntotal >= Ndisk) { 104 Npad = ftable[0].size - Nx*Ntotal; 105 ALLOCATE (pad, char, Npad); 106 bzero (pad, Npad); 107 Nbytes = fwrite (pad, sizeof (char), Npad, f); 108 free (pad); 109 110 if (Nbytes != Npad) return (FALSE); 111 } 112 113 return (TRUE); 114 } 115 -
trunk/Ohana/src/markrock/src/markrock.c
r8386 r15743 45 45 exit (2); 46 46 } 47 if (catalog.Nave _disk) {47 if (catalog.Naves_disk) { 48 48 dvo_catalog_unlock (&catalog); 49 49 dvo_catalog_free (&catalog); -
trunk/Ohana/src/markstar/src/markstar.c
r8386 r15743 48 48 exit (2); 49 49 } 50 if (!catalog.Nave _disk) {50 if (!catalog.Naves_disk) { 51 51 dvo_catalog_unlock (&catalog); 52 52 dvo_catalog_free (&catalog); -
trunk/Ohana/src/mosastro/src/getptolemy.c
r12332 r15743 36 36 dvo_catalog_unlock (&catalog); 37 37 38 // Nave _disk == 0 implies an empty catalog file38 // Naves_disk == 0 implies an empty catalog file 39 39 // for only_match, skip empty catalogs 40 if (!catalog.Nave _disk) {40 if (!catalog.Naves_disk) { 41 41 dvo_catalog_free (&catalog); 42 42 continue; -
trunk/Ohana/src/photdbc/src/join_stars.c
r12332 r15743 172 172 173 173 catalog[0].Naverage = Naves; 174 catalog[0].Nsecf_mem = Naves*catalog[0].Nsecfilt; 174 175 } 175 176 … … 181 182 generates a new SecFilt table with empty values 182 183 does NOT update magnitudes 184 output measure table is the same size as the input measure table 185 (measures are just moved around). thus, catalog[0].Nmeasure does not change. 183 186 */ 184 187 -
trunk/Ohana/src/photdbc/src/make_subcatalog.c
r12332 r15743 10 10 11 11 Nsecfilt = GetPhotcodeNsecfilt (); 12 assert (catalog[0].Nsecfilt == Nsecfilt); 12 13 13 14 /* we are moving only the subset of measurements from catalog[0] to subcatalog[0] */ … … 96 97 subcatalog[0].Naverage = Naverage; 97 98 subcatalog[0].Nmeasure = Nmeasure; 98 subcatalog[0].Nsecfilt = catalog[0].Nsecfilt; 99 subcatalog[0].Nsecfilt = Nsecfilt; 100 subcatalog[0].Nsecf_mem = Naverage * Nsecfilt; 99 101 100 102 // XXX for now, don't copy the missing entries (these should be re-computed) -
trunk/Ohana/src/photdbc/src/photdbc.c
r8701 r15743 34 34 } 35 35 // skip empty input catalogs 36 if (!incatalog.Nave _disk) {36 if (!incatalog.Naves_disk) { 37 37 dvo_catalog_unlock (&incatalog); 38 38 dvo_catalog_free (&incatalog); -
trunk/Ohana/src/relastro/src/bcatalog.c
r15130 r15743 6 6 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm; 7 7 float mag; 8 9 // XXX PhotNsec as a global is a bad idea; either get it from catalog 10 // or get it from: 11 // Nsecfilt = GetPhotcodeNsecfilt (); 12 // assert (catalog[0].Nsecfilt == Nsecfilt); 8 13 9 14 /* we are moving only the subset of measurements from catalog[0] to subcatalog[0] */ … … 104 109 subcatalog[0].Nmeasure = Nmeasure; 105 110 subcatalog[0].Nsecfilt = catalog[0].Nsecfilt; 111 subcatalog[0].Nsecf_mem = Naverage * PhotNsec; 112 assert (PhotNsec == catalog[0].Nsecfilt); 106 113 107 114 if (VERBOSE) { -
trunk/Ohana/src/relastro/src/load_catalogs.c
r15130 r15743 13 13 for (i = 0; i < skylist[0].Nregions; i++) { 14 14 15 // we only allow output if we do not use a subset. in this case, 16 // the output parameters are correctly set for catalog[i] via pcatalog 15 17 pcatalog = subselect ? &tcatalog : &catalog[i]; 16 18 … … 26 28 exit (1); 27 29 } 28 if (VERBOSE && !pcatalog[0].Nave _disk) fprintf (stderr, "no data in %s, skipping\n", pcatalog[0].filename);30 if (VERBOSE && !pcatalog[0].Naves_disk) fprintf (stderr, "no data in %s, skipping\n", pcatalog[0].filename); 29 31 30 32 // select only the brighter stars -
trunk/Ohana/src/relastro/src/reload_catalogs.c
r12332 r15743 29 29 exit (1); 30 30 } 31 if (VERBOSE && (catalog.Nave _disk == 0)) {31 if (VERBOSE && (catalog.Naves_disk == 0)) { 32 32 fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 33 33 dvo_catalog_unlock (&catalog); -
trunk/Ohana/src/relphot/src/bcatalog.c
r15634 r15743 6 6 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm; 7 7 float mag; 8 9 // XXX PhotNsec as a global is a bad idea; either get it from catalog 10 // or get it from: 11 // Nsecfilt = GetPhotcodeNsecfilt (); 12 // assert (catalog[0].Nsecfilt == Nsecfilt); 8 13 9 14 /* we are moving only the subset of measurements from catalog[0] to subcatalog[0] */ … … 105 110 subcatalog[0].Nmeasure = Nmeasure; 106 111 subcatalog[0].Nsecfilt = catalog[0].Nsecfilt; 112 subcatalog[0].Nsecf_mem = Naverage * catalog[0].Nsecfilt; 113 assert (PhotNsec == catalog[0].Nsecfilt); 107 114 108 115 if (VERBOSE) { -
trunk/Ohana/src/relphot/src/load_catalogs.c
r9633 r15743 24 24 exit (1); 25 25 } 26 if (VERBOSE && !tcatalog.Nave _disk) fprintf (stderr, "no data in %s, skipping\n", tcatalog.filename);26 if (VERBOSE && !tcatalog.Naves_disk) fprintf (stderr, "no data in %s, skipping\n", tcatalog.filename); 27 27 28 28 // select only the brighter stars -
trunk/Ohana/src/relphot/src/reload_catalogs.c
r9633 r15743 30 30 exit (1); 31 31 } 32 if (VERBOSE && (catalog.Nave _disk == 0)) {32 if (VERBOSE && (catalog.Naves_disk == 0)) { 33 33 fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 34 34 dvo_catalog_unlock (&catalog); -
trunk/Ohana/src/uniphot/src/update.c
r12332 r15743 52 52 exit (2); 53 53 } 54 if (!catalog.Nave _disk) {54 if (!catalog.Naves_disk) { 55 55 dvo_catalog_unlock (&catalog); 56 56 dvo_catalog_free (&catalog);
Note:
See TracChangeset
for help on using the changeset viewer.
