graphnet.data.extractors.icecube.utilities.types module

Utility methods for checking the types of objects.

graphnet.data.extractors.icecube.utilities.types.is_boost_enum(obj)[source]

Check whether obj inherits from Boost.Python.enum.

Return type:

bool

Parameters:

obj (Any)

graphnet.data.extractors.icecube.utilities.types.is_boost_class(obj)[source]

Check whether obj is instance of Boost.Python.enum.

Return type:

bool

Parameters:

obj (Any)

graphnet.data.extractors.icecube.utilities.types.is_icecube_class(obj)[source]

Check whether obj is an IceCube-specific class.

Return type:

bool

Parameters:

obj (Any)

graphnet.data.extractors.icecube.utilities.types.is_type(obj)[source]

Check whether obj is a type, and not an instance.

Return type:

bool

Parameters:

obj (Any)

graphnet.data.extractors.icecube.utilities.types.is_method(obj)[source]

Check whether obj is a method.

Return type:

bool

Parameters:

obj (Any)

graphnet.data.extractors.icecube.utilities.types.break_cyclic_recursion(fn)[source]

Ensure that method isn’t called recursively on the same object.

Return type:

Callable

Parameters:

fn (Callable)

graphnet.data.extractors.icecube.utilities.types.get_member_variables(obj, return_discarded)[source]

Return list of valid member variables.

Ignoring mangled (__*) variables, types, methods, and Boost enums.

Return type:

Union[List[str], Tuple[List[str], Dict[str, List[str]]]]

Parameters:
  • obj (Any)

  • return_discarded (bool)

graphnet.data.extractors.icecube.utilities.types.cast_object_to_pure_python(obj)[source]

Cast obj, and any members/elements, to pure-python classes.

The function takes any object obj and tries to cast it to a pure python class. This is mainly relevant for IceCube-specific classes (I3*) that cannot be cast trivially.

For IceCube-specific classes, we check whether the object has any member, variables and if does, we recursively try to cast these to pure python. Similarly, if an IceCube-specific class has a signature similar to a python list or dict (e.g, it has a length and supports indexation), we cast it to the corresponding pure python equivalent, and recursively try to cast its elements.

For regular-python, non-Icecube-specific, classes, we cast to list-like objects to list and dict-like objects to list, and otherwise return the object itself if it deemed “pythonic” in this way.

Return type:

Any

Parameters:

obj (Any)

graphnet.data.extractors.icecube.utilities.types.cast_pulse_series_to_pure_python(frame, key, calibration, gcd_dict)[source]

Cast pulse series key to a pure-python data representation.

Parameters:
  • frame (icetray.I3Frame) – I3 physics frame.

  • key (str) – Name of the pulse series to be cast.

  • calibration (Any)

  • gcd_dict (Dict)

Returns:

Dictionary of lists of properties for each

pulse across optical modules (OMs), if any pulses are found.

None, otherwise

Return type:

Dict[str, List[Any]]