schrodinger.application.msv.utils module

class schrodinger.application.msv.utils.BaseSignalAttribute(val)

Bases: object

A util class for handling emitting a signal while changing an attribute.

SIGNAL_NAME = ''
class schrodinger.application.msv.utils.IdentityMapping(*args)

Bases: _abcoll.MutableMapping, dict

An identity mapping is a dictionary for mutable objects that uses the id for the object as the key. The object itself and only the object, independent of any values it contains, is used to look up the value.

clear()
has_key(obj)
items()
iteritems()
iterkeys()
keys()
schrodinger.application.msv.utils.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.

schrodinger.application.msv.utils.get_rolling_average(data, window_padding=4)

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
Return type:

list

Returns:

A list of rolling averages (or None values)

schrodinger.application.msv.utils.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
Return type:

list of tuples

Returns:

A list of (name, signal) tuples

schrodinger.application.msv.utils.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
Return type:

type

Returns:

A MetaClass suitable for creating wrapper objects

See the tests for this class for a simple example.