-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sample data, CI, and auto-scaling for segmenation CLI
- Loading branch information
1 parent
414b4cb
commit 9b3e7b5
Showing
7 changed files
with
272 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
pull_request: # run CI on commits to any open PR | ||
workflow_dispatch: # can manually trigger CI from GitHub actions tab | ||
|
||
|
||
jobs: | ||
test: | ||
name: ${{ matrix.os }} ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 60 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.11"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup micromamba | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: environment_cpu.yaml | ||
create-args: >- | ||
python=${{ matrix.python-version }} | ||
- name: Install SynapseNet | ||
shell: bash -l {0} | ||
run: pip install --no-deps -e . | ||
|
||
- name: Run tests | ||
shell: bash -l {0} | ||
run: python -m unittest discover -s test -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import os | ||
import pooch | ||
|
||
|
||
def get_sample_data(name: str) -> str: | ||
"""Get the filepath to SynapseNet sample data, stored as mrc file. | ||
Args: | ||
name: The name of the sample data. Currently, we only provide the 'tem_2d' sample data. | ||
Returns: | ||
The filepath to the downloaded sample data. | ||
""" | ||
registry = { | ||
"tem_2d.mrc": "3c6f9ff6d7673d9bf2fd46c09750c3c7dbb8fa1aa59dcdb3363b65cc774dcf28", | ||
} | ||
urls = { | ||
"tem_2d.mrc": "https://owncloud.gwdg.de/index.php/s/5sAQ0U4puAspcHg/download", | ||
} | ||
key = f"{name}.mrc" | ||
|
||
if key not in registry: | ||
valid_names = [k[:-4] for k in registry.keys()] | ||
raise ValueError(f"Invalid sample name {name}, please choose one of {valid_names}.") | ||
|
||
cache_dir = os.path.expanduser(pooch.os_cache("synapse-net")) | ||
data_registry = pooch.create( | ||
path=os.path.join(cache_dir, "sample_data"), | ||
base_url="", | ||
registry=registry, | ||
urls=urls, | ||
) | ||
file_path = data_registry.fetch(key) | ||
return file_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.