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

Not all float fields should be set to nan by default #1026

Open
terliuk opened this issue Apr 21, 2022 · 2 comments
Open

Not all float fields should be set to nan by default #1026

terliuk opened this issue Apr 21, 2022 · 2 comments

Comments

@terliuk
Copy link
Contributor

terliuk commented Apr 21, 2022

When we compute event_basics, we set all defaults to nan and then overwrite it in processing. In most cases this makes sense, however, it creates issues sometimes. For example, if we have alt_s1 or alt_s2 area as nan, it means that alternatives do not exist and should have area of 0. This might be relevant for some of cut applications or event selection, when no explicit requirement for (non) existence of alternatives is made.

def set_nan_defaults(buffer):
"""
When constructing the dtype, take extra care to set values to
np.Nan / -1 (for ints) as 0 might have a meaning
"""
for field in buffer.dtype.names:
if np.issubdtype(buffer.dtype[field], np.integer):
buffer[field][:] = -1
else:
buffer[field][:] = np.nan

@JoranAngevaare
Copy link
Contributor

JoranAngevaare commented Apr 21, 2022

@terliuk this comes up every now and than indeed. It's a question of somehow choosing the defaults such that people don't by accident make wrong selections. This is a very non-trivial question because people will all do something different and/or might not check their data-format properly.

What would you argue makes most sense from your point of view?

@terliuk
Copy link
Contributor Author

terliuk commented Apr 21, 2022

my suggestion would be to use "common sense" (or "physical reality", whatever we name it) for it, so for areas of alternatives we should set 0, for parameters characterizing those non-existing peaks - nans, index -1 etc.

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