Skip to content

Commit

Permalink
move to snake fmri naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
paquiteau committed Jan 23, 2024
1 parent 289f27d commit a1bbee2
Show file tree
Hide file tree
Showing 71 changed files with 93 additions and 95 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ simfmri comes with helper tools to configure and run simulation, and as such can
## Available commands

3 CLI interfaces are able to use the configuration folder to perform differents task:
- `simfmri-main` to do a full simulation + reconstruction + validation
- `simfmri-data` to generate a dataset of simulation
- `simfmri-rec` to evaluate reconstructions methods (and do the statistics) over an existing dataset.
- `snkf-main` to do a full simulation + reconstruction + validation
- `snkf-data` to generate a dataset of simulation
- `snkf-rec` to evaluate reconstructions methods (and do the statistics) over an existing dataset.

Typically you would create a dataset with `simfmri-data` and then run `simfmri-rec` on it.
Typically you would create a dataset with `snkf-data` and then run `snkf-rec` on it.


## Configurations Files
The configuration are located in `simfmri/runner/conf` and articulates over 3 main componenents:
The configuration are located in `snkf/runner/conf` and articulates over 3 main componenents:
- the simulation
- the reconstruction
- the validation via statistical analysis

### Simulation
located in `simfmri/runner/conf/simulation`
located in `snkf/runner/conf/simulation`
### Reconstruction
located in `simfmri/runner/conf/reconstruction`
located in `snkf/runner/conf/reconstruction`

### Validation

Expand Down
10 changes: 5 additions & 5 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ parts:
- caption: API References
chapters:
- file: api.rst
# - file: _api/simfmri.simulation.rst
# - file: _api/simfmri.handlers.rst
# - file: _api/simfmri.reconstructor.rst
# - file: _api/simfmri.cli.rst
# - file: _api/simfmri.analysis.rst
# - file: _api/snkf.simulation.rst
# - file: _api/snkf.handlers.rst
# - file: _api/snkf.reconstructor.rst
# - file: _api/snkf.cli.rst
# - file: _api/snkf.analysis.rst

- caption: Extras
chapters:
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced_guide/understanding_handlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Handlers can be chained to create a complex simulation.
## Listing availables handlers

```{code-cell} ipython3
from simfmri.handlers import H, list_handlers, HandlerChain
from snkf.handlers import H, list_handlers, HandlerChain
```

```{code-cell} ipython3
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced_guide/writing_config_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```

