IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 19, 2012, 5:24:19 PM (14 years ago)
Author:
mhuber
Message:

merging latest r34040 trunk changes to branch

Location:
branches/meh_branches/ppstack_test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/meh_branches/ppstack_test

  • branches/meh_branches/ppstack_test/Ohana/src/relphot/include/relphot.h

    r31668 r34041  
    33# include <kapa.h>
    44# include <signal.h>
     5# include <pthread.h>
    56
    67/* # define GRID_V1 */
    78# define GRID_V2
    89# define NO_IMAGE -100
     10
     11// choose off_t or int depending on full-scale relphot analysis resources
     12// # define IDX_T off_t
     13# define IDX_T int
     14
     15typedef enum {
     16    MODE_NONE   = 0,
     17    MODE_LOAD   = 1,
     18    MODE_UPDATE = 2,
     19    MODE_UPDATE_OBJECTS = 3,
     20} ModeType;
    921
    1022typedef struct {
     
    1527  float dMcal;
    1628  float dMsys;
    17   short nFitPhotom;
     29  unsigned short nFitPhotom;
    1830  short Xm;
    1931  float secz;
    20   char flags;
     32  float ubercalDist;
     33  unsigned int flags;
     34  char skipCal;               // if TRUE, this mosaic is incomplete and should not be calibrated
    2135  Coords coords;
    2236} Mosaic;
     37
     38typedef enum {
     39  STATS_NONE,
     40  STATS_MEAN,
     41  STATS_MEDIAN,
     42  STATS_WT_MEAN,
     43  STATS_INNER_MEAN,
     44  STATS_INNER_WTMEAN,
     45  STATS_CHI_INNER_MEAN,
     46  STATS_CHI_INNER_WTMEAN
     47} ListStatsMode;
    2348
    2449typedef struct {
     
    3055  double min;
    3156  double max;
     57  double Upper80;
     58  double Lower20;
    3259  double total;
    3360  int    Nmeas;
     61  ListStatsMode statmode;
    3462} StatType;
    3563
     64typedef struct {
     65  AverageTiny *average;       // array of (minimal) average data
     66  MeasureTiny *measure;       // array of (minimal) measure data
     67  SecFilt     *secfilt;       // array of secfilt data (matched to average by Nsecfilt)
     68  off_t       Naverage;
     69  off_t       Nmeasure;
     70} BrightCatalog;
     71
     72typedef struct {
     73  float Mcal;
     74  float dMcal;
     75  unsigned int imageID;
     76  unsigned int photom_map_id;
     77  unsigned int flags;
     78  unsigned int tzero;
     79  unsigned char trate;
     80} ImageSubset;
     81
     82typedef struct {
     83  Catalog *catalog;           // array of catalogs generated
     84  int NCATALOG;               // number of catalogs allocated
     85  int Ncatalog;               // number of catalogs generated
     86  int Nsecfilt;               // number of catalogs generated
     87  off_t *NAVERAGE;            // allocated Averages per catalog
     88  off_t *NMEASURE;            // allocated Measures per catalog
     89  int   *index;               // lookup table catID -> catalog[i]
     90  int   *catIDs;              // lookup table catID <- catalog[i]
     91  int    maxID;               // max catID value to date
     92} CatalogSplitter;
     93
    3694/* global variables set in parameter file */
    37 char   ImageCat[256];
    38 char   ImageTemplate[256];
    39 char   CatTemplate[256];
    40 char   GSCFILE[256];
    41 char   CATDIR[256];
     95# define DVO_MAX_PATH 1024
     96char   ImageCat[DVO_MAX_PATH];
     97char   ImageTemplate[DVO_MAX_PATH];
     98char   CatTemplate[DVO_MAX_PATH];
     99char   GSCFILE[DVO_MAX_PATH];
     100char  *CATDIR;
    42101char   CATMODE[16];    /* raw, mef, split, mysql */
    43102char   CATFORMAT[16];  /* internal, elixir, loneos, panstarrs */
    44 char   CameraConfig[256];
    45 char   SKY_TABLE[256];
     103char   CameraConfig[DVO_MAX_PATH];
     104char   CAMERA[64];    /* eg, gpc1 */
     105char   SKY_TABLE[DVO_MAX_PATH];
    46106int    SKY_DEPTH;  /** XXX EAM : depth of catalog tables, fix usage */
     107
     108int          HOST_ID;
     109char        *HOSTDIR;
     110char        *IMAGES;
     111char        *BCATALOG;
     112ModeType     MODE;
    47113
    48114double MAG_LIM;
     
    54120double MIN_ERROR;
    55121double IMFIT_SYS_SIGMA_LIM;
     122double CLOUD_TOLERANCE;
     123
     124int    PARALLEL;
     125int    PARALLEL_MANUAL;
     126int    PARALLEL_SERIAL;
     127
     128int    NTHREADS;
    56129
    57130int    VERBOSE;
     
    79152int    FREEZE_MOSAICS;
    80153int    USE_GRID;
     154int    KEEP_UBERCAL;
    81155char  *OUTROOT;
     156char  *UPDATE_CATFORMAT;
    82157int    PLOTDELAY;
    83158int    UpdateAverages;
     159int    ApplyOffsets;
     160
     161char  *PhotcodeList;
    84162
    85163int    RELPHOT_GRID_X;
     
    101179double AreaXmin, AreaXmax, AreaYmin, AreaYmax;
    102180
    103 int ImagSelect, ImagMin, ImagMax;
     181int ImagSelect;
     182double ImagMin, ImagMax;
    104183
    105184int DophotSelect, DophotValue;
     
    112191
    113192SkyRegion UserPatch;
    114 int UserPatchSelect;
     193char *UserCatalog;
    115194
    116195int USE_BASIC_CHECK;
     
    131210off_t        *SelectRefMosaic     PROTO((Mosaic **refmosaic, off_t *Nimage));
    132211int           args                PROTO((int argc, char **argv));
    133 int           bcatalog            PROTO((Catalog *subcatalog, Catalog *catalog));
     212int           args_client         PROTO((int argc, char **argv));
     213int           bcatalog            PROTO((Catalog *subcatalog, Catalog *catalog, int Ncat));
    134214void          clean_images        PROTO((void));
    135 void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final));
     215void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final, FlatCorrectionTable *flatcorr));
    136216void          clean_mosaics       PROTO((void));
    137217void          clean_stars         PROTO((Catalog *catalog, int Ncatalog));
     
    156236Coords       *getCoords           PROTO((off_t meas, int cat));
    157237off_t         getImageEntry       PROTO((off_t meas, int cat));
    158 float         getMcal             PROTO((off_t meas, int cat));
     238float         getMcal             PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog));
     239float         getMflat            PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog));
    159240float         getMgrid            PROTO((off_t meas, int cat));
    160241float         getMmos             PROTO((off_t meas, int cat));
    161242float         getMrel             PROTO((Catalog *catalog, off_t meas, int cat));
     243short         getUbercalDist      PROTO((off_t meas, int cat));
    162244Image        *getimage            PROTO((off_t N));
    163245Image        *getimages           PROTO((off_t *N, off_t **LineNumber));
    164 void          global_stats        PROTO((Catalog *catalog, int Ncatalog));
     246ImageSubset  *getimages_subset    PROTO((off_t *N));
     247void          global_stats        PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
    165248void          initGrid            PROTO((int dX, int dY));
    166249void          initGridBins        PROTO((Catalog *catalog, int Ncatalog));
    167250void          initImageBins       PROTO((Catalog *catalog, int Ncatalog, int doImageList));
     251void          initImagesSubset    PROTO((ImageSubset *input, off_t *line_number, off_t N));
    168252void          initImages          PROTO((Image *input, off_t *LineNumber, off_t N));
    169253void          initMosaicBins      PROTO((Catalog *catalog, int Ncatalog, int doMosaicList));
    170254void          initMosaicGrid      PROTO((Image *image, off_t Nimage));
    171 void          initMosaics         PROTO((Image *image, off_t Nimage));
     255void          initMosaics         PROTO((Image *subset, off_t Nsubset, Image *image, char *inSubset, off_t Nimage));
    172256void          initMrel            PROTO((Catalog *catalog, int Ncatalog));
    173257void          initialize          PROTO((int argc, char **argv));
    174 void          initstats           PROTO((char *mode));
    175 int           liststats           PROTO((double *value, double *dvalue, int N, StatType *stats));
    176 Catalog       *load_catalogs      PROTO((SkyList *skylist, int *Ncatalog));
    177 SkyList      *load_images         PROTO((FITS_DB *db, char *regionName, SkyRegion *region, int RegionSelect));
    178 Image         *select_images      PROTO((SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage));
     258void          initialize_client   PROTO((int argc, char **argv));
     259void          liststats_setmode   PROTO((StatType *stats, char *strmode));
     260int           liststats           PROTO((double *value, double *dvalue, double *wvalue, int N, StatType *stats));
     261Catalog      *load_catalogs       PROTO((SkyList *skylist, int *Ncatalog, int hostID, char *hostpath));
     262Catalog      *load_catalogs_parallel PROTO((SkyList *sky, int *Ncatalog));
     263
     264SkyList      *load_images         PROTO((FITS_DB *db, char *regionName, SkyRegion *region));
     265Image        *select_images       PROTO((SkyList *skylist, Image *timage, off_t Ntimage, char *inSubset, off_t **LineNumber, off_t *Nimage, SkyRegion *region));
    179266
    180267int           main                PROTO((int argc, char **argv));
     
    185272void          plot_chisq          PROTO((Catalog *catalog, int Ncatalog));
    186273void          plot_defaults       PROTO((Graphdata *graphdata));
    187 void          plot_grid           PROTO((Catalog *catalog));
     274void          plot_grid           PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
    188275void          plot_images         PROTO((void));
    189276void          plot_list           PROTO((Graphdata *graphdata, double *xlist, double *ylist, int N, char *label, char *format, ...) OHANA_FORMAT(printf, 6, 7) );
    190277void          plot_mosaic_fields  PROTO((Catalog *catalog));
    191278void          plot_mosaics        PROTO((void));
    192 void          plot_scatter        PROTO((Catalog *catalog, int Ncatalog));
     279void          plot_scatter        PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
    193280void          plot_star_coords    PROTO((Catalog *catalog, int Ncatalog));
    194281void          plot_stars          PROTO((Catalog *catalog, int Ncatalog));
    195 void          reload_catalogs     PROTO((SkyList *skylist));
     282void          reload_catalogs     PROTO((SkyList *skylist, FlatCorrectionTable *flatcorr, int hostID, char *hostpath));
     283int           reload_catalogs_parallel PROTO((SkyList *sky));
    196284int           reload_images       PROTO((FITS_DB *db));
    197 int           setExclusions       PROTO((Catalog *catalog, int Ncatalog));
    198 void          setMcal             PROTO((Catalog *catalog, int Poor));
     285int           setExclusions       PROTO((Catalog *catalog, int Ncatalog, int verbose));
     286void          setMcal             PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr));
    199287void          setMcalFinal        PROTO((void));
    200 int           setMcalOutput       PROTO((Catalog *catalog, int Ncatalog));
    201 void          setMgrid            PROTO((Catalog *catalog));
    202 int           setMmos             PROTO((Catalog *catalog, int Poor));
    203 int           setMrel             PROTO((Catalog *catalog, int Ncatalog));
    204 void          setMrelFinal        PROTO((Catalog *catalog));
    205 int           setMrelOutput       PROTO((Catalog *catalog, int Ncatalog, int mark));
     288int           setMcalOutput       PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
     289void          setMgrid            PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
     290int           setMmos             PROTO((Catalog *catalog, int Poor, FlatCorrectionTable *flatcorr));
     291int           setMrel             PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr));
     292void          setMrelFinal        PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr, int simpleAverage));
     293int           setMrelOutput       PROTO((Catalog *catalog, int Ncatalog, int pass, FlatCorrectionTable *flatcorr));
    206294int           setMave             PROTO((Catalog *catalog, int Ncatalog));
    207295void          set_ZP              PROTO((double ZERO));
    208296int           setrefcode          PROTO((Image *image, off_t Nimage));
    209 void          skip_measurements   PROTO((Catalog *catalog, int pass));
     297void          skip_measurements   PROTO((Catalog *catalog, int pass, FlatCorrectionTable *flatcorr));
    210298void          sortA               PROTO((double *X, int N));
    211299void          sortB               PROTO((double *X, double *Y, int N));
     
    213301void          sortD               PROTO((double *X, double *Y, double *Z, int N));
    214302StatType      statsImageM         PROTO((Catalog *catalog));
    215 StatType      statsImageN         PROTO((Catalog *catalog));
     303StatType      statsImageN         PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
    216304StatType      statsImageX         PROTO((Catalog *catalog));
    217305StatType      statsImagedM        PROTO((Catalog *catalog));
    218306StatType      statsMosaicM        PROTO((Catalog *catalog));
    219 StatType      statsMosaicN        PROTO((Catalog *catalog));
     307StatType      statsMosaicN        PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr));
    220308StatType      statsMosaicX        PROTO((Catalog *catalog));
    221309StatType      statsMosaicdM       PROTO((Catalog *catalog));
    222 StatType      statsStarN          PROTO((Catalog *catalog, int Ncatalog, int Nsec, int seccode));
     310StatType      statsStarN          PROTO((Catalog *catalog, int Ncatalog, int Nsec, int seccode, FlatCorrectionTable *flatcorr));
    223311StatType      statsStarS          PROTO((Catalog *catalog, int Ncatalog, int Nsec));
    224312StatType      statsStarX          PROTO((Catalog *catalog, int Ncatalog, int Nsec));
     
    226314void          wimages             PROTO((void));
    227315void          write_coords        PROTO((Header *header, Coords *coords));
    228 int relphot_objects (void);
     316int relphot_objects (int hostID, char *hostpath);
    229317
    230318void relphot_usage (void);
    231319void relphot_help (int argc, char **argv);
    232320
     321void relphot_client_usage (void);
     322void relphot_client_help (int argc, char **argv);
     323
    233324off_t getImageByID (off_t ID);
    234325
     
    236327int LimitDensityCatalog (Catalog *subcatalog, Catalog *catalog);
    237328
    238 int populate_tiny_values (Catalog *catalog);
    239 int free_tiny_values (Catalog *catalog);
     329BrightCatalog *BrightCatalogLoad(char *filename);
     330int BrightCatalogSave(char *filename, BrightCatalog *catalog);
     331BrightCatalog *BrightCatalogMerge (Catalog *catalog, int Ncatalog);
     332CatalogSplitter *BrightCatalogSplitInit (int Nsecfilt);
     333int BrightCatalogSplitFree (CatalogSplitter *catalogs);
     334int BrightCatalogSplit (CatalogSplitter *catalogs, BrightCatalog *bcatalog);
     335
     336int ImageSubsetSave(char *filename, ImageSubset *image, off_t Nimage);
     337ImageSubset *ImageSubsetLoad(char *filename, off_t *nimage);
     338
     339int client_logger_init ();
     340int client_logger_message (char *format,...);
     341
Note: See TracChangeset for help on using the changeset viewer.