Skip to content
Open
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
25 changes: 25 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Codespell configuration is within pyproject.toml
---
name: Codespell

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: codespell-project/actions-codespell@v2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ We use [WebDataset](https://github.com/webdataset/webdataset) to read data durin

**Upstream:** All upstream data contain three core entries for I) the parcelated BOLD data (`bold.pyd`), II) its repetition time (`t_r.pyd`), and III) a key (`__key__`) indicating the specific subject / task / run that this .tar file corresponds to.

**Downstream:** Each .tar file of the two downstream datasets contains one sample for each trial of its experiment run. In addition to the three entries listed for the upstream data, each trial also contains information describing the associated mental state. In our downstream adapatation analyses, we utilize the `task_label.pyd` (MDTB data) and `label_across_tasks.pyd` (HCP data) entries to assign numerical labels to each mental state during training. Note that the MDTB data is indicated with its OpenNeuro identifier (`ds002105`) in the `data/downstream/` directory.
**Downstream:** Each .tar file of the two downstream datasets contains one sample for each trial of its experiment run. In addition to the three entries listed for the upstream data, each trial also contains information describing the associated mental state. In our downstream adaptation analyses, we utilize the `task_label.pyd` (MDTB data) and `label_across_tasks.pyd` (HCP data) entries to assign numerical labels to each mental state during training. Note that the MDTB data is indicated with its OpenNeuro identifier (`ds002105`) in the `data/downstream/` directory.

For details on the additional preprocessing applied to [fmriprep](https://fmriprep.org/en/stable/)'s derivatives for each dataset, see the scripts contained in `scripts/dataprep/`.

Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ webdataset = "0.1.103"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = '.git*,*.lock'
check-hidden = true
# ignore-regex = ''
# ignore-words-list = ''
2 changes: 1 addition & 1 deletion scripts/analyses/fig5_downstream_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def fig_downstream_performance(

def get_args() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description='figure 5 of the manuscript; downstream model adapatation performances'
description='figure 5 of the manuscript; downstream model adaptation performances'
)

parser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion scripts/analyses/sfig4_5_downstream_learning_curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def sfig_downstream_learning_curves(

def get_argparse() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description='appendix figure 4-5 of the manuscript; downstream adapatation learning curves'
description='appendix figure 4-5 of the manuscript; downstream adaptation learning curves'
)

parser.add_argument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def sfig_downstream_performance_replication(config: Dict=None) -> None:
"""Script's main funtion; creates Appendix Figure 6 by wrapping
"""Script's main function; creates Appendix Figure 6 by wrapping
fig_downstream_performance() from scripts/analyses/fig5_downstream-performance.py"""

if config is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def sfig_downstream_learning_curves_replication(config: Dict=None) -> None:
"""Script's main funtion; creates Appendix Figure 7 by wrapping
"""Script's main function; creates Appendix Figure 7 by wrapping
fig_downstream_performance() from scripts/analyses/fig5_downstream-performance.py"""

if config is None:
Expand Down
2 changes: 1 addition & 1 deletion scripts/dataprep/downstream/mdtb_dataprep.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def get_args() -> argparse.Namespace:
metavar='DIR',
default='../data/downstream/',
type=str,
help='path where .tar files for fMRI runs wil be stored '
help='path where .tar files for fMRI runs will be stored '
'(default: ../data/downstream)'
)
parser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion scripts/dataprep/upstream/dataprep.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def get_args() -> argparse.ArgumentParser:
default=-1,
type=float,
help='repetition time / TR of BOLD data (in seconds); '
'will be infered from data files, if not set (or set to -1).'
'will be inferred from data files, if not set (or set to -1).'
)
parser.add_argument(
'--check-fmriprep-bug',
Expand Down
2 changes: 1 addition & 1 deletion scripts/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def make_model(model_config: Dict=None):
def get_config(args: argparse.Namespace=None) -> Dict:
"""
Make config from command line arguments (as created by get_args()).
Performs additional formating of args required for calling train().
Performs additional formatting of args required for calling train().
"""

if args is None:
Expand Down
2 changes: 1 addition & 1 deletion src/batcher/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def make_batcher(
run files.
sample_random_seq: bool
If True, the sequences are sampled randomly from
the data run files, given the spefied
the data run files, given the specified
sequence length (seq_min and seq_max) and the
specified gap consecutive sequences (bert_seq_gap_min,
bert_seq_gap_max) for BERT-style training.
Expand Down
4 changes: 2 additions & 2 deletions src/decoder/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def make_decoder(
(as generated by src.embedder.prep_batch).
decode(outputs: Dict):
Make decoding prediction, given outputs generated by
caling forward().
calling forward().
switch_decoding_mode(is_decoding_mode: bool):
Switch model to decoding mode (is_decoding_mode=True).
Relevant for adaptation of pre-trained models
Expand Down Expand Up @@ -112,4 +112,4 @@ def make_decoder(
return LinearBaseline(**kwargs)

else:
raise ValueError(f'{architecture}-architecture unkown.')
raise ValueError(f'{architecture}-architecture unknown.')
2 changes: 1 addition & 1 deletion tests/test_adapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_adapt_decoding() -> None:
'training_style': pre_training_style,
}
)
# adapt mdoel
# adapt model
adapt_trainer = run_train_process(
config={
**ADAPT_CONFIG,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_checkpoint_forward_pass() -> None:
model.eval()
loaded_model.eval()
batch_prepped = model.embedder.prep_batch(batch)
# test embdder forward pass
# test embedder forward pass
inputs_embeds = model.embedder(batch=batch_prepped)
inputs_embeds_loaded = loaded_model.embedder(batch=batch_prepped)
assert torch.equal(
Expand Down