IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15729


Ignore:
Timestamp:
Dec 1, 2007, 4:31:07 PM (18 years ago)
Author:
eugene
Message:

cleaning up code org

Location:
branches/eam_branch_20071130/Ohana/src/dvosplit/src
Files:
4 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071130/Ohana/src/dvosplit/src/dvosplit.c

    r15728 r15729  
    11# include "dvosplit.h"
    2 # define NROWS 100000 /* ~10MB per row for measures */
    32
    43int main (int argc, char **argv) {
     
    3130    // XXX : we need to copy these files to their new names
    3231
    33     // change outsky.regions[i].depth for these regions
    34     outlist = SkyListByPatch (outsky, OUT_DEPTH, skylist[0].regions[i]);
    35 
    3632    // set the parameters which guide catalog open/load/create
    3733    incatalog.filename = skylist[0].filename[i];
     
    5248    }
    5349
    54     // split out the average entries:
    55     incatalog.catflags = LOAD_AVES;
    56     Nblocks = incatalog.Nave_disk / NROWS;
    57     for (j = 0; j < Nblocks; j++) {
     50    // change outsky.regions[i].depth for these regions
     51    outlist = SkyListByPatch (outsky, OUT_DEPTH, skylist[0].regions[i]);
    5852
    59       // read up to NROWS at a time
    60       dvo_catalog_load_segment (&incatalog, VERBOSE, j*NROWS, NROWS);
     53    outcatalogs = open_output_catalogs (outlist);
    6154
    62       for (k = 0; k < incatalog.Naverage; k++) {
    63         averef = j*NROWS + k;
    64        
    65         inR  = incatalog.average[k].R;
    66         inD = incatalog.average[k].D;
     55    avelinks = split_averages (&incatalog, outlist, outcatalogs);
    6756
    68         // which of the outcatalogs contains this coordinate?
     57    split_measures (&incatalog, outlist, outcatalogs, avelinks);
    6958
    70         N = -1;
    71         for (n = 0; n < outlist[0].Nregions; n++) {
    72           if (inR < outregions[n].Rmin) continue;
    73           if (inR > outregions[n].Rmax) continue;
    74           if (inD < outregions[n].Dmin) continue;
    75           if (inD > outregions[n].Dmax) continue;
    76           Ncat = n;
    77           break;
    78         }
    79         if (Ncat == -1) continue;
     59    // XXX missing entries have to be reconstructed if they are desired
     60    // split_missings (&incatalog, outlist, outcatalogs, avelinks);
    8061
    81         // XXX this probably needs to be Nave_disk so we can have partial saves
    82         Nout = outcatalog[Ncat].Naverage;
    83         outref[averef] = Nout;
    84         outcat[averef] = Ncat;
     62    dvo_catalog_close (&incatalog);
    8563
    86         outcatalog[Ncat].average[Nout] = incatalog.average[k];
    87         outcatalog[Ncat].Naverage++;
    88       }
    89 
    90       for (n = 0; n < Noutcatalog; n++) {
    91         dvo_catalog_save_segment (&outcatalog[Ncat], VERBOSE, outcatalog[Ncat].Nave_disk, outcatalog[Ncat].Naverage);
    92       }
     64    for (j = 0; j < outlist[0].Nregions; j++) {
     65      dvo_catalog_close (&outcatalogs[j]);
    9366    }
    94 
    95     // split out the measure entries:
    96     incatalog.catflags = LOAD_MEAS;
    97     Nblocks = incatalog.Nmeas_disk / NROWS;
    98     for (j = 0; j < Nblocks; j++) {
    99 
    100       // read up to NROWS at a time
    101       dvo_catalog_load_segment (&incatalog, VERBOSE, j*NROWS, NROWS);
    102 
    103       for (k = 0; k < incatalog.Nmeasure; k++) {
    104 
    105         averef = incatalog.measure[k].averef;
    106         Ncat = outcat[averef];
    107 
    108         Nout = outcatalog[Ncat].Nmeasure;
    109         outcatalog[Ncat].measure[Nout] = incatalog.measure[k];
    110         outcatalog[Ncat].measure[Nout].averef = outref[averef];
    111         outcatalog[Ncat].Nmeasure++;
    112       }
    113 
    114       for (n = 0; n < Noutcatalog; n++) {
    115         dvo_catalog_save_segment (&outcatalog[N], VERBOSE, outcatalog[N].Nmeas_disk, outcatalog[N].Nmeasure);
    116       }
    117     }
    118 
    119     // split out the secfilt entries:
    120     incatalog.catflags = LOAD_SECF;
    121     Nblocks = incatalog.Nsecfilt_disk / NROWS;
    122     for (j = 0; j < Nblocks; j++) {
    123 
    124       // read up to NROWS at a time
    125       dvo_catalog_load_segment (&incatalog, VERBOSE, j*NROWS, NROWS);
    126 
    127       for (k = 0; k < incatalog.Naverage; k++) {
    128 
    129         averef = j*NROWS + k;
    130         Ncat = outcat[averef];
    131         Nout = outref[averef] * Nsecfilt;
    132 
    133         for (n = 0; n < Nsecfilt; n++) {
    134           outcatalog[Ncat].secfilt[Nout + n] = incatalog.measure[k*Nsecfilt + n];
    135         }
    136       }
    137 
    138       for (n = 0; n < Noutcatalog; n++) {
    139         dvo_catalog_save_segment (&outcatalog[N], VERBOSE, outcatalog[N].Nmeas_disk, outcatalog[N].Nmeasure);
    140       }
    141     }
    142 
     67  }
     68  exit (0);
     69}
Note: See TracChangeset for help on using the changeset viewer.