#35 adding general and simplified jump proposal draws #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi all,
regarding issue #35
I have added 3 functions to
JumpProposal
inmodel_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 inmodel_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: