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

Issue: IndexError: index 12 is out of bounds for axis 0 with size 12 #375

Open
yanzhij opened this issue May 29, 2024 · 3 comments
Open

Comments

@yanzhij
Copy link

yanzhij commented May 29, 2024

Hi everyone,
I encountered a problem while using MontePython, and received the following error message during runtime:

File "/home/cosmology/jwst_hst/montepython_public-3.6/montepython/mcmc.py", line 149, in get_new_position
sigmas[j+Previous] = (math.sqrt(1./Range)) *
IndexError: index 12 is out of bounds for axis 0 with size 12

I also reviewed my input data, but couldn't find any issues related to index out of bounds.

@brinckmann
Copy link
Owner

Hi,

Can you copy your param file?

Best,
Thejs

@yanzhij
Copy link
Author

yanzhij commented Jun 2, 2024

Hi,
Thank you,This is my param file
‘’‘
data.experiments=['four_par_UVLF_HST_ST_model1', 'Pantheon']

data.over_sampling=[1, 3, 1]

data.parameters['sigma8'] = [0.8120, 0.1, 3., 0.3, 1, 'cosmo']
#data.parameters['omega_m'] = [0.1432, 0., 1., 0.02, 1, 'cosmo']
#data.parameters['omega_b'] = [2.236, 0., None, 0.5, 0.01, 'cosmo']
#data.parameters['n_s'] = [0.9649, 0.7, 1.3, 0.2, 1, 'cosmo']

data.parameters['alphastar'] = [-6.499906e-01, -3., 0, 0.2, 1, 'nuisance']
data.parameters['betastar'] = [5.830253e-01, 0., 3., 0.1, 1, 'nuisance']
data.parameters['epsilonstar_slope'] = [-1.250277e+00, -3., 3., 0.1, 1, 'nuisance']
data.parameters['epsilonstar_icept'] = [-2.065852e+00, -3., 3., 0.1, 1, 'nuisance']
data.parameters['Mc_slope'] = [1.241402e+00, -3., 3., 0.1, 1, 'nuisance']
data.parameters['Mc_icept'] = [1.191313e+01, 7., 15., 0.5, 1, 'nuisance']
data.parameters['sigma_MUV'] = [1.149963e-02, 0.001, 3., 0.1, 1, 'nuisance']
data.parameters['Q'] = [2.089035e+00, 1.5, 2.5, 0.1, 1, 'nuisance']
data.parameters['M'] = [-1.943457e+01, None, None, 0.05, 1, 'nuisance']
data.parameters['A_star_bump'] = [1, 0,10, 1,1,'nuisance']
data.parameters['ln_k_star_bump'] = [0.5, -0.6, 1, 0.1, 1,'nuisance']

#data.parameters['h'] = [0.7, None, None, 0, 1, 'derived']
#data.parameters['Omega_m'] = [0.3, None, None, 0, 1, 'derived']

data.cosmo_arguments['100*theta_s'] = 1.04110
data.cosmo_arguments['tau_reio'] = 0.0544
data.cosmo_arguments['k_pivot'] = 0.05
data.cosmo_arguments['output'] = 'mPk'
data.cosmo_arguments['P_k_max_1/Mpc'] = 11000.
data.cosmo_arguments['z_max_pk'] = 15.

data.cosmo_arguments['m_ncdm'] = 0.06
data.cosmo_arguments['N_ur'] = 2.0308
data.cosmo_arguments['N_ncdm'] = 1
data.cosmo_arguments['T_ncdm'] = 0.71611

data.N=5000
data.write_step=1

’‘’

@brinckmann
Copy link
Owner

Hi,

I agree this is odd. I don't see any problems with the param file. I was "hoping" you'd have a line with a comment at the end of it, which isn't allowed and prompts this kind of error, but that's not the case. I see you have 12 varying parameters (1 cosmo and 11 nuisance) and for some reason it tries to go to parameter 13 (index 12).

Trying to brainstorm, a couple of questions come to mind:

  • Are your nuisance parameters ordered as the list in likelihoods? I.e. all parameters related to HST first then all parameters related to Pantheon after.
  • Also, are you being careful to start in a new directory with a new log.param generated by MontePython without edits every time you change your param file?
  • Can you try to set oversampling to [1,3,3] ? I forget if the 1 at the end is OK or if it can cause problems.
  • You're using the 'fast' sampling/jumping method (default), you could try to go to the relevant part of montepython/mcmc.py , which is after line 128, and print some parts to get a handle on what's going wrong. If I remember correctly maybe printing the variables data.block_parameters and data.mcmc_parameters or parameter_names could be useful. Also the variables j and Previous. I suggest printing between line 148 and 149, since line 149 is causing the crash when j+Previous = 12 (so the 13th index) and the size of sigmas is 12.

I hope some of this helps.

Best,
Thejs

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

No branches or pull requests

2 participants