IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28721


Ignore:
Timestamp:
Jul 27, 2010, 3:14:39 PM (16 years ago)
Author:
eugene
Message:

modify image flags to separate PHOTOM and ASTROM states; use typedefs instead of defines

Location:
branches/eam_branches/ipp-20100621/Ohana/src/libdvo
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/Ohana/src/libdvo/include/dvo.h

    r27817 r28721  
    8585# define PHOT_MAG 0x06  /* generic magnitude; never stored */
    8686
    87 /* Image.code values.  these are codes to note bad images */
    88 # define ID_IMAGE_NEW   0x0000  /* no nrphot attempted */
    89 # define ID_IMAGE_NOCAL 0x0001  /* used within nrphot to mean "don't apply fit" */
    90 # define ID_IMAGE_POOR  0x0002  /* relphot says image is bad */
    91 # define ID_IMAGE_SKIP  0x0004  /* external information image is bad */
    92 # define ID_IMAGE_FEW   0x0008  /* currently too few measurements for good value */
     87/* Image.code values -- these values are 32 bit (as of PS1_V1) */
     88typedef enum {
     89  ID_IMAGE_NEW          = 0x00000000,  /* no calibrations yet attempted */
     90  ID_IMAGE_PHOTOM_NOCAL = 0x00000001,  /* user-set value used within relphot: ignore */
     91  ID_IMAGE_PHOTOM_POOR  = 0x00000002,  /* relphot says image is bad (dMcal > limit) */
     92  ID_IMAGE_PHOTOM_SKIP  = 0x00000004,  /* user-set value: assert that this image has bad photometry */
     93  ID_IMAGE_PHOTOM_FEW   = 0x00000008,  /* currently too few measurements for photometry */
     94  ID_IMAGE_ASTROM_NOCAL = 0x00000010,  /* user-set value used within relastro: ignore */
     95  ID_IMAGE_ASTROM_POOR  = 0x00000020,  /* relastro says image is bad (dR,dD > limit) */
     96  ID_IMAGE_ASTROM_FAIL  = 0x00000040,  /* relastro fit diverged, fit not applied */
     97  ID_IMAGE_ASTROM_SKIP  = 0x00000080,  /* user-set value: assert that this image has bad astrometry */
     98  ID_IMAGE_ASTROM_FEW   = 0x00000100,  /* currently too few measurements for astrometry */
     99} DVOImageFlags;
    93100
    94101/* Measure.flags values -- these values are 32 bit (as of PS1_V1) */
    95102typedef enum {
    96   ID_MEAS_NOCAL        = 0x0001,  // detection ignored for this analysis (photcode, time range) -- internal only
    97   ID_MEAS_POOR_PHOTOM  = 0x0002,  // detection is photometry outlier                                             
    98   ID_MEAS_SKIP_PHOTOM  = 0x0004,  // detection was ignored for photometry measurement                             
    99   ID_MEAS_AREA         = 0x0008,  // detection near image edge                                               
    100   ID_MEAS_POOR_ASTROM  = 0x0010,  // detection is astrometry outlier                                             
    101   ID_MEAS_SKIP_ASTROM  = 0x0020,  // detection was ignored for astrometry measurement                             
    102   ID_MEAS_USED_OBJ     = 0x0040,  // detection was used during opdate objects                               
    103   ID_MEAS_USED_CHIP    = 0x0080,  // detection was used during update chips                                         
    104   ID_MEAS_BLEND_MEAS   = 0x0100,  // detection is within radius of multiple objects                                 
    105   ID_MEAS_BLEND_OBJ    = 0x0200,  // multiple detections within radius of object                                     
    106   ID_MEAS_UNDEF_3      = 0x0400,  // unused                                                                         
    107   ID_MEAS_UNDEF_4      = 0x0800,  // unused                                                                         
    108   ID_MEAS_BLEND_MEAS_X = 0x1000,  // detection is within radius of multiple objects across catalogs                 
    109   ID_MEAS_ARTIFACT     = 0x2000,  // detection is thought to be non-astronomical                                     
    110   ID_MEAS_UNDEF_5      = 0x4000,  // unused                                                                         
    111   ID_MEAS_UNDEF_6      = 0x8000,  // unused                                                                         
     103  ID_MEAS_NOCAL        = 0x00000001,  // detection ignored for this analysis (photcode, time range) -- internal only
     104  ID_MEAS_POOR_PHOTOM  = 0x00000002,  // detection is photometry outlier                                                 
     105  ID_MEAS_SKIP_PHOTOM  = 0x00000004,  // detection was ignored for photometry measurement                                 
     106  ID_MEAS_AREA         = 0x00000008,  // detection near image edge                                                   
     107  ID_MEAS_POOR_ASTROM  = 0x00000010,  // detection is astrometry outlier                                                 
     108  ID_MEAS_SKIP_ASTROM  = 0x00000020,  // detection was ignored for astrometry measurement                                 
     109  ID_MEAS_USED_OBJ     = 0x00000040,  // detection was used during opdate objects                                   
     110  ID_MEAS_USED_CHIP    = 0x00000080,  // detection was used during update chips                                     
     111  ID_MEAS_BLEND_MEAS   = 0x00000100,  // detection is within radius of multiple objects                             
     112  ID_MEAS_BLEND_OBJ    = 0x00000200,  // multiple detections within radius of object                                 
     113  ID_MEAS_UNDEF_3      = 0x00000400,  // unused                                                                     
     114  ID_MEAS_UNDEF_4      = 0x00000800,  // unused                                                                     
     115  ID_MEAS_BLEND_MEAS_X = 0x00001000,  // detection is within radius of multiple objects across catalogs             
     116  ID_MEAS_ARTIFACT     = 0x00002000,  // detection is thought to be non-astronomical                                 
     117  ID_MEAS_UNDEF_5      = 0x00004000,  // unused                                                                     
     118  ID_MEAS_UNDEF_6      = 0x00008000,  // unused                                                                     
    112119} DVOMeasureFlags;
    113120
  • branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/LoadPhotcodesFITS.c

    r27580 r28721  
    4343  if (!strcmp (extname, "DVO_PHOTCODE")) {
    4444    PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped);
     45    if (!photcode_elixir) {
     46      fprintf (stderr, "ERROR: failed to read photcodes\n");
     47      exit (2);
     48    }
    4549    photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode);
    4650    free (photcode_elixir);
     
    4953  if (!strcmp (extname, "DVO_PHOTCODE_ELIXIR")) {
    5054    PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped);
     55    if (!photcode_elixir) {
     56      fprintf (stderr, "ERROR: failed to read photcodes\n");
     57      exit (2);
     58    }
    5159    photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode);
    5260    free (photcode_elixir);
     
    5563  if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_1")) {
    5664    PhotCode_PS1_DEV_1 *photcode_ps1_dev_1 = gfits_table_get_PhotCode_PS1_DEV_1 (&db.ftable, &Ncode, &db.swapped);
     65    if (!photcode_ps1_dev_1) {
     66      fprintf (stderr, "ERROR: failed to read photcodes\n");
     67      exit (2);
     68    }
    5769    photcode = PhotCode_PS1_DEV_1_To_Internal (photcode_ps1_dev_1, Ncode);
    5870    free (photcode_ps1_dev_1);
     
    6173  if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_2")) {
    6274    PhotCode_PS1_DEV_2 *photcode_ps1_dev_2 = gfits_table_get_PhotCode_PS1_DEV_2 (&db.ftable, &Ncode, &db.swapped);
     75    if (!photcode_ps1_dev_2) {
     76      fprintf (stderr, "ERROR: failed to read photcodes\n");
     77      exit (2);
     78    }
    6379    photcode = PhotCode_PS1_DEV_2_To_Internal (photcode_ps1_dev_2, Ncode);
    6480    free (photcode_ps1_dev_2);
     
    6783  if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_3")) {
    6884    PhotCode_PS1_DEV_3 *photcode_ps1_dev_3 = gfits_table_get_PhotCode_PS1_DEV_3 (&db.ftable, &Ncode, &db.swapped);
     85    if (!photcode_ps1_dev_3) {
     86      fprintf (stderr, "ERROR: failed to read photcodes\n");
     87      exit (2);
     88    }
    6989    photcode = PhotCode_PS1_DEV_3_To_Internal (photcode_ps1_dev_3, Ncode);
    7090    free (photcode_ps1_dev_3);
     
    7393  if (!strcmp (extname, "DVO_PHOTCODE_PS1_V1")) {
    7494    PhotCode_PS1_V1 *photcode_ps1_v1 = gfits_table_get_PhotCode_PS1_V1 (&db.ftable, &Ncode, &db.swapped);
     95    if (!photcode_ps1_v1) {
     96      fprintf (stderr, "ERROR: failed to read photcodes\n");
     97      exit (2);
     98    }
    7599    photcode = PhotCode_PS1_V1_To_Internal (photcode_ps1_v1, Ncode);
    76100    free (photcode_ps1_v1);
     
    79103  if (!strcmp (extname, "DVO_PHOTCODE_PS1_V2")) {
    80104    PhotCode_PS1_V2 *photcode_ps1_v2 = gfits_table_get_PhotCode_PS1_V2 (&db.ftable, &Ncode, &db.swapped);
     105    if (!photcode_ps1_v2) {
     106      fprintf (stderr, "ERROR: failed to read photcodes\n");
     107      exit (2);
     108    }
    81109    photcode = PhotCode_PS1_V2_To_Internal (photcode_ps1_v2, Ncode);
    82110    free (photcode_ps1_v2);
     
    85113  if (!strcmp (extname, "DVO_PHOTCODE_PS1_REF")) {
    86114    PhotCode_PS1_REF *photcode_ps1_ref = gfits_table_get_PhotCode_PS1_REF (&db.ftable, &Ncode, &db.swapped);
     115    if (!photcode_ps1_ref) {
     116      fprintf (stderr, "ERROR: failed to read photcodes\n");
     117      exit (2);
     118    }
    87119    photcode = PhotCode_PS1_REF_To_Internal (photcode_ps1_ref, Ncode);
    88120    free (photcode_ps1_ref);
  • branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c

    r28241 r28721  
    1414  if (ftable[0].header[0].Naxis[0] != 136) {
    1515    fprintf (stderr, "ERROR: wrong format for CMF_PS1_V1_Alt: "OFF_T_FMT" vs %d\n",  ftable[0].header[0].Naxis[0], 136);
    16     exit (2);
     16    return (NULL);
    1717  }
    1818
  • branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/coordops.c

    r28674 r28721  
    2020int XY_to_LM (double *L, double *M, double x, double y, Coords *coords) {
    2121
     22  OhanaProjection proj;
     23  OhanaProjectionMode mode;
    2224  double X, Y, X2, XY, Y2, X3, Y3;
     25
     26  proj = GetProjection (coords[0].ctype);
     27  mode = GetProjectionMode (proj);
    2328
    2429  /** convert pixel coordinates to cartesian system **/
     
    4449  }
    4550
     51  if (mode == PROJ_MODE_CARTESIAN) {
     52    *L += coords[0].crval1;
     53    *M += coords[0].crval2;
     54  }
     55
    4656  return (TRUE);
    4757}
     
    6373  /** Locally Cartesian Projections **/
    6474  if (mode == PROJ_MODE_CARTESIAN) {
    65     *ra  = L + coords[0].crval1;
    66     *dec = M + coords[0].crval2;
    67 
    6875    /* mosaic astrometry : WRP is chip astrometry; apply mosaic (DIS) term */
    6976    if (proj == PROJ_WRP) {
     
    182189
    183190  double phi, theta;
    184   double Lo, Mo;
    185191  double sphi, cphi, stht, ctht;
    186192  double salp, calp, sdel, cdel, sdp, cdp;
     
    200206    if (proj == PROJ_WRP) {
    201207      if (!gotMosaic) return (FALSE);
    202       RD_to_XY (&Lo, &Mo, ra, dec, &mosaic);
    203       *L = (Lo - coords[0].crval1);
    204       *M = (Mo - coords[0].crval2);
     208      RD_to_XY (L, M, ra, dec, &mosaic);
    205209      return (TRUE);
    206210    }
    207     *L = (ra  - coords[0].crval1);
    208     *M = (dec - coords[0].crval2);
     211    *L = ra;
     212    *M = dec;
    209213    return (TRUE);
    210214  }
     
    309313  double dX, dY, Lo, Mo, dL, dM;
    310314  double dLdX, dLdY, dMdX, dMdY, Do;
     315  OhanaProjection proj;
     316  OhanaProjectionMode mode;
     317
     318  proj = GetProjection (coords[0].ctype);
     319  mode = GetProjectionMode (proj);
    311320
    312321  *x = 0;
    313322  *y = 0;
     323
     324  if (mode == PROJ_MODE_CARTESIAN) {
     325    L -= coords[0].crval1;
     326    M -= coords[0].crval2;
     327  }
    314328
    315329  /* start with linear solution for X,Y */
  • branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/dvo_catalog_mef.c

    r28241 r28721  
    125125    /* no conversions currently defined */
    126126    catalog[0].missing = gfits_table_get_Missing (&ftable, &catalog[0].Nmissing, NULL);
     127    if (!catalog[0].missing) {
     128      fprintf (stderr, "ERROR: failed to read missing\n");
     129      exit (2);
     130    }
    127131    if (Nmissing != catalog[0].Nmiss_disk) {
    128132      fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nmissing,  catalog[0].Nmiss_disk);
  • branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/dvo_catalog_split.c

    r28241 r28721  
    285285    /* no conversions currently defined : this just does the byte swap */
    286286    catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL);
     287    if (!catalog[0].missing) {
     288      fprintf (stderr, "ERROR: failed to read missing\n");
     289      exit (2);
     290    }
    287291    if (Nmissing != catalog[0].Nmiss_disk) {
    288292      fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nmissing,  catalog[0].Nmiss_disk);
     
    473477    /* no conversions currently defined : this just does the byte swap */
    474478    catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL);
     479    if (!catalog[0].missing) {
     480      fprintf (stderr, "ERROR: failed to read missing\n");
     481      exit (2);
     482    }
    475483    if (Nmissing != Nrows) {
    476484      fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nmissing,  Nrows);
  • branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/dvo_convert.c

    r28241 r28721  
    3232    Average_##TYPE *tmpAverage; \
    3333    tmpAverage = gfits_table_get_Average_##TYPE (ftable, Naverage, NULL); \
     34    if (!tmpAverage) { \
     35      fprintf (stderr, "ERROR: failed to read averages\n"); \
     36      exit (2); \
     37    } \
    3438    average = Average_##TYPE##_ToInternal (tmpAverage, *Naverage, primary); \
    3539    free (tmpAverage); \
     
    3943  if (!strcmp (extname, "DVO_AVERAGE")) {
    4044    average = gfits_table_get_Average (ftable, Naverage, NULL);
     45    if (!average) {
     46      fprintf (stderr, "ERROR: failed to read averages\n");
     47      exit (2);
     48    }
    4149    *format = DVO_FORMAT_INTERNAL;
    4250    return (average);
     
    111119    Measure_##TYPE *tmpMeasure; \
    112120    tmpMeasure = gfits_table_get_Measure_##TYPE (ftable, Nmeasure, NULL); \
     121    if (!tmpMeasure) { \
     122      fprintf (stderr, "ERROR: failed to read measures\n"); \
     123      exit (2); \
     124    } \
    113125    measure = Measure_##TYPE##_ToInternal (tmpMeasure, *Nmeasure); \
    114126    free (tmpMeasure); \
     
    118130  if (!strcmp (extname, "DVO_MEASURE")) {
    119131    measure = gfits_table_get_Measure (ftable, Nmeasure, NULL);
     132    if (!measure) {
     133      fprintf (stderr, "ERROR: failed to read measures\n");
     134      exit (2);
     135    }
    120136    *format = DVO_FORMAT_INTERNAL;
    121137    return (measure);
     
    190206    SecFilt_##TYPE *tmpSecFilt; \
    191207    tmpSecFilt = gfits_table_get_SecFilt_##TYPE (ftable, Nsecfilt, NULL); \
     208    if (!tmpSecFilt) { \
     209      fprintf (stderr, "ERROR: failed to read secfilts\n"); \
     210      exit (2); \
     211    } \
    192212    secfilt = SecFilt_##TYPE##_ToInternal (tmpSecFilt, *Nsecfilt); \
    193213    free (tmpSecFilt); \
     
    197217  if (!strcmp (extname, "DVO_SECFILT")) {
    198218    secfilt = gfits_table_get_SecFilt (ftable, Nsecfilt, NULL);
     219    if (!secfilt) {
     220      fprintf (stderr, "ERROR: failed to read secfilts\n");
     221      exit (2);
     222    }
    199223    *format = DVO_FORMAT_INTERNAL;
    200224    return (secfilt);
     
    263287    Image_Elixir *tmpimage;
    264288    tmpimage = gfits_table_get_Image_Elixir (ftable, &Nimage, NULL);
     289    if (!tmpimage) {
     290      fprintf (stderr, "ERROR: failed to read images\n");
     291      exit (2);
     292    }
    265293    ftable[0].buffer = (char *) Image_Elixir_ToInternal (tmpimage, Nimage);
    266294    free (tmpimage);
     
    284312    *format = DVO_FORMAT_##FORMAT; \
    285313    tmpimage = gfits_table_get_Image_##TYPE (ftable, &Nimage, NULL); \
     314    if (!tmpimage) { \
     315      fprintf (stderr, "ERROR: failed to read images\n"); \
     316      exit (2); \
     317    } \
    286318    ftable[0].buffer = (char *) Image_##TYPE##_ToInternal (tmpimage, Nimage); \
    287319    free (tmpimage); \
     
    296328    Image *image;
    297329    image = gfits_table_get_Image (ftable, &Nimage, NULL);
     330    if (!image) {
     331      fprintf (stderr, "ERROR: failed to read images\n");
     332      exit (2);
     333    }
    298334    *format = DVO_FORMAT_INTERNAL;
    299335    return (TRUE);
  • branches/eam_branches/ipp-20100621/Ohana/src/libdvo/src/skyregion_io.c

    r27435 r28721  
    4040  ALLOCATE (skytable, SkyTable, 1);
    4141  skytable[0].regions = gfits_table_get_SkyRegion (&ftable, &skytable[0].Nregions, NULL);
     42  if (!skytable[0].regions) {
     43    fprintf (stderr, "ERROR: failed to read sky regions\n");
     44    exit (2);
     45  }
     46
    4247  ALLOCATE (skytable[0].filename, char *, skytable[0].Nregions);
    4348  for (i = 0; i < skytable[0].Nregions; i++) {
Note: See TracChangeset for help on using the changeset viewer.