diff --git a/script/local.py b/script/local.py index 509d081..19df4d0 100644 --- a/script/local.py +++ b/script/local.py @@ -92,6 +92,8 @@ COUNT_TIME_PREFERENCE = "count_time" GEOMETRY_PREFERENCE = "geometry" ROI_PREFERENCE = "roi" BG_ROI_PREFERENCE = "bg_roi" +USER_PATH_PREFERENCE = "user_path" +USER_EXP_PREFERENCE = "user_exp" def get_count_time(): """ @@ -174,6 +176,25 @@ def is_geometry_set(): return get_device("wavelength") is not None +def set_user_env(path, experiment, images_path=None): + """ + Sets user folder + """ + set_setting(USER_PATH_PREFERENCE, path) + set_setting(USER_EXP_PREFERENCE, experiment) + set_data_path(path + "/" +experiment) + pixel.set_path((path + "/image") if images_path is None else images_path, experiment) + +def get_user_env(path, experiment): + return (get_setting(USER_PATH_PREFERENCE), get_setting(USER_EXP_PREFERENCE)) + + +def load_user_env(): + (path, exp) = get_user_env() + if path and exp: + set_user_env(path, exp) + + ################################################################################################### # Scan callbacks ################################################################################################### @@ -399,6 +420,7 @@ def set_script_path(path): """ get_context().setScriptPath(path) + def backup_ub(name=None, destination = "{data}"): """Copies ub matrix (default= current) to user space. """ @@ -530,6 +552,7 @@ def hkllinscan(hstart, hfinish, kstart, kfinish, lstart, lfinish, number_of_step ################################################################################################### set_geometry(get_geometry(),True) +load_user_env() load_exp_context()