Skip to content

Commit 370c975

Browse files
Update type assertions to use Image class
1 parent ca597a8 commit 370c975

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

deeptrack/test/test_aberrations.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def testGaussianApodization(self):
3131

3232
for z in (-100, 0, 100):
3333
im = aberrated_particle.resolve(z=z)
34-
self.assertIsInstance(im, np.ndarray)
34+
self.assertIsInstance(im, Image)
3535
self.assertEqual(im.shape, (64, 48, 1))
3636

3737
aberrated_particle.store_properties(True)
@@ -53,7 +53,7 @@ def testPiston(self):
5353
aberrated_particle = aberrated_optics(self.particle)
5454
for z in (-100, 0, 100):
5555
im = aberrated_particle.resolve(z=z)
56-
self.assertIsInstance(im, np.ndarray)
56+
self.assertIsInstance(im, Image)
5757
self.assertEqual(im.shape, (64, 48, 1))
5858

5959
aberrated_particle.store_properties(True)
@@ -75,7 +75,7 @@ def testVerticalTilt(self):
7575
aberrated_particle = aberrated_optics(self.particle)
7676
for z in (-100, 0, 100):
7777
im = aberrated_particle.resolve(z=z)
78-
self.assertIsInstance(im, np.ndarray)
78+
self.assertIsInstance(im, Image)
7979
self.assertEqual(im.shape, (64, 48, 1))
8080

8181
aberrated_particle.store_properties(True)
@@ -97,7 +97,7 @@ def testHorizontalTilt(self):
9797
aberrated_particle = aberrated_optics(self.particle)
9898
for z in (-100, 0, 100):
9999
im = aberrated_particle.resolve(z=z)
100-
self.assertIsInstance(im, np.ndarray)
100+
self.assertIsInstance(im, Image)
101101
self.assertEqual(im.shape, (64, 48, 1))
102102

103103
aberrated_particle.store_properties(True)
@@ -119,7 +119,7 @@ def testObliqueAstigmatism(self):
119119
aberrated_particle = aberrated_optics(self.particle)
120120
for z in (-100, 0, 100):
121121
im = aberrated_particle.resolve(z=z)
122-
self.assertIsInstance(im, np.ndarray)
122+
self.assertIsInstance(im, Image)
123123
self.assertEqual(im.shape, (64, 48, 1))
124124

125125
aberrated_particle.store_properties(True)
@@ -141,7 +141,7 @@ def testDefocus(self):
141141
aberrated_particle = aberrated_optics(self.particle)
142142
for z in (-100, 0, 100):
143143
im = aberrated_particle.resolve(z=z)
144-
self.assertIsInstance(im, np.ndarray)
144+
self.assertIsInstance(im, Image)
145145
self.assertEqual(im.shape, (64, 48, 1))
146146

147147
aberrated_particle.store_properties(True)
@@ -163,7 +163,7 @@ def testAstigmatism(self):
163163
aberrated_particle = aberrated_optics(self.particle)
164164
for z in (-100, 0, 100):
165165
im = aberrated_particle.resolve(z=z)
166-
self.assertIsInstance(im, np.ndarray)
166+
self.assertIsInstance(im, Image)
167167
self.assertEqual(im.shape, (64, 48, 1))
168168

169169
aberrated_particle.store_properties(True)
@@ -185,7 +185,7 @@ def testObliqueTrefoil(self):
185185
aberrated_particle = aberrated_optics(self.particle)
186186
for z in (-100, 0, 100):
187187
im = aberrated_particle.resolve(z=z)
188-
self.assertIsInstance(im, np.ndarray)
188+
self.assertIsInstance(im, Image)
189189
self.assertEqual(im.shape, (64, 48, 1))
190190

191191
aberrated_particle.store_properties(True)
@@ -207,7 +207,7 @@ def testVerticalComa(self):
207207
aberrated_particle = aberrated_optics(self.particle)
208208
for z in (-100, 0, 100):
209209
im = aberrated_particle.resolve(z=z)
210-
self.assertIsInstance(im, np.ndarray)
210+
self.assertIsInstance(im, Image)
211211
self.assertEqual(im.shape, (64, 48, 1))
212212

213213
aberrated_particle.store_properties(True)
@@ -229,7 +229,7 @@ def testHorizontalComa(self):
229229
aberrated_particle = aberrated_optics(self.particle)
230230
for z in (-100, 0, 100):
231231
im = aberrated_particle.resolve(z=z)
232-
self.assertIsInstance(im, np.ndarray)
232+
self.assertIsInstance(im, Image)
233233
self.assertEqual(im.shape, (64, 48, 1))
234234

235235
aberrated_particle.store_properties(True)
@@ -251,7 +251,7 @@ def testTrefoil(self):
251251
aberrated_particle = aberrated_optics(self.particle)
252252
for z in (-100, 0, 100):
253253
im = aberrated_particle.resolve(z=z)
254-
self.assertIsInstance(im, np.ndarray)
254+
self.assertIsInstance(im, Image)
255255
self.assertEqual(im.shape, (64, 48, 1))
256256

257257
aberrated_particle.store_properties(True)
@@ -273,7 +273,7 @@ def testSphericalAberration(self):
273273
aberrated_particle = aberrated_optics(self.particle)
274274
for z in (-100, 0, 100):
275275
im = aberrated_particle.resolve(z=z)
276-
self.assertIsInstance(im, np.ndarray)
276+
self.assertIsInstance(im, Image)
277277
self.assertEqual(im.shape, (64, 48, 1))
278278

