IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 14, 2021, 11:02:20 AM (5 years ago)
Author:
eugene
Message:

add code to rationalize the zero points on each pass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relphot/src/TGroupOps.c

    r41647 r41662  
    13651365}
    13661366
     1367double get_median_zpt_tgroups (short photcode) {
     1368
     1369  double *mlist;
     1370
     1371  if (!TGROUP_ZEROPT) return NAN;
     1372
     1373  ALLOCATE (mlist, double, NtgroupTimes);
     1374
     1375  int N = 0;
     1376  for (int i = 0; i < NtgroupTimes; i++) {
     1377    TGroup *tgroup = tgroupTimes[i][0].byCode;
     1378    for (int j = 0; j < tgroupTimes[i][0].nCode; j++) {
     1379      if (tgroup[j].photcode != photcode) continue;
     1380      if (!(tgroup[j].flags & ID_IMAGE_TGROUP_PHOTCAL)) continue;
     1381      mlist[N] = tgroup[j].McalPSF;
     1382      N++;
     1383    }
     1384  }
     1385
     1386  if (N == 0) {
     1387    free (mlist);
     1388    return NAN;
     1389  }
     1390
     1391  StatType stats;
     1392  liststats_setmode (&stats, "MEAN");
     1393
     1394  liststats (mlist, NULL, NULL, N, &stats);
     1395  free (mlist);
     1396
     1397  return stats.median;
     1398}
     1399
     1400void set_median_zpt_tgroups (short photcode, double zpt) {
     1401
     1402  if (!TGROUP_ZEROPT) return;
     1403  if (!isfinite(zpt)) return; // do not break the zero points
     1404
     1405  for (int i = 0; i < NtgroupTimes; i++) {
     1406    TGroup *tgroup = tgroupTimes[i][0].byCode;
     1407    for (int j = 0; j < tgroupTimes[i][0].nCode; j++) {
     1408      if (tgroup[j].photcode != photcode) continue;
     1409      tgroup[j].McalPSF -= zpt;
     1410      tgroup[j].McalAPER -= zpt;
     1411    }
     1412  }
     1413  return;
     1414}
     1415
    13671416void plot_tgroup_fields (Catalog *catalog) {
    13681417
Note: See TracChangeset for help on using the changeset viewer.