Skip to content

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

@sebvetter

Description

@sebvetter

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions