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

Add some basic cuts #84

Merged
merged 3 commits into from Aug 31, 2018
Merged

Add some basic cuts #84

merged 3 commits into from Aug 31, 2018

Conversation

coderdj
Copy link
Contributor

@coderdj coderdj commented Aug 29, 2018

This is an attempt to add a few basic cuts to strax. Cuts added are the 1.3T FV cylinder, S1MaxPMT, and S1 low energy. They should be direct ports from lax/sciencerun0.

This also adds the max pmt value to peak_basics, previously only the max pmt index had been stored per peak.

(all the changes are within strax/xenon)

@coderdj coderdj changed the title Cuts pr Add some basic cuts Aug 29, 2018
Copy link
Member

@JelleAalbers JelleAalbers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

It would be good to factor out a basic cut base class and use that for these example cuts, but we can do that after this is merged.

dtype = [('cut_s1_low_energy_range', np.bool, "Event under 200pe")]

def compute(self, events):
ret = np.all([events['cs1'] < 200], axis=0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need np.all here? I'm not sure what happens now, sounds like you're computing one boolean per chunk. I would have thought you'd just do ret = events['cs1'] < 200

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, the extra []'s make a new axis, and you're all-ing over that axis which has one element here (so it's not needed here), but above you use it as a way of combining event selections.

OK, I usually use the & sign for this, e.g. (cs1 > 70) & (r < 20) % ... .

@JelleAalbers
Copy link
Member

Just ignore Codacy's comments: it doesn't seem to understand the flexible signature of the compute method.

@coderdj
Copy link
Contributor Author

coderdj commented Aug 30, 2018

Sympy is complaining about overloading compute with (self, events), for example, since the base function isn't defined like this. But I think this is how all the plugins have been done so far, right?

(should hit refresh before commenting)

@JelleAalbers JelleAalbers merged commit e7743ec into AxFoundation:master Aug 31, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants