IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6642


Ignore:
Timestamp:
Mar 18, 2006, 5:26:07 PM (20 years ago)
Author:
eugene
Message:

added periodogram, tests, some minor bugs

Location:
trunk/Ohana/src/opihi
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/Makefile

    r5943 r6642  
    3030$(SDIR)/drizzle.$(ARCH).o          \
    3131$(SDIR)/flux.$(ARCH).o             \
     32$(SDIR)/fixwrap.$(ARCH).o          \
    3233$(SDIR)/gauss.$(ARCH).o            \
    3334$(SDIR)/getvel.$(ARCH).o           \
  • trunk/Ohana/src/opihi/cmd.astro/init.c

    r3144 r6642  
    1111int drizzle                 PROTO((int, char **));
    1212int flux                    PROTO((int, char **));
     13int fixwrap                 PROTO((int, char **));
    1314int gauss                   PROTO((int, char **));
    1415int gaussfit                PROTO((int, char **));
     
    4445  {"drizzle",     drizzle,      "transform image to image"},
    4546  {"flux",        flux,         "flux in a convex contour"},
     47  {"fixwrap",     fixwrap,      "fix megacam over-wrapped pixels"},
    4648  {"gauss",       gauss,        "get statistics on a star, assuming gaussian profile"},
    4749  {"getvel",      getvel,       "rotcurve to velocities"},
  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r5943 r6642  
    6868$(SDIR)/mset.$(ARCH).o          \
    6969$(SDIR)/peak.$(ARCH).o          \
     70$(SDIR)/periodogram.$(ARCH).o   \
    7071$(SDIR)/plot.$(ARCH).o          \
    7172$(SDIR)/dot.$(ARCH).o           \
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r5850 r6642  
    5353int mset             PROTO((int, char **));
    5454int peak             PROTO((int, char **));
     55int periodogram      PROTO((int, char **));
    5556int plot             PROTO((int, char **));
    5657int dot              PROTO((int, char **));
     
    160161  {"mset",         mset,             "insert a vector in a matrix"},
    161162  {"peak",         peak,             "find vector peak in range"},
     163  {"periodogram",  periodogram,      "measure periods in unevenly sampled data"},
    162164  {"plot",         plot,             "plot a pair of vectors"},
    163165  {"dot",          dot,              "plot a single point"},
  • trunk/Ohana/src/opihi/cmd.data/peak.c

    r4689 r6642  
    33int peak (int argc, char **argv) {
    44 
    5   int i, imax;
     5  int i, N, imax, QUIET;
    66  double start, end, xmax, ymax;
    77  float *X, *Y;
    88  Vector *vecx, *vecy;
    99
    10   if (argc != 5) {
    11     fprintf (stderr, "USAGE: peak <x> <y> start end\n");
     10  QUIET = FALSE;
     11  if ((N = get_argument (argc, argv, "-q"))) {
     12    QUIET = TRUE;
     13    remove_argument (N, &argc, argv);
     14  }
     15
     16  if ((argc != 5) && (argc != 3)) {
     17    fprintf (stderr, "USAGE: peak <x> <y> [start end]\n");
    1218    return (FALSE);
    1319  }
     
    1622  if ((vecy = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    1723
    18   start = atof (argv[3]);
    19   end   = atof (argv[4]);
     24  if (argc == 5) {
     25    start = atof (argv[3]);
     26    end   = atof (argv[4]);
     27  } else {
     28    start = vecx[0].elements[0];
     29    end   = vecx[0].elements[vecx[0].Nelements - 1];
     30  }
    2031
    2132  X = vecx[0].elements;
     
    3950  set_variable ("peaknum", imax);
    4051
    41   fprintf (stderr, "peak %f @ %f (%d)\n", ymax, xmax, imax);
     52  if (!QUIET) fprintf (GetOutfile(), "peak %f @ %f (%d)\n", ymax, xmax, imax);
    4253
    4354  return (TRUE);
    4455}
    45 
  • trunk/Ohana/src/opihi/cmd.data/write_vectors.c

    r2843 r6642  
    4141  for (i = 0; i < Nvec; i++) {
    4242    if ((vec[i] = SelectVector (argv[i + 2], OLDVECTOR, FALSE)) == NULL) {
     43      fprintf (stderr, "unknown vector %s\n", argv[i+2]);
    4344      fprintf (stderr, "USAGE: write (file) vector vector ...\n");
    4445      free (vec);
  • trunk/Ohana/src/opihi/dvo/avextract.c

    r5945 r6642  
    1818  RegionName = NULL;
    1919  RegionList = NULL;
     20  skylist = NULL;
    2021  code = NULL;
    2122  mode = MAG_AVE;
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r5945 r6642  
    99  double Mcat, Mrel;
    1010  float *RA, *DEC;
    11   int i, j, k, m, N, *N1, Nsec, NPTS;
     11  int i, j, k, m, N, *N1, Nsec, NPTS, QUIET;
    1212  int Nstars, found, GetMeasures, Nlo, Nhi;
    1313  int SaveVectors;
     
    1717  Catalog catalog;
    1818  PhotCode *code;
     19  int TimeFormat;
     20  time_t TimeReference;
    1921
    2022  if (!InitPhotcodes ()) return (FALSE);
    2123  Nsec = GetPhotcodeNsecfilt ();
     24
     25  QUIET = FALSE;
     26  if ((N = get_argument (argc, argv, "-q"))) {
     27    QUIET = TRUE;
     28    remove_argument (N, &argc, argv);
     29  }
    2230
    2331  NPTS = 0;
     
    4452  }
    4553 
     54  GetTimeFormat (&TimeReference, &TimeFormat);
     55
    4656  Ra = atof (argv[1]);
    4757  Dec = atof (argv[2]);
     
    127137    if (r < Radius2) {
    128138      k = N1[i];
    129       fprintf (GetOutfile(), "star: %d\n", k);
    130       fprintf (GetOutfile(), "%9.5f %9.5f %3d of %3d  %4.1f %5d\n", catalog.average[k].R_PS, catalog.average[k].D_PS,
    131                catalog.average[k].Nm, catalog.average[k].Nn + catalog.average[k].Nm,
    132                0.01*catalog.average[k].Xp, catalog.average[k].code);
     139      if (!QUIET) {
     140          fprintf (GetOutfile(), "star: %d\n", k);
     141          fprintf (GetOutfile(), "%9.5f %9.5f %3d of %3d  %4.1f %5d\n", catalog.average[k].R_PS, catalog.average[k].D_PS,
     142                   catalog.average[k].Nm, catalog.average[k].Nn + catalog.average[k].Nm,
     143                   0.01*catalog.average[k].Xp, catalog.average[k].code);
    133144     
    134       /* filter names -- primary code is 0 in this function */
    135       for (j = 0; j < Nsec + 1; j++) {
    136         code = GetPhotcodebyNsec (j);
    137         fprintf (GetOutfile (), "%s ", code[0].name);
     145          /* filter names -- primary code is 0 in this function */
     146          for (j = 0; j < Nsec + 1; j++) {
     147              code = GetPhotcodebyNsec (j);
     148              fprintf (GetOutfile (), "%s ", code[0].name);
     149          }
     150          fprintf (GetOutfile (), "\n");
     151
     152          /* average mags */
     153          print_value (GetOutfile(), catalog.average[k].M_PS, catalog.average[k].M_PS);
     154          for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].M_PS, catalog.secfilt[j + Nsec*k].M_PS);
     155          fprintf (GetOutfile(), "\n");
     156
     157          /* average mag errors */
     158          print_value (GetOutfile(), catalog.average[k].dM_PS, catalog.average[k].dM_PS);
     159          for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].dM_PS, catalog.secfilt[j + Nsec*k].dM_PS);
     160          fprintf (GetOutfile(), "\n");
     161
     162          /* average mag chisq */
     163          print_value (GetOutfile(), pow (10.0, 0.01*catalog.average[k].Xm), catalog.average[k].Xm);
     164          for (j = 0; j < Nsec; j++) print_value (GetOutfile(), pow (10.0, 0.01*catalog.secfilt[j + Nsec*k].Xm), catalog.secfilt[j + Nsec*k].Xm);
     165          fprintf (GetOutfile(), "\n");
    138166      }
    139       fprintf (GetOutfile (), "\n");
    140 
    141       /* average mags */
    142       print_value (GetOutfile(), catalog.average[k].M_PS, catalog.average[k].M_PS);
    143       for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].M_PS, catalog.secfilt[j + Nsec*k].M_PS);
    144       fprintf (GetOutfile(), "\n");
    145 
    146       /* average mag errors */
    147       print_value (GetOutfile(), catalog.average[k].dM_PS, catalog.average[k].dM_PS);
    148       for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].dM_PS, catalog.secfilt[j + Nsec*k].dM_PS);
    149       fprintf (GetOutfile(), "\n");
    150 
    151       /* average mag chisq */
    152       print_value (GetOutfile(), pow (10.0, 0.01*catalog.average[k].Xm), catalog.average[k].Xm);
    153       for (j = 0; j < Nsec; j++) print_value (GetOutfile(), pow (10.0, 0.01*catalog.secfilt[j + Nsec*k].Xm), catalog.secfilt[j + Nsec*k].Xm);
    154       fprintf (GetOutfile(), "\n");
    155167
    156168      if (GetMeasures || SaveVectors) {
     
    161173          Mrel = PhotRel (&catalog.measure[m], &catalog.average[k], &catalog.secfilt[k*Nsec]);
    162174
    163           if (GetMeasures) {
     175          if (GetMeasures && !QUIET) {
    164176            date = sec_to_date (catalog.measure[m].t);
    165177            fprintf (GetOutfile(), "%6.3f %6.3f %5.3f  %20s  %5.2f %5.2f %2d %3x %3d %-20s\n",
     
    173185          if (SaveVectors) {
    174186            vec1[0].elements[N] = Mcat;
    175             vec2[0].elements[N] = catalog.measure[m].t;
     187            vec2[0].elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
    176188            vec3[0].elements[N] = catalog.measure[m].airmass_PS;
    177189            vec4[0].elements[N] = catalog.measure[m].source;
  • trunk/Ohana/src/opihi/test/tests.sh

    r6266 r6642  
    11
    22list testdir
     3  cmd.data/test
    34  cmd.basic/test
    45end
     6
     7$VERBOSE = 0
    58
    69macro fulltests
     
    1518
    1619  for Ti 0 $testdir:n
     20    if ($VERBOSE > 0)
     21       echo "directory $testdir:$Ti"
     22    end
    1723    list testscripts -x "ls $testdir:$Ti/*.sh"
    1824    for Tj 0 $testscripts:n
     25      if ($VERBOSE > 1)
     26         echo " running $testscripts:$Tj"
     27      end
    1928      input $testscripts:$Tj
    2029      for Tk 0 $tests:n
    21         # echo running $tests:$Tk
     30        if ($VERBOSE > 2)
     31          echo "   running $tests:$Tk"
     32        end
    2233        $tests:$Tk
    2334        if ($PASS == 0)
    24           echo "failed test $tests:$Tk"
     35          echo "   ** failed test $tests:$Tk"
    2536          $Nfail ++
    2637          $n = $failtest:n
     
    3243          $faildirs:n ++
    3344        else
    34           # echo "passed $tests:$Tk"
    3545          $Npass ++
    3646        end
Note: See TracChangeset for help on using the changeset viewer.