ME-ICA/tedana

Consistently use either Legendre polynomials or scaled monomials for detrending

tsalo opened this issue · 5 comments

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 #1064 (comment)

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

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:

  • Create a new file name and have an option to save the detrending regressors in a tsv file directly within utils.create_legendre_polynomial_basis_set
  • Pass and return the Component selector to a lot more functions so that this info is more centrally logged

Thoughts?

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

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)

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.