more cleanups
This commit is contained in:
@@ -178,29 +178,6 @@ def sum_images(
|
||||
)
|
||||
|
||||
|
||||
def get_contrast_images(
|
||||
filesets,
|
||||
channel="JF16T03V01",
|
||||
alignment_channels=None,
|
||||
batch_size=10,
|
||||
roi: Optional[ROI] = None,
|
||||
preview=False,
|
||||
):
|
||||
"""
|
||||
See perform_image_calculations. Here calculates mean and standard deviation for a given set of images.
|
||||
"""
|
||||
|
||||
return perform_image_calculations(
|
||||
filesets,
|
||||
channel=channel,
|
||||
alignment_channels=alignment_channels,
|
||||
batch_size=batch_size,
|
||||
roi=roi,
|
||||
preview=preview,
|
||||
operations=["mean", "std"],
|
||||
)
|
||||
|
||||
|
||||
@memory.cache(ignore=["batch_size"]) # we ignore batch_size for caching purposes
|
||||
def perform_image_stack_sum(
|
||||
filesets,
|
||||
@@ -213,7 +190,7 @@ def perform_image_stack_sum(
|
||||
upper_cutoff_threshold=None, # in keV
|
||||
):
|
||||
"""
|
||||
Performs summation for a given region of interest (roi) for an image channel
|
||||
Performs summation along the pulse dimensionfor a given region of interest (roi) for an image channel
|
||||
from a fileset (e.g. "run0352/data/acq0001.*.h5" or step.fnames from a SFScanInfo object).
|
||||
|
||||
Allows alignment, i.e. reducing only to a common subset with other channels.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import re
|
||||
from collections import defaultdict
|
||||
|
||||
import matplotlib
|
||||
@@ -27,7 +26,7 @@ plt.style.use("cristallina.cristallina_style")
|
||||
|
||||
def ju_patch_less_verbose(ju_module):
|
||||
"""Quick monkey patch to suppress verbose messages from gain & pedestal file searcher.
|
||||
Not required for newer versions of ju."""
|
||||
Not anymore required for newer versions of ju."""
|
||||
|
||||
if hasattr(ju_module, "swissfel_helpers"):
|
||||
|
||||
@@ -273,6 +272,7 @@ def plot_spectrum_channel(data: SFDataFiles, channel_name_x, channel_name_y, ave
|
||||
ax.set_xlabel(channel_name_x)
|
||||
axis_styling(ax, channel_name_y, description)
|
||||
|
||||
|
||||
def line_plot_with_colorbar(xs,ys,colors, cmap=plt.cm.viridis,
|
||||
markers='o',markersize=6,alpha=1,
|
||||
title=None,xlabel=None,ylabel=None,cbar_label=None,
|
||||
|
||||
@@ -333,7 +333,7 @@ def check_JF_frames(JF_file_path):
|
||||
Raises an error if invalid frames are found, else returns True.
|
||||
"""
|
||||
pattern = r"\.(JF[0-9].*)\.h5"
|
||||
m = re.search(pattern, str(fpath))
|
||||
m = re.search(pattern, str(JF_file_path))
|
||||
if m is None:
|
||||
raise LookupError("Cannot match Jungfrau detector name from file path.")
|
||||
|
||||
@@ -346,6 +346,7 @@ def check_JF_frames(JF_file_path):
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
def get_step_time(step: SFDataFiles):
|
||||
"""Returns the start and end time as a unix timestamp (in seconds)
|
||||
of a given SFDataFiles or scan step.
|
||||
@@ -360,9 +361,6 @@ def get_step_time(step: SFDataFiles):
|
||||
) / np.timedelta64(1, "s")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def wait_for_run(run_number, total_num_steps, snd_file_path="/tmp/CantinaBand3.wav"):
|
||||
""" Busy wait loop until run has completed all steps. Plays sound
|
||||
when all files are written to disk.
|
||||
@@ -637,7 +635,7 @@ def find_nearest(array, value):
|
||||
|
||||
|
||||
def find_two_nearest(time_array, percentage):
|
||||
"""Finds indeces of the two values that are the nearest to the given value in an array"""
|
||||
"""Finds indices of the two values that are the nearest to the given value in an array"""
|
||||
array = np.asarray(time_array)
|
||||
value = (np.max(array) - np.min(array)) * percentage + np.min(array)
|
||||
idx = (np.abs(array - value)).argmin()
|
||||
|
||||
Reference in New Issue
Block a user