8000 Question regarding temporal filtering · Issue #448 · nipy/nipy · GitHub
[go: up one dir, main page]

Skip to content

Question regarding temporal filtering #448

Open

Description

@takhs91

Hi,
I was reading the way temporal filtering is implemented using the cosine model and except I was a bit confused from the fact that is written as a low-pass filter while it is a high-pass filter as also stated in #295 (An error that is actually propagated in nistats too https://github.com/nistats/nistats/blob/master/nistats/design_matrix.py#L87) I also think I noticed something else.

The order of the DCT that is computed at https://github.com/nipy/nipy/blob/master/nipy/modalities/fmri/design_matrix.py#L87
is the closest one (equal to or a bit lower in frequency ) to the requested cutoff point.

For example if you have 120 volumes and a tr of 2s and you want your cut period to be 120s then highest order should be

2*120*(1/120)*2 = 4

this is the exact dct order that will cut the requested period

Although later https://github.com/nipy/nipy/blob/master/nipy/modalities/fmri/design_matrix.py#L91
only the 1... order-1 drifts are added (plus the constant at last)missing the dct of order equal to the order found above.

Should't it be included too? If that's the case I am willing to proceed with a fix for here and for nistats.

Activity

  1. bthirion commented on Dec 19, 2018

    @bthirion
    Contributor
  2. takhs91 commented on Dec 19, 2018

    @takhs91
    Author

    Thanks for replying,
    the documentation Create a cosine drift matrix with periods greater or equals to period_cut gave me the idea its should be inclusive.

    Except from that though in the case when the calculated order is exact to the one matching the cutt-of, skipping it is the conservative option.

    On the other hand at the cases where the order is not exact (where using the floor func makes the difference) using that order would be already conservative. Skipping it is not necessary and makes it too conservative.

    For example, using the same data as in the example above but using a cutoff of 100s

    order = floor(2120(1/100)*2) = floor(4,8)= 4

    in that case using 4 would be the conservative choice but using 3 (this is the default now) is too conservative.

    If skipping is kept maybe using round instead of floor would be more even.

    Also stop skipping and using the inclusive option would be fine. Are there any disadvantages to that?
    Will some frequencies a bit less than the cut-off also be regressed out? I believe so but again not many

  3. bthirion commented on Dec 19, 2018

    @bthirion
    Contributor

    I'm fine with not skipping.
    Best, B

  4. takhs91 commented on Dec 20, 2018

    @takhs91
    Author

    Ok! I will make the changes proposed both here and in nistats and open PRs . Do you think they have not chance of being merged here? I see some commits up to October. I would like to go straight to nistats but I am waiting for it to stabilize.

  5. matthew-brett commented on Dec 20, 2018

    @matthew-brett
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0