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

Changing gain model in st.config raises errors at peaklet level #1533

Open
sebvetter opened this issue Jan 21, 2025 · 0 comments
Open

Changing gain model in st.config raises errors at peaklet level #1533

sebvetter opened this issue Jan 21, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@sebvetter
Copy link

Describe the bug
When changing the gain model in the st.config to a numpy array, you get an error that arrays are not JSON seriazable. When changing this array to a list you get an indexing error, since lists can not be indexed by arrays.

To Reproduce
Insert the MWE of how to reproduce the error

gains = straxen.URLConfig.evaluate_dry(st.config['gain_model'])
median_top_gain = np.median(gains[:253])
gains_all_pmts_on = np.where(gains == 0, median_top_gain, gains)
st.set_config(dict(gain_model=gains_all_pmts_on))

Supposed fix / workaround
Changing the way we load the gain model here to self.to_pe = np.array(self.gain_model) works. We could also make a type check beforehand.

@sebvetter sebvetter added the bug Something isn't working label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant