Changeset 15735
- Timestamp:
- Dec 5, 2007, 11:27:37 AM (18 years ago)
- Location:
- branches/eam_branch_20071130/Ohana/src/dvosplit
- Files:
-
- 5 added
- 4 edited
-
Makefile (added)
-
src/ConfigInit.c (added)
-
src/SetSignals.c (added)
-
src/Shutdown.c (added)
-
src/args.c (added)
-
src/dvosplit.c (modified) (5 diffs)
-
src/open_output_catalogs.c (modified) (2 diffs)
-
src/split_averages.c (modified) (5 diffs)
-
src/split_measures.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20071130/Ohana/src/dvosplit/src/dvosplit.c
r15729 r15735 1 1 # include "dvosplit.h" 2 2 3 // dvosplit (outlevel) [-region Rmin Rmax Dmin Dmax] 3 4 int main (int argc, char **argv) { 4 5 5 // 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]; 6 12 7 // the output catalog needs to inherit the SKY_DEPTH of the input catalog. 8 // if the CATDIR/SkyTable.fits is not found, assume the HST layout (old default) 13 SetSignals (); 14 ConfigInit (&argc, argv); 15 args (argc, argv); 9 16 10 // force the output to have SPLIT mode?17 OUT_DEPTH = atoi (argv[1]); 11 18 12 19 // load the sky table for the existing database … … 14 21 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 22 16 // XXX I should just be copying the input sky and setting the output names on that17 // load the sky table for the existing database, generate output names18 outsky = SkyTableLoadOptimal (CATDIR, NULL, NULL, SKY_DEPTH_HST, VERBOSE);19 SkyTableSetFilenames (outsky, OUTDIR, "cpt");20 21 23 // get the list of populated regions 22 skylist = SkyListByPatch (sky, -1, & REGION);24 skylist = SkyListByPatch (sky, -1, &UserPatch); 23 25 24 26 for (i = 0; i < skylist[0].Nregions; i++) { … … 28 30 // if (current level == out level) skip: no action is needed 29 31 if (skylist[0].regions[i][0].depth >= OUT_DEPTH) continue; 30 // XXX : we need to copy these files to their new names31 32 32 33 // set the parameters which guide catalog open/load/create … … 48 49 } 49 50 50 // change outsky.regions[i].depth for these regions51 outlist = SkyListByPatch ( outsky, OUT_DEPTH, skylist[0].regions[i]);51 // change sky.regions[i].depth for these regions 52 outlist = SkyListByPatch (sky, OUT_DEPTH, skylist[0].regions[i]); 52 53 53 54 outcatalogs = open_output_catalogs (outlist); … … 60 61 // split_missings (&incatalog, outlist, outcatalogs, avelinks); 61 62 62 dvo_catalog_ close(&incatalog);63 dvo_catalog_unlock (&incatalog); 63 64 64 65 for (j = 0; j < outlist[0].Nregions; j++) { 65 dvo_catalog_ close(&outcatalogs[j]);66 dvo_catalog_unlock (&outcatalogs[j]); 66 67 } 68 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; 73 } 74 67 75 } 76 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 } 84 68 85 exit (0); 69 86 } -
branches/eam_branch_20071130/Ohana/src/dvosplit/src/open_output_catalogs.c
r15729 r15735 3 3 Catalog *open_output_catalogs (SkyList *outlist) { 4 4 5 int i; 5 6 Catalog *outcatalogs; 6 7 … … 11 12 12 13 // set the parameters which guide catalog open/load/create 13 outcatalogs[i].filename = skylist[0].filename[i]; 14 outcatalogs[i].Nsecfilt = GetPhotcodeNsecfilt (); 15 outcatalogs[i].catflags = LOAD_NONE; 14 outcatalogs[i].filename = outlist[0].filename[i]; 15 outcatalogs[i].Nsecfilt = GetPhotcodeNsecfilt (); 16 outcatalogs[i].catflags = LOAD_NONE; 17 outcatalogs[i].catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 18 outcatalogs[i].catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 16 19 17 20 if (!dvo_catalog_open (&outcatalogs[i], outlist[0].regions[i], VERBOSE, "w")) { -
branches/eam_branch_20071130/Ohana/src/dvosplit/src/split_averages.c
r15732 r15735 5 5 6 6 double inR, inD; 7 int block, ave, cat, Nblocks, Ncat, Nout;7 int n, block, ave, cat, averef, Nblocks, Ncat, Nout, Nsecfilt; 8 8 int *outref, *outcat; 9 9 AveLinks *avelinks; … … 17 17 // contains primary photcodes, which will increase Nsecfilt by one. 18 18 for (cat = 0; cat < outlist[0].Nregions; cat++) { 19 REALLOCATE (outcatalog [cat].average, Average, NROWS);20 REALLOCATE (outcatalog [cat].secfilt, SecFilt, NROWS*(Nsecfilt + 1));19 REALLOCATE (outcatalogs[cat].average, Average, NROWS); 20 REALLOCATE (outcatalogs[cat].secfilt, SecFilt, NROWS*(Nsecfilt + 1)); 21 21 } 22 22 … … 27 27 28 28 // read up to NROWS at a time 29 dvo_catalog_load_segment ( &incatalog, VERBOSE, block*NROWS, NROWS);30 assert (block*NROWS == incatalog s[0].Naves_off);29 dvo_catalog_load_segment (incatalog, VERBOSE, block*NROWS, NROWS); 30 assert (block*NROWS == incatalog[0].Naves_off); 31 31 32 32 for (ave = 0; ave < incatalog[0].Naverage; ave++) { … … 53 53 } 54 54 55 Nout = outcatalog [Ncat].Naverage;56 outref[averef] = Nout + outcatalog [Ncat].Naves_off;55 Nout = outcatalogs[Ncat].Naverage; 56 outref[averef] = Nout + outcatalogs[Ncat].Naves_off; 57 57 outcat[averef] = Ncat; 58 58 59 59 // assign the value to the next element of the output catalog 60 outcatalog [Ncat].average[Nout] = incatalog[0].average[k];61 outcatalog [Ncat].Naverage++;60 outcatalogs[Ncat].average[Nout] = incatalog[0].average[ave]; 61 outcatalogs[Ncat].Naverage ++; 62 62 63 63 // update secfilt at the same time 64 64 for (n = 0; n < Nsecfilt; n++) { 65 outcatalog [Ncat].secfilt[Nout*Nsecfilt + n] = incatalog[0].secfilt[ave*Nsecfilt + n];66 outcatalog [Ncat].Nsecf_mem++;65 outcatalogs[Ncat].secfilt[Nout*Nsecfilt + n] = incatalog[0].secfilt[ave*Nsecfilt + n]; 66 outcatalogs[Ncat].Nsecf_mem++; 67 67 } 68 68 } … … 72 72 // write out the new values 73 73 for (cat = 0; cat < outlist[0].Nregions; cat++) { 74 outcatalog [cat].catflags = LOAD_AVES | LOAD_SECF;75 dvo_catalog_save _segment (&outcatalog[cat], VERBOSE);74 outcatalogs[cat].catflags = LOAD_AVES | LOAD_SECF; 75 dvo_catalog_save (&outcatalogs[cat], VERBOSE); 76 76 77 77 // XXX I need to advance the pointers and free the current data 78 78 // XXX these should be done within save segment: 79 outcatalog [cat].Naves_disk += outcatalog[cat].Naverage;80 outcatalog [cat].Naves_off += outcatalog[cat].Naverage;81 outcatalog [cat].Naverage = 0;79 outcatalogs[cat].Naves_disk += outcatalogs[cat].Naverage; 80 outcatalogs[cat].Naves_off += outcatalogs[cat].Naverage; 81 outcatalogs[cat].Naverage = 0; 82 82 83 outcatalog [cat].Nsecf_disk += Nsecfilt * outcatalog[cat].Naverage;84 outcatalog [cat].Nsecf_off += Nsecfilt * outcatalog[cat].Naverage;85 outcatalog [cat].Nsecf_mem = 0;83 outcatalogs[cat].Nsecf_disk += Nsecfilt * outcatalogs[cat].Naverage; 84 outcatalogs[cat].Nsecf_off += Nsecfilt * outcatalogs[cat].Naverage; 85 outcatalogs[cat].Nsecf_mem = 0; 86 86 } 87 87 } -
branches/eam_branch_20071130/Ohana/src/dvosplit/src/split_measures.c
r15729 r15735 4 4 int split_measures (Catalog *incatalog, SkyList *outlist, Catalog *outcatalogs, AveLinks *avelinks) { 5 5 6 int block, meas, cat, Nblocks, Ncat, Nout, averef; 6 7 int *outref, *outcat; 7 8 … … 11 12 // allocate enough space for the output buffer 12 13 for (cat = 0; cat < outlist[0].Nregions; cat++) { 13 REALLOCATE (outcatalog [cat].measure, Measure, NROWS);14 REALLOCATE (outcatalogs[cat].measure, Measure, NROWS); 14 15 } 15 16 … … 27 28 Ncat = outcat[averef]; 28 29 29 Nout = outcatalog [Ncat].Nmeasure;30 outcatalog [Ncat].measure[Nout] = incatalog[0].measure[meas];31 outcatalog [Ncat].measure[Nout].averef = outref[averef];32 outcatalog [Ncat].Nmeasure++;30 Nout = outcatalogs[Ncat].Nmeasure; 31 outcatalogs[Ncat].measure[Nout] = incatalog[0].measure[meas]; 32 outcatalogs[Ncat].measure[Nout].averef = outref[averef]; 33 outcatalogs[Ncat].Nmeasure++; 33 34 } 34 35 35 36 for (cat = 0; cat < outlist[0].Nregions; cat++) { 36 37 outcatalogs[cat].catflags = LOAD_AVES | LOAD_SECF; 37 dvo_catalog_save _segment (&outcatalog[cat], VERBOSE);38 dvo_catalog_save (&outcatalogs[cat], VERBOSE); 38 39 39 outcatalog [cat].Nmeas_disk += outcatalog[cat].Nmeasure;40 outcatalog [cat].Nmeas_off += outcatalog[cat].Nmeasure;41 outcatalog [cat].Nmeasure = 0;40 outcatalogs[cat].Nmeas_disk += outcatalogs[cat].Nmeasure; 41 outcatalogs[cat].Nmeas_off += outcatalogs[cat].Nmeasure; 42 outcatalogs[cat].Nmeasure = 0; 42 43 43 44 }
Note:
See TracChangeset
for help on using the changeset viewer.
