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

@ -196,6 +196,7 @@ function /s ad_display_profiles(image, [filter])
view_filter_options = ""
variable /g view_filter_smoothing_x = 1
variable /g view_filter_smoothing_y = 1
variable /g view_cursor_mode = 0
string dfname = ReplaceString("root:", GetDataFolder(1, imagedf), "")
string graphtitle = dfname + NameOfWave(image) + " Profiles"
string /g prof_graphname = graphname_from_dfref(imagedf, "prof_")
@ -348,15 +349,88 @@ function ad_update_profiles(image)
return 0
end
/// switch cursors on a profiles graph
///
/// the standard cursors allow to select the profiles to display in the profiles panes.
/// additional cursors are shown in the profiles panes.
///
/// in the background selection mode, additional cursors allow the user to select
/// the limits of the background and peak integration regions.
/// the meaning of the cursors depends on the particular processing function.
///
/// @param mode cursor mode.
/// @arg 0 (default) standard profile selection. cursors C-F on profile panes.
/// @arg 1 background selection. cursors A-F on image.
///
/// @param image image displayed in the graph.
/// this is the original image, not the one in the view data folder.
///
function ad_profiles_cursor_mode(image, mode)
wave image
variable mode
dfref savedf = GetDataFolderDFR()
wave view_image = get_view_image(image)
dfref viewdf = GetWavesDataFolderDFR(view_image)
svar /sdfr=viewdf graphname = prof_graphname
nvar /sdfr=viewdf cursor_mode = view_cursor_mode
wave /sdfr=viewdf xprofiles, yprofiles
variable dx = DimSize(view_image, 0)
variable dy = DimSize(view_image, 1)
switch(mode)
case 1: // background selection
Cursor /w=$graphname /A=0 /P /I /S=2 /H=1 /L=1 A view_image 0, 0
Cursor /w=$graphname /A=0 /P /I /S=2 /H=1 /L=1 B view_image dx-1, dy-1
Cursor /w=$graphname /A=0 /P /I /S=2 /H=2 /L=1 C view_image round(0.2 * dx) -1, 0
Cursor /w=$graphname /A=0 /P /I /S=2 /H=2 /L=1 D view_image round(0.8 * dx) -1, 0
Cursor /w=$graphname /A=0 /P /I /S=2 /H=2 /L=1 E view_image round(0.4 * dx) -1, 0
Cursor /w=$graphname /A=0 /P /I /S=2 /H=2 /L=1 F view_image round(0.6 * dx) -1, 0
ShowInfo /w=$graphname /CP=0
cursor_mode = mode
break
default:
Cursor /w=$graphname /A=1 /P /I /S=2 /H=1 /L=1 A view_image 0,0
Cursor /w=$graphname /A=1 /P /I /S=2 /H=1 /L=1 B view_image dx-1, dy-1
variable pcurs
pcurs = floor(DimSize(xprofiles, 0) / 3)
Cursor /w=$graphname /A=0 /P /S=1 /H=0 C xprofiles#2 pcurs
pcurs = floor(DimSize(xprofiles, 0) * 2 / 3)
Cursor /w=$graphname /A=0 /P /S=1 /H=0 D xprofiles#2 pcurs
pcurs = floor(DimSize(yprofiles, 0) / 3)
Cursor /w=$graphname /A=0 /P /S=1 /H=0 E yprofiles#2 pcurs
pcurs = floor(DimSize(yprofiles, 0) * 2 / 3)
Cursor /w=$graphname /A=0 /P /S=1 /H=0 F yprofiles#2 pcurs
ShowInfo /w=$graphname /CP=0
cursor_mode = 0
endswitch
setdatafolder savedf
return 0
end
/// move a cursor to the specified position in a profiles graph.
///
/// this function can only set cursors in the image part of the profiles graph.
///
/// @param image image displayed in the graph.
/// this is the original image, not the one in the view data folder.
/// @param cursorname name of the cursor, e.g. "A" or "B".
/// other cursors are allowed but need to be activated separately.
/// @param xa x-coordinate to move the cursor to.
/// the position is coerced to the image scale. +/-inf is allowed.
/// @param ya y-coordinate to move the cursor to.
/// the position is coerced to the image scale. +/-inf is allowed.
/// @param pscale scaling of the position argument
/// @arg 0 (default) wave scaling
/// @arg 1 point scaling
///
function ad_profiles_set_cursor(image, cursorname, xa, ya, [pscale])
wave image // image displayed in the graph. this is the original image, not the one in the view data folder.
string cursorname // name of the cursor. must be "A" or "B".
variable xa, ya // position to move the cursor to.
// the position is coerced to the image scale. +/-inf is allowed.
variable pscale // scaling of the position argument
// 0 (default) = wave scaling
// 1 = point scaling
wave image
string cursorname
variable xa, ya
variable pscale
if (ParamIsDefault(pscale))
pscale = 0