schrodinger.application.matsci.density_analysis_widget module

class schrodinger.application.matsci.density_analysis_widget.ASLSelectorCheckableComboBox(text=None, item_name='item', layout=None, items=None, max_selected_items=None, command=None, stretch=True, width=80, **kwargs)

Bases: schrodinger.application.matsci.mswidgets.MultiComboWithCount

Combobox for ASL names with check-able options

addItems(*args, **kwargs)

Overwrite parent to select all the items when new item is added

class schrodinger.application.matsci.density_analysis_widget.MeasurementTableFrame(panel)

Bases: schrodinger.ui.qt.swidgets.SFrame

Tab containing the pick peaks from the plot.

AXIS_COL = 'Axis/Plane'
NAME_COL = 'Name'
LENGTH_COL = 'Length (Å)'
ASL_COL = 'ASL'
LINE_COL = 'MLine'
COL_NAMES = ['Axis/Plane', 'Name', 'Length (Å)', 'ASL']
__init__(panel)
Parameters

panel (StructureFactorViewerPanel) – Parent panel object

updateData(mlines)

Update table with all the measurement lines

Parameters

mlines (list(MeasurementLine)) – List of all measurement lines in the plots

exportData()

Export the qpeaks from the table and corresponding real units lengths.

deleteSelectedRows()

Delete the selected rows from the table.

reset()

Reset the frame widgets

class schrodinger.application.matsci.density_analysis_widget.CustomToolbar(canvas)

Bases: schrodinger.ui.qt.navtoolbar.NavToolbar

Custom NavToolbar to contain toolbar option to add measure lines to the plot

__init__(canvas)

Create the toolbar

Parameters

canvas (schrodinger.mpl_backend_agg.FigureCanvasQTAgg) – The matplotlib canvas

zoom(*args)

Modify mathplotlib zoom function so zoom button and measure buttons are exclusive.

pan(*args)

Modify mathplotlib pan function so pan button and peak edit buttons are exclusive.

resetZoomBtn()

Reset zoom button state

resetPanBtn()

Reset zoom button state

resetMeasureBtn()

Reset measure button state to unchecked

measureDepth()

Connect to edit peaks function in the plot and make checked icons (zoom and pan) unchecked. Also add the mode message to the plot.

reset()

Reset toolbar

class schrodinger.application.matsci.density_analysis_widget.MeasurementLine(plot_frame, xval, yval)

Bases: object

Object containing Line2D and Annotations in the plot and its value.

__init__(plot_frame, xval, yval)

Create plot canvas with updated toolbar,

Parameters
  • plot_frame (PlotFrame) – Plot frame containing the plot.

  • xval (float) – x value at which the first point is to be drawn

  • yval (float) – y value at which the first point is to be drawn

checkFinalPointRange()

A dialog box is displayed with a message if the projected point is outside the plot area.

addFinalPoint(xval, yval)

Add the 2nd point and related annotation. If plot type is linear then y value will be ignored and taken from the first point.

Parameters
  • xval (float) – x value at which the second point is to be drawn

  • yval (float) – y value at which the second point is to be drawn

getMinDistance(xval, yval)

Get the minimum distance of the input point with the two data points.

Parameters
  • xval (float) – x value of the point to calculate the distance from

  • yval (float) – y value of the point to calculate the distance from

Return float

Minimum distance of from the measurement point

addAnnotation()

Replot the the annotation and markers

class schrodinger.application.matsci.density_analysis_widget.BasePlotFrame(panel, parent_tab)

Bases: schrodinger.ui.qt.swidgets.SFrame

Class to initialize all the plots.

__init__(panel, parent_tab)
Parameters

panel (SimulationProfileAnalysisViewerPanel) – Parent panel object

loadData(data, asls, bin_edges, asl_names)

Read and initialize data.

Parameters
  • data (dict) – dictionary containing all the data for each asl.

  • asls (list) – list of asls used in calculations.

  • bin_edges (dict) – dictionary containing bin edges of ‘x’, ‘y’, and ‘z’ axis.

  • asl_names (dict) – dictionary where the key is the asl and the value is the associated given name for it.

getCurrentASLData(asl, axis=None)

Get the data for the passed asl for the current selected time range

Parameters
  • asl (str) – asl for which data is to be found

  • axis (str or None) – Axis for which data is needed. If None it will get the current select axis in combobox

Return numpy.ndarraynumpy.ndarray

The average data for the asl in the current time range

getSelectedAslNames()

The selected asl names in the panel

Return list(str)

List of asl(s) for 1D plot and the list of single asl str for the 2D plot

getCurrentAxis()

Get the current selected axis. For 1D plot it will be X,Y, or Z. And for 2D plot it will be XY, XZ, or YZ.

Return str

name of the selected axis

removeClosestMLine(xval, yval)

Find the closest measurement line to the passed point and remove it from the plot.

Parameters
  • xval (float) – x value of the point to calculate the distance from and remove

  • yval (float) – y value of the point to calculate the distance from and remove

getAcuteAngle(vec_A, vec_B)

Returns the acute angle in degrees.

Parameters
  • vec_A (numpy.array) – vector representation of vec_A

  • vec_B (numpy.array) – vector representation of vec_B

Return type

float

Returns

The acute angle between vec_A and vec_B

getDiagonalFinalPoint(s_point, e_point)

Returns the projection of the end point of the line such that it is parallel to x=y or x=-y.

Parameters
  • s_point (numpy.array) – start point of the line

  • e_point (numpy.array) – end point of the line

Return type

float, float

Returns

The projected x and y value on x=y or x=-y line.

getFinalPoint(e_x, e_y)

Returns the final endpoint of the line.If the shift key is not pressed, the original point are returned. Else, the projected point are returned such that the line is parallel to x-axis or y-axis or x=y or x=-y.

Parameters
  • e_x (float) – x coordinate of the endpoint of the line.

  • e_y (float) – y coordinate of the endpoint of the line.

Return type

float, float

Returns

The projected point parallel to x=0 or y=0 or x=y or x=-y or the original point.

isShiftPressed()

Whether the shift key is pressed.

Return type

boolean

Returns

state of the shift key press

measureDepth(event=None)

React to button press. If measure depth is checked then it will add a single point on 1st left click and will add point and annotation on next click (left or right). If the 1st click is right click it will find the closest measurement line and delete it.

replot()

Replot the plot

reset()

Clear and reset stored data and replot to get default plot.

addMeasurement(mline)

Add the measurement line to the measurement line list.

Parameters

mline (MeasurementLine) – The MeasurementLine to add to the list

class schrodinger.application.matsci.density_analysis_widget.ImagePlotFrame(panel, parent_tab)

Bases: schrodinger.application.matsci.density_analysis_widget.BasePlotFrame

Class to setup a frame with projection density plot

PLOT_TYPE = 'Planes'
SLICES = dict_values(['XY', 'XZ', 'YZ'])
plotData()

Plot data with current selection

setAxisLabels()

Set axis label based on axis selection

getMList(asl=None, axis=None)

Return the current list of measurement lines

Parameters
  • asl (str or None) – Get the measurement lines for the passed asl, if passed None it will get for currently selected asl

  • axis (str or None) – Get the measurement lines for the passed axis, if passed None it will get for currently selected axis

Return list(MeasurementLine)

list of measurement lines

class schrodinger.application.matsci.density_analysis_widget.LinePlotFrame(*args, image_width=0.85, **kwargs)

Bases: schrodinger.application.matsci.density_analysis_widget.BasePlotFrame

Class to setup a frame with line plot of 1d density profile.

PLOT_TYPE = 'Axis'
SLICES = ['X', 'Y', 'Z']
__init__(*args, image_width=0.85, **kwargs)

initialize the Line plot frame. See base class for input arguments.

Parameters

image_width (float) – Scale with plot with image_width value. This allows legend to be shown outside the plot. The acceptable values are between 0 and 1.

setAxisLabels()

Set axis label based on axis selection

plotData()

Plot data with current selection

getMList(axis=None, **kwargs)

Return the current list of measurement lines

Parameters

axis (str or None) – Get the measurement lines for the passed axis, if passed None it will get for currently selected axis

Return list(MeasurementLine)

list of measurement lines

class schrodinger.application.matsci.density_analysis_widget.DensityTab(panel, dimension, include_all_and_none=False)

Bases: schrodinger.ui.qt.swidgets.SFrame

Tab containing plot selection options and plot.

__init__(panel, dimension, include_all_and_none=False)
Parameters
  • panel (SimulationProfileAnalysisViewerPanel) – Parent panel object

  • dimension (int) – the dimension of the plot, 1 will create tab for line plot and 2 will create image plot.

  • include_all_and_none (bool) – Include all and none options in the 1D line plot

axisChanged()

React to change in axis

loadData(data, asls, bin_edges, asl_names, add_item=True)

Load the data to combobox and plot

Parameters
  • data (dict) – dictionary containing all the data for each asl

  • asls (list) – list of asls used in calculations

  • bin_edges (dict) – dictionary containing bin edges of ‘x’, ‘y’, and ‘z’ axis.

  • asl_names (dict) – dictionary where the key is the asl and the value is the associated given name for it.

reset()

Reset the tab.