<jupyter_start><jupyter_text>Jump proposal from Jeff<jupyter_code>class my_jump_proposal(model_utils.JumpProposal):
    def __init__(self,pta):
        super().__init__(pta)

    def draw_from_gw_prior(self, x, iter, beta):

        q = x.copy()
        lqxy = 0

        param_name = 'zlog10_A_gw'

        # draw parameter from signal model
        print(self.pnames)
        param = self.pnames[param_name]
        print('Here: ' + param)
        if param.size:
            idx2 = np.random.randint(0, param.size)
            q[self.pmap[str(param)]][idx2] = param.sample()[idx2]

        # scalar parameter
        else:
            q[self.pmap[str(param)]] = param.sample()

        # forward-backward jump probability
        lqxy = (param.get_logpdf(x[self.pmap[str(param)]]) -
                param.get_logpdf(q[self.pmap[str(param)]]))

        return q, float(lqxy)
    def draw_from_other_gw_prior(self, x, iter, beta):

        q = x.copy()
        lqxy = 0

        param_name = 'zlog10_A_other_gw'

        # draw parameter from signal model
        param = self.pnames[param_name]
        if param.size:
            idx2 = np.random.randint(0, param.size)
            q[self.pmap[str(param)]][idx2] = param.sample()[idx2]

        # scalar parameter
        else:
            q[self.pmap[str(param)]] = param.sample()

        # forward-backward jump probability
        lqxy = (param.get_logpdf(x[self.pmap[str(param)]]) -
                param.get_logpdf(q[self.pmap[str(param)]]))

        return q, float(lqxy)
#define your JP here
jp = model_utils.JumpProposal(pta)
#jp = my_jump_proposal(pta)

sampler.addProposalToCycle(jp.draw_from_prior, 15)
sampler.addProposalToCycle(jp.draw_from_red_prior, 15)
#sampler.addProposalToCycle(jp.draw_from_gw_prior, 15)
#sampler.addProposalToCycle(jp.draw_from_other_gw_prior, 15)
# sampler for N steps
N = int(1e5)
x0 = np.hstack(p.sample() for p in pta.params)
sampler.sample(x0, N, SCAMweight=30, AMweight=15, DEweight=50)<jupyter_output>/home/akaiser/.conda/envs/enterprise_dev36/lib/python3.6/site-packages/ipykernel_launcher.py:3: FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.
  This is separate from the ipykernel package so we can avoid doing imports until
{'fraction_non_alphanumeric': 0.11515912897822446, 'fraction_numerical': 0.01675041876046901, 'mean_word_length': 2.9750415973377704, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '24047', 'license': 'MIT', 'n_tokens_mistral': 887, 'n_tokens_neox': 830, 'n_words': 173, 'path': 'BackgroundInjections/SimInject1/.ipynb_checkpoints/BackgroundInjectionsV2-checkpoint.ipynb', 'repo_name': 'ark0015/NANOGrav', 'size': '2388'}