Package schrodinger :: Package application :: Package msv :: Module utils
[hide private]
[frames] | no frames]

Module utils

Classes [hide private]
  BaseSignalAttribute
A util class for handling emitting a signal while changing an attribute.
  IdentityMapping
An identity mapping is a dictionary for mutable objects that uses the id for the object as the key.
Functions [hide private]
list
get_rolling_average(data, window_padding=2)
Returns the running average of data in a window
list of tuples
get_signals(source)
Utility method for iterating through the signals on a QObject.
 
const(method)
A decorator that adds a 'const' attribute to a method
type
wrapper_meta_class(WrappedClass, wrapped_name, instance_attrs)
Returns a MetaClass that can be use to conveniently wrap the specified class
Variables [hide private]
  __package__ = 'schrodinger.application.msv'
Function Details [hide private]

get_rolling_average(data, window_padding=2)

 

Returns the running average of data in a window

Parameters:
  • data (list) - Data to average
  • window_padding (int) - The number of elements on either side of a given element to include in the average
Returns: list
A list of rolling averages (or None values)

get_signals(source)

 

Utility method for iterating through the signals on a QObject.

Parameters:
  • source (QtCore.QObject or instance thereof) - Any object or class with signals
  • filter (tuple of strings) - Any signals to ignore
Returns: list of tuples
A list of (name, signal) tuples

const(method)

 

A decorator that adds a 'const' attribute to a method

This attribute can be used together with the wrapper_meta_class to mark methods that should be wrapped.

wrapper_meta_class(WrappedClass, wrapped_name, instance_attrs)

 

Returns a MetaClass that can be use to conveniently wrap the specified class

Parameters:
  • WrappedClass (type) - The class to wrap
  • wrapped_name (str) - The name of the wrapped component on the wrapping instance
  • instance_attrs (tuple of str) - The names of instance attributes to be wrapped
Returns: type
A MetaClass suitable for creating wrapper objects

See the tests for this class for a simple example.