def executeButtonClicked(self): offset = [ self.x_position.value, self.y_position.value, self.z_position.value ] if not is_close(offset, [0.0, 0.0, 0.0]): self.parent.presenter.transformSample(offset, self.selected_sample, TransformType.Translate)
def executeButtonClicked(self): angles = [ self.z_rotation.value, self.y_rotation.value, self.x_rotation.value ] if not is_close(angles, [0.0, 0.0, 0.0]): self.parent.presenter.transformSample(angles, self.selected_sample, TransformType.Rotate)
def moveJointsButtonClicked(self): q = [control.value for control in self.positioner_form_controls] q = self.instrument.positioning_stack.fromUserFormat(q) if not is_close(q, self.instrument.positioning_stack.set_points, POS_EPS): name = self.instrument.positioning_stack.name self.parent.presenter.movePositioner(name, q)
def executeButtonClicked(self): offset = [ 0.0 if ignore else -value for value, ignore in zip(self.move_to, self.ignore) ] if not is_close(offset, [0.0, 0.0, 0.0]): self.parent.presenter.transformSample(offset, self.selected_sample, TransformType.Translate)
def moveDetectorsButtonClicked(self): q = [ control.value for control in self.position_form_group.form_controls ] q = self.detector.positioner.fromUserFormat(q) if not is_close(q, self.detector.positioner.set_points, POS_EPS): name = self.detector.positioner.name self.parent.presenter.movePositioner(name, q)
def executeButtonClicked(self): if self.final_plane_normal is None or self.initial_plane is None: return matrix = Matrix44.identity() matrix[0:3, 0:3] = rotation_btw_vectors(self.initial_plane.normal, self.final_plane_normal) if not is_close(matrix, Matrix44.identity()): self.parent.presenter.transformSample(matrix, self.selected_sample, TransformType.Custom) self.clearPicks()
def executeButtonClicked(self): matrix = self.matrix.inverse() if self.invert_checkbox.isChecked( ) else self.matrix if not is_close(matrix, Matrix44.identity()): self.parent.presenter.transformSample(matrix, self.selected_sample, TransformType.Custom)
def testIsClose(self): self.assertTrue(is_close(2.5, 2.5)) self.assertFalse(is_close(0.998, 0.999)) self.assertTrue(is_close(0.998, 0.999, 1e-2))