279279
aberrated_particle.store_properties(True)

deeptrack/test/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_Image_not_store(self):
275275
particle = self.Particle(position=(128, 128))
276276
input_image = Image(np.zeros((256, 256)))
277277
output_image = particle.resolve(input_image)
278-
self.assertIsInstance(output_image, np.ndarray)
278+
self.assertIsInstance(output_image, Image)
279279

280280
def test_Image_properties(self):
281281
particle = self.Particle(position=(128, 128))

deeptrack/test/test_noises.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,30 @@ def test_Offset(self):
1515
noise = noises.Offset(offset=0.5)
1616
input_image = Image(np.zeros((256, 256)))
1717
output_image = noise.resolve(input_image)
18-
self.assertIsInstance(output_image, np.ndarray)
18+
self.assertIsInstance(output_image, Image)
1919
self.assertEqual(output_image.shape, (256, 256))
2020
self.assertTrue(np.all(np.array(output_image) == 0.5))
2121

2222
def test_Background(self):
2323
noise = noises.Background(offset=0.5)
2424
input_image = Image(np.zeros((256, 256)))
2525
output_image = noise.resolve(input_image)
26-
self.assertIsInstance(output_image, np.ndarray)
26+
self.assertIsInstance(output_image, Image)
2727
self.assertEqual(output_image.shape, (256, 256))
2828
self.assertTrue(np.all(np.array(output_image) == 0.5))
2929

3030
def test_Gaussian(self):
3131
noise = noises.Gaussian(mu=0.1, sigma=0.05)
3232
input_image = Image(np.zeros((256, 256)))
3333
output_image = noise.resolve(input_image)
34-
self.assertIsInstance(output_image, np.ndarray)
34+
self.assertIsInstance(output_image, Image)
3535
self.assertEqual(output_image.shape, (256, 256))
3636

3737
def test_Poisson(self):
3838
noise = noises.Poisson(snr=20)
3939
input_image = Image(np.ones((256, 256)) * 0.1)
4040
output_image = noise.resolve(input_image)
41-
self.assertIsInstance(output_image, np.ndarray)
41+
self.assertIsInstance(output_image, Image)
4242
self.assertEqual(output_image.shape, (256, 256))
4343

4444

deeptrack/test/test_optics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_Fluorescence(self):
3535
)
3636
imaged_scatterer = microscope(scatterer)
3737
output_image = imaged_scatterer.resolve()
38-
self.assertIsInstance(output_image, np.ndarray)
38+
self.assertIsInstance(output_image, Image)
3939
self.assertEqual(output_image.shape, (64, 64, 1))
4040

4141
def test_Brightfield(self):
@@ -57,7 +57,7 @@ def test_Brightfield(self):
5757
)
5858
imaged_scatterer = microscope(scatterer)
5959
output_image = imaged_scatterer.resolve()
60-
self.assertIsInstance(output_image, np.ndarray)
60+
self.assertIsInstance(output_image, Image)
6161
self.assertEqual(output_image.shape, (64, 64, 1))
6262

6363
def test_IlluminationGradient(self):
@@ -81,7 +81,7 @@ def test_IlluminationGradient(self):
8181
)
8282
imaged_scatterer = microscope(scatterer)
8383
output_image = imaged_scatterer.resolve()
84-
self.assertIsInstance(output_image, np.ndarray)
84+
self.assertIsInstance(output_image, Image)
8585
self.assertEqual(output_image.shape, (64, 64, 1))
8686

8787
def test_upscale_fluorescence(self):

deeptrack/test/test_scatterers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_PointParticle(self):
2828
)
2929
imaged_scatterer = optics(scatterer)
3030
output_image = imaged_scatterer.resolve()
31-
self.assertIsInstance(output_image, np.ndarray)
31+
self.assertIsInstance(output_image, Image)
3232
self.assertEqual(output_image.shape, (64, 64, 1))
3333

3434
def test_Ellipse(self):
@@ -49,7 +49,7 @@ def test_Ellipse(self):
4949
)
5050
imaged_scatterer = optics(scatterer)
5151
output_image = imaged_scatterer.resolve()
52-
self.assertIsInstance(output_image, np.ndarray)
52+
self.assertIsInstance(output_image, Image)
5353
self.assertEqual(output_image.shape, (64, 64, 1))
5454

5555
def test_EllipseUpscale(self):
@@ -147,7 +147,7 @@ def test_Sphere(self):
147147
)
148148
imaged_scatterer = optics(scatterer)
149149
output_image = imaged_scatterer.resolve()
150-
self.assertIsInstance(output_image, np.ndarray)
150+
self.assertIsInstance(output_image, Image)
151151
self.assertEqual(output_image.shape, (64, 64, 1))
152152

153153
def test_SphereUpscale(self):
@@ -189,7 +189,7 @@ def test_Ellipsoid(self):
189189
)
190190
imaged_scatterer = optics(scatterer)
191191
output_image = imaged_scatterer.resolve()
192-
self.assertIsInstance(output_image, np.ndarray)
192+
self.assertIsInstance(output_image, Image)
193193
self.assertEqual(output_image.shape, (64, 64, 1))
194194

195195
def test_EllipsoidUpscale(self):

0 commit comments

Comments
 (0)