marcoviero / simstack3

Updated SIMSTACK, compatible with python 3
GNU General Public License v3.0
2 stars 1 forks source link

Error using simstack #7

Open lecorrige opened 7 months ago

lecorrige commented 7 months ago

Hello,

I tried using Simstack and ran into an error when trying to parse the results of the test data. The stacking was successful but I can't figure out how to extract the data from the pickle. I used the code from the notebook to estimate and save values and here was the error:

(simstack) C:\Users\stani\OneDrive\Bureau\Universite\3rd_year_project\stack\simstack3main>python estimate_and_save_values.py

15000-3000-3sigma_mixed_prior C:\Users\stani\OneDrive\Bureau\Universite\3rd_year_project\stack\simstack3main\pickles\test_stack_nuvrj_1_1p5_2_2p5_3_4p0_X_4_foregnd_atonce_bootstrap_1-5 Traceback (most recent call last): File "C:\Users\stani\OneDrive\Bureau\Universite\3rd_year_project\stack\simstack3main\estimate_and_save_values.py", line 52, in simstack_object.parse_results(catalog_object=simstack_catalog_object, estimate_mcmcs=False) File "C:\Users\stani\OneDrive\Bureau\Universite\3rd_year_project\stack\simstack3main\simstackresults.py", line 28, in parse_results self.results_dict['bootstrap_results_dict'] = self.populate_results_dict() File "C:\Users\stani\OneDrive\Bureau\Universite\3rd_year_project\stack\simstack3main\simstackresults.py", line 462, in populate_results_dict sf_sed_array[:, iwv, :] = boot_dict[wv][:, :, :, 1] IndexError: too many indices for array: array is 3-dimensional, but 4 were indexed Thanks in advance!
marcoviero commented 7 months ago

Hi. I don't really know, but this could be because you are only stacking at one wavelength. Is that the case?

lecorrige commented 7 months ago

Hi, Thanks for your response! I am stacking in PSW and PMW. The dataset used is the one provided in github to test the program. I don't understand why the parse_results function would lead to an error since it takes in input the pickle provided by simstack. It may be the way I configured the documents but I don't think it is since the stacking was successful. Do you have any idea of what it could be? Thanks in advance!

marcoviero commented 6 months ago

The indices have always been a headache, so I'm not surprised. I would put a pdb.set_trace() where you are finding the problem (line 462?) and np.shape(boot_dict). It might be that removing one of the : works. It might be better to recast how data is stored completely, but that's a big job (I will try to do it eventually).

lecorrige commented 6 months ago

I first tried removing the : and I get another error message being:

ValueError: could not broadcast input array from shape (5,5) into shape (5,5,4)

I also tried what you advise me to do with pdb.set_trace() and I don't understand why boot_dict is full of zeros.

**(Pdb) np.shape(boot_dict) () (Pdb) boot_dict {250.0: array([[[0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.]],

   [[0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.]],

   [[0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.]],

   [[0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.]],

   [[0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.]],

   [[0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.]],

   [[0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.]],

   [[0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.]],

   [[0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.],
    [0., 0., 0., 0.]]])}**

Thank you!