IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4679


Ignore:
Timestamp:
Jul 30, 2005, 9:13:10 AM (21 years ago)
Author:
eugene
Message:

more photselection modifications

Location:
trunk/Ohana/src/opihi/dvo
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/ccd.c

    r4606 r4679  
    88  int i, m, k, Npts, NPTS, N;
    99  int N1, N2, i1, i2, mode[4];
    10   int Ngraph, Nsec, Nregions;
     10  int Ngraph, Nsec, Nregions, KeepNulls;
    1111
    1212  Catalog catalog;
     
    3333  if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape;
    3434  if (!SetPhotSelections (&argc, argv, 4)) goto usage;
     35
     36  KeepNulls = FALSE;
     37  if (N = get_argument (argc, argv, "-nulls")) {
     38    KeepNulls = TRUE;
     39    remove_argument (N, &argc, argv);
     40  }
    3541
    3642  /* interpret command-line options */
     
    8288      SetSelectionParam (2);
    8389      M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N2);
    84       if (N2 == 0) goto skip;
     90      if (N2 == 0) {
     91        if (KeepNulls) {
     92          ALLOCATE (M2, double, 1);
     93          N2 = 1;
     94          M2[0] = NO_MAG;
     95        } else {
     96          goto skip;
     97        }
     98      }
    8599
    86100      for (i1 = 0; i1 < N1; i1++) {
  • trunk/Ohana/src/opihi/dvo/cmd.c

    r4606 r4679  
    77  int i, j, m, i1, i3, N1, N3, N;
    88  int Npts, NPTS, mode[3];
    9   int Ngraph, Nsec, Nregions;
     9  int Ngraph, Nsec, Nregions, KeepNulls;
    1010
    1111  Catalog catalog;
     
    3333  if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape;
    3434  if (!SetPhotSelections (&argc, argv, 3)) goto usage;
     35
     36  KeepNulls = FALSE;
     37  if (N = get_argument (argc, argv, "-nulls")) {
     38    KeepNulls = TRUE;
     39    remove_argument (N, &argc, argv);
     40  }
    3541
    3642  /* interpret command-line options */
     
    8086      SetSelectionParam (2);
    8187      M3 = ExtractMagnitudes (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N3);
    82       if (N3 == 0) goto skip;
     88      if (N3 == 0) {
     89        if (KeepNulls) {
     90          ALLOCATE (M3, double, 1);
     91          N3 = 1;
     92          M3[0] = NO_MAG;
     93        } else {
     94          goto skip;
     95        }
     96      }
    8397
    8498      for (i1 = 0; i1 < N1; i1++) {
  • trunk/Ohana/src/opihi/dvo/ddmags.c

    r4606 r4679  
    66  double Radius;
    77  double *M1, *M2;
    8   int i, m, k, Npts, NPTS;
     8  int i, m, k, N, Npts, NPTS;
    99  int N1, N2, i1, i2, mode[4];
    10   int Ngraph, Nsec, Nregions;
     10  int Ngraph, Nsec, Nregions, KeepNulls;
    1111
    1212  Catalog catalog;
     
    3333  if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape;
    3434  if (!SetPhotSelections (&argc, argv, 4)) goto usage;
     35
     36  KeepNulls = FALSE;
     37  if (N = get_argument (argc, argv, "-nulls")) {
     38    KeepNulls = TRUE;
     39    remove_argument (N, &argc, argv);
     40  }
    3541
    3642  /* interpret command-line options */
     
    8288      SetSelectionParam (2);
    8389      M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N2);
    84       if (N2 == 0) goto skip;
     90      if (N2 == 0) {
     91        if (KeepNulls) {
     92          ALLOCATE (M2, double, 1);
     93          N2 = 1;
     94          M2[0] = NO_MAG;
     95        } else {
     96          goto skip;
     97        }
     98      }
    8599
    86100      for (i1 = 0; i1 < N1; i1++) {
  • trunk/Ohana/src/opihi/dvo/dmagaves.c

    r4606 r4679  
    2121  RegionName = NULL;
    2222  RegionList = NULL;
     23  code[2] = NULL;
    2324
    2425  /* load photcode information */
  • trunk/Ohana/src/opihi/dvo/dmagmeas.c

    r4606 r4679  
    77  int i, j, k, m, i1, i3, N1, N3, N;
    88  int Npts, NPTS, param, mode[3];
    9   int Ngraph, Nsec, Nregions;
     9  int Ngraph, Nsec, Nregions, KeepNulls;
    1010
    1111  Catalog catalog;
     
    3333  if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape;
    3434  if (!SetPhotSelections (&argc, argv, 3)) goto usage;
     35
     36  KeepNulls = FALSE;
     37  if (N = get_argument (argc, argv, "-nulls")) {
     38    KeepNulls = TRUE;
     39    remove_argument (N, &argc, argv);
     40  }
    3541
    3642  /* interpret command-line arguments: dmagmeas F1 - F2 : (value) */
     
    8187      SetSelectionParam (2);
    8288      M3 = ExtractMeasures (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N3, param);
    83       if (N3 == 0) goto skip;
     89      if (N3 == 0) {
     90        if (KeepNulls) {
     91          ALLOCATE (M3, double, 1);
     92          N3 = 1;
     93          M3[0] = NO_MAG;
     94        } else {
     95          goto skip;
     96        }
     97      }
    8498
    8599      for (i1 = 0; i1 < N1; i1++) {
  • trunk/Ohana/src/opihi/dvo/dmags.c

    r4585 r4679  
    77  int i, j, m, i1, i3, N1, N3, N;
    88  int Npts, NPTS, mode[3];
    9   int Nsec, Nregions;
     9  int Nsec, Nregions, KeepNulls;
    1010
    1111  PhotCode *code[3];
     
    3333  if (!SetPhotSelections (&argc, argv, 3)) goto usage;
    3434
     35  KeepNulls = FALSE;
     36  if (N = get_argument (argc, argv, "-nulls")) {
     37    KeepNulls = TRUE;
     38    remove_argument (N, &argc, argv);
     39  }
     40
    3541  /* interpret required command-line arguments: dmags F1 - F2 : F3 */
    3642  if (argc != 6) { goto usage; }
     
    4046  if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) goto usage;
    4147  if (!GetPhotcodeInfo (argv[5], &code[2], &mode[2])) goto usage;
    42   if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape;
     48  if (!TestPhotSelections (&code[0], &mode[0], MEAS_ZERO)) goto escape;
    4349
    4450  /* load region corresponding to selection above */
     
    7985      SetSelectionParam (2);
    8086      M3 = ExtractMagnitudes (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec], &catalog.measure[m], &N3);
    81       if (N3 == 0) goto skip;
     87      if (N3 == 0) {
     88        if (KeepNulls) {
     89          ALLOCATE (M3, double, 1);
     90          N3 = 1;
     91          M3[0] = NO_MAG;
     92        } else {
     93          goto skip;
     94        }
     95      }
    8296
    8397      for (i1 = 0; i1 < N1; i1++) {
  • trunk/Ohana/src/opihi/dvo/photometry.c

    r4606 r4679  
    244244  if (!strcasecmp (parname, "Nphot")) param = AVE_NPHOT;
    245245  if (!strcasecmp (parname, "Ncode")) param = AVE_NCODE;
     246  if (!strcasecmp (parname, "Ncrit")) param = AVE_NCRIT;
    246247  return (param);
    247248}
     
    250251int TestPhotSelections (PhotCode **code, int *mode, int param) {
    251252
    252   int NeedPhotcode;
     253  int NeedPhotcode, Needcode;
    253254
    254255  /* if i've supplied a photcode (code != NULL), i'm not allowed to restrict it */
     
    262263  }
    263264
    264   /* if I have an average or ensemble restriction, I must have a photcode */
     265  /* for measure tests, supply MEAS_ZERO */
     266
     267  /* if I have an average or ensemble restriction, I must have a PRI/SEC photcode */
    265268  NeedPhotcode = FALSE;
    266269  NeedPhotcode |= ChiSelect;
    267270  NeedPhotcode |= NphotSelect;
    268   NeedPhotcode |= NcodeSelect;
    269271  NeedPhotcode |= ErrSelect;
    270272  NeedPhotcode |= TypeSelect;
    271273  NeedPhotcode |= TypefracSelect;
    272274 
    273   /* for measure tests, supply MEAS_ZERO */
    274275  NeedPhotcode |= (param == AVE_Xm);
    275276  NeedPhotcode |= (param == AVE_MAG);
     
    277278  NeedPhotcode |= (param == AVE_TYPE);
    278279  NeedPhotcode |= (param == AVE_NPHOT);
    279   NeedPhotcode |= (param == AVE_NCODE);
    280 
    281   if (NeedPhotcode || PhotcodeSelect) {
    282     if (!PhotcodeSelect) return (FALSE);
     280  Needcode = (param == AVE_NCODE);
     281
     282  if (NeedPhotcode || Needcode || NcodeSelect || PhotcodeSelect) {
     283    if (!PhotcodeSelect) {
     284      fprintf (stderr, "photcode selection problem: value requires photcode\n");
     285      return (FALSE);
     286    }
    283287    code[0] = PhotcodeValue;
    284288    mode[0] = PhotcodeMode;
    285     if (code[0][0].type == PHOT_DEP) return (FALSE);
    286     if (code[0][0].type == PHOT_REF) return (FALSE);
     289  }
     290  if (NeedPhotcode) {
     291    if (code[0][0].type == PHOT_PRI) return (TRUE);
     292    if (code[0][0].type == PHOT_SEC) return (TRUE);
     293    fprintf (stderr, "photcode selection problem: average value requires PRI/SEC photcode\n");
     294    return (FALSE);
    287295  }
    288296  return (TRUE);
     
    615623      value = 0;
    616624      for (i = 0; i < average[0].Nm; i++) {
    617         if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].source)) continue;
     625        if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].source))) continue;
    618626        if (ErrSelect && (measure[i].dM > ErrValue)) continue;
    619627        if (FlagSelect && (measure[i].flags != FlagValue)) continue;
     
    738746  if (code == NULL) return (FALSE);
    739747
    740   /* only PRI/SEC photcodes apply the filter */
    741   if (code[0].type == PHOT_DEP) return (TRUE);
    742   if (code[0].type == PHOT_REF) return (TRUE);
    743 
    744   /* exclusions based on average.params  */
    745   if (ChiSelect) {
    746     Xm = PhotXm (code, average, secfilt);
    747     if (Xm == -1) return (FALSE);
    748     if (Xm > ChiLimit) return (FALSE);
    749   }
    750  
    751   /* for ErrSelect, check average errors */
    752   if (ErrSelect) {
    753     dM = iPhotdM (code, average, secfilt);
    754     if (dM > ErrValue) return (NO_MAG);
    755   }
    756  
    757748  /* for NcodeSelect, count Nmeas for appropriate photcode */
    758749  if (NcodeSelect) {
     
    777768  }
    778769
     770  /* only PRI/SEC photcodes apply the filter */
     771  if (code[0].type == PHOT_DEP) return (TRUE);
     772  if (code[0].type == PHOT_REF) return (TRUE);
     773
     774  /* exclusions based on average.params  */
     775  if (ChiSelect) {
     776    Xm = PhotXm (code, average, secfilt);
     777    if (Xm == -1) return (FALSE);
     778    if (Xm > ChiLimit) return (FALSE);
     779  }
     780 
     781  /* for ErrSelect, check average errors */
     782  if (ErrSelect) {
     783    dM = iPhotdM (code, average, secfilt);
     784    if (dM > ErrValue) return (NO_MAG);
     785  }
     786 
    779787  /* for NphotSelect, count Nmeas for appropriate photcode */
    780788  if (NphotSelect) {
Note: See TracChangeset for help on using the changeset viewer.