Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dm nondiag test #114

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,81 @@ def test_model_singlepsr_noise_dip_cusp(nodmx_psrs,caplog):
x0 = {pname:p.sample() for pname,p in zip(m.param_names, m.params)}
m.get_lnlikelihood(x0)

def test_model_singlepsr_noise_dm_nondiag(nodmx_psrs,caplog):
paulthebaker marked this conversation as resolved.
Show resolved Hide resolved
# caplog.set_level(logging.CRITICAL)
mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_nondiag_kernel ='dmx_like')
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)

mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_nondiag_kernel ='sq_exp')
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)

mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_nondiag_kernel ='sq_exp_rfband')
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)

mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_nondiag_kernel ='periodic')
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)

mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_nondiag_kernel ='periodic_rfband')
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)

mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_nondiag_kernel ='None')
paulthebaker marked this conversation as resolved.
Show resolved Hide resolved
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)

def test_model_singlepsr_noise_dm_diag(nodmx_psrs,caplog):
# caplog.set_level(logging.CRITICAL)
mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_psd ='powerlaw')
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)

mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_psd ='turnover')
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)

mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_psd ='tprocess')
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)

mn=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
dm_type='gp', dmgp_kernel ='diag',
dm_psd ='tprocess_adapt')
assert hasattr(mn,'get_lnlikelihood')
x0 = {pname:p.sample() for pname,p in zip(mn.param_names, mn.params)}
mn.get_lnlikelihood(x0)


def test_model_singlepsr_noise_chrom_nondiag(nodmx_psrs,caplog):
# caplog.set_level(logging.CRITICAL)
m=models.model_singlepsr_noise(nodmx_psrs[1], dm_var=True,
Expand Down