3.10.1.27. opengate.utility

3.10.1.27.1. Attributes

git

g4_units

3.10.1.27.2. Classes

LazyModuleLoader

Lazy loading allows you to delay the loading of a module until it's actually needed.

3.10.1.27.3. Functions

assert_equal_dic(d1, d2[, name])

ensure_directory_exists(directory)

get_material_name_variants(material_name)

Get different variants of a material name, e.g. with/without prepended G4_, only first letter capital.

g4_best_unit(value, unit_type)

g4_best_unit_tuple(value, unit_type)

assert_key(key, d)

assert_keys(keys, d)

indent(amount, text[, ch])

Prefix the text with indent spaces

assert_unique_element_name(elements, name)

make_builders(class_names)

Consider a list of Classname. For each, it builds a key/value, with:

read_mac_file_to_commands(filename)

ensure_filename_is_str(filename)

insert_suffix_before_extension(file_path, suffix[, ...])

get_random_folder_name([size, create])

get_rnd_seed(seed)

DDF()

Debug print current Function name

DD(arg)

Debug print variable name and its value

print_dic(dic)

get_release_date(opengate_version)

get_gate_folder()

get_data_folder()

get_tests_folder()

get_contrib_path()

print_opengate_info()

Print information about OpenGate and the environment

calculate_variance(value_array, squared_value_array, ...)

standard_error_c4_correction(n)

Parameters

3.10.1.27.4. Module Contents

class opengate.utility.LazyModuleLoader(module_name)[source]

Lazy loading allows you to delay the loading of a module until it’s actually needed. This can be useful if a module is expensive to load or if it may not be used in every execution of the program. We use it for some modules that was found to delay the startup time, in particular: - radioactivedecay and pandas in phidsources - torch and gaga in gansources (only required for some features)

module_name[source]
module = None[source]
__getattr__(name)[source]
opengate.utility.git[source]
opengate.utility.assert_equal_dic(d1, d2, name='')[source]
opengate.utility.ensure_directory_exists(directory)[source]
opengate.utility.g4_units[source]
opengate.utility.get_material_name_variants(material_name)[source]

Get different variants of a material name, e.g. with/without prepended G4_, only first letter capital. Intended to bridge inconsistencies in naming conventions.

opengate.utility.g4_best_unit(value, unit_type)[source]
opengate.utility.g4_best_unit_tuple(value, unit_type)[source]
opengate.utility.assert_key(key: str, d: box.Box)[source]
opengate.utility.assert_keys(keys: list, d: box.Box)[source]
opengate.utility.indent(amount, text, ch=' ')[source]

Prefix the text with indent spaces https://stackoverflow.com/questions/8234274/how-to-indent-the-contents-of-a-multi-line-string

opengate.utility.assert_unique_element_name(elements, name)[source]
opengate.utility.make_builders(class_names)[source]

Consider a list of Classname. For each, it builds a key/value, with: - the type of the class as key - and a lambda function that create an object of this class as value

opengate.utility.read_mac_file_to_commands(filename)[source]
opengate.utility.ensure_filename_is_str(filename)[source]
opengate.utility.insert_suffix_before_extension(file_path, suffix, suffix_separator='-')[source]
opengate.utility.get_random_folder_name(size=8, create=True)[source]
opengate.utility.get_rnd_seed(seed)[source]
opengate.utility.DDF()[source]

Debug print current Function name

opengate.utility.DD(arg)[source]

Debug print variable name and its value

opengate.utility.print_dic(dic)[source]
opengate.utility.get_release_date(opengate_version)[source]
opengate.utility.get_gate_folder()[source]
opengate.utility.get_data_folder()[source]
opengate.utility.get_tests_folder()[source]
opengate.utility.get_contrib_path()[source]
opengate.utility.print_opengate_info()[source]

Print information about OpenGate and the environment

opengate.utility.calculate_variance(value_array, squared_value_array, number_of_samples)[source]
opengate.utility.standard_error_c4_correction(n)[source]

3.10.1.27. Parameters

ninteger

Number of subsets (of the samples).

3.10.1.27. Returns

c4double

Factor to convert the biased standard error of the mean of subsets of the sample into an unbiased - assuming a normal distribution . Usage: standard_error(unbiased) = standard_deviation_of_mean(=biased) / c4 The reason is that the standard deviation of the mean of subsets of the sample X underestimates the true standard error. For n = 2 this underestimation is about 25%.

Values for c4: n=2: 0.7979; n= 9: 0.9693