IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 11, 2017, 10:10:18 AM (9 years ago)
Author:
eugene
Message:

add floating-mean periodogram; convert style elements to enums; add bar plots; extend number of active JobIDs

Location:
trunk/Ohana
Files:
8 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r40007 r40165  
    102102$(SRC)/peak.$(ARCH).o           \
    103103$(SRC)/periodogram.$(ARCH).o    \
     104$(SRC)/periodogram-fm.$(ARCH).o \
    104105$(SRC)/plot.$(ARCH).o           \
    105106$(SRC)/dot.$(ARCH).o            \
  • trunk/Ohana/src/opihi/cmd.data/dot.c

    r33963 r40165  
    2929
    3030  /* set point style and errorbar mode (these are NOT sticky) */
    31   graphmode.style = 2;
     31  graphmode.style = KAPA_PLOT_POINTS;
    3232  graphmode.etype = 0;
    3333
  • trunk/Ohana/src/opihi/cmd.data/grid.c

    r34584 r40165  
    175175
    176176  Xvec.Nelements = Yvec.Nelements = N;
    177   graphmode.style = 2; /* points */
    178   graphmode.ptype = 100; /* connect a pair */
     177  graphmode.style = KAPA_PLOT_POINTS; /* points */
     178  graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */
    179179  graphmode.etype = 0;
    180180  PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode);
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r40007 r40165  
    9191int peak             PROTO((int, char **));
    9292int periodogram      PROTO((int, char **));
     93int periodogram_fm   PROTO((int, char **));
    9394int plot             PROTO((int, char **));
    9495int dot              PROTO((int, char **));
     
    270271  {1, "parity",       parity,           "set image parity"},
    271272  {1, "peak",         peak,             "find vector peak in range"},
    272   {1, "periodogram",  periodogram,      "measure periods in unevenly sampled data"},
     273  {1, "periodogram",    periodogram,    "measure periods in unevenly sampled data (Lomb-Scargle)"},
     274  {1, "periodogram_fm", periodogram_fm, "measure periods in unevenly sampled data (generalized Lomb-Scargle; floating mean)"},
    273275  {1, "plot",         plot,             "plot a pair of vectors"},
    274276  {1, "png",          jpeg,             "convert display graphic to PNG"},
  • trunk/Ohana/src/opihi/cmd.data/line.c

    r33662 r40165  
    3333
    3434  /* set point style and errorbar mode (these are NOT sticky) */
    35   graphmode.style = 0;
     35  graphmode.style = KAPA_PLOT_CONNECT;
    3636  graphmode.etype = 0;
    3737
  • trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh

    r27435 r40165  
     1
     2if (not($?PLOT)) set PLOT = 0
    13
    24list tests
     
    2830   echo "OFFSET: {$peakpos - $P}"
    2931 end
     32
     33 if ($PLOT)
     34  lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line
     35 end
    3036end
    3137
     
    99105
    100106 periodogram t f 2 30 period power
     107
     108#  lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f
     109#  lim -n 1 period power; clear; box; plot period power
     110
     111 peak -q period power
     112
     113 if (abs ($peakpos - $P) > 0.05)
     114   $PASS = 0
     115 end
     116end
     117
     118# test using random samples, offset start, non-zero DC
     119macro test5
     120 $PASS = 1
     121 break -auto off
     122
     123 local P PI
     124 $PI = 3.14159265359
     125 $P  = 15.0
     126
     127 delete -q x t f period power
     128
     129 create x 500 800
     130 set t = 300 * rnd(x) + 500
     131 set f = sin(2*$PI*t/$P) + 0.5
     132
     133 periodogram t f 2 30 period power
     134
     135#  lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f
     136#  lim -n 1 period power; clear; box; plot period power
     137
     138 peak -q period power
     139
     140 if (abs ($peakpos - $P) > 0.05)
     141   $PASS = 0
     142 end
     143end
     144
     145# test using random samples, offset start, non-zero DC, some noise
     146macro test6
     147 $PASS = 1
     148 break -auto off
     149
     150 local P PI
     151 $PI = 3.14159265359
     152 $P  = 15.0
     153
     154 delete -q x t f period power
     155
     156 create x 500 800
     157 set t = 300 * rnd(x) + 500
     158 set fraw = sin(2*$PI*t/$P) + 0.5
     159
     160 # 0.05 : peakpos = 14.95
     161 # 0.10 : peakpos = 15.04 (
     162 gaussdev df t[] 0.0 0.25
     163 set f = fraw + df
     164
     165 periodogram t f 2 30 period power
     166
     167#  lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f
     168#  lim -n 1 period power; clear; box; plot period power
     169
     170 peak -q period power
     171
     172 if (abs ($peakpos - $P) > 0.05)
     173   $PASS = 0
     174 end
     175end
     176
     177# test using fewer random samples, offset start, non-zero DC, some noise
     178macro test7
     179 $PASS = 1
     180 break -auto off
     181
     182 local P PI
     183 $PI = 3.14159265359
     184 $P  = 15.0
     185
     186 delete -q x t f period power
     187
     188 create x 0 100
     189 set t = 100 * rnd(x)
     190 set fraw = sin(2*$PI*t/$P) + 0.5
     191
     192 # 0.05 : peakpos = 14.95
     193 # 0.10 : peakpos = 15.04 (
     194 gaussdev df t[] 0.0 0.25
     195 set f = fraw + df
     196
     197 periodogram t f 2 30 period power
     198
     199#  lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f
     200#  lim -n 1 period power; clear; box; plot period power
     201
     202 peak -q period power
     203
     204 if (abs ($peakpos - $P) > 0.05)
     205   $PASS = 0
     206 end
     207end
     208
     209# test using fewer random samples, high frequency, non-zero DC, some noise
     210macro test8
     211 if ($0 != 2)
     212   echo "USAGE: test8: Ndays")
     213   break
     214 end
     215 
     216 local Ndays
     217 $Ndays = $1
     218
     219 $PASS = 1
     220 break -auto off
     221
     222 local P PI
     223 $PI = 3.14159265359
     224 $P  = 0.8*rnd(0) + 0.2
     225 $trueP = $P
     226
     227 delete -q x t f period power
     228
     229 create x 0 $Ndays
     230
     231 # t is a time in days, but we always have 4 within 1 hour:
     232 set t0 = int(100 * rnd(x))
     233 set dtx = (3/24) * rnd(x)
     234 set t0 = t0 + dtx
     235
     236 set dt1 = (15.0 / 1440) * rnd(x) + ( 0 + 7.5) / 1440
     237 set dt2 = (15.0 / 1440) * rnd(x) + (15 + 7.5) / 1440
     238 set dt3 = (15.0 / 1440) * rnd(x) + (30 + 7.5) / 1440
     239
     240 delete -q t
     241 concat t0 t
     242 set tmp = t0 + dt1; concat tmp t
     243 set tmp = t0 + dt2; concat tmp t
     244 set tmp = t0 + dt3; concat tmp t
     245
     246 set fraw = sin(2*$PI*t/$P) + 0.5
     247
     248 # 0.05 : peakpos = 14.95
     249 # 0.10 : peakpos = 15.04 (
     250 gaussdev df t[] 0.0 0.25
     251 set f = fraw + df
     252
     253 periodogram t f 0.1 2.0 period power
    101254
    102255#  lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f
  • trunk/Ohana/src/opihi/cmd.data/zplot.c

    r38062 r40165  
    117117
    118118  /* point size determined by Zvec */
    119   graphmode.style = 2; /* plot points */
     119  graphmode.style = KAPA_PLOT_POINTS; /* points */
    120120  graphmode.size = -1; /* point size determined by Zvec */
    121121  PlotVectorTriplet (kapa, xvec, yvec, &Zvec, mask, &graphmode);
     
    226226
    227227  /* point size determined by Zvec */
    228   graphmode.style = 2; /* plot points */
     228  graphmode.style = KAPA_PLOT_POINTS; /* plot points */
    229229  graphmode.color = -1; /* point color determined by Zvec */
    230230  graphmode.etype = 0; /* no errorbars */
Note: See TracChangeset for help on using the changeset viewer.