Skip to content

Conversation

@rob-luke
Copy link
Member

@rob-luke rob-luke commented Oct 14, 2021

Reference issue

The fNIRS processing uses the modified Beer Lambert law (BLL) to convert optical density data to changes in haemoglobin concentration. This process uses a scaling factor called the partial path length factor.

The largest fNIRS group that wrote the Homer software uses a ppf=6 value. Whereas we use a default value of 0.1. @larsoner already ran in to this issue before, and for his code needed to change the MNE function to use ppf=6 (#8711 (comment))

When I wrote the BLL code I had been using the default ppf value from the Huppert AnalyzIR toolbox (Santosa... Huppert 2018) of 0.1. Their approach was to use a partial volume correction (PVC=60) when determining the ppf. So their ppf = [dpf=6]/[pvc=60] = 0.1

I had assumed when writing our code that the 2018 paper was a better benchmark than the Homer 2009 paper (also by Huppert). However, I just had a phone call with Yucel (author of the fNIRS best practices paper), and they still recommend ppf=6. For many reasons, but one that stood out for me is that the pvc value is not well known and varies across the head and task.

What does this implement/fix?

To be in line with best practices and with the most prominent fNIRS software and match community expectations from existing literature I change our default ppf=0.1 to ppf=6

Additional information

Neither approach is right or wrong. But using ppf=6 is more inline with the community expectations and makes our results easier compared to the majority of the existing literature.

I've been going back and forth in my head about this for a while, but I think we should make the jump before the 0.24 release.

The tests already had a hard coded ppf value (didnt use the default), so they didnt require changing.

@rob-luke
Copy link
Member Author

FYI: @HanBnrd (also looking forward to your talk next week!) @rderollepot @kylemath

@larsoner @agramfort ready for review, unless someone above disagrees

@rob-luke rob-luke added this to the 0.24 milestone Oct 14, 2021
@rob-luke
Copy link
Member Author

Cancel that merge request, I will check the tutorials before requesting a merge. The scaling of results might now be different and I may need to change the tutorial text and ylims

@rob-luke rob-luke changed the title Change Beer Lambert law default ppf value to 6 WIP: Change Beer Lambert law default ppf value to 6 Oct 14, 2021
@rob-luke rob-luke marked this pull request as draft October 14, 2021 00:20
@larsoner
Copy link
Member

+1 for this change, but unfortunately we need to do it via deprecation :(

This means in the signature you have ppf=None, and in the description of the kwarg you say the default in 0.24 is 0.1 but will change to 6 in 0.25, and in the code you do:

if ppf is None:
    ppf = 0.1
    warn('The default value ppf=0.1 in 0.24 will change to ppf=6 in 0.25, set it ...', DeprecationWarning)

and then to save us some pain, add an ignore line to conf.py to ignore this deprecation warning so that we don't have to explicitly ignore it in our tests to avoid them failing.

@rob-luke
Copy link
Member Author

but unfortunately we need to do it via deprecation

Ah yes, of course. No worries, I will implement as you describe.

Thanks for explaining how to do it in detail, that saved me a good 20 mins!

@rderollepot
Copy link
Contributor

rderollepot commented Oct 18, 2021

FYI: @HanBnrd (also looking forward to your talk next week!) @rderollepot @kylemath

@larsoner @agramfort ready for review, unless someone above disagrees

Thank you Robert for your investigation on this point and for the clear sum up above !

@rob-luke
Copy link
Member Author

@larsoner do we put in latest.inc items for future changes? Or should I just remove this from latest?

@larsoner
Copy link
Member

Deprecations go in the API section

@rob-luke
Copy link
Member Author

@larsoner and @agramfort could you please review. The failing tests in one CI seem unrelated. Thanks

@rob-luke rob-luke marked this pull request as ready for review October 24, 2021 04:37
@rob-luke rob-luke changed the title WIP: Change Beer Lambert law default ppf value to 6 MRG: Change Beer Lambert law default ppf value to 6 Oct 24, 2021
@larsoner larsoner merged commit 44f4b0f into mne-tools:main Oct 25, 2021
@larsoner
Copy link
Member

Thanks @rob-luke !


- Deprecate ``mne.viz.utils.center_cmap`` (:gh:`9851` by `Clemens Brunner`_)

- Add depreciation warning for the default partial pathlength factor of :func:`mne.preprocessing.nirs.beer_lambert_law` from 0.1 to 6 (:gh:`9843` by `Robert Luke`_)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, depreciation should be deprecation -- will fix in main

@rob-luke
Copy link
Member Author

Thanks @agramfort and @larsoner for completing this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants