-
Notifications
You must be signed in to change notification settings - Fork 26
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
Don't interpolate volumes at beginning/end of run #950
Conversation
Codecov ReportAll modified lines are covered by tests ✅
📢 Thoughts on this report? Let us know!. |
@mattcieslak would you mind looking over the core change? |
|
||
To address this, XCP-D now replaces interpolated volumes at the edges of the run with the | ||
closest non-outlier volume's data, as of 0.5.1. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an appropriate level of concern/warning
"sub-1648798153_ses-PNC1_task-rest_acq-singleband_desc-confounds_timeseries.tsv", | ||
) | ||
motion_df = pd.read_table(motion_file) | ||
motion_df.loc[56:, "trans_x"] = np.arange(1, 5) * 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great idea
# Create an updated censoring file with outliers at first and last two volumes | ||
censoring_df = confounds_df[["framewise_displacement"]] | ||
censoring_df["framewise_displacement"] = False | ||
censoring_df.iloc[:2]["framewise_displacement"] = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you pick 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was just arbitrary. It could have been any number >= 1.
if outlier_idx: | ||
gaps = [[s, e] for s, e in zip(outlier_idx, outlier_idx[1:]) if s + 1 < e] | ||
edges = iter(outlier_idx[:1] + sum(gaps, []) + outlier_idx[-1:]) | ||
consecutive_outliers_idx = list(zip(edges, edges)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is hard for me to follow intuitively, but I tested it a bunch and it seems to work fine.
] = interpolated_unfiltered_bold[first_outliers[1] + 1, :] | ||
|
||
# Replace outliers at end of run | ||
if last_outliers[1] == n_volumes - 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem only arises if the very last or very first points are censored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it seems like cubic spline interpolation works well as long as there's some data before and after the points being interpolated, so the problem comes from interpolating with point only on one side.
Closes #949.
Changes proposed in this pull request
constant
buffer we use for the bandpass filter.Documentation that should be reviewed