diff --git a/benchmarks/benchmarks/brainglobe_atlasapi.py b/benchmarks/benchmarks/brainglobe_atlasapi.py new file mode 100644 index 00000000..288dc344 --- /dev/null +++ b/benchmarks/benchmarks/brainglobe_atlasapi.py @@ -0,0 +1,36 @@ +import json +import os +from pathlib import Path + +from brainglobe_workflows.brainglobe_atlasapi.create_mouse_atlas import ( + create_mouse_atlas, +) + + +class TimeBenchmark: + # Timing attributes + timeout = 3600 # default: 60 s + + def setup(self): + # read input config: environment variable if it exists, else default + input_config_path = os.getenv( + "ATLAS_CONFIG_PATH", + default=str( + Path(__file__).parents[2] + / "brainglobe_workflows" + / "configs" + / "brainglobe_atlasapi_small.json" + ), + ) + + assert Path(input_config_path).exists() + + # read as dict + with open(input_config_path) as cfg: + config_dict = json.load(cfg) + + # pass dict to class + self.config = config_dict + + def time_create_mouse_atlas(self): + create_mouse_atlas(**self.config) diff --git a/brainglobe_workflows/brainglobe_atlasapi/__init__.py b/brainglobe_workflows/brainglobe_atlasapi/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/brainglobe_workflows/brainglobe_atlasapi/create_mouse_atlas.py b/brainglobe_workflows/brainglobe_atlasapi/create_mouse_atlas.py new file mode 100644 index 00000000..a52f96b3 --- /dev/null +++ b/brainglobe_workflows/brainglobe_atlasapi/create_mouse_atlas.py @@ -0,0 +1,10 @@ +from brainglobe_atlasapi import BrainGlobeAtlas + + +def create_mouse_atlas(atlas_name): + atlas = BrainGlobeAtlas(atlas_name) + print(atlas.atlas_name) + + +if __name__ == "__main__": + create_mouse_atlas("allen_mouse_100um") diff --git a/brainglobe_workflows/configs/brainglobe_atlasapi_large.json b/brainglobe_workflows/configs/brainglobe_atlasapi_large.json new file mode 100644 index 00000000..a999d569 --- /dev/null +++ b/brainglobe_workflows/configs/brainglobe_atlasapi_large.json @@ -0,0 +1,3 @@ +{ + "atlas_name": "allen_mouse_10um" +} diff --git a/brainglobe_workflows/configs/brainglobe_atlasapi_small.json b/brainglobe_workflows/configs/brainglobe_atlasapi_small.json new file mode 100644 index 00000000..a41a627a --- /dev/null +++ b/brainglobe_workflows/configs/brainglobe_atlasapi_small.json @@ -0,0 +1,3 @@ +{ + "atlas_name": "allen_mouse_100um" +}