Git Product home page Git Product logo

Comments (5)

Remi-Gau avatar Remi-Gau commented on June 4, 2024

Well it is not the expected behaviour. I think that one of the items on the to do list has been trying to make sure that the BIDS inheritance principle is properly implemented but we have gotten there yet.

from bids-matlab.

gllmflndn avatar gllmflndn commented on June 4, 2024

Yes, a valid implementation of the inheritance principle still requires some work. The commented out tests were created here:
#10
Note that, at least until recently, the inheritance principle was not entirely clearly defined (especially its granularity) so it might be worth checking its status.

from bids-matlab.

apjanke avatar apjanke commented on June 4, 2024

I may be able to help with this.

It looks like bids.query, when you don't pass a 'sub','01' query filter, filters to "all subjects" and still goes down to the subject level when searching for metadata. And that subject-level metadata overrides the top-level metadata.

When there's no 'sub' filter, should query be looking at just the top-level metadata? Or still be pulling in metadata from all subjects? Or is this something I should be referring to the BIDS standard documentation for?

from bids-matlab.

Remi-Gau avatar Remi-Gau commented on June 4, 2024

I would tend to say that in terms of behavior we should maybe align on what pybids does.

I think that here part our problem is that the way the metadata is collected by get_metadata, because from my understanding it does the opposite of what we want: it starts by the lowest level in the hierarchy and then goes up level after level and overrides the metadata by what ever it finds on the way.

Am I wrong about this?

from bids-matlab.

apjanke avatar apjanke commented on June 4, 2024

I think the get_metadata implementation is doing the Inheritance principle correctly already. It does start at the lowest level, and then moves up to higher levels, using update_metadata to add the higher-level metadata. But the key is this line, down in update_metadata:

    if ~isfield(s1,fn{i})
        s1.(fn{i}) = s2.(fn{i});
    end

That ~isfield means that the new (upper-level) metadata is only applied if no lower-level metadata source had already set it for that key. So lower-level metadata specifications override higher-level metadata on a per-key basis.

I think the issue with the commented-out tests is that the test code is acting like bids.query(BIDS, 'metadata') will directly get the higher-level metadata, when it actually goes and gets bottom-level per-subject/session metadata. If you want query to be able to directly get the higher-level metadata, it will need a special calling form for that.

I'll have a look at what pybids does here.

from bids-matlab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.