|
25 | 25 | import json
|
26 | 26 | import tokenize
|
27 | 27 | import io
|
| 28 | +import warnings |
28 | 29 |
|
29 | 30 | import labscript_utils.h5_lock
|
30 | 31 | import h5py
|
31 | 32 | import numpy as np
|
32 | 33 |
|
33 | 34 | from labscript_utils.ls_zprocess import ProcessTree, zmq_push_multipart
|
34 | 35 | from labscript_utils.labconfig import LabConfig
|
| 36 | +import labscript_utils.shot_utils |
35 | 37 | process_tree = ProcessTree.instance()
|
36 | 38 |
|
37 | 39 | from .__version__ import __version__
|
@@ -915,24 +917,16 @@ def compile_labscript_with_globals_files_async(labscript_file, globals_files, ou
|
915 | 917 | def get_shot_globals(filepath):
|
916 | 918 | """Returns the evaluated globals for a shot, for use by labscript or lyse.
|
917 | 919 | Simple dictionary access as in dict(h5py.File(filepath).attrs) would be fine
|
918 |
| - except we want to apply some hacks, so it's best to do that in one place.""" |
919 |
| - params = {} |
920 |
| - with h5py.File(filepath, 'r') as f: |
921 |
| - for name, value in f['globals'].attrs.items(): |
922 |
| - # Convert numpy bools to normal bools: |
923 |
| - if isinstance(value, np.bool_): |
924 |
| - value = bool(value) |
925 |
| - # Convert null HDF references to None: |
926 |
| - if isinstance(value, h5py.Reference) and not value: |
927 |
| - value = None |
928 |
| - # Convert numpy strings to Python ones. |
929 |
| - # DEPRECATED, for backward compat with old files. |
930 |
| - if isinstance(value, np.str_): |
931 |
| - value = str(value) |
932 |
| - if isinstance(value, bytes): |
933 |
| - value = value.decode() |
934 |
| - params[name] = value |
935 |
| - return params |
| 920 | + except we want to apply some hacks, so it's best to do that in one place. |
| 921 | + |
| 922 | + Deprecated: use identical function `labscript_utils.shot_utils.get_shot_globals` |
| 923 | + """ |
| 924 | + |
| 925 | + warnings.warn( |
| 926 | + FutureWarning("get_shot_globals has moved to labscript_utils.shot_utils. " |
| 927 | + "Please update your code to import it from there.")) |
| 928 | + |
| 929 | + return labscript_utils.shot_utils.get_shot_globals(filepath) |
936 | 930 |
|
937 | 931 |
|
938 | 932 | def dict_diff(dict1, dict2):
|
|
0 commit comments