Ejemplo n.º 1
0
 def test_works_on_xyz_with_scale(self):
     tuning_transformer = TuningTransformer(scale=0.5)
     self.assertEquals([0.75, 0.75],
                       tuning_transformer.transform([1.0, 1.0, 1.0]))
     self.assertEquals([0.5, 0.5],
                       tuning_transformer.transform([0.5, 0.5, 1.0]))
     self.assertEquals([0.25, 0.25],
                       tuning_transformer.transform([0.0, 0.0, 1.0]))
Ejemplo n.º 2
0
 def test_works_on_xyz(self):
     tuning_transformer = TuningTransformer()
     self.assertEquals([1.0, 1.0],
                       tuning_transformer.transform([1.0, 1.0, 1.0]))
     self.assertEquals([0.5, 0.5],
                       tuning_transformer.transform([0.5, 0.5, 1.0]))
     self.assertEquals([0.0, 0.0],
                       tuning_transformer.transform([0.0, 0.0, 1.0]))
Ejemplo n.º 3
0
 def test_can_change_tuning_transformer_scale(self):
     tuning_transformer = TuningTransformer(scale=1.0)
     self.assertEquals([1.0, 1.0],
                       tuning_transformer.transform([1.0, 1.0, 1.0]))
     self.assertEquals([0.5, 0.5],
                       tuning_transformer.transform([0.5, 0.5, 1.0]))
     self.assertEquals([0.0, 0.0],
                       tuning_transformer.transform([0.0, 0.0, 1.0]))
     tuning_transformer.set_scale(0.5)
     self.assertEquals([0.75, 0.75],
                       tuning_transformer.transform([1.0, 1.0, 1.0]))
     self.assertEquals([0.5, 0.5],
                       tuning_transformer.transform([0.5, 0.5, 1.0]))
     self.assertEquals([0.25, 0.25],
                       tuning_transformer.transform([0.0, 0.0, 1.0]))
 def test_can_change_tuning_transformer_scale(self):
     tuning_transformer = TuningTransformer(scale=1.0)
     self.assertEquals([1.0, 1.0], tuning_transformer.transform([1.0, 1.0, 1.0]))
     self.assertEquals([0.5, 0.5], tuning_transformer.transform([0.5, 0.5, 1.0]))
     self.assertEquals([0.0, 0.0], tuning_transformer.transform([0.0, 0.0, 1.0]))
     tuning_transformer.set_scale(0.5)
     self.assertEquals([0.75, 0.75], tuning_transformer.transform([1.0, 1.0, 1.0]))
     self.assertEquals([0.5, 0.5], tuning_transformer.transform([0.5, 0.5, 1.0]))
     self.assertEquals([0.25, 0.25], tuning_transformer.transform([0.0, 0.0, 1.0]))
Ejemplo n.º 5
0
    def test_can_change_transformer(self):
        samples_per_second = 4
        laser_size = 0.5
        path2audio = PathToPoints(samples_per_second, self.transformer,
                                  laser_size)
        path2audio.set_transformer(TuningTransformer())
        expected = numpy.array([[1.0, 1.0], [1.0, 1.0]])

        actual = path2audio.process([1.0, 1.0, 1.0], [1.0, 1.0, 1.0], 1.0)
        self.assertNumpyArrayClose(expected, actual)
Ejemplo n.º 6
0
 def test_should_adjust_if_request_points_out_of_bounds(self):
     tuning_transformer = TuningTransformer(scale=1.0)
     self.assertEquals([1.0, 1.0],
                       tuning_transformer.transform([1.1, 1.0, 1.0]))
     self.assertEquals([0.0, 1.0],
                       tuning_transformer.transform([-0.1, 1.0, 1.0]))
     self.assertEquals([1.0, 1.0],
                       tuning_transformer.transform([1.0, 1.1, 1.0]))
     self.assertEquals([1.0, 0.0],
                       tuning_transformer.transform([1.0, -0.1, 1.0]))
Ejemplo n.º 7
0
 def _unapply_calibration(self):
     self._path_to_points.set_transformer(
         TuningTransformer(scale=self._configuration.calibration.max_deflection))
