ZH: employ phase_comparison_figure function

This commit is contained in:
Eric-Teunis de Boone 2023-02-07 17:58:45 +01:00
parent e821ce00ca
commit 8fc7d4bc0c
4 changed files with 71 additions and 79 deletions

View file

@ -10,6 +10,7 @@ def phase_comparison_figure(
sc_kwargs={},
colors=['blue', 'orange'],
legend_on_scatter=True,
secondary_axis='time',
**fig_kwargs
):
"""
@ -27,11 +28,18 @@ def phase_comparison_figure(
if not hasattr(axs, '__len__'):
axs = [axs]
if f_beacon:
if f_beacon and secondary_axis in ['phase', 'time']:
phase2time = lambda x: x/(2*np.pi*f_beacon)
time2phase = lambda x: 2*np.pi*x*f_beacon
secax = axs[0].secondary_xaxis('top', functions=(phase2time, time2phase))
secax.set_xlabel('Time $\\varphi/(2\\pi f_{beac})$ [ns]')
if secondary_axis == 'time':
functions = (phase2time, time2phase)
label = 'Time $\\varphi/(2\\pi f_{beac})$ [ns]'
else:
functions = (time2phase, phase2time)
label = 'Phase $2\\pi t f_{beac}$ [rad]'
secax = axs[0].secondary_xaxis('top', functions=functions)
# Histogram
if do_hist_plot: