code changes for release 2.2.0
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
#pragma TextEncoding = "UTF-8"
|
||||
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
|
||||
#pragma IgorVersion = 6.1
|
||||
#pragma IgorVersion = 6.36
|
||||
#pragma ModuleName = PearlDataExplorer
|
||||
#pragma version = 1.50
|
||||
#pragma version = 1.60
|
||||
#include "pearl-area-import"
|
||||
#include "pearl-area-profiles"
|
||||
#include "pearl-area-display"
|
||||
@ -11,7 +12,7 @@
|
||||
#include "pearl-matrix-import"
|
||||
#endif
|
||||
|
||||
// copyright (c) 2013-16 Paul Scherrer Institut
|
||||
// copyright (c) 2013-20 Paul Scherrer Institut
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@ -258,6 +259,9 @@ static function preview_file(filename)
|
||||
string filename
|
||||
|
||||
dfref saveDF = GetDataFolderDFR()
|
||||
dfref previewDF = $package_path
|
||||
|
||||
killStrings /z authors, pgroup, proposal, proposer, sample
|
||||
|
||||
variable ft = pearl_file_type(filename)
|
||||
switch(ft)
|
||||
@ -288,6 +292,35 @@ static function preview_file(filename)
|
||||
sprintf cmd, "PearlElog#set_panel_graphs(\"\", \"%s\")", graphname
|
||||
execute /Q/Z cmd
|
||||
endif
|
||||
svar /sdfr=previewDF /z authors
|
||||
if (svar_Exists(authors))
|
||||
if (strlen(authors)>=1)
|
||||
sprintf cmd, "PearlElog#set_panel_attributes(\"\", \"author=%s\")", authors
|
||||
execute /Q/Z cmd
|
||||
endif
|
||||
endif
|
||||
svar /sdfr=previewDF /z pgroup
|
||||
if (svar_Exists(pgroup))
|
||||
if (strlen(pgroup)>=1)
|
||||
sprintf cmd, "PearlElog#set_panel_attributes(\"\", \"p-group=%s\")", pgroup
|
||||
execute /Q/Z cmd
|
||||
endif
|
||||
endif
|
||||
svar /sdfr=previewDF /z proposal
|
||||
if (svar_Exists(proposal))
|
||||
if (strlen(proposal)>=1)
|
||||
sprintf cmd, "PearlElog#set_panel_attributes(\"\", \"project=%s\")", proposal
|
||||
execute /Q/Z cmd
|
||||
endif
|
||||
endif
|
||||
svar /sdfr=previewDF /z proposer
|
||||
svar /sdfr=previewDF /z sample
|
||||
if (svar_Exists(sample))
|
||||
if (strlen(sample)>=1)
|
||||
sprintf cmd, "PearlElog#set_panel_attributes(\"\", \"sample=%s\")", sample
|
||||
execute /Q/Z cmd
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -337,6 +370,8 @@ static function /wave preview_pshell_file(filename)
|
||||
|
||||
if (strlen(s_preview_file) > 0)
|
||||
s_file_info = psh5_load_info("pearl_explorer_filepath", filename)
|
||||
setdatafolder previewDF
|
||||
psh5_load_general_group("pearl_explorer_filepath", filename)
|
||||
else
|
||||
s_file_info = ""
|
||||
endif
|
||||
@ -960,15 +995,22 @@ static function /s display_preview_trace(xtrace, ytrace)
|
||||
lab = "X"
|
||||
endif
|
||||
Label /w=$graphname bottom lab + " (\\U)"
|
||||
lab = StringByKey("AxisLabelD", labels, "=", "\r")
|
||||
lab = StringByKey("Dataset", labels, "=", "\r")
|
||||
if (!strlen(lab))
|
||||
lab = "value"
|
||||
endif
|
||||
Label /w=$graphname left lab + " (\\U)"
|
||||
|
||||
|
||||
return s_name
|
||||
end
|
||||
|
||||
/// load the selected files
|
||||
///
|
||||
/// load the files that are selected in the data explorer panel.
|
||||
/// the files are loaded using the load_file() function.
|
||||
///
|
||||
/// @note this function may change the current data folder!
|
||||
///
|
||||
static function load_selected_files([options])
|
||||
string options
|
||||
|
||||
@ -981,6 +1023,7 @@ static function load_selected_files([options])
|
||||
variable ii
|
||||
for (ii = 0; ii < nn; ii += 1)
|
||||
if (wSelectedFiles[ii])
|
||||
setdatafolder saveDF
|
||||
if (ParamIsDefault(options))
|
||||
load_file(wtFiles[ii])
|
||||
else
|
||||
@ -990,15 +1033,19 @@ static function load_selected_files([options])
|
||||
endfor
|
||||
|
||||
update_datasets()
|
||||
setdatafolder saveDF
|
||||
end
|
||||
|
||||
/// load one file
|
||||
///
|
||||
/// this can be a PShell, HDF5, ITX or MTRX file.
|
||||
/// (HDF5 and MTRX files require the corresponding XOP to be loaded - cf. file documentation)
|
||||
///
|
||||
/// @note this function may change the current data folder!
|
||||
///
|
||||
static function load_file(filename, [options])
|
||||
string filename
|
||||
string options
|
||||
|
||||
dfref saveDF = GetDataFolderDFR()
|
||||
|
||||
variable ft = pearl_file_type(filename)
|
||||
switch(ft)
|
||||
case 1:
|
||||
@ -1024,8 +1071,6 @@ static function load_file(filename, [options])
|
||||
default:
|
||||
break
|
||||
endswitch
|
||||
|
||||
setdatafolder saveDF
|
||||
end
|
||||
|
||||
static function prompt_hdf_options(options)
|
||||
@ -1087,6 +1132,27 @@ function prompt_func_params(func_name, func_param)
|
||||
endif
|
||||
end
|
||||
|
||||
/// load a pshell file
|
||||
///
|
||||
/// load a pshell hdf5 file (complete or reduced).
|
||||
///
|
||||
/// if options is not specified, the complete file is loaded.
|
||||
/// if options is an empty string, the package default options are used.
|
||||
///
|
||||
/// the only supported options is `mode:load_reduced`.
|
||||
/// in this case, the name of the reduction function must also be given under the `reduction_func` key.
|
||||
/// the reduction parameters are prompted for if a prompt function for the reduction function is found.
|
||||
/// the default reduction parameters are the most recent parameters `s_reduction_params` stored in the package data folder.
|
||||
///
|
||||
/// @param options `key:value;` list of load options.
|
||||
/// by default, load complete, using psh5_load_complete().
|
||||
/// empty string, use options from `s_hdf_options.
|
||||
/// @arg `mode:load_reduced` load reduced, using psh5_load_reduced().
|
||||
/// @arg `reduction_func:...` name of the reduction function.
|
||||
///
|
||||
/// @note after the function returns,
|
||||
/// the current data folder points to the loaded data (scan1).
|
||||
///
|
||||
static function /df load_pshell_file(filename, [options])
|
||||
string filename
|
||||
string options
|
||||
@ -1122,7 +1188,7 @@ static function /df load_pshell_file(filename, [options])
|
||||
print reduction_func, reduction_params
|
||||
psh5_load_reduced(nickname, "pearl_explorer_filepath", filename, $reduction_func, reduction_params)
|
||||
svar s_filepath
|
||||
loaded_filename = s_filepath
|
||||
loaded_filename = filename
|
||||
endif
|
||||
break
|
||||
endswitch
|
||||
@ -1132,10 +1198,12 @@ static function /df load_pshell_file(filename, [options])
|
||||
if (strlen(loaded_filename) > 0)
|
||||
setdatafolder $("root:" + nickname)
|
||||
dataDF = GetDataFolderDFR()
|
||||
setdatafolder $(":scan1")
|
||||
string /g pearl_explorer_import = "load_pshell_file"
|
||||
else
|
||||
setdatafolder saveDF
|
||||
endif
|
||||
|
||||
setdatafolder saveDF
|
||||
return dataDF
|
||||
end
|
||||
|
||||
@ -1183,9 +1251,10 @@ static function /df load_hdf_file(filename, [options])
|
||||
setdatafolder $("root:" + nickname)
|
||||
dataDF = GetDataFolderDFR()
|
||||
string /g pearl_explorer_import = "load_hdf_file"
|
||||
else
|
||||
setdatafolder saveDF
|
||||
endif
|
||||
|
||||
setdatafolder saveDF
|
||||
return dataDF
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user