bug fixes in angle scan processing and documentation

This commit is contained in:
2019-02-28 18:55:29 +01:00
parent 9a81493a1a
commit 0fb0fd92c8
6 changed files with 132 additions and 33 deletions

View File

@ -257,9 +257,9 @@ end
/// divide the strip by a sine function in phi (wobble correction).
///
/// the sine function is a curve fit to the intensity integrated over detector angle
/// with a period of 360&degree;.
/// with a period of 360°.
///
/// this normalization may be useful if the intensity varies with a 360&degree; periodicity in the azimuthal angle,
/// this normalization may be useful if the intensity varies with a 360° periodicity in the azimuthal angle,
/// e.g. due to misalignment of the surface normal and the azimuthal rotation axis of the manipulator (wobble).
/// note, however, that this function does not correct other effects of wobble such as angle shifts.
///
@ -1565,6 +1565,58 @@ function rotate_hemi_scan(nickname, angle)
setdatafolder saveDF
end
/// create waves for plotting a hemispherical angle scan.
///
/// the scan data must exist in the current data folder.
///
/// @param nickname name prefix of holo waves.
/// may be empty.
///
/// @param projection mapping function from polar to cartesian coordinates.
/// see @ref PageProjections for details.
/// @arg kProjDist = 0 azimuthal equidistant
/// @arg kProjStereo = 1 stereographic (default)
/// @arg kProjArea = 2 azimuthal equal-area
/// @arg kProjGnom = 3 gnomonic (0 <= polar < 90)
/// @arg kProjOrtho = 4 orthographic
///
///
function /s prepare_hemi_scan_display(nickname, [projection])
string nickname
variable projection
dfref savedf = getdatafolderdfr()
if (ParamIsDefault(projection))
projection = 1
endif
// hemi grid waves
string s_prefix = ""
string s_int = "values"
dfref df = find_hemi_data(nickname, s_prefix, s_int)
string s_polar = s_prefix + "pol"
string s_azim = s_prefix + "az"
wave /sdfr=df /z values = $s_int
wave /sdfr=df /z azim = $s_azim
wave /sdfr=df /z polar = $s_polar
setdatafolder df
string s_ster_rad = s_prefix + "ster_rad"
duplicate /o polar, $s_ster_rad /wave=ster_rad
ster_rad = calc_graph_radius(polar, projection=projection)
string s_ster_x = s_prefix + "ster_x"
string s_ster_y = s_prefix + "ster_y"
duplicate /o azim, $s_ster_x /wave=ster_x, $s_ster_y /wave=ster_y
ster_x = ster_rad * cos(azim * pi / 180)
ster_y = ster_rad * sin(azim * pi / 180)
setdatafolder savedf
end
/// display a plot of a hemispherical angle scan.
///
/// the scan data must exist in the current data folder.
@ -1641,6 +1693,8 @@ function /s display_hemi_scan(nickname, [projection, graphtype, do_ticks, do_gri
endif
endif
prepare_hemi_scan_display(nickname, projection=projection)
// hemi grid waves
string s_prefix = ""
string s_int = "values"
@ -1649,23 +1703,15 @@ function /s display_hemi_scan(nickname, [projection, graphtype, do_ticks, do_gri
string s_polar = s_prefix + "pol"
string s_azim = s_prefix + "az"
string s_matrix = s_prefix + "matrix"
string s_ster_rad = s_prefix + "ster_rad"
wave /sdfr=df /z values = $s_int
wave /sdfr=df /z azim = $s_azim
wave /sdfr=df /z polar = $s_polar
wave /sdfr=df /z ster_rad = $s_ster_rad
wave /sdfr=df /z matrix = $s_matrix
setdatafolder df
string s_ster_rad = s_prefix + "ster_rad"
duplicate /o polar, $s_ster_rad /wave=ster_rad
ster_rad = calc_graph_radius(polar, projection=projection)
string s_ster_x = s_prefix + "ster_x"
string s_ster_y = s_prefix + "ster_y"
duplicate /o azim, $s_ster_x /wave=ster_x, $s_ster_y /wave=ster_y
ster_x = ster_rad * cos(azim * pi / 180)
ster_y = ster_rad * sin(azim * pi / 180)
variable azim_offset = 0
if (!(NumberByKey("version", note(azim), "=", "\r") >= 1.6))
DoAlert /T="display hemi scan" 0, "your dataset doesn't include the version 1.6 flag. if it was created with an earlier version that might be okay. please check that the orientation is correct!"
@ -2534,12 +2580,12 @@ end
/// interpolate a hemispherical scan onto a rectangular grid
///
/// the scan data must exist in the current data folder
/// or in the sub-folder given by the nickname parameter.
///
/// the interpolated data is written to a new two-dimensional wave "matrix".
/// the wave has a fixed size of 181 x 181 points optimized for 1-degree polar steps.
///
/// the function requires the ster_x and ster_y waves that are created by display_hemi_scan,
/// and thus implicitly uses the same projection.
///
/// missing values (nan) are interpolated.
/// this works well only if the missing values are reasonable sparse.
/// the function also applies a gaussian filter to smooth the image.
@ -2547,26 +2593,47 @@ end
///
/// to display the result call display_hemi_scan() with graphtype=3.
///
function interpolate_hemi_scan(nickname)
/// @param nickname name prefix of holo waves.
/// may be empty.
///
/// @param projection mapping function from polar to cartesian coordinates.
/// see @ref PageProjections for details.
/// @arg kProjDist = 0 azimuthal equidistant
/// @arg kProjStereo = 1 stereographic (default)
/// @arg kProjArea = 2 azimuthal equal-area
/// @arg kProjGnom = 3 gnomonic (0 <= polar < 90)
/// @arg kProjOrtho = 4 orthographic
///
///
function interpolate_hemi_scan(nickname, [projection])
string nickname
variable projection
dfref savedf = GetDataFolderDFR()
if (ParamIsDefault(projection))
projection = 1
endif
string s_prefix = ""
string s_int = "values"
dfref df = find_hemi_data(nickname, s_prefix, s_int)
prepare_hemi_scan_display(nickname, projection=projection)
string s_polar = s_prefix + "pol"
string s_azim = s_prefix + "az"
string s_matrix = s_prefix + "matrix"
string s_ster_rad = s_prefix + "ster_rad"
string s_ster_x = s_prefix + "ster_x"
string s_ster_y = s_prefix + "ster_y"
wave /sdfr=df values = $s_int
wave /sdfr=df azim = $s_azim
wave /sdfr=df polar = $s_polar
wave /sdfr=df ster_x = $s_ster_x
wave /sdfr=df ster_y = $s_ster_y
wave /sdfr=df /z values = $s_int
wave /sdfr=df /z azim = $s_azim
wave /sdfr=df /z polar = $s_polar
wave /sdfr=df /z ster_rad = $s_ster_rad
wave /sdfr=df /z ster_x = $s_ster_x
wave /sdfr=df /z ster_y = $s_ster_y
variable min_ster_x = wavemin(ster_x)
variable max_ster_x = wavemax(ster_x)
variable x0 = min_ster_x
@ -3040,7 +3107,6 @@ static function check_contrast(values, pcmin, pcmax, vmin, vmax)
variable imax = round(numpnts(index) * (100 - pcmax) / 100)
vmin = values[index[imin]]
vmax = values[index[imax]]
KillDataFolder dfr
setdatafolder save_df
end