Skip to content
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

Please support formulaic 0.6.0 #1000

Open
musicinmybrain opened this issue May 2, 2023 · 5 comments
Open

Please support formulaic 0.6.0 #1000

musicinmybrain opened this issue May 2, 2023 · 5 comments

Comments

@musicinmybrain
Copy link

Version 0.6.0 of the formulaic dependency is available.

It does not advertise any breaking changes to the user-facing APIs. However, if I loosen the version constraint in the just-released pybids 0.16.1 to allow the new release, in the manner of #916, I do find that there is one regression in the tests with formulaic 0.6.0:

=================================== FAILURES ===================================
__________________________________ test_split __________________________________
[gw5] linux -- Python 3.11.3 /usr/bin/python3

collection = <BIDSRunVariableCollection['PTval', 'RT', 'RT.respcat[-1]', 'RT.respcat[0]', 'RT.respcat[1]', 'RT_2', 'RT_2.respcat[-1...1].loss[8]', 'RT_2.respcat[1].loss[9]', 'RT_3', 'gain', 'loss', 'parametric gain', 'respcat', 'respnum', 'trial_type']>

    def test_split(collection):

        orig = collection['RT'].clone(name='RT_2')
        collection['RT_2'] = orig.clone()
        collection['RT_3'] = collection['RT']\
            .clone(name='RT_3').to_dense(collection.sampling_rate)

        rt_pre_onsets = collection['RT'].onset
        rt_pre_values = collection['RT'].values.values

        # Grouping SparseEventVariable by one column
        transform.Split(collection, ['RT'], ['respcat'])

        # Verify names
        assert 'RT.respcat[0]' in collection.variables.keys() and \
               'RT.respcat[-1]' in collection.variables.keys()

        # Verify values
        rt_post_onsets = np.r_[collection['RT.respcat[0]'].onset,
                               collection['RT.respcat[-1]'].onset,
                               collection['RT.respcat[1]'].onset]
        assert np.array_equal(rt_pre_onsets.sort(), rt_post_onsets.sort())

        rt_post_values = np.r_[collection['RT.respcat[0]'].values.values,
                               collection['RT.respcat[-1]'].values.values,
                               collection['RT.respcat[1]'].values.values]
        assert np.array_equal(rt_pre_values.sort(), rt_post_values.sort())

        # Grouping SparseEventVariable by multiple columns
        transform.Split(collection, variables=['RT_2'], by=['respcat', 'loss'])
>       assert 'RT_2.loss[13].respcat[-1]' in collection.variables.keys() and \
               'RT_2.loss[13].respcat[1]' in collection.variables.keys()
