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

Using asteria.neutrino.Flavor enum items as hashes in source.py can causes odd errors #51

Closed
sgriswol opened this issue Jul 1, 2020 · 1 comment
Assignees

Comments

@sgriswol
Copy link
Collaborator

sgriswol commented Jul 1, 2020

The dictionary containing the SciPy interpolation objects in source.py (Link to definition uses the enumeration items of asteria.neutrino.Flavor as keys. More specifically, it uses the object location of those enumeration items as part of those keys.

When the upcoming SimulationHandler parses the simulation flavor configuration, it creates and stores its own instances of <enum 'Flavor'> objects. So, when comparing the instances created by the handler to those used to define the source objects, the equality operator returns false, due to the fact that their location is not the same. According to the Python dict documentation, only hashable (fixed) values should be used as keys. The name and value members of the flavor enumeration items are suitable for this, but in order to use these, the __hash__ and __eq__ methods must be overwritten.

It is not sufficient to only change the keys used to define the dictionaries mentioned above. The attached figures show the expected DOM signal (top), and the DOM signal having changed only the definition of the dictionary keys to use the flavor names (bottom). The cause of this difference is not yet understood.

Expected DOM Signal.
flavorhashing_noerror

DOM Signal having changed only key definitions in source.py
flavorhashing_error

@sgriswol sgriswol self-assigned this Jul 1, 2020
@sgriswol
Copy link
Collaborator Author

sgriswol commented Jul 1, 2020

Resolved by commit d5d8bda, I messed up the issue reference when I made it....

@sgriswol sgriswol closed this as completed Jul 1, 2020
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

1 participant