updates: pshell import, angle-scans, elog

- pshell import: fix units and data scaling.
- pshell import: support new multi-region scans.
- angle scans: add trim function.
- angle scans: update import_tpi_scan function.
- angle scans: fix scales of check waves in normalization.
- area display: new cursor mode for background selection.
- elog: bugfixes (attachment list, check existing logbook).
This commit is contained in:
2017-07-04 11:06:49 +02:00
parent 9a65d26984
commit 80a01f2bdb
8 changed files with 426 additions and 94 deletions

View File

@ -300,6 +300,7 @@ function normalize_strip_theta(strip, theta, [theta_offset, smooth_method, smoot
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
variable nx = dimsize(strip, 0)
variable ix
@ -336,6 +337,7 @@ function normalize_strip_theta(strip, theta, [theta_offset, smooth_method, smoot
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
@ -1861,7 +1863,7 @@ function /s display_scanlines(nickname, alpha_lo, alpha_hi, m_theta, m_tilt, m_p
make /n=1 /d /free d_polar, d_azi
variable n_alpha = round(alpha_hi - alpha_lo) + 1
make /n=(n_alpha) /d /free analyser
setscale /i x alpha_lo, alpha_hi, "deg", analyser
setscale /i x alpha_lo, alpha_hi, "<EFBFBD>", analyser
analyser = x
convert_angles_ttpa2polar(m_theta, loc_m_tilt, m_phi, analyser, d_polar, d_azi)
@ -2586,8 +2588,35 @@ end
/// import a hemispherical scan from theta-phi-intensity waves and display it
///
/// @warning EXPERIMENTAL
/// the interface and behaviour of this function may change
/// in the tpi format, the hemi scan data is represented
/// by a triple of flat one-dimensional waves
/// corresponding to the polar angle (theta), azimuthal angle (phi) and intensity.
/// no specific sort order is required.
///
/// @param nickname nick name for output data
/// @arg in default mode, this will become the name of a child folder containing the output.
/// @arg in XPDplot mode, this will become a prefix of the generated data in the root folder.
///
/// @param theta theta angles, 0 = normal emission.
///
/// @param phi phi angles, 0 = azimuthal origin. size = dimsize(data, 1)
///
/// @param intensity intensity wave, see requirements above.
///
/// @param npolar number of polar angles, determines polar and azimuthal step size.
/// default = 91 (1 degree steps)
///
/// @param folding rotational averaging.
/// example: 3 = average to 3-fold symmetry.
/// default = 1.
///
/// @param nograph display a new graph window?
/// @arg 0 (default) display a new polar graph
/// @arg 1 don't display a new graph
///
/// @param xpdplot XPDplot compatibility
/// @arg 0 (default) create waves in child folder $nickname
/// @arg 1 create waves in root folder (compatible with XPDplot)
///
function import_tpi_scan(nickname, theta, phi, intensity, [folding, npolar, nograph, xpdplot])
string nickname
@ -2622,7 +2651,43 @@ function import_tpi_scan(nickname, theta, phi, intensity, [folding, npolar, nogr
fold_phi = fold_phi >= 180 ? fold_phi + 360 / folding - fold_phi : fold_phi + 360 / folding
endfor
display_hemi_scan(nickname)
if (nograph==0)
display_hemi_scan(nickname)
endif
end
/// trim a hemispherical scan at grazing angle
///
/// the function recalaculates the values wave from totals and weights
/// but sets elements above a given polar angle to nan.
///
/// @param nickname name of the scan dataset.
/// can be empty if no prefix is used.
/// the dataset must be in the current datafolder.
///
/// @param theta_max highest polar angle to keep (0...90 degrees).
///
function trim_hemi_scan(nickname, theta_max)
string nickname
variable theta_max
if (strlen(nickname))
string s_prefix = nickname + "_"
string s_int = s_prefix + "i"
else
s_prefix = ""
s_int = "values"
endif
string s_totals = s_prefix + "tot"
string s_weights = s_prefix + "wt"
string s_polar = s_prefix + "pol"
wave w_polar = $s_polar
wave w_values = $s_int
wave w_totals = $s_totals
wave w_weights = $s_weights
w_values = w_polar <= theta_max ? w_totals / w_weights : nan
end
/// extract a polar cut from a hemispherical scan.
@ -2772,7 +2837,7 @@ function /wave hemi_azi_cut(nickname, pol)
make /n=(nsel) /o $s_cut
wave w_cut = $s_cut
w_cut = w_values[sel]
setscale /i x w_azim[sel[0]], w_azim[sel[nsel-1]], "deg", w_cut
setscale /i x w_azim[sel[0]], w_azim[sel[nsel-1]], "<EFBFBD>", w_cut
return w_cut
else
return $""