3.10.1.3. opengate.base

3.10.1.3.1. Classes

MetaUserInfo

MetaUserInfoSingleton

GateObjectSingleton

GateObject

3.10.1.3.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.

3.10.1.3.3. Module Contents

class opengate.base.MetaUserInfo[source]

Bases: type

_created_classes[source]
__call__(*args, **kwargs)[source]
class opengate.base.MetaUserInfoSingleton[source]

Bases: type

_instances[source]
_created_classes[source]
__call__(*args, **kwargs)[source]
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]
clone_user_info(other_obj)[source]
to_dictionary()[source]
from_dictionary(d)[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.