Skip to content

Commit

Permalink
start adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD committed Aug 27, 2024
1 parent 0c434b3 commit 4c5fa1e
Showing 1 changed file with 73 additions and 11 deletions.
84 changes: 73 additions & 11 deletions src/pynwb/ndx_microscopy/testing/_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def mock_Microscope(
*,
name: Optional[str] = None,
description: str = "This is a mock instance of a Microscope type to be used for rapid testing.",
description: str = "A mock instance of a Microscope type to be used for rapid testing.",
manufacturer: str = "A fake manufacturer of the mock microscope.",
model: str = "A fake model of the mock microscope.",
) -> ndx_microscopy.Microscope:
Expand All @@ -27,7 +27,7 @@ def mock_Microscope(
def mock_MicroscopyLightSource(
*,
name: Optional[str] = None,
description: str = "This is a mock instance of a MicroscopyLightSource type to be used for rapid testing.",
description: str = "A mock instance of a MicroscopyLightSource type to be used for rapid testing.",
manufacturer: str = "A fake manufacturer of the mock light source.",
model: str = "A fake model of the mock light source.",
filter_description: str = "A description about the fake filter used by the mock light source.",
Expand Down Expand Up @@ -57,7 +57,7 @@ def mock_MicroscopyLightSource(
def mock_MicroscopyOpticalChannel(
*,
name: Optional[str] = None,
description: str = "This is a mock instance of a MicroscopyOpticalChannel type to be used for rapid testing.",
description: str = "A mock instance of a MicroscopyOpticalChannel type to be used for rapid testing.",
indicator: str = "The indicator targeted by the mock optical channel.",
filter_description: str = "A description about the fake filter used by the mock optical channel.",
emission_wavelength_in_nm: float = 450.0,
Expand All @@ -76,7 +76,7 @@ def mock_PlanarImagingSpace(
*,
microscope: ndx_microscopy.Microscope,
name: Optional[str] = None,
description: str = "This is a mock instance of a PlanarImagingSpace type to be used for rapid testing.",
description: str = "A mock instance of a PlanarImagingSpace type to be used for rapid testing.",
origin_coordinates: Tuple[float, float, float] = (-1.2, -0.6, -2),
grid_spacing_in_um: Tuple[float, float, float] = (20, 20),
location: str = "The location targeted by the mock imaging space.",
Expand All @@ -98,7 +98,7 @@ def mock_VolumetricImagingSpace(
*,
microscope: ndx_microscopy.Microscope,
name: Optional[str] = None,
description: str = "This is a mock instance of a VolumetricImagingSpace type to be used for rapid testing.",
description: str = "A mock instance of a VolumetricImagingSpace type to be used for rapid testing.",
origin_coordinates: Tuple[float, float, float] = (-1.2, -0.6, -2),
grid_spacing_in_um: Tuple[float, float, float] = (20, 20, 50),
location: str = "The location targeted by the mock imaging space.",
Expand Down Expand Up @@ -140,7 +140,7 @@ def mock_MicroscopyPlaneSegmentation(
*,
imaging_space: ndx_microscopy.ImagingSpace,
name: Optional[str] = None,
description: str = "This is a mock instance of a MicroscopyPlaneSegmentation type to be used for rapid testing.",
description: str = "A mock instance of a MicroscopyPlaneSegmentation type to be used for rapid testing.",
number_of_rois: int = 5,
image_shape: Tuple[int, int] = (10, 10),
) -> ndx_microscopy.MicroscopyPlaneSegmentation:
Expand All @@ -166,7 +166,7 @@ def mock_PlanarMicroscopySeries(
imaging_space: ndx_microscopy.PlanarImagingSpace,
optical_channel: ndx_microscopy.MicroscopyOpticalChannel,
name: Optional[str] = None,
description: str = "This is a mock instance of a PlanarMicroscopySeries type to be used for rapid testing.",
description: str = "A mock instance of a PlanarMicroscopySeries type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
unit: str = "a.u.",
conversion: float = 1.0,
Expand Down Expand Up @@ -221,7 +221,7 @@ def mock_VariableDepthMicroscopySeries(
imaging_space: ndx_microscopy.PlanarImagingSpace,
optical_channel: ndx_microscopy.MicroscopyOpticalChannel,
name: Optional[str] = None,
description: str = "This is a mock instance of a PlanarMicroscopySeries type to be used for rapid testing.",
description: str = "A mock instance of a PlanarMicroscopySeries type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
depth_per_frame_in_um: Optional[np.ndarray] = None,
unit: str = "a.u.",
Expand Down Expand Up @@ -284,7 +284,7 @@ def mock_VolumetricMicroscopySeries(
imaging_space: ndx_microscopy.VolumetricImagingSpace,
optical_channel: ndx_microscopy.MicroscopyOpticalChannel,
name: Optional[str] = None,
description: str = "This is a mock instance of a VolumetricMicroscopySeries type to be used for rapid testing.",
description: str = "A mock instance of a VolumetricMicroscopySeries type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
unit: str = "a.u.",
conversion: float = 1.0,
Expand Down Expand Up @@ -339,7 +339,7 @@ def mock_MultiChannelMicroscopyVolume(
light_sources: pynwb.base.VectorData,
optical_channels: pynwb.base.VectorData,
name: Optional[str] = None,
description: str = "This is a mock instance of a MultiChannelMicroscopyVolume type to be used for rapid testing.",
description: str = "A mock instance of a MultiChannelMicroscopyVolume type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
unit: str = "n.a.",
conversion: float = 1.0,
Expand All @@ -363,14 +363,76 @@ def mock_MultiChannelMicroscopyVolume(
return volumetric_microscopy_series


def mock_MicroscopyResponseSeries(
*,
table_region: pynwb.core.DynamicTableRegion,
name: Optional[str] = None,
description: str = "A mock instance of a MicroscopyResponseSeries type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
unit: str = "a.u.",
conversion: float = 1.0,
offset: float = 0.0,
starting_time: Optional[float] = None,
rate: Optional[float] = None,
timestamps: Optional[np.ndarray] = None,
) -> ndx_microscopy.MicroscopyResponseSeries:
series_name = name or name_generator("MicroscopyResponseSeries")

response_series = ndx_microscopy.MicroscopyResponseSeries(
name=series_name,
description=description,
table_region=table_region,
data=data,
unit=unit,
conversion=conversion,
offset=offset,
starting_time=starting_time,
rate=rate,
timestamps=timestamps,
)

return response_series


def mock_MicroscopyResponseSeriesContainer(
*,
table_region: pynwb.core.DynamicTableRegion,
name: Optional[str] = None,
description: str = "A mock instance of a MicroscopyResponseSeriesContainer type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
unit: str = "a.u.",
conversion: float = 1.0,
offset: float = 0.0,
starting_time: Optional[float] = None,
rate: Optional[float] = None,
timestamps: Optional[np.ndarray] = None,
) -> ndx_microscopy.MicroscopyResponseSeriesContainer:
series_name = name or name_generator("MicroscopyResponseSeries")

response_series = ndx_microscopy.MicroscopyResponseSeries(
name=series_name,
description=description,
table_region=table_region,
data=data,
unit=unit,
conversion=conversion,
offset=offset,
starting_time=starting_time,
rate=rate,
timestamps=timestamps,
)

return response_series


def mock_VariableDepthMultiChannelMicroscopyVolume(
*,
microscope: ndx_microscopy.Microscope,
imaging_space: ndx_microscopy.VolumetricImagingSpace,
light_sources: pynwb.base.VectorData,
optical_channels: pynwb.base.VectorData,
name: Optional[str] = None,
description: str = "This is a mock instance of a MultiChannelMicroscopyVolume type to be used for rapid testing.",
description: str = "A mock instance of a MultiChannelMicroscopyVolume type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
depth_per_frame_in_um: Optional[np.ndarray] = None,
unit: str = "n.a.",
Expand Down

0 comments on commit 4c5fa1e

Please sign in to comment.