IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 11, 2021, 11:38:34 AM (5 years ago)
Author:
eugene
Message:

fix the fixhsc support functions

Location:
branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/load_images_fixhsc.c

    r41802 r41835  
    3838    // the rule is the new base photcode
    3939    // this is robust against multiple passes
    40     short chipcode = 1000 * (int)(photcode / 1000);
     40    short chipcode = photcode % 200;
    4141
    4242    short newcode  = newbase + chipcode;
  • branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/load_rules_fixhsc.c

    r41802 r41835  
    22
    33static int    Nrule = 0;
    4 static double *startRule     = NULL;
    5 static double *stopRule      = NULL;
     4static e_time *startRule     = NULL;
     5static e_time *stopRule      = NULL;
    66static int    *photbaseRule  = NULL;
    77
     
    1616  int NRULE = 10000;
    1717
    18   ALLOCATE_PTR (startRule, double, NRULE);
    19   ALLOCATE_PTR (stopRule,  double, NRULE);
    20   ALLOCATE_PTR (photbaseRule, int, NRULE);
     18  ALLOCATE (startRule, e_time, NRULE);
     19  ALLOCATE (stopRule,  e_time, NRULE);
     20  ALLOCATE (photbaseRule, int, NRULE);
    2121
    22   while (fscanf (f, "%lf %lf %d", &startRule[Nrule], &stopRule[Nrule], &photbaseRule[Nrule]) != EOF) {
     22  double startMJD, stopMJD;
     23
     24  // rules are in MJD, convert to e_time values
     25  while (fscanf (f, "%lf %lf %d", &startMJD, &stopMJD, &photbaseRule[Nrule]) != EOF) {
     26
     27    startRule[Nrule] = ohana_mjd_to_sec (startMJD);
     28    stopRule[Nrule]  = ohana_mjd_to_sec (stopMJD);
    2329    Nrule ++;
    2430
    2531    if (Nrule >= NRULE) {
    2632      NRULE += 10000;
    27       REALLOCATE (startRule, double, NRULE);
    28       REALLOCATE (stopRule,  double, NRULE);
     33      REALLOCATE (startRule, e_time, NRULE);
     34      REALLOCATE (stopRule,  e_time, NRULE);
    2935      REALLOCATE (photbaseRule, int, NRULE);
    3036    }
  • branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/update_catalog_fixhsc.c

    r41802 r41835  
    1111    if (!newbase) continue;
    1212   
    13     short photcode = catalog[0].measure[i].photcode;
     13    unsigned short photcode = catalog[0].measure[i].photcode;
    1414
    1515    // the rule is the new base photcode
    1616    // this is robust against multiple passes
    17     short chipcode = 1000 * (int)(photcode / 1000);
     17    short chipcode = photcode % 200;
    1818
    1919    short newcode  = newbase + chipcode;
Note: See TracChangeset for help on using the changeset viewer.