I have light curve data consist of time (t) and flux (f) (4067 rows x 2 columns)
nx=4067
t=fltarr(nx)
f=fltarr(nx)
data=read_table('kplr4830001.dat')
;print,data(0,*) ;this is t
;print,data(1,*) ;this is f
window,0
plot,data(0,*)/data(0,0),data(1,*)/data(1,0),xrange=[1.045,1.13],yrange=[0.98,1.03],xstyle=1,ystyle=1
I managed to calculate the threshold (thr = 0.0067621339).
I want to calculate a specific time period (t_start) and (t_end).
t_start: The time at which the flux first exceeds the threshold (0.0067621339).
t_end: The time at which the flux first becom smaller than (3*exp(-9/2)).
This is how I did it:
;t_start
for i=0,nx-2 do begin
IF (data(1,i)/data(1,0) GT (thr)) THEN begin
print, data(1,i)/data(1,0)
endif
endfor
;t_end
for i=0,nx-2 do begin
IF (data(1,i)/data(1,0) LT (3*exp(-9/2))) THEN begin
print, data(0,i)/data(0,0)
endif
endfor
end
what I need is just the first value of data(0,i)/data(0,0) that met these conditions. How can I do it?