Changed local median signal calculation to global median#1630
Open
ttsan2521 wants to merge 1 commit into
Open
Conversation
keskitalo
approved these changes
May 9, 2026
| from toast.timing import function_timer, Timer | ||
| from toast.traits import Bool, Int, Unicode, trait_docs | ||
| from toast.utils import Environment, Logger, unit_conversion | ||
| from toast.mpi import MPI #added this import- Tran |
Member
There was a problem hiding this comment.
We can leave out the comment here. If we need to figure out who added which line, there is always git blame.
| ## Calculate a global median | ||
| local_good = signal[row][good] | ||
| if obs.comm.comm_group is not None: | ||
| all_good = obs.comm.comm_group.gather(local_good, root=0) |
Member
There was a problem hiding this comment.
This gets the job done but can be slow if there are lots of detectors and processes. It would be more expedient to compute and store the medians in the beginning of exec() before the data are redistributed.
Since I am not running this operator myself, I leave it up to Tran and Toby to decide if they want to develop the more efficient computation.
| # Propagate flags | ||
| obs.detdata[self.det_flags][det] |= temp_obs.detdata[self.det_flags][det] | ||
|
|
||
|
|
Member
There was a problem hiding this comment.
Looks like an extra line change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In sim_mumux_crosstalk.py, changed the local median signal calculation when evaluating dPhi0/dT to a global median calculation. In the original script, it calculates the median of the input signal after an MPI distribution, which put all the detectors into bins or ranks where each rank has a subset of the sample. So all the detectors inside a rank only see a portion of the scan, and the calculated median within each rank may differ from rank to rank, which can cause a scan-like pattern as the crosstalk operator is implemented. A way to go about this is to take the median before the distribution or a global median.