Commit 363d9ab8 authored by Gonzalez, Miguel's avatar Gonzalez, Miguel
Browse files

Issue 33: Added Salsa tests, including first files produced in 2004. rdid...

Issue 33: Added Salsa tests, including first files produced in 2004. rdid modified to handle the older Salsa files
parent ed89a46e
...@@ -1996,13 +1996,7 @@ if STATUS eq 0 then begin ...@@ -1996,13 +1996,7 @@ if STATUS eq 0 then begin
'salsa': begin 'salsa': begin
;Modified on May 2019 - Tested on 2018 data, but not on older data (M. A. Gonzalez) ;Modified on May-Aug 2019 and tested on 2004-2019 data (lamp_reading_unit_test)
;Old data
if year lt 2014 then begin
lamp_journal, "Old data files! Check carefully if reading is OK."
lamp_message, "Old data files! Check carefully if reading is OK."
endif
;The current code has been written for version 5 of Salsa Ascii files ;The current code has been written for version 5 of Salsa Ascii files
;In previous versions (at least in v. 4), the information about the ;In previous versions (at least in v. 4), the information about the
;type of scan was encoded in the variables manip and nbang, but since ;type of scan was encoded in the variables manip and nbang, but since
...@@ -2012,9 +2006,7 @@ if STATUS eq 0 then begin ...@@ -2012,9 +2006,7 @@ if STATUS eq 0 then begin
;uses the information available from the title, as the type of scan ;uses the information available from the title, as the type of scan
;is written at the end. There are chances that this works also for ;is written at the end. There are chances that this works also for
;previous versions, but this has not been tested. ;previous versions, but this has not been tested.
;References in the previous code to manip and nbang have been removed, ;References in the previous code to manip and nbang have been removed.
;until the reading of data before 2014 is re-validated again.
;If needed, the old rdid code can be retrived from the Git repository.
WOUT = float(WOUT) WOUT = float(WOUT)
bix=0 bix=0
...@@ -2031,7 +2023,6 @@ if STATUS eq 0 then begin ...@@ -2031,7 +2023,6 @@ if STATUS eq 0 then begin
if scan gt 1 then WOUT = transpose(temporary(WOUT), [1,0,2]) $ if scan gt 1 then WOUT = transpose(temporary(WOUT), [1,0,2]) $
else WOUT = transpose(temporary(WOUT)) else WOUT = transpose(temporary(WOUT))
endelse endelse
;WOUT=reverse(WOUT) ; First detector till run 394
if (n_elements(cal_d1a) eq 0) or (n_elements(cal_d1a) eq 25) then $ if (n_elements(cal_d1a) eq 0) or (n_elements(cal_d1a) eq 25) then $
P_DID_CALOD, insv, insv + '.cal', flg P_DID_CALOD, insv, insv + '.cal', flg
...@@ -2094,7 +2085,7 @@ if STATUS eq 0 then begin ...@@ -2094,7 +2085,7 @@ if STATUS eq 0 then begin
;determine type of scan ;determine type of scan
tmp = strsplit(exper[0], /extract) tmp = strsplit(exper[0], /extract)
scantype = tmp[-1] scantype = tmp[-1]
case scantype of case scantype of
'2theta': begin '2theta': begin
...@@ -2112,12 +2103,14 @@ if STATUS eq 0 then begin ...@@ -2112,12 +2103,14 @@ if STATUS eq 0 then begin
end end
'chi': begin 'chi': begin
ZZ = reform(vparm[20,*]/1000.) if year ge 2014 then ZZ = reform(vparm[20,*]/1000.) $
else ZZ = reform(vparm[3,*]/1000.)
ZT = 'phi scan' ZT = 'phi scan'
end end
'phi': begin 'phi': begin
ZZ = reform(vparm[21,*]/1000.) if year ge 2014 then ZZ = reform(vparm[21,*]/1000.) $
else ZZ = reform(vparm[3,*]/1000.)
ZT = 'phi scan' ZT = 'phi scan'
end end
...@@ -2153,7 +2146,8 @@ if STATUS eq 0 then begin ...@@ -2153,7 +2146,8 @@ if STATUS eq 0 then begin
end end
else: begin else: begin
ZZ = reform(vparm[12,*]/1000.) if year gt 2014 then ZZ = reform(vparm[12,*]/1000.) $
else ZZ = reform(vparm[3,*]/1000.)
ZT = 'Unknown scan' ZT = 'Unknown scan'
end end
...@@ -2161,31 +2155,45 @@ if STATUS eq 0 then begin ...@@ -2161,31 +2155,45 @@ if STATUS eq 0 then begin
endif else begin ;single acquisition endif else begin ;single acquisition
NN[0,0,0] = param[43] ;value of monitor1 in common block in header NN[0,0,0] = param[43] ;value of monitor1 in common block in header
if year lt 2014 then NN[0,0,0] = vpara[1] ;value of monitor in 2nd parameter block (11 values)
endelse endelse
if n_elements(cal_d1a) eq 256.*256. then $ if n_elements(cal_d1a) eq 256.*256. then $
for i=0,scan-1 do WOUT[0,0,i] = WOUT[*,*,i]*cal_d1a for i=0,scan-1 do WOUT[0,0,i] = WOUT[*,*,i]*cal_d1a
;Raw button not set --> To check if those options are still valid (MG, 14/5/2019) ;Raw button not set
if (INST[2] eq '0') then begin if (INST[2] eq '0') then begin
WOUT = WOUT[17:238,1:254,*] & sz=size(WOUT) ;Bad areas
XX = XX[17:238,*] & YY = YY[1:254] ;Bad areas ; Select good detector region
datp = {x:XX[*,0], y:YY, e:0, z:ZZ} WOUT = WOUT[17:238, 1:254, *]
XX = XX[17:238,*]
YY = YY[1:254]
if typename(ZZ) eq 'STRING' then begin
; Replace hexapod strings by number of scan point, to allow call to regular
; Info about hexapod position (Tx, Ty, Tz) will be kept in Z
Z2 = fix(indgen(n_elements(ZZ)) + 1)
endif else Z2 = ZZ
datp = {x:XX[*,0], y:YY, e:0, z:Z2}
sz=size(WOUT)
temp = regular(WOUT[*,*,0], datp=datp, DY=0, /GetNewSize) temp = regular(WOUT[*,*,0], datp=datp, DY=0, /GetNewSize)
sz[1:2] = temp[0:1] sz[1:2] = temp[0:1]
if YEAR lt '2014' then DistCm = 89. else DistCm = 125. if YEAR lt '2014' then DistCm = 89. else DistCm = 125.
if (size(XX))[0] eq 1 then begin ;not a gamma scan if (size(XX))[0] eq 1 then begin ;not a gamma scan
WTMP = straight_1d(WOUT, distance=DistCm, datp=datp) WTMP = straight_1d(WOUT, distance=DistCm, datp=datp)
XTMP = datp.x XTMP = datp.x
endif else begin ;gamma scan endif else begin ;gamma scan
WTMP = reform(fltarr(sz[1], scan)) WTMP = reform(fltarr(sz[1], scan))
XTMP = WTMP XTMP = WTMP
for i=0,scan-1 do begin for i=0, scan-1 do begin
datp = {x:XX[*,i<bix], y:YY, e:0, z:ZZ} datp = {x:XX[*,i<bix], y:YY, e:0, z:Z2}
WTMP[*,i] = straight_1d(WOUT[*,*,i], distance=DistCm, datp=datp) WTMP[*,i] = straight_1d(WOUT[*,*,i], distance=DistCm, datp=datp)
XTMP[*,i] = datp.x XTMP[*,i] = datp.x
endfor endfor
endelse endelse
XX = temporary(XTMP) XX = temporary(XTMP)
EE = 0. EE = 0.
if scan gt 1 then if (size(XX))[0] eq 1 then begin if scan gt 1 then if (size(XX))[0] eq 1 then begin
...@@ -2193,7 +2201,7 @@ if STATUS eq 0 then begin ...@@ -2193,7 +2201,7 @@ if STATUS eq 0 then begin
XX = fltarr((size(XX))[1], scan) XX = fltarr((size(XX))[1], scan)
for i=0,scan-1 do XX[*,i] = tmp for i=0,scan-1 do XX[*,i] = tmp
endif endif
YY = ZZ YY = Z2
YT = ZT YT = ZT
ZT = 'join_y' ZT = 'join_y'
WOUT = temporary(WTMP) WOUT = temporary(WTMP)
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment