minor updates and bug fixes in angle scan processing and data explorer

This commit is contained in:
2019-02-10 14:31:06 +01:00
parent b2f4816629
commit 3235d52212
6 changed files with 594 additions and 36 deletions

View File

@ -160,6 +160,8 @@ end
/// this is a simple way to remove the effect of the angle-dependence of the analyser transmission function.
/// the strip is normalized in place, previous data is overwritten.
///
/// the function can handle sparse NaNs.
///
/// @param[in,out] strip 2D data, X-axis = analyser angle, Y-axis = arbitrary manipulator scan
///
/// @param[in] smooth_method smoothing method
@ -205,12 +207,20 @@ function normalize_strip_x(strip, [smooth_method, smooth_factor, check])
endif
// average over all scan positions
wave dist = ad_profile_x(strip, -inf, inf, "")
wave raw_dist = ad_profile_x(strip, -inf, inf, "")
// remove nans
extract /free /indx raw_dist, clean_index, numtype(raw_dist) == 0
duplicate /free raw_dist, dist, dist_x
redimension /n=(numpnts(clean_index)) dist, dist_x
dist = raw_dist[clean_index[p]]
dist_x = pnt2x(raw_dist, clean_index[p])
variable div = mean(dist)
dist /= div
if (check)
duplicate /o dist, check_dist
duplicate /o raw_dist, check_dist
check_dist = numtype(raw_dist) == 0 ? interp(x, dist_x, dist) : nan
endif
// smooth distribution function
@ -223,21 +233,24 @@ function normalize_strip_x(strip, [smooth_method, smooth_factor, check])
break
case 3:
make /n=1 /d /free fit_params
fit_scienta_ang_transm(dist, fit_params)
fit_scienta_ang_transm(raw_dist, fit_params)
duplicate /free raw_dist, dist, dist_x
dist_x = x
dist = scienta_ang_transm(fit_params, x)
break
case 4:
loess /smth=(smooth_factor) srcWave=dist
loess /smth=(smooth_factor) srcWave=dist, factors={dist_x}
break
endswitch
if (check)
duplicate /o dist, check_smoo
duplicate /o raw_dist, check_smoo
check_smoo = interp(x, dist_x, dist)
endif
// divide
if (check != 2)
strip /= dist[p]
strip /= interp(x, dist_x, dist)
endif
end
@ -1660,6 +1673,17 @@ function /s display_hemi_scan(nickname, [projection, graphtype, do_ticks, do_gri
endif
string s_trace
DoWindow $graphname
if (v_flag)
if (str2num(GetUserData(graphname, "", "graphtype")) == graphtype)
// graph exists and will update automatically - do not recreate
graphtype = 0
else
// graph exists - but needs recreating
killwindow $graphname
endif
endif
switch(graphtype)
case 1:
graphname = display_polar_graph(graphname, angle_offset=azim_offset, do_ticks=do_ticks)
@ -1673,6 +1697,7 @@ function /s display_hemi_scan(nickname, [projection, graphtype, do_ticks, do_gri
ColorScale /W=$graphname /C /N=text0 nticks=2, minor=1, tickLen=4.00, tickThick=0.50
SetWindow $graphname, userdata(projection)=num2str(projection)
SetWindow $graphname, userdata(graphtype)=num2str(graphtype)
draw_hemi_axes(graphname, do_grids=do_grids)
break
case 3:
@ -1687,6 +1712,7 @@ function /s display_hemi_scan(nickname, [projection, graphtype, do_ticks, do_gri
ColorScale /W=$graphname /C /N=text0 nticks=2, minor=1, tickLen=4.00, tickThick=0.50
SetWindow $graphname, userdata(projection)=num2str(projection)
SetWindow $graphname, userdata(graphtype)=num2str(graphtype)
draw_hemi_axes(graphname, do_grids=do_grids)
break
endswitch