IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38548


Ignore:
Timestamp:
Jun 25, 2015, 4:28:38 PM (11 years ago)
Author:
eugene
Message:

fix the flags (two possible output modes with OBJ lensing parameters at the end or the middle)

Location:
branches/eam_branches/ipp-20150616/Ohana/src/libdvo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150616/Ohana/src/libdvo/include/cmf-ps1-v5-r2-lensing.h

    r37993 r38548  
    9595
    9696CMF_PS1_V5_R2_Lensing *gfits_table_get_CMF_PS1_V5_R2_Lensing (FTable *table, off_t *Ndata, char *swapped);
     97CMF_PS1_V5_R2_Lensing *gfits_table_get_CMF_PS1_V5_R2x_Lensing (FTable *ftable, off_t *Ndata, char *swapped);
     98
    9799int      gfits_table_set_CMF_PS1_V5_R2_Lensing (FTable *ftable, CMF_PS1_V5_R2_Lensing *data, off_t Ndata);
    98100int      gfits_table_mkheader_CMF_PS1_V5_R2_Lensing (Header *header);
  • branches/eam_branches/ipp-20150616/Ohana/src/libdvo/src/cmf-ps1-v5-r2-lensing.c

    r37992 r38548  
    480480}
    481481
     482/** ****/
     483int fix_lensing (char *data, int Nrows) {
     484
     485  off_t i;
     486
     487  int Nbytes = sizeof (CMF_PS1_V5_R2_Lensing);
     488
     489  char buffer[64];
     490
     491  char *ptr = data;
     492  for (i = 0; i < Nrows; i++, ptr += Nbytes) {
     493    // bytes 184 - 224 (exclusive) are now at 288 - 328 (exclusive)
     494    memcpy (buffer, &ptr[288], 40);
     495    memmove (&ptr[224], &ptr[184], 104);
     496    memcpy (&ptr[184], buffer, 40);
     497  }
     498  return TRUE;
     499}
     500
     501/**************************************/
     502CMF_PS1_V5_R2_Lensing *gfits_table_get_CMF_PS1_V5_R2x_Lensing (FTable *ftable, off_t *Ndata, char *swapped) {
     503
     504  int Ncols;
     505  CMF_PS1_V5_R2_Lensing *data;
     506
     507  Ncols = ftable[0].header[0].Naxis[0];
     508  if (Ncols != ST_SIZE) {
     509    fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, ST_SIZE);
     510    return NULL;
     511  }
     512
     513  *Ndata = ftable[0].header[0].Naxis[1];
     514
     515  fix_lensing (ftable[0].buffer, *Ndata);
     516  data = (CMF_PS1_V5_R2_Lensing *) ftable[0].buffer;
     517  if ((swapped == NULL) || (*swapped == FALSE)) {
     518    if (!gfits_convert_CMF_PS1_V5_R2_Lensing ((unsigned char *) data, sizeof (CMF_PS1_V5_R2_Lensing), *Ndata, TRUE)) {
     519      return NULL;
     520    }
     521    off_t i;
     522    for (i = 0; i < *Ndata; i++) {
     523      data[i].detID   += 0x80000000;
     524      data[i].flags   += 0x80000000;
     525      data[i].flags2  += 0x80000000;
     526      data[i].nFrames += 0x8000;
     527    }
     528    // gfits_table_scale_data (ftable);
     529    if (swapped != NULL) *swapped = TRUE;
     530  }
     531  return (data);
     532}
     533
Note: See TracChangeset for help on using the changeset viewer.