-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadtransit3.pro
More file actions
58 lines (49 loc) · 1.49 KB
/
readtransit3.pro
File metadata and controls
58 lines (49 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function readtransit3, filename, nmaxdetrends
;; Read the transit data file into a structure
;; (with an arbitary number of detrending variables)
band = (strsplit(filename,'.',/extract))(1)
if band eq 'u' then begin
band = 'Sloanu'
bandname = "u"
endif else if band eq 'g' then begin
band = 'Sloang'
bandname = "g"
endif else if band eq 'r' then begin
band = 'Sloanr'
bandname = "r"
endif else if band eq 'i' then begin
band = 'Sloani'
bandname = "i"
endif else if band eq 'z' then begin
band = 'Sloanz'
bandname = "z"
endif else bandname = band
line = ""
openr, lun, filename, /get_lun
readf, lun, line
entries = double(strsplit(line,/extract))
ncol = n_elements(entries)
nrow = file_lines(filename)
;; rewind file to beginning
point_lun, lun, 0
array = dblarr(ncol,nrow)
readf, lun, array
free_lun, lun
bjd = transpose(array[0,*])
flux = transpose(array[1,*])
err = transpose(array[2,*])
if (ncol gt 3) && (nmaxdetrends gt 0) then begin
ndetrend = ncol-3 < nmaxdetrends
d = array[3:3+ndetrend-1,*]
endif else begin
d = 0d0
ndetrend=0
endelse
secondary = 0;
if (strmid(filename,0,1) eq 's') then secondary = 1;
night = strmid(filename,1,4)+'-'+strmid(filename,5,2)+'-'+strmid(filename,7,2)
label = (strsplit(filename,'.',/extract))(2) + ' UT ' + night + ' ('+ bandname + ')'
transit=create_struct('bjd',bjd,'flux',flux,'err',err,'band',band,'ndx',0,$
'epoch',0.0,'detrend',d,'label',label,'ndetrend',ndetrend,'secondary',secondary)
return, transit
end