Added number_of_steps()
This commit is contained in:
@@ -221,7 +221,8 @@ def fit_2d_gaussian(image, roi: Optional[ROI] = None, plot=False):
|
||||
center_y = result.params["centery"].value
|
||||
|
||||
if plot == True:
|
||||
|
||||
from matplotlib import pyplot as plt
|
||||
from scipy.interpolate import griddata
|
||||
X, Y = np.meshgrid(np.arange(len_y), np.arange(len_x))
|
||||
Z = griddata((x, y), z, (X, Y), method='linear', fill_value=0)
|
||||
|
||||
|
||||
@@ -95,7 +95,10 @@ def print_run_info(
|
||||
print("\n".join([str(c) for c in ch]))
|
||||
# print only channels for first step
|
||||
break
|
||||
|
||||
def number_of_steps(scan_number_or_scan):
|
||||
"""Returns number of steps for a scan object or run number"""
|
||||
scan = cu.get_scan_from_run_number_or_scan(scan_number_or_scan)
|
||||
return len(scan.info['scan_readbacks'])
|
||||
|
||||
def process_run(run_number, rois,detector='JF16T03V01', calculate =None, only_shots=slice(None), n_jobs=cpu_count()-2):
|
||||
"""Process rois for a given detector. Save the results small data in the res/small_data/run...
|
||||
@@ -245,14 +248,20 @@ def heuristic_extract_pgroup(path=None):
|
||||
path = path or os.getcwd()
|
||||
|
||||
if "/p" in path:
|
||||
# Cut the string and look at the next five letters after /p
|
||||
p_number = path.partition("/p")[2][:5]
|
||||
|
||||
# Find the last /p in the path
|
||||
p_index = path.rfind('/p')
|
||||
|
||||
# Cut the string and look at the next five letters after the last /p
|
||||
p_number = path[p_index+2:p_index+7]
|
||||
|
||||
if not p_number.isdigit():
|
||||
raise KeyError("Automatic p-group extraction from the current working directory didn't work.")
|
||||
|
||||
else:
|
||||
raise KeyError("Automatic p-group extraction from the current working directory didn't work.")
|
||||
return p_number
|
||||
|
||||
return p_number
|
||||
|
||||
def heuristic_extract_base_path():
|
||||
""" The function tries to guess the full path where the raw data is saved."""
|
||||
@@ -263,7 +272,7 @@ def heuristic_extract_base_path():
|
||||
def heuristic_extract_smalldata_path():
|
||||
""" The function tries to guess the full path where the small data is saved."""
|
||||
p_number = heuristic_extract_pgroup()
|
||||
small_data_path = f"/das/work/units/cristallina/p{p_number}/smalldata/"
|
||||
small_data_path = f"/das/work/p{str(p_number)[0:2]}/p{p_number}/smalldata/"
|
||||
return small_data_path
|
||||
|
||||
######################## Little useful functions ########################
|
||||
|
||||
Reference in New Issue
Block a user