distro release 2.1.1
This commit is contained in:
@ -515,6 +515,88 @@ function normalize_strip_thetaphi(strip, theta, phi, [theta_offset, smooth_metho
|
||||
endif
|
||||
end
|
||||
|
||||
/// divide the strip piecewise by a smooth polar distribution.
|
||||
///
|
||||
/// @warning experimental. this function is under development.
|
||||
///
|
||||
///
|
||||
function normalize_strip_theta_scans(strip, theta, [theta_offset, smooth_method, smooth_factor, check])
|
||||
wave strip
|
||||
wave theta
|
||||
variable theta_offset
|
||||
variable smooth_method
|
||||
variable smooth_factor
|
||||
variable check
|
||||
|
||||
if (ParamIsDefault(check))
|
||||
check = 0
|
||||
endif
|
||||
if (ParamIsDefault(theta_offset))
|
||||
theta_offset = 0
|
||||
endif
|
||||
if (ParamIsDefault(smooth_method))
|
||||
smooth_method = 4
|
||||
endif
|
||||
if (ParamIsDefault(smooth_factor))
|
||||
smooth_factor = 0.5
|
||||
endif
|
||||
|
||||
// average over analyser angles
|
||||
wave dist = ad_profile_y(strip, -inf, inf, "")
|
||||
|
||||
// smooth distribution function
|
||||
duplicate /free dist, dist_smoo
|
||||
duplicate /free theta, theta_int
|
||||
theta_int = theta - theta_offset
|
||||
setscale /p x theta_int[0], theta_int[1] - theta_int[0], waveunits(theta,-1), dist, dist_smoo
|
||||
|
||||
// analyse scanning scheme
|
||||
duplicate /free theta_int, d1_theta, d2_theta
|
||||
Differentiate /METH=2 theta_int /D=d1_theta
|
||||
Differentiate /METH=2 d1_theta /D=d2_theta
|
||||
d2_theta = abs(d2_theta)
|
||||
make /free w_levels
|
||||
FindLevels /edge=1 /p /q /d=w_levels d2_theta, 0.1
|
||||
if (v_flag != 1)
|
||||
abort "unrecognized scanning scheme"
|
||||
endif
|
||||
w_levels = ceil(w_levels)
|
||||
InsertPoints 0, 1, w_levels
|
||||
w_levels[0] = 0
|
||||
InsertPoints numpnts(w_levels), 1, w_levels
|
||||
w_levels[numpnts(w_levels)-1] = numpnts(theta_int)
|
||||
|
||||
variable n_scans = numpnts(w_levels) - 1
|
||||
variable i_scan
|
||||
variable p1, p2
|
||||
for (i_scan = 0; i_scan < n_scans; i_scan += 1)
|
||||
p1 = w_levels[i_scan]
|
||||
p2 = w_levels[i_scan+1] - 1
|
||||
duplicate /free /r=[p1, p2] dist, dist_piece, smooth_piece
|
||||
duplicate /free /r=[p1, p2] theta_int, theta_piece
|
||||
switch(smooth_method)
|
||||
case 4:
|
||||
loess /dest=smooth_piece /smth=(smooth_factor) srcWave=dist_piece, factors={theta_piece}
|
||||
break
|
||||
default:
|
||||
abort "smooth method not supported"
|
||||
endswitch
|
||||
dist_smoo[p1, p2] = smooth_piece[p - p1]
|
||||
endfor
|
||||
|
||||
// divide
|
||||
if (check != 2)
|
||||
strip /= dist_smoo[q]
|
||||
endif
|
||||
|
||||
// check
|
||||
if (check)
|
||||
duplicate /o dist, check_dist
|
||||
duplicate /o dist_smoo, check_smoo
|
||||
setscale /p x dimoffset(dist,0), dimdelta(dist,0), waveunits(dist,0), check_dist, check_smoo
|
||||
endif
|
||||
end
|
||||
|
||||
/// divide the strip by a two-dimensional normalization function.
|
||||
///
|
||||
/// @warning experimental. this function is under development.
|
||||
@ -606,6 +688,42 @@ function crop_strip(strip, xlo, xhi)
|
||||
setscale /i x xlo, xhi, waveunits(strip, 0), strip
|
||||
end
|
||||
|
||||
/// crop a strip in theta.
|
||||
///
|
||||
/// the strip is cropped in place, data outside the region of interest is lost.
|
||||
///
|
||||
/// @param[in,out] strip 2D data, X-axis = analyser angle, Y-axis = arbitrary manipulator scan
|
||||
/// @param[in] ylo lowest polar angle to keep (will be rounded to nearest existing point)
|
||||
/// @param[in] yhi highest polar angle to keep (will be rounded to nearest existing point)
|
||||
/// @param[in,out] theta polar angle along the Y dimension of strip.
|
||||
/// this wave is modified: cropped rows are deleted.
|
||||
/// @param[in,out] tilt tilt angle along the Y dimension of strip.
|
||||
/// this wave is modified: cropped rows are deleted.
|
||||
/// @param[in,out] phi azimuthal angle along the Y dimension of strip.
|
||||
/// this wave is modified: cropped rows are deleted.
|
||||
///
|
||||
function crop_strip_theta(strip, theta_lo, theta_hi, theta, tilt, phi)
|
||||
wave strip
|
||||
variable theta_lo
|
||||
variable theta_hi
|
||||
wave theta
|
||||
wave tilt
|
||||
wave phi
|
||||
|
||||
extract /indx /free theta, idx, (theta >= theta_lo) && (theta <= theta_hi)
|
||||
variable nx = dimsize(strip, 0)
|
||||
variable ny = numpnts(idx)
|
||||
|
||||
theta = theta[idx]
|
||||
tilt = tilt[idx]
|
||||
phi = phi[idx]
|
||||
redimension /n=(ny) theta, tilt, phi
|
||||
|
||||
duplicate /free strip, strip_copy
|
||||
redimension /n=(nx,ny) strip
|
||||
strip = strip_copy[p][idx[q]]
|
||||
end
|
||||
|
||||
/// create a pizza plot from a measured (energy-integrated) data strip
|
||||
///
|
||||
/// accepts angle-scan data as returned by adh5_load_reduced(),
|
||||
@ -3198,3 +3316,37 @@ function set_contrast(pcmin, pcmax, [graphname, colortable])
|
||||
|
||||
setdatafolder save_df
|
||||
end
|
||||
|
||||
/// k-space mapping of 2D angle-energy distribution (scienta image)
|
||||
///
|
||||
/// courtesy of F. Matsui
|
||||
///
|
||||
/// @param inwave 2D wave, x = kinetic energy (eV), y = polar angle (deg)
|
||||
/// note: the kinetic energy is with reference to the vacuum level at the sample.
|
||||
/// if the work functions of the analyser and the sample differ:
|
||||
/// Ekin,sample = Ekin,analyser + WFanalyser - WFsample
|
||||
/// where WFanalyser = Ephot - EFermi
|
||||
///
|
||||
/// @return the output wave has the name of the input wave with the suffix "_k".
|
||||
///
|
||||
Function AngleToK(inwave)
|
||||
Wave inwave
|
||||
String newname = NameofWave(inwave)+"_k"
|
||||
Duplicate/O inwave, $newname
|
||||
Wave outwave = $newname
|
||||
Variable rows,columns,xdelta,xoffset,ydelta,yoffset,kmin,kmax,Emax
|
||||
// inwave parameters
|
||||
rows = DimSize(inwave,0)
|
||||
columns = DimSize(inwave,1)
|
||||
xdelta = DimDelta(inwave,0)
|
||||
xoffset = DimOffset(inwave,0)
|
||||
ydelta = DimDelta(inwave,1)
|
||||
yoffset = DimOffset(inwave,1)
|
||||
Emax= xoffset + xdelta*(rows-1)
|
||||
kmin = 0.5123*sqrt(Emax)*sin(pi/180*(yoffset)) // calculate the k boundaries
|
||||
kmax = 0.5123*sqrt(Emax)*sin(pi/180*(yoffset+(columns-1)*ydelta))
|
||||
SetScale/I y kmin,kmax,"Ang^-1", outwave
|
||||
// scale the y axis
|
||||
outwave = interp2D(inwave, x, 180/pi*asin(y/ (0.5123*sqrt(x)))) // recalculate to k
|
||||
outwave = (NumType(outwave)==2) ? 0 : outwave // replace NaNs (optional)
|
||||
End
|
||||
|
Reference in New Issue
Block a user