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

Problem in ensemble.py? #107

Closed
cecgresonant opened this issue Jan 20, 2020 · 6 comments
Closed

Problem in ensemble.py? #107

cecgresonant opened this issue Jan 20, 2020 · 6 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@cecgresonant
Copy link

cecgresonant commented Jan 20, 2020

I tested the Ensemble class for my 186W matrix, and it worked nicely for 10 perturbed members as in the documentation example. However, when I tried 100 perturbed members I got the following error at the end, after a seemingly successful generation of 100 perturbed matrices:

[...]
2020-01-18 11:40:11,703 - ompy.ensemble - INFO - Generating 97
 96%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋     | 96/100 [02:30<00:05,  1.47s/it]2020-01-18 11:40:12,850 - ompy.ensemble - INFO - Generating 98
 97%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████    | 97/100 [02:32<00:05,  1.72s/it]2020-01-18 11:40:15,166 - ompy.ensemble - INFO - Generating 99
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [02:36<00:00,  1.56s/it]
Traceback (most recent call last):
  File "ompy_186W_script.py", line 115, in <module>
    ensemble.generate(100, regenerate=True)
  File "/Applications/ompy/ompy/ensemble.py", line 230, in generate
    raw_ensemble = ensembles[:, 0, :, :]
IndexError: too many indices for array

Is this a bug in ensemble.py? I attach the python script and my input raw matrix as .txt files.
alfna_recal_cutd_comp.txt

ompy_186W_script.txt

@cecgresonant cecgresonant added the question Further information is requested label Jan 20, 2020
@fzeiser fzeiser self-assigned this Jan 20, 2020
@fzeiser
Copy link
Collaborator

fzeiser commented Jan 20, 2020

I'll look at it tonight

@fzeiser fzeiser added the bug Something isn't working label Jan 20, 2020
@fzeiser
Copy link
Collaborator

fzeiser commented Jan 20, 2020

I'll have to look at the exact problem later. For now, if you want to work with the matrices, introduce a "reasonable" cut, eg.

raw.cut('Ex', 0, 10000)
raw.cut('Eg', 0, 10000)

This will speedup the calculations, too.

@fzeiser
Copy link
Collaborator

fzeiser commented Jan 20, 2020

When I run it with 10 without the modificaiton above, it doesn't work either.

@cecgresonant
Copy link
Author

cecgresonant commented Jan 20, 2020

Thanks for looking into this, Fabio! :)

When I run it with 10 without the modificaiton above, it doesn't work either.

Now I reproduce this as well. Probably I had the cuts the first time I ran with 10 iterations.
It is probably reasonable to include the cuts, but maybe it would be good to warn the user that without them the numpy arrays go a bit crazy?

I found this thread:
https://stackoverflow.com/questions/28036812/indexerror-too-many-indices-for-array
Maybe it's relevant - I am too much of a Python noob to know...

@fzeiser
Copy link
Collaborator

fzeiser commented Jan 20, 2020

Well, as I said, I'll come up with a fix for it later 😄.

@fzeiser
Copy link
Collaborator

fzeiser commented Jan 20, 2020

I think it's negative Ex that it doesn't like, but I'll come back with a more elaborate solution later. So the important part is the lower cuts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants