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 select index to compute width #465

Merged
merged 3 commits into from Jun 12, 2021

Conversation

zhut19
Copy link
Contributor

@zhut19 zhut19 commented Jun 8, 2021

What is the problem / what does the code in this PR do

After reconstructing peaklets with saturation correction, we need to update the widths for selected peaklets. For this purpose, I propose to add a select_peaks_indicies key to the compute width function.

I couldn't find a way to do this without changing this function in strax because numpy structured array assignment is a bit tricky i.e.
arr[index]['x'] = new_values will not update the values
arr['x'][index] = new_values will update the values

@zhut19 zhut19 marked this pull request as ready for review June 8, 2021 22:20
@skazama
Copy link

skazama commented Jun 11, 2021

Hi Tianyu, thanks for the PR. I just had a look at the code and looks fine (only changes for peaks with saturated channels).
@jorana I think this can be ok, but can you please check it too as this PR should be included for the reprocessing campaign.

Copy link
Member

@JoranAngevaare JoranAngevaare left a comment

Choose a reason for hiding this comment

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

Thanks @zhut19 I think it looks good, just one request:

@@ -68,12 +68,18 @@ def compute_index_of_fraction(peak, fractions_desired, result):


@export
def compute_widths(peaks):
def compute_widths(peaks, select_peaks_indices=None):
"""Compute widths in ns at desired area fractions for peaks
Copy link
Member

Choose a reason for hiding this comment

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

could you update the dosctring to include the select_peaks_indices and what None means?

@JoranAngevaare JoranAngevaare merged commit bb23f8a into AxFoundation:master Jun 12, 2021
@zhut19 zhut19 deleted the sat_width_patch branch August 27, 2021 20:19
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

3 participants