!------------------------------------------------------------------------------ ! PERIOD.PRG !------------------------------------------------------------------------------ ! purpose: perform a period analysis using the context tsa ! author: B. Gaensicke ! last revision: 2023-10-17 ! ! - allow for the additional parameters of AOV and ORT ! - changed the format of target.tbl to double-precision ! - changed the final output to increase the number of digits !------------------------------------------------------------------------------ ! You need to specify ! ! p1 = the start of the frequency window to be searched ! p2 = the end of the frequency window to be searched ! p3 = the number of test frequencies ! p4 = the method: scargle, aov, power, or ort ! p5 = the name of the file to be analysed [two columns: time flux/rv/whatever !------------------------------------------------------------------------------ set/context tsa define/par p1 0 n "freq [start] = " define/par p2 20 n "freq [end] = " define/par p3 1000 n "nfreq = " define/par p4 scargle c "method [scargle/aov/power/ort] = " define/par p5 tsa c "data file = " define/par p6 0 c "[aov: # bins, ort: # harmonics] = " define/par p7 2 c "[aov: "overlapping bin covers"] = " define/local start/d/1/1 {p1} define/local end/d/1/1 {p2} define/local nstep/i/1/1 {p3} define/local method/c/1/10 {p4} define/local file/c/1/80 {p5} define/local order/i/1/1 {p6} define/local cover/i/1/1 {p7} define/local step/d/1/1 0. ! Read in data create/table target * * {file} $MID_WORK/period.fmt if {end} .eq. 0 then ! either have MIDAS choose the sampling... band/tsa target else step = (end-start)/nstep ! ... or do it yourself set/tsa starttsa = {start} set/tsa steptsa = {step} set/tsa nsteps = {nstep} endif if "{method}" .eq. "scargle" then scargle/tsa target {method} endif if "{method}" .eq. "power" then power/tsa target {method} endif if "{method}" .eq. "aov" then if {order} .eq. 0 then aov/tsa target {method} else aov/tsa target {method} ? ? ? {order} {cover} endif endif if "{method}" .eq. "ort" then if {order} .eq. 0 then ort/tsa target {method} else ort/tsa target {method} ? ? ? {order} endif endif cop/it {method}.bdf {method} :frequency name/column {method} #1 E15.9 name/column {method} #2 :power E15.9 delete/column {method} #3 ass/print file tmp.dat print/tab {method} N $ awk '{printf "%15.9g %15.9g\n",$2,$3}' tmp.dat > {method}.dat return