IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 22, 2011, 12:33:45 AM (15 years ago)
Author:
eugene
Message:

merged from eam_branches/ipp-20110505: allow managed memory (with linked list a la psLib); add csv to mana; allow read-only dvo databases

Location:
trunk/Ohana/src/libdvo
Files:
4 edited

Legend:

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

    r31635 r31663  
    7878# define LOAD_MISS      0x04
    7979# define LOAD_SECF      0x08
    80 # define LOAD_MEAS_META 0x10
     80# define SKIP_AVES      0x10
     81# define SKIP_MEAS      0x20
     82# define SKIP_MISS      0x40
     83# define SKIP_SECF      0x80
     84
     85// # define LOAD_MEAS_META 0x100 -- is this used??
    8186
    8287/* photometry code types */
  • trunk/Ohana/src/libdvo/src/coordops.c

    r29001 r31663  
    440440int GetCoords (Coords *coords, Header *header) {
    441441 
    442   int status, itmp, Polynomial, Polyterm;
    443   double Lambda, rotate, scale;
     442  int status, status1, status2, itmp, Polynomial, Polyterm;
     443  double Lambda, rotate, rotate1, rotate2, scale;
    444444  double equinox;
    445445  char *ctype;
     
    456456  mode = COORD_TYPE_NONE;
    457457  {   
    458     int haveCTYPE, haveCDELT, haveCROTA, haveCDij, havePCij, haveRAo;
     458    int haveCTYPE, haveCDELT, haveCROTA, haveCROTA1, haveCROTA2, haveCDij, havePCij, haveRAo;
    459459    float tmp;
    460460    char stmp[80];
     
    463463    // set: (CDELTi + CROTAi), (CDELTi + PCij), (CDij),
    464464
    465     haveCTYPE = gfits_scan (header, "CTYPE2",   "%s", 1, stmp);
    466     haveCDELT = gfits_scan (header, "CDELT1",   "%f", 1, &tmp);
    467     haveCROTA = gfits_scan (header, "CROTA1",   "%f", 1, &tmp);
    468     haveCDij  = gfits_scan (header, "CD1_1",    "%f", 1, &tmp);
    469     havePCij  = gfits_scan (header, "PC001001", "%f", 1, &tmp);
    470     haveRAo   = gfits_scan (header, "RA_O",     "%f", 1, &tmp);
     465    haveCTYPE  = gfits_scan (header, "CTYPE2",   "%s", 1, stmp);
     466    haveCDELT  = gfits_scan (header, "CDELT1",   "%f", 1, &tmp);
     467    haveCROTA1 = gfits_scan (header, "CROTA1",   "%f", 1, &tmp);
     468    haveCROTA2 = gfits_scan (header, "CROTA2",   "%f", 1, &tmp);
     469    haveCDij   = gfits_scan (header, "CD1_1",    "%f", 1, &tmp);
     470    havePCij   = gfits_scan (header, "PC001001", "%f", 1, &tmp);
     471    haveRAo    = gfits_scan (header, "RA_O",     "%f", 1, &tmp);
    471472   
     473    haveCROTA = haveCROTA1 || haveCROTA2;
     474
    472475    if (haveCTYPE && havePCij  && haveCDELT) { mode = COORD_TYPE_PC;   goto gotit; }
    473476    if (haveCTYPE && haveCROTA && haveCDELT) { mode = COORD_TYPE_ROT;  goto gotit; }
     
    540543      status &= gfits_scan (header, "CDELT2", "%f", 1, &coords[0].cdelt2);
    541544
    542       status &= gfits_scan (header, "CROTA2", "%lf", 1, &rotate);
     545      status1 = gfits_scan (header, "CROTA1", "%lf", 1, &rotate1);
     546      status2 = gfits_scan (header, "CROTA2", "%lf", 1, &rotate2);
     547      status &= status1 || status2;
     548
     549      rotate = rotate2;
     550      if (status1 && !status2) rotate = rotate1;
     551      if (!status1 && !status2) rotate = 0.0;
     552
    543553      Lambda = coords[0].cdelt2 / coords[0].cdelt1;
    544554      coords[0].pc1_1 =  cos(rotate*RAD_DEG);
  • trunk/Ohana/src/libdvo/src/dvo_catalog.c

    r29938 r31663  
    9090  catalog[0].secfilt = NULL;
    9191 
     92  catalog[0].averageT = NULL;
     93  catalog[0].measureT = NULL;
     94
    9295  catalog[0].objID = 0;
    9396  catalog[0].catID = 0;
  • trunk/Ohana/src/libdvo/src/dvo_catalog_split.c

    r31450 r31663  
    172172  header.buffer = NULL;
    173173  primary = NULL;
     174  status = FALSE;
    174175
    175176  /* get the components from the header - these duplicate information in the split files (NAXIS2) */
     
    239240
    240241  /*** Measure Table ***/
    241   status = dvo_catalog_open_subcat (catalog, &catalog[0].measure_catalog, ftable.header, "MEASURE", VERBOSE);
    242   if (status == DVO_CAT_OPEN_FAIL) {
    243     return (FALSE);
    244   }
    245   if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nmeas_disk > 0)) {
    246     return (FALSE);
     242  if (!(catalog[0].catflags & SKIP_MEAS)) {
     243    // unless we specify 'skip', we still need to load the
     244    status = dvo_catalog_open_subcat (catalog, &catalog[0].measure_catalog, ftable.header, "MEASURE", VERBOSE);
     245    if (status == DVO_CAT_OPEN_FAIL) {
     246      return (FALSE);
     247    }
     248    if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nmeas_disk > 0)) {
     249      return (FALSE);
     250    }
    247251  }
    248252  if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_MEAS)) {
     
    262266  } else {
    263267    // XXX is it necessary to generate a template header here?
     268    // XXX this is a memory leak, right?
     269    if (catalog[0].measure_catalog) {
     270      gfits_free_header (&catalog[0].measure_catalog[0].header);
     271    } else {
     272      ALLOCATE (catalog[0].measure_catalog, Catalog, 1);
     273      dvo_catalog_init (catalog[0].measure_catalog, TRUE);
     274    }
    264275    gfits_create_header (&catalog[0].measure_catalog[0].header);
    265276    ALLOCATE (catalog[0].measure, Measure, 1);
Note: See TracChangeset for help on using the changeset viewer.