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

fix flip boolean bug in pulse_processing #266

Merged
merged 3 commits into from Jun 15, 2020

Conversation

sophiafarrell
Copy link
Contributor

@sophiafarrell sophiafarrell commented May 20, 2020

An address to this issue: #265

Replaced (-1*flip) with np.where(flip, -1, 1) to fix flip=False bug in records flipping.
using np.where with flip as boolean, will return -1 if flip=True, else returns 1.
Previously boolean meant if flip=False d['data'] will go to 0.

Also I believe that calculating

samples_per_record = len(records[0]['data'])

in baseline computation is unnecessary.

using np.where with flip as boolean, will return -1 if flip=True, else returns 1. 
Previously boolean meant if flip=False d['data'] will go to 0.
unnecessary calculation step, it's not called again in the function. We use it later after calling it later as well.
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.

Thanks for spotting Sophia! Setting all data to zero is not so good. I guess (-1 if flip else 1) or even (1 - 2 * flip) would work too in place of np.where, but up to you.

@sophiafarrell
Copy link
Contributor Author

Yes, I like (-1 if flip else 1) the most, much simpler for people. I will edit it for that and thanks for the more elegant suggestion.

@JelleAalbers JelleAalbers merged commit 8af8e92 into AxFoundation:master Jun 15, 2020
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