pygwb.statistical_checks.StatisticalChecks

class pygwb.statistical_checks.StatisticalChecks(sliding_times_all, sliding_omega_all, sliding_sigmas_all, naive_sigmas_all, coherence_spectrum, coherence_n_segs, point_estimate_spectrum, sigma_spectrum, frequencies, badGPSTimes, delta_sigmas, plot_dir, baseline_name, param_file, frequency_mask=None, coherence_far=1.0, gates_ifo1=None, gates_ifo2=None, file_tag=None, legend_fontsize=16, convention='pygwb', seaborn_palette='tab10')[source]

Bases: object

__init__(sliding_times_all, sliding_omega_all, sliding_sigmas_all, naive_sigmas_all, coherence_spectrum, coherence_n_segs, point_estimate_spectrum, sigma_spectrum, frequencies, badGPSTimes, delta_sigmas, plot_dir, baseline_name, param_file, frequency_mask=None, coherence_far=1.0, gates_ifo1=None, gates_ifo2=None, file_tag=None, legend_fontsize=16, convention='pygwb', seaborn_palette='tab10')[source]

Instantiate a StatisticalChecks object.

Parameters:
sliding_times_all: ``array_like``

Array of GPS times before the bad GPS times from the delta sigma cut are applied.

sliding_omega_all: ``array_like``

Array of sliding omegas before the bad GPS times from the delta sigma cut are applied.

sliding_sigmas_all: ``array_like``

Array of sliding sigmas before the bad GPS times from the delta sigma cut are applied.

naive_sigmas_all: ``array_like``

Array of naive sigmas before the bad GPS times from the delta sigma cut are applied.

coherence_spectrum: ``array_like``

Array containing a coherence spectrum. Each entry in this array corresponds to the 2-detector coherence spectrum evaluated at the corresponding frequency in the frequencies array.

coherence_n_segs: ``int``

Number of segments used for coherence calculation.

point_estimate_spectrum: ``array_like``

Array containing the point estimate spectrum. Each entry in this array corresponds to the point estimate spectrum evaluated at the corresponding frequency in the frequencies array.

sigma_spectrum: ``array_like``

Array containing the sigma spectrum. Each entry in this array corresponds to the sigma spectrum evaluated at the corresponding frequency in the frequencies array.

frequencies: ``array_like``

Array containing the frequencies.

badGPStimes: ``array_like``

Array of bad GPS times, i.e. times that do not pass the delta sigma cut.

delta_sigmas: ``array_like``

Array containing the value of delta sigma for all times in sliding_times_all.

plot_dir: ``str``

String with the path to which the output of the statistical checks (various plots) will be saved.

baseline_name: ``str``

Name of the baseline under consideration.

param_file: ``str``

String with path to the file containing the parameters that were used for the analysis run.

frequency_mask: ``array_like``

Boolean mask applied to the specrtra in broad-band analyses.

coherence_far: ``float``

Target false alarm rate for number of frequency bins in the coherence spectrum exceeding the coherence threshold.

gates_ifo1/gates_ifo2: ``list``

List of gates applied to interferometer 1/2.

file_tag: ``str``

Tag to be used in file naming convention.

legend_fontsize: ``int``

Font size for plot legends. Default is 16. All other fonts are scaled to this font.

__call__(*args, **kwargs)

Call self as a function.

Methods

__init__(sliding_times_all, ...[, ...])

Instantiate a StatisticalChecks object.

coherence_pdf(gamma)

Theoretical pdf of coherences assuming Gaussian noise

coherence_pvalue(gamma)

Upper tail p-value of the given coherences assuming Gaussian noise

coherence_threshold()

Returns the coherence threshold corresponding to the given FAR.

compute_ifft_integrand()

Function that computes the inverse Fourier transform of the point estimate integrand.

compute_running_quantities()

Function that computes the running point estimate and running sigmas from the sliding point estimate and sliding sigmas.

generate_all_plots()

Generates and saves all the statistical analysis plots.

get_data_after_dsc()

Function that returns the GPS times, the sliding omegas, the sliding sigmas, the naive sigmas, the delta sigmas and the sliding deviates after the bad GPS times from the delta sigma cut were applied.

plot_IFFT_point_estimate_integrand()

Generates and saves a plot of the IFFT of the point estimate integrand.

plot_KS_test([bias_factor])

Generates and saves a panel plot with results of the Kolmogorov-Smirnov test for Gaussianity.

plot_SNR_spectrum()

Generates and saves a plot of the point estimate integrand.

plot_coherence_spectrum([flow, fhigh])

Generates and saves a plot of the coherence spectrum, if present.

plot_cumulative_SNR_spectrum()

Generates and saves a plot of the cumulative point estimate integrand.

plot_cumulative_sensitivity()

Generates and saves a plot of the cumulative sensitivity.

plot_gates_in_time()

plot_hist_coherence([total_bins])

Generates and saves a histogram of the coherence distribution.

plot_hist_omega_pre_post_dsc()

Generates and saves a histogram of the \(\Delta{\rm SNR}_i\) distribution. The plot shows the data before and after the delta-sigma cut (bad GPS times) was applied. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sliding_deviate_all).

plot_hist_sigma_dsc()

Generates and saves a panel plot with a histogram of \(|\Delta\sigma|/\sigma\), as well as a histogram of \(\sigma\).

plot_hist_sigma_squared([max_val, ...])

Generates and saves a histogram of :math:`sigma^2/langlesigma^2

plot_imag_SNR_spectrum()

Generates and saves a plot of the imaginary part of the SNR spectrum.

plot_omega_sigma_in_time()

Generates and saves a panel plot with a scatter plot of \(\sigma\) vs \(\Delta{\rm SNR}_i\), as well as the evolution of \(\Omega\), \(\sigma\), and \((\Omega-\langle\Omega\rangle)/\sigma\) as a function of the days since the start of the run.

plot_omega_time_fit()

Generates and saves a plot of \(\Omega\) as a function of time and fits the data to perform a linear trend analysis.

plot_real_SNR_spectrum()

Generates and saves a plot of the real part of the SNR spectrum.

plot_running_point_estimate([ymin, ymax])

Generates and saves a plot of the running point estimate.

plot_running_sigma()

Generates and saves a plot of the running sigma.

plot_scatter_omega_sigma_dsc()

Generates and saves a panel plot with scatter plots of \(|\Delta\sigma|/\sigma\) vs \(\Delta{\rm SNR}_i\), as well as \(\sigma\) vs \((\Omega-\langle\Omega\rangle)/\sigma\).

plot_scatter_sigma_dsc()

Generates and saves a scatter plot of \(|\Delta\sigma]/\sigma\) vs \(\sigma\).

plot_sigma_spectrum()

Generates and saves a plot of the sigma spectrum.

plot_sigma_time_fit()

Generates and saves a plot of \(\sigma\) as a function of time and fits the data to perform a linear trend analysis.

save_all_statements()

Saves all useful statements gathered throughout the checks to a json file.

coherence_pdf(gamma)[source]

Theoretical pdf of coherences assuming Gaussian noise

Parameters


gamma: array_like

Array of coherence values

Returns


coherence_pdf: array_like

Value of PDF at each gamma

coherence_pvalue(gamma)[source]

Upper tail p-value of the given coherences assuming Gaussian noise

Parameters


gamma: array_like

Array of coherence values

Returns


coherence_pvalue: array_like

p-value of each gamma

coherence_threshold()[source]

Returns the coherence threshold corresponding to the given FAR.

compute_ifft_integrand()[source]

Function that computes the inverse Fourier transform of the point estimate integrand. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.point_estimate_integrand).

Returns:
t_array: array_like

Array containing the time lag values (in seconds).

omega_t: array_like

Array containing the

See also

numpy.fft.fft

More information here.

compute_running_quantities()[source]

Function that computes the running point estimate and running sigmas from the sliding point estimate and sliding sigmas. This is done only for the values after the delta sigma cut. This method does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sliding_sigma_cut).

Returns:
running_pt_estimate: array_like

Array containing the values of the running point estimate.

running_sigmas: array_like

Array containing the values of the running sigmas.

generate_all_plots()[source]

Generates and saves all the statistical analysis plots.

get_data_after_dsc()[source]

Function that returns the GPS times, the sliding omegas, the sliding sigmas, the naive sigmas, the delta sigmas and the sliding deviates after the bad GPS times from the delta sigma cut were applied. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sliding_times_all).

Returns:
sliding_times_cut: array_like

Array of GPS times after the bad GPS times were applied.

days_cut: array_like

Array of days after the bad GPS times were applied.

sliding_omega_cut: array_like

Array of the sliding omega values after the bad GPS times were applied.

sliding_sigma_cut: array_like

Array of sliding sigmas after the bad GPS times were applied.

naive_sigma_cut: array_like

Array of naive sigmas after the bad GPS times were applied.

delta_sigma_cut: array_like

Array of the delta sigma values after the bad GPS times were applied.

sliding_deviate_cut: array_like

Array of the deviates after the bad GPS times were applied.

plot_IFFT_point_estimate_integrand()[source]

Generates and saves a plot of the IFFT of the point estimate integrand. The IFFT of the point estimate integrand is computed using the method “compute_ifft_integrand”. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.point_estimate_integrand).

plot_KS_test(bias_factor=None)[source]

Generates and saves a panel plot with results of the Kolmogorov-Smirnov test for Gaussianity. The cumulative distribution of the data (after the delta-sigma (bad GPS times) cut) is compared to the one of Gaussian data, where the bias factor for the sigmas is taken into account. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sliding_deviate_cut).

Parameters:

bias_factor (float, optional) – Bias factor to consider in the KS calculation. Defaults to None, in which case it computes the bias factor on the fly.

plot_SNR_spectrum()[source]

Generates and saves a plot of the point estimate integrand. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.point_estimate_integrand).

plot_coherence_spectrum(flow=None, fhigh=None)[source]

Generates and saves a plot of the coherence spectrum, if present. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. coherence_spectrum).

plot_cumulative_SNR_spectrum()[source]

Generates and saves a plot of the cumulative point estimate integrand. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.point_estimate_integrand).

plot_cumulative_sensitivity()[source]

Generates and saves a plot of the cumulative sensitivity. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sigma_spectrum).

plot_hist_coherence(total_bins=None)[source]

Generates and saves a histogram of the coherence distribution. The plot shows the data after the delta-sigma cut (bad GPS times) was applied. This function does not require any input parameters, as it accesses the data through the attributes of the class. Furthermore, it also saves a text file which contains the frequencies at which outliers of the coherence distribution were identified, i.e. spectral artefacts.

plot_hist_omega_pre_post_dsc()[source]

Generates and saves a histogram of the \(\Delta{\rm SNR}_i\) distribution. The plot shows the data before and after the delta-sigma cut (bad GPS times) was applied. This function

does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sliding_deviate_all).

plot_hist_sigma_dsc()[source]

Generates and saves a panel plot with a histogram of \(|\Delta\sigma|/\sigma\), as well as a histogram of \(\sigma\). Both plots show the data before and after the delta-sigma cut (bad GPS times) was applied. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.delta_sigmas_all).

plot_hist_sigma_squared(max_val=5, total_bins=100, label_number=6)[source]

Generates and saves a histogram of :math:`sigma^2/langlesigma^2

