Commit 2cf50b4e authored by Gonzalez, Miguel's avatar Gonzalez, Miguel

Issue 32: Changes to use attenuation_coefficient value read from D11 NeXus...

Issue 32: Changes to use attenuation_coefficient value read from D11 NeXus file instead of hard-coded table
parent f14a3f83
......@@ -47,12 +47,29 @@ case flagg of
collima= '1.5,2.5,4.0,5.5,8.0,10.5,13.5,16.5,20.5,28.,34.,40.5'
att2017 = '1., 324., 1052., 2813.' ;attenuators used until 2017
att2018 = ', 8.53, 30.65, 69.29, 256.28, 603.85, 1990.0, 14889.27' ;new attenuators installed on 2018
;att2019 = ', 8.53, 30.65, 68.47, 256.28, 603.85, 1623.87, 14889.27' ;new attenuators installed on 2018
; Attenuation coefficients changed again in 2019,
; so instead of modifying read_hdf and adding a new attenuator table,
; I use a mechanism equivalent to the one used in D22 to read the
; second attenuator (chopper) --> paridx[18]
; This number is then used to read the attenuation coefficient
; in sans_supl[71] and will be used later in sans_settings_phi0.
; There I define 2 possibilities:
; 1. If the attenuator number > 3 and sans_supl[71] > 1 then I
; use directly this number as attenuation coefficient.
; 2. Otherwise, use the old method, reading the value from the
; table as attenu[sans_supl[24]]
attenua = att2017 + att2018
paridx[18] = 29 ;parameter number corresponding to attenuation coefficient (set in read_hdf)
; attenuF = correction to attenuation due to collimation dependence, tested in 2017, not needed with 2018 atts
; attenuF=[[1. , 1. , 1. , 1. , 1., 1. , 1. , 1. , 1. , 1. , 1. , 1. ],$ ;No attenuator
; [.9505, .969, 1.052, 1.017, 1., .967, .805, .856, .862, .735, .686, 1.134],$ ;Attenuator1 factor/collimation
; [.9505, .969, 1.052, 1.017, 1., .967, .805, .856, .862, .735, .686, 1.134],$ ;Attenuator2 factor/collimation (temp)
; [.9505, .969, 1.052, 1.017, 1., .967, .805, .856, .862, .735, .686, 1.134]] ;Attenuator3 factor/collimation (temp)
Qdep = '(cos(THETA^3/dist*2)^2)*(1-(radius/(max(radius)>(1e-9))*.095))'
XWdep= '.7078+ .03652*Lambda+ .0013467*Lambda^2+ 3.6842e-5*Lambda^3'
fct =[1.,1.] & centex='63.50 ' & centey='63.50 ' & FX =-1
......
......@@ -844,7 +844,6 @@ if n_elements(wout) gt 1 then begin
if sxyc eq sxy then begin
if nzc gt 0 then if nzc lt nz then begin & nzc=0 & Esample=Esample[*,*,0] & endif
TAKE_DATP, datps, W=nEsample & E_ES=datps.E & tim=datps.p[sans_supl[85]]
if nzc gt 0 then tim=datps.pv[sans_supl[85],*]
if UseTime then N_ES=tim else N_ES=datps.N
if n_elements(E_ES) ne n_elements(Esample) then if sans_supl[66] gt 1 then E_ES=sqrt(Esample>0.) else E_ES=sqrt(Esample) ;NegMask!
......@@ -1601,6 +1600,7 @@ if siz[0] eq 2 then begin ; one of the beams must be there
;EMPTY SAMPLE TRANSMISSION
;*************************
if n_elements(nEsample) eq 1 then TAKE_W,Esample,W=nEsample
if n_elements(Esample) gt 1 then $
if n_elements(Esample[*,*,0]) eq n_elements(beam) then begin
......@@ -8687,25 +8687,44 @@ pro sans_settings_phi0, baset, sans_supl, tmpbeam, attFact=supl26, phi0=flux
;** ******************
;** return attenuator factor and calculate flux phi0 from a transmission beam
;-
tau = sans_supl[6] * sans_supl[27] ; enable * TAUvalue
ftau= sans_supl[7] & tim = sans_supl[23] ; tau function and time
;if sans_supl[66] gt 1 then tau = 0. ; commented for Tbeam (sans_supl no defined here!)
err = 0
if tau*tim gt 0. then sans_tau, tmpbeam ,err ,ftau ,tau ,tim ; dead times correction
sans_settings_getmask,size(tmpbeam),[0.,0.],M,/nobeam,/noWbeam ; get detector mask then
if n_elements(M) eq n_elements(tmpbeam) then tmpbeam=tmpbeam*(1-M) ; mask correction
attenu =float(strsplit(/EXTRACT,baset.attenu,',')) ;attenuator factor of reference
attenuF=baset.attenuF ;attenuator factors / all possible collimations
supl26=(attenu[sans_supl[24]] *sans_supl[25]) > 1 ;att[number] * OnOff >1
if (supl26 gt 1.) and ((size(attenuF))[0] gt 0) then begin
collim=strsplit(/EXTRACT,baset.collim,',') ;Calculate collimation index for that transmission
colidx=where(round(float(collim)*10.)/10. eq round(sans_supl[4]*10.)/10.) & colidx=colidx[0]>0
supl26 = ( supl26 * attenuF[colidx,sans_supl[24]] )>1 ;Real attenuator factor
endif
if sans_supl[71] gt 1. then supl26 *= sans_supl[71] ; Attenuator 2 given by the instrument
flux = total(tmpbeam) / tim * supl26 ; return PHI0
tau = sans_supl[6] * sans_supl[27] ; enable * TAUvalue
ftau = sans_supl[7] & tim = sans_supl[23] ; tau function and time
err = 0
; dead times correction
if tau*tim gt 0. then sans_tau, tmpbeam ,err ,ftau ,tau ,tim
; get detector mask then and apply it
sans_settings_getmask, size(tmpbeam), [0.,0.], M, /nobeam, /noWbeam
if n_elements(M) eq n_elements(tmpbeam) then tmpbeam = tmpbeam*(1-M)
; only actual D11 has a table with more than 3 attenuators
; (1-3 corresponding to the values before 2018 and 4-10 to
; the values valid for 2018)
if sans_supl[24] gt 3 and sans_supl[71] gt 1 then begin
;use attenuation coefficient directly read from NeXus file
supl26 = sans_supl[71]
endif else begin
;attenuator factor of reference
attenu = float(strsplit(/EXTRACT, baset.attenu, ','))
;additional correction factor related to collimation effects in attenuation value
attenuF = baset.attenuF
;att[number] * OnOff >1
supl26 = (attenu[sans_supl[24]] *sans_supl[25]) > 1
if (supl26 gt 1.) and ((size(attenuF))[0] gt 0) then begin
;calculate collimation index for that transmission
collim = strsplit(/EXTRACT, baset.collim, ',')
colidx = where(round(float(collim)*10.)/10. eq round(sans_supl[4]*10.)/10.)
colidx = colidx[0]>0
;real attenuator factor
supl26 = ( supl26 * attenuF[colidx,sans_supl[24]] ) > 1
endif
; Apply attenuator 2 (factor read in sans_supl[71] for D22 and D33)
if sans_supl[71] gt 1. then supl26 *= sans_supl[71]
endelse
; return PHI0
flux = total(tmpbeam) / tim * supl26
end
......@@ -10016,6 +10035,7 @@ if (xregistered('sans_settings_win',/noshow) eq 0) or (fresh) or keyword_set(now
baset.Qdep =Qdep
RDSET, step = sans_supl[67]
endelse
sans_supl[80:99]=paridx
if sans_supl[10] le 0 then sans_supl[10]=thinW
......@@ -11721,6 +11741,7 @@ if (xregistered('sans_settings_win',/noshow) eq 0) or (fresh) or keyword_set(now
endif else sans_settings_mask, baset ;endif not fresh
;**********
endif ;registered
baseSANS=base0
if mappi ge 0 then widget_control,baseSANS,iconify=1-mappi
end
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