IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15426


Ignore:
Timestamp:
Oct 31, 2007, 3:02:19 PM (19 years ago)
Author:
eugene
Message:

work on absphot to layout basic code

Location:
branches/eam_branch_20071015/Ohana/src/absphot
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071015/Ohana/src/absphot/Makefile

    r15354 r15426  
    2121
    2222ABSPHOT = \
     23$(SRC)/absphot.$(ARCH).o         \
     24$(SRC)/initialize.$(ARCH).o      \
    2325$(SRC)/ConfigInit.$(ARCH).o      \
    24 $(SRC)/GridOps.$(ARCH).o         \
    25 $(SRC)/ImageOps.$(ARCH).o        \
    26 $(SRC)/MosaicOps.$(ARCH).o       \
    27 $(SRC)/SetSignals.$(ARCH).o      \
    28 $(SRC)/Shutdown.$(ARCH).o        \
    29 $(SRC)/StarOps.$(ARCH).o         \
    3026$(SRC)/args.$(ARCH).o            \
    31 $(SRC)/bcatalog.$(ARCH).o        \
    32 $(SRC)/global_stats.$(ARCH).o    \
    33 $(SRC)/initialize.$(ARCH).o      \
     27$(SRC)/find_regions.$(ARCH).o    \
     28$(SRC)/load_catalogs.$(ARCH).o   \
     29$(SRC)/subset_catalog.$(ARCH).o  \
     30$(SRC)/fit_trend.$(ARCH).o       \
    3431$(SRC)/liststats.$(ARCH).o       \
    35 $(SRC)/load_catalogs.$(ARCH).o   \
    36 $(SRC)/load_images.$(ARCH).o     \
    37 $(SRC)/plot_scatter.$(ARCH).o    \
    38 $(SRC)/plotstuff.$(ARCH).o       \
    39 $(SRC)/reload_catalogs.$(ARCH).o \
    40 $(SRC)/absphot.$(ARCH).o         \
    41 $(SRC)/select_images.$(ARCH).o   \
    42 $(SRC)/setExclusions.$(ARCH).o   \
    43 $(SRC)/setMrelFinal.$(ARCH).o    \
    44 $(SRC)/sort.$(ARCH).o            \
    45 $(SRC)/write_coords.$(ARCH).o
     32$(SRC)/sort.$(ARCH).o            \
     33$(SRC)/plotstuff.$(ARCH).o
     34
     35# $(SRC)/plot_residuals.$(ARCH).o        \
    4636
    4737$(ABSPHOT): $(INC)/absphot.h
  • branches/eam_branch_20071015/Ohana/src/absphot/include/absphot.h

    r15354 r15426  
    33# include <kapa.h>
    44# include <signal.h>
    5 
    6 /* # define GRID_V1 */
    7 # define GRID_V2
    8 # define NO_IMAGE -100
    9 
    10 # if (0)
    11 typedef struct {
    12   double xmin, xmax, ymin, ymax;
    13   int style, ptype, ltype, etype, color;
    14   double lweight, size;
    15 } Graphdata;
    16 # endif
    17 
    18 typedef struct {
    19   unsigned int start;
    20   unsigned int stop;
    21   float Mcal;
    22   float dMcal;
    23   short Xm;
    24   float secz;
    25   char code;
    26   Coords coords;
    27 } Mosaic;
    285
    296typedef struct {
     
    4118/* global variables set in parameter file */
    4219char   ImageCat[256];
    43 char   ImageTemplate[256];
    44 char   CatTemplate[256];
    4520char   GSCFILE[256];
    4621char   CATDIR[256];
    4722char   CATMODE[16];    /* raw, mef, split, mysql */
    4823char   CATFORMAT[16];  /* internal, elixir, loneos, panstarrs */
    49 char   CameraConfig[256];
     24
    5025char   SKY_TABLE[256];
    5126int    SKY_DEPTH;  /** XXX EAM : depth of catalog tables, fix usage */
    5227
    53 double MAG_LIM;
    54 double SIGMA_LIM;
    55 double IMAGE_SCATTER;
    56 double IMAGE_OFFSET;
    57 double STAR_SCATTER;
    58 double STAR_CHISQ;
    59 double MIN_ERROR;
    60 
    6128int    VERBOSE;
    6229
    63 int    NLOOP;
    64 int    RESET;
    6530int    UPDATE;
    6631int    PLOTSTUFF;
    6732int    SAVEPLOT;
    68 int    SHOW_PARAMS;
    69 char   MOSAICNAME[256];
    70 char   STATMODE[32];
    71 int    STAR_BAD;
    72 int    MEAS_BAD;
    73 int    STAR_TOOFEW;
    74 int    IMAGE_TOOFEW;
    75 double IMAGE_GOOD_FRACTION;
    76 int    IMAGE_BAD;
    77 int    FREEZE_IMAGES;
    78 int    USE_GRID;
    7933int    PLOTDELAY;
    8034
    81 int    RELPHOT_GRID_X;
    82 int    RELPHOT_GRID_Y;
    83 int    RELPHOT_GRID_BINNING;
     35int    SHOW_PARAMS;
     36char   STATMODE[32];
    8437
    8538PhotCode      *photcode;
     
    8740int            PhotSec;
    8841
    89 int AreaSelect;
    90 double AreaXmin, AreaXmax, AreaYmin, AreaYmax;
    91 
    92 int ImagSelect, ImagMin, ImagMax;
    93 
    94 int DophotSelect, DophotValue;
    95 
    9642double  PlotMmin, PlotMmax, PlotdMmin, PlotdMmax;
    97 enum {black, white, red, orange, yellow, green, blue, indigo, violet};
    98 
    99 int TimeSelect;
    100 time_t TSTART, TSTOP;
    10143
    10244SkyRegion UserPatch;
    103 int UserPatchSelect;
    10445
    105 # ifdef GRID_V1
    106 int setGridMeasure (int meas, int cat, double X, double Y);
    107 # endif
    108 
    109 # ifdef GRID_V2
    110 int setGridMeasure (int meas, int cat, double X, double Y, int ccdnum);
    111 # endif
    112 
    113 /*** relphot prototypes ***/
     46/*** absphot prototypes ***/
     47int           main                PROTO((int argc, char **argv));
     48void          initialize          PROTO((int argc, char **argv));
     49int           args                PROTO((int argc, char **argv));
    11450void          ConfigInit          PROTO((int *argc, char **argv));
    11551void          GetConfig           PROTO((char *config, char *field, char *format, int N, void *ptr));
    116 char         *GetPhotnamebyCode   PROTO((PhotCodeData *photcodes, int code));
    117 void          InterpolateGrid     PROTO((float *buffer, int Nx, int Ny, Coords *ccd, Coords *gcoords));
    118 int          *SelectRefMosaic     PROTO((Mosaic **refmosaic, int *Nimage));
    119 int           args                PROTO((int argc, char **argv));
    120 int           bcatalog            PROTO((Catalog *subcatalog, Catalog *catalog));
    121 void          clean_images        PROTO(());
    122 void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final));
    123 void          clean_mosaics       PROTO(());
    124 void          clean_stars         PROTO((Catalog *catalog, int Ncatalog));
    125 int           corner_check        PROTO((double *x1, double *y1, double *x2, double *y2));
    126 void          dumpGrid            PROTO(());
    127 void          dump_grid           PROTO(());
    128 int           edge_check          PROTO((double *x1, double *y1, double *x2, double *y2));
    129 void          findImages          PROTO((Catalog *catalog, int Ncatalog));
    130 int           findMosaics         PROTO((Catalog *catalog, int Ncatalog));
     52Catalog      *load_catalogs       PROTO((SkyList *skylist));
     53int           subset_catalog      PROTO((Catalog *subcatalog, Catalog *catalog));
     54void          free_catalogs       PROTO((Catalog *catalog, int Ncatalog));
    13155
    132 void set_db (FITS_DB *in);
    133 int Shutdown (char *format, ...);
    134 void TrapSignal (int sig);
    135 void SetProtect (int mode);
    136 int SetSignals ();
    137 
    138 void          freeGridBins        PROTO((int Ncatalog));
    139 void          freeImageBins       PROTO((int Ncatalog));
    140 void          freeMosaicBins      PROTO((int Ncatalog));
    141 void          free_catalogs       PROTO((Catalog *catalog, int Ncatalog));
    142 int           gcatalog            PROTO((Catalog *catalog, int FINAL));
    143 Coords       *getCoords           PROTO((int meas, int cat));
    144 float         getMcal             PROTO((int meas, int cat));
    145 float         getMgrid            PROTO((int meas, int cat));
    146 float         getMmos             PROTO((int meas, int cat));
    147 float         getMrel             PROTO((Catalog *catalog, int meas, int cat));
    148 Image        *getimage            PROTO((int N));
    149 Image        *getimages           PROTO((int *N));
    150 void          global_stats        PROTO((Catalog *catalog, int Ncatalog));
    151 void          initGrid            PROTO((int dX, int dY));
    152 void          initGridBins        PROTO((Catalog *catalog, int Ncatalog));
    153 void          initImageBins       PROTO((Catalog *catalog, int Ncatalog));
    154 void          initImages          PROTO((Image *input, int N));
    155 void          initMosaicBins      PROTO((Catalog *catalog, int Ncatalog));
    156 void          initMosaicGrid      PROTO((Image *image, int Nimage));
    157 void          initMosaics         PROTO((Image *image, int Nimage));
    158 void          initMrel            PROTO((Catalog *catalog, int Ncatalog));
    159 void          initialize          PROTO((int argc, char **argv));
    16056void          initstats           PROTO((char *mode));
    16157int           liststats           PROTO((double *value, double *dvalue, int N, StatType *stats));
    162 Catalog       *load_catalogs      PROTO((SkyList *skylist, int *Ncatalog));
    163 SkyList      *load_images         PROTO((FITS_DB *db, char *regionName, SkyRegion *region, int RegionSelect));
    164 Image         *select_images      PROTO((SkyList *skylist, Image *timage, int Ntimage, int **LineNumber, int *Nimage));
    16558
    166 int           main                PROTO((int argc, char **argv));
    167 void          mark_images         PROTO((Image *image, int Nimage, Image *timage, int Ntimage));
    168 void          matchImage          PROTO((Catalog *catalog, int meas, int cat));
    169 void          matchMosaics        PROTO((Catalog *catalog, int meas, int cat));
    170 double        opening_angle       PROTO((double x1, double y1, double x2, double y2, double x3, double y3));
    171 void          plot_chisq          PROTO((Catalog *catalog, int Ncatalog));
    172 void          plot_defaults       PROTO((Graphdata *graphdata));
    173 void          plot_grid           PROTO((Catalog *catalog));
    174 void          plot_images         PROTO(());
    175 void          plot_list           PROTO((Graphdata *graphdata, double *xlist, double *ylist, int N, char *label, char *file));
    176 void          plot_mosaic_fields  PROTO((Catalog *catalog));
    177 void          plot_mosaics        PROTO(());
    178 void          plot_scatter        PROTO((Catalog *catalog, int Ncatalog));
    179 void          plot_star_coords    PROTO((Catalog *catalog, int Ncatalog));
    180 void          plot_stars          PROTO((Catalog *catalog, int Ncatalog));
    181 void          reload_catalogs     PROTO((SkyList *skylist));
    182 int           reload_images       PROTO((FITS_DB *db));
    183 int           setExclusions       PROTO((Catalog *catalog, int Ncatalog));
    184 void          setMcal             PROTO((Catalog *catalog, int Poor));
    185 void          setMcalFinal        PROTO(());
    186 int           setMcalOutput       PROTO((Catalog *catalog, int Ncatalog));
    187 void          setMgrid            PROTO((Catalog *catalog));
    188 int           setMmos             PROTO((Catalog *catalog, int Poor));
    189 int           setMrel             PROTO((Catalog *catalog, int Ncatalog));
    190 void          setMrelFinal        PROTO((Catalog *catalog));
    191 int           setMrelOutput       PROTO((Catalog *catalog, int Ncatalog, int mark));
    192 void          set_ZP              PROTO((double ZERO));
    193 int           setrefcode          PROTO((Image *image, int Nimage));
    194 void          skip_measurements   PROTO((Catalog *catalog, int pass));
    195 void          sortA               PROTO((double *X, int N));
    196 void          sortB               PROTO((double *X, double *Y, int N));
    197 void          sortC               PROTO((double *X, double *Y, double *F1, double *F2, int N));
    198 void          sortD               PROTO((double *X, double *Y, double *Z, int N));
    199 StatType      statsImageM         PROTO((Catalog *catalog));
    200 StatType      statsImageN         PROTO((Catalog *catalog));
    201 StatType      statsImageX         PROTO((Catalog *catalog));
    202 StatType      statsImagedM        PROTO((Catalog *catalog));
    203 StatType      statsMosaicM        PROTO((Catalog *catalog));
    204 StatType      statsMosaicN        PROTO((Catalog *catalog));
    205 StatType      statsMosaicX        PROTO((Catalog *catalog));
    206 StatType      statsMosaicdM       PROTO((Catalog *catalog));
    207 StatType      statsStarN          PROTO((Catalog *catalog, int Ncatalog));
    208 StatType      statsStarS          PROTO((Catalog *catalog, int Ncatalog));
    209 StatType      statsStarX          PROTO((Catalog *catalog, int Ncatalog));
    210 void          wcatalog            PROTO((Catalog *catalog));
    211 void          wimages             PROTO(());
    212 void          write_coords        PROTO((Header *header, Coords *coords));
     59SkyList      *find_regions        PROTO((FITS_DB *db, SkyRegion *region));
  • branches/eam_branch_20071015/Ohana/src/absphot/src/ConfigInit.c

    r15354 r15426  
    11# include "absphot.h"
    2 
    32void ConfigInit (int *argc, char **argv) {
    43
     
    1817  if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file);
    1918
    20   GetConfig (config, "MAG_LIM",                "%lf", 0, &MAG_LIM);
    21   GetConfig (config, "SIGMA_LIM",              "%lf", 0, &SIGMA_LIM);
    22   GetConfig (config, "STAR_SCATTER",           "%lf", 0, &STAR_SCATTER);
    23   GetConfig (config, "IMAGE_SCATTER",          "%lf", 0, &IMAGE_SCATTER);
    24   GetConfig (config, "IMAGE_OFFSET",           "%lf", 0, &IMAGE_OFFSET);
    25 
    26   GetConfig (config, "STAR_CHISQ",             "%lf", 0, &STAR_CHISQ);
    27   GetConfig (config, "STAR_TOOFEW",            "%d",  0, &STAR_TOOFEW);
    28   GetConfig (config, "IMAGE_TOOFEW",           "%d",  0, &IMAGE_TOOFEW);
    29   GetConfig (config, "IMAGE_GOOD_FRACTION",    "%lf", 0, &IMAGE_GOOD_FRACTION);
    30 
    31   GetConfig (config, "GSCFILE",                "%s",  0, GSCFILE);
    32   GetConfig (config, "CATDIR",                 "%s",  0, CATDIR);
     19  GetConfig (config, "GSCFILE",                 "%s",  0, GSCFILE);
     20  GetConfig (config, "CATDIR",                  "%s",  0, CATDIR);
    3321  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    3422  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
     
    4634  GetConfig (config, "ZERO_PT",                "%lf", 0, &ZERO_POINT);
    4735
    48   GetConfig (config, "RELPHOT_GRID_X",         "%d",  0, &RELPHOT_GRID_X);
    49   GetConfig (config, "RELPHOT_GRID_Y",         "%d",  0, &RELPHOT_GRID_Y);
    50   GetConfig (config, "RELPHOT_GRID_BINNING",   "%d",  0, &RELPHOT_GRID_BINNING);
    51   GetConfig (config, "CAMERA_CONFIG",          "%s",  0, CameraConfig);
    52 
     36  // XXX these are used to set the default values if we are opening a new catalog,
     37  // but this program requires the existence of a catalog (with observations and references)
    5338  if (*CATMODE == 0) strcpy (CATMODE, "RAW");
    5439  if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR");
    5540
    56   /* XXX this does not yet write out the master photcode table */
     41  // XXX this does not yet write out the master photcode table
    5742  sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
    5843  if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) {
  • branches/eam_branch_20071015/Ohana/src/absphot/src/absphot.c

    r15354 r15426  
    99  SkyList *skylist = NULL;
    1010
    11   /* get configuration info, args */
     11  // get configuration info, interpret args
    1212  initialize (argc, argv);
    1313
    14   /* lock and load the photcode table */
    15   if (UPDATE) dvo_photcode_lock ();
     14  // lock and load the photcode table
     15  // XXX need to define this
     16  // if (UPDATE) dvo_photcode_lock ();
    1617
    17   /* load catalog data from region files */
     18  // restrict to user-specified region
     19  skylist = find_regions (&db, &UserPatch);
     20
     21  // load catalog data from selected regions
    1822  catalog = load_catalogs (skylist);
    1923 
    20   /* add in a loop over the catalogs calling dvo_catalog_chipcoords */
    21   fit_trend (catalog);
     24  // fit the trend of the obs - ref vs color...
     25  // XXX define this
     26  // fit_trend (catalog);
    2227
    2328  if (PLOTSTUFF) {
    24     plot_residuals (catalog);
     29    // XXX define this
     30    // plot_residuals (catalog);
    2531  }
    2632
    2733  if (!UPDATE) exit (0);
    2834
    29   /* load catalog data from region files, update Mrel include all data */
    30   dvo_photcode_update ();
    31   dvo_photcode_unlock ();
     35  // write out modifications to the photcode table (how do we record historical values?)
     36  // XXX define these
     37  // dvo_photcode_update ();
     38  // dvo_photcode_unlock ();
    3239
    3340  exit (0);
  • branches/eam_branch_20071015/Ohana/src/absphot/src/args.c

    r15354 r15426  
    77  double trange;
    88
    9   /* define time */
    10   TimeSelect = FALSE;
    11   if ((N = get_argument (argc, argv, "-time"))) {
    12     remove_argument (N, &argc, argv);
    13     if (!ohana_str_to_time (argv[N], &TSTART)) {
    14       fprintf (stderr, "ERROR: syntax error\n");
    15       return (FALSE);
    16     }
    17     remove_argument (N, &argc, argv);
    18     if (!ohana_str_to_dtime (argv[N], &trange)) {
    19       if (!ohana_str_to_time (argv[N], &TSTOP)) {
    20         fprintf (stderr, "ERROR: syntax error\n");
    21         return (FALSE);
    22       }
    23     } else {
    24       if (trange < 0) {
    25         trange = fabs (trange);
    26         TSTOP = TSTART;
    27         TSTART -= trange;
    28       } else {
    29         TSTOP = TSTART + trange;
    30       }
    31     }
    32     remove_argument (N, &argc, argv);
    33     TimeSelect = TRUE;
    34   }
    35 
    369  /* specify portion of the sky */
    3710  UserPatch.Rmin = 0;
     
    3912  UserPatch.Dmin = -90;
    4013  UserPatch.Dmax = +90;
    41   UserPatchSelect = FALSE;
    4214  if ((N = get_argument (argc, argv, "-region"))) {
    4315    remove_argument (N, &argc, argv);
     
    5022    UserPatch.Dmax = atof (argv[N]);
    5123    remove_argument (N, &argc, argv);
    52     UserPatchSelect = TRUE;
    5324  }
    5425
     
    7950  }
    8051
    81   NLOOP = 8;
    82   if ((N = get_argument (argc, argv, "-n"))) {
    83     remove_argument (N, &argc, argv);
    84     NLOOP = atof (argv[N]);
    85     remove_argument (N, &argc, argv);
    86   }
    87 
    88   RESET = FALSE;
    89   if ((N = get_argument (argc, argv, "-reset"))) {
    90     remove_argument (N, &argc, argv);
    91     RESET = TRUE;
    92   }
    93 
    94   UPDATE = FALSE;
    95   if ((N = get_argument (argc, argv, "-update"))) {
    96     remove_argument (N, &argc, argv);
    97     UPDATE = TRUE;
    98   }
    99 
    10052  SHOW_PARAMS = FALSE;
    10153  if ((N = get_argument (argc, argv, "-params"))) {
     
    10557
    10658  PlotMmin = 10.0; PlotMmax = 20.0; PlotdMmin = -1.0; PlotdMmax = 1.0;
    107   if ((N = get_argument (argc, argv, "-plrange"))) {
     59  if ((N = get_argument (argc, argv, "-plotrange"))) {
    10860    remove_argument (N, &argc, argv);
    10961    PlotMmin = atof (argv[N]);
     
    11769  }
    11870
    119   /* group images by mosaic, find Mmos */
    120   MOSAICNAME[0] = 0;
    121   if ((N = get_argument (argc, argv, "-mosaic"))) {
    122     remove_argument (N, &argc, argv);
    123     strcpy (MOSAICNAME, argv[N]);
    124     remove_argument (N, &argc, argv);
    125   }
    126 
    127   FREEZE_IMAGES = FALSE;
    128   if ((N = get_argument (argc, argv, "-imfreeze"))) {
    129     remove_argument (N, &argc, argv);
    130     FREEZE_IMAGES = TRUE;
    131   }
    132 
    133   USE_GRID = FALSE;
    134   if ((N = get_argument (argc, argv, "-grid"))) {
    135     remove_argument (N, &argc, argv);
    136     USE_GRID = TRUE;
    137     if (!MOSAICNAME[0]) {
    138       fprintf (stderr, "-grid is only valid with -mosaic\n");
    139       exit (2);
    140     }
    141   }
    142 
    143   MIN_ERROR = 0.001;
    144   if ((N = get_argument (argc, argv, "-minerror"))) {
    145     remove_argument (N, &argc, argv);
    146     MIN_ERROR = atof (argv[N]);
    147     remove_argument (N, &argc, argv);
    148     /* require MIN_ERROR > 0 */
    149   } 
    150 
    151   AreaSelect = FALSE;
    152   if ((N = get_argument (argc, argv, "-area"))) {
    153     remove_argument (N, &argc, argv);
    154     AreaXmin = atof (argv[N]);
    155     remove_argument (N, &argc, argv);
    156     AreaXmax = atof (argv[N]);
    157     remove_argument (N, &argc, argv);
    158     AreaYmin = atof (argv[N]);
    159     remove_argument (N, &argc, argv);
    160     AreaYmax = atof (argv[N]);
    161     remove_argument (N, &argc, argv);
    162     AreaSelect = TRUE;
    163   }
    164 
    165   ImagSelect = FALSE;
    166   if ((N = get_argument (argc, argv, "-instmag"))) {
    167     remove_argument (N, &argc, argv);
    168     ImagMin = atof (argv[N]);
    169     remove_argument (N, &argc, argv);
    170     ImagMax = atof (argv[N]);
    171     remove_argument (N, &argc, argv);
    172     ImagSelect = TRUE;
    173   }
    174 
    175   DophotSelect = FALSE;
    176   if ((N = get_argument (argc, argv, "-dophot"))) {
    177     remove_argument (N, &argc, argv);
    178     DophotValue = atof (argv[N]);
    179     remove_argument (N, &argc, argv);
    180     DophotSelect = TRUE;
    181   }
    182 
    183   if ( UserPatchSelect && (argc != 2)) usage ();
    184   if (!UserPatchSelect && (argc != 3)) usage ();
     71  if (argc != 2) usage ();
    18572
    18673  return TRUE;
     
    18875
    18976void usage () {
    190   fprintf (stderr, "ERROR: USAGE: absphot (region) (photcode)\n");
    191   fprintf (stderr, "       or:    absphot (photcode) -region RA RA DEC DEC\n");
     77  fprintf (stderr, "ERROR: USAGE: absphot (photcode) -region RA RA DEC DEC\n");
    19278  fprintf (stderr, "  options: \n");
    193   fprintf (stderr, "  -time (start) (stop)\n");
    19479  fprintf (stderr, "  -v\n");
    19580  fprintf (stderr, "  -plot\n");
    19681  fprintf (stderr, "  -plotdelay (seconds)\n");
    19782  fprintf (stderr, "  -statmode (mode)\n");
    198   fprintf (stderr, "  -n (nloop)\n");
    199   fprintf (stderr, "  -reset\n");
    200   fprintf (stderr, "  -update\n");
    20183  fprintf (stderr, "  -params\n");
    202   fprintf (stderr, "  -mosaic (mosaic)\n");
    203   fprintf (stderr, "  -imfreeze\n");
    204   fprintf (stderr, "  -grid\n");
    205   fprintf (stderr, "  -area Xmin Xmax Ymin Ymax\n");
    206   fprintf (stderr, "  -instmag min max\n");
     84  fprintf (stderr, "  -plotrange Mmin Mmax dMmin dMmax\n");
    20785  fprintf (stderr, "  \n");
    20886  exit (2);
  • branches/eam_branch_20071015/Ohana/src/absphot/src/fit_trend.c

    r15354 r15426  
    1 # include "absphot.c"
     1# include "absphot.h"
    22
    33int fit_trend (Catalog *catalog) {
     4
     5  // XXX define this : obs - ref vs color(obs)
     6  // target is the ref photcode (derived from obs photcode table entry)
     7  PhotCode *target;
     8
     9  int i, Nc0, Nc1, Nc2;
     10  float *x, *y, *dy;
     11  float c0, m0, dc0, dm0, c1, c2;
    412
    513  ALLOCATE (x, float, catalog[0].Naverage);
     
    917  // XXX I must have code that does this in another program
    1018  // XXX perhaps relphot for the grid colors?
    11   Nc0 = getNsecphot (target.c0);
    12   Nc1 = getNsecphot (target.c1);
    13   Nc2 = getNsecphot (target.c2);
     19  Nc0 = GetPhotcodeNsec (target->code);
     20  Nc1 = GetPhotcodeNsec (target->c1);
     21  Nc2 = GetPhotcodeNsec (target->c2);
    1422
    1523  if (catalog[0].Naverage != catalog[0].Nmeasure) abort();
     
    1826
    1927    // XXX I probably need to apply some corrections?
    20     c0 = catalog[0].secfilt[i*Nsecfilt + Nc0].mag;
    21     m0 = catalog[0].measure[i].mag;
     28    c0 = catalog[0].secfilt[i*PhotNsec + Nc0].M;
     29    m0 = catalog[0].measure[i].M;
    2230
    23     dc0 = catalog[0].secfilt[i*Nsecfilt + Nc0].dmag;
    24     dm0 = catalog[0].measure[i].dmag;
     31    dc0 = catalog[0].secfilt[i*PhotNsec + Nc0].dM;
     32    dm0 = catalog[0].measure[i].dM;
    2533
    26     c1 = catalog[0].secfilt[i*Nsecfilt + Nc1].mag;
    27     c2 = catalog[0].secfilt[i*Nsecfilt + Nc2].mag;
     34    c1 = catalog[0].secfilt[i*PhotNsec + Nc1].M;
     35    c2 = catalog[0].secfilt[i*PhotNsec + Nc2].M;
    2836
    2937    x[i] = c1 - c2;
     
    3341  }
    3442
    35   fit_vectors (x, y, dy);
     43  // XXX define this
     44  // fit_vectors (x, y, dy);
     45  // do something with the result!
     46
     47  free (x);
     48  free (y);
     49  free (dy);
    3650
    3751}
  • branches/eam_branch_20071015/Ohana/src/absphot/src/initialize.c

    r15354 r15426  
    88  args (argc, argv);
    99
    10   N = UserPatchSelect ? 1 : 2;
    11   if ((photcode = GetPhotcodebyName (argv[N])) == NULL) {
    12     fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", argv[N]);
     10  // XXX what type of photcodes are allowed / required?
     11  if ((photcode = GetPhotcodebyName (argv[1])) == NULL) {
     12    fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", argv[1]);
    1313    exit (1);
    1414  }
    1515  if (photcode[0].type != PHOT_SEC) {
    16     fprintf (stderr, "photcode %s is not a primary or secondary filter\n", argv[N]);
     16    fprintf (stderr, "photcode %s is not a primary or secondary filter\n", argv[1]);
    1717    exit (1);
    1818  }
     
    2323  initstats (STATMODE);
    2424
    25   IMAGE_BAD = ID_IMAGE_POOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;
    26   STAR_BAD  = ID_STAR_POOR | ID_STAR_FEW;
    27   MEAS_BAD  = ID_MEAS_NOCAL | ID_MEAS_POOR | ID_MEAS_SKIP | ID_MEAS_AREA;
    28 
    2925  if (SHOW_PARAMS) {
    3026    fprintf (stderr, "current parameter settings:\n");
    31     if (TimeSelect) {
    32       fprintf (stderr, "TimeSelect: TRUE (%s - %s)\n", ohana_sec_to_date (TSTART), ohana_sec_to_date (TSTOP));
    33     } else {
    34       fprintf (stderr, "TimeSelect: FALSE\n");
    35     }
    3627    fprintf (stderr, "VERBOSE: %d, PLOTSTUFF: %d\n", VERBOSE, PLOTSTUFF);
    37     fprintf (stderr, "GRID_X: %d, GRID_Y: %d, BINNING: %d == Nmx: %d, Nmy: %d\n",
    38              RELPHOT_GRID_X,
    39              RELPHOT_GRID_Y,
    40              RELPHOT_GRID_BINNING,
    41              (int)(RELPHOT_GRID_X/RELPHOT_GRID_BINNING), (int)(RELPHOT_GRID_Y/RELPHOT_GRID_BINNING));
    4228
    43     fprintf (stderr, "MAG_LIM                %lf\n", MAG_LIM);
    44     fprintf (stderr, "STAR_SCATTER           %lf\n", STAR_SCATTER);
    45     fprintf (stderr, "IMAGE_SCATTER          %lf\n", IMAGE_SCATTER);
    46     fprintf (stderr, "IMAGE_OFFSET           %lf\n", IMAGE_OFFSET);
    4729    fprintf (stderr, "IMAGE_CATALOG          %s\n",  ImageCat);
    4830    fprintf (stderr, "GSCFILE                %s\n",  GSCFILE);
  • branches/eam_branch_20071015/Ohana/src/absphot/src/plotstuff.c

    r15354 r15426  
    138138  graphdata[0].ltype = 0;
    139139  graphdata[0].etype = 0;
    140   graphdata[0].color = black;
     140  graphdata[0].color = 0;
    141141  graphdata[0].lweight = 0;
    142142  graphdata[0].size = 0.5;
  • branches/eam_branch_20071015/Ohana/src/absphot/src/subset_catalog.c

    r15354 r15426  
    33int subset_catalog (Catalog *subcatalog, Catalog *catalog) {
    44 
    5   int i, j, offset, ecode;
     5  // XXX define this : obs - ref vs color(obs)
     6  // target is the ref photcode (derived from obs photcode table entry)
     7  PhotCode *target;
     8
     9  int i, j, offset, averef, ecode;
    610  int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm;
    711  float mag;
     
    3034
    3135    // find desired target photcode measurements
    32     if (catalog[0].measure[i].photcode != target.photcode) continue;
     36    if (catalog[0].measure[i].photcode != target[0].code) continue;
    3337
    3438    // some possible exclusions based on the target measurements
    35     mag = PhotCat (&catalog[0].measure[i]);
    36     if (mag > MAG_LIM) continue;
     39    // mag = PhotCat (&catalog[0].measure[i]);
     40    // if (mag > MAG_LIM) continue;
    3741
    3842    /* select measurements by measurement error */
    39     if ((SIGMA_LIM > 0) && (catalog[0].measure[i].dM > SIGMA_LIM)) continue;
     43    // if ((SIGMA_LIM > 0) && (catalog[0].measure[i].dM > SIGMA_LIM)) continue;
    4044
    41     ave = catalog[0].measure[i].averef;
     45    averef = catalog[0].measure[i].averef;
    4246
    4347    // copy the average and secfilt data for this average object
    4448    // XXX potentially skip this source on some basis here
    45     subcatalog[0].average[Naverage] = catalog[0].average[ave];
     49    subcatalog[0].average[Naverage] = catalog[0].average[averef];
    4650    subcatalog[0].average[Naverage].offset = Nmeasure;
    4751    for (j = 0; j < PhotNsec; j++) {
    48       subcatalog[0].secfilt[PhotNsec*Naverage+j] = catalog[0].secfilt[PhotNsec*ave+j];
     52      subcatalog[0].secfilt[PhotNsec*Naverage+j] = catalog[0].secfilt[PhotNsec*averef+j];
    4953    }
    5054
Note: See TracChangeset for help on using the changeset viewer.