Ejemplo n.º 8
0
    def __init__(self, configuration_manager):
        logger.info("Calibartion API Startup")
        self._configuration_manager = configuration_manager
        self._configuration = self._configuration_manager.load()

        self._point_generator = SinglePointGenerator()
        self._blink_generator = BlinkGenerator()
        self._orientaiton_generator = OrientationGenerator()
        self._alignment_generator = CalibrationLineGenerator()
        self._scale_generator = ScaleGenerator(speed=2.0, radius=1.0)

        self._test_patterns = {
            'Hilbert Space Filling Curve': HilbertGenerator(),
            'Square': SquareGenerator(),
            'Circle': CircleGenerator(),
            'Spiral': SpiralGenerator(),
            'Memory Hourglass': MemoryHourglassGenerator(),
            'Damping Test': DampingTestGenerator(),
            'NESW': NESWGenerator(),
            'Twitch': TwitchGenerator(),
            }

        self._current_generator = self._point_generator

        self._laser_control = LaserControl(self._configuration.cure_rate.override_laser_power_amount)
        transformer = TuningTransformer(scale=self._configuration.calibration.max_deflection)
        self._controller = None
        logger.debug("Setting up audiowriter")

        self._current_generator = self._point_generator

        self._state = MachineState()
        self._status = MachineStatus()

        self._communicator = UsbPacketCommunicator(self._configuration.circut.calibration_queue_length)
        self._communicator.start()
        self._disseminator = MicroDisseminator(
            self._laser_control,
            self._communicator,
            self._configuration.circut.data_rate
            )

        self._path_to_points = PathToPoints(
            self._disseminator.samples_per_second,
            transformer,
            self._configuration.options.laser_thickness_mm
            )

        post_fire_delay_speed = None
        slew_delay_speed = None
        if self._configuration.options.post_fire_delay:
            post_fire_delay_speed = self._configuration.options.laser_thickness_mm / (float(self._configuration.options.post_fire_delay) / 1000.0)
        if self._configuration.options.slew_delay:
            slew_delay_speed = self._configuration.options.laser_thickness_mm / (float(self._configuration.options.slew_delay) / 1000.0)

        self._writer = LayerWriter(
            self._disseminator,
            self._path_to_points,
            self._laser_control,
            self._state,
            post_fire_delay_speed=post_fire_delay_speed,
            slew_delay_speed=slew_delay_speed
            )

        self._layer_processing = LayerProcessing(
            self._writer,
            self._state,
            self._status,
            )

        self._controller = Controller(
            self._writer,
            self._layer_processing,
            self._current_generator,
            self._status,
            abort_on_error=False,
            )

        self.make_pattern_fit()
        self._controller.start()
 def test_should_adjust_if_request_points_out_of_bounds(self):
     tuning_transformer = TuningTransformer(scale=1.0)
     self.assertEquals([1.0, 1.0], tuning_transformer.transform([1.1, 1.0, 1.0]))
     self.assertEquals([0.0, 1.0], tuning_transformer.transform([-0.1, 1.0, 1.0]))
     self.assertEquals([1.0, 1.0], tuning_transformer.transform([1.0, 1.1, 1.0]))
     self.assertEquals([1.0, 0.0], tuning_transformer.transform([1.0, -0.1, 1.0]))
 def test_works_on_xyz_with_scale(self):
     tuning_transformer = TuningTransformer(scale=0.5)
     self.assertEquals([0.75, 0.75], tuning_transformer.transform([1.0, 1.0, 1.0]))
     self.assertEquals([0.5, 0.5], tuning_transformer.transform([0.5, 0.5, 1.0]))
     self.assertEquals([0.25, 0.25], tuning_transformer.transform([0.0, 0.0, 1.0]))
 def test_works_on_xyz(self):
     tuning_transformer = TuningTransformer()
     self.assertEquals([1.0, 1.0], tuning_transformer.transform([1.0, 1.0, 1.0]))
     self.assertEquals([0.5, 0.5], tuning_transformer.transform([0.5, 0.5, 1.0]))
     self.assertEquals([0.0, 0.0], tuning_transformer.transform([0.0, 0.0, 1.0]))
Ejemplo n.º 12
0
 def test_should_kaboom_if_scale_not_greater_then_0(self):
     with self.assertRaises(Exception):
         TuningTransformer(scale=0.0)