Revision: | 1.1 |
Committed: | Fri Apr 23 09:16:15 2010 UTC (13 years, 5 months ago) by tplarson |
Branch: | MAIN |
CVS Tags: | Ver_6-0, Ver_6-1, Ver_6-2, Ver_6-3, Ver_6-4, Ver_9-1, Ver_5-14, Ver_5-13, Ver_5-12, Ver_5-11, Ver_5-10, Ver_LATEST, Ver_9-3, Ver_9-41, Ver_9-2, Ver_5-9, Ver_8-8, Ver_8-2, Ver_8-3, Ver_8-0, Ver_8-1, Ver_8-6, Ver_8-7, Ver_8-4, Ver_8-5, Ver_7-1, Ver_7-0, Ver_9-5, Ver_9-4, Ver_8-10, Ver_8-11, Ver_8-12, Ver_9-0, HEAD |
Log Message: | idl functions, procedures, scripts, and input files needed by doretidl, dogfidl, and dopkgn |
# | Content |
---|---|
1 | FUNCTION transfunct, X, M |
2 | |
3 | return,[[exp(-1*x/15.0)],[exp(-1*x/60.0)],[1.0]] |
4 | |
5 | END |
6 | |
7 | |
8 | FUNCTION TRANSFILT, day, xin, g2, rms, transients=transients, threshold=threshold, nwtf=nwtf |
9 | |
10 | nx=n_elements(xin) |
11 | |
12 | if (n_elements(threshold) eq 0) then threshold=1.0 |
13 | |
14 | ndays=ceil(nx/1440.0) |
15 | |
16 | xcopy=xin |
17 | transients=fltarr(nx) |
18 | |
19 | wz=where(g2 eq 0,nz) |
20 | if (nz ne 0) then xcopy[wz]=0 |
21 | nan=!values.f_nan |
22 | |
23 | daystr=strtrim(string(day),2) |
24 | ndstr=strtrim(string(ndays),2) |
25 | sectionfile='secs.'+ndstr+'.'+daystr |
26 | nsecs=0L |
27 | rec=lonarr(2) |
28 | openr,1,sectionfile |
29 | readf,1,nsecs |
30 | for j=0L,nsecs-1 do begin |
31 | readf,1,rec |
32 | start=rec[0] |
33 | finish=rec[1] |
34 | nmin=finish-start+1 |
35 | sup=fltarr(nmin) |
36 | sub=xcopy[start:finish] |
37 | ws=where(finite(sub) and sub ne 0,nws) |
38 | if (nws lt 5) then goto, skip |
39 | if (nws gt 500) then x=ws[0:499] else x=ws |
40 | y=sub[x] |
41 | |
42 | result=svdfit(x,y,3,yfit=yfit,function_name='transfunct',status=status) |
43 | print,j,status,result |
44 | |
45 | print,max(abs(result[2]-yfit)),6*rms |
46 | if (max(abs(result[2]-yfit)) lt 6*rms) then continue |
47 | |
48 | wy=where(abs(yfit-result[2]) gt threshold*rms,nwy) |
49 | if (nwy eq 0) then continue |
50 | rej=max(wy) |
51 | print,'rejected ',rej+1,' points' |
52 | |
53 | sup[ws[0:rej]]=1 |
54 | skip: |
55 | transients[start:finish]=sup |
56 | |
57 | endfor |
58 | close,1 |
59 | |
60 | wtf=where(transients,nwtf) |
61 | return,wtf |
62 | |
63 | END |