Skip to content

Commit

Permalink
Update tests to handle data changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgadling committed Jan 31, 2024
1 parent ad618c2 commit b0c025c
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/napari_cryoet_data_portal/_sample_data.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from typing import List

import numpy as np
from npe2.types import FullLayerData
from cryoet_data_portal import Client, Tomogram, TomogramVoxelSpacing
from npe2.types import FullLayerData

from napari_cryoet_data_portal import (
read_annotation,
read_tomogram,
)
from napari_cryoet_data_portal import read_annotation, read_tomogram


def tomogram_10000_ts_026() -> List[FullLayerData]:
Expand All @@ -22,9 +19,13 @@ def tomogram_10000_ts_027() -> List[FullLayerData]:

def _read_tomogram_from_10000(name: str) -> List[FullLayerData]:
client = Client()

tomogram_spacing_url = f"https://files.cryoetdataportal.cziscience.com/10000/{name}/Tomograms/VoxelSpacing13.480/"
tomogram_spacing = next(TomogramVoxelSpacing.find(client, [TomogramVoxelSpacing.https_prefix == tomogram_spacing_url]))
tomogram_spacing = next(
TomogramVoxelSpacing.find(
client, [TomogramVoxelSpacing.https_prefix == tomogram_spacing_url]
)
)

tomogram: Tomogram = next(tomogram_spacing.tomograms)

Expand All @@ -34,8 +35,18 @@ def _read_tomogram_from_10000(name: str) -> List[FullLayerData]:
tomogram_image[1]["scale"] = (4, 4, 4)

annotations = tuple(tomogram_spacing.annotations)
ribosome_points = read_annotation(annotations[0], tomogram=tomogram)
fatty_acid_points = read_annotation(annotations[1], tomogram=tomogram)
ribosome_annotations = [
item
for item in annotations
if item.object_name.lower() == "cytosolic ribosome"
].pop()
fas_annotations = [
item
for item in annotations
if item.object_name.lower() == "fatty acid synthase"
].pop()
ribosome_points = read_annotation(ribosome_annotations, tomogram=tomogram)
fatty_acid_points = read_annotation(fas_annotations, tomogram=tomogram)

return [
tomogram_image,
Expand Down

0 comments on commit b0c025c

Please sign in to comment.