Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions bids2table/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,19 @@ def datatypes(self) -> List[str]:
@cached_property
def modalities(self) -> List[str]:
"""
Get all modalities present in the table.
Get data modalities present in the table.

Currently includes: https://github.com/bids-standard/bids-specification/blob/master/src/schema/objects/suffixes.yaml
which can include events, etc.
"""
return self.suffixes

@cached_property
def suffixes(self) -> List[str]:
"""
Get all suffixes present in the table.
"""
# TODO: Is this the right way to get the modality
return self.ent["mod"].unique().tolist()
return self.ent["suffix"].unique().tolist()

@cached_property
def subjects(self) -> List[str]:
Expand Down
8 changes: 7 additions & 1 deletion tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ def test_table(tab: BIDSTable):
assert subtab.ds.shape == (10, 4)

assert len(tab.datatypes) == 2
assert len(tab.modalities) == 1
assert set(tab.modalities).issuperset(
{
"T1w",
"inplaneT2",
"bold",
}
)
assert len(tab.subjects) == 16
assert len(tab.entities) == 3

Expand Down