Skip to content

Make bin_signal compatible with 1d-array - #1674

Merged
ykyohei merged 8 commits into
masterfrom
bin
Aug 12, 2026
Merged

Make bin_signal compatible with 1d-array#1674
ykyohei merged 8 commits into
masterfrom
bin

Conversation

@ykyohei

@ykyohei ykyohei commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This is for binning 1d-array such as thermometer data to az.
This doesn't affect binning of 2d array.

There was an issue where, when the range was narrower than the bin_by value, the edge bins returned the wrong value due to np.digitize and np.clip.
This PR also fixes this issue. This error should not impact most analyses.

Added unit test for binning.

@ykyohei
ykyohei requested a review from msilvafe June 23, 2026 13:33

@msilvafe msilvafe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Couple inline comments, feel free to push back/reply/resolve any and hit re-review when ready. I'll be fast next time around (I think)!

Comment thread sotodlib/tod_ops/binning.py
Comment thread sotodlib/tod_ops/binning.py Outdated
Comment thread sotodlib/tod_ops/binning.py Outdated
Comment thread sotodlib/tod_ops/binning.py

@ykyohei ykyohei left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made suggested changes, thanks for the review.

Additionally, I modified bin_signal to accept arbitrary samps length of signal array. This won't affect previous bahavior and helpful for binning house keeping data which has different sampling rate from detector's data. Test for this new feature is also added test_400_arbitrary_length_of_signal

In addition to the unit test, tested this with real data and confirmed that this reproduces exact same results, when range is wide enough.

@ykyohei
ykyohei requested a review from msilvafe August 12, 2026 20:31

@msilvafe msilvafe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Alright, thanks for addressing all of my previous comments. I'm approving but left a few inline comments which you can take-or-leave before merge.

Comment thread sotodlib/tod_ops/binning.py Outdated
Comment thread sotodlib/tod_ops/binning.py Outdated
Comment thread sotodlib/tod_ops/binning.py Outdated
@ykyohei
ykyohei merged commit eb8919a into master Aug 12, 2026
5 checks passed
@ykyohei
ykyohei deleted the bin branch August 12, 2026 22:30
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.

2 participants