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/libdvo/include/dvo.h

    r31663 r34041  
    2626  DVO_FORMAT_PS1_V1,
    2727  DVO_FORMAT_PS1_V2,
     28  DVO_FORMAT_PS1_V3,
    2829} DVOTableFormat;
    2930
     
    6970} DVO_INT_NAN;
    7071
     72// max path length
     73# define DVO_MAX_PATH 1024
     74
    7175/* RegImage.flag values */
    7276# define IMREG_DIST  0x01 /* image distributed, only imregister-3.0 */
     
    9599/* Image.code values -- these values are 32 bit (as of PS1_V1) */
    96100typedef enum {
    97   ID_IMAGE_NEW          = 0x00000000,  /* no calibrations yet attempted */
    98   ID_IMAGE_PHOTOM_NOCAL = 0x00000001,  /* user-set value used within relphot: ignore */
    99   ID_IMAGE_PHOTOM_POOR  = 0x00000002,  /* relphot says image is bad (dMcal > limit) */
    100   ID_IMAGE_PHOTOM_SKIP  = 0x00000004,  /* user-set value: assert that this image has bad photometry */
    101   ID_IMAGE_PHOTOM_FEW   = 0x00000008,  /* currently too few measurements for photometry */
    102   ID_IMAGE_ASTROM_NOCAL = 0x00000010,  /* user-set value used within relastro: ignore */
    103   ID_IMAGE_ASTROM_POOR  = 0x00000020,  /* relastro says image is bad (dR,dD > limit) */
    104   ID_IMAGE_ASTROM_FAIL  = 0x00000040,  /* relastro fit diverged, fit not applied */
    105   ID_IMAGE_ASTROM_SKIP  = 0x00000080,  /* user-set value: assert that this image has bad astrometry */
    106   ID_IMAGE_ASTROM_FEW   = 0x00000100,  /* currently too few measurements for astrometry */
     101  ID_IMAGE_NEW            = 0x00000000,  /* no calibrations yet attempted */
     102  ID_IMAGE_PHOTOM_NOCAL   = 0x00000001,  /* user-set value used within relphot: ignore */
     103  ID_IMAGE_PHOTOM_POOR    = 0x00000002,  /* relphot says image is bad (dMcal > limit) */
     104  ID_IMAGE_PHOTOM_SKIP    = 0x00000004,  /* user-set value: assert that this image has bad photometry */
     105  ID_IMAGE_PHOTOM_FEW     = 0x00000008,  /* currently too few measurements for photometry */
     106  ID_IMAGE_ASTROM_NOCAL   = 0x00000010,  /* user-set value used within relastro: ignore */
     107  ID_IMAGE_ASTROM_POOR    = 0x00000020,  /* relastro says image is bad (dR,dD > limit) */
     108  ID_IMAGE_ASTROM_FAIL    = 0x00000040,  /* relastro fit diverged, fit not applied */
     109  ID_IMAGE_ASTROM_SKIP    = 0x00000080,  /* user-set value: assert that this image has bad astrometry */
     110  ID_IMAGE_ASTROM_FEW     = 0x00000100,  /* currently too few measurements for astrometry */
     111  ID_IMAGE_PHOTOM_UBERCAL = 0x00000200,  /* externally-supplied photometry zero point from ubercal analysis */
    107112} DVOImageFlags;
    108113
    109114/* Measure.flags values -- these values are 32 bit (as of PS1_V1) */
    110115typedef enum {
    111   ID_MEAS_NOCAL        = 0x00000001,  // detection ignored for this analysis (photcode, time range) -- internal only
    112   ID_MEAS_POOR_PHOTOM  = 0x00000002,  // detection is photometry outlier                                                 
    113   ID_MEAS_SKIP_PHOTOM  = 0x00000004,  // detection was ignored for photometry measurement                                 
    114   ID_MEAS_AREA         = 0x00000008,  // detection near image edge                                                   
    115   ID_MEAS_POOR_ASTROM  = 0x00000010,  // detection is astrometry outlier                                                 
    116   ID_MEAS_SKIP_ASTROM  = 0x00000020,  // detection was ignored for astrometry measurement                                 
    117   ID_MEAS_USED_OBJ     = 0x00000040,  // detection was used during opdate objects                                   
    118   ID_MEAS_USED_CHIP    = 0x00000080,  // detection was used during update chips                                     
    119   ID_MEAS_BLEND_MEAS   = 0x00000100,  // detection is within radius of multiple objects                             
    120   ID_MEAS_BLEND_OBJ    = 0x00000200,  // multiple detections within radius of object                               
    121   ID_MEAS_UNDEF_3      = 0x00000400,  // unused                                                                     
    122   ID_MEAS_UNDEF_4      = 0x00000800,  // unused                                                                     
    123   ID_MEAS_BLEND_MEAS_X = 0x00001000,  // detection is within radius of multiple objects across catalogs             
    124   ID_MEAS_ARTIFACT     = 0x00002000,  // detection is thought to be non-astronomical                                 
    125   ID_MEAS_UNDEF_5      = 0x00004000,  // unused                                                                     
    126   ID_MEAS_UNDEF_6      = 0x00008000,  // unused                                                                     
     116  ID_MEAS_NOCAL          = 0x00000001,  // detection ignored for this analysis (photcode, time range) -- internal only
     117  ID_MEAS_POOR_PHOTOM    = 0x00000002,  // detection is photometry outlier                                               
     118  ID_MEAS_SKIP_PHOTOM    = 0x00000004,  // detection was ignored for photometry measurement                               
     119  ID_MEAS_AREA           = 0x00000008,  // detection near image edge                                                 
     120  ID_MEAS_POOR_ASTROM    = 0x00000010,  // detection is astrometry outlier                                               
     121  ID_MEAS_SKIP_ASTROM    = 0x00000020,  // detection was ignored for astrometry measurement                               
     122  ID_MEAS_USED_OBJ       = 0x00000040,  // detection was used during update objects 
     123  ID_MEAS_USED_CHIP      = 0x00000080,  // detection was used during update chips (XXX this probably does not make it into the db)
     124  ID_MEAS_BLEND_MEAS     = 0x00000100,  // detection is within radius of multiple objects
     125  ID_MEAS_BLEND_OBJ      = 0x00000200,  // multiple detections within radius of object
     126  ID_MEAS_UNDEF_3        = 0x00000400,  // unused
     127  ID_MEAS_UNDEF_4        = 0x00000800,  // unused
     128  ID_MEAS_BLEND_MEAS_X   = 0x00001000,  // detection is within radius of multiple objects across catalogs                   
     129  ID_MEAS_ARTIFACT       = 0x00002000,  // detection is thought to be non-astronomical                               
     130  ID_MEAS_UNDEF_5        = 0x00004000,  // unused
     131  ID_MEAS_PHOTOM_UBERCAL = 0x00008000,  // externally-supplied zero point from ubercal analysis
    127132} DVOMeasureFlags;
    128133
     
    141146*/
    142147
    143 /* Average.code values -- these values are 32 bit (as of PS1_V1) */
     148/* Average.flags values -- these values are 32 bit (as of PS1_V1) */
    144149typedef enum {
    145150  ID_STAR_FEW     = 0x00000001, // used within relphot: skip star
     
    168173} DVOAverageFlags;
    169174
     175/* Secfilt.flags values -- these values are 32 bit (as of PS1_V1) */
     176typedef enum {
     177  ID_SECF_STAR_FEW    = 0x00000001, // used within relphot: skip star
     178  ID_SECF_STAR_POOR   = 0x00000002, // used within relphot: skip star
     179  ID_SECF_USE_SYNTH   = 0x00000004, // synthetic photometry used in average measurement
     180  ID_SECF_USE_UBERCAL = 0x00000008, // synthetic photometry used in average measurement
     181  ID_PHOTOM_PASS_0    = 0x00000100, // average magnitude calculated in 0th pass
     182  ID_PHOTOM_PASS_1    = 0x00000200, // average magnitude calculated in 1th pass
     183  ID_PHOTOM_PASS_2    = 0x00000400, // average magnitude calculated in 2th pass
     184  ID_PHOTOM_PASS_3    = 0x00000800, // average magnitude calculated in 3th pass
     185  ID_PHOTOM_PASS_4    = 0x00001000, // average magnitude calculated in 4th pass
     186  ID_SECF_OBJ_EXT     = 0x01000000, // extended in this band
     187} DVOSecfiltFlags;
     188
    170189/*** general dvo structures (internal use only / not IO) ***/
    171190
     
    196215  char **filename;
    197216  SkyRegion *regions;
     217  char hosts[80];
    198218} SkyTable;
    199219
     
    203223  char **filename;
    204224  SkyRegion **regions;
     225  char hosts[80];
    205226} SkyList;
     227
     228typedef struct {
     229  off_t Nimage;
     230  FlatCorrectionImage *image;
     231  off_t Ncorr;
     232  int *IDtoSeq;
     233  FlatCorrection *corr;
     234  float ***offset; // the correction images represented as a set of arrays (same sequence as *image)
     235  int Nseason;
     236  e_time *tstart;
     237  e_time *tstop;
     238} FlatCorrectionTable;
     239
     240/* definitions for parallel dvo host information
     241   XXX : need better names (safer namespace)
     242 */
     243
     244typedef enum {
     245  DATA_ON_TGT  = 0x01,
     246  DATA_ON_BCK  = 0x02,
     247  DATA_USE_BCK = 0x04,
     248
     249  DATA_COPY_FAILURE = 0x80,
     250} SkyTableDataFlags;
     251
     252typedef enum {
     253  HOST_STDIN = 0,
     254  HOST_STDOUT = 1,
     255  HOST_STDERR = 2,
     256} HostInfoIOfd;
     257
     258typedef struct {
     259  char *hostname;             // name of remote machine
     260  char *pathname;             // name of directory for this machine's data
     261  char *results;              // name of file machine's result data
     262  int hostID;                 // remove machine ID in SkyTable
     263  int stdio[3];               // fd's for communication with the remote host
     264  int pid;                    // remote process ID
     265  int status;                 // job exit status
     266  IOBuffer stdout;
     267  IOBuffer stderr;
     268} HostInfo;
     269
     270typedef struct {
     271  int Nhosts;
     272  HostInfo *hosts;
     273  short *index;
     274} HostTable;
    206275
    207276// special-case function:
     
    218287} PhotCodeData;
    219288
     289typedef enum {
     290  DVO_TV_MEASURE = 0x01,
     291  DVO_TV_AVERAGE = 0x02,
     292} DVOTinyValueMode;
     293
     294// XXX DROP? // a reduced-subset structure for relastro
     295// XXX DROP? typedef struct {
     296// XXX DROP?   double         R;
     297// XXX DROP?   double         D;
     298// XXX DROP?   unsigned short Nmeasure;
     299// XXX DROP?   int            measureOffset;
     300// XXX DROP?   uint32_t       flags;
     301// XXX DROP?   int            catID;
     302// XXX DROP? } AverageTinyAstro;
     303
    220304// a reduced-subset structure for relphot
    221305typedef struct {
     
    225309  int            measureOffset;
    226310  uint32_t       flags;
     311  int            catID;
    227312} AverageTiny;
    228313
    229 // a reduced-subset structure for relphot
     314// a reduced-subset structure for relphot & relastro
    230315typedef struct {
    231316  float          dR;
     
    242327  unsigned int   imageID;
    243328  unsigned int   dbFlags;
     329  unsigned int   photFlags;
     330  int            catID; // unsigned int?
    244331  unsigned short photcode;
     332  short          dXccd;
     333  short          dYccd;
     334  short          dRsys;
    245335} MeasureTiny;
    246336
     
    366456float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt);
    367457
     458float PhotMstdev (PhotCode *code, Average *average, SecFilt *secfilt);
     459float PhotM20 (PhotCode *code, Average *average, SecFilt *secfilt);
     460float PhotM80 (PhotCode *code, Average *average, SecFilt *secfilt);
     461float PhotUCdist (PhotCode *code, Average *average, SecFilt *secfilt);
     462
    368463float PhotColorForCode (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
    369464int PhotColor (Average *average, SecFilt *secfilt, Measure *measure, int c1, int c2, double *color);
     
    383478int PhotColorTiny (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, int c1, int c2, double *color);
    384479
    385 
    386480PhotCodeData *GetPhotcodeTable (void);
    387481void SetPhotcodeTable (PhotCodeData *);
    388482
    389483int *GetSecFiltMap(PhotCodeData *ouput, PhotCodeData* input);
     484PhotCode **ParsePhotcodeList (char *rawlist, int *nphotcodes, int needAve);
    390485
    391486int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite);
     
    429524void dvo_catalog_test (Catalog *catalog, int halt);
    430525
     526int dvo_catalog_backup (Catalog *catalog, int primary);
     527int dvo_catalog_unlink_backup (Catalog *catalog, int primary);
     528
    431529/* catmode-specific APIs */
    432530int dvo_catalog_load_raw (Catalog *catalog, int VERBOSE);
     
    450548int WriteRawSecFilt (FILE *f, SecFilt *secfilt, off_t Nsecfilt, char format);
    451549
     550DVOTableFormat FtableGetFormat (FTable *ftable);
     551
    452552Average *FtableToAverage (FTable *ftable, off_t *Naverage, char *format, SecFilt **primary);
    453553Measure *FtableToMeasure (FTable *ftable, off_t *Nmeasure, char *format);
     
    470570# include "ps1_v1_defs.h"
    471571# include "ps1_v2_defs.h"
     572# include "ps1_v3_defs.h"
    472573# include "ps1_ref_defs.h"
    473574
     
    484585void dvo_image_create (FITS_DB *db, double ZeroPoint);
    485586
     587/* flatcorr APIs */
     588FlatCorrectionTable *FlatCorrectionLoad (char *filename, int VERBOSE);
     589int FlatCorrectionInternal(FlatCorrectionTable *flatcorrTable);
     590int FlatCorrectionSave (FlatCorrectionTable *flatcorrTable, char *filename);
     591float FlatCorrectionOffset (FlatCorrectionTable *flatcorr, int ID, int X, int Y);
     592
    486593/* skyregion APIs */
    487594int        SkyTableSave            PROTO((SkyTable *table, char *filename));
    488595SkyTable  *SkyTableLoad            PROTO((char *filename, int VERBOSE));
     596char      *SkyTableFilename        PROTO((char *catdir));
    489597SkyTable  *SkyTableFromGSC         PROTO((char *filename, int depth, int VERBOSE));
    490598SkyTable  *SkyTableLoadOptimal     PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int readwrite, int depth, int VERBOSE));
     
    528636#endif
    529637
    530 # endif
     638// functions for parallel DVO
     639HostTable    *HostTableLoad (char *catdir, char *rootname);
     640int HostTableWaitJobs (HostTable *table, char *file, int lineno);
     641int HostTableWaitJobsGetIO (HostTable *table, char *file, int lineno, int VERBOSE);
     642int HostTableTestHost (SkyRegion *region, int hostID);
     643
     644// functions to support tiny versions of Average and Measure
     645void CopyAverageToTiny (AverageTiny *averageT, Average *average);
     646void CopyMeasureToTiny (MeasureTiny *measureT, Measure *measure);
     647int populate_tiny_values (Catalog *catalog, DVOTinyValueMode mode);
     648int free_tiny_values (Catalog *catalog);
     649
     650# endif // DVO_H
     651
Note: See TracChangeset for help on using the changeset viewer.