3.1.2.2. opengate.base

3.1.2.2.1. Module Contents

3.1.2.2.1.1. Classes

MetaUserInfo

MetaUserInfoSingleton

GateObjectSingleton

GateObject

DynamicGateObject

3.1.2.2.1.2. Functions

process_cls(cls)

Digest the class's user_infos and store the augmented class

check_property_name(name)

check_property(property_name, value, defaultvalue)

digest_user_info_defaults(cls)

add_properties_to_class(cls, user_info_defaults)

Add user_info defaults as properties to class if not yet present.

_make_property(property_name[, options, container_dict])

Return a property that stores the user_info item in a

make_docstring(cls, user_info_defaults)

restore_userinfo_properties(cls, attributes)

attach_methods(GateObjectClass)

Convenience function to avoid redundant code.

recursive_userinfo_to_dict(obj)

Walk recursively across entries of user_info and convert to appropriate structure.

find_paths_in_gate_object_dictionary(go_dict[, ...])

recursively_search_object(obj[, condition])

find_all_gate_objects(dct)

find_all_paths(dct)

_get_user_info_options(user_info_name, object_type, ...)

Utility function to retrieve the options associated with a user info given the class name,

create_gate_object_from_dict(dct)

Function to (re-)create an object derived from GateObject based on a dictionary.

class opengate.base.MetaUserInfo[source]

Bases: type

_created_classes[source]
__call__(*args, **kwargs)[source]

Call self as a function.

class opengate.base.MetaUserInfoSingleton[source]

Bases: type

_instances[source]
_created_classes[source]
__call__(*args, **kwargs)[source]

Call self as a function.

opengate.base.process_cls(cls)[source]

Digest the class’s user_infos and store the augmented class in a dictionary inside the meta class which handles the class creation. Note: type(cls) yields the meta class MetaUserInfo or MetaUserInfoSingleton, depending on the class in question (e.g. GateObject, GateObjectSingleton).

opengate.base.check_property_name(name)[source]
opengate.base.check_property(property_name, value, defaultvalue)[source]
opengate.base.digest_user_info_defaults(cls)[source]
opengate.base.add_properties_to_class(cls, user_info_defaults)[source]

Add user_info defaults as properties to class if not yet present.

opengate.base._make_property(property_name, options=None, container_dict=None)[source]

Return a property that stores the user_info item in a dictionary which is an attribute of the object (self).

opengate.base.make_docstring(cls, user_info_defaults)[source]
opengate.base.restore_userinfo_properties(cls, attributes)[source]
opengate.base.attach_methods(GateObjectClass)[source]

Convenience function to avoid redundant code. Can be used to add common methods to classes that differ otherwise, e.g. GateObject and GateObjectSingleton.

class opengate.base.GateObjectSingleton[source]
user_info_defaults[source]
class opengate.base.GateObject[source]
user_info_defaults[source]
copy_user_info(other_obj)[source]
to_dictionary()[source]
from_dictionary(d)[source]
class opengate.base.DynamicGateObject[source]

Bases: GateObject

property is_dynamic[source]
property dynamic_user_info[source]
user_info_defaults[source]
process_dynamic_parametrisation(params)[source]
_add_dynamic_parametrisation_to_userinfo(params, name)[source]

This base class implementation only acts as a setter. Classes inheriting from this class should implement an add_dynamic_parametrisation() method which actually does something with the parameters and then call super().add_dynamic_parametrisation(). Inheriting classes should avoid calling this method directly.

add_dynamic_parametrisation(name=None, **params)[source]
create_changers()[source]
opengate.base.recursive_userinfo_to_dict(obj)[source]

Walk recursively across entries of user_info and convert to appropriate structure. Dictionary-like structures are mapped to dictionary and walked across recursively. List-like structures are mapped to lists and walked across recursively. GateObject-like objects are converted through their to_dictionary() method. All other input (presumably common data types including numpy structures) is left untouched.

opengate.base.find_paths_in_gate_object_dictionary(go_dict, only_input_files=False)[source]
opengate.base.recursively_search_object(obj, condition=lambda x: ...)[source]
opengate.base.find_all_gate_objects(dct)[source]
opengate.base.find_all_paths(dct)[source]
opengate.base._get_user_info_options(user_info_name, object_type, class_module)[source]

Utility function to retrieve the options associated with a user info given the class name, the module in which the class is defined, and the name of the user info.

opengate.base.create_gate_object_from_dict(dct)[source]

Function to (re-)create an object derived from GateObject based on a dictionary.

Used as part of the deserialization chain, when reading simulations stored as JSON file.