IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37574


Ignore:
Timestamp:
Nov 10, 2014, 8:33:44 AM (12 years ago)
Author:
eugene
Message:

updates to handle new format from Eddie

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/load_zpt_table.c

    r33654 r37574  
    173173      mjdstart = tstart_uc[i];
    174174      mjdstop  = tstop_uc[i];
    175   } else {
     175    } else {
    176176      char name[9];
    177       snprintf (name, 9, "TS0_%04d", i);
     177      // snprintf (name, 9, "TS0_%04d", i);
     178      snprintf (name, 9, "S0_MJD%d", i);
    178179      if (!gfits_scan (&header, name, "%lf", 1, &mjdstart)) {
    179180        fprintf (stderr, "cannot find %s in header of %s\n", name, filename);
     
    182183      }
    183184
    184       snprintf (name, 9, "TS1_%04d", i);
     185      // snprintf (name, 9, "TS1_%04d", i);
     186      snprintf (name, 9, "S1_MJD%d", i);
    185187      if (!gfits_scan (&header, name, "%lf", 1, &mjdstop)) {
    186188        fprintf (stderr, "cannot find %s in header of %s\n", name, filename);
     
    189191      }
    190192    }
    191     flatcorrTable->tstart[i] = ohana_mjd_to_sec(mjdstart);
    192     flatcorrTable->tstop[i]  = ohana_mjd_to_sec(mjdstop);
     193    flatcorrTable->tstart[i] = (mjdstart > 0) ? ohana_mjd_to_sec(mjdstart) : ohana_mjd_to_sec(50000.0); // 1995/10/10 (ancient history)
     194    flatcorrTable->tstop[i]  = (mjdstop  > 0) ? ohana_mjd_to_sec(mjdstop)  : ohana_mjd_to_sec(60000.0); // 2023/02/25 (infinite future)
    193195  }
    194196
     
    247249    } else {
    248250      if (!gfits_scan (&header, "FILTER", "%s", 1, filter)) {
    249         fprintf (stderr, "cannot find FILTER in header of %s\n", filename);
    250         fclose (f);
    251         return NULL;
     251        fprintf (stderr, "cannot find FILTER in header of %s, using %s\n", filename, filters_uc[nfilter]);
     252        strcpy (filter, filters_uc[nfilter]);
     253        // fclose (f);
     254        // return NULL;
    252255      }
    253256    }
     
    278281      REALLOCATE (offset64, double, matrix.Naxis[0]);
    279282      matrix.buffer = (char *) offset64;
     283    }
     284    if (matrix.Naxes == 1) {
     285      int Ntotal = NSEASON*NCHIP_X*NCHIP_Y*NCELL_X*NCELL_Y;
     286      if (matrix.Naxis[0] != Ntotal) {
     287        int Nextra = Ntotal - matrix.Naxis[0];
     288        assert (Nextra >= 0);
     289        fprintf (stderr, "warning: images are not fully populated, extending by %d\n", Nextra);
     290       
     291        REALLOCATE (offset64, double, Ntotal);
     292        int npix;
     293        for (npix = matrix.Naxis[0]; npix < Ntotal; npix ++) offset64[npix] = 0.0;
     294
     295        matrix.Naxis[0] = Ntotal;
     296        matrix.buffer = (char *) offset64;
     297      }
    280298    }
    281299
Note: See TracChangeset for help on using the changeset viewer.