Skip to content

Commit

Permalink
Tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgadling committed Oct 21, 2024
1 parent 1aa878a commit b8cea01
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
7 changes: 5 additions & 2 deletions ingestion_tools/scripts/tests/db_import/populate_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def populate_stale_tomogram_voxel_spacing(run_id: int = RUN1_ID) -> None:
TomogramAuthor.create(tomogram_id=stale_tomogram.id, name="John John", author_list_order=2)
stale_annotation = Annotation.create(
tomogram_voxel_spacing_id=stale_voxel_spacing.id,
deposition_id=DEPOSITION_ID2,
s3_metadata_path="foo",
https_metadata_path="foo",
deposition_date="2025-04-01",
Expand Down Expand Up @@ -342,14 +343,15 @@ def populate_annotations() -> None:
Annotation.create(
id=ANNOTATION_ID,
tomogram_voxel_spacing_id=TOMOGRAM_VOXEL_ID1,
deposition_id=DEPOSITION_ID2,
s3_metadata_path="s3://test-public-bucket/30001/RUN1/Tomograms/VoxelSpacing12.300/Annotations/100-foo-1.0.json",
https_metadata_path="foo",
deposition_date="2025-04-01",
release_date="2025-06-01",
last_modified_date="2025-06-01",
annotation_method="",
annotation_method="2D CNN predictions",
ground_truth_status=False,
object_name="bar",
object_name="foo",
object_count=0,
object_id="invalid-id",
annotation_software="bar",
Expand All @@ -360,6 +362,7 @@ def populate_stale_annotations() -> None:
Annotation.create(
id=STALE_ANNOTATION_ID,
tomogram_voxel_spacing_id=TOMOGRAM_VOXEL_ID1,
deposition_id=DEPOSITION_ID2,
s3_metadata_path="foo",
https_metadata_path="foo",
deposition_date="2025-04-01",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@pytest.fixture
def expected_annotations(http_prefix: str) -> list[dict[str, Any]]:
path = f"{DATASET_ID}/RUN1/Tomograms/VoxelSpacing12.300/Annotations/100-foo-1.0.json"
path = f"{DATASET_ID}/RUN1/Reconstructions/VoxelSpacing12.300/Annotations/100/foo-1.0.json"
return [
{
"id": ANNOTATION_ID,
Expand All @@ -43,12 +43,12 @@ def expected_annotations(http_prefix: str) -> list[dict[str, Any]]:
{
"link": "https://fake-link.com/resources/100-foo-1.0_method.pdf",
"link_type": "documentation",
"name": "Method Documentation",
"custom_name": "Method Documentation",
},
{
"link": "https://another-link.com/100-foo-1.0_code.zip",
"link_type": "source_code",
"name": "Source Code",
"custom_name": "Source Code",
},
],
},
Expand All @@ -57,7 +57,7 @@ def expected_annotations(http_prefix: str) -> list[dict[str, Any]]:

@pytest.fixture
def expected_annotation_files(http_prefix: str) -> list[dict[str, Any]]:
path = f"{DATASET_ID}/RUN1/Tomograms/VoxelSpacing12.300/Annotations/"
path = f"{DATASET_ID}/RUN1/Reconstructions/VoxelSpacing12.300/Annotations/"
return [
{
"id": ANNOTATION_FILE_ID,
Expand Down
30 changes: 18 additions & 12 deletions ingestion_tools/scripts/tests/db_import/test_db_tomo_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def expected_tomograms_by_run(http_prefix: str) -> dict[str, dict[float, list[di
"processing_software": "tomo3D",
"tomogram_version": "1",
"is_canonical": True,
"s3_omezarr_dir": f"s3://test-public-bucket/{run1_vs_path}CanonicalTomogram/RUN1.zarr",
"https_omezarr_dir": f"{http_prefix}/{run1_vs_path}CanonicalTomogram/RUN1.zarr",
"s3_mrc_scale0": f"s3://test-public-bucket/{run1_vs_path}CanonicalTomogram/RUN1.mrc",
"https_mrc_scale0": f"{http_prefix}/{run1_vs_path}CanonicalTomogram/RUN1.mrc",
"s3_omezarr_dir": f"s3://test-public-bucket/{run1_vs_path}Tomograms/100/RUN1.zarr",
"https_omezarr_dir": f"{http_prefix}/{run1_vs_path}Tomograms/100/RUN1.zarr",
"s3_mrc_scale0": f"s3://test-public-bucket/{run1_vs_path}Tomograms/100/RUN1.mrc",
"https_mrc_scale0": f"{http_prefix}/{run1_vs_path}Tomograms/100/RUN1.mrc",
"scale0_dimensions": "980,1016,500",
"scale1_dimensions": "490,508,250",
"scale2_dimensions": "245,254,125",
Expand All @@ -85,11 +85,11 @@ def expected_tomograms_by_run(http_prefix: str) -> dict[str, dict[float, list[di
[0, 0, 1, 0],
[0, 0, 0, 1],
],
"key_photo_url": f"{http_prefix}/{run1_vs_path}KeyPhotos/key-photo-snapshot.png",
"key_photo_thumbnail_url": f"{http_prefix}/{run1_vs_path}KeyPhotos/key-photo-thumbnail.png",
"key_photo_url": f"{http_prefix}/{run1_vs_path}Images/key-photo-snapshot.png",
"key_photo_thumbnail_url": f"{http_prefix}/{run1_vs_path}Images/key-photo-thumbnail.png",
"neuroglancer_config": '{"foo":"bar","baz":"test"}',
"type": "CANONICAL",
"deposition_id": 301,
"deposition_id": 300,
}
run2_tomo = {
"name": "RUN2",
Expand All @@ -102,19 +102,25 @@ def expected_tomograms_by_run(http_prefix: str) -> dict[str, dict[float, list[di
"reconstruction_software": "Unknown",
"processing": "filtered",
"tomogram_version": "1",
"affine_transformation_matrix": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1],
],
"is_canonical": True,
"s3_omezarr_dir": f"s3://test-public-bucket/{run2_vs_path}CanonicalTomogram/RUN2.zarr",
"https_omezarr_dir": f"{http_prefix}/{run2_vs_path}CanonicalTomogram/RUN2.zarr",
"s3_mrc_scale0": f"s3://test-public-bucket/{run2_vs_path}CanonicalTomogram/RUN2.mrc",
"https_mrc_scale0": f"{http_prefix}/{run2_vs_path}CanonicalTomogram/RUN2.mrc",
"s3_omezarr_dir": f"s3://test-public-bucket/{run2_vs_path}Tomograms/100/RUN2.zarr",
"https_omezarr_dir": f"{http_prefix}/{run2_vs_path}Tomograms/100/RUN2.zarr",
"s3_mrc_scale0": f"s3://test-public-bucket/{run2_vs_path}Tomograms/100/RUN2.mrc",
"https_mrc_scale0": f"{http_prefix}/{run2_vs_path}Tomograms/100/RUN2.mrc",
"scale0_dimensions": "800,800,400",
"scale1_dimensions": "400,400,200",
"scale2_dimensions": "200,200,100",
"ctf_corrected": False,
"offset_x": 0,
"offset_y": 0,
"offset_z": 0,
"neuroglancer_config": "{}",
"neuroglancer_config": '{"foo":"bar","baz":"test"}',
"type": "CANONICAL",
"deposition_id": 300,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"last_modified_date": "2022-09-02",
"release_date": "2022-06-01"
},
"alignment_metadata_path": "test-public-bucket/30001/RUN2/Alignments/100/alignment_metadata.json",
"neuroglancer_config_path": "test-public-bucket/30001/RUN2/Reconstructions/VoxelSpacing13.480/NeuroglancerPrecompute/100-neuroglancer_config.json",
"alignment_metadata_path": null,
"neuroglancer_config_path": null,
"last_updated_at": 1728676818
}

0 comments on commit b8cea01

Please sign in to comment.