Repository Documentation
Shiver
Main Qt application for shiver
- class shiver.shiver.Shiver
Main Shiver window
- shiver.shiver.gui()
Main entry point for Qt application
Models
Model for the Sample Parameters dialog
- class shiver.models.sample.SampleModel(name=None)
Sample model
- connect_error_message(callback)
Set the callback function for error messages
- get_lattice_from_ub_matrix(ub_matrix)
check and return lattice parameters using ub matrix
- get_lattice_ub()
return oriented lattice object from mtd - if no name provided initialize lattice
- get_ub_matrix_from_lattice(params)
check and return ub matrix using lattice parameters
- is_nexus_processed(filename)
Return true if the file is NexusProcessed - can be loaded through LoadNexusProcessed, else false
- load_isaw_ub(filename)
Mantid LoadIsawUB with Isaw file
- load_nexus_processed(filename)
Mantid SetUB with Nexus file
- load_nexus_ub(filename)
Mantid SetUB with Nexus file
- save_isaw(filename)
Save in Isaw file
- set_ub(params)
Mantid SetUB with current workspace
- validate_lattice(params)
validate the lattice values
- validate_matrix(ub_matrix)
validate the ub matrix values
- shiver.models.sample.update_sample_mde_config(name, oriented_lattice)
Update the MDE Config Sample Parameters, if the MDE Config exists
single help module
- shiver.models.help.help_function(context)
open a browser with the appropriate help page
Model for the Generate tab
- class shiver.models.generate.GenerateMDEObserver(*args: Any, **kwargs: Any)
Observer to handle the execution of GenerateDGSMDE
- errorHandle(msg)
Call parent upon error of algorithm
- finishHandle()
Call parent upon completion of algorithm
- class shiver.models.generate.GenerateModel
Generate model
- connect_error_message(callback)
Connect error message
- connect_generate_mde_finish_callback(callback)
Connect generate mde finish
- finish_generate_mde(obs, error=False, msg='')
Callback from algorithm observer for GenerateDGSMDE
Parameters
- obsAlgorithmObserver
Observer of the algorithm
- errorbool, optional
Error flag, by default False
- msgstr, optional
Error message, by default “”
- finish_save_md(obs, error=False, msg='')
Callback from saveMD observer.
Parameters
- obsAlgorithmObserver
observer for SaveMD
- error: bool
Error flag
- msg: str, optional
Error message
- generate_mde(config_dict: dict)
Call GenerateDGSMDE algorithm
Parameters
- config_dictdict
Configuration dictionary
- save_mde_to_disk()
Save the generated MDE workspace to disk.
- class shiver.models.generate.SaveMDObserver(*args: Any, **kwargs: Any)
Observer to handle the execution of SaveMD
- errorHandle(msg)
Call parent upon error of algorithm
- finishHandle()
Call parent upon completion of algorithm
- shiver.models.generate.gather_mde_config_dict(workspace_name: str) dict
Generate a config dictionary for given MDE workspace.
Parameters
- workspace_namestr
Name of the MDE workspace
Returns
- dict
Dictionary containing the config information
- shiver.models.generate.save_mde_config_dict(workspace_name, config_dict)
Save the config dictionary in the given MDE workspace.
The Shiver ConvertDGSToSingleMDE mantid algorithm
- class shiver.models.convert_dgs_to_single_mde.ConvertDGSToSingleMDE(*args: Any, **kwargs: Any)
ConvertDGSToSingleMDE algorithm
- shiver.models.convert_dgs_to_single_mde.get_Ei_T0(data, data_m, Ei_supplied, T0_supplied, filenames, progress=None)
Determines the Ei and T0 values from the data supplied
The Shiver MakeSlice mantid algorithm
The Shiver MakeSFCorrectedSlices mantid algorithm
- class shiver.models.makeslices.MakeSFCorrectedSlices(*args: Any, **kwargs: Any)
MakeSFCorrectedSlices algorithm
The Shiver GenerateDGSMDE mantid algorithm
- class shiver.models.generate_dgs_mde.GenerateDGSMDE(*args: Any, **kwargs: Any)
GenerateDGSMDE algorithm
Model for Corrections tab
- class shiver.models.corrections.ApplyDetailedBalanceMDObserver(*args: Any, **kwargs: Any)
Observer for ApplyDetailedBalanceMD algorithm
- errorHandle(msg)
Call upon algorithm error
- finishHandle()
Call upon algorithm finishing
- class shiver.models.corrections.CorrectionsModel
Corrections table model
- apply(ws_name: str, detailed_balance: bool, hyspec_polarizer_transmission: bool, temperature: str = '') None
Apply corrections.
Parameters
- ws_namestr
Workspace name
- detailed_balancebool
Apply detailed balance
- hyspec_polarizer_transmissionbool
Apply HYSPEC polarizer transmission correction
- temperaturestr, optional
Temperature value as string or log entry contains temperature, by default “”
Return
None
Note
- The applied correction is noted as the suffix of the workspace name
detailed balance: “_DB”
HYSPEC polarizer transmission: “_PT”
- apply_detailed_balance(ws_name: str, temperature: str, output_ws_name: str) None
Apply detailed balance to the workspace.
Parameters
- ws_namestr
Workspace name
- temperaturestr
Temperature value as string or log entry contains temperature
- output_ws_namestr
Output workspace name
Returns
None
- apply_detailed_balance_finished(ws_name: str, alg: ApplyDetailedBalanceMDObserver, error: bool = False, msg='') None
Call when ApplyDetailedBalanceMD finishes.
Parameters
- ws_namestr
Workspace name
- algApplyDetailedBalanceMDObserver
Observer
- errorbool, optional
Error flag, by default False
- msgstr, optional
Error message, by default “”
Returns
None
- apply_scattered_transmission_correction(ws_name: str, output_ws_name: str) None
Apply DGSScatterTransmissionCorrection to the workspace.
- ref: IOP Conf. Series: Journal of Physics: Conf. Series 862 (2017) 012023
Parameters
- ws_namestr
Workspace name
- output_ws_namestr
Output workspace name
Returns
None
- apply_scattered_transmission_correction_finished(ws_name: str, alg: DgsScatteredTransmissionCorrectionMDObserver, error: bool = False, msg='') None
Call when DgsScatteredTransmissionCorrectionMD finishes.
Parameters
- ws_namestr
Workspace name
- algDgsScatteredTransmissionCorrectionMDObserver
Observer
- errorbool, optional
Error flag, by default False
- msgstr, optional
Error message, by default “”
Returns
None
- connect_error_message(callback)
Set the callback function for error messages.
Parameters
- callbackfunction
Callback function
Returns
None
- get_ws_alg_histories(ws_name: str) list
Get algorithm histories of the workspace.
Parameters
- ws_namestr
Workspace name
Returns
- list
List of algorithm histories
- has_apply_detailed_balance(ws_name: str) Tuple[bool, str]
Check if the workspace has ApplyDetailedBalanceMD applied.
Parameters
- ws_namestr
Workspace name
Returns
- Tuple[bool, str]
True if the workspace has ApplyDetailedBalanceMD applied Temperature if the workspace has ApplyDetailedBalanceMD applied
- class shiver.models.corrections.DgsScatteredTransmissionCorrectionMDObserver(*args: Any, **kwargs: Any)
Observer for DgsScatteredTransmissionCorrectionMD algorithm
- errorHandle(msg)
Call upon algorithm error
- finishHandle()
Call upon algorithm finishing
Common utility functions
- shiver.models.utils.flatten_list(xlst)
Flattens a list of lists list(flatten_list([[[‘test’]],1,2,[3,4,[5,6]]])) will yield [‘test’, 1, 2, 3, 4, 5, 6]
Model for the Histogram tab
- class shiver.models.histogram.ADSObserver(*args: Any, **kwargs: Any)
Object to handle interactions with the ADS
- addHandle(ws, _)
Callback handle for ADS add
- clearHandle()
Callback handle for ADS clear
- deleteHandle(ws, _)
Callback handle for ADS delete
- register_call_back(callback)
Set the callback function for workspace changes
- renameHandle(old, new)
Callback handle for ADS rename
- replaceHandle(ws, _)
Callback handle for ADS replace
- class shiver.models.histogram.FileLoadingObserver(*args: Any, **kwargs: Any)
Object to handle the execution events of the loading algorithms
- errorHandle(msg)
Call parent upon algorithm error
- finishHandle()
Call parent upon algorithm finishing
- class shiver.models.histogram.HistogramModel
Histogram model
- clone(ws_name, ws_clone_name)
Clone the workspace
- connect_error_message(callback)
Set the callback function for error messages
- connect_makeslice_finish(callback)
Set the callback function for makeslice finish
- connect_warning_message(callback)
Set the callback function for error messages
- delete(ws_name)
Delete the workspace
- do_make_slice(config: dict)
Method to take filename and workspace type and load with correct algorithm
- finish_loading(obs, filename, ws_type, ws_name, error=False, msg='')
This is the callback from the algorithm observer
- finish_make_slice(obs, ws_names, error=False, msg='')
This is the callback from the algorithm observer
- get_all_valid_workspaces()
Get all existing workspaces
- get_ei(ws_name)
Return the Ei for the given workspace
- get_make_slice_history(name) dict
Get the history of the last applied MakeSlice/s algorithm.
Parameters
- namestr
The name of the histogram workspace for history retrieval
Returns
- dict
A dictionary of the history of the make slice algorithm
- get_plot_display_name(ws_name, ndims)
Method retrieve all dimension names, minimum and maximum for displaying in the plot
- load(filename, ws_type)
Method to take filename and workspace type and load with correct algorithm
- load_dataset(dataset: dict) Tuple[str, str, str]
Perform dataset loading with given parameters dictionary.
Parameters
- datasetdict
Dictionary of parameters for loading the dataset.
Returns
- Tuple[str, str, str]
Tuple of workspace names for data, background and normalization.
- rename(old_name, new_name)
Rename the workspace from old_name to new_name
- save(ws_name, filename)
Save the workspace to Nexus file.
- save_history(ws_name, filename)
Save the mantid algorithm history
- save_to_ascii(ws_name: str, filename: str, ignore_integrated: bool = False, num_ev_norm: bool = False, format_str: str = '%.6e')
Save an MDHistoToWorkspace to an ascii file (column format).
Parameters
- ws_namestr
Name of the workspace to save.
- filenamestr
Name of the file to save to.
- IgnoreIntegratedbool, optional
If True, the integrated dimensions are ignored (smaller files), but that information is lost (default is False).
- NumEvNormbool, optional
Must be set to true if data was converted to MD from a histogram workspace (like NXSPE) and no MDNorm algorithms were used.
- format_strstr, optional
Format string for the output (default is “%.6e”).
NOTE
This function is adapted from DGS_SC_scripts/slice_util.py::SaveMDToAscii.
- scale(ws_name_in, ws_name_out, scale_factor)
Scale the workspace
- symmetry_operations(symmetry)
Validate the symmetry value with mantid
- validate_workspace_logs(config: dict)
Method to validate sample logs and flipping ratios of SF and NSF workspaces
- ws_change_call_back(callback)
Set the callback function for workspace changes
- class shiver.models.histogram.MakeSliceObserver(*args: Any, **kwargs: Any)
Object to handle the execution of MakeSlice algorithms
- errorHandle(msg)
Call parent upon algorithm error
- finishHandle()
Call parent upon algorithm finishing
- shiver.models.histogram.dim2array(dim, center=True) ndarray
Create a numpy array containing bin centers along the dimension d.
Parameters
dim: IMDDimension center: bool, optional
Returns
from min+st/2 to max-st/2 with step st
- shiver.models.histogram.filter_ws(name)
Return the type of workspace
- shiver.models.histogram.get_frame(name)
Returns the MDE frame for the given workspace name
- shiver.models.histogram.get_num_non_integrated_dims(name)
Returns the number of non-integrated dimensions
Model for the Sample Parameters dialog
- class shiver.models.polarized.PolarizedModel(workspace_name=None)
Polarized model
- connect_error_message(callback)
Set the callback function for error messages
- get_experiment_sample_log(log_name)
Get the sample log with name
- get_flipping_ratio()
Method to return the flipping ratio for a workspace
- get_polarization_logs()
Get polarization logs from workspace
- get_polarization_logs_for_workspace()
Get polarization logs from workspace
- get_polarization_state()
Get the polarization state from Sample Log in workspace
- save_experiment_sample_log(log_name, log_value)
Add the sample log with log_name and log_value in the workspace with name
- save_polarization_logs(polarization_logs)
Save polarization logs in workspace
- save_polarization_state(pol_state)
Save the polarization state as Sample Log in workspace
- update_polarized_mde_config()
Update the MDE Config Polarized Parameters, if the MDE Config exists
Model for the Refine UB widget
- class shiver.models.refine_ub.PeaksTableWorkspaceDisplayModel(*args: Any, **kwargs: Any)
Model for the peaks table
- connect_error_message(callback)
Set the callback function for error messages
- get_lattice_parameters()
collect and return the lattice parameters from the peaks workspace
- get_peaks_from_rows(rows)
Extract a subset of peaks using the row numbers
- recenter_rows(rows)
Recenter the selected peaks
- refine(rows, lattice_type)
Refine the UB using the selected rows
- refine_orientation(rows)
Refine the UB orientation only using the selected rows
- set_parent_mde(mde)
set the MDE used for recentering
Drop the DeltaE dimension
- set_peak_number_to_rows()
set the peaks numbers to match the rows so that the peaks subset can be match back
- set_peaks(peaks)
Replace the peaks workspace in the models
- undo()
Set the origonal UB onto the peaks workspace
- update_ub(new_ub)
Update the UB of the peaks workspace from the refine workspace
- class shiver.models.refine_ub.RefineUBModel(mdh, mde)
Model for the refinement UB tab
- connect_error_message(callback)
Set the callback function for error messages
- get_mdh()
Return the MDHistoWorkspace
- get_peaks_table_model()
get the model for the peaks table
- get_perpendicular_slices(peak_row)
Create 3 perpendicular slices center on the peaks corresponding to the given row
- predict_peaks()
Run predict peaks, the set new peaks to the peaks table model
- update_mde_with_new_ub()
Update the UB in the MDE from the one in the peaks workspace
- update_workspaces(mdh, mde)
Set the MD workspace, after the UB has been refined
Presenters
Presenter for the Sample Parameters dialog
- class shiver.presenters.sample.SamplePresenter(view, model)
Sample Parameter presenter
- error_message(msg)
Pass error message to the view
- handle_apply_button(params_dict)
Call SetUB mantid algorithm
- handle_isaw_button(filename)
Call LoadIsawUB
- handle_lattice_from_ub_matrix(ub_matrix)
Get SetUB matrix
- handle_lattice_state(params)
Validate lattices
- handle_load_button(filename)
Call LoadNexusProcessed
- handle_matrix_state(ub_matrix)
Validate UB matrix
- handle_nexus_button(filename)
Call LoadNexusUB
- handle_sample_data_init()
Get SetUB matrix
- handle_save_isaw_button(filename)
Save file
- handle_ub_matrix_from_lattice(params)
Get SetUB matrix
- property model
Return the model for this presenter
- property view
Return the view for this presenter
- shiver.presenters.sample.copy_params_to_dict(oriented_lattice, params)
Copy all oriented lattice and ub matrix to params dictionary
- shiver.presenters.sample.get_sample_parameters_from_workspace(oriented_lattice)
Get UB matrix and lattice parameters ina dictionary format
Presenter for the Generate tab
- class shiver.presenters.generate.GeneratePresenter(view, model)
Generate Presenter
- do_generate_mde()
Slot for Generate button.
Notes
This function will collection configuration information from the view and pass it to the model.
- do_save_configuration()
Slot for Save Configuration button.
Notes
This function will collect configuration information from the view and save it to a python file similar to define_dataset.py.
- property model
Return the model for this presenter
- property view
Return the view for this presenter
- shiver.presenters.generate.translate_filelist_to_string(filelist: list) str
Translate filelist to string.
Parameters
- filelistlist
List of files
Returns
- str
Comma-separated string of files.
Notes
Mantid’s MultipleFileProperty is expecting a string representation of nested lists, e.g.
For a single layer list, the conversion is simple:
>>> filelist = ['/tmp/file1', '/tmp/file2'] to >>> filelist = "/tmp/file1, /tmp/file2"
For a nested list, the conversion is slightly more complicated: >>> filelist = [[‘/tmp/file1’, ‘/tmp/file2’], [‘/tmp/file3’]] to >>> filelist = “/tmp/file1+/tmp/file2, /tmp/file3”
Presenter for the Histogram tab
- class shiver.presenters.histogram.HistogramPresenter(view, model)
Histogram presenter
- build_config_for_make_slice() dict
Gather parameters from view for MakeSlice.
Returns
- configdict
Dictionary of parameters for MakeSlice.
- clone_workspace(name, clone_name)
Called by the view to clone a workspace
- create_corrections_tab(name)
Create a corrections tab
- create_refine_ub_tab()
UB refinement tab
- delete_workspace(name)
Called by the view to delete a workspace
- error_message(msg, **kwargs)
Pass error message to the view
- get_polarization_state(name)
get polarization state from polarized model
- handle_button(params_dict)
Validate symmetry histogram parameter
- load_file(file_type, filename)
Call model to load the filename from the UI file dialog
- makeslice_finish(workspace_dimesions, error=False)
Handle the makeslice algorithm finishing
- property model
Return the model for this presenter
- populate_ui_from_selected_histogram(name)
Populate the UI from the selected histogram
- ready_for_histogram()
Check if the view is ready to submit a histogram
- refine_ub(ws_name)
Set the histogram parameters needed for UB refinement
- remake_slice()
Remake the HKL volume after UB was updated
- remove_provenance_tab(workspace_name)
remove provenance tab for a workspace, if it exists
- rename_workspace(old_name, new_name)
Called by the view to rename a workspace
- save_mde_workspace(name, filepath)
Called by the view to save a workspace
- save_polarization_state(name, pol_state)
save polarization state with polarized model
- save_workspace(name, filename)
Called by the view to save a workspace
- save_workspace_history(name, filename)
Called by the view to rename a workspace
- save_workspace_to_ascii(name, filename)
Called by the view to save a workspace to ascii.
- scale_workspace(name, output_name, scale_factor)
Called by the view to scale a workspace
- submit_histogram_to_make_slice()
Submit the histogram to the model
- property view
Return the view for this presenter
- warning_message(msg, **kwargs)
Pass warning message to the view
- ws_changed(action, name, ws_type, frame=None, ndims=0)
Pass the workspace change to the view
Presenter for the Polarized Options dialog
- class shiver.presenters.polarized.PolarizedPresenter(view, model)
Polarized Options presenter
- error_message(msg)
Pass error message to the view
- get_polarization_logs()
Retrieve the values for the sample logs
- handle_apply_button(polarization_logs)
Save the values for the sample logs
- property model
Return the model for this presenter
- property view
Return the view for this presenter
- shiver.presenters.polarized.create_dictionary_polarized_options(sample_log_data)
Create a dictionary from the values for the sample logs
Presenter for the Refine UB widget
- class shiver.presenters.refine_ub.PeaksTableWorkspaceDataPresenterStandard(*args: Any, **kwargs: Any)
Peaks table presenter
- load_data(table)
load the peaks workspace in the QTable model
- update_column_headers()
set the table column headers
- class shiver.presenters.refine_ub.PeaksTableWorkspaceDisplay(*args: Any, **kwargs: Any)
Peaks table widget
- emit_close()
Handle closing
- class shiver.presenters.refine_ub.RefineUB(mdh, mde, model=None, view=None, parent=None)
Refine UB table presenter
- peak_selected(peak_row)
called when a peak is selected to create the 3 perpendicular slices
- populate(checked)
toggle the peaks overlay in the sliceviewer
- predict()
called to predict peaks
- recenter()
Recenter the selected rows
- refine()
called to refine the UB
- refine_orientation()
called to refine the UB orientation only
- remake_slice()
called after the UB was changed to remake the HKL slice
- undo()
This will return to UB to the origonal state
- update_lattice()
called to update the lattice parameters from the model
- update_workspaces(mdh, mde)
update the workspaces used
Views
PyQt QGroupBox for the histogram parameters
- class shiver.views.histogram_parameters.Dimensions(*args: Any, **kwargs: Any)
Widget for handling the selection of output dimensions
- combo_changed(index)
Swap the combo box values when combo boxes are changed
- property combo_dimension_boxes
Return a list of combo boxes
- property combo_max_boxes
Return a list of combo boxes
- property combo_min_boxes
Return a list of combo boxes
- combo_step()
Step border color and histogram button update
- property combo_step_boxes
Return a list of combo boxes
- compare_numbers(minnum, maxnum)
Check Minimum and Maximum value pairs are: float numbers, Minimum < Maximum
- min_max_checked(cmin, cmax)
Ensure Minimum and Maximum value pairs are: float numbers, Minimum < Maximum and both exist at the same time
- min_max_compare(cmin, cmax)
Ensure Minimum and Maximum value pairs are: float numbers, Minimum < Maximum if both exist at the same time
- set_field_invalid_state(item)
if parent exists then call the corresponding function and update the color
- set_field_valid_state(item)
remove the item from the field_error list and its invalid style, if it was previously invalid and enable the corresponding button
- steps_valid_state()
Check whether required steps are filled in
- update_combo()
Update combo box dimension values
- update_dimension_names(basis)
Update the combo box dimension selection items based on the projection values
- validate_min_max_checked(cmin, cmax, sender_flag)
Validate Minimum and Maximum value pairs are: float numbers, Minimum < Maximum and both exist at the same time and update their state if sender_flag ==1 sender =cmin else sender =cmax
- validate_step(step)
Step border color and histogram button update
- class shiver.views.histogram_parameters.HistogramParameter(*args: Any, **kwargs: Any)
Histogram parameters widget
- property combo_dimx
Returns the combo boxes for the dimensions
- property combo_maxx
Returns the max spin boxes for the dimensions
- property combo_minx
Returns the min spin boxes for the dimensions
- property combo_stepx
Returns the step spin boxes for the dimensions
- connect_histogram_submit(callback)
callback for the histogram submit button
- gather_histogram_parameters() dict
Gathers the histogram parameters
Returns
dict – histogram parameters
- initialize_default()
initialize default values
- property is_valid: bool
Checks if the histogram parameters are valid
Returns
bool – True if valid, False otherwise
- populate_histogram_parameters(parameters: dict)
Populates the histogram parameters from given dictionary.
- projection_to_hkl(projection: str) str
Converts the projection to H,K,L
- Arguments:
projection {str} – projection
- Returns:
str – H,K,L
- projection_updated()
Validate the projection values
- set_dimension(btn)
Update parameter table based on mode.
Based on the radio button step, allow the corresponding step values to be filled in; the rest become read-only
Parameters
- btnQRadioButton
radio button for the step
- set_field_invalid_state(item)
if parent exists then call the corresponding function and update the color
- set_field_valid_state(item)
remove the item from the field_error list and its invalid style, if it was previously invalid and enable the corresponding button
- update_plot_num()
Updates the plot number if name_checkbox is unchecked
- validate_projection_values()
Validate the projection values on co-linear
- validate_symmentry_once()
validate symmetry once the current invalid text is updated. Note: the actual validation happens in models
- class shiver.views.histogram_parameters.V3DValidator(*args: Any, **kwargs: Any)
Validates the projection values
- validate(teststring, pos)
Validates the projections 3-digit array format: [1,0,0]
- shiver.views.histogram_parameters.return_valid(validity, teststring, pos)
Returns state during validation
- shiver.views.histogram_parameters.translation(number, character)
Used in projection
PyQt QDialog for Sample Parameters
- class shiver.views.sample.LatticeParametersWidget(*args: Any, **kwargs: Any)
Lattice Parameters widget
- check_and_update_matrix()
Validate parameters and updates the UB matrix
- get_lattice_parameters()
Return all values of lattice parameters in a dictionary
- lattice_state()
Check all lattice parameters; returns true if they are all in acceptable state
- set_field_invalid_state(item)
if parent exists then call the corresponding function and update the color
- set_field_valid_state(item)
remove the item from the field_error list and its invalid style, if it was previously invalid and enable the corresponding button
- set_lattice_parameters(params)
Set values in lattice parameters
- trigger_update_matrix(ub_matrix)
Emit the signal for changed
- update_all_background_color(valid)
Update the background color of all lattice parameters fields
- class shiver.views.sample.SampleDialog(*args: Any, **kwargs: Any)
Histogram parameters widget
- btn_apply_submit()
Check everything is valid and then call the ub mandit algorithm
- btn_cancel_action()
Cancel the sample dialog
- btn_help_action()
Show the help for the sample dialog
- btn_isaw_submit()
Open the file dialog and update the fields using the Mat file
- btn_load_submit()
Open the file dialog and update the fields using the Nexus file
- btn_nexus_submit()
Open the file dialog and update the fields using the Nexus file
- btn_save_isaw_submit()
Open the file dialog to select file location and name
- check_items_and_update_lattice()
Check whether ub matrix cell items are in valid state and update lattice values
- get_matrix_values_as_2d_list()
Retrieve the UB matrix cell values into a 2d list
- get_matrix_values_as_string()
‘Serialize’ the ub matrix cell values into a comma-separated string
- get_sample_parameters()
Return all parameters in a dictionary returned format {‘a’:5.12484,’b’:5.33161,’c’:7.31103, ‘alpha’:90,’beta’:90,’gamma’:90, ‘u’:’-0.0493617,4.27279,-4.37293’, ‘v’:’-0.0706905,-3.18894,-5.85775’, ‘matrix_ub’:’-0.00000,-0.00000,7.00000,-0.00000,-0.00000,7.00000,-0.00000,-0.00000,7.00000’}
- initialize_matrix()
initialize ub matrix cells
- matrix_update_all_background_color(valid)
Update the background color of all ub matrix cells
- populate_sample_parameters()
Set the default values for lattice and UB matrix
- populate_sample_parameters_from_dict(param_dict)
Set the values for lattice from the dictionary and use them to calculate UB matrix expected format: {‘a’:5.12484,’b’:5.33161,’c’:7.31103, ‘alpha’:90,’beta’:90,’gamma’:90, ‘u’:’-0.0493617,4.27279,-4.37293’, ‘v’:’-0.0706905,-3.18894,-5.85775’}
- set_field_invalid_state(item)
include the item in the field_error list and disable the corresponding button
- set_field_valid_state(item)
remove the item from the field_error list and enable the corresponding button
- show_error_message(msg)
Will show a error dialog with the given message
- trigger_update_lattice(lattice)
Emit the signal for changed
- ub_matrix_state()
Check whether the ub matrix cells are all in a valid state
- update_all_background_color(valid)
Update the background color of all fields
- update_matrix(dict_ub_matrix)
Update the value of each ub matrix cell from the dictionary
- validate_cell_value()
Check whether the ub matrix cell is in a valid state
- class shiver.views.sample.SampleView(*args: Any, **kwargs: Any)
View for Sample Parameters
- connect_apply_submit(callback)
callback for the apply submit button
- connect_btn_save_isaw_callback(callback)
callback for the isaw save button
- connect_isaw_submit(callback)
callback for the isaw submit button
- connect_lattice_from_ub_matrix(callback)
callback for the matrix data
- connect_lattice_state(callback)
callback for the matrix data
- connect_load_submit(callback)
callback for the loaf submit button
- connect_matrix_state(callback)
callback for the matrix data
- connect_nexus_submit(callback)
callback for the nexus submit button
- connect_sample_data(callback)
callback for the matrix data
- connect_ub_matrix_from_lattice(callback)
callback for the matrix data
- get_error_message(msg)
received the error message from model
- get_sample_parameters_dict()
Get all sample parameters as a dictionary
- set_sample_parameters_dict()
Set all sample parameters as a dictionary
- start_dialog()
initialize and start dialog
CSS styles invalid fields
PyQt widget for the OnCat widget in General tab.
- class shiver.views.oncat.OnCatAgent(use_notes=False)
Agent to interface with OnCat
- get_agent_instance()
Get OnCat agent instance
- get_datasets(facility: str, instrument: str, ipts: int) list
Get datasets for given facility, instrument, and IPTS.
Parameters
- facilitystr
Facility name
- instrumentstr
Instrument name
- iptsint
IPTS number
Returns
- list
List of datasets
- get_ipts(facility: str, instrument: str) list
Get IPTS numbers for given facility and instrument.
Parameters
- facilitystr
Facility name
- instrumentstr
Instrument name
Returns
- list
List of IPTS numbers in string format (IPTS-XXXXX)
- property has_token
Check if token exists
- property is_connected
Check if connected to OnCat
- class shiver.views.oncat.Oncat(*args: Any, **kwargs: Any)
ONCat widget
- connect_error_callback(callback)
Connect error message callback
- connect_to_oncat()
Connect to OnCat
- get_angle_integration()
Get angle integration target
- get_dataset()
Get dataset
- get_facility()
Get facility based on instrument
- get_instrument()
Get instrument
- get_ipts()
Get IPTS
- get_ipts_number()
Get IPTS number
- get_suggested_selected_files() list
Return a list of suggested files to be selected based on dataset selection.
- set_dataset_to_custom()
Set dataset to custom
- sync_with_remote(refresh=False)
Update all items within OnCat widget.
- update_connection_status()
Update connection status
- update_datasets()
Update dataset list
- update_ipts()
Update IPTS list
- class shiver.views.oncat.OncatToken(token_path: str)
Class to hold OnCat token
- read_token()
Read token from file
- write_token(token)
Write token to file
- shiver.views.oncat.get_data_from_oncat(login: ONCat, projection: list, ipts_number: int, instrument: str, facility: str = 'SNS', tags: str = 'type/raw') dict
Get data according to a projection from oncat
Parameters:
- loginpyoncat.ONCat
An object that contains login information to oncat database.
- projectionlist
A list of paths in the oncat datafile to extract the relevant information.
- ipts_numberint,str
The experiment identifier number (IPTS)
- instrumentstr
The instrument associated with the datafiles
- facilitystr, optional
The facility associated with the datafiles (Default = ‘SNS’)
- tagsstr, optional
The type of files to look for in the OnCat database (Default = ‘type/raw’)
Returns:
- datafiles: dict
A dictionary containing information requested from the OnCat database
- shiver.views.oncat.get_dataset_info(*, login, ipts_number, instrument, dataset_name=None, use_notes=False, facility='SNS', group_by_angle=False, angle_pv='omega', angle_bin=0.5, include_runs=None, exclude_runs=None)
A function to return a list of runs in a dataset, optionally grouped by angle. Grouping by angle is from the lowest value, within angle_bin.
Parameters:
- loginpyoncat.ONCat
An object that contains login information to oncat database.
- ipts_numberint,str
The experiment identifier number (IPTS)
- instrumentstr
The instrument associated with the datafiles
- dataset_namestr, optional
The name of a dataset to look for in the database. It can be None.
- use_notesbool, optional
A flag to indicate that the names of the datasets are stored in the Notes/Comments (as opposed to sequence name)
- facilitystr, optional
The facility associated with the datafiles (Default = ‘SNS’)
- group_by_anglebool, optional
A flag to indicate if the runs should be grouped by angle
- angle_pvstr, optional
The name of the angle process variable. The value read from this variable will be used for grouping files together.Default is ‘omega’
- angle_binfloat, optional
The maximum difference (in degrees) between angles in the same group. Default is 0.5
- include_runsarray_like, optional
A list or array of additional runs to be added to the same dataset. The default is None
- exclude_runsarray_like, optional
A list or array of runs to be excluded from the dataset. The default is None
Returns:
- file_nameslist
List of runs in the dataset, or list of list of runs at the same angle
Raises:
- ValueError
If any of the include_runs is not in the OnCat database for this IPTS If any of the include_runs is already in the dataset If any of the exclude_runs is not already accounted for If no runs were found to match the criteria (for example, dataset_name=None and include_runs=None)
- shiver.views.oncat.get_dataset_names(login: ONCat, ipts_number: int, instrument: str, use_notes: bool = False, facility: str = 'SNS') list
A function to return the names of the datasets, either from sequence names or from comments
Parameters:
- loginpyoncat.ONCat
An object that contains login information to oncat database.
- ipts_numberint,str
The experiment identifier number (IPTS)
- instrumentstr
The instrument associated with the datafiles
- use_notesbool, optional
A flag to indicate that the names of the datasets are stored in the Notes/Comments (as opposed to sequence name)
- facilitystr, optional
The facility associated with the datafiles (Default = ‘SNS’)
Returns:
- dsn: set of strings
A set containing strings with the dataset names, as tored in the OnCat database
PyQt widget for the histogram tab
- class shiver.views.generate.Generate(*args: Any, **kwargs: Any)
Generate widget
- connect_generate_mde_callback(callback)
Connect the callback for generating the MDE
- connect_save_configuration_callback(callback)
Connect the callback for saving the configuration
- do_generate_mde()
Generate the MDE
- do_save_configuration()
Save the configuration
- generate_mde_finish_callback(activate)
Toggle the generate button disabled state
- get_save_configuration_filepath(default_filename: str, default_output_dir: str) str
Return the filename and output directory to save the configuration.
Parameters:
- default_filename: str
The default filename to save the configuration.
- default_output_dir: str
The default output directory to save the configuration.
Returns:
- str:
The full path to save the configuration.
- populate_from_dict(data: dict)
Populate all child widgets with the given dict.
Parameters
- datadict
The data to populate the widgets with.
- set_dataset_to_custom()
Set the dataset in the oncat widget to “custom”.
- set_field_invalid_state(item)
include the item in the field_error list and disable the corresponding button/s
- set_field_valid_state(item)
remove the item from the field_error list and enable the corresponding button/s
- show_error_message(msg)
Will show a error dialog with the given message
This will emit a signal so that other threads can call this but have the GUI thread execute
- update_raw_data_widget_path()
Update the path in the raw data widget
- update_raw_data_widget_selection()
Update the selection in the raw data widget
- update_workspace_in_reduction_params()
Update the workspace name from mde to reduction parameters
- class shiver.views.generate.MDEType(*args: Any, **kwargs: Any)
MDE type widget
- check_mde_name() bool
Check if the mde name is valid.
Returns:
bool: True if the mde name is valid, False otherwise.
- check_output_dir() bool
Check if the output directory is valid.
Returns:
- bool:
True if the output directory is not empty and does not contains any special char, False otherwise.
- connect_error_callback(callback)
Connect the error callback.
Parameters:
- callback: callable
The error callback.
- connect_update_title_callback(callback)
Connect the update title callback.
Parameters:
- callback: callable
The update title callback.
- populate_from_dict(param_dict: dict) bool
Populate the MDE type widget from a dictionary.
Parameters:
- param_dict: dict
The dictionary containing the MDE type widget parameters.
Returns:
- bool:
True if the MDE type widget is populated successfully, False otherwise.
- re_init_widget()
Re-initialize the widget.
- set_field_invalid_state(item)
if parent exists then call the corresponding function
- set_field_valid_state(item)
remove the item from the field_error list and its invalid style, if it was previously invalid and enable the corresponding button
- shiver.views.generate.has_special_char(var_name: str) bool
Check if the variable name contains special characters.
Parameters:
- var_name: str
The variable name to check.
Returns:
- bool:
True if the variable name contains special characters, False otherwise.
- shiver.views.generate.is_valid_name(var_name: str) bool
Check if the variable name is valid.
Parameters:
- var_name: str
The variable name to check.
Returns:
- bool:
True if the variable name is valid, False otherwise.
NOTE:
The variable name must follow the following rules: - must not be empty - must start with a letter or underscore - must only contain letters, numbers, and underscores
PyQt QDialog for Sample Parameters
- class shiver.views.advanced_options.ADValidator(*args: Any, **kwargs: Any)
Validates the additional dimensions value
- validate(teststring, pos)
Validates the 3-element values
- validate_cell(teststring, start, end, pos)
Validates in 3-element comma-separated format: <string>,<min_number>,<max_number>
- class shiver.views.advanced_options.AdvancedDialog(*args: Any, **kwargs: Any)
Advanced Options widget
- adt_dim_update()
Validate the additional dimension values
- btn_add_row()
Add a new row
- btn_apply_submit()
Check everything is valid and close dialog
- btn_cancel_action()
Cancel the sample dialog
- btn_delete_row()
Delete selected row
- btn_help_action()
Show the help for the sample dialog
- check_num_input(min_value, max_value)
Ensure numbers are: float, Minimum < Maximum and both exist at the same time
- get_advanced_options_dict()
Return advanced options as a dictionary
- get_clicked_row()
Allow for one selected row to be return for possible deletion
- get_table_values_dict()
Return table cells as a dictionary
- initialize_cells()
Initialize table cells
- lcutoff_color_update()
Update LowerCutoff valid state based on the input
- lcutoff_update()
Enable/Disable LowerCutoff based on the filter check box
- min_max_checked(min_input, max_input, required)
Ensure Minimum and Maximum value pairs are valid and whether they are required
- populate_advanced_options_from_dict(params)
Populate all fields from dictionary
- set_cell_invalid_state(item)
include the item in the invalid_cells and field_error list and disable the corresponding button
- set_cell_valid_state(item)
remove the item from the invalid_cells and field_error list and enable the corresponding button
- set_field_invalid_state(item)
include the item in the field_error list and disable the corresponding button
- set_field_valid_state(item)
remove the item from the field_error list and enable the corresponding button
- set_table_values(maskinputs)
Populate all table rows from list of rows
- show_error_message(msg)
Will show a error dialog with the given message
- tib_update()
Enable/Disable TIB min and max based on the apply tib radio buttons
- validate_cell()
Validates the cells using the IntArrayProperty-based format: <num1>,<num2>, .., <range1>-<range2>, <range1>:<range2> <range1>:<range2>:<step>
- shiver.views.advanced_options.return_valid(validity, teststring, pos)
Returns state during validation
PyQt widget for the raw data selection
- class shiver.views.data.RawData(*args: Any, **kwargs: Any)
Raw data selection widget
- as_dict(use_grouped=False)
Return a dictionary of the current state
- check_file_input()
check whether any files are selected
- get_selected(use_grouped=False)
Return a list of the full path of the files selected
- set_field_invalid_state(item)
if parent exists then call the corresponding function
- set_field_valid_state(item)
remove the item from the field_error list and its invalid style, if it was previously invalid and enable the corresponding button
- shiver.views.data.filename_str_to_list(filenames_str)
Convert a string of filenames to a list.
Parameters
- filenames_strstr
String of filenames separated by a comma. Grouped filenames are connected with “+”, i.e. “file1.nxs.h5,file2.nxs.h5+file3.nxs.h5,file4.nxs.h5” to [“file1.nxs.h5”, [“file2.nxs.h5”, “file3.nxs.h5”], “file4.nxs.h5”]
- class shiver.views.loading_buttons.LoadingButtons(*args: Any, **kwargs: Any)
Buttons for Loading
- connect_error_msg(callback)
connect a function to the error message.
Parameters
- callbackfunction
the function to be called when an error message is needed.
- connect_load_dataset(callback)
connect a function to the selection of a dataset.
Parameters
- callbackfunction
the function to be called when a dataset is selected.
- connect_load_file(callback)
connect a function to the selection of a filename
PyQt widget for the histogram tab input workspaces
- class shiver.views.workspace_tables.ADSList(*args: Any, **kwargs: Any)
List widget that will add and remove items from the ADS
- add_ws(name, ws_type, frame, ndims)
Adds a workspace to the list if it is of the correct type
- del_ws(name)
Removes a workspace from the list if it is of the correct type
- class shiver.views.workspace_tables.Frame(value)
An enumeration.
- class shiver.views.workspace_tables.HistogramWorkspaces(*args: Any, **kwargs: Any)
Histogram workspaces widget
- add_ws(name, ws_type, frame, ndims)
Adds a workspace to the list if it is of the correct type
- clear_ws()
Clears all workspaces from the lists
- del_ws(name)
Removes a workspace from the list if it is of the correct type
- on_item_clicked(item)
method to emit a signal when a workspace is selected
- class shiver.views.workspace_tables.InputWorkspaces(*args: Any, **kwargs: Any)
MDE and Normalization workspace widget
- add_ws(name, ws_type, frame, ndims)
Adds a workspace to the list if it is of the correct type
- clear_ws()
Clears all workspaces from the lists
- del_ws(name)
Removes a workspace from the list if it is of the correct type
- initialize_default()
initialize invalid style color due to absence of data
- set_field_invalid_state(item)
if parent exists then call the corresponding function to disable the button
- set_field_valid_state(item)
if parent exists then call the corresponding function to enable the button
- class shiver.views.workspace_tables.MDEList(*args: Any, **kwargs: Any)
Special workspace list widget so that we can add a menu to each item
- add_ws(name, ws_type, frame, ndims)
Adds a workspace to the list if it is of the correct type
- all_data()
return all the selected data workspace names
- property background
return the workspace name set as background (optional, may be None)
- clone_ws(name)
method to clone the selected workspace
- connect_get_polarization_logs(callback)
connect a function to get the sample logs for workspace
- connect_get_polarization_state_workspace(callback)
connect a function to get the polariation state for workspace
- connect_save_mde_workspace_callback(callback)
connect a function to save the mde workspace
- connect_save_polarization_state_workspace(callback)
connect a function to save the polarization state for workspace
- property data
return unpolarized data
- property data_nsf
return the workspace name set as polarized no spinflip data
- property data_sf
return the workspace name set as polarized spinflip data
- property data_u
return the workspace name set as unpolarized data
- delete_ws(name)
method to delete the currently selected workspace
- do_provenance(workspace_name: str)
Method to open the provenance window
Parameters
- workspace_namestr
Name of the workspace to open the provenance window for.
- get_data_workspaces_not_allowed(pol_state)
method to return unallowed data workspaces based on the polarization state
- initialize_default()
initialize invalid style color due to absence of data
- mousePressEvent(event)
mouse click event handler
- refine_ub(name)
method to set refinement UB histogram and open refine ub tab
- rename_ws(name)
method to rename the currently selected workspace
- save_mde_ws(name)
method to save workspace data in file
- scale_ws(name)
method to scale the workspace data, creating a new workspace
- set_background(name)
method to set the selected workspace as ‘background’ and update border color
- set_corrections(name)
method to open the correction tab to apply correction for given workspace
- set_data(name, pol_state)
method to set the selected workspace as data pol_state and update border color
- set_field_invalid_state(item)
if parent exists then call the corresponding function and update the color
- set_field_valid_state(item)
remove the item from the field_error list and its invalid style, if it was previously invalid and enable the corresponding button
- set_pol_options(name)
Open the dialog to set polarization options in the selected workspace
- set_sample(name)
method to set sample parameters in the selected workspace
- unset_all()
reset the list and update border color
- unset_background(name)
method to unset the selected workspace as ‘background’
- unset_selected_data(data_workspaces)
method to unset the selected workspaces in field defined by data_workspaces
- unset_selected_states_with_name(name)
method to unselect the workspace with name
- validate_data_workspace_state()
method to check whether there is at least one selected data workspace and update boarder color-valid state
- class shiver.views.workspace_tables.MDHList(*args: Any, **kwargs: Any)
List widget that will add and remove items from the ADS
- add_ws(name, ws_type, frame, ndims)
Adds a workspace to the list if it is of the correct type
- contextMenu(pos)
right-click event handler
- delete_ws(name)
Method to delete the currently selected workspace.
- get_display_name_and_intensity_limits(selected_ws, ndims)
get the display name and intensity limits
- plot_1d(name, display_name, intensity_limits, log_scale, errors, overplot)
method to do 1D plots
- plot_2d(name, display_name, intensity_limits, log_scale)
method to do 2D plots
- plot_slice_viewer(name, intensity_limits, log_scale)
method to open sliceviewer
- save_script(name)
method to handle the saving of script
- class shiver.views.workspace_tables.NormList(*args: Any, **kwargs: Any)
List widget that will add and remove items from the ADS
- contextMenu(pos)
right-click event handler
- delete_ws(name)
method to delete the currently selected workspace
- deselect_all()
reset the list
- rename_ws(name)
method to rename the currently selected workspace
PyQt widget for the workspace icons
- class shiver.views.workspace_icons.IconLegend(*args: Any, **kwargs: Any)
Legend for the icons in the MDE table
- shiver.views.workspace_icons.get_icon(name: str) qtpy.QtGui.QIcon
return a icon for the given name
Functions to plot histograms
- shiver.views.plots.do_1d_plot(workspaces, display_name, intensity_limits=None, log_scale=False, errors=False, overplot=False)
Create an 1D plot for the provided workspace
- shiver.views.plots.do_colorfill_plot(workspaces, display_name=None, intensity_limits=None, log_scale=False)
Create a colormesh plot for the provided workspace
- shiver.views.plots.do_default_plot(workspace, ndims, display_name=None, intensity_limits=None)
Create the default plot for the workspace and number of dimensions
- shiver.views.plots.do_slice_viewer(workspaces, parent=None, intensity_limits=None, log_scale=False)
Open sliceviewer for the provided workspace
PyQt QDialog for Sample Parameters
- class shiver.views.polarized_options.PolarizedDialog(*args: Any, **kwargs: Any)
Polarized Options widget
- btn_apply_submit()
Check everything is valid and close dialog
- btn_cancel_action()
Cancel the sample dialog
- btn_help_action()
Show the help for the sample dialog
- dir_update()
Remove direction from invalid_fields
- disable_params()
Disable/hide direction, ratio and log parameters
- enable_params()
Enable/show direction, ratio and log parameters
- get_polarized_direction()
Return polarized direction
- get_polarized_options_dict()
Return polarized options as a dictionary
- get_polarized_state()
Return polarized state
- log_update()
Check sample log and update ratio validation status
- log_validate()
Check whether sample log is in valid state
- populate_pol_options_from_dict(params)
Populate all fields from dictionary
- populate_polarized_options()
Populate all fields from workspace
- psda_update()
Validate the psda value
- ratio_update()
Validate the ratio value
- set_field_invalid_state(item)
include the item in the field_error list and disable the corresponding button
- set_field_valid_state(item)
remove the item from the field_error list and enable the corresponding button
- set_polarized_state_dir(params)
Set state and direction from polarized state
- show_error_message(msg)
Will show a error dialog with the given message
- class shiver.views.polarized_options.PolarizedView(*args: Any, **kwargs: Any)
View for Sample Parameters
- connect_apply_submit(callback)
connect to save the polarization logs for workspace
- connect_populate_polarized_options(callback)
connect to get the polarization logs for workspace
- get_error_message(msg)
received the error message from model
- set_parameter_dict()
Set all polarized parameters as a dictionary in current and parent view
- start_dialog(disable_psda=False)
initialize and start dialog
- class shiver.views.polarized_options.RatioValidator(*args: Any, **kwargs: Any)
Validates the additional dimensions value
- validate(teststring, pos)
Validates number or formula
- shiver.views.polarized_options.return_valid(validity, teststring, pos)
Returns state during validation
Main Qt window for shiver
- class shiver.views.mainwindow.MainWindow(*args: Any, **kwargs: Any)
Main shiver widget
- handle_help()
get current tab type and open the corresponding help page
Widget for background minimization options
- class shiver.views.minimize_background.MinimizeBackgroundOptions(*args: Any, **kwargs: Any)
Background minimization options
- as_dict()
Return the background minimization widget as a dictionary.
- check_grouping_file()
Check that the grouping filename has been set
- check_num_input(min_value, max_value)
Ensure numbers are: float, Minimum < Maximum, between 0 and 100 and both exist at the same time
- min_max_checked()
Ensure Minimum and Maximum value pairs are valid
- populate_from_dict(param_dict)
Populate this widget from a dictionary
- set_enabled(enabled)
Set this widget as enabled or not, and set correct valid state
- set_field_invalid_state(item)
include the item in the field_error list and disable the corresponding button
- set_field_valid_state(item)
remove the item from the field_error list and enable the corresponding button
PyQt widget for the Reduction Parameters section
- class shiver.views.reduction_parameters.ReductionParameters(*args: Any, **kwargs: Any)
Generate reduction parameter widget
- get_reduction_params_dict()
Return all reduction parameters as a dictionary
- populate_red_params_from_dict(params)
Populate all fields and inner dialogs from dictionary
- set_adv_btn()
Open the dialog to set advanced options
- set_field_invalid_state(item)
if parent exists then call the corresponding function
- set_field_valid_state(item)
remove the item from the field_error list and its invalid style, if it was previously invalid and enable the corresponding button
- set_pol_btn()
Open the dialog to set polarization options
- set_sample_btn()
Open the dialog to set sample parameters
- update_polarization_label()
It updates the label with the plarization state and direction
- validate_t0()
validate t0 input
View for the Refine UB widget
- class shiver.views.refine_ub.PeaksTableModel(*args: Any, **kwargs: Any)
A QAbstractTableModel for use with a QTableView
- columnCount(_)
Returns the number of columns
- data(index, role=qtpy.QtCore.Qt.DisplayRole)
Returns the data stored under the given role for the item referred to by the index.
- deselect_all()
Deselect all refine/recenter checkboxes
- flags(index)
Returns the item flags for the given index.
- headerData(section, orientation, role)
Returns the data for the given role and section in the header with the specified orientation.
- load_data(data_model)
update the data used in this model
- recenter_rows()
Return a list of row number where “Recenter” box is checked
- refine_rows()
Return a list of row number where “Refine” box is checked
- round_hkl()
Round all HKL values to integer
- rowCount(_)
Returns the number of rows
- select_all()
Select all refine/recenter checkboxes
- setData(index, value, role)
Sets the role data for the item at index to value.
- setHorizontalHeaderLabels(labels)
Update the attribute storing the header labels
- class shiver.views.refine_ub.RefineUBView(*args: Any, **kwargs: Any)
The view for the Refine UB widget
- connect_peak_selection(callback)
Connect the peak selection callback
- connect_populate_peaks(callback)
connect the “populate peaks” button callback
- connect_predict_peaks(callback)
connect the “predict peaks” button callback
- connect_recenter_peaks(callback)
connect the recenter button callback
- connect_refine(callback)
connect the refine button callback
- connect_refine_orientation(callback)
connect the refine orientation button callback
- connect_undo(callback)
connect the undo button callback
- get_lattice_type()
return the lattice type from the combobox
- plot_perpendicular_slice(centers, *slices)
Update the 3 plots with the workspace slices and draw peak positions
- refine_call()
call when refine button pressed
- refine_orientation_call()
call when “refine orientation” button pressed
- remove_sliceviewer()
remove the current sliceviewer
this will prevent issues when the workspace is updated
- select_row(row)
Set which peaks is currently selected
- selected_rows()
return the currently selected rows in peak table
- set_lattice(parameters)
Update the lattice parameters widget from the parameters dict
- set_sliceviewer(sliceviewer)
insert the new sliceviewer into the layout
- undo_call()
call when Undo button pressed
PyQt widget for the correction tab
- class shiver.views.corrections.Corrections(*args: Any, **kwargs: Any)
Correction widget
- balance_temp_validate()
Validate balance: validate balance and temperature combination
- set_field_invalid_state(item, invalid_style)
include the item in the field_error list and disable the corresponding button
- set_field_valid_state(item)
remove the item from the field_error list and enable the corresponding button
PyQt widget for the histogram tab
- class shiver.views.histogram.Histogram(*args: Any, **kwargs: Any)
Histogram widget
- add_ws(name, ws_type, frame=None, ndims=0)
Adds a workspace to the list if it is of the correct type
- clear_ws()
Clears all workspaces from the lists
- connect_clone_workspace(callback)
connect a function to clone a workspace
- connect_corrections_tab(callback)
connect a function to the creation of a corrections tab
- connect_delete_workspace(callback)
connect a function to the selection of a filename
- connect_do_provenance_callback(callback)
connect a function to the creation of a corrections tab.
Parameters
- callbackfunction
The function to call when the provenance button is clicked.
- connect_plot_display_name_callback(callback)
callback for the display name-description for the plot
- connect_refine_ub(callback)
connect a function to the Refine sample parameters button
- connect_refine_ub_tab(callback)
connect a function to the creation of a Refine UB tab
- connect_rename_workspace(callback)
connect a function to the selection of a filename
- connect_save_script_workspace(callback)
connect a function to the save script for workspace
- connect_save_workspace(callback)
connect a function to the save a workspace
- connect_save_workspace_to_ascii(callback)
connect a function to the save a workspace to ascii
- connect_scale_workspace(callback)
connect a function to scale the workspace
- del_ws(name)
Removes a workspace from the list if it is of the correct type
- disable_while_running(disable)
This will disable the UI elements for histgramming while MakeSlice is running
- gather_workspace_background()
Return the name of background workspace.
- gather_workspace_normalization()
Return the name of normalization workspace.
- get_plot_data(ws_name, ndims)
Get display name and intensities data for plotting.
- get_selected_normalization()
Return the selected normalization workspace.
- is_valid()
return whether the field_errors is empty
- make_slice_finish(ws_name, ndims)
Handle the UI updates for when MakeSlice has finished.
This will emit a signal so that other threads can call this but have the GUI thread execute it.
- select_normalization(normalization)
Select the normalization workspace.
- set_background(background)
Set the background workspace.
- set_data(data, pol_state)
Set the data unpolarized workspace and update its valid state.
- set_field_invalid_state(item)
include the item in the field_error list and disable the corresponding button
- set_field_valid_state(item)
remove the item from the field_error list and enable the corresponding button
- show_error_message(msg, accumulate=False)
Will show a error dialog with the given message.
This will emit a signal so that other threads can call this but have the GUI thread execute it.
Parameters
- msgstr
The message to show
- accumulatebool, optional
If True, the error message will be accumulated and shown when accumulate is False
- show_warning_message(msg)
Will show a warning dialog with the given message and return button click as True/False
- unset_all()
Unset all workspaces.