software_state

This module contains two classes, class State(object) and class DiagnosticPickler(pickle.Pickler), which are used to save the state of the software so it can restart at the same point in an experiment at which it crashed.

class DiagnosticPickler(pickle.Pickler)

class microscope_automation.util.software_state.DiagnosticPickler(file, protocol=None, fix_imports=True, buffer_callback=None)[source]

class State(object)

class microscope_automation.util.software_state.State(recovery_file_path=None)[source]
add_last_experiment_object(exp_object_name)[source]

Add objects to the list for last experiment objects to keep track of which cells have already been imaged. To be able to pick up exactly where we left off

Input:

exp_object_list: list of experiment objects to add for the next experiment

Output:

none

add_next_experiment_object(experiment_name, exp_object_list)[source]

Add objects to the list for next experiment objects.

Input:

experiment_name: name of experiment to add

exp_object_list: list of experiment objects to add for the next experiment

Output:

none

add_unpickled_objects(base_object)[source]

Function to add Zen object back

Input

base_object: The reference object or next experiment object to rehydrate

Output:

none

eliminate_unpickled_objects(base_object)[source]

Remove unpickled objects from given object

Input:

base_object: Object that needs to be pruned

Output:

none

prune_object_dict()[source]

Function to strip away the Zen microscope object from each level of the sample object tree.

Reason - there are some objects in microscope class (communication object) that can’t be pickled.

Input:

object_dict: The dictionary that needs to be filtered.

Output:

object_dict: The filtered dictionary.

recover_objects(file_path)[source]

Function to return next objects dictionary and the reference object by unpickling the file.

Input:

filepath: path to the pickled file

Output:

tuple of recovered objects in the form (next_experiment_objects, reference_object, last_experiment_objects, hardware_status_dict)

rehydrate_removed_references()[source]

In case of auto save, we need the Zen object to be added back (it was removed before pickling)

Input:

none

Output:

none

save_state()[source]

Function to process the objects and save them by pickling.

Input:

none

Output:

none

save_state_and_exit()[source]

Function to process the objects and save them by pickling and exiting the software.

Input:

none

Output:

none