Commit c9902cfb authored by Laurent Petre's avatar Laurent Petre
Browse files

Merge branch 'feature/range-plots-sbit' into 'main'

Set range in S-bit rate scan plot

See merge request !36
parents 780304b2 00709f55
Pipeline #3969094 passed with stages
in 3 minutes and 17 seconds
......@@ -32,9 +32,12 @@ def create_configuration(input_filenames, output_directory, target_rate, plottin
def plot_scan_oh(df):
"""Plot threshold scans for all VFATs in single OH"""
def plot_scan_vfat(vfat, df, ax):
def plot_scan_vfat(vfat, df, ax, time_interval):
"""Plot threshold scan for single VFAT"""
ax.plot(df["dac-value"], df["rate"], "o")
# The axis limit is chosen to be twice the maximum rate aquired in the time interval of the scan
ax.set_ylim(1, time_interval * 40080000 * 2)
ax.set_xlim(0, 255)
ax.title.set_text(f"VFAT {vfat}")
ax.set_xlabel("THR_ARM_DAC")
ax.set_ylabel("S-bt rate (Hz)")
......@@ -44,6 +47,12 @@ def create_configuration(input_filenames, output_directory, target_rate, plottin
slot = df.iloc[0]["slot"]
oh = df.iloc[0]["oh"]
# The s-bit counters increase of maximum 1 per each bunch crossing;
# the bunch crissing rate in LHC is 40.07897 MHz approximated to 4008000 MHz
# giving a possible increase in the s-bit counters of maximum 4008000 per second.
# The time interval used for the scan can be estimated in second as:
time_interval = (df["rate"].max() // 40080000) + 1
vfat_group = df.groupby(["vfat"])
nrows, ncols = 3, int(np.ceil(len(vfat_group) / 3)) # Round-up the number of columns
......@@ -51,7 +60,7 @@ def create_configuration(input_filenames, output_directory, target_rate, plottin
thr_scan_axs = thr_scan_axs.flat
for group_index, (vfat_index, vfat_df) in enumerate(vfat_group):
plot_scan_vfat(vfat_index, vfat_df, thr_scan_axs[group_index])
plot_scan_vfat(vfat_index, vfat_df, thr_scan_axs[group_index], time_interval)
output_figure = "{}/plots/fed{}-slot{}-oh{}.png".format(output_directory, fed, slot, oh)
thr_scan_fig.savefig(output_figure)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment