tests package

Submodules

tests.enterprise_test_data module

This module provides the location of data files for tests as datadir. Currently they are in tests/data, and they are based on the 9-yr data release.

tests.test_deterministic_signals module

Deterministic Signals are those that provide a get_delay() method, and are created by the class factories in enterprise.signals.deterministic_signals. All tests in this module are run on B1855+09_NANOGrav_9yv1.

class tests.test_deterministic_signals.TestDeterministicSignals(methodName='runTest')[source]

Bases: TestCase

Tests deterministic signals with a tempo2 Pulsar object.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Set up the enterprise.Pulsar() object used in tests (tempo2 version).

test_bwm()[source]

Tests enterprise.signals.deterministic_signals.Deterministic() using the burst-with-memory function enterprise.signals.utils.bwm_delay(). The test instantiates a deterministic Signal on our test pulsar, and compares the array returned by calling get_delay() on the Signal with a fixed dictionary of parameters, with the result of calling the function directly with those parameters.

test_delay()[source]

Same as TestDeterministicSignals.test_bwm(), but for a simple sine wave signal.

test_delay_backend()[source]

Same as TestDeterministicSignals.test_delay(), but instantiates the Signal with enterprise.signals.selections.by_backend(), which creates separated named parameters for 430_ASP, 430_PUPPI, L-wide_ASP, L-wide_PUPPI. The parameters are automatically accounted for in get_delay(), but they need to be used explicitly when calling the function directly. The tests therefore reconstructs the delay vector by building selection masks from enterprise.Pulsar.backend_flags().

test_physical_ephem_model()[source]

Tests physical ephemeris model (which is implemented as a deterministic signal) four ways:

  • computed directly with enterprise.signals.utils.physical_ephem_delay();

  • computed with enterprise.signals.deterministic_signals.PhysicalEphemerisSignal.get_delay() with use_epoch_toas=True (the default), which reduces computation by evaluating ephemeris corrections once per measurement epoch, and then interpolating to the full toas vector;

  • computed with enterprise.signals.deterministic_signals.PhysicalEphemerisSignal.get_delay(), setting use_epoch_toas=False;

  • loaded from a golden copy.

test_physical_ephem_model_setIII()[source]

Test physical ephemeris model

class tests.test_deterministic_signals.TestDeterministicSignalsPint(methodName='runTest')[source]

Bases: TestDeterministicSignals

Tests deterministic signals with a PINT Pulsar object.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Set up the enterprise.Pulsar() object used in tests (PINT version).

tests.test_deterministic_signals.sine_wave(toas, log10_A=-7, log10_f=-8, phase=0.0)[source]

A simple sine wave Enterprise function object. When instantiated, it will create named Parameters for log10_A, log10_f, phase, and it will automatically extract toas from the linked Pulsar object.

tests.test_gp_coefficients module

test_gp_coefficients

Tests for GP signals used with deterministic coefficients.

class tests.test_gp_coefficients.TestGPCoefficients(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_common_red_noise()[source]

Test of a coefficient-based common GP.

test_conditional_gp()[source]
test_ecorr_backend()[source]

Test that ecorr-backend signal returns correct values.

test_ephemeris()[source]

Test physical-ephemeris delay, made three ways: from marginalized GP, from coefficient-based GP, from deterministic model.

test_formalism()[source]
test_fourier_red_noise()[source]

Test that implicit and explicit GP delays are the same.

class tests.test_gp_coefficients.TestGPCoefficientsPint(methodName='runTest')[source]

Bases: TestGPCoefficients

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_ephemeris()[source]

Test physical-ephemeris delay, made three ways: from marginalized GP, from coefficient-based GP, from deterministic model.

tests.test_gp_coefficients.create_quant_matrix(toas, dt=1)[source]
tests.test_gp_coefficients.se_kernel(etoas, log10_sigma=-7, log10_lam=6.413634997198556)[source]

tests.test_gp_priors module

test_gp_priors

Tests for GP priors and bases.

class tests.test_gp_priors.TestGPSignals(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_adapt_t_process_prior()[source]

Test that red noise signal returns correct values.

test_broken_powerlaw_prior()[source]

Test that red noise signal returns correct values.

test_free_spec_prior()[source]

Test that red noise signal returns correct values.

test_powerlaw_genmodes_prior()[source]

Test that red noise signal returns correct values.

test_t_process_prior()[source]

Test that red noise signal returns correct values.

test_turnover_knee_prior()[source]

Test that red noise signal returns correct values.

test_turnover_prior()[source]

Test that red noise signal returns correct values.

tests.test_gp_signals module

test_gp_signals

Tests for GP signal modules.

class tests.test_gp_signals.TestGPSignals(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_combine_signals()[source]

Test for combining different signals.

test_ecorr()[source]

Test that ecorr signal returns correct values.

test_ecorr_backend()[source]

Test that ecorr-backend signal returns correct values.

test_fourier_red_noise()[source]

Test that red noise signal returns correct values.

test_fourier_red_noise_backend()[source]

Test that red noise-backend signal returns correct values.

test_fourier_red_noise_pshift()[source]

Test that red noise signal returns correct values.

test_fourier_red_user_freq_array()[source]

Test that red noise signal returns correct values with user defined frequency array.

test_gp_parameter()[source]

Test GP basis model with parameterized basis.

test_gp_timing_model()[source]

Test that the timing model signal returns correct values.

test_kernel()[source]
test_kernel_backend()[source]
test_pshift_fourier()[source]

Test Fourier basis with prescribed phase shifts.

test_red_noise_add()[source]

Test that red noise addition only returns independent columns.

test_red_noise_add_backend()[source]

Test that red noise with backend addition only returns independent columns.

class tests.test_gp_signals.TestGPSignalsPint(methodName='runTest')[source]

Bases: TestGPSignals

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

tests.test_gp_signals.create_quant_matrix(toas, dt=1)[source]
tests.test_gp_signals.se_kernel(etoas, log10_sigma=-7, log10_lam=6.413634997198556)[source]

tests.test_gp_wideband module

test_gp_wideband

Tests for WidebandTimingModel.

class tests.test_gp_wideband.TestGPSignalsPint(methodName='runTest')[source]

Bases: TestWidebandTimingModel

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_wideband()[source]
class tests.test_gp_wideband.TestWidebandTimingModel(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_wideband()[source]

tests.test_hierarchical_parameter module

test_hierarchical_parameter

Tests for hierarchical parameter functionality

class tests.test_hierarchical_parameter.TestHierarchicalParameter(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_Function_of_Function()[source]
test_enterprise_Function()[source]
test_enterprise_Parameter()[source]
test_powerlaw()[source]
test_powerlaw_equad()[source]

tests.test_likelihood module

test_likelihood

Tests of likelihood module

class tests.test_likelihood.TestLikelihood(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

compute_like(npsrs=1, inc_corr=False, inc_kernel=False, cholesky_sparse=True, marginalizing_tm=False)[source]
classmethod setUpClass()[source]

Setup the Pulsar object.

test_compare_ecorr_likelihood()[source]

Compare basis and kernel ecorr methods.

test_like_corr()[source]

Test likelihood with spatial correlations.

test_like_corr_kernel()[source]

Test likelihood with spatial correlations and kernel.

test_like_corr_one_kernel()[source]

Test likelihood with spatial correlations and one kernel.

test_like_nocorr()[source]

Test likelihood with no spatial correlations.

test_like_nocorr_kernel()[source]

Test likelihood with no spatial correlations and kernel.

test_like_nocorr_one_kernel()[source]

Test likelihood with no spatial correlations and one kernel.

class tests.test_likelihood.TestLikelihoodPint(methodName='runTest')[source]

Bases: TestLikelihood

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

tests.test_likelihood.create_quant_matrix(toas, dt=1)[source]
tests.test_likelihood.get_noise_from_pal2(noisefile)[source]
tests.test_likelihood.se_kernel(etoas, log10_sigma=-7, log10_lam=6.413634997198556)[source]

tests.test_parameter module

test_parameter

Tests Uniform and Normal parameter priors and sampling functions

class tests.test_parameter.TestParameter(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_linearexp()[source]

Test LinearExp parameter prior and sampler.

test_metaparam()[source]
test_normal()[source]

Test Normal parameter prior and sampler for various combinations of scalar and vector arguments.

test_normalandtruncnormal()[source]
test_truncnormal()[source]

Test TruncNormal parameter prior and sampler for various combinations of scalar and vector arguments.

test_uniform()[source]

Test Uniform parameter prior and sampler for various combinations of scalar and vector arguments.

tests.test_pta module

test_pta

Tests for common signal and PTA class modules.

class tests.test_pta.TestPTASignals(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_parameterized_orf()[source]
test_pta_phi()[source]
test_pta_phiinv_methods()[source]
test_summary()[source]

Test PTA summary table as well as its str representation and dict-like interface.

class tests.test_pta.TestPTASignalsPint(methodName='runTest')[source]

Bases: TestPTASignals

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

tests.test_pta.hd_orf_generic(pos1, pos2, a=1.5, b=0.25, c=0.25)[source]
tests.test_pta.hd_powerlaw(f, pos1, pos2, log10_A=-15, gamma=4.3)[source]

tests.test_pulsar module

tests.test_selections module

test_pulsar

Tests for signals/selections module.

class tests.test_selections.TestSelections(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_selections()[source]
class tests.test_selections.TestSelectionsPint(methodName='runTest')[source]

Bases: TestSelections

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

tests.test_set_parameter module

test_set_parameter

Tests of setting constant parameters

class tests.test_set_parameter.TestSetParameters(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_pta()[source]
test_single_pulsar()[source]
class tests.test_set_parameter.TestSetParametersPint(methodName='runTest')[source]

Bases: TestSetParameters

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

tests.test_set_parameter.get_noise_from_pal2(noisefile)[source]

tests.test_utils module

test_utils

Tests for utils module.

class tests.test_utils.TestUtils(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_createfourierdesignmatrix_dm(nf=30)[source]

Check DM-variation Fourier design matrix shape.

test_createfourierdesignmatrix_ephem(nf=30)[source]

Check x-axis ephemeris Fourier design matrix shape.

test_createfourierdesignmatrix_red(nf=30)[source]

Check Fourier design matrix shape.

test_createstabletimingdesignmatrix()[source]

Timing model design matrix shape.

test_ecc_cw_waveform()[source]

Check eccentric wafeform generation.

test_fplus_fcross()[source]

Check fplus, fcross generation.

test_numerical_ecc_integration()[source]

Test numerical integration of eccentric GW.

test_orf()[source]

Test ORF functions.

test_psd()[source]

Test PSD functions.

test_quantization_matrix()[source]

Test quantization matrix generation.

tests.test_vector_parameter module

test_vector_parameter

Tests for vector parameter functionality

class tests.test_vector_parameter.TestVectorParameter(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_phi()[source]

Test vector parameter on signal level.

test_vector_parameter_like()[source]

Test vector parameter in a likelihood

class tests.test_vector_parameter.TestVectorParameterPint(methodName='runTest')[source]

Bases: TestVectorParameter

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

tests.test_vector_parameter.free_spectrum(f, log10_rho=None)[source]

tests.test_white_signals module

test_white_signals

Tests for white signal modules.

class tests.test_white_signals.TestWhiteSignals(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

test_add_efac_tnequad()[source]

Test that addition of efac and tnequad signal returns correct covariance.

test_add_efac_tnequad_backend()[source]

Test that addition of efac-backend and tnequad-backend signal returns correct covariance.

test_ecorr_block()[source]

Test of block matrix ecorr signal and solve methods.

test_ecorr_block_ipta()[source]

Test of block matrix ecorr signal and solve methods.

test_ecorr_sherman_morrison()[source]

Test of sherman-morrison ecorr signal and solve methods.

test_ecorr_sherman_morrison_ipta()[source]

Test of sherman-morrison ecorr signal and solve methods.

test_ecorr_sparse()[source]

Test of sparse ecorr signal and solve methods.

test_ecorr_sparse_ipta()[source]

Test of sparse ecorr signal and solve methods.

test_efac()[source]

Test that efac signal returns correct covariance.

test_efac_backend()[source]

Test that backend-efac signal returns correct covariance.

test_efac_equad_combined_backend()[source]

Test that the combined EFAC + EQUAD noise (tempo/tempo2/pint definition) returns the correct covariance.

test_equad()[source]

Test that the deprecated EquadNoise is not available.

test_tnequad()[source]

Test that tnequad signal returns correct covariance.

test_tnequad_backend()[source]

Test that backend-equad signal returns correct covariance.

class tests.test_white_signals.TestWhiteSignalsPint(methodName='runTest')[source]

Bases: TestWhiteSignals

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup the Pulsar object.

class tests.test_white_signals.Woodbury(N, U, J)[source]

Bases: object

logdet()[source]
solve(other)[source]