Skip to content

Commit

Permalink
Made some changes for PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
kdreher authored Sep 23, 2022
1 parent 373c3ea commit ab72fc7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions simpa_tests/automatic_tests/device_tests/test_field_of_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
import unittest
from simpa.core.device_digital_twins.detection_geometries.detection_geometry_base import DetectionGeometryBase
from simpa.log.file_logger import Logger
from simpa.utils import Settings, Tags
from simpa.core.device_digital_twins.detection_geometries.linear_array import LinearArrayDetectionGeometry
from simpa.core.simulation_modules.reconstruction_module.reconstruction_utils import compute_image_dimensions
from simpa.core.device_digital_twins.pa_devices.ithera_msot_acuity import MSOTAcuityEcho
import numpy as np


class TestFieldOfView(unittest.TestCase):

def setUp(self):
msot = MSOTAcuityEcho()
self.detection_geometry = msot.get_detection_geometry()
self.odd_detection_geometry = LinearArrayDetectionGeometry(device_position_mm=[0,0,0],
self.odd_detection_geometry = LinearArrayDetectionGeometry(device_position_mm=[0, 0, 0],
number_detector_elements=99)
self.logger = Logger()

Expand Down Expand Up @@ -46,7 +45,7 @@ def symmetric_test(self):
self.assertAlmostEqual(zdim_end, 0)

def symmetric_test_with_small_spacing(self):
image_dimensions = self._test([-25,25,0,0,-12,8], 0.1, self.detection_geometry)
image_dimensions = self._test([-25, 25, 0, 0, -12, 8], 0.1, self.detection_geometry)
xdim, zdim, ydim, xdim_start, xdim_end, ydim_start, ydim_end, zdim_start, zdim_end = image_dimensions

assert zdim == 1, "With no FOV extend in z dimension only one slice should be created"
Expand All @@ -60,7 +59,7 @@ def symmetric_test_with_small_spacing(self):
self.assertAlmostEqual(zdim_end, 0)

def unsymmetric_test_with_small_spacing(self):
image_dimensions = self._test([-25,24.9,0,0,-12,8], 0.1, self.detection_geometry)
image_dimensions = self._test([-25, 24.9, 0, 0, -12, 8], 0.1, self.detection_geometry)
xdim, zdim, ydim, xdim_start, xdim_end, ydim_start, ydim_end, zdim_start, zdim_end = image_dimensions

assert zdim == 1, "With no FOV extend in z dimension only one slice should be created"
Expand All @@ -74,7 +73,7 @@ def unsymmetric_test_with_small_spacing(self):
self.assertAlmostEqual(zdim_end, 0)

def unsymmetric_test(self):
image_dimensions = self._test([-25,24.9,0,0,-12,8], 0.2, self.detection_geometry)
image_dimensions = self._test([-25, 24.9, 0, 0, -12, 8], 0.2, self.detection_geometry)
xdim, zdim, ydim, xdim_start, xdim_end, ydim_start, ydim_end, zdim_start, zdim_end = image_dimensions

assert zdim == 1, "With no FOV extend in z dimension only one slice should be created"
Expand All @@ -91,7 +90,7 @@ def symmetric_test_with_odd_number_of_elements(self):
"""
The number of sensor elements should not affect the image dimensionality
"""
image_dimensions = self._test([-25,25,0,0,-12,8], 0.2, self.odd_detection_geometry)
image_dimensions = self._test([-25, 25, 0, 0, -12, 8], 0.2, self.odd_detection_geometry)
xdim, zdim, ydim, xdim_start, xdim_end, ydim_start, ydim_end, zdim_start, zdim_end = image_dimensions

assert zdim == 1, "With no FOV extend in z dimension only one slice should be created"
Expand All @@ -104,11 +103,12 @@ def symmetric_test_with_odd_number_of_elements(self):
self.assertAlmostEqual(zdim_start, 0)
self.assertAlmostEqual(zdim_end, 0)


if __name__ == '__main__':
test = TestFieldOfView()
test.setUp()
test.symmetric_test()
test.symmetric_test_with_small_spacing()
test.unsymmetric_test_with_small_spacing()
test.unsymmetric_test()
test.symmetric_test_with_odd_number_of_elements()
test.symmetric_test_with_odd_number_of_elements()

0 comments on commit ab72fc7

Please sign in to comment.