1 #pragma rtGlobals=3// Use modern global access method and strict wave access. 2 #include "pearl-area-profiles" 31 dfref savedf = GetDataFolderDFR()
32 dfref datadf = GetWavesDataFolderDFR(data)
35 make /n=5 /d /o w_coef_int
36 make /n=7 /d /o w_coef_curved
40 duplicate /free xint, xint_sig
41 xint_sig = sqrt(xint * 4) / 4
42 variable xmin = wavemin(xint)
43 variable xmax = wavemax(xint)
44 variable xmean = mean(xint)
49 w_coef_int[2] = xmax - xmin
50 w_coef_int[3] = dimoffset(xint, 0) + dimdelta(xint, 0) * dimsize(xint, 0) / 2
52 FuncFit /NTHR=0 FermiFuncLinDOS w_coef_int xint /D /I=1 /W=xint_sig
54 duplicate /o w_sigma, w_sigma_int
58 variable ymean = mean(yavg)
60 duplicate /o data, data_norm, data_sig
61 data_sig = sqrt(data * 4) / 4
62 data_norm = data_norm * ymean / yavg[q]
63 data_sig = data_sig * ymean / yavg[q]
71 w_coef_curved[0] = {0, 0, 1, 95.5, 100, 0, -0.0001}
72 w_coef_curved[0] = xmin
73 w_coef_curved[2] = xmax - xmin
74 w_coef_curved[3] = w_coef_int[3]
75 w_coef_curved[4] = w_coef_int[4]
85 duplicate /o data_norm, fit_data_norm
86 FuncFitMD /X=1 /NTHR=0 FermiFuncLinDOS_2Dcorr w_coef_curved data_norm /D=fit_data_norm /I=1 /W=data_sig
88 duplicate /o w_sigma, w_sigma_curved
90 display /k=1; appendimage data_norm
91 ModifyImage data_norm ctab= {xmin,xmax,Grays,0}
92 AppendMatrixContour fit_data_norm
101 dfref savedf = GetDataFolderDFR()
102 wave /sdfr=root: Tint, Tint_sig, Tcurv, Tcurv_sig, EFcurv, EFcurv_sig
103 wave w_coef_int, w_coef_curved
104 wave w_sigma_int, w_sigma_curved
106 Tint[index] = w_coef_int[4]
107 Tint_sig[index] = w_sigma_int[4]
108 Tcurv[index] = w_coef_curved[4]
109 Tcurv_sig[index] = w_sigma_curved[4]
110 EFcurv[index] = w_coef_curved[3]
111 EFcurv_sig[index] = w_sigma_curved[3]
121 string name = nameofwave(data)
123 duplicate /o data, data_out
124 redimension /n=(dimsize(data,0)) data_out
127 if (waveexists(data_sig))
128 duplicate /o data_sig, sig_out
129 redimension /n=(dimsize(data,0)) sig_out
136 variable sum_ywgt = sum(ywgt)
138 variable nx = dimsize(data, 0)
139 variable ny = dimsize(data, 1)
147 wave PassEnergy = :attr:PassEnergy
148 wave NumSlices = :attr:NumSlices
150 for (iy = 0; iy < ny; iy += 1)
151 dy = dimoffset(data, 1) + dimdelta(data, 1) * iy
152 dy = dy / dimdelta(data, 1)
153 dx =
slit_shift(dy * 902 / NumSlices[0], PassEnergy[0])
154 dp = round(dx / dimdelta(data, 0))
155 dp_min = min(dp_min, dp)
157 data_out[] = p+dp >= 0 ? data_out + data[p+dp][iy] * ywgt[iy] : data_out
159 if (waveexists(data_sig))
160 sig_out = p+dp >= 0 ? sig_out + data_sig[p+dp][iy] * ywgt[iy] : sig_out
165 data_out[0, -dp_min][] = nan
167 if (waveexists(sig_out))
181 if (!WaveExists(data_out))
182 string name = nameofwave(data) +
"_corr" 183 duplicate /o data, $name
184 wave data_out = $name
189 variable nx = dimsize(data, 0)
190 variable ny = dimsize(data, 1)
198 for (iy = 0; iy < ny; iy += 1)
199 dy = dimoffset(data, 1) + dimdelta(data, 1) * iy
200 dy = dy / dimdelta(data, 1)
202 dp = round(dx / dimdelta(data, 0))
203 dp_min = min(dp_min, dp)
205 if (wavedims(data_out) >= 2)
206 data_out[][iy] = p+dp >= 0 ? data_out + data[p+dp][iy] : data_out
208 data_out = p+dp >= 0 ? data_out + data[p+dp][iy] : data_out
212 data_out[0, -dp_min][] = nan
222 Wave w; Variable x; variable y
234 variable pos = w[3] +
slit_shift(y * w[9], w[8])
235 variable transm = 1 + w[5] * y + w[6] * y^2 + w[7] * y^3
236 variable fermi = (w[1] * min(x - pos, 0) + w[2]) / ( exp( (x - pos) / (kBoltzmann * w[4]) ) + 1.0 )
237 return transm * (fermi + w[0])
241 threadsafe Function FermiFuncLinDOS_2Dcorr_old(w,x,y) : FitFunc
245 Wave w; Variable x; variable y
254 variable pos = w[3] + w[5] * y + w[6] * y^2
255 return w[0] + (w[1] * min(x - pos, 0) + w[2]) / ( exp( (x - pos) / (kBoltzmann * w[4]) ) + 1.0 )
267 threadsafe variable
slit_shift(variable ypix, variable epass){
278 variable isin = asin(ypix / rpix)
279 variable dene = rene * (cos(isin) - 1)
288 variable ny = dimsize(data, 1)
289 make /o /n=(ny) shift_x
290 setscale /i x -ny/2, ny/2,
"", shift_x
291 wave PassEnergy = :attr:PassEnergy
292 wave NumSlices = :attr:NumSlices
294 shift_x =
slit_shift(x * 902 / NumSlices[0], PassEnergy[0])
296 variable ecenter = dimoffset(data, 0) + dimdelta(data, 0) * dimsize(data, 0) / 2
319 return epass * max(0.2, slit) / 0.2 / respow
threadsafe variable FermiFuncLinDOS2D_corr(variable w, threadsafe x, wave y)
threadsafe variable slit_shift(variable ypix, variable epass)
static const variable mcp_radius_pix
MCP radius seen by the camera in pixels.
static const variable mcp_radius_mm
physical size (radius) of the MCP in mm
threadsafe wave ad_profile_y(wave dataset, variable p1, variable p2, string destname, variable noavg=defaultValue)
1D cut through 2D dataset along Y dimension, new destination wave.
variable analyse_curved_edge(wave data)
static const variable hemi_radius_mm
physical size (radius) of the hemisphere in mm
variable analyser_energy_resolution(variable epass, variable slit)
calculate the energy resolution of the analyser
variable slit_correction(wave data, wave data_out, variable epass)
static const variable mcp_radius_epass
energy range imaged on MCP relative to the pass energy
variable integrate_curved_edge(wave data, wave data_sig)
variable show_shift(wave data)
threadsafe wave ad_profile_x(wave dataset, variable q1, variable q2, string destname, variable noavg=defaultValue)
1D cut through 2D dataset along X dimension, new destination wave.
variable record_results(variable index)