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

#35 adding general and simplified jump proposal draws #37

Merged
merged 2 commits into from
Dec 18, 2019

Conversation

siyuan-chen
Copy link
Contributor

@siyuan-chen siyuan-chen commented Dec 16, 2019

Hi all,
regarding issue #35
I have added 3 functions to JumpProposal in model_utils.py(v1.0, there is a bug) / sampler.py(v2.0) to allow for a more flexible user-specified jump proposal draw. In theory those three functions could be even more generalized and can be used to replace most of the existing jump proposal draws in model_utils. The error handling could also be done better. But, it seems to work for me and I will write some instructions below.
draw_from_par_prior: allows the user to specify a list of parameters that should be jumped by drawing from the prior.
draw_from_par_log_uniform: allows the user to specify a dictionary of parameters that should be jumped by drawing from the given log uniform distribution.
draw_from_signal: allows the user to specify a list of signals that should be jumped by drawing from the signal prior.

Let me know if there is any issues. Hopefully, this is useful for people.

Tutorial code:
custom_par_list1 = ['gw_log10_A']
custom_par_list2 = ['jup_orb_elements_0','gw_log10_A']
custom_par_log_dict1 = {'gw_log10_A' : (-18,-11)}
custom_par_log_dict2 = {'J1713+0747_red_noise_log10_A' : (-20,-10)
,'gw_log10_A' : (-18,-11)}
custom_signal_list = ['red noise','dm_gp']
jp = model_utils.JumpProposal(pta)
sampler.addProposalToCycle(jp.draw_from_par_prior(custom_par_list1),15)
sampler.addProposalToCycle(jp.draw_from_par_prior(custom_par_list2),15)
sampler.addProposalToCycle(jp.draw_from_par_log_uniform(custom_par_log_dict1),15)
sampler.addProposalToCycle(jp.draw_from_par_log_uniform(custom_par_log_dict2),15)
sampler.addProposalToCycle(jp.draw_from_signal(custom_signal_list),15)

By the number of lines:

  1. add a prior draw for gw_log10_A every 15 iterations
  2. randomly choose between gw_log10_A and jup_orb_elements_0 and then add a prior draw every 15 iterations
  3. add a draw from a uniform distribution for gw_log10_A between -18 and -11 every 15 iterations
  4. randomly choose between gw_log10_A and J1713+0747_log10_A and then add a uniform distribution draw between -18, -11 for gw and -20,-10 for J1713 every 15 iterations
  5. randomly choose between red_noise and dm_gp and then add a draw from the prior for the corresponding signal every 15 iterations.

@stevertaylor stevertaylor merged commit 4ce5065 into nanograv:master Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants