IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31635


Ignore:
Timestamp:
Jun 16, 2011, 11:18:00 AM (15 years ago)
Author:
bills
Message:

move the functions that implement the dvo "database lookups" (avextract, mextract, imextract) etc from opihi to libdvo so that they can be used in relastro -high-speed. Restructure relastro -high-speed to use configuration variables for the cuts on the two sets of photcodes. Default to ps1 versus 2mass as was previoulsy hard coded

Location:
trunk/Ohana/src
Files:
7 added
48 edited
19 moved

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/Makefile

    r31496 r31635  
    3636$(DESTINC)/ps1_ref_defs.h
    3737
    38 INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h $(DESTINC)/dvo_util.h
     38INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h $(DESTINC)/dvo_util.h $(DESTINC)/dvodb.h $(DESTINC)/libdvo_astro.h $(DESTINC)/convert.h
    3939
    4040OBJS = \
     
    7373$(SRC)/skyregion_gsc.$(ARCH).o    \
    7474$(SRC)/skyregion_ops.$(ARCH).o \
     75$(SRC)/dvo_set_skyregion.$(ARCH).o \
     76$(SRC)/dvo_set_catdir.$(ARCH).o \
    7577$(SRC)/cmf-ps1-v1-alt.$(ARCH).o \
    7678$(SRC)/cmf-ps1-sv1-alt.$(ARCH).o \
    77 $(SRC)/dvo_util.$(ARCH).o
     79$(SRC)/dvo_util.$(ARCH).o \
     80$(SRC)/dbBooleanCond.$(ARCH).o          \
     81$(SRC)/dbCheckStack.$(ARCH).o           \
     82$(SRC)/dbCmdlineFields.$(ARCH).o        \
     83$(SRC)/dbExtractAverages.$(ARCH).o      \
     84$(SRC)/dbExtractMeasures.$(ARCH).o      \
     85$(SRC)/dbExtractImages.$(ARCH).o        \
     86$(SRC)/dbFields.$(ARCH).o       \
     87$(SRC)/dbRPN.$(ARCH).o                  \
     88$(SRC)/dbStackMath.$(ARCH).o            \
     89$(SRC)/dbStackOps.$(ARCH).o             \
     90$(SRC)/coord_systems.$(ARCH).o          \
     91$(SRC)/LoadImages.$(ARCH).o             \
     92$(SRC)/ImageSelection.$(ARCH).o         \
     93$(SRC)/ImageOps.$(ARCH).o               \
     94$(SRC)/match_image.$(ARCH).o            \
     95$(SRC)/db_utils.$(ARCH).o               \
     96$(SRC)/convert.$(ARCH).o
     97
    7898
    7999# $(SRC)/dvo_convert_panstarrs.$(ARCH).o
  • trunk/Ohana/src/libdvo/include/convert.h

    r31607 r31635  
    1 # include "external.h"
     1// # include "external.h"
     2
     3#include <ohana.h>
     4#include <dvo.h>
    25
    36# ifndef CONVERT_H
  • trunk/Ohana/src/libdvo/include/dvo.h

    r31450 r31635  
     1# ifndef DVO_H
     2# define DVO_H
     3
    14# include <ohana.h>
    25# include <gfitsio.h>
    36# include <autocode.h>
    47
    5 # ifndef DVO_H
    6 # define DVO_H
     8# include <libdvo_astro.h>
     9# include <dvodb.h>
    710
    811/* DVO table modes */
     
    501504SkyList   *SkyListChildrenByBounds_List PROTO((SkyList *table, int depth, double Rmin, double Rmax, double Dmin, double Dmax));
    502505
     506int set_skyregion(double Rs, double Re, double Ds, double De);
     507int get_skyregion (double *Rs, double *Re, double *Ds, double *De);
     508
     509void dvo_set_catdir(char *catdir);
     510char *dvo_get_catdir();
     511
    503512/* dvo-specific sorting functions */
    504513void sortave (Average *ave, off_t N);
     
    508517void sort_regions (SkyRegion *region, off_t N);
    509518
     519#ifdef MOVED_TO_LIBOHANA
     520int  print_error(void);
     521int  init_error(void);
     522int  push_error(char *);
     523#endif
     524
    510525# endif
  • trunk/Ohana/src/libdvo/src/ImageOps.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
     2# include "dvodb.h"
    23
    34void image_subset (Image *image, off_t Nimage, off_t **Subset, off_t *Nsubset,
     
    1617
    1718  if (selection->useDisplay) {
    18     if (!GetGraphData (&graph, NULL, NULL)) {
     19    if (!GetGraphdata (&graph, NULL, NULL)) {
    1920      gprint (GP_ERR, "region display not available\n");
    2021      return;
  • trunk/Ohana/src/libdvo/src/ImageSelection.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22
    33/* db image table */
     
    2929  }
    3030
    31   if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     31  if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE);
    3232  BuildChipMatch (image, Nimage);
    3333  image_subset (image, Nimage, &subset, &Nsubset, selection, tzero, (double) tend - tzero, TimeSelect);
     
    3838/* free loaded images */
    3939void FreeImageSelection () {
    40   if (image != NULL) FreeImages(image);
     40  if (image != NULL) FreeImagesDVO(image);
    4141  if (subset != NULL) free (subset);
    4242  image = NULL;
     
    4545}
    4646
    47 Image *MatchImage (unsigned int time, short int source, unsigned int imageID) {
     47Image *MatchImageDVO (unsigned int time, short int source, unsigned int imageID) {
    4848
    4949  int m = -1;
  • trunk/Ohana/src/libdvo/src/LoadImages.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
     2# include "dvodb.h"
    23
    34// XXX: Maybe make this a command line option
     
    1112static time_t getLastModified(char *filename);
    1213
    13 Image *LoadImages (off_t *Nimage) {
     14Image *LoadImagesDVO (off_t *Nimage) {
    1415
    1516  int status;
     
    2021  /* VarConfig ("IMAGE_CATALOG", "%s", filename); */
    2122
    22   catdir = GetCATDIR ();
     23  catdir = dvo_get_catdir ();
    2324  sprintf (filename, "%s/Images.dat", catdir);
    2425
     
    8889}
    8990
    90 void FreeImages(Image *images) {
     91void FreeImagesDVO(Image *images) {
    9192  if (!dvoUseImageCache && (images != NULL)) {
    9293    free(images);
  • trunk/Ohana/src/libdvo/src/coord_systems.c

    r31607 r31635  
    1 # include "astro.h"
     1# include "dvo.h"
     2# include "libdvo_astro.h"
    23   
    34CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output) {
  • trunk/Ohana/src/libdvo/src/dbBooleanCond.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22
    33// evaluate the expression in inStack as a boolean; necessary db field values are
  • trunk/Ohana/src/libdvo/src/dbCheckStack.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22
    33// XXX we are using a fairly bogus set of char values to distinguish a few cases:
     
    66// 't', 'T' : value is a temp scalar (upper == float; lower == int)
    77// these would be better done using bit values to test for field? temp? float?
     8//
     9
     10#define OPIHI_INT 1
    811
    912int dbCheckStack (dbStack *stack, int Nstack, int table, dbField **inFields, int *inNfields) {
  • trunk/Ohana/src/libdvo/src/dbCmdlineFields.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22
    33// check for 'where' or 'matched to'; return first field after the word, and the value
     
    128128
    129129    Graphdata graphsky;
    130     if (!GetGraphData (&graphsky, NULL, NULL)) {
     130    if (!GetGraphdata (&graphsky, NULL, NULL)) {
    131131      gprint (GP_ERR, "region display not available\n");
    132132      return (FALSE);
  • trunk/Ohana/src/libdvo/src/dbExtractAverages.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
     2# include "libdvo_astro.h"
    23
    34/* time concepts */
  • trunk/Ohana/src/libdvo/src/dbExtractImages.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22
    33/* time concepts */
  • trunk/Ohana/src/libdvo/src/dbExtractMeasures.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
     2# include "dvodb.h"
    23
    34// to add a new field to the extractions:
     
    358359        ra  = average[0].R - measure[0].dR / 3600.0;
    359360        dec = average[0].D - measure[0].dD / 3600.0;
    360         image = MatchImage (measure[0].t, measure[0].photcode, measure[0].imageID);
     361        image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
    361362        if (image == NULL) break;
    362363        RD_to_XY (&x, &y, ra, dec, &image[0].coords);
     
    374375        ra  = average[0].R - measure[0].dR / 3600.0;
    375376        dec = average[0].D - measure[0].dD / 3600.0;
    376         image = MatchImage (measure[0].t, measure[0].photcode, measure[0].imageID);
     377        image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
    377378        if (image == NULL) break;
    378379        RD_to_XY (&x, &y, ra, dec, &image[0].coords);
     
    449450      {
    450451        Image *image;
    451         image = MatchImage (measure[0].t, measure[0].photcode, measure[0].imageID);
     452        image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
    452453        if (image == NULL) break;
    453454        value.Int = image->externID;
  • trunk/Ohana/src/libdvo/src/dbFields.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22
    33void dbFreeFields (dbField *fields, int Nfields) {
     
    240240  return (TRUE);
    241241}
    242  
     242
    243243int ParseAverageField (dbField *field, char *fieldName) {
    244244
     
    335335}
    336336
     337
    337338int ParseImageField (dbField *field, char *fieldName) {
    338339
  • trunk/Ohana/src/libdvo/src/dbRPN.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22# define DUMPSTACK 0
    33
  • trunk/Ohana/src/libdvo/src/dbStackMath.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22
    33static int NallocBinary = 0;
  • trunk/Ohana/src/libdvo/src/dbStackOps.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22
    33void dbInitStack (dbStack *stack) {
  • trunk/Ohana/src/libdvo/src/match_image.c

    r31607 r31635  
    1 # include "dvoshell.h"
     1# include "dvo.h"
    22
    33off_t match_image (Image *image, off_t Nimage, unsigned int T, short int S) {
  • trunk/Ohana/src/libohana/Makefile

    r31496 r31635  
    3939$(SRC)/IOBufferOps.$(ARCH).o     \
    4040$(SRC)/CommOps.$(ARCH).o         \
     41$(SRC)/isolate_elements.$(ARCH).o        \
     42$(SRC)/errors.$(ARCH).o  \
     43$(SRC)/gprint.$(ARCH).o  \
    4144$(SRC)/version.$(ARCH).o
    4245
  • trunk/Ohana/src/libohana/include/ohana.h

    r31160 r31635  
    9494};
    9595
     96typedef enum {GP_LOG, GP_ERR} gpDest;
     97
    9698/* Some notes on the Ohana BYTE_SWAP macros:
    9799
     
    317319off_t   Fwrite                 PROTO((void *ptr, off_t size, off_t nitems, FILE *f, char *type));
    318320
     321char   **isolate_elements      PROTO((int argc, char **argv, int *nstack));
     322
     323// functions used to manage "last error message"
     324int    init_error                PROTO((void));
     325int    push_error                PROTO((char *line));
     326int    print_error               PROTO((void));
     327
     328// gprint gets a stub implementation in libohana. opihi implements the real one.
     329int    gprint (gpDest dest, char *format, ...);
     330
    319331/*
    320332#   define F_SETFL         4   
  • trunk/Ohana/src/libohana/src/errors.c

    r31607 r31635  
    1 # include "opihi.h"
     1# include "ohana.h"
    22
    33static char errorline[1024];
  • trunk/Ohana/src/libohana/src/isolate_elements.c

    r31607 r31635  
    1 # include "opihi.h"
     1// # include "opihi.h"
     2//
     3#include "ohana.h"
    24
    35/* local private functions */
  • trunk/Ohana/src/opihi/cmd.astro/Makefile

    r30972 r31635  
    2525$(SRC)/cplot.$(ARCH).o             \
    2626$(SRC)/csystem.$(ARCH).o           \
    27 $(SRC)/coord_systems.$(ARCH).o     \
    2827$(SRC)/ctimes.$(ARCH).o    \
    2928$(SRC)/cval.$(ARCH).o              \
     
    7776$(INC)/shell.h \
    7877$(INC)/dvomath.h \
    79 $(INC)/convert.h \
    8078$(INC)/display.h
    8179
  • trunk/Ohana/src/opihi/cmd.basic/Makefile

    r27255 r31635  
    6666$(INC)/shell.h \
    6767$(INC)/dvomath.h \
    68 $(INC)/convert.h \
    6968$(INC)/display.h
    7069
  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r31450 r31635  
    155155$(INC)/shell.h \
    156156$(INC)/dvomath.h \
    157 $(INC)/convert.h \
    158157$(INC)/display.h
    159158
  • trunk/Ohana/src/opihi/cmd.data/cursor.c

    r13479 r31635  
    2020    remove_argument (N, &argc, argv);
    2121  }
    22   if (!GetGraphData (NULL, &kapa, name)) return (FALSE);
     22  if (!GetGraphdata (NULL, &kapa, name)) return (FALSE);
    2323  FREE (name);
    2424
  • trunk/Ohana/src/opihi/cmd.data/ps.c

    r14590 r31635  
    5656
    5757  // get the connection to kapa, false if none available
    58   if (!GetGraphData (NULL, &kapa, name)) return (FALSE);
     58  if (!GetGraphdata (NULL, &kapa, name)) return (FALSE);
    5959  FREE (name);
    6060
  • trunk/Ohana/src/opihi/dvo/Makefile

    r31450 r31635  
    2020funcs = \
    2121$(SRC)/init.$(ARCH).o                   \
    22 $(SRC)/ImageOps.$(ARCH).o               \
    23 $(SRC)/ImageSelection.$(ARCH).o         \
    24 $(SRC)/LoadImages.$(ARCH).o             \
    2522$(SRC)/cmpReadFile.$(ARCH).o            \
    2623$(SRC)/compare.$(ARCH).o                \
    27 $(SRC)/match_image.$(ARCH).o            \
    2824$(SRC)/dvomisc.$(ARCH).o                \
    2925$(SRC)/region_list.$(ARCH).o            \
    3026$(SRC)/find_matches.$(ARCH).o           \
    3127$(SRC)/photometry.$(ARCH).o             \
    32 $(SRC)/dbBooleanCond.$(ARCH).o          \
    33 $(SRC)/dbCheckStack.$(ARCH).o           \
    34 $(SRC)/dbCmdlineFields.$(ARCH).o        \
    35 $(SRC)/dbExtractAverages.$(ARCH).o      \
    36 $(SRC)/dbExtractMeasures.$(ARCH).o      \
    37 $(SRC)/dbExtractImages.$(ARCH).o        \
    38 $(SRC)/dbFields.$(ARCH).o               \
    39 $(SRC)/dbRPN.$(ARCH).o                  \
    40 $(SRC)/dbStackMath.$(ARCH).o            \
    41 $(SRC)/dbStackOps.$(ARCH).o             \
    4228$(SRC)/dvo.$(ARCH).o
    4329
  • trunk/Ohana/src/opihi/dvo/badimages.c

    r29540 r31635  
    2020  }
    2121 
    22   image = LoadImages (&Nimage);
     22  image = LoadImagesDVO (&Nimage);
    2323
    2424  Cross = FALSE;
     
    7070  }
    7171 
    72   FreeImages(image);
     72  FreeImagesDVO(image);
    7373  return (TRUE);
    7474}
  • trunk/Ohana/src/opihi/dvo/dmt.c

    r27435 r31635  
    4545  }
    4646
    47   if (!GetGraphData (&graphsky, &kapa, NULL)) return (FALSE);
     47  if (!GetGraphdata (&graphsky, &kapa, NULL)) return (FALSE);
    4848  if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);
    4949
  • trunk/Ohana/src/opihi/dvo/extract.c

    r17201 r31635  
    3131  RegionFile *regions;
    3232
    33   if (!GetGraphData (&graphmode, NULL, NULL)) return (FALSE);
     33  if (!GetGraphdata (&graphmode, NULL, NULL)) return (FALSE);
    3434  if (!InitPhotcodes ()) return (FALSE);
    3535
  • trunk/Ohana/src/opihi/dvo/gimages.c

    r30612 r31635  
    8383  if (!ohana_str_to_radec (&Ra, &Dec, argv[1], argv[2])) return (FALSE);
    8484
    85   if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     85  if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE);
    8686  image_subset (image, Nimage, &subset, &Nsubset, selection, tzero, trange, TimeSelect);
    8787  BuildChipMatch (image, Nimage);
     
    245245  set_int_variable ("IMAGEphotcode:n", Nfound);
    246246
    247   FreeImages (image);
     247  FreeImagesDVO (image);
    248248  free (subset);
    249249
  • trunk/Ohana/src/opihi/dvo/images.c

    r30612 r31635  
    130130 
    131131  /* it is not an error for the database not to have any images */
    132   if ((image = LoadImages (&Nimage)) == NULL) return (TRUE);
     132  if ((image = LoadImagesDVO (&Nimage)) == NULL) return (TRUE);
    133133  BuildChipMatch (image, Nimage);
    134134
     
    355355  free (Xvec.elements.Flt);
    356356  free (Yvec.elements.Flt);
    357   FreeImages (image);
     357  FreeImagesDVO (image);
    358358  FREE (foundMosaic);
    359359  return (TRUE);
  • trunk/Ohana/src/opihi/dvo/imdata.c

    r29540 r31635  
    8686  if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) return (FALSE);
    8787
    88   if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     88  if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE);
    8989  image_subset (image, Nimage, &subset, &Nsubset, selection, tzero, trange, TimeSelect);
    9090  BuildChipMatch (image, Nimage);
     
    222222  vec[0].Nelements = N;
    223223  REALLOCATE (vec[0].elements.Flt, opihi_flt, MAX(1,N));
    224   FreeImages(image);
     224  FreeImagesDVO(image);
    225225  return (TRUE);
    226226}
  • trunk/Ohana/src/opihi/dvo/imdense.c

    r28958 r31635  
    2121  }
    2222
    23   if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     23  if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE);
    2424  BuildChipMatch (image, Nimage);
    2525
     
    7070  free (Xvec.elements.Flt);
    7171  free (Yvec.elements.Flt);
    72   FreeImages (image);
     72  FreeImagesDVO (image);
    7373  return (TRUE);
    7474
  • trunk/Ohana/src/opihi/dvo/imextract.c

    r31160 r31635  
    9090  }
    9191
    92   if ((image = LoadImages (&Nimage)) == NULL) goto escape;
     92  if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape;
    9393  BuildChipMatch (image, Nimage);
    9494  dbExtractImagesInit ();
     
    141141
    142142  // free (subset);
    143   FreeImages (image);
     143  FreeImagesDVO (image);
    144144
    145145  if (vec) free (vec);
  • trunk/Ohana/src/opihi/dvo/imlist.c

    r29938 r31635  
    8181  }
    8282 
    83   if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     83  if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE);
    8484  image_subset (image, Nimage, &subset, &Nsubset, selection, tzero, trange, TimeSelect);
    8585  BuildChipMatch (image, Nimage);
     
    108108  }
    109109
    110   FreeImages(image);
     110  FreeImagesDVO(image);
    111111  free (subset);
    112112  return (TRUE);
  • trunk/Ohana/src/opihi/dvo/imphot.c

    r30612 r31635  
    5050  gprint (GP_ERR, "searching in range %ds - %ds (%f seconds)\n", (int)tzero, (int)(tzero + trange), trange);
    5151 
    52   if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     52  if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE);
    5353  image_subset (image, Nimage, &subset, &Nsubset, selection, tzero, trange, TRUE);
    5454
     
    9898  }
    9999
    100   FreeImages(image);
     100  FreeImagesDVO(image);
    101101  free (subset);
    102102  return (TRUE);
  • trunk/Ohana/src/opihi/dvo/imstats.c

    r29540 r31635  
    3030  }
    3131
    32   if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     32  if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE);
    3333  BuildChipMatch (image, Nimage);
    3434
     
    5858  free (Xvec.elements.Flt);
    5959  free (Yvec.elements.Flt);
    60   FreeImages (image);
     60  FreeImagesDVO (image);
    6161  return (TRUE);
    6262}
  • trunk/Ohana/src/opihi/dvo/lcat.c

    r14401 r31635  
    1111  SkyList *skylist;
    1212
    13   if (!GetGraphData (&graphmode, NULL, NULL)) return (FALSE);
     13  if (!GetGraphdata (&graphmode, NULL, NULL)) return (FALSE);
    1414
    1515  ShowAll = FALSE;
  • trunk/Ohana/src/opihi/dvo/photometry.c

    r30612 r31635  
    11781178      ra  = average[0].R - measure[0].dR / 3600.0;
    11791179      dec = average[0].D - measure[0].dD / 3600.0;
    1180       image = MatchImage (measure[0].t, measure[0].photcode, measure[0].imageID);
     1180      image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
    11811181      if (image == NULL) break;
    11821182      RD_to_XY (&x, &y, ra, dec, &image[0].coords);
     
    11911191      ra  = average[0].R - measure[0].dR / 3600.0;
    11921192      dec = average[0].D - measure[0].dD / 3600.0;
    1193       image = MatchImage (measure[0].t, measure[0].photcode, measure[0].imageID);
     1193      image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
    11941194      if (image == NULL) break;
    11951195      RD_to_XY (&x, &y, ra, dec, &image[0].coords);
  • trunk/Ohana/src/opihi/dvo/region_list.c

    r25757 r31635  
    55   information carried back up */
    66
    7 static char *CATDIR  = NULL;
    87static SkyTable *sky = NULL;
    98
    109int SetCATDIR (char *path, int verbose) {
    1110
     11  char *CATDIR  = NULL;
    1212  char *newpath;
    1313  char catdir_config[256];
     
    2424  }
    2525
    26   if (CATDIR != NULL) free (CATDIR);
    27   CATDIR = strcreate (newpath);
     26  CATDIR = newpath;
     27  // save the new value in libdvo
     28  dvo_set_catdir(CATDIR);
    2829
    2930  if (VarConfig ("GSCFILE",  "%s", gscfile) == NULL) gscfile[0] = 0;
     
    5152
    5253char *GetCATDIR () {
     54  char *CATDIR = dvo_get_catdir();
     55
    5356  if (CATDIR == NULL) {
    54     SetCATDIR (NULL, FALSE);
     57    if (SetCATDIR (NULL, FALSE)) {
     58        CATDIR = dvo_get_catdir();
     59    }
    5560  }
    5661  return (CATDIR);
     
    136141  if (selection->name != NULL) {
    137142    char filename[256];
     143    char *CATDIR = dvo_get_catdir();
    138144
    139145    ALLOCATE (skylist, SkyList, 1);
     
    158164    Graphdata graphsky;
    159165
    160     if (!GetGraphData (&graphsky, NULL, NULL)) {
     166    if (!GetGraphdata (&graphsky, NULL, NULL)) {
    161167      gprint (GP_ERR, "region display not available\n");
    162168      return (NULL);
     
    201207  ALLOCATE (skylist[0].filename, char *, NREGIONS);
    202208  skylist[0].ownElements = TRUE; // free these elements when freeing the list
     209
     210  char *CATDIR = dvo_get_catdir();
    203211
    204212  while (fscanf (f, "%s", filename) != EOF) {
  • trunk/Ohana/src/opihi/dvo/skycoverage.c

    r31160 r31635  
    186186  PutCoords (&coords, &buf[0].header);
    187187
    188   image = LoadImages(&Nimage);
     188  image = LoadImagesDVO(&Nimage);
    189189  if (image == NULL) {
    190190      return (FALSE);
     
    266266    }
    267267  }
    268   FreeImages(image);
     268  FreeImagesDVO(image);
    269269  return (TRUE);
    270270}
  • trunk/Ohana/src/opihi/dvo/skyregion.c

    r27610 r31635  
    11# include "dvoshell.h"
    22
     3#ifdef NO_MOVED_TO_DVO
    34static double RAs = 0.0;
    45static double RAe = 0.0;
    56static double DECs = 0.0;
    67static double DECe = 0.0;
     8#endif
    79
    810// define the sky region for which extractions are limited
     
    1012 
    1113  if (argc == 1) {
     14    double RAs, RAe, DECs, DECe;
     15    get_skyregion(&RAs, &RAe, &DECs, &DECe);
     16
    1217    gprint (GP_ERR, "current skyregion: %f - %f : %f - %f\n", RAs, RAe, DECs, DECe);
    1318    gprint (GP_ERR, "USAGE:  skyregion (min RA) (max RA) (min DEC) (max DEC)\n");
     
    2429  return (TRUE);
    2530}
    26 
     31#ifdef NOT_MOVED_TO_LIBDVO
    2732int get_skyregion (double *Rs, double *Re, double *Ds, double *De) {
    2833
     
    4449  return TRUE;
    4550}
     51#endif
    4652
    4753/* find region which overlaps c at given depth (-1 : populated ) */
  • trunk/Ohana/src/opihi/dvo/subpix.c

    r29540 r31635  
    114114
    115115  /* load all images, extract those touching Ra, Dec */
    116   if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     116  if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE);
    117117  BuildChipMatch (image, Nimage);
    118118
     
    150150  SkyListFree (skylist);
    151151
    152   FreeImages(image);
     152  FreeImagesDVO(image);
    153153  return (TRUE);
    154154}
  • trunk/Ohana/src/opihi/include/astro.h

    r21153 r31635  
    2727} CoordTransform;
    2828
     29#ifndef MOVED_TO_LIBDVO
    2930typedef enum {COORD_NONE, COORD_CELESTIAL, COORD_GALACTIC, COORD_ECLIPTIC} CoordTransformSystem;
     31#endif
    3032
    3133CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output);
  • trunk/Ohana/src/opihi/include/dvomath.h

    r20936 r31635  
    77
    88# define NCHARS 256
    9 # define opihi_flt double
    10 # define opihi_int int
     9// # define opihi_flt double
     10// # define opihi_int int
    1111// NOTE: if opihi_int is changed to unsigned, all subtraction and negation operations
    1212// need to result in a float value (or 3 - 5 will yield the unexpected value 2^32 - 2)
     
    2626enum {ANYVECTOR, NEWVECTOR, OLDVECTOR};
    2727enum {ANYBUFFER, NEWBUFFER, OLDBUFFER};
     28#ifdef NOT_MOVED_TO_LIBDVO
    2829enum {OPIHI_FLT, OPIHI_INT};
     30#endif
    2931
    3032typedef struct {                        /* representation of a variable (0-D) */
     
    6466/* math functions */
    6567char         *dvomath               PROTO((int argc, char **argv, int *size, int maxsize));
    66 char        **isolate_elements      PROTO((int argc, char **argv, int *nstack));
     68// MOVED to libohana
     69// char        **isolate_elements      PROTO((int argc, char **argv, int *nstack));
    6770StackVar     *convert_to_RPN        PROTO((int argc, char **argv, int *nstack));
    6871int           check_stack           PROTO((StackVar *stack, int Nstack, int validsize));
     
    144147/* why are these in here? */
    145148int           gfits_copy_matrix_info (Matrix *matrix1, Matrix *matrix2);
     149#ifndef MOVED_TO_LIBDVO
    146150int           GetTimeFormat         PROTO((time_t *TimeReference, int *TimeFormat));
     151#endif
    147152
    148153# endif
  • trunk/Ohana/src/opihi/include/dvoshell.h

    r31160 r31635  
    22# include "basic.h"
    33# include "astro.h"
     4# include "dvo.h"
    45
    56# ifndef DVOSHELL_H
    67# define DVOSHELL_H
    78
     9#ifdef NOT_MOVED_TO_LIBDVO
    810typedef enum {
    911  DB_STACK_NONE  = 0,
     
    232234};
    233235
    234 
    235236enum {DVO_TABLE_AVERAGE, DVO_TABLE_MEASURE, DVO_TABLE_IMAGE};
    236237enum {DVO_DB_CMDLINE_ERROR, DVO_DB_CMDLINE_IS_END, DVO_DB_CMDLINE_IS_WHERE, DVO_DB_CMDLINE_IS_MATCH};
     
    268269  opihi_int Int;
    269270} dbValue;
     271
     272#endif // notdef MOVED_TO_LIBDVO
    270273
    271274typedef struct {
     
    313316void          FreeDVO               PROTO((void));
    314317int           InitPhotcodes         PROTO((void));
     318#ifdef NOT_MOVED_TO_DVO
    315319Image        *LoadImages            PROTO((off_t *Nimage));
    316320void          FreeImages            PROTO((Image *images));
    317321Image        *MatchImage            PROTO((unsigned int time, short int source, unsigned int imageID));
     322#endif
    318323Coords       *MatchMosaic           PROTO((unsigned int time, short int source));
    319324int           Quality               PROTO((Measure *measure, int IsDophot));
     
    347352CMPstars     *cmpReadText           PROTO((FILE *f, off_t *nstars));
    348353int           RD_to_XYpic           PROTO((double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside));
    349 
     354int wordhash (char *word);
     355
     356#ifdef NOT_MOVED_TO_LIBDVO
    350357// dvo DB field functions
    351358dbField     *dbCmdlineFields        PROTO((int argc, char **argv, int table, int *last, int *nfields));
     
    361368dbStack     *dbBinary               PROTO((dbStack *V1, dbStack *V2, char *op, dbValue *fields));
    362369dbStack     *dbUnary                PROTO((dbStack *V1, char *op, dbValue *fields));
     370#endif
    363371
    364372int          GetMagMode             PROTO((char *string));
     
    368376int          ParseImageField        PROTO((dbField *field, char *fieldName));
    369377
    370 dbValue      dbExtractAverages      PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field));
    371378dbValue      dbExtractMeasures      PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field));
    372379dbValue      dbExtractImages        PROTO((Image *image, off_t Nimage, off_t N, dbField *field));
     380#ifdef NOT_MOVED_TO_LIBDVO
     381dbValue      dbExtractAverages      PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field));
    373382
    374383void         dbInitField            PROTO((dbField *field));
    375384void         dbFreeFields           PROTO((dbField *fields, int Nfields));
    376385int          dbAstroRegionLimits    PROTO((dbStack **stack, int *nstack, SkyRegionSelection *selection, int table));
    377 char        *strfloat               PROTO((float value));
    378 
    379386int get_skyregion (double *Rs, double *Re, double *Ds, double *De);
    380387int set_skyregion (double Rs, double Re, double Ds, double De);
    381388void FreeImageSelection (void);
     389char        *strfloat               PROTO((float value));
     390
    382391
    383392void FreeSkyRegionSelection (SkyRegionSelection *selection);
    384 int wordhash (char *word);
     393
    385394
    386395int dbExtractMeasuresInitTransform (CoordTransformSystem target);
     
    395404int dbExtractImagesInit (void);
    396405int dbExtractImagesReset (void);
     406#endif // NOT_MOVED_TO_LIBDVO
    397407
    398408# endif
  • trunk/Ohana/src/opihi/include/shell.h

    r30614 r31635  
    1212# define MACRO_NAME(s) MACRO_STRING(s)
    1313
     14typedef enum {GP_FILE, GP_BUFF} gpMode;
     15#ifdef NOT_MOVED_TO_LIBOHANA
    1416/* enums used by gprint functions */
    15 typedef enum {GP_FILE, GP_BUFF} gpMode;
    1617typedef enum {GP_LOG, GP_ERR} gpDest;
     18#endif
    1719typedef enum {OPIHI_VERBOSE_OFF, OPIHI_VERBOSE_ON, OPIHI_VERBOSE_ERROR} OpihiVerboseMode;
    1820
     
    122124char         *VarConfigEntry            PROTO((char *keyword, char *mode, int entry, void *ptr));
    123125
     126#ifndef NOT_MOVED_TO_DVO
    124127int           init_error                PROTO((void));
    125128int           push_error                PROTO((char *line));
    126129int           print_error               PROTO((void));
     130#endif
     131
    127132void          handle_interrupt          PROTO((int));
    128133char        **command_completer         PROTO((const char *, int, int));
     
    168173FILE         *gprintGetFile             PROTO((gpDest dest));
    169174char         *gprintGetName             PROTO((gpDest dest));
     175#ifdef NOT_MOVED_TO_LIBOHANA
    170176int           gprint                    PROTO((gpDest dest, char *format, ...)) OHANA_FORMAT(printf, 2, 3);
     177#endif
    171178int           gwrite                    PROTO((char *buffer, int size, int N, gpDest dest));
    172179int           gprint_syserror           PROTO((gpDest dest, int myError, char *format, ...)) OHANA_FORMAT(printf, 3, 4);
  • trunk/Ohana/src/opihi/lib.data/Makefile

    r29540 r31635  
    2121$(SDIR)/svdcmp.$(ARCH).o                \
    2222$(SDIR)/svdcmp_bond_new.$(ARCH).o               \
    23 $(SDIR)/convert.$(ARCH).o               \
    2423$(SDIR)/bracket.$(ARCH).o               \
    2524$(SDIR)/spline.$(ARCH).o                \
     
    4847$(INC)/shell.h \
    4948$(INC)/dvomath.h \
    50 $(INC)/convert.h \
    5149$(INC)/display.h
    5250
  • trunk/Ohana/src/opihi/lib.data/open_kapa.c

    r18326 r31635  
    162162
    163163/* return pointers for given kapa, don't set or open */
    164 int GetGraphData (Graphdata *data, int *fd, char *name) {
     164int GetGraphdata (Graphdata *data, int *fd, char *name) {
    165165
    166166  int entry;
  • trunk/Ohana/src/opihi/lib.shell/Makefile

    r16889 r31635  
    2828$(SDIR)/convert_to_RPN.$(ARCH).o        \
    2929$(SDIR)/dvomath.$(ARCH).o               \
    30 $(SDIR)/errors.$(ARCH).o                \
    3130$(SDIR)/evaluate_stack.$(ARCH).o        \
    3231$(SDIR)/exec_loop.$(ARCH).o             \
     
    3534$(SDIR)/gprint.$(ARCH).o                \
    3635$(SDIR)/interrupt.$(ARCH).o             \
    37 $(SDIR)/isolate_elements.$(ARCH).o      \
    3836$(SDIR)/macro_create.$(ARCH).o          \
    3937$(SDIR)/macro_delete.$(ARCH).o          \
     
    6159$(INC)/shell.h \
    6260$(INC)/dvomath.h \
    63 $(INC)/convert.h \
    6461$(INC)/display.h
    6562
  • trunk/Ohana/src/opihi/lib.shell/dvomath.c

    r20936 r31635  
    11# include "opihi.h"
     2# include "dvo.h"
    23
    34/* return value on success is temp vector/buffer name or scalar value return value on error is NULL, all
  • trunk/Ohana/src/photdbc/include/photdbc.h

    r30616 r31635  
    111111void          unique_measures (Catalog *catalog);
    112112void          wcatalog (Catalog *catalog);
    113 int           make_subcatalog (Catalog *subcatalog, Catalog *catalog);
     113int           make_subcatalog (Catalog *subcatalog, Catalog *catalog, SkyRegion *region);
    114114void          check_directory (char *basefile);
    115115
  • trunk/Ohana/src/photdbc/src/make_subcatalog.c

    r31450 r31635  
    33// copy a catalog to a new subcatalog, applying some filters
    44// the supplied subcatalog must already be locked, opened, and created
    5 int make_subcatalog (Catalog *subcatalog, Catalog *catalog) {
     5int make_subcatalog (Catalog *subcatalog, Catalog *catalog, SkyRegion *region) {
    66 
    77  int found;
     
    3636  for (i = 0; i < catalog[0].Naverage; i++) {
    3737    // perform exclusions based on average properties
     38
     39    // XXX: temporary check make sure that this object belongs in this region
     40    // used to fix the pole area in the reference catalog
     41    {
     42        double R = catalog[0].average[i].R;
     43        double D = catalog[0].average[i].D;
     44        if (R <= region->Rmin) continue;
     45        if (R >  region->Rmax) continue;
     46        if (D <= region->Dmin) continue;
     47        if (D >  region->Dmax) continue;
     48    }
    3849
    3950    // exclude stars with too few measurements
  • trunk/Ohana/src/photdbc/src/photdbc.c

    r28331 r31635  
    6565
    6666    /* limit number of measures based on selections */
    67     make_subcatalog (&outcatalog, &incatalog);
     67    make_subcatalog (&outcatalog, &incatalog, skylist[0].regions[i]);
    6868       
    6969    // XXX add other filters here:
  • trunk/Ohana/src/relastro/Makefile

    r29001 r31635  
    6161$(SRC)/high_speed_catalogs.$(ARCH).o  \
    6262$(SRC)/high_speed_objects.$(ARCH).o  \
     63$(SRC)/high_speed_utils.$(ARCH).o  \
    6364$(SRC)/relastroVisual.$(ARCH).o
    6465
  • trunk/Ohana/src/relastro/include/relastro.h

    r31160 r31635  
    131131int           NphotcodesGroupA,  NphotcodesGroupB;
    132132PhotCode     **photcodesGroupA, **photcodesGroupB;
     133char          WHERE_A[10000],          WHERE_B[10000];
     134SkyRegionSelection SELECTION;
    133135
    134136int AreaSelect;
     
    361363
    362364int GetScatterRawRef(float *dLsig, float *dMsig, float *dRsig, int *nKeep, StarData *raw, StarData *ref, int Nstars, float SigmaLimit);
     365
     366int initializeConstraints();
     367int applyConstraintsA();
     368int applyConstraintsB();
     369void setupAreaSelection(SkyRegion *region);
     370
  • trunk/Ohana/src/relastro/src/ConfigInit.c

    r30616 r31635  
    4848  ScanConfig(config, "PHOTCODE_FILE",          "%s",  0, MasterPhotcodeFile);
    4949
     50  // Defaults for WHERE_A are established in db_utils.c: intializeConstraints
     51  ScanConfig(config, "WHERE_A",                "%s",  0, WHERE_A);
     52  ScanConfig(config, "WHERE_B",                "%s",  0, WHERE_B);
     53
    5054  sprintf (ImageCat, "%s/Images.dat", CATDIR);
    5155
  • trunk/Ohana/src/relastro/src/args.c

    r31160 r31635  
    307307  fprintf (stderr, "  -update-chips\n");
    308308  fprintf (stderr, "  -update-mosaics\n");
    309   fprintf (stderr, "  -high-speed (code[,code,code]) (code[,code,code]) (radius)\n\n");
     309  fprintf (stderr, "  -high-speed (code[,code,code]) (code[,code,code]) (radius) (whereA) (whereB) (output catdir)\n\n");
    310310  fprintf (stderr, "  additional options: \n");
    311311  fprintf (stderr, "  -time (start)(stop)\n");
  • trunk/Ohana/src/relastro/src/high_speed_catalogs.c

    r31602 r31635  
    99  Catalog catalog;
    1010
     11  // tell libdvo the CATDIR
     12  dvo_set_catdir(CATDIR);
     13
    1114  // load the current sky table (layout of all SkyRegions)
    1215  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, FALSE, SKY_DEPTH, VERBOSE);
     
    1619  if (UserCatalog) {
    1720    skylist = SkyRegionByPoint (sky, -1, UserCatalogRA, UserCatalogDEC);
     21    setupAreaSelection(skylist->regions[0]);
    1822  } else {
    1923    skylist = SkyListByPatch (sky, -1, &UserPatch);
     24    setupAreaSelection(&UserPatch);
    2025  }
     26
     27  initializeConstraints();
    2128
    2229  // load data from each region file, only use bright stars
  • trunk/Ohana/src/relastro/src/high_speed_objects.c

    r31160 r31635  
    44# define NEXT_J { j++; continue; }
    55
    6 // XXX these were used to spot-check specific objects
    7 # define REF_RA1 192.455781
    8 # define REF_DEC1 2.563102
    9 # define REF_RA2 192.444302113
    10 # define REF_DEC2 2.5786559112
    116int high_speed_objects (SkyRegion *region, Catalog *catalog) {
    127
     
    149
    1510  off_t i, j, m, J, ni, nj, *N1, Nslow, Ninvalid, NgroupA, NgroupB, NgroupAbad, NgroupBbad,l,i1,Noff,Nmeasure,Naverage, NAVERAGE, NMEASURE;
    16   int *slowMoving, *groupA, *groupB, status, foundA, foundB, Nmatch, valid,Nmatchmeas,Nepoch,nv[2],Nmatchmeasobj;
     11  int *slowMoving, *groupA, *groupB, status, Nmatch, Nmatchmeas,Nepoch,nv[2],Nmatchmeasobj;
     12  int foundA, foundB;
    1713  double *X1, *Y1;
    1814  double dX, dY, dR, RADIUS2;
     
    2016  Catalog catalog1;
    2117
    22   int zcode, zNsec, ycode, yNsec, jcode, jNsec, hcode, hNsec, kcode, kNsec, USNO_R, USNO_N, Nsecfilt;
     18  int Nsecfilt;
    2319  char filename[1024];
    2420  Noff = strlen(CATDIR);
    25   sprintf (filename, "%s/%s", HIGH_SPEED_DIR, &catalog[0].filename[Noff]);
    26   printf("%s\n",filename);
     21  sprintf (filename, "%s%s", HIGH_SPEED_DIR, &catalog[0].filename[Noff]);
     22  fprintf(stderr, "%s\n",filename);
    2723  dvo_catalog_init(&catalog1, TRUE); /*initialise new catalogue*/
    2824  catalog1.filename = strcreate(filename);
     
    3329  Naverage=catalog[0].Naverage;
    3430  Nmeasure=catalog[0].Nmeasure;
    35   // ALLOCATE (catalog1.average, Average,Naverage);
    36   // ALLOCATE (catalog1.measure, Measure,Nmeasure);
    37   // ALLOCATE(catalog1.secfilt, SecFilt,catalog[0].Naverage*Nsecfilt);
    3831  catalog1.filename = filename; // based on the input name, need to keep everything below the catdir portion
    3932  catalog1.Nsecfilt  = Nsecfilt;
     
    5649  REALLOCATE(catalog1.secfilt, SecFilt, NAVERAGE*Nsecfilt);
    5750
    58   ycode = GetPhotcodeCodebyName("y");
    59   yNsec = GetPhotcodeNsec(ycode);
    60  
    61   zcode = GetPhotcodeCodebyName("z");
    62   zNsec = GetPhotcodeNsec(zcode);
    63  
    64   jcode = GetPhotcodeCodebyName("J");
    65   jNsec = GetPhotcodeNsec(jcode);
    66  
    67   hcode = GetPhotcodeCodebyName("H");
    68   hNsec = GetPhotcodeNsec(hcode);
    69  
    70   kcode = GetPhotcodeCodebyName("K");
    71   kNsec = GetPhotcodeNsec(kcode);
    72  
    73   USNO_R = GetPhotcodeCodebyName("USNO_RED");
    74   USNO_N = GetPhotcodeCodebyName("USNO_N");
    75 
    7651  // high-speed between different surveys (easier case):
    7752  // we have two sets of photcodes (A) and (B) and are looking for objects
     
    9469  memset (groupB, 0, catalog[0].Naverage*sizeof(int));
    9570
    96   fprintf (stderr, "checking "OFF_T_FMT" objects\n",  catalog[0].Naverage);
     71  if (VERBOSE) fprintf (stderr, "checking "OFF_T_FMT" objects\n",  catalog[0].Naverage);
    9772  Nslow = 0;
    9873  Ninvalid = 0;
     
    10075  NgroupBbad = 0;
    10176
    102   fprintf (stdout, "#      RA_A  DEC_A              RA_B  DEC_B      :     pmx     pmy      dR  dt:    z      dz       y      dy       J      dJ       H      dH       K      dK\n");
    103   //................270.2346670  20.2471540  270.2170434  20.2717396 :  -59.11   88.78   106.66 :   0.000  0.000   19.582  0.112   16.041  0.110   15.388  0.098   14.858  0.001
    104 
    10577  // mark (exclude) objects with both sets of target photcodes
    10678  for (i = 0; i < catalog[0].Naverage; i++) {
    107 
    108     // if (i % 100 == 0) fprintf (stderr, ".");
    109 
    110     // radius = hypot((REF_DEC1 - catalog[0].average[i].D), (REF_RA1 - catalog[0].average[i].R));
    111     // if (radius < 0.0001) {
    112     //   fprintf (stderr, "found it\n");
    113     // }
    114     // radius = hypot((REF_DEC2 - catalog[0].average[i].D), (REF_RA2 - catalog[0].average[i].R));
    115     // if (radius < 0.0001) {
    116     //   fprintf (stderr, "found it\n");
    117     // }
    118 
    11979    // do any of the measures for this object match group A?
    12080    m = catalog[0].average[i].measureOffset;
     
    13292    for (j = 0; !foundB && (j < catalog[0].average[i].Nmeasure); j++, m++) {
    13393         
    134 
    13594      if (MeasMatchesPhotcode(&catalog[0].measure[m], photcodesGroupB, NphotcodesGroupB)) {
    13695        foundB = TRUE;
     
    13897    }
    13998
     99    // object found in both - mark as slow moving
    140100    if (foundA && foundB) {
    141101      slowMoving[i] = TRUE;
     
    144104    }
    145105
    146     // additional constraints:
    147     // * group A : require
    148 
    149     // 2MASS detections:
     106    // Apply additional constraints:
    150107    if (foundA && !foundB) {
    151       // average-based tests:
    152          
    153 
    154       valid = TRUE;
    155       valid &= ((catalog[0].average[i].flags & 0x02000000) == 0);
    156       valid &= ((catalog[0].average[i].flags & 0x08000000)  > 0);
    157       valid &= ((catalog[0].secfilt[i*Nsecfilt + yNsec].M < 1.0)||(isnan(catalog[0].secfilt[i*Nsecfilt + yNsec].M)));
    158       valid &= (((catalog[0].secfilt[i*Nsecfilt + zNsec].M < 1.0))||(isnan(catalog[0].secfilt[i*Nsecfilt + zNsec].M)));
    159       // XXX color restrictions are applied in the pair-wise matching below
    160      
    161       // measure-based tests:
    162       /*      m = catalog[0].average[i].measureOffset;
    163       for (j = 0; valid && (j < catalog[0].average[i].Nmeasure); j++, m++) {
    164         if (catalog[0].measure[m].photcode == USNO_R) {
    165           valid &= ((catalog[0].measure[m].M > 20.0) || isnan(catalog[0].measure[m].M));
    166         }
    167         if (catalog[0].measure[m].photcode == USNO_N) {
    168           valid &= ((catalog[0].measure[m].M > 18.0) || isnan(catalog[0].measure[m].M));
    169         }
    170         }*/
    171 
    172       // ((objflags & 524288) == 524288) &&
    173       // ((objflags & 262144) == 0) &&
    174       // (z<1.0) &&
    175       // (y<1.0) &&
    176       // ((yp[$i]-J)>1.25) && ((yp[$i]-J)<5.0) &&
    177       // ((USNO_RED<1.0)||(USNO_RED>20.0)) &&
    178       // ((USNO_N>18.0)||(USNO_N<1.0))
    179 
    180       if (valid) {
    181         groupA[i] = TRUE;
    182         NgroupA ++;
    183         continue;
    184       } else {
    185         NgroupAbad ++;
    186         // fprintf (stderr, "skip "OFF_T_FMT" (group A)\n",  i);
    187       }
    188     }
    189 
    190     // PS1 detections:
    191     if (foundB && !foundA) {
    192 
    193       // average-based tests:
    194       valid = TRUE;
    195       valid &= ((catalog[0].average[i].flags & 0x01000000) == 0);
    196 
    197       valid &= ((catalog[0].average[i].flags & 0x04000000)  > 0);
    198 
    199       valid &= ((catalog[0].secfilt[i*Nsecfilt + jNsec].M < 1.0)||(isnan(catalog[0].secfilt[i*Nsecfilt + jNsec].M)));
    200       valid &= ((catalog[0].secfilt[i*Nsecfilt + yNsec].Nused > 1)||(catalog[0].secfilt[i*Nsecfilt + zNsec].Nused > 1));
    201       valid &= ((catalog[0].secfilt[i*Nsecfilt + yNsec].dM < 0.2)||(catalog[0].secfilt[i*Nsecfilt + zNsec].dM < 0.2));
    202 
    203       /*if ((catalog[0].secfilt[i*Nsecfilt + zNsec].M < 1.0) || (catalog[0].secfilt[i*Nsecfilt + zNsec].Nused == 1)) {
    204         valid &= TRUE;
    205       } else {
    206         valid &= ((catalog[0].secfilt[i*Nsecfilt + zNsec].M - catalog[0].secfilt[i*Nsecfilt + yNsec].M) > 0.2);
    207         }*/
    208 
    209       // measure-based tests:
    210       /*m = catalog[0].average[i].measureOffset;
    211       for (j = 0; valid && (j < catalog[0].average[i].Nmeasure); j++, m++) {
    212         if (catalog[0].measure[m].photcode == USNO_R) {
    213           valid &= ((catalog[0].measure[m].M > 20.0) || isnan(catalog[0].measure[m].M));
    214         }
    215         if (catalog[0].measure[m].photcode == USNO_N) {
    216           valid &= ((catalog[0].measure[m].M > 18.5) || isnan(catalog[0].measure[m].M));
    217         }
    218         }*/
    219 
    220       // (abs(glat)>15.0) &&
    221       // ((objflags & 65536) == 0) &&
    222       // ((objflags & 131072) == 131072) &&
    223       // (J<1.0) &&
    224       // (y:nphot>1) &&
    225       // (y:err<0.2) &&
    226       // ((USNO_RED>20.0)||(USNO_RED<1.0)) &&
    227       // ((USNO_N>18.5)||(USNO_N<1.0)) &&
    228       // ((z<1.0)||(z:nphot == 1)||((z:nphot>1)&&((z-y)>0.2)))
    229 
    230       if (valid) {
    231         groupB[i] = TRUE;
    232         NgroupB ++;
    233         continue;
    234       } else {
    235         NgroupBbad ++;
    236         // fprintf (stderr, "skip "OFF_T_FMT" (group B)\n",  i);
    237       }
    238     }
    239 
    240     // this object does not have a detection from either groupA or groupB -- skip as if slow
     108        if (applyConstraintsA(catalog, i)) {
     109            groupA[i] = TRUE;
     110            NgroupA++;
     111            continue;
     112        } else {
     113            NgroupAbad ++;
     114            // fprintf (stderr, "skip "OFF_T_FMT" (group A)\n",  i);
     115        }
     116
     117    } else if (foundB && !foundA) {
     118
     119        if (applyConstraintsB(catalog, i)) {
     120            groupB[i] = TRUE;
     121            NgroupB++;
     122            continue;
     123        } else {
     124            NgroupBbad++;
     125        }
     126    }
     127    // this object does not have a detection matching the contraints from either gorupA or groupB -- skip as if slow
    241128    slowMoving[i] = TRUE;
    242129    Ninvalid ++;
    243130  }
     131
    244132  fprintf (stderr, OFF_T_FMT" slow, "OFF_T_FMT" invalid, ("OFF_T_FMT" group A, "OFF_T_FMT" group B), "OFF_T_FMT" total objects; "OFF_T_FMT" in group A, "OFF_T_FMT" in group B\n",  Nslow,  Ninvalid, NgroupAbad, NgroupBbad, catalog[0].Naverage,  NgroupA,  NgroupB);
    245133   
     
    284172    ni = N1[i];
    285173    nj = N1[j];
    286     // if (ni == 131030) {
    287     //   fprintf (stderr, "got 2mass\n");
    288     // }
    289     // if (nj == 53581) {
    290     //   fprintf (stderr, "got ps1\n");
    291     // }
    292174
    293175    if (slowMoving[ni]) NEXT_I;
     
    319201      dR = dX*dX + dY*dY;
    320202      if (dR > RADIUS2) continue;
    321 
    322       // y_groupA - J_groupB
    323 
    324       /*      yJ = catalog[0].secfilt[nj*Nsecfilt + yNsec].M - catalog[0].secfilt[ni*Nsecfilt + jNsec].M;
    325       if (yJ < 1.25) continue;
    326       if (yJ > 5.0) continue;*/
    327203
    328204      /*** a match is found (just print it for the moment) ***/
     
    330206      Nepoch=2;
    331207      FIT_MODE = FIT_PM_ONLY;
    332 /*nv=(int *)malloc(Nepoch*sizeof(int));*/
    333208      nv[0]=ni; /*THESE SHOULD BE CHANGED FOR MULTIPLE EPOCHS AS SHOULD nv*/
    334209      nv[1]=nj;
     
    363238        REALLOCATE(catalog1.secfilt, SecFilt, NAVERAGE*Nsecfilt);
    364239      }
    365       // for the moment, just write the matches to stdout:
    366       //float pmx = -dX; // proper-motion displacement in ra  direction (B - A) [arcsec]
    367       //float pmy = -dY; // proper-motion displacement in dec direction (B - A) [arcsec]
    368       /*           fprintf (stdout, "%11.7f %11.7f  %11.7f %11.7f : %7.2f %7.2f  %7.2f: %7.3f %6.3f  %7.3f %6.3f  %7.3f %6.3f  %7.3f %6.3f  %7.3f %6.3f\n",
    369                catalog[0].average[ni].R, catalog[0].average[ni].D,
    370                catalog[0].average[nj].R, catalog[0].average[nj].D,
    371                dX, dY, sqrt(dR),
    372                catalog[0].secfilt[nj*Nsecfilt + zNsec].M,
    373                catalog[0].secfilt[nj*Nsecfilt + zNsec].dM,
    374                catalog[0].secfilt[nj*Nsecfilt + yNsec].M,
    375                catalog[0].secfilt[nj*Nsecfilt + yNsec].dM,
    376                catalog[0].secfilt[ni*Nsecfilt + jNsec].M,
    377                catalog[0].secfilt[ni*Nsecfilt + jNsec].dM,
    378                catalog[0].secfilt[ni*Nsecfilt + hNsec].M,
    379                catalog[0].secfilt[ni*Nsecfilt + hNsec].dM,
    380                catalog[0].secfilt[ni*Nsecfilt + kNsec].M,
    381                catalog[0].secfilt[ni*Nsecfilt + kNsec].dM);*/
    382240    }
    383241    i++;
  • trunk/Ohana/src/relastro/src/initialize.c

    r29001 r31635  
    6363
    6464    /* parse the comma-separated list of photcodesGroupA */
     65    fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST);
    6566    list = PHOTCODE_A_LIST;
    6667    while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
    6768      list = NULL; // pass NULL on successive strtok_r calls
    68       fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST);
    6969      fprintf (stderr, "codename: %s\n", codename);
    7070      if ((photcodesGroupA[NphotcodesGroupA] = GetPhotcodebyName (codename)) == NULL) {
     
    8383    ALLOCATE (photcodesGroupB, PhotCode *, NPHOTCODES);
    8484
     85    fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST);
    8586    /* parse the comma-separated list of photcodesGroupB */
    8687    list = PHOTCODE_B_LIST;
    8788    while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
    8889      list = NULL; // pass NULL on successive strtok_r calls
    89       fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST);
    9090      fprintf (stderr, "codename: %s\n", codename);
    9191      if ((photcodesGroupB[NphotcodesGroupB] = GetPhotcodebyName (codename)) == NULL) {
  • trunk/Ohana/src/relastro/src/relastroVisual.c

    r30616 r31635  
    33 */
    44
    5 #include "kapa.h"
    65#include "relastro.h"
    76
  • trunk/Ohana/src/uniphot/include/uniphot.h

    r31160 r31635  
    8383  int style, ptype, ltype, etype, color;
    8484  double lweight, size;
    85 } Graphdata;
     85} UPGraphdata;
    8686
    8787/***** prototypes ****/
    8888void          ConfigInit          PROTO((int *argc, char **argv));
    89 void          DonePlotting        PROTO((Graphdata *graphmode, int N));
    90 void          JpegPlot            PROTO((Graphdata *graphmode, int N, char *filename));
    91 void          PSPlot              PROTO((Graphdata *graphmode, int N, char *filename));
     89void          DonePlotting        PROTO((UPGraphdata *graphmode, int N));
     90void          JpegPlot            PROTO((UPGraphdata *graphmode, int N, char *filename));
     91void          PSPlot              PROTO((UPGraphdata *graphmode, int N, char *filename));
    9292void          PlotLabel           PROTO((char *string, int N));
    9393void          PlotVector          PROTO((int Npts, double *vect, int mode, int N));
    94 void          PrepPlotting        PROTO((int Npts, Graphdata *graphmode, int N));
     94void          PrepPlotting        PROTO((int Npts, UPGraphdata *graphmode, int N));
    9595void          XDead               PROTO((void));
    9696int           args_uniphot        PROTO((int argc, char **argv));
  • trunk/Ohana/src/uniphot/src/plotstuff.c

    r13479 r31635  
    2727}
    2828
    29 void DonePlotting (Graphdata *graphmode, int N) {
     29void DonePlotting (UPGraphdata *graphmode, int N) {
    3030
    3131  if (Xgraph[N] == 0) return;
     
    3434}
    3535
    36 void PrepPlotting (int Npts, Graphdata *graphmode, int N) {
     36void PrepPlotting (int Npts, UPGraphdata *graphmode, int N) {
    3737
    3838  active = N;
     
    7575}
    7676
    77 void JpegPlot (Graphdata *graphmode, int N, char *filename) {
     77void JpegPlot (UPGraphdata *graphmode, int N, char *filename) {
    7878
    7979  if (Xgraph[N] == 0) return;
     
    8383}
    8484
    85 void PSPlot (Graphdata *graphmode, int N, char *filename) {
     85void PSPlot (UPGraphdata *graphmode, int N, char *filename) {
    8686
    8787  if (Xgraph[N] == 0) return;
     
    9797   int style, ptype, ltype, etype, color;
    9898   double lweight, size;
    99    } Graphdata;
    100    Graphdata graphdata;
     99   } UPGraphdata;
     100   UPGraphdata graphdata;
    101101   
    102102   graphdata.xmin = -200;
Note: See TracChangeset for help on using the changeset viewer.