IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5439


Ignore:
Timestamp:
Oct 21, 2005, 5:53:44 PM (21 years ago)
Author:
eugene
Message:

working on skydb tools

Location:
trunk/Ohana/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/doc/notes.txt

    r5397 r5439  
    11
    2 todo goals:
     2todo:
     3
     4  * sky db tools
     5  * parallel servers
     6  * threaded addstard
     7  * dvo_load daemon
     8  * getstar (program and c-client)
     9  * parallal / proper-motion data
     10  * other additional Average / Measure columns
     11  * deal with Myyyy as sky value
     12  * better way to interpret flips header info for sky?
     13  * fix unlink empty file problem
     14  * programs like relphot and dvo need to be provided
     15    with sorted measure tables; add this as a feature
     16    of the load_catalog API?
     17
     18done:
    319
    420  o move addstar/gstars to AddstarClientOptions
     
    925  o address the cat & ref modes in client/server
    1026  o add airmass quality to options
    11 
    12   * deal with Myyyy as sky value
    13   * better way to interpret flips header info for sky?
    14   * fix unlink empty file problem
    15   * programs like relphot and dvo need to be provided
    16     with sorted measure tables; add this as a feature
    17     of the load_catalog API?
    1827
    19282005.10.19
  • trunk/Ohana/src/libautocode/Makefile

    r5345 r5439  
    5151$(SRC)/Stars.$(ARCH).o \
    5252$(SRC)/GSCRegion.$(ARCH).o \
    53 $(SRC)/AddstarClientOptions.$(ARCH).o
     53$(SRC)/AddstarClientOptions.$(ARCH).o \
     54$(SRC)/SkyRegion.$(ARCH).o
    5455
    5556LIBINC = \
     
    8283$(INC)/Stars.h \
    8384$(INC)/GSCRegion.h \
    84 $(INC)/AddstarClientOptions.h
     85$(INC)/AddstarClientOptions.h \
     86$(INC)/SkyRegion.h
    8587
    8688objects: $(LIBOBJ)
  • trunk/Ohana/src/libdvo/Makefile

    r5346 r5439  
    7171$(ASRC)/Stars.$(ARCH).o \
    7272$(ASRC)/GSCRegion.$(ARCH).o \
    73 $(ASRC)/AddstarClientOptions.$(ARCH).o
     73$(ASRC)/AddstarClientOptions.$(ARCH).o \
     74$(ASRC)/SkyRegion.$(ARCH).o
    7475
    7576ACOM = $(ADEF)/autocode.c $(ADEF)/autocode.h $(ADEF)/common.h
  • trunk/Ohana/src/opihi/dvo/find_regions.c

    r4689 r5439  
    1515  int NLINES, done, NREGIONS, nregion;
    1616 
    17   VarConfig ("GSCFILE", "%s", filename);
     17  VarConfig ("SKYFILE", "%s", filename);
    1818  f = fopen (filename, "r");
    1919  if (f == NULL) {
  • trunk/Ohana/src/opihi/dvo2/Makefile

    r5242 r5439  
    1717INCS    =       -I$(INC) -I$(LINC) -I$(XINC)
    1818LFLAGS  =       -L$(LLIB) -L$(LIB)
    19 LIBS1   =       -lsocket -lnsl -lreadline -ltermcap -lFITS -lohana -lm
     19LIBS1   =       -lsocket -lnsl -lreadline -ltermcap -ldvo -lFITS -lohana -lm
    2020LIBS2   =       -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata
    2121LIBS    =       $(LIBS2) $(LIBS1)
     
    4747install: $(DESTBIN)/dvo2
    4848
    49 # utilities #################################################
    50 $(BIN)/%.$(ARCH):
    51         @if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
    52         $(CC) $^ -o $@ $(LFLAGS) $(LIBS)
    53         @echo "compiled $*"
    54         @echo ""
     49mkst = \
     50$(SDIR)/mkskytable.$(ARCH).o \
     51$(SDIR)/skydbutils.$(ARCH).o
    5552
    56 $(DESTBIN)/%: $(BIN)/%.$(ARCH)
    57         @if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
    58         rm -f $(DESTBIN)/$*
    59         cp $(BIN)/$*.$(ARCH) $(DESTBIN)/$*
    60         @echo "installed $*"
    61         @echo ""
     53$(BIN)/mkskytable.$(ARCH): $(mkst)
     54mkskytable: $(BIN)/mkskytable.$(ARCH)
     55mkskytable.install: $(DESTBIN)/mkskytable
    6256
    63 $(LIB)/%.$(ARCH).a:
    64         @if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi
    65         rm -f $@
    66         ar rcv $@ $^
    67         $(RANLIB) $@
    68         @echo "compiled library $*"
    69         @echo ""
     57.PHONY: dvo
     58.PHONY: mkskytable
    7059
    71 $(DESTLIB)/%.a: $(LIB)/%.$(ARCH).a
    72         @if [ ! -d $(DESTLIB) ]; then mkdir -p $(DESTLIB); fi
    73         @echo ""
    74         rm -f $@
    75         cp $^ $@
    76 
    77 clean:
    78         rm -f $(BIN)/*.$(ARCH)
    79         rm -f $(LIB)/*.$(ARCH).a
    80         rm -f `find . -name "*.o"`
    81         rm -f `find . -name "*~"`
    82         rm -f `find . -name "#*"`
    83 
    84 dist: clean
    85         rm -f $(BIN)/*
    86         rm -f $(LIB)/*
    87 
    88 lib%.clean:
    89         rm -f $(LIB)/lib$*.$(ARCH).a
    90         rm -f $($*)
    91         @echo ""
    92 
    93 %.clean:
    94         rm -f $(BIN)/$*.$(ARCH)
    95         @echo ""
    96 
    97 %.$(ARCH).o : %.c
    98         $(CC) $(CFLAGS) -c $*.c -o $@
     60include ../Makefile.Common
    9961
    10062
    101 
    102 ## -*- makefile -*-
    103 # deprecated functions: verify & delete
    104 #$(SDIR)/abszero.$(ARCH).o \
    105 #$(SDIR)/cals.$(ARCH).o \
    106 #$(SDIR)/dumpmags.$(ARCH).o \
    107 #$(SDIR)/extract.$(ARCH).o \
    108 #$(SDIR)/gtypes.$(ARCH).o \
    109 #$(SDIR)/photresid.$(ARCH).o \
    110 #$(SDIR)/resid.$(ARCH).o \
    111 #$(SDIR)/zeropts.$(ARCH).o
    112 #$(SDIR)/objload.$(ARCH).o \ - make sure we have vect to tv
    113 #$(SDIR)/ccdextract.$(ARCH).o \
    114 #$(SDIR)/cmdextract.$(ARCH).o \
    115 #$(SDIR)/dmagextract.$(ARCH).o \
    116 #$(SDIR)/ddmagextract.$(ARCH).o \
    117 
    118 # future functions, not fully implemented
    119 #$(SDIR)/detrend.$(ARCH).o \
    120 #$(SDIR)/getxtra.$(ARCH).o \
    121 #$(SDIR)/addxtra.$(ARCH).o \
    122 
    123 # functions that need to be updated
    124 #$(SDIR)/gregions.$(ARCH).o \
    125 
  • trunk/Ohana/src/opihi/dvo2/skydbsearch.c

    r5438 r5439  
    181181}
    182182
    183 SkyRegion *SkyBuildTable (SkyRegion *seed, int Nseed, int level, int depth) {
    184 
    185   /* given a table of Rmin, Dmin, Rmax, Dmax, name, at level 3, generate
    186      all higher levels and 'depth' extra levels */
    187 
    188   /* levels:
    189      0 - fullsky.cpt
    190      1 - n????.cpt, s????.cpt
    191      2 - r????.cpt
    192      3 - ????.cpt
    193      4 - ????.??.cpt
    194   */
    195  
    196   SkyRegion *db;
    197 
    198   /* allocate at least 30 for levels 0 & 1 */
    199   NREGION = 100;
    200   ALLOCATE (db, SkyRegion, NREGION);
    201 
    202   /* full sky */
    203   strcpy (region[0].name, "fullsky.cpt");
    204   region[0].Rmin =   0; region[0].Rmax = 360;
    205   region[0].Dmin = -90; region[0].Dmax =  90;
    206   region[0].depth = 0;
    207   region[0].child = FALSE;
    208   N = 1;
    209 
    210   region[0].childS = N;
    211   /* north dec bands */
    212   for (dec = 0; dec < 90; dec += 7.5) {
    213     sprintf (region[N].name, "n%04d.cpt", (int) 100*dec);
    214     region[N].Rmin =   0; region[N].Rmax = 360;
    215     region[N].Dmin = dec; region[N].Dmax = dec + 7.5;
    216     region[N].depth = 1;
    217     region[N].child = FALSE;
    218     N++;
    219   }
    220   /* south dec bands */
    221   for (dec = 0; dec > -90; dec -= 7.5) {
    222     sprintf (region[N].name, "s%04d.cpt", (int) 100*dec);
    223     region[N].Rmin =   0;       region[N].Rmax = 360;
    224     region[N].Dmin = dec - 7.5; region[N].Dmax = dec;
    225     region[N].depth = 1;
    226     region[N].child = FALSE;
    227     N++;
    228   }
    229   region[0].childE = N;
    230 
    231   /* subdivide dec bands based on seed */
    232   Rnumber = 0;
    233   childS = region[0].childS;
    234   childE = region[0].childE;
    235   for (i = childS; i < childE; i++) {
    236 
    237     Nnew = 0;
    238     NNEW = 100;
    239     ALLOCATE (new, SkyRegion, NNEW);
    240 
    241     for (j = 0; j < Nseed; j++) {
    242       /* skip seeds outside of parent bound */
    243       if (seed[j].Rmin > region[i].Rmax) continue;
    244       if (seed[j].Rmax < region[i].Rmin) continue;
    245       if (seed[j].Dmin > region[i].Dmax) continue;
    246       if (seed[j].Dmax < region[i].Dmin) continue;
    247      
    248       for (k = 0; k < Nnew; k++) {
    249         if ((seed[j].Rmin == new[k].Rmin) &&
    250             (seed[j].Rmax == new[k].Rmax)) {
    251           goto next_seed;
    252         }
    253         if ((seed[j].Rmin == new[k].Rmin) ^^
    254             (seed[j].Rmax != new[k].Rmax)) {
    255           fprintf (stderr, "inconsistent blocks in seed file\n");
    256           return (NULL);
    257         }
    258       }
    259       /* new region spans full DEC band.  */
    260       new[Nnew].Dmin = region[i].Dmin;
    261       new[Nnew].Dmax = region[i].Dmax;
    262      
    263       Ntall = (region[i].Dmax - region[i].Dmin) / (seed[j].Dmax - seed[j].Dmin);
    264      
    265       /* fi
    266 
    267       new[Nnew].Rmin = seed[j].Rmin;
    268       new[Nnew].Rmax = seed[j].Rmax;
    269       new[Nnew].depth = 2;
    270       new[Nnew].child = FALSE;
    271       strncpy (root, region[i].name, 5); root[5] = 0;
    272       sprintf (new[Nnew].name, "%s/r%04d.cpt", root, Rnumber);
    273       Rnumber ++;     
    274       Nnew ++;
    275       if (Nnew == NNEW) {
    276         NNEW += 100;
    277         REALLOCATE (new, SkyRegion, NNEW);
    278       }
    279     next_seed:
    280     }
    281     /* update db list */
    282     region[i].childS = N;
    283     region[i].childE = N + Nnew;
    284     NREGION = N + Nnew + 100;
    285     REALLOCATE (db, SkyRegion, NREGION);
    286     memcpy (&region[N], new, Nnew*sizeof(SkyRegion));
    287     free (new);
    288     N += Nnew;
    289   }
    290 
    291   /* subdivide ra strips based on seed */
    292   childS = region[region[0].childS].childS;
    293   childE = region[region[0].childE - 1].childE;
    294   nextS = N;
    295   for (i = childS; i < childE; i++) {
    296 
    297     Nnew = 0;
    298     NNEW = 100;
    299     ALLOCATE (new, SkyRegion, NNEW);
    300 
    301     for (j = 0; j < Nseed; j++) {
    302       if (seed[j].Rmin > region[i].Rmax) continue;
    303       if (seed[j].Rmax < region[i].Rmin) continue;
    304       if (seed[j].Dmin > region[i].Dmax) continue;
    305       if (seed[j].Dmax < region[i].Dmin) continue;
    306      
    307       for (k = 0; k < Nnew; k++) {
    308         if ((seed[j].Dmin == new[k].Dmin) &&
    309             (seed[j].Dmax == new[k].Dmax)) {
    310           goto next_seed;
    311         }
    312         if ((seed[j].Dmin == new[k].Dmin) ^^
    313             (seed[j].Dmax != new[k].Dmax)) {
    314           fprintf (stderr, "inconsistent blocks in seed file\n");
    315           return (NULL);
    316         }
    317       }
    318       new[Nnew].Dmin = seed[j].Dmin;
    319       new[Nnew].Dmax = seed[j].Dmax;
    320       new[Nnew].Rmin = region[i].Rmin;
    321       new[Nnew].Rmax = region[i].Rmax;
    322       new[Nnew].depth = 3;
    323       new[Nnew].child = FALSE;
    324       strcpy (new[Nnew].name, seed[j].name);
    325       Nnew ++;
    326       if (Nnew == NNEW) {
    327         NNEW += 100;
    328         REALLOCATE (new, SkyRegion, NNEW);
    329       }
    330     next_seed:
    331     }
    332    
    333     /* update db list */
    334     region[i].childS = N;
    335     region[i].childE = N + Nnew;
    336     NREGION = N + Nnew + 100;
    337     REALLOCATE (db, SkyRegion, NREGION);
    338     memcpy (&region[N], new, Nnew*sizeof(SkyRegion));
    339     free (new);
    340     N += Nnew;
    341   }
    342   nextE = N;
    343 
    344   /* subdivide entries once more */
    345   childS = nextS;
    346   childE = nextE;
    347   for (i = childS; i < childE; i++) {
    348     Rnumber = 0;
    349     region[i].childS = N;
    350     dDec = (region[i].Dmax - region[i].Dmin) / 5.0;
    351     dRa  = (region[i].Rmax - region[i].Rmin) / 5.0;
    352     for (nx = 0; nx < 5; nx++) {
    353       for (ny = 0; ny < 5; ny++) {
    354         region[N].Dmin = region[i].Dmin + dDec * (nx + 0);
    355         region[N].Dmax = region[i].Dmax + dDec * (nx + 1);
    356         region[N].Rmin = region[i].Rmin + dDec * (nx + 0);
    357         region[N].Rmax = region[i].Rmax + dDec * (nx + 1);
    358         region[N].depth = 3;
    359         region[N].child = FALSE;
    360         strncpy (root, region[i].name, 10); root[10] = 0;
    361         sprintf (region[N].name, "%s.%02d.cpt", root, Rnumber);
    362         Rnumber ++;
    363         N ++;
    364         if (N == NREGION) {
    365           NREGION += 100;
    366           REALLOCATE (new, SkyRegion, NREGION);
    367         }
    368       }
    369     }
    370   }
    371 
    372 }
    373 
    374183/* region is pointer to entry in db */
    375184SkyRegion *SkyExtend (SkyRegion *db, SkyRegion *region) {
  • trunk/Ohana/src/opihi/include/dvo2.h

    r5438 r5439  
    1 # include "external.h"
    2 # include "shell.h"
    3 # include "dvomath.h"
    4 # include "convert.h"
    5 # include "display.h"
    6 # include "data.h"
     1# include "astro.h"
    72
    83# ifndef DVO2_H
     
    2318} SkyRegionList;
    2419
     20# if (0)
    2521typedef struct {
    2622  float Rmin, Rmax;
     
    3127  char  name[24];
    3228} SkyRegion; /* 48 bytes */
     29# endif
    3330
    3431SkyRegion *SkyFindPoint (SkyRegion *db, SkyCoord c, int depth);
     
    3633SkyRegion **SkyFindArea (SkyRegion *db, SkyCoord c1, SkyCoord c2, int *nlist);
    3734SkyRegion *SkyFindAreaDB (SkyRegion *db, SkyRegion *ref, SkyCoord c1, SkyCoord c2, int *Nregion);
    38 SkyRegion *SkyBuildTable (SkyRegion *seed, int Nseed, int level, int depth);
    3935
    4036SkyRegion *SkyMakeRegions (int Nlevels, int *nlist);
     
    4339SkyRegion *SkyDivide (SkyRegion *in);
    4440
     41SkyRegionTable *SkyBuildTable (SkyRegion *seed, int Nseed);
     42SkyRegion *SkyRegionsFromGSC (char *filename, int *nregions);
     43int FindDecBand (double dec, double *DEC0, double *DEC1);
     44
    4545# endif
Note: See TracChangeset for help on using the changeset viewer.