IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 21, 2014, 5:42:34 AM (12 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ps2-tc3-20130727
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ps2-tc3-20130727

  • branches/eam_branches/ps2-tc3-20130727/Ohana

    • Property svn:mergeinfo deleted
  • branches/eam_branches/ps2-tc3-20130727/Ohana/src/libdvo/include/dvo.h

    r35755 r36680  
    285285} HostTable;
    286286
     287// A RegionHost processes data for some region in parallel with other regions
     288typedef struct RegionHostInfo {
     289  double Rmin;        // (Rmin,Rmax),(Dmin,Dmax) arehard RA,DEC boundaries of the
     290  double Rmax;        // region for which each host is responsible.  A given host
     291  double Dmin;        // calibrates the images for which the fiducial point (center)
     292  double Dmax;        // lands in the region, and all objects in the region
     293
     294  double RminCat;      // (RminCat,RmaxCat),(DminCat,DmaxCat) are the region for which
     295  double RmaxCat;      // the catalogs need to be loaded : this is the outer bounds
     296  double DminCat;      // of the region containing all images completely
     297  double DmaxCat;
     298
     299  char *hostname;
     300
     301  int hostID;                 // remove machine ID in SkyTable
     302  int stdio[3];               // fd's for communication with the remote host
     303  int pid;                    // remote process ID
     304  int status;
     305  IOBuffer stdout;
     306  IOBuffer stderr;
     307
     308  off_t Nimage;
     309  off_t NIMAGE;
     310  Image *image;
     311  off_t *imseq;
     312
     313  int *neighbors;             // list of neighbor index values
     314  int Nneighbors;             // number of neighbors
     315  char isNeighbor;            // TRUE if I am a neighbor to the current region host
     316} RegionHostInfo;
     317
     318typedef struct {
     319  double Rmin;
     320  double Rmax;
     321  double Dmin;
     322  double Dmax;
     323
     324  int Nhosts;
     325  RegionHostInfo *hosts;
     326  short *index;
     327} RegionHostTable;
     328
    287329// special-case function:
    288330CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, off_t *Ndata, char *swapped);
     
    308350# define BOUNDARY_TREE_NAME_LENGTH 128
    309351
     352// BoundaryTree is a structure to describe the 3pi RINGS skycell boundaries in terms of lines of constant (RA,DEC)
     353// the structure is flexible for a variety of RINGS-like tessellations, but is not appropriate for the LOCAL style tess
    310354typedef struct {
    311355  int FixedGridDEC;           // is the DEC sequence linear?
     
    342386} BoundaryTree;
    343387
    344 // XXX DROP? // a reduced-subset structure for relastro
    345 // XXX DROP? typedef struct {
    346 // XXX DROP?   double         R;
    347 // XXX DROP?   double         D;
    348 // XXX DROP?   unsigned short Nmeasure;
    349 // XXX DROP?   int            measureOffset;
    350 // XXX DROP?   uint32_t       flags;
    351 // XXX DROP?   int            catID;
    352 // XXX DROP? } AverageTinyAstro;
     388typedef enum { TESS_NONE, TESS_LOCAL, TESS_RINGS } TessType;
     389
     390// TessellationTable is a structure to describe the parameters of a set of "tessellations"
     391// (these are not strictly tessellations but projection sets as only the non-local
     392// versions can cover the full sky).  For LOCAL projection cells, the structure describes
     393// the boundaries of a SINGLE projection cell with Nx * Ny skycells and includes some
     394// basic parameters (not used by the fullsky, eg RINGS, tessellations)
     395typedef struct {
     396  double Rmin; // this tessellation is valid only for RA >= Rmin
     397  double Rmax; // this tessellation is valid only for RA <  Rmax
     398  double Dmin; // this tessellation is valid only for DEC >= Dmin
     399  double Dmax; // this tessellation is valid only for DEC <  Dmax
     400
     401  double Xo;
     402  double Yo;
     403  double Ro;
     404  double Do;
     405  double dPix;
     406  int dX;
     407  int dY;
     408
     409  int NX_SUB;
     410  int NY_SUB;
     411
     412  char *basename;
     413  int Nbasename;
     414  int projectIDoff;
     415  int skycellIDoff;
     416
     417  TessType type; //
     418  BoundaryTree *tree;
     419} TessellationTable;
    353420
    354421// a reduced-subset structure for relphot
     
    360427  uint32_t       flags;
    361428  int            catID;
     429  int            objID;
     430  int            nOwn;
    362431} AverageTiny;
    363432
     
    385454  short          dYccd;
    386455  short          dRsys;
     456  char           myDet;
    387457} MeasureTiny;
     458
     459/** STRUCT DEFINITION **/
     460typedef struct {
     461  double           R;                    // RA (decimal degrees )
     462  double           D;                    // DEC (decimal degrees )
     463  float            dR;                   // RA error (arcsec)
     464  float            dD;                   // DEC error (arcsec)
     465  float            uR;                   // RA*cos(D) proper-motion (arcsec/year)
     466  float            uD;                   // DEC proper-motion (arcsec/year)
     467  float            duR;                  // RA*cos(D) p-m error (arcsec/year)
     468  float            duD;                  // DEC p-m error (arcsec/year)
     469  float            P;                    // parallax (arcsec)
     470  float            dP;                   // parallax error (arcsec)
     471  float            ChiSqAve;             // astrometry analysis chisq
     472  float            ChiSqPM;              // astrometry analysis chisq
     473  float            ChiSqPar;             // astrometry analysis chisq
     474  int              Tmean;                // mean epoch (PM,PAR ref) (unix time seconds)
     475  int              Trange;               // mean epoch (PM,PAR ref) (unix time seconds)
     476  float            Xp;                   // unused
     477  unsigned short   Npos;                 // number of detections used for astrometry
     478  unsigned short   Nmeasure;             // number of psf measurements
     479  unsigned short   Nmissing;             // number of missings
     480  unsigned short   Nextend;              // number of extended measurements
     481  uint32_t         measureOffset;        // offset to first psf measurement
     482  uint32_t         missingOffset;        // offset to first missing obs
     483  uint32_t         extendOffset;         // offset to first extended measurement
     484  uint32_t         flags;                // average object flags (star; ghost; etc)
     485  uint32_t         photFlagsUpper;       // upper bit of 2 bit summary of per-measure photflags
     486  uint32_t         photFlagsLower;       // lower bit of 2 bit summary of per-measure photflags
     487  unsigned int     objID;                // unique ID for object in table
     488  unsigned int     catID;                // unique ID for table in which object was first realized
     489  uint64_t         extID;                // external ID for object (eg PSPS objID)
     490} Average_PS1_V4alt;
     491
     492Average_PS1_V4alt *gfits_table_get_Average_PS1_V4alt (FTable *table, off_t *Ndata, char *swapped);
     493Average *Average_PS1_V4alt_ToInternal (Average_PS1_V4alt *in, off_t Nvalues);
     494
     495/** STRUCT DEFINITION **/
     496typedef struct {
     497  float            dR;                   // RA offset (arcsec)
     498  float            dD;                   // DEC offset (arcsec)
     499  float            M;                    // catalog mag (mag)
     500  float            Mcal;                 // image cal mag (mag)
     501  float            Map;                  // aperture mag (mag)
     502  float            Mkron;                // kron magnitude (mag)
     503  float            dMkron;               // kron magnitude error (mag)
     504  float            dM;                   // mag error (mag)
     505  float            dMcal;                // systematic calibration error (mag)
     506  float            dt;                   // exposure time (2.5*log(exptime))
     507  float            FluxPSF;              // flux from psf fit (counts/sec?)
     508  float            dFluxPSF;             // error on psf flux (counts/sec?)
     509  float            FluxKron;             // flux from kron ap (counts/sec?)
     510  float            dFluxKron;            // error on kron flux (counts/sec?)
     511  float            airmass;              // (airmass - 1) (airmass)
     512  float            az;                   // telescope azimuth
     513  float            Xccd;                 // X coord on chip (raw value) (pixels)
     514  float            Yccd;                 // Y coord on chip (raw value) (pixels)
     515  float            Sky;                  // local estimate of sky flux (counts/sec)
     516  float            dSky;                 // local estimate of sky flux (counts/sec)
     517  int              t;                    // time in seconds (UNIX)
     518  unsigned int     averef;               // reference to average entry     
     519  unsigned int     detID;                // detection ID
     520  unsigned int     imageID;              // reference to DVO image ID
     521  unsigned int     objID;                // unique ID for object in table
     522  unsigned int     catID;                // unique ID for table in which object was first realized
     523  uint64_t         extID;                // external ID (eg PSPS detID)
     524  float            psfQF;                // psf coverage/quality factor
     525  float            psfQFperf;            // psf coverage / quality factor (all mask bits)
     526  float            psfChisq;             // psf fit chisq
     527  int              psfNdof;              // psf degrees of freedom
     528  int              psfNpix;              // psf number of pixels
     529  float            crNsigma;             // Nsigma deviation towards CR
     530  float            extNsigma;            // Nsigma deviation towards EXT
     531  short            FWx;                  // object fwhm major axis (1/100 of pixels)
     532  short            FWy;                  // object fwhm minor axis (1/100 of pixels )
     533  short            theta;                // angle wrt ccd X dir ((0xffff/360) deg)
     534  short            Mxx;                  // second moments in pixel coords (1/100 of pixels)
     535  short            Mxy;                  // second moments in pixel coords (1/100 of pixels)
     536  short            Myy;                  // second moments in pixel coords (1/100 of pixels)
     537  unsigned short   t_msec;               // time fraction of second (milliseconds)
     538  unsigned short   photcode;             // photcode
     539  short            dXccd;                // X coord error on chip (1/100 of pixels)
     540  short            dYccd;                // Y coord error on chip (1/100 of pixels)
     541  short            dRsys;                // systematic error from astrom (1/100 of pixels)
     542  short            posangle;             // position angle sky to chip ((0xffff/360) deg)
     543  float            pltscale;             // plate scale (arcsec/pixel)
     544  unsigned int     dbFlags;              // flags supplied by analysis in database
     545  unsigned int     photFlags;            // flags supplied by photometry program
     546} Measure_PS1_V4alt;
     547
     548Measure_PS1_V4alt *gfits_table_get_Measure_PS1_V4alt (FTable *table, off_t *Ndata, char *swapped);
     549Measure *Measure_PS1_V4alt_ToInternal (Measure_PS1_V4alt *in, off_t Nvalues);
    388550
    389551/* a catalog contains this data */
     
    438600  float *X;
    439601  float *Y;
     602  int   *nOwn; // relastro uses this to count owned detections per object
    440603
    441604} Catalog;
     
    499662float PhotInst (Measure *measure);
    500663float PhotCat (Measure *measure);
    501 float PhotAper (Measure *measure);
    502 float PhotKron (Measure *measure);
    503664float PhotSys (Measure *measure, Average *average, SecFilt *secfilt);
    504665float PhotRel (Measure *measure, Average *average, SecFilt *secfilt);
     
    506667float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt);
    507668float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure);
     669float PhotAveErr (PhotCode *code, Average *average, SecFilt *secfilt);
     670
     671float PhotAperInst (Measure *measure);
     672float PhotAperCat (Measure *measure);
     673float PhotAperSys (Measure *measure, Average *average, SecFilt *secfilt);
     674float PhotAperRel (Measure *measure, Average *average, SecFilt *secfilt);
     675float PhotAperCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
     676float PhotAperAve (PhotCode *code, Average *average, SecFilt *secfilt);
     677float PhotAperRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure);
     678
     679float PhotKronInst (Measure *measure);
     680float PhotKronCat (Measure *measure);
     681float PhotKronSys (Measure *measure, Average *average, SecFilt *secfilt);
     682float PhotKronRel (Measure *measure, Average *average, SecFilt *secfilt);
     683float PhotKronCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
     684float PhotKronAve (PhotCode *code, Average *average, SecFilt *secfilt);
     685float PhotKronRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure);
     686float PhotKronAveErr (PhotCode *code, Average *average, SecFilt *secfilt);
     687
    508688float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt);
    509 float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt);
    510 
    511 float PhotAperInst (Measure *measure);
    512 float PhotKronInst (Measure *measure);
    513 float PhotKronAve (PhotCode *code, Average *average, SecFilt *secfilt);
    514 float PhotKronAveErr (PhotCode *code, Average *average, SecFilt *secfilt);
    515689
    516690float PhotZeroPoint (Measure *measure, Average *average, SecFilt *secfilt);
     
    696870void sort_coords_index (double *X, double *Y, off_t *S, off_t N);
    697871void sort_coords_indexonly (double *X, double *Y, off_t *S, off_t N);
     872void sort_IDs_indexonly (opihi_int *X, off_t *S, off_t N);
    698873void sort_regions (SkyRegion *region, off_t N);
    699874
     
    716891int free_tiny_values (Catalog *catalog);
    717892
     893BoundaryTree *BoundaryTreeLoad(char *filename);
     894BoundaryTree *BoundaryTreeRead(Header *headerPHU, Header *headerZone, FILE *f);
     895
     896int BoundaryTreeSave(char *filename, BoundaryTree *tree);
     897int BoundaryTreeWrite(FILE *f, BoundaryTree *tree);
     898
    718899int BoundaryTreeCellCoords (BoundaryTree *tree, int *zone, int *band, double ra, double dec);
    719 int BoundaryTreeSave(char *filename, BoundaryTree *tree);
    720 BoundaryTree *BoundaryTreeLoad(char *filename);
    721900int BoundaryTreeProjection (double *x, double *y, double r, double d, BoundaryTree *tree, int zone, int band);
     901
     902TessellationTable *TessellationTableLoad(char *filename, int *Ntess);
     903int TessellationTableSave(char *filename, TessellationTable *tess, int Ntess);
     904int TessellationPrimaryCellIDs (TessellationTable *tess, int Ntess, int *tessID, int *projID, int *skycellID, double ra, double dec);
     905void TessellationTableInit (TessellationTable *tess, int Ntess);
    722906
    723907void dvo_average_init (Average *average);
     
    727911void dvo_measureT_init (MeasureTiny *measure);
    728912
     913void InitRegionHosts (RegionHostInfo *hosts, int Nhosts, int NHOSTS);
     914void FreeRegionHosts (RegionHostInfo *hosts, int Nhosts);
     915void FreeRegionHostTable (RegionHostTable *table);
     916RegionHostTable *RegionHostTableLoad (char *catdir, char *rootname);
     917int RegionHostTableWaitJobs (RegionHostTable *regionHosts, char *file, int lineno);
     918int RegionHostTableWaitJobsGetIO (RegionHostTable *regionHosts, char *file, int lineno, int VERBOSE);
     919int RegionHostFindNeighbors (RegionHostTable *table, int Nhost);
     920
    729921# endif // DVO_H
Note: See TracChangeset for help on using the changeset viewer.