#this file runs the experiment through runmanager from datetime import datetime import time from os import listdir #import for labscript from labscript.labscript import labscript_init from runmanager import remote def run_experiment(routine_name, global_var): hdf_path = f"C:\\Users\\DyLab\\PrepLab\\Experiments\\NNDy_TestSetup\\{routine_name}" #this way it should be loading the routine based on past executions, with the possibility of only changing the global variables #it's possible that there could be some issue if the script is changed before running MLOOP #without further insights on this, it's recommended to always run the sequence once from runmanager GUI before running NNDy labscript_init(hdf_path, new = True) runmanager_client = remote.Client() runmanager_client.set_view_shots(False) runmanager_client.set_globals(global_var) #print of all the shot globals print(f'globals: \n {runmanager_client.get_globals()}') #set the path to the shot that will be created hdf_path = runmanager_client.get_shot_output_folder() print(f'engaged, now waiting') runmanager_client.engage() #print('engaged') #NNDy_ will make sure that the script is put on hold until the shot isn't sent to lyse #ask Jianshun for further info print('waiting time is over') #returns and retrieve the hdf5 file of the shot try: hdf_files = listdir(hdf_path) if len(hdf_files) == 0: raise ModuleNotFoundError else: if len(hdf_files) > 1: raise ImportError hdf_file = hdf_path + "/" + hdf_files[0] except (ModuleNotFoundError, ImportError) as e: raise Error(f'An error has occured while importing from hdf output folder: {e}') return hdf_file