angle`. The plot shows

data after the delta-sigma (bad GPS times) cut. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sliding_sigma_cut).

plot_imag_SNR_spectrum()[source]

Generates and saves a plot of the imaginary part of the SNR spectrum. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.point_estimate_spectrum and self.sigma_spectrum).

plot_omega_sigma_in_time()[source]

Generates and saves a panel plot with a scatter plot of \(\sigma\) vs \(\Delta{\rm SNR}_i\), as well as the evolution of \(\Omega\), \(\sigma\), and \((\Omega-\langle\Omega\rangle)/\sigma\) as a function of the days since the start of the run. All plots show the data before and after the delta-sigma cut (bad GPS times) was applied. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sliding_sigmas_all).

plot_omega_time_fit()[source]

Generates and saves a plot of \(\Omega\) as a function of time and fits the data to perform a linear trend analysis. The plot shows data after the delta-sigma (bad GPS times) cut. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sliding_omega_cut).

plot_real_SNR_spectrum()[source]

Generates and saves a plot of the real part of the SNR spectrum. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.point_estimate_spectrum and self.sigma_spectrum).

plot_running_point_estimate(ymin=None, ymax=None)[source]

Generates and saves a plot of the running point estimate. The plotted values are the ones after the delta sigma cut. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.days_cut).

Parameters:
  • ymin (array_like) – Minimum value on the y-axis.

  • ymax (array_like) – Maximum value on the y-axis.

plot_running_sigma()[source]

Generates and saves a plot of the running sigma. The plotted values are the ones after the delta sigma cut. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.days_cut).

plot_scatter_omega_sigma_dsc()[source]

Generates and saves a panel plot with scatter plots of \(|\Delta\sigma|/\sigma\) vs \(\Delta{\rm SNR}_i\), as well as \(\sigma\) vs \((\Omega-\langle\Omega\rangle)/\sigma\). All plots show the data before and after the delta-sigma cut (bad GPS times) was applied. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.delta_sigmas_all).

plot_scatter_sigma_dsc()[source]

Generates and saves a scatter plot of \(|\Delta\sigma]/\sigma\) vs \(\sigma\). The plot shows the data before and after the delta-sigma cut (bad GPS times) was applied. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.delta_sigmas_all).

plot_sigma_spectrum()[source]

Generates and saves a plot of the sigma spectrum. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sigma_spectrum).

plot_sigma_time_fit()[source]

Generates and saves a plot of \(\sigma\) as a function of time and fits the data to perform a linear trend analysis. The plot shows data after the delta-sigma (bad GPS times) cut. This function does not require any input parameters, as it accesses the data through the attributes of the class (e.g. self.sliding_sigma_cut).

save_all_statements()[source]

Saves all useful statements gathered throughout the checks to a json file.