<!-- #raw -->
```{include} ../../../src/simfmri/conf/simulation/sl_basic.yaml
```{include} ../../../src/snkf/conf/simulation/sl_basic.yaml
```
<!-- #endraw -->

Expand Down
10 changes: 5 additions & 5 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
:toctree: _autosummary
:recursive:

simfmri.simulation
simfmri.handlers
simfmri.reconstructors
simfmri.cli
simfmri.analysis
snkf.simulation
snkf.handlers
snkf.reconstructors
snkf.cli
snkf.analysis
2 changes: 1 addition & 1 deletion docs/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
rm -rf _build _api

# Build the API documentation with autoapi
sphinx-apidoc -ePf --ext-autodoc --output-dir=_api -t _templates/ ../src/simfmri "**/_version.py"
sphinx-apidoc -ePf --ext-autodoc --output-dir=_api -t _templates/ ../src/snkf "**/_version.py"

# Finally build the entire docs
jupyter-book build .
2 changes: 1 addition & 1 deletion examples/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Examples
========

The following are a collection of examples showcasing the possibility of simfmri.
The following are a collection of examples showcasing the possibility of snkf.
2 changes: 1 addition & 1 deletion examples/example_big.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import matplotlib.pyplot as plt
from simfmri.utils.phantom import generate_phantom, raster_phantom
from snkf.utils.phantom import generate_phantom, raster_phantom

# %%
# Rasterisation vs Generation
Expand Down
4 changes: 2 additions & 2 deletions examples/example_shepp_logan.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import matplotlib.pyplot as plt

from simfmri.simulation import SimData
from simfmri.handlers import (
from snkf.simulation import SimData
from snkf.handlers import (
SheppLoganGeneratorHandler,
ActivationHandler,
AcquisitionHandler,
Expand Down
12 changes: 6 additions & 6 deletions examples/example_simulation_with_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@

sim_config = """
### Simulation for a Shepp Logan phantom with activation.
_target_: simfmri.simulation.SimDataFactory
_target_: snkf.simulation.SimDataFactory
checkpoints: false
sim_params:
_target_: simfmri.simulation.SimulationParams
_target_: snkf.simulation.SimulationParams
n_frames: 100
shape: [128, 128, 128]
sim_tr: 1.0
n_coils: 1
handlers:
generator:
_target_: simfmri.simulation.SheppLoganGeneratorHandler
_target_: snkf.simulation.SheppLoganGeneratorHandler
slicer:
_target_: simfmri.simulation.SlicerHandler
_target_: snkf.simulation.SlicerHandler
axis: 0
index: 58
activation:
_target_: simfmri.simulation.ActivationHandler.from_block_design
_target_: snkf.simulation.ActivationHandler.from_block_design
event_name: block_on
block_on: 3
block_off: 3
Expand All @@ -56,7 +56,7 @@
#
# .. tip::
# For more information on Hydra and its configuration be sure to check the sister
# package ``simfmri_runner``.
# package ``snkf_runner``.
#

# %%
Expand Down
4 changes: 2 additions & 2 deletions examples/example_vds_simrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"""
import matplotlib.pyplot as plt
import numpy as np
from simfmri.simulation import H, SimData, list_handlers
from simfmri.runner.reconstructor import (
from snkf.simulation import H, SimData, list_handlers
from snkf.runner.reconstructor import (
ZeroFilledReconstructor,
SequentialReconstructor,
LowRankPlusSparseReconstructor,
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "simfmri" # Required
name = "snake-fmri" # Required
# corresponds to the "Summary" metadata field:
description = "A simulator and validator of fMRI reconstruction methods."
# This field corresponds to the "Description" metadata field:
Expand Down Expand Up @@ -64,9 +64,9 @@ doc = ["jupyter-book", "sphinx-book-theme<1.0.0"]
"Source" = "https://github.com/paquiteau/simfmri"

[project.scripts]
simfmri-main ="simfmri.cli.main:main_app"
simfmri-data ="simfmrmi.cli.generate_dataset:generate_data"
simfmri-rec="simfmri.cli.eval_recon:eval_recon"
snkf-main ="snkf.cli.main:main_app"
snkf-data ="simfmrmi.cli.generate_dataset:generate_data"
snkf-rec="snkf.cli.eval_recon:eval_recon"


[build-system]
Expand All @@ -80,7 +80,7 @@ where=["src"]


[tool.setuptools_scm]
write_to = "src/simfmri/_version.py"
write_to = "src/snkf/_version.py"
version_scheme = "python-simplified-semver"
local_scheme="no-local-version"

Expand All @@ -97,7 +97,7 @@ profile="black"
[tool.pytest.ini_options]
minversion = "6.0"
addopts = [
"--cov=simfmri",
"--cov=snkf",
"--cov-report=term-missing",
"--cov-report=xml"
]
Expand Down
2 changes: 1 addition & 1 deletion src/conf/3d-cartesian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ hydra:
_target_: hydra_callbacks.MultiRunGatherer
aggregator:
_partial_: true
_target_: simfmri.cli.utils.aggregate_results
_target_: snkf.cli.utils.aggregate_results

latest_run:
_target_: hydra_callbacks.LatestRunLink
2 changes: 1 addition & 1 deletion src/conf/3d-sos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ hydra:
_target_: hydra_callbacks.MultiRunGatherer
aggregator:
_partial_: true
_target_: simfmri.cli.utils.aggregate_results
_target_: snkf.cli.utils.aggregate_results

latest_run:
_target_: hydra_callbacks.LatestRunLink
2 changes: 1 addition & 1 deletion src/conf/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Hydra configuration files for simfmri."""
"""Hydra configuration files for snkf."""
2 changes: 1 addition & 1 deletion src/conf/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ hydra:
_target_: hydra_callbacks.MultiRunGatherer
aggregator:
_partial_: true
_target_: simfmri.cli.utils.aggregate_results
_target_: snkf.cli.utils.aggregate_results

latest_run:
_target_: hydra_callbacks.LatestRunLink
2 changes: 1 addition & 1 deletion src/conf/dataset_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ hydra:
_target_: hydra_callbacks.GitInfo
clean: false
retrieve_dataset:
_target_: simfmri.runner.generate_dataset.RetrieveDatasetCallback
_target_: snkf.runner.generate_dataset.RetrieveDatasetCallback
dataset_dir: datasets
2 changes: 1 addition & 1 deletion src/conf/eval_recon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ hydra:
sweeper:
max_batch_size: 10
samples_per_job: 1
dataset_path: "/home/pac/gits/nsp/simfmri_runner/datasets/dataset.csv"
dataset_path: "/home/pac/gits/nsp/snkf_runner/datasets/dataset.csv"
6 changes: 3 additions & 3 deletions src/conf/experiments/extend_sweep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ hydra:
reconstruction: lowrank_sparse, sequential, zero_filled

run:
dir: /volatile/pierre-antoine/simfmri/outputs/${hydra.job.name}/${now:%Y-%m-%d_%H-%M-%S}
dir: /volatile/pierre-antoine/snkf/outputs/${hydra.job.name}/${now:%Y-%m-%d_%H-%M-%S}
sweep:
dir: /volatile/pierre-antoine/simfmri/multirun/extend-sweep/${now:%Y-%m-%d}/${now:%H-%M-%S}
dir: /volatile/pierre-antoine/snkf/multirun/extend-sweep/${now:%Y-%m-%d}/${now:%H-%M-%S}
subdir: ${hydra.job.num}

callbacks:
gather_files:
_target_: hydra_callbacks.MultiRunGatherer
result_file: "results.json"
aggregator:
_target_: simfmri.runner.utils.aggregate_results
_target_: snkf.runner.utils.aggregate_results
_partial_: true

latest_link:
Expand Down
4 changes: 2 additions & 2 deletions src/conf/experiments/sequentials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ hydra:

callbacks:
gather_files:
_target_: simfmri.runner.callback.MultiRunGatherer
_target_: snkf.runner.callback.MultiRunGatherer
latest_link:
_target_: simfmri.runner.callback.LatestRunLink
_target_: snkf.runner.callback.LatestRunLink
4 changes: 2 additions & 2 deletions src/conf/scenario1.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This files contains the configuration to reproduce the scenario 1 of the Simfmri paper.
# This files contains the configuration to reproduce the scenario 1 of the Snkf paper.

force_sim: false
cache_dir: ${oc.env:PWD}/cache
Expand Down Expand Up @@ -56,7 +56,7 @@ hydra:
_target_: hydra_callbacks.MultiRunGatherer
aggregator:
_partial_: true
_target_: simfmri.cli.utils.aggregate_results
_target_: snkf.cli.utils.aggregate_results

latest_run:
_target_: hydra_callbacks.LatestRunLink
Expand Down
2 changes: 1 addition & 1 deletion src/conf/scenario2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ hydra:
_target_: hydra_callbacks.MultiRunGatherer
aggregator:
_partial_: true
_target_: simfmri.cli.utils.aggregate_results
_target_: snkf.cli.utils.aggregate_results

latest_run:
_target_: hydra_callbacks.LatestRunLink
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from matplotlib.artist import Artist
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from simfmri.simulation import SimData
from snkf.simulation import SimData

from matplotlib.lines import Line2D
from matplotlib.offsetbox import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from nilearn.glm.thresholding import fdr_threshold
from scipy.stats import norm

from simfmri.simulation import SimData
from snkf.simulation import SimData

logger = logging.getLogger(__name__)

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/simfmri/cli/main.py → src/snkf/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
from hydra_callbacks import PerfLogger
from omegaconf import DictConfig, OmegaConf

from simfmri.analysis.stats import contrast_zscore, get_scores
from simfmri.handlers import HandlerChain
from simfmri.reconstructors import get_reconstructor
from simfmri.cli.utils import hash_config
from snkf.analysis.stats import contrast_zscore, get_scores
from snkf.handlers import HandlerChain
from snkf.reconstructors import get_reconstructor
from snkf.cli.utils import hash_config

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/simfmri/cli/sweeper.py → src/snkf/cli/sweeper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""A dataset sweeper for simfmri_runner."""
"""A dataset sweeper for snkf_runner."""
import itertools
import logging
import os
Expand Down
2 changes: 1 addition & 1 deletion src/simfmri/cli/utils.py → src/snkf/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import itertools
import numpy as np
from collections.abc import Sequence
from simfmri.simulation import SimData
from snkf.simulation import SimData
import logging
from joblib.hashing import hash as jb_hash
from omegaconf import DictConfig, OmegaConf
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import numpy as np
from mrinufft.io import read_trajectory

from simfmri.simulation import SimData
from simfmri.utils import AnyShape, validate_rng
from snkf.simulation import SimData
from snkf.utils import AnyShape, validate_rng

from ..base import AbstractHandler
from ._coils import get_smaps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from enum import Enum

from typing import Sequence, Any, Literal
from simfmri.utils import RngType, validate_rng, AnyShape
from snkf.utils import RngType, validate_rng, AnyShape

SlicerType = list[slice | np.ndarray[Any, np.dtype[np.int64]] | int]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Literal, Mapping, Any
from collections.abc import Generator
import numpy as np
from simfmri.utils.typing import RngType, AnyShape
from snkf.utils.typing import RngType, AnyShape

from .cartesian_sampling import get_kspace_slice_loc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from tqdm.auto import tqdm

from simfmri.simulation import SimData, LazySimArray
from snkf.simulation import SimData, LazySimArray

from ._tools import TrajectoryGeneratorType

Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a1bbee2

Please sign in to comment.