Changeset 40145
- Timestamp:
- Sep 26, 2017, 6:22:26 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20170822/src/opihi/cmd.data/periodogram-fm.c
r40141 r40145 8 8 float mean, var, w, tau, P, Pc, Ps, Po; 9 9 float C, S, cs, sn, cs2, sn2, ratio; 10 Vector *time, *flux, * power, *period;10 Vector *time, *flux, *dflux, *power, *period; 11 11 12 12 VERBOSE = FALSE; … … 16 16 } 17 17 18 if (argc != 7) {19 gprint (GP_ERR, "USAGE: periodogram (time) (flux) (minP) (maxP) (period) (power)\n");18 if (argc != 8) { 19 gprint (GP_ERR, "USAGE: periodogram-fm (time) (flux) (dflux) (minP) (maxP) (period) (power)\n"); 20 20 return (FALSE); 21 21 } 22 22 23 if ((time = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE); 24 if ((flux = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE); 25 minP = atof(argv[3]); 26 maxP = atof(argv[4]); 27 if ((period = SelectVector (argv[5], ANYVECTOR, TRUE)) == NULL) return (FALSE); 28 if ((power = SelectVector (argv[6], ANYVECTOR, TRUE)) == NULL) return (FALSE); 23 // XXX allow dflux to be dropped? 24 25 if ((time = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE); 26 if ((flux = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE); 27 if ((dflux = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE); 28 minP = atof(argv[4]); 29 maxP = atof(argv[5]); 30 if ((period = SelectVector (argv[6], ANYVECTOR, TRUE)) == NULL) return (FALSE); 31 if ((power = SelectVector (argv[7], ANYVECTOR, TRUE)) == NULL) return (FALSE); 29 32 30 33 REQUIRE_VECTOR_FLT (time, FALSE); … … 62 65 ResetVector (period, OPIHI_FLT, NP); 63 66 67 // for testing, we are going to write out the terms explicitly 68 // for optimization, some of the tri functions can be calculated more efficiently 69 // by storing cos,sin(w t) and using some recurrence rules 70 71 // XXX consider choice of period or frequency step 64 72 P = minP; 65 73 while (P < maxP) { … … 68 76 /* find the period offset tau */ 69 77 tv = time[0].elements.Flt; 70 cs = sn = 0; 78 df = dflux[0].elements.Flt; 79 80 cs = sn = cs2 = sn2 = 0; 81 71 82 for (i = 0; i < Npt; i++, tv++) { 83 opihi_flt wt = 72 84 cs += cos (*tv*w*2); 73 85 sn += sin (*tv*2*2);
Note:
See TracChangeset
for help on using the changeset viewer.
