ME-ICA / tedana

TE-dependent analysis of multi-echo fMRI
https://tedana.readthedocs.io
GNU Lesser General Public License v2.1
158 stars 94 forks source link

Consistently use either Legendre polynomials or scaled monomials for detrending #1099

Closed tsalo closed 3 weeks ago

tsalo commented 1 month ago

In #1064, we start using scaled monomials to detrend data, but in gscontrol_raw we use Legendre polynomials. I want to consistently use one or the other. If there's a good reason to use Legendre in one case and monomials in the other, then I'd like to document that somewhere.

_Originally posted by @tsalo in https://github.com/ME-ICA/tedana/pull/1064#discussion_r1585422641_

handwerkerd commented 1 month ago

In #1064 I just made a single function utils.create_legendre_polynomial_basis_set and that function is now used both in gscontrol_raw and external.py

handwerkerd commented 1 month ago

I'm adding the number of detrending regressors used in the fits to LGR.info, but we are not saving that value elsewhere and we're not writing out the actual detrending regressors used.

To options to log this info are:

Thoughts?

tsalo commented 1 month ago

How do the Legendre results look compared to the standard polynomial terms?

handwerkerd commented 1 month ago

I didn't directly compare, but the Legendre polynomials are fine for detrending and I agree that there's no reason to use two different methods in two different places. I've confirmed the code is working as expected, but I haven't looked at the detrended vs non-detrended time series (since the code is just fitting them all to a single model rather than outputting a detrended fit)

handwerkerd commented 3 weeks ago

As discussed in our June 2024 dev call, I'm closing this issue. Currently, Legendre polynomials are the only method and they are only used with gscontrol_raw When #1064 is merged, the code to create the Legendre polynomials will be modularized and also used when fitting external regressors.