Skip to content

Commit

Permalink
move imzml code into a dedicated package
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Jul 5, 2024
1 parent f3e7c42 commit a8c341a
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/depiction/persistence/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .imzml_mode_enum import ImzmlModeEnum
from .imzml_read_file import ImzmlReadFile
from .imzml_reader import ImzmlReader
from .imzml_write_file import ImzmlWriteFile
from .imzml_writer import ImzmlWriter
from depiction.persistence.imzml.imzml_mode_enum import ImzmlModeEnum
from depiction.persistence.imzml.imzml_read_file import ImzmlReadFile
from depiction.persistence.imzml.imzml_reader import ImzmlReader
from depiction.persistence.imzml.imzml_write_file import ImzmlWriteFile
from depiction.persistence.imzml.imzml_writer import ImzmlWriter
from .ram_read_file import RamReadFile
from .ram_reader import RamReader

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from numpy.typing import NDArray

from depiction.persistence.file_checksums import FileChecksums
from depiction.persistence.imzml_mode_enum import ImzmlModeEnum
from depiction.persistence.imzml_reader import ImzmlReader
from depiction.persistence.imzml.imzml_mode_enum import ImzmlModeEnum
from depiction.persistence.imzml.imzml_reader import ImzmlReader
from depiction.persistence.pixel_size import PixelSize


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import pyimzml.ImzMLParser

from depiction.persistence.imzml_mode_enum import ImzmlModeEnum
from depiction.persistence.imzml.imzml_mode_enum import ImzmlModeEnum

if TYPE_CHECKING:
from types import TracebackType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from pathlib import Path
from typing import TYPE_CHECKING

from depiction.persistence.imzml_writer import ImzmlWriter
from depiction.persistence.imzml.imzml_writer import ImzmlWriter

if TYPE_CHECKING:
from depiction.persistence.imzml_mode_enum import ImzmlModeEnum
from depiction.persistence.imzml.imzml_mode_enum import ImzmlModeEnum


class ImzmlWriteFile:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import pyimzml.ImzMLWriter
from tqdm import tqdm

from depiction.persistence.imzml_alignment_tracker import ImzmlAlignmentTracker
from depiction.persistence.imzml_mode_enum import ImzmlModeEnum
from depiction.persistence.imzml.imzml_alignment_tracker import ImzmlAlignmentTracker
from depiction.persistence.imzml.imzml_mode_enum import ImzmlModeEnum

if TYPE_CHECKING:
from collections.abc import Sequence
import numpy as np
from depiction.persistence.imzml_reader import ImzmlReader
from depiction.persistence.imzml.imzml_reader import ImzmlReader


class ImzmlWriter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from loguru import logger
from pydantic import ValidationError

from depiction.persistence.extract_metadata import ExtractMetadata, Metadata
from depiction.persistence.imzml.extract_metadata import ExtractMetadata, Metadata
from depiction.persistence.pixel_size import PixelSize


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import typer
import xarray

from depiction.persistence.extract_metadata import Metadata
from depiction.persistence.imzml.extract_metadata import Metadata
from depiction.persistence.format_ome_tiff import OmeTiff


Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_metadata_checksums_when_both_checksums_available(mocker: MockerFixture,


def test_ibd_checksums(mocker: MockerFixture, mock_read_file: ImzmlReadFile) -> None:
mock_file_checksums = mocker.patch("depiction.persistence.imzml_read_file.FileChecksums")
mock_file_checksums = mocker.patch("depiction.persistence.imzml.imzml_read_file.FileChecksums")
assert mock_file_checksums.return_value == mock_read_file.ibd_checksums
mock_file_checksums.assert_called_once_with(file_path=mock_read_file.ibd_file)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def test_get_spectra_mz_range_when_none(self, mock_get_spectrum_mz) -> None:
self.assertTupleEqual((0.5, 6), mz_range)
self.assertListEqual([call(0), call(1), call(2)], mock_get_spectrum_mz.mock_calls)

@patch("depiction.persistence.imzml_reader.pyimzml.ImzMLParser.ImzMLParser")
@patch("depiction.persistence.imzml.imzml_reader.pyimzml.ImzMLParser.ImzMLParser")
def test_parse_imzml(self, module_imzml_parser) -> None:
mock_path = MagicMock(name="mock_path", spec=[])
mock_portable_spectrum_reader = MagicMock(name="mock_portable_spectrum_reader")
Expand Down
File renamed without changes.

0 comments on commit a8c341a

Please sign in to comment.