pointwise_scales, piecewise_scales = sel_align_m2q_log_xcorr.get_all_scale_coeffs(
    m2q_corr, m2q_roi=[0.5, 75], cts_per_slice=2**8, max_scale=1.15)
# Compute corrected data
m2q_corr_q = m2q_corr / pointwise_scales

# Convert back to tof
tof_corr_q = np.sqrt(m2q_corr_q / (p_m2q[0] * 1e-4)) + p_m2q[1]

# Plot TOF vs event index with voltage overlaid to show if voltage corr went ok
ax = plotting_stuff.plot_TOF_vs_time(tof_corr_q, epos, 2)
ax.set_title('voltage and bowl corrected')

# Plot slices from the detector to show if bowl corr went ok
plotting_stuff.plot_bowl_slices(tof_corr_q,
                                epos,
                                3,
                                clearFigure=True,
                                user_ylim=[0, 1200])

# Find c and t0 for ToF data based on aligning to reference spectrum
m2q_corr_q, p_m2q_q = m2q_calib.align_m2q_to_ref_m2q(ref_epos['m2q'],
                                                     tof_corr_q)

# Define calibration peaks
ed = initElements_P3.initElements()
ref_pk_m2qs = np.array([
    ed['H'].isotopes[1][0], ed['Si'].isotopes[28][0] / 3,
    ed['Si'].isotopes[28][0] / 2, ed['O'].isotopes[16][0] / 1,
    (ed['Si'].isotopes[28][0] + ed['O'].isotopes[16][0]) / 2,
    ed['O'].isotopes[16][0] * 2,
    (ed['Si'].isotopes[28][0] + ed['O'].isotopes[16][0]) / 1,
Beispiel #2
0
fig.clf()
ax = fig.gca()

ax.scatter(epos_vb_R44['x_det'][rhs_idxs],
           epos_vb_R44['y_det'][rhs_idxs],
           alpha=0.1,
           s=3)
ax.axis('equal')
ax.axis('square')
ax.set_xlabel('x')
ax.set_ylabel('y')

plotting_stuff.plot_bowl_slices(
    epos_vb_R44['tof'],
    epos_vb_R44,
    1000,
    clearFigure=True,
    user_ylim=[0, 1000],
)

lhs_roi = [489., 490]
rhs_roi = [490, 491]

lhs_idxs = np.where((epos_vb_R20['tof'] > lhs_roi[0])
                    & (epos_vb_R20['tof'] < lhs_roi[1]))[0]
rhs_idxs = np.where((epos_vb_R20['tof'] > rhs_roi[0])
                    & (epos_vb_R20['tof'] < rhs_roi[1]))[0]

fig = plt.figure(num=500)
fig.clf()
ax = fig.gca()