sas.sasgui.perspectives.calculator package
Submodules
sas.sasgui.perspectives.calculator.aperture_editor module
-
class
sas.sasgui.perspectives.calculator.aperture_editor.
ApertureDialog
(parent=None, manager=None, aperture=None, *args, **kwds)[source] Bases:
wx._windows.Dialog
-
get_aperture
()[source] return the current aperture
-
get_notes
()[source] return notes
-
on_change_distance
()[source] Change distance of the aperture
-
on_change_name
()[source] Change name
-
on_change_size
()[source] Change aperture size
-
on_change_size_name
()[source] Change the size’s name
-
on_change_type
()[source] Change aperture type
-
on_click_apply
(event)[source] Apply user values to the aperture
-
on_click_cancel
(event)[source] reset the current aperture to its initial values
-
reset_aperture
()[source] put the default value of the detector back to the current aperture
-
set_manager
(manager)[source] Set manager of this window
-
set_values
()[source] take the aperture values of the current data and display them through the panel
-
sas.sasgui.perspectives.calculator.calculator module
Calculator Module
-
class
sas.sasgui.perspectives.calculator.calculator.
Plugin
[source] Bases:
sas.sasgui.guiframe.plugin_base.PluginBase
This class defines the interface for a Plugin class for calculator perspective
-
get_python_panel
(filename=None)[source] Get the python shell panel
Parameters: filename – file name to open in editor
-
get_tools
()[source] Returns a set of menu entries for tools
-
on_calculate_dv
(event)[source] Compute the mass density or molar voulme
-
on_calculate_kiessig
(event)[source] Compute the Kiessig thickness
-
on_calculate_resoltuion
(event)[source] Estimate the instrumental resolution
-
on_calculate_sld
(event)[source] Compute the scattering length density of molecula
-
on_calculate_slit_size
(event)[source] Compute the slit size a given data
-
on_data_operation
(event)[source] Data operation
-
on_edit_data
(event)[source] Edit meta data
-
on_gen_model
(event)[source] On Generic model menu event
-
on_image_viewer
(event)[source] Get choose an image file dialog
Parameters: event – menu event
-
on_python_console
(event)[source] Open Python Console
Parameters: event – menu event
-
put_icon
(frame)[source] Put icon in the frame title bar
-
sas.sasgui.perspectives.calculator.calculator_widgets module
This software was developed by the University of Tennessee as part of the Distributed Data Analysis of Neutron Scattering Experiments (DANSE) project funded by the US National Science Foundation.
See the license text in license.txt
copyright 2009, University of Tennessee
-
class
sas.sasgui.perspectives.calculator.calculator_widgets.
InputTextCtrl
(parent=None, *args, **kwds)[source] Bases:
wx._controls.TextCtrl
Text control for model and fit parameters. Binds the appropriate events for user interactions.
-
class
sas.sasgui.perspectives.calculator.calculator_widgets.
InterActiveOutputTextCtrl
(*args, **kwds)[source] Bases:
wx._controls.TextCtrl
Text control used to display outputs. No editing allowed. The background is grayed out. User can’t select text.
-
class
sas.sasgui.perspectives.calculator.calculator_widgets.
OutputTextCtrl
(*args, **kwds)[source] Bases:
sas.sasgui.perspectives.calculator.calculator_widgets.InterActiveOutputTextCtrl
Text control used to display outputs. No editing allowed. The background is grayed out. User can’t select text.
sas.sasgui.perspectives.calculator.collimation_editor module
-
class
sas.sasgui.perspectives.calculator.collimation_editor.
CollimationDialog
(parent=None, manager=None, collimation=[], *args, **kwds)[source] Bases:
wx._windows.Dialog
-
add_aperture
(event)[source] Append empty aperture to data’s list of aperture
-
add_collimation
(event)[source] Append empty collimation to data’s list of collimation
-
edit_aperture
(event)[source] Edit the selected aperture
-
enable_aperture
()[source] Enable /disable widgets crelated to aperture
-
enable_collimation
()[source] Enable /disable widgets related to collimation
-
fill_aperture_combox
()[source] fill the current combobox with the available aperture
-
fill_collimation_combox
()[source] fill the current combobox with the available collimation
-
get_collimation
()[source] return the current collimation
-
get_current_collimation
()[source]
-
get_notes
()[source] return notes
-
on_change_length
()[source] Change the length
-
on_change_name
()[source] Change name
-
on_click_apply
(event)[source] Apply user values to the collimation
-
on_click_cancel
(event)[source] leave the collimation as it is and close
-
on_select_collimation
(event)[source] fill the control on the panel according to the current selected collimation
-
remove_aperture
(event)[source] Remove aperture to data’s list of aperture
-
remove_collimation
(event)[source] Remove collimation to data’s list of collimation
-
reset_aperture_combobox
(edited_aperture)[source] take all edited editor and reset clientdata of aperture combo box
-
reset_collimation_combobox
(edited_collimation)[source] take all edited editor and reset clientdata of collimation combo box
-
set_aperture
(aperture)[source] set aperture for data
-
set_manager
(manager)[source] Set manager of this window
-
set_values
()[source] take the collimation values of the current data and display them through the panel
-
sas.sasgui.perspectives.calculator.console module
Console Module display message of a dialog
-
class
sas.sasgui.perspectives.calculator.console.
ConsoleDialog
(parent=None, manager=None, data=None, title='Data Summary', size=(500, 550))[source] Bases:
wx._windows.Dialog
Data summary dialog
-
set_manager
(manager)[source] Set the manager of this window
-
set_message
(msg='')[source] Display the message received
-
sas.sasgui.perspectives.calculator.data_editor module
-
class
sas.sasgui.perspectives.calculator.data_editor.
DataEditorPanel
(parent, data=[], *args, **kwds)[source] Bases:
wx._windows.ScrolledWindow
Parameters: data – when not empty the class can same information into a dat object and post event containing the changed data object to some other frame -
choose_data_file
(location=None)[source] Open a file dialog to allow loading a file
-
complete_loading
(data=None, filename='')[source] Complete the loading and compute the slit size
-
edit_collimation
()[source] Edit the selected collimation
-
edit_detector
()[source] Edit the selected detector
-
edit_sample
()[source] Open the dialog to edit the sample of the current data
-
edit_source
()[source] Open the dialog to edit the saource of the current data
-
enable_data_cbox
()[source]
-
fill_data_combox
()[source] fill the current combobox with the available data
-
get_current_data
()[source]
-
get_data
()[source] return the current data
-
get_notes
()[source] return notes
-
on_change_run
(event=None)[source] Change run
-
on_change_title
(event=None)[source] Change title
-
on_click_apply
(event)[source] changes are saved in data object imported to edit
-
on_click_browse
(event)[source] Open a file dialog to allow the user to select a given file. Display the loaded data if available.
-
on_click_reset
(event)[source]
-
on_click_save
(event)[source] Save change into a file
-
on_click_view
(event)[source] Display data info
-
on_close
(event)[source] leave data as it is and close
-
on_edit
(event)[source]
-
on_select_data
(event=None)[source]
-
reset_panel
()[source]
-
reset_radiobox
()[source]
-
set_collimation
(collimation, notes=None)[source] set collimation for data
-
set_detector
(detector, notes=None)[source] set detector for data
-
set_sample
(sample, notes=None)[source] set sample for data
-
set_source
(source, notes=None)[source] set source for data
-
set_values
()[source] take the aperture values of the current data and display them through the panel
-
-
class
sas.sasgui.perspectives.calculator.data_editor.
DataEditorWindow
(parent, manager, data=None, *args, **kwds)[source] Bases:
wx._windows.Frame
-
get_data
()[source] return the current data
-
-
sas.sasgui.perspectives.calculator.data_editor.
load_error
(error=None)[source] Pop up an error message.
@param error: details error message to be displayed
sas.sasgui.perspectives.calculator.data_operator module
GUI for the data operations panel (sum and multiply)
-
class
sas.sasgui.perspectives.calculator.data_operator.
DataOperPanel
(parent, *args, **kwds)[source] Bases:
wx._windows.ScrolledWindow
-
check_data_inputs
()[source] Check data1 and data2 whether or not they are ready for operation
-
disconnect_panels
()[source]
-
draw_output
(output)[source] Draw output data(temp)
-
fill_data_combox
()[source] fill the current combobox with the available data
-
fill_oprator_combox
()[source] fill the current combobox with the operator
-
get_datalist
()[source]
-
make_data_out
(data1, data2)[source] Make a temp. data output set
-
on_click_apply
(event)[source] changes are saved in data object imported to edit
-
on_close
(event)[source] leave data as it is and close
-
on_help
(event)[source] Bring up the Data Operations Panel Documentation whenever the HELP button is clicked.
Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”
Parameters: evt – Triggers on clicking the help button
-
on_name
(event=None)[source] On data name typing
-
on_number
(event=None, control=None)[source] On selecting Number for Data2
-
on_select_data1
(event=None)[source] On select data1
-
on_select_data2
(event=None)[source] On Selecting Data2
-
on_select_operator
(event=None)[source] On Select an Operator
-
put_text_pic
(pic=None, content='')[source] Put text to the pic
-
send_warnings
(msg='', info='info')[source] Send warning to status bar
-
set_panel_on_focus
(event)[source] On Focus at this window
-
set_plot_unfocus
()[source] Unfocus on right click
-
-
class
sas.sasgui.perspectives.calculator.data_operator.
DataOperatorWindow
(parent, manager, *args, **kwds)[source] Bases:
wx._windows.MDIChildFrame
-
OnClose
(event=None)[source] On close event
-
-
class
sas.sasgui.perspectives.calculator.data_operator.
SmallPanel
(parent, id=-1, is_number=False, content='?', **kwargs)[source] Bases:
sas.sasgui.plottools.PlotPanel.PlotPanel
PlotPanel for Quick plot and masking plot
-
add_image
(plot)[source] Add Image
-
add_text
()[source] Text in the plot
-
add_toolbar
()[source] Add toolbar
-
draw
()[source] Draw
-
erase_legend
()[source] Remove Legend
-
onContextMenu
(event)[source] Default context menu for a plot panel
-
onLeftDown
(event)[source] Disables LeftDown
-
onMouseMotion
(event)[source] Disable dragging 2D image
-
onPick
(event)[source] Remove Legend
-
onWheel
(event)[source]
-
on_set_focus
(event)[source] send to the parenet the current panel on focus
-
ontogglescale
(event)[source] On toggle 2d scale
-
set_content
(content='')[source] Set text content
-
sas.sasgui.perspectives.calculator.density_panel module
This module provide GUI for the mass density calculator
-
class
sas.sasgui.perspectives.calculator.density_panel.
DensityPanel
(parent, base=None, *args, **kwds)[source] Bases:
wx.lib.scrolledpanel.ScrolledPanel
,sas.sasgui.guiframe.panel_base.PanelBase
Provides the mass density calculator GUI.
-
CENTER_PANE
= True
-
calculate
(event)[source] Calculate the mass Density/molar Volume of the molecules
-
check_inputs
()[source] Check validity user inputs
-
clear_outputs
()[source] Clear the outputs textctrl
-
get_input
()[source] Return the current input and output combobox values
-
on_close
(event)[source] close the window containing this panel
-
on_help
(event)[source] Bring up the density/volume calculator Documentation whenever the HELP button is clicked.
Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”
Parameters: evt – Triggers on clicking the help button
-
on_select_input
(event)[source] On selection of input combobox, update units and output combobox
-
on_select_output
(event)[source] On selection of output combobox, update units and input combobox
-
set_values
()[source] Sets units and combobox values
-
window_name
= 'Mass Density Calculator'
-
sas.sasgui.perspectives.calculator.detector_editor module
-
class
sas.sasgui.perspectives.calculator.detector_editor.
DetectorDialog
(parent=None, manager=None, detector=None, title='Detector Editor', size=(500, 450))[source] Bases:
wx._windows.Dialog
-
add_detector
(event)[source] Append empty detector to data’s list of detector
-
enable_detector
()[source] Enable /disable widgets crelated to detector
-
fill_detector_combox
()[source] fill the current combobox with the available detector
-
get_current_detector
()[source]
-
get_detector
()[source] return the current detector
-
get_notes
()[source] return notes
-
on_change_beam_center
()[source] Change the detector beam center
-
on_change_distance
()[source] Change distance of the sample to the detector
-
on_change_instrument
()[source] Change instrument
-
on_change_offset
()[source] Change the detector offset
-
on_change_orientation
()[source] Change the detector orientation
-
on_change_pixel_size
()[source] Change the detector pixel size
-
on_change_slit_length
()[source] Change slit length of the detector
-
on_click_apply
(event)[source] Apply user values to the detector
-
on_click_cancel
(event)[source] reset the current detector to its initial values
-
remove_detector
(event)[source] Remove detector to data’s list of detector
-
reset_detector
()[source] put the default value of the detector back to the current detector
-
reset_detector_combobox
(edited_detector)[source] take all edited editor and reset clientdata of detector combo box
-
set_detector
(detector)[source] set detector for data
-
set_manager
(manager)[source] Set manager of this window
-
set_values
()[source] take the detector values of the current data and display them through the panel
-
sas.sasgui.perspectives.calculator.gen_scatter_panel module
Generic Scattering panel. This module relies on guiframe manager.
-
class
sas.sasgui.perspectives.calculator.gen_scatter_panel.
CalcGen
(id=-1, input=None, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source] Bases:
sas.sascalc.data_util.calcthread.CalcThread
Computation
-
compute
()[source] excuting computation
-
-
class
sas.sasgui.perspectives.calculator.gen_scatter_panel.
OmfPanel
(parent, *args, **kwds)[source] Bases:
wx.lib.scrolledpanel.ScrolledPanel
,sas.sasgui.guiframe.panel_base.PanelBase
Provides the sas gen calculator GUI.
-
check_inputs
()[source] check if the inputs are valid
-
display_npts
(nop)[source] Displays Npts ctrl
-
get_pix_volumes
()[source] Get the pixel volume
-
get_sld_val
()[source] Set sld_n of slddata on sld input
-
on_save
(event)[source] Close the window containing this panel
-
on_sld_draw
(event)[source] Draw sld profile as scattered plot
-
set_npts_from_slddata
()[source] Set total n. of points form the sld data
-
set_sld_ctr
(sld_data)[source] Set sld textctrls
-
set_slddata
(slddata)[source] Set sld data related items
-
window_name
= 'SLD Pixel Info'
-
-
class
sas.sasgui.perspectives.calculator.gen_scatter_panel.
SasGenPanel
(parent, *args, **kwds)[source] Bases:
wx.lib.scrolledpanel.ScrolledPanel
,sas.sasgui.guiframe.panel_base.PanelBase
Provides the sas gen calculator GUI.
-
choose_data_file
(location=None)[source] Choosing a dtata file
-
complete
(input, update=None)[source] Gen compute complete function :Param input: input list [qx_data, qy_data, i_out]
-
complete_loading
(data=None, filename='')[source] Complete the loading
-
estimate_ctime
()[source] Calculation time estimation
-
load_update
()[source] print update on the status bar
-
on_compute
(event)[source] Compute I(qx, qy)
-
on_help
(event)[source] Bring up the General scattering Calculator Documentation whenever the HELP button is clicked.
Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”
Parameters: evt – Triggers on clicking the help button
-
on_load_data
(event)[source] Open a file dialog to allow the user to select a given file. The user is only allow to load file with extension .omf, .txt, .sld. Display the slit size corresponding to the loaded data.
-
on_panel_close
(event)[source] close the window containing this panel
-
set_est_time
()[source] Set text for est. computation time
-
set_input_params
()[source] Set model parameters
-
set_scale2d
(scale)[source] Set SLD plot scale
-
set_volume_ctl_val
(val)[source] Set volume txtctrl value
-
sld_draw
(event=None, has_arrow=True)[source] Draw 3D sld profile
-
window_name
= 'Generic SAS Calculator'
-
-
class
sas.sasgui.perspectives.calculator.gen_scatter_panel.
SasGenWindow
(parent=None, manager=None, title='Generic Scattering Calculator', size=(798.0, 610.5), *args, **kwds)[source] Bases:
wx._windows.MDIChildFrame
GEN SAS main window
-
build_panels
()[source]
-
check_omfpanel_inputs
()[source] Check OMF panel inputs
-
draw_graph
(plot, title='')[source]
-
get_npix
()[source] Get no. of pixels from omf panel
-
get_path
()[source] File location
-
get_pix_volumes
()[source] Get a pixel volume
-
get_sld_data
()[source] Return slddata
-
get_sld_data_from_omf
()[source]
-
get_sld_from_omf
()[source]
-
on_close
(event)[source] Close
-
on_open_file
(event)[source] On Open
-
on_panel_close
(event)[source]
-
on_save_file
(event)[source] On Close
-
set_etime
()[source] Sets est. computation time on panel
-
set_file_location
(path)[source] File location
-
set_main_panel_sld_data
(sld_data)[source]
-
set_omfpanel_default_shap
(shape)[source] Set default_shape in omfpanel
-
set_omfpanel_npts
()[source] Set Npts in omf panel
-
set_scale2d
(scale)[source]
-
set_schedule_full_draw
(panel=None, func='del')[source] Send full draw to gui frame
-
set_sld_data
(data)[source] Set omfdata
-
set_sld_n
(sld)[source]
-
set_volume_ctr_val
(val)[source] Set volume txtctl value
-
sld_draw
()[source] sld draw
-
-
sas.sasgui.perspectives.calculator.gen_scatter_panel.
add_icon
(parent, frame)[source] Add icon in the frame
sas.sasgui.perspectives.calculator.image_viewer module
-
class
sas.sasgui.perspectives.calculator.image_viewer.
ImageFrame
(parent, id, title, image=None, scale='log_{10}', size=wx.Size(550, 470))[source] Bases:
sas.sasgui.guiframe.local_perspectives.plotting.SimplePlot.PlotFrame
Frame for simple plot
-
on_help
(event)[source] Bring up Image Viewer Documentation from the image viewer window whenever the help menu item “how to” is clicked. Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”.
Parameters: evt – Triggers on clicking “how to” in help menu
-
on_set_data
(event)[source] Rescale the x y range, make 2D data and send it to data explore
-
-
class
sas.sasgui.perspectives.calculator.image_viewer.
ImageView
(parent=None)[source] Open a file dialog to allow the user to select a given file. Display the loaded data if available.
-
choose_data_file
(location=None)[source] Open a file dialog to allow loading a file
-
load
()[source] load image files
-
-
class
sas.sasgui.perspectives.calculator.image_viewer.
SetDialog
(parent, id=-1, title='Convert to Data', image=None, size=(400, 270))[source] Bases:
wx._windows.Dialog
Dialog for Data Set
-
OnClose
(event)[source] Close event
-
convert_image
(rgb, xmin, xmax, ymin, ymax, zscale)[source] Convert image to data2D
-
on_set
(event)[source] Set image as data
-
rgb2gray
(rgb)[source] RGB to Grey
-
sas.sasgui.perspectives.calculator.kiessig_calculator_panel module
This software was developed by the University of Tennessee as part of the Distributed Data Analysis of Neutron Scattering Experiments (DANSE) project funded by the US National Science Foundation.
See the license text in license.txt
copyright 2008, 2009, University of Tennessee
-
class
sas.sasgui.perspectives.calculator.kiessig_calculator_panel.
KiessigThicknessCalculatorPanel
(parent, *args, **kwds)[source] Bases:
wx._windows.Panel
,sas.sasgui.guiframe.panel_base.PanelBase
Provides the Kiessig thickness calculator GUI.
-
CENTER_PANE
= True
-
format_number
(value=None)[source] Return a float in a standardized, human-readable formatted string
-
on_close
(event)[source] close the window containing this panel
-
on_compute
(event)[source] Execute the computation of thickness
-
on_help
(event)[source] - Bring up the Kiessig fringe calculator Documentation whenever the HELP button is clicked. Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”
Parameters: evt – Triggers on clicking the help button
-
window_name
= 'Kiessig Thickness Calculator'
-
sas.sasgui.perspectives.calculator.load_thread module
Thread handler used to load data
-
class
sas.sasgui.perspectives.calculator.load_thread.
DataReader
(path, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source] Bases:
sas.sascalc.data_util.calcthread.CalcThread
Load a data given a filename
-
compute
()[source] read some data
-
isquit
()[source] @raise KeyboardInterrupt: when the thread is interrupted
-
-
class
sas.sasgui.perspectives.calculator.load_thread.
GenReader
(path, loader, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source] Bases:
sas.sascalc.data_util.calcthread.CalcThread
Load a sld data given a filename
-
compute
()[source] read some data
-
isquit
()[source] @raise KeyboardInterrupt: when the thread is interrupted
-
sas.sasgui.perspectives.calculator.model_editor module
This module provides three model editor classes: the composite model editor, the easy editor which provides a simple interface with tooltip help to enter the parameters of the model and their default value and a panel to input a function of y (usually the intensity). It also provides a drop down of standard available math functions. Finally a full python editor panel for complete customization is provided.
:TODO the writing of the file and name checking (and maybe some other functions?) should be moved to a computational module which could be called from a python script. Basically one just needs to pass the name, description text and function text (or in the case of the composite editor the names of the first and second model and the operator to be used).
-
class
sas.sasgui.perspectives.calculator.model_editor.
EditorPanel
(parent, base, path, title, *args, **kwds)[source] Bases:
wx._windows.ScrolledWindow
Simple Plugin Model function editor
-
check_name
()[source] Check name if exist already
-
get_notes
()[source] return notes
-
get_param_helper
(line)[source] Get string in line to define the params dictionary
Parameters: line – one line of string got from the param_str
-
get_warning
()[source] Get the warning msg
-
on_change_name
(event=None)[source] Change name
-
on_click_apply
(event)[source] Changes are saved in data object imported to edit.
checks firs for valid name, then if it already exists then checks that a function was entered and finally that if entered it contains at least a return statement. If all passes writes file then tries to compile. If compile fails or import module fails or run method fails tries to remove any .py and pyc files that may have been created and sets error message.
:todo this code still could do with a careful going over to clean up and simplify. the non GUI methods such as this one should be removed to computational code of SasView. Most of those computational methods would be the same for both the simple editors.
-
on_close
(event)[source] leave data as it is and close
-
on_help
(event)[source] Bring up the New Plugin Model Editor Documentation whenever the HELP button is clicked.
Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”
Parameters: evt – Triggers on clicking the help button
-
on_over_cb
(event)[source] Set overwrite name flag on cb event
-
set_function_helper
(line)[source] Get string in line to define the local params
Parameters: line – one line of string got from the param_str
-
write_file
(fname, name, desc_str, param_str, pd_param_str, func_str)[source] Write content in file
Parameters: - fname – full file path
- desc_str – content of the description strings
- param_str – content of params; Strings
- pd_param_str – content of params requiring polydispersity; Strings
- func_str – content of func; Strings
-
-
class
sas.sasgui.perspectives.calculator.model_editor.
EditorWindow
(parent, base, path, title, size=(800, 735), *args, **kwds)[source] Bases:
wx._windows.Frame
Editor Window
-
on_close
(event)[source] On close event
-
-
class
sas.sasgui.perspectives.calculator.model_editor.
TextDialog
(parent=None, base=None, id=None, title='', model_list=[], plugin_dir=None)[source] Bases:
wx._windows.Dialog
Dialog for easy custom composite models. Provides a wx.Dialog panel to choose two existing models (including pre-existing Plugin Models which may themselves be composite models) as well as an operation on those models (add or multiply) the resulting model will add a scale parameter for summed models and a background parameter for a multiplied model.
The user also gives a brief help for the model in a description box and must provide a unique name which is verified as unique before the new model is saved.
This Dialog pops up for the user when they press ‘Sum|Multi(p1,p2)’ under ‘Plugin Model Operations’ under ‘Fitting’ menu. This is currently called as a Modal Dialog.
:TODO the build in compiler currently balks at when it tries to import a model whose name contains spaces or symbols (such as + ... underscore should be fine). Have fixed so the editor cannot save such a file name but if a file is dropped in the plugin directory from outside this class will create a file that cannot be compiled. Should add the check to the write method or to the on_modelx method.
- PDB:April 5, 2015
-
check_name
(event=None)[source] Check that proposed new model name is a valid Python module name and that it does not already exist. If not show error message and pink background in text box else call on_apply
:TODO this should be separated out from the GUI code. For that we need to pass it the name (or if we want to keep the default name option also need to pass the self._operator attribute) We just need the function to return an error code that the name is good or if not why (not a valid name, name exists already). The rest of the error handling should be done in this module. so on_apply would then start by checking the name and then either raise errors or do the deed.
-
compile_file
(path)[source] Compile the file in the path
-
delete_file
(path)[source] Delete file in the path
-
fill_explanation_helpstring
(operator)[source] Choose the equation to use depending on whether we now have a sum or multiply model then create the appropriate string
-
fill_oprator_combox
()[source] fill the current combobox with the operator
-
get_textnames
()[source] Returns model name string as list
-
on_apply
(path)[source] This method is a misnomer - it is not bound to the apply button event. Instead the apply button event goes to check_name which then calls this method if the name of the new file is acceptable.
:TODO this should be bound to the apply button. The first line should call the check_name method which itself should be in another module separated from the the GUI modules.
-
on_change_name
(event=None)[source] Change name
-
on_help
(event)[source] Bring up the Composite Model Editor Documentation whenever the HELP button is clicked.
Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”
Parameters: evt – Triggers on clicking the help button
-
on_model1
(event)[source] Set model1
-
on_model2
(event)[source] Set model2
-
on_select_operator
(event=None)[source] On Select an Operator
-
update_cm_list
()[source] Update custom model list
-
write_string
(fname, name1, name2)[source] Write and Save file
sas.sasgui.perspectives.calculator.pyconsole module
Console Module display Python console
-
class
sas.sasgui.perspectives.calculator.pyconsole.
PyConsole
(parent=None, base=None, manager=None, panel=None, title='Python Shell/Editor', filename=None, size=(800, 700))[source] Bases:
wx.py.editor.EditorNotebookFrame
-
CENTER_PANE
= False
-
OnAbout
(event)[source] On About
-
OnCheckModel
(event)[source] Compile
-
OnHelp
(event)[source] Show a help dialog.
-
OnNewFile
(event)[source] OnFileOpen
-
OnOpenFile
(event)[source] OnFileOpen
-
OnRun
(event)[source] Run
-
OnSaveAsFile
(event)[source] OnFileSaveAs overwrite
-
OnSaveFile
(event)[source] OnFileSave overwrite
-
OnUpdateCompileMenu
(event)[source] Update Compile menu items based on current tap.
-
bufferOpen
()[source] Open file in buffer, bypassing editor bufferOpen
-
bufferSaveAs
()[source] Save buffer to a new filename: Bypassing editor bufferSaveAs
-
on_close
(event)[source] Close event
-
set_manager
(manager)[source] Set the manager of this window
-
window_name
= 'Custom Model Editor'
-
-
class
sas.sasgui.perspectives.calculator.pyconsole.
ResizableScrolledMessageDialog
(parent, msg, caption, pos=wx.Point(-1, -1), size=(500, 300), style=536877120)[source] Bases:
wx._windows.Dialog
Custom version of wx ScrolledMessageDialog, allowing border resize
-
sas.sasgui.perspectives.calculator.pyconsole.
check_model
(path)[source] Check that the model on the path can run.
-
sas.sasgui.perspectives.calculator.pyconsole.
show_model_output
(parent, fname)[source]
sas.sasgui.perspectives.calculator.resolcal_thread module
Thread for Resolution computation
-
class
sas.sasgui.perspectives.calculator.resolcal_thread.
CalcRes
(id=-1, func=None, qx=None, qy=None, qx_min=None, qx_max=None, qy_min=None, qy_max=None, image=None, completefn=None, updatefn=None, elapsed=0, yieldtime=0.01, worktime=0.01)[source] Bases:
sas.sascalc.data_util.calcthread.CalcThread
Compute Resolution
-
compute
()[source] excuting computation
-
sas.sasgui.perspectives.calculator.resolution_calculator_panel module
This software was developed by the University of Tennessee as part of the Distributed Data Analysis of Neutron Scattering Experiments (DANSE) project funded by the US National Science Foundation.
See the license text in license.txt
copyright 2008, 2009, 2010 University of Tennessee
-
class
sas.sasgui.perspectives.calculator.resolution_calculator_panel.
ResolutionCalculatorPanel
(parent, *args, **kwds)[source] Bases:
wx.lib.scrolledpanel.ScrolledPanel
Provides the Resolution calculator GUI.
-
CENTER_PANE
= True
-
complete
(image, elapsed=None)[source] Callafter complete: wx call after needed for stable output
-
complete_cal
(image, elapsed=None)[source] Complete computation
-
format_number
(value=None)[source] Return a float in a standardized, human-readable formatted string
-
on_close
(event)[source] close the window containing this panel
-
on_compute
(event=None)[source] Execute the computation of resolution
-
on_compute_call
(event=None)[source] Execute the computation of resolution
-
on_help
(event)[source] Bring up the Resolution calculator Documentation whenever the HELP button is clicked.
Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”
Parameters: evt – Triggers on clicking the help button
-
on_reset
(event)[source] Execute the reset
-
window_name
= 'Q Resolution Estimator'
-
sas.sasgui.perspectives.calculator.sample_editor module
-
class
sas.sasgui.perspectives.calculator.sample_editor.
SampleDialog
(parent=None, manager=None, sample=None, size=(500, 430), title='Sample Editor')[source] Bases:
wx._windows.Dialog
-
get_notes
()[source] return notes
-
get_sample
()[source] return the current sample
-
on_change_details
()[source] Change details
-
on_change_id
()[source] Change id of the sample
-
on_change_name
()[source] Change name
-
on_change_orientation
()[source] Change orientation
-
on_change_position
()[source] Change position
-
on_change_temperature
()[source] Change temperature
-
on_change_thickness
()[source] Change thickness
-
on_change_transmission
()[source] Change transmission
-
on_click_apply
(event)[source] Apply user values to the sample
-
on_click_cancel
(event)[source] leave the sample as it is and close
-
reset_sample
()[source] Put initial values of the sample back to the current sample
-
set_details
(sample)[source] print details on the current sample
-
set_manager
(manager)[source] Set manager of this window
-
set_values
()[source] take the sample values of the current data and display them through the panel
-
sas.sasgui.perspectives.calculator.sld_panel module
This module provide GUI for the neutron scattering length density calculator
-
class
sas.sasgui.perspectives.calculator.sld_panel.
SldPanel
(parent, base=None, *args, **kwds)[source] Bases:
wx._windows.Panel
,sas.sasgui.guiframe.panel_base.PanelBase
Provides the SLD calculator GUI.
-
CENTER_PANE
= True
-
calculateSld
(event)[source] Calculate the neutron scattering density length of a molecule
-
calculate_sld_helper
(element, density, molecule_formula)[source] Get an element and compute the corresponding SLD for a given formula
Parameters: element – elements a string of existing atom
-
calculate_xray_sld
(element)[source] Get an element and compute the corresponding SLD for a given formula
Parameters: element – elements a string of existing atom
-
check_inputs
()[source] Check validity user inputs
-
clear_outputs
()[source] Clear the outputs textctrl
-
on_close
(event)[source] close the window containing this panel
-
on_help
(event)[source] Bring up the SLD Documentation whenever the HELP button is clicked.
Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”
Parameters: evt – Triggers on clicking the help button
-
window_name
= 'SLD Calculator'
-
sas.sasgui.perspectives.calculator.slit_length_calculator_panel module
This software was developed by the University of Tennessee as part of the Distributed Data Analysis of Neutron Scattering Experiments (DANSE) project funded by the US National Science Foundation.
See the license text in license.txt
copyright 2008, 2009, University of Tennessee
-
class
sas.sasgui.perspectives.calculator.slit_length_calculator_panel.
SlitLengthCalculatorPanel
(parent, *args, **kwds)[source] Bases:
wx._windows.Panel
,sas.sasgui.guiframe.panel_base.PanelBase
Provides the slit length calculator GUI.
-
CENTER_PANE
= True
-
choose_data_file
(location=None)[source]
-
complete_loading
(data=None, filename='')[source] Complete the loading and compute the slit size
-
load_update
()[source] print update on the status bar
-
on_close
(event)[source] close the window containing this panel
-
on_help
(event)[source] Bring up the slit length calculator Documentation whenever the HELP button is clicked.
Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”
Parameters: evt – Triggers on clicking the help button
-
on_load_data
(event)[source] Open a file dialog to allow the user to select a given file. The user is only allow to load file with extension .DAT or .dat. Display the slit size corresponding to the loaded data.
-
window_name
= 'Slit Size Calculator'
-
sas.sasgui.perspectives.calculator.source_editor module
-
class
sas.sasgui.perspectives.calculator.source_editor.
SourceDialog
(parent=None, manager=None, source=None, *args, **kwds)[source] Bases:
wx._windows.Dialog
-
get_notes
()[source] return notes
-
get_source
()[source] return the current source
-
on_change_beam_shape
()[source] Change beams shape
-
on_change_beam_size
()[source] Change beam size
-
on_change_beam_size_name
()[source] Change beam size name
-
on_change_name
()[source] Change name
-
on_change_radiation
()[source] Change radiation of the sample
-
on_change_wavelength
()[source] Change the wavelength
-
on_change_wavelength_max
()[source] Change the wavelength maximum
-
on_change_wavelength_min
()[source] Change the wavelength minimum
-
on_change_wavelength_spread
()[source] Change the wavelength spread
-
on_click_apply
(event)[source] Apply user values to the source
-
on_click_cancel
(event)[source] reset the current source
-
reset_source
()[source] put back initial values of the source
-
set_manager
(manager)[source] Set manager of this window
-
set_values
()[source] take the source values of the current data and display them through the panel
-
Module contents
-
sas.sasgui.perspectives.calculator.
data_files
()[source] Return the data files associated with media calculator.
The format is a list of (directory, [files...]) pairs which can be used directly in setup(...,data_files=...) for setup.py.
-
sas.sasgui.perspectives.calculator.
get_data_path
(media)[source]