Added method LeftRightBottomTop to ROI

This commit is contained in:
2022-08-27 21:23:57 +02:00
parent 3de4db9415
commit a75fba93fd
2 changed files with 20 additions and 10 deletions

View File

@@ -188,20 +188,23 @@ def plot_image_channel(data, channel_name, pulse=0, ax=None, rois=None, norms=No
axis_styling(ax, channel_name, description)
plt.legend(loc=4)
def plot_spectrum_channel(data, channel_name_x, channel_name_y, ax=None):
def plot_spectrum_channel(data, channel_name_x, channel_name_y, average=True, frame=0, ax=None):
"""
Plots channel data for two channels where the first is taken as the (constant) x-axis
and the second as the y-axis (here we take the mean over the individual pulses).
and the second as the y-axis (here we take by default the mean over the individual pulses).
"""
try:
mean, std = np.mean(data[channel_name_y].data), np.std(data[channel_name_y].data)
# data[channel_name].data
mean_over_frames = np.mean(data[channel_name_y].data, axis=0)
except TypeError:
print(f"Unknown data in channel {channel_name_y}.")
return
y_data = mean_over_frames
if average:
y_data = mean_over_frames
else:
y_data = data[channel_name_y].data[frame]
if ax is None:
fig, ax = plt.subplots(constrained_layout=True)