Syntax:
-Injectharm <"spec" | "fix" per | "rand" minp maxp | "logrand" minp maxp | "randfreq" minf maxf | "lograndfreq" minf maxf> Nharm (<"ampspec" | "ampfix" amp | "amprand" minamp maxamp | "amplogrand" minamp maxamp> ["amprel"] <"phasespec" | "phasefix" phase | "phaserand"> ["phaserel"])0...Nharm Nsubharm (<"ampspec" | "ampfix" amp | "amprand" minamp maxamp | "amplogrand" minamp maxamp> ["amprel"] <"phasespec" | "phasefix" phase | "phaserand"> ["phaserel"])1...Nsubharm omodel [modeloutdir] Example 1.$ ./vartools -i EXAMPLES/3 -randseed 1 -oneline \ -Injectharm rand 1.0 5.0 \ 0 amplogrand 0.01 0.1 phaserand \ 0 1 EXAMPLES/OUTDIR1 \ -LS 0.1 10.0 0.1 1 0 Name = EXAMPLES/3 Injectharm_Period_0 = 4.36075087 Injectharm_Fundamental_Amp_0 = 0.02480 Injectharm_Fundamental_Phase_0 = 0.78310 LS_Period_1_1 = 4.38128183 Log10_LS_Prob_1_1 = -681.95917 LS_SNR_1_1 = 55.84933
Inject a sinusoid into the light curve EXAMPLES/3 and then conduct a search for a periodic sinusoidal signal using -LS. In this example we adopt a random period between 1.0 and 5.0 days, we include 0 harmonic overtones (Nharm=0 implies only the fundamental is used) and take the amplitude of the fundamental signal from a uniform-log distribution, and we also adopt a random phase. We use no sub-harmonics and we output the model to the directory EXAMPLES/OUTDIR1 (it will have the filename "EXAMPLES/OUTDIR1/3.injectharm.model", the model values are in the third column). By giving the option "-randseed 1" we explicitely seed the random number generator with the value 1. Use "-randseed time." to get a non-repeatable test.
Fig 1. Phased Light Curve Before and After Injecting a Harmonic Signal, from example 1.
$ echo EXAMPLES/4 | \ gawk '{amp = 0.25; \ for(i=1; i <= 10; i += 1) { \ print $1, amp; amp = amp*0.5; \ }}' | \ ./vartools -l - -header -numbercolumns -parallel 4 \ -Injectharm fix 0.514333 10 \ ampspec phaserand \ ampfix 0.47077 amprel phasefix 0.60826 phaserel \ ampfix 0.35916 amprel phasefix 0.26249 phaserel \ ampfix 0.23631 amprel phasefix -0.06843 phaserel \ ampfix 0.16353 amprel phasefix 0.60682 phaserel \ ampfix 0.10621 amprel phasefix 0.28738 phaserel \ ampfix 0.06203 amprel phasefix 0.95751 phaserel \ ampfix 0.03602 amprel phasefix 0.58867 phaserel \ ampfix 0.02900 amprel phasefix 0.22322 phaserel \ ampfix 0.01750 amprel phasefix 0.94258 phaserel \ ampfix 0.00768 amprel phasefix 0.66560 phaserel \ 0 0 \ -o EXAMPLES/OUTDIR1 format InjectRRLyrae.%d.txt \ -LS 0.1 10.0 0.01 2 0 \ -aov_harm 2 0.1 10.0 0.1 0.01 2 0 | \ gawk '{print $1, $2, $3, $25, $27, $31, $33}' #1_Name 2_Injectharm_Period_0 3_Injectharm_Fundamental_Amp_0 25_LS_Period_1_1 27_LS_SNR_1_1 31_Period_1_2 33_AOV_HARM_SNR_1_2 EXAMPLES/4 0.51433300 0.25000 0.51493297 39.71890 0.51458364 163.155 EXAMPLES/4 0.51433300 0.03125 0.51493297 37.91822 0.51449853 158.581 EXAMPLES/4 0.51433300 0.06250 0.51408199 36.85215 0.51432840 136.468 EXAMPLES/4 0.51433300 0.12500 0.51493297 37.16393 0.51432840 149.048 EXAMPLES/4 0.51433300 0.00781 0.51416696 33.94252 0.51415838 83.0094 EXAMPLES/4 0.51433300 0.00391 0.51425196 30.05318 0.51458364 46.9948 EXAMPLES/4 0.51433300 0.01562 0.51467738 38.30902 0.51458364 149.857 EXAMPLES/4 0.51433300 0.00195 0.51416696 24.28090 0.51356418 23.9632 EXAMPLES/4 0.51433300 0.00049 0.93667874 12.19034 0.99348763 13.8977 EXAMPLES/4 0.51433300 0.00098 0.93527063 13.22210 1.99136298 9.40744
Inject an RR Lyrae signal into a light curve and recover it. The initial gawk command creates a list with 10 rows, each row gives the name of the light curve to inject the signal into (EXAMPLES/4) and the amplitude of the injected signal. The call to vartools uses -Injectharm to inject a signal with a fixed period of 0.514333 days, and with 10 harmonics. For the fundamental mode we take the amplitude from the input list, and we allow the phase to be random. We then fix the relative amplitudes and phases of the 10 harmonics (these values give an RR-Lyrae shaped signal, see "vartools -example -Killharm" for an example of how these coefficients can be determined). After injecting the signal it is then recovered using the -LS and -aov_harm commands. To speed up the process we use "-parallel 4" which processes up to four light curves simultaneously (use a higher or lower number depending on the number of CPU cores on your machine). Note that the order of rows in the output is arbitrary when using parallel. For this example we pipe the results into gawk to output only the columns that are most relevant. The injected signal is recovered for fundamental mode amplitudes >= 0.00195.
Fig 2. Example of a light curve with a high-amplitude RR Lyrae signal injected from Example 2.
Fig 3. Example of a light curve with a lower-amplitude RR Lyrae signal injected from Example 2.