mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-11-13 10:03:32 +01:00
ZH: save phase_time_residuals for SNR plotting required for (a585677
)
This commit is contained in:
parent
97f7b0ba8c
commit
878c476a4a
1 changed files with 22 additions and 1 deletions
|
@ -7,6 +7,7 @@ import matplotlib.pyplot as plt
|
||||||
from matplotlib.colors import Normalize
|
from matplotlib.colors import Normalize
|
||||||
import matplotlib as mpl
|
import matplotlib as mpl
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import json
|
||||||
|
|
||||||
import aa_generate_beacon as beacon
|
import aa_generate_beacon as beacon
|
||||||
import lib
|
import lib
|
||||||
|
@ -119,6 +120,11 @@ if __name__ == "__main__":
|
||||||
mean_clock_phase = np.nanmean(clock_phase_matrix[my_mask], axis=0)
|
mean_clock_phase = np.nanmean(clock_phase_matrix[my_mask], axis=0)
|
||||||
std_clock_phase = np.nanstd( clock_phase_matrix[my_mask], axis=0)
|
std_clock_phase = np.nanstd( clock_phase_matrix[my_mask], axis=0)
|
||||||
|
|
||||||
|
# Remove the mean from the matrix
|
||||||
|
if False:
|
||||||
|
clock_phase_matrix = clock_phase_matrix - np.mean(mean_clock_phase)
|
||||||
|
mean_clock_phase = np.nanmean(clock_phase_matrix[my_mask], axis=0)
|
||||||
|
std_clock_phase = np.nanstd( clock_phase_matrix[my_mask], axis=0)
|
||||||
|
|
||||||
# Show resulting matrix as figure
|
# Show resulting matrix as figure
|
||||||
if True:
|
if True:
|
||||||
|
@ -175,6 +181,7 @@ if __name__ == "__main__":
|
||||||
global_phase_shift = actual_antenna_phase_shifts[0] - mean_clock_phase[0]
|
global_phase_shift = actual_antenna_phase_shifts[0] - mean_clock_phase[0]
|
||||||
actual_antenna_phase_shifts = lib.phase_mod(actual_antenna_phase_shifts - global_phase_shift )
|
actual_antenna_phase_shifts = lib.phase_mod(actual_antenna_phase_shifts - global_phase_shift )
|
||||||
|
|
||||||
|
fit_info = {}
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
plot_residuals = i == 1
|
plot_residuals = i == 1
|
||||||
true_phases = actual_antenna_phase_shifts
|
true_phases = actual_antenna_phase_shifts
|
||||||
|
@ -184,7 +191,7 @@ if __name__ == "__main__":
|
||||||
if plot_residuals:
|
if plot_residuals:
|
||||||
measured_phases = lib.phase_mod(measured_phases - actual_antenna_phase_shifts)
|
measured_phases = lib.phase_mod(measured_phases - actual_antenna_phase_shifts)
|
||||||
|
|
||||||
fig = figlib.phase_comparison_figure(
|
fig, _fit_info = figlib.phase_comparison_figure(
|
||||||
measured_phases,
|
measured_phases,
|
||||||
true_phases,
|
true_phases,
|
||||||
plot_residuals=plot_residuals,
|
plot_residuals=plot_residuals,
|
||||||
|
@ -192,6 +199,7 @@ if __name__ == "__main__":
|
||||||
figsize=figsize,
|
figsize=figsize,
|
||||||
hist_kwargs=hist_kwargs,
|
hist_kwargs=hist_kwargs,
|
||||||
fit_gaussian=plot_residuals,
|
fit_gaussian=plot_residuals,
|
||||||
|
return_fit_info = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
axs = fig.get_axes()
|
axs = fig.get_axes()
|
||||||
|
@ -215,6 +223,19 @@ if __name__ == "__main__":
|
||||||
extra_name = "residuals"
|
extra_name = "residuals"
|
||||||
fig.savefig(path.join(fig_dir, path.basename(__file__) + f".phase.{extra_name}.pdf"))
|
fig.savefig(path.join(fig_dir, path.basename(__file__) + f".phase.{extra_name}.pdf"))
|
||||||
|
|
||||||
|
# Save fit_info to data file
|
||||||
|
if fname_dir and plot_residuals:
|
||||||
|
with open(path.join(fname_dir, 'phase_time_residuals.json'), 'w') as fp:
|
||||||
|
json.dump(
|
||||||
|
{
|
||||||
|
'mean': np.mean(measured_phases),
|
||||||
|
'std': np.std(measured_phases),
|
||||||
|
'values': measured_phases.tolist(),
|
||||||
|
},
|
||||||
|
fp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
##########################
|
##########################
|
||||||
##########################
|
##########################
|
||||||
|
|
Loading…
Reference in a new issue