utils.pyΒΆ

Module that contains general-use utilities. Some of these are useful outside of hutch-python, while others are used in multiple places throughout the module.

safe_load

Context manager to safely run a block of code.

get_current_experiment

Get the current experiment for hutch.

IterableNamespace

alias of HelpfulNamespace

HelpfulNamespace

SimpleNamespace that can be iterated over, with a fancy table repr.

count_ns_leaves

Count the number of objects in a nested IterableNamespace.

extract_objs

Return all objects with the scope.

find_object

Given a string module path to an object, return that object.

find_class

Find a type object given a str.

strip_prefix

Strip the first section of an underscore-separated name.

hutch_banner

Display the hutch's banner.

In [1]: hutch_banner()
 _    _       _       _       _____       _   _                 
| |  | |     | |     | |     |  __ \     | | | |                
| |__| |_   _| |_ ___| |__   | |__) |   _| |_| |__   ___  _ __  
|  __  | | | | __/ __| '_ \  |  ___/ | | | __| '_ \ / _ \| '_ \ 
| |  | | |_| | || (__| | | | | |   | |_| | |_| | | | (_) | | | |
|_|  |_|\__,_|\__\___|_| |_| |_|    \__, |\__|_| |_|\___/|_| |_|
                                     __/ |                      
                                    |___/