IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2012, 2:28:17 PM (14 years ago)
Author:
eugene
Message:

new query fields (secfilt flags; mean airmass; mcal offset, photcode_klam, photcode_c); updates to the measure,average,secfilt bit flags (relphot & relastr); support for distributed hosts & flat-field corrections in dvo; support for PS1_V3 schema; remove strdup from code (break ohana memory management); better support for Average,Measure Tiny values (used by relphot and relastro)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/include/dvo.h

    r31663 r33649  
    2626  DVO_FORMAT_PS1_V1,
    2727  DVO_FORMAT_PS1_V2,
     28  DVO_FORMAT_PS1_V3,
    2829} DVOTableFormat;
    2930
     
    9596/* Image.code values -- these values are 32 bit (as of PS1_V1) */
    9697typedef 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 */
     98  ID_IMAGE_NEW            = 0x00000000,  /* no calibrations yet attempted */
     99  ID_IMAGE_PHOTOM_NOCAL   = 0x00000001,  /* user-set value used within relphot: ignore */
     100  ID_IMAGE_PHOTOM_POOR    = 0x00000002,  /* relphot says image is bad (dMcal > limit) */
     101  ID_IMAGE_PHOTOM_SKIP    = 0x00000004,  /* user-set value: assert that this image has bad photometry */
     102  ID_IMAGE_PHOTOM_FEW     = 0x00000008,  /* currently too few measurements for photometry */
     103  ID_IMAGE_ASTROM_NOCAL   = 0x00000010,  /* user-set value used within relastro: ignore */
     104  ID_IMAGE_ASTROM_POOR    = 0x00000020,  /* relastro says image is bad (dR,dD > limit) */
     105  ID_IMAGE_ASTROM_FAIL    = 0x00000040,  /* relastro fit diverged, fit not applied */
     106  ID_IMAGE_ASTROM_SKIP    = 0x00000080,  /* user-set value: assert that this image has bad astrometry */
     107  ID_IMAGE_ASTROM_FEW     = 0x00000100,  /* currently too few measurements for astrometry */
     108  ID_IMAGE_PHOTOM_UBERCAL = 0x00000200,  /* externally-supplied photometry zero point from ubercal analysis */
    107109} DVOImageFlags;
    108110
    109111/* Measure.flags values -- these values are 32 bit (as of PS1_V1) */
    110112typedef 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                                                                     
     113  ID_MEAS_NOCAL          = 0x00000001,  // detection ignored for this analysis (photcode, time range) -- internal only
     114  ID_MEAS_POOR_PHOTOM    = 0x00000002,  // detection is photometry outlier                                               
     115  ID_MEAS_SKIP_PHOTOM    = 0x00000004,  // detection was ignored for photometry measurement                               
     116  ID_MEAS_AREA           = 0x00000008,  // detection near image edge                                                 
     117  ID_MEAS_POOR_ASTROM    = 0x00000010,  // detection is astrometry outlier                                               
     118  ID_MEAS_SKIP_ASTROM    = 0x00000020,  // detection was ignored for astrometry measurement                               
     119  ID_MEAS_USED_OBJ       = 0x00000040,  // detection was used during update objects 
     120  ID_MEAS_USED_CHIP      = 0x00000080,  // detection was used during update chips (XXX this probably does not make it into the db)
     121  ID_MEAS_BLEND_MEAS     = 0x00000100,  // detection is within radius of multiple objects
     122  ID_MEAS_BLEND_OBJ      = 0x00000200,  // multiple detections within radius of object
     123  ID_MEAS_UNDEF_3        = 0x00000400,  // unused
     124  ID_MEAS_UNDEF_4        = 0x00000800,  // unused
     125  ID_MEAS_BLEND_MEAS_X   = 0x00001000,  // detection is within radius of multiple objects across catalogs                   
     126  ID_MEAS_ARTIFACT       = 0x00002000,  // detection is thought to be non-astronomical                               
     127  ID_MEAS_UNDEF_5        = 0x00004000,  // unused
     128  ID_MEAS_PHOTOM_UBERCAL = 0x00008000,  // externally-supplied zero point from ubercal analysis
    127129} DVOMeasureFlags;
    128130
     
    141143*/
    142144
    143 /* Average.code values -- these values are 32 bit (as of PS1_V1) */
     145/* Average.flags values -- these values are 32 bit (as of PS1_V1) */
    144146typedef enum {
    145147  ID_STAR_FEW     = 0x00000001, // used within relphot: skip star
     
    168170} DVOAverageFlags;
    169171
     172/* Secfilt.flags values -- these values are 32 bit (as of PS1_V1) */
     173typedef enum {
     174  ID_SECF_STAR_FEW    = 0x00000001, // used within relphot: skip star
     175  ID_SECF_STAR_POOR   = 0x00000002, // used within relphot: skip star
     176  ID_SECF_USE_SYNTH   = 0x00000004, // synthetic photometry used in average measurement
     177  ID_SECF_USE_UBERCAL = 0x00000008, // synthetic photometry used in average measurement
     178  ID_PHOTOM_PASS_0    = 0x00000100, // average magnitude calculated in 0th pass
     179  ID_PHOTOM_PASS_1    = 0x00000200, // average magnitude calculated in 1th pass
     180  ID_PHOTOM_PASS_2    = 0x00000400, // average magnitude calculated in 2th pass
     181  ID_PHOTOM_PASS_3    = 0x00000800, // average magnitude calculated in 3th pass
     182  ID_PHOTOM_PASS_4    = 0x00001000, // average magnitude calculated in 4th pass
     183  ID_SECF_OBJ_EXT     = 0x01000000, // extended in this band
     184} DVOSecfiltFlags;
     185
    170186/*** general dvo structures (internal use only / not IO) ***/
    171187
     
    196212  char **filename;
    197213  SkyRegion *regions;
     214  char hosts[80];
    198215} SkyTable;
    199216
     
    203220  char **filename;
    204221  SkyRegion **regions;
     222  char hosts[80];
    205223} SkyList;
     224
     225typedef struct {
     226  off_t Nimage;
     227  FlatCorrectionImage *image;
     228  off_t Ncorr;
     229  int *IDtoSeq;
     230  FlatCorrection *corr;
     231  float ***offset; // the correction images represented as a set of arrays (same sequence as *image)
     232  int Nseason;
     233  e_time *tstart;
     234  e_time *tstop;
     235} FlatCorrectionTable;
     236
     237/* definitions for parallel dvo host information
     238   XXX : need better names (safer namespace)
     239 */
     240
     241typedef enum {
     242  DATA_ON_TGT  = 0x01,
     243  DATA_ON_BCK  = 0x02,
     244  DATA_USE_BCK = 0x04,
     245
     246  DATA_COPY_FAILURE = 0x80,
     247} SkyTableDataFlags;
     248
     249typedef enum {
     250  HOST_STDIN = 0,
     251  HOST_STDOUT = 1,
     252  HOST_STDERR = 2,
     253} HostInfoIOfd;
     254
     255typedef struct {
     256  char *hostname;             // name of remote machine
     257  char *pathname;             // name of directory for this machine's data
     258  char *results;              // name of file machine's result data
     259  int hostID;                 // remove machine ID in SkyTable
     260  int stdio[3];               // fd's for communication with the remote host
     261  int pid;                    // remote process ID
     262  int status;                 // job exit status
     263  IOBuffer stdout;
     264  IOBuffer stderr;
     265} HostInfo;
     266
     267typedef struct {
     268  int Nhosts;
     269  HostInfo *hosts;
     270  unsigned short *index;
     271} HostTable;
    206272
    207273// special-case function:
     
    218284} PhotCodeData;
    219285
     286typedef enum {
     287  DVO_TV_MEASURE = 0x01,
     288  DVO_TV_AVERAGE = 0x02,
     289} DVOTinyValueMode;
     290
     291// XXX DROP? // a reduced-subset structure for relastro
     292// XXX DROP? typedef struct {
     293// XXX DROP?   double         R;
     294// XXX DROP?   double         D;
     295// XXX DROP?   unsigned short Nmeasure;
     296// XXX DROP?   int            measureOffset;
     297// XXX DROP?   uint32_t       flags;
     298// XXX DROP?   int            catID;
     299// XXX DROP? } AverageTinyAstro;
     300
    220301// a reduced-subset structure for relphot
    221302typedef struct {
     
    225306  int            measureOffset;
    226307  uint32_t       flags;
     308  int            catID;
    227309} AverageTiny;
    228310
    229 // a reduced-subset structure for relphot
     311// a reduced-subset structure for relphot & relastro
    230312typedef struct {
    231313  float          dR;
     
    242324  unsigned int   imageID;
    243325  unsigned int   dbFlags;
     326  unsigned int   photFlags;
     327  int            catID; // unsigned int?
    244328  unsigned short photcode;
     329  short          dXccd;
     330  short          dYccd;
     331  short          dRsys;
    245332} MeasureTiny;
    246333
     
    383470int PhotColorTiny (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, int c1, int c2, double *color);
    384471
    385 
    386472PhotCodeData *GetPhotcodeTable (void);
    387473void SetPhotcodeTable (PhotCodeData *);
    388474
    389475int *GetSecFiltMap(PhotCodeData *ouput, PhotCodeData* input);
     476PhotCode **ParsePhotcodeList (char *rawlist, int *nphotcodes, int needAve);
    390477
    391478int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite);
     
    450537int WriteRawSecFilt (FILE *f, SecFilt *secfilt, off_t Nsecfilt, char format);
    451538
     539DVOTableFormat FtableGetFormat (FTable *ftable);
     540
    452541Average *FtableToAverage (FTable *ftable, off_t *Naverage, char *format, SecFilt **primary);
    453542Measure *FtableToMeasure (FTable *ftable, off_t *Nmeasure, char *format);
     
    470559# include "ps1_v1_defs.h"
    471560# include "ps1_v2_defs.h"
     561# include "ps1_v3_defs.h"
    472562# include "ps1_ref_defs.h"
    473563
     
    484574void dvo_image_create (FITS_DB *db, double ZeroPoint);
    485575
     576/* flatcorr APIs */
     577FlatCorrectionTable *FlatCorrectionLoad (char *filename, int VERBOSE);
     578int FlatCorrectionInternal(FlatCorrectionTable *flatcorrTable);
     579int FlatCorrectionSave (FlatCorrectionTable *flatcorrTable, char *filename);
     580float FlatCorrectionOffset (FlatCorrectionTable *flatcorr, int ID, int X, int Y);
     581
    486582/* skyregion APIs */
    487583int        SkyTableSave            PROTO((SkyTable *table, char *filename));
    488584SkyTable  *SkyTableLoad            PROTO((char *filename, int VERBOSE));
     585char      *SkyTableFilename        PROTO((char *catdir));
    489586SkyTable  *SkyTableFromGSC         PROTO((char *filename, int depth, int VERBOSE));
    490587SkyTable  *SkyTableLoadOptimal     PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int readwrite, int depth, int VERBOSE));
     
    528625#endif
    529626
    530 # endif
     627// functions for parallel DVO
     628HostTable    *HostTableLoad (char *catdir, char *rootname);
     629int HostTableWaitJobs (HostTable *table, char *file, int lineno);
     630int HostTableWaitJobsGetIO (HostTable *table, char *file, int lineno, int VERBOSE);
     631int HostTableTestHost (SkyRegion *region, int hostID);
     632
     633// functions to support tiny versions of Average and Measure
     634void CopyAverageToTiny (AverageTiny *averageT, Average *average);
     635void CopyMeasureToTiny (MeasureTiny *measureT, Measure *measure);
     636int populate_tiny_values (Catalog *catalog, DVOTinyValueMode mode);
     637int free_tiny_values (Catalog *catalog);
     638
     639# endif // DVO_H
     640
Note: See TracChangeset for help on using the changeset viewer.