diff --git a/synapse_net/inference/inference.py b/synapse_net/inference/inference.py index fd0ee676..e1abd1d1 100644 --- a/synapse_net/inference/inference.py +++ b/synapse_net/inference/inference.py @@ -112,6 +112,8 @@ def get_model_training_resolution(model_type: str) -> Dict[str, float]: "active_zone": {"x": 1.38, "y": 1.38, "z": 1.38}, "compartments": {"x": 3.47, "y": 3.47, "z": 3.47}, "mitochondria": {"x": 2.07, "y": 2.07, "z": 2.07}, + # TODO: this is just copied from the previous mito model, it may be necessary to update this. + "mitochondria2": {"x": 2.07, "y": 2.07, "z": 2.07}, "cristae": {"x": 1.44, "y": 1.44, "z": 1.44}, "ribbon": {"x": 1.188, "y": 1.188, "z": 1.188}, "vesicles_2d": {"x": 1.35, "y": 1.35}, diff --git a/test/test_inference.py b/test/test_inference.py index 4d4512d3..571db1b0 100644 --- a/test/test_inference.py +++ b/test/test_inference.py @@ -4,6 +4,7 @@ from shutil import rmtree import imageio.v3 as imageio +import requests from synapse_net.file_utils import read_mrc from synapse_net.sample_data import get_sample_data @@ -23,6 +24,26 @@ def tearDown(self): except OSError: pass + # Test that all models can be accessed by pooch and have the necessary resolution information. + def test_models(self): + from synapse_net.inference.inference import _get_model_registry, get_model_training_resolution + + def check_url(url): + try: + # Make a HEAD request to the URL, which fetches HTTP headers but no content. + response = requests.head(url, allow_redirects=True) + # Check if the HTTP status code is one that indicates availability (200 <= code < 400). + return response.status_code < 400 + except requests.RequestException: + # Handle connection exceptions + return False + + registry = _get_model_registry() + for name in registry.registry.keys(): + url_exists = check_url(registry.get_url(name)) + self.assertTrue(url_exists) + get_model_training_resolution(name) + def test_run_segmentation(self): from synapse_net.inference import run_segmentation, get_model