mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-21 19:13:32 +01:00
ZH: prefer str.format with g over e
This commit is contained in:
parent
5abed24ecf
commit
01164ddfae
7 changed files with 10 additions and 10 deletions
|
@ -60,7 +60,7 @@ if __name__ == "__main__":
|
|||
sys.exit(1)
|
||||
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1g}"
|
||||
|
||||
# read in antennas
|
||||
with h5py.File(antennas_fname, 'a') as fp:
|
||||
|
@ -211,7 +211,7 @@ if __name__ == "__main__":
|
|||
p2t = lambda phase: phase/(2*np.pi*f_beacon)
|
||||
|
||||
fig, ax = plt.subplots(figsize=figsize)
|
||||
ax.set_title(f"Beacon at antenna {h5ant.attrs['name']}\nF:{frequency:.2e}GHz, $\\varphi$:{beacon_phase:.4f}rad")
|
||||
ax.set_title(f"Beacon at antenna {h5ant.attrs['name']}\nF:{frequency:.2g}GHz, $\\varphi$:{beacon_phase:.4f}rad")
|
||||
ax.set_xlabel("t [ns]")
|
||||
ax.set_ylabel("Amplitude")
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ if __name__ == "__main__":
|
|||
## Histogram
|
||||
##
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1g}"
|
||||
|
||||
fig = figlib.phase_comparison_figure(
|
||||
loc_c,
|
||||
|
|
|
@ -94,7 +94,7 @@ if __name__ == "__main__":
|
|||
# Compare actual time shifts #
|
||||
##############################
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1g}"
|
||||
|
||||
actual_antenna_clock_phases = { a.name: -2*np.pi*a.attrs['clock_offset']*f_beacon for a in sorted(antennas, key=lambda a: int(a.name)) }
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ if __name__ == "__main__":
|
|||
# Compare actual time shifts #
|
||||
##############################
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1g}"
|
||||
|
||||
actual_antenna_time_shifts = { a.name: a.attrs['clock_offset'] for a in sorted(antennas, key=lambda a: int(a.name)) }
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ if __name__ == "__main__":
|
|||
|
||||
# Read in snr info
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1g}"
|
||||
|
||||
# For now only implement using one freq_name
|
||||
freq_names = antennas[0].beacon_info.keys()
|
||||
|
|
|
@ -71,7 +71,7 @@ if __name__ == "__main__":
|
|||
ev.antennas = antennas
|
||||
# Read in snr info
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1g}"
|
||||
|
||||
# For now only implement using one freq_name
|
||||
freq_names = antennas[0].beacon_info.keys()
|
||||
|
|
|
@ -26,9 +26,9 @@ def save_overlapping_traces_figure(test_location, ev, N_plot = 30, wx=200, title
|
|||
axs.set_title("Antenna traces" + (("\n" + title_extra) if title_extra is not None else '') )
|
||||
axs.set_xlabel("Time [ns]")
|
||||
axs.set_ylabel("Amplitude [$\\mu V/m$]")
|
||||
if False:
|
||||
if True:
|
||||
text_loc = (0.02, 0.95)
|
||||
axs.text(*text_loc, '[' + ', '.join(['{:.1e}'.format(x) for x in test_location]) + ']', ha='left', transform=axs.transAxes)
|
||||
axs.text(*text_loc, '[' + ', '.join(['{:.1g}'.format(x) for x in test_location]) + ']', ha='left', transform=axs.transAxes)
|
||||
|
||||
a_max = [ np.amax(ant.E_AxB) for ant in ev.antennas ]
|
||||
power_sort_idx = np.argsort(a_max)
|
||||
|
@ -139,7 +139,7 @@ if __name__ == "__main__":
|
|||
ev.antennas = antennas
|
||||
# Read in snr info
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1g}"
|
||||
|
||||
##
|
||||
## Setup grid
|
||||
|
|
Loading…
Reference in a new issue