3939import unittest .mock
4040from queue import Queue
4141
42- import numpy
42+ import numpy as np
4343
4444import microscope
4545import microscope .testsuite .devices as dummies
@@ -280,7 +280,7 @@ class DeformableMirrorTests(DeviceTests):
280280 """
281281
282282 def assertCurrentPattern (self , expected_pattern , msg = "" ):
283- numpy .testing .assert_array_equal (
283+ np .testing .assert_array_equal (
284284 self .fake .get_current_pattern (), expected_pattern , msg
285285 )
286286
@@ -290,39 +290,39 @@ def test_get_number_of_actuators(self):
290290 self .assertEqual (self .device .n_actuators , self .planned_n_actuators )
291291
292292 def test_applying_pattern (self ):
293- pattern = numpy .full ((self .planned_n_actuators ,), 0.2 )
293+ pattern = np .full ((self .planned_n_actuators ,), 0.2 )
294294 self .device .apply_pattern (pattern )
295295 self .assertCurrentPattern (pattern )
296296
297297 def test_out_of_range_pattern (self ):
298298 # While we expect values in the [0 1] range, we should not
299299 # actually be checking for that.
300- pattern = numpy .zeros ((self .planned_n_actuators ,))
300+ pattern = np .zeros ((self .planned_n_actuators ,))
301301 for v in [- 1000 , - 1 , 0 , 1 , 3 ]:
302302 pattern [:] = v
303303 self .device .apply_pattern (pattern )
304304 self .assertCurrentPattern (pattern )
305305
306306 def test_software_triggering (self ):
307307 n_patterns = 5
308- patterns = numpy .random .rand (n_patterns , self .planned_n_actuators )
308+ patterns = np .random .rand (n_patterns , self .planned_n_actuators )
309309 self .device .queue_patterns (patterns )
310310 for i in range (n_patterns ):
311311 self .device .next_pattern ()
312312 self .assertCurrentPattern (patterns [i ])
313313
314314 def test_validate_pattern_too_long (self ):
315- patterns = numpy .zeros ((self .planned_n_actuators + 1 ))
315+ patterns = np .zeros ((self .planned_n_actuators + 1 ))
316316 with self .assertRaisesRegex (Exception , "length of second dimension" ):
317317 self .device .apply_pattern (patterns )
318318
319319 def test_validate_pattern_swapped_dimensions (self ):
320- patterns = numpy .zeros ((self .planned_n_actuators , 1 ))
320+ patterns = np .zeros ((self .planned_n_actuators , 1 ))
321321 with self .assertRaisesRegex (Exception , "length of second dimension" ):
322322 self .device .apply_pattern (patterns )
323323
324324 def test_validate_pattern_with_extra_dimension (self ):
325- patterns = numpy .zeros ((2 , 1 , self .planned_n_actuators ))
325+ patterns = np .zeros ((2 , 1 , self .planned_n_actuators ))
326326 with self .assertRaisesRegex (
327327 Exception , "dimensions \\ (must be 1 or 2\\ )"
328328 ):
@@ -444,7 +444,7 @@ def test_non_square_patterns_shape(self):
444444
445445class TestStageAwareCamera (unittest .TestCase , CameraTests ):
446446 def setUp (self ):
447- image = numpy .full ((3000 , 1500 , 1 ), 42 , dtype = numpy .uint8 )
447+ image = np .full ((3000 , 1500 , 1 ), 42 , dtype = np .uint8 )
448448 self .sensor_shape = (128 , 128 )
449449 self .stage = simulators .SimulatedStage (
450450 {
0 commit comments