E       AssertionError: assert ('RT_2.loss[13].respcat[-1]' in dict_keys(['RT', 'loss', 'parametric gain', 'gain', 'respnum', 'trial_type', 'respcat', 'PTval', 'RT_2', 'RT_3', 'RT.respcat[-1]', 'RT.respcat[0]', 'RT.respcat[1]', 'RT_2.respcat[-1].loss[10]', 'RT_2.respcat[0].loss[10]', 'RT_2.respcat[1].loss[10]', 'RT_2.respcat[-1].loss[11]', 'RT_2.respcat[0].loss[11]', 'RT_2.respcat[1].loss[11]', 'RT_2.respcat[-1].loss[12]', 'RT_2.respcat[0].loss[12]', 'RT_2.respcat[1].loss[12]', 'RT_2.respcat[-1].loss[13]', 'RT_2.respcat[0].loss[13]', 'RT_2.respcat[1].loss[13]', 'RT_2.respcat[-1].loss[14]', 'RT_2.respcat[0].loss[14]', 'RT_2.respcat[1].loss[14]', 'RT_2.respcat[-1].loss[15]', 'RT_2.respcat[0].loss[15]', 'RT_2.respcat[1].loss[15]', 'RT_2.respcat[-1].loss[16]', 'RT_2.respcat[0].loss[16]', 'RT_2.respcat[1].loss[16]', 'RT_2.respcat[-1].loss[17]', 'RT_2.respcat[0].loss[17]', 'RT_2.respcat[1].loss[17]', 'RT_2.respcat[-1].loss[18]', 'RT_2.respcat[0].loss[18]', 'RT_2.respcat[1].loss[18]', 'RT_2.respcat[-1].loss[19]', 'RT_2.respcat[0].loss[19]', 'RT_2.respcat[1].loss[19]', 'RT_2.respcat[-1].loss[20]', 'RT_2.respcat[0].loss[20]', 'RT_2.respcat[1].loss[20]', 'RT_2.respcat[-1].loss[5]', 'RT_2.respcat[0].loss[5]', 'RT_2.respcat[1].loss[5]', 'RT_2.respcat[-1].loss[6]', 'RT_2.respcat[0].loss[6]', 'RT_2.respcat[1].loss[6]', 'RT_2.respcat[-1].loss[7]', 'RT_2.respcat[0].loss[7]', 'RT_2.respcat[1].loss[7]', 'RT_2.respcat[-1].loss[8]', 'RT_2.respcat[0].loss[8]', 'RT_2.respcat[1].loss[8]', 'RT_2.respcat[-1].loss[9]', 'RT_2.respcat[0].loss[9]', 'RT_2.respcat[1].loss[9]']))
E        +  where dict_keys(['RT', 'loss', 'parametric gain', 'gain', 'respnum', 'trial_type', 'respcat', 'PTval', 'RT_2', 'RT_3', 'RT.respcat[-1]', 'RT.respcat[0]', 'RT.respcat[1]', 'RT_2.respcat[-1].loss[10]', 'RT_2.respcat[0].loss[10]', 'RT_2.respcat[1].loss[10]', 'RT_2.respcat[-1].loss[11]', 'RT_2.respcat[0].loss[11]', 'RT_2.respcat[1].loss[11]', 'RT_2.respcat[-1].loss[12]', 'RT_2.respcat[0].loss[12]', 'RT_2.respcat[1].loss[12]', 'RT_2.respcat[-1].loss[13]', 'RT_2.respcat[0].loss[13]', 'RT_2.respcat[1].loss[13]', 'RT_2.respcat[-1].loss[14]', 'RT_2.respcat[0].loss[14]', 'RT_2.respcat[1].loss[14]', 'RT_2.respcat[-1].loss[15]', 'RT_2.respcat[0].loss[15]', 'RT_2.respcat[1].loss[15]', 'RT_2.respcat[-1].loss[16]', 'RT_2.respcat[0].loss[16]', 'RT_2.respcat[1].loss[16]', 'RT_2.respcat[-1].loss[17]', 'RT_2.respcat[0].loss[17]', 'RT_2.respcat[1].loss[17]', 'RT_2.respcat[-1].loss[18]', 'RT_2.respcat[0].loss[18]', 'RT_2.respcat[1].loss[18]', 'RT_2.respcat[-1].loss[19]', 'RT_2.respcat[0].loss[19]', 'RT_2.respcat[1].loss[19]', 'RT_2.respcat[-1].loss[20]', 'RT_2.respcat[0].loss[20]', 'RT_2.respcat[1].loss[20]', 'RT_2.respcat[-1].loss[5]', 'RT_2.respcat[0].loss[5]', 'RT_2.respcat[1].loss[5]', 'RT_2.respcat[-1].loss[6]', 'RT_2.respcat[0].loss[6]', 'RT_2.respcat[1].loss[6]', 'RT_2.respcat[-1].loss[7]', 'RT_2.respcat[0].loss[7]', 'RT_2.respcat[1].loss[7]', 'RT_2.respcat[-1].loss[8]', 'RT_2.respcat[0].loss[8]', 'RT_2.respcat[1].loss[8]', 'RT_2.respcat[-1].loss[9]', 'RT_2.respcat[0].loss[9]', 'RT_2.respcat[1].loss[9]']) = <built-in method keys of dict object at 0x7f3d4953da80>()
E        +    where <built-in method keys of dict object at 0x7f3d4953da80> = {'PTval': <SparseRunVariable(name='PTval', source='events')>, 'RT': <SparseRunVariable(name='RT', source='events')>, 'RT.respcat[-1]': <SparseRunVariable(name='RT.respcat[-1]', source='events')>, 'RT.respcat[0]': <SparseRunVariable(name='RT.respcat[0]', source='events')>, ...}.keys
E        +      where {'PTval': <SparseRunVariable(name='PTval', source='events')>, 'RT': <SparseRunVariable(name='RT', source='events')>, 'RT.respcat[-1]': <SparseRunVariable(name='RT.respcat[-1]', source='events')>, 'RT.respcat[0]': <SparseRunVariable(name='RT.respcat[0]', source='events')>, ...} = <BIDSRunVariableCollection['PTval', 'RT', 'RT.respcat[-1]', 'RT.respcat[0]', 'RT.respcat[1]', 'RT_2', 'RT_2.respcat[-1].loss[10]', 'RT_2.respcat[-1].loss[11]', 'RT_2.respcat[-1].loss[12]', 'RT_2.respcat[-1].loss[13]', 'RT_2.respcat[-1].loss[14]', 'RT_2.respcat[-1].loss[15]', 'RT_2.respcat[-1].loss[16]', 'RT_2.respcat[-1].loss[17]', 'RT_2.respcat[-1].loss[18]', 'RT_2.respcat[-1].loss[19]', 'RT_2.respcat[-1].loss[20]', 'RT_2.respcat[-1].loss[5]', 'RT_2.respcat[-1].loss[6]', 'RT_2.respcat[-1].loss[7]', 'RT_2.respcat[-1].loss[8]', 'RT_2.respcat[-1].loss[9]', 'RT_2.respcat[0].loss[10]', 'RT_2.respcat[0].loss[11]', 'RT_2.respcat[0].loss[12]', 'RT_2.respcat[0].loss[13]', 'RT_2.respcat[0].loss[14]', 'RT_2.respcat[0].loss[15]', 'RT_2.respcat[0].loss[16]', 'RT_2.respcat[0].loss[17]', 'RT_2.respcat[0].loss[18]', 'RT_2.respcat[0].loss[19]', 'RT_2.respcat[0].loss[20]', 'RT_2.respcat[0].loss[5]', 'RT_2.respcat[0].loss[6]', 'RT_2.respcat[0].loss[7]', 'RT_2.respcat[0].loss[8]', 'RT_2.respcat[0].loss[9]', 'RT_2.respcat[1].loss[10]', 'RT_2.respcat[1].loss[11]', 'RT_2.respcat[1].loss[12]', 'RT_2.respcat[1].loss[13]', 'RT_2.respcat[1].loss[14]', 'RT_2.respcat[1].loss[15]', 'RT_2.respcat[1].loss[16]', 'RT_2.respcat[1].loss[17]', 'RT_2.respcat[1].loss[18]', 'RT_2.respcat[1].loss[19]', 'RT_2.respcat[1].loss[20]', 'RT_2.respcat[1].loss[5]', 'RT_2.respcat[1].loss[6]', 'RT_2.respcat[1].loss[7]', 'RT_2.respcat[1].loss[8]', 'RT_2.respcat[1].loss[9]', 'RT_3', 'gain', 'loss', 'parametric gain', 'respcat', 'respnum', 'trial_type']>.variables

bids/modeling/tests/test_transformations.py:290: AssertionError
@musicinmybrain
Copy link
Author

(Version 0.6.1 is available.)

@effigies
Copy link
Collaborator

effigies commented May 3, 2023

Yes, we should support it when someone gets a chance to understand the changes.

@sanjayankur31
Copy link
Contributor

Hi there,

Anything we can do to help with this? I have looked at the formulaic tweaks, but I don't know enough about either code base to be able to suggest what's going on here.

Cheers,

@sanjayankur31
Copy link
Contributor

Version 1.0.0 is now available and includes some deprecations:

https://github.com/matthewwardrop/formulaic/releases/tag/v1.0.0

@sanjayankur31
Copy link
Contributor

Version 1.1.0 is now available and includes more backwards incompatible changes:

https://github.com/matthewwardrop/formulaic/releases/tag/v1.1.0

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

No branches or pull requests

3 participants