XENONnT / straxen

Streaming analysis for XENON
BSD 3-Clause "New" or "Revised" License
21 stars 32 forks source link

Use `straxen.EventBasics.set_nan_defaults` to set default values #1317

Closed dachengx closed 7 months ago

dachengx commented 7 months ago

What does the code in this PR do / what does it improve?

With the old code and numpy==1.26.3, we will see error like:

FAILED tests/plugins/test_plugins.py::PluginTest::test_event_ms_naive - ValueError: cannot convert float NaN to integer

This is due to https://github.com/XENONnT/straxen/blob/2c48b773a56f446d0f46bb42e664a918a5620b99/straxen/plugins/peaks/peak_per_event.py#L33 is not compatible anymore with the new numpy when there is int in result.

So this PR use straxen.EventBasics.set_nan_defaults to set the default value of result.

Can you briefly describe how it works?

Can you give a minimal working example (or illustrate with a figure)?

coveralls commented 7 months ago

Coverage Status

coverage: 92.445% (+0.05%) from 92.397% when pulling 3c2c6fc0c93c03d3af843b922055617fbb7d250f on np_fix_new into 16caa01f84a5e3c0f907bb34f16cfcf242f92e3f on master.

WenzDaniel commented 7 months ago

Thanks for the quick update.