Commit 7984fe0d by Samuel Rowlinson

Closes #133

```Property Surface.Rc now behaves similarly to the geometric Cavity properties in that
it always returns a two-element NumPy array for the RoCs in the x, y planes.

Removed some obsolete tests due to this change.```
parent 23a41507
 ... ... @@ -209,31 +209,29 @@ following must be specified: @property def Rc(self): """The radius of curvature of the mirror in metres. If the mirror is astigmatic this is a tuple of the tangential and sagittal radii of curvature. """The radius of curvature of the mirror in metres, for both the tangential and sagittal planes. :getter: Returns the radius of curvature of the mirror in metres (a tuple of values if the mirror is astigmatic). :getter: Returns values of both planes' radii of curvature as a :class:`numpy.ndarray` where the first element is the tangential plane RoC and the second element is the sagittal plane RoC. :setter: Sets the radius of curvature. Examples -------- The following sets the radii of curvature of an object `obj`, which The following sets the radii of curvature of an object `m`, which is a sub-instance of `Surface`, in both directions to 2.5 m: >>> obj.Rc = 2.5 >>> m.Rc = 2.5 Whilst this would set the radius of curvature in the x-direction (tangential plane) to 2.5 and the radius of curvature in the y-direction (sagittal plane) to 2.7: plane) to 2.5 m and the radius of curvature in the y-direction (sagittal plane) to 2.7 m: >>> obj.Rc = (2.5, 2.7) >>> m.Rc = (2.5, 2.7) """ if np.isclose(self.Rcx.value, self.Rcy.value): return self.Rcx return (self.Rcx, self.Rcy) return np.array([self.Rcx.value, self.Rcy.value]) @Rc.setter def Rc(self, value): ... ... @@ -244,8 +242,6 @@ following must be specified: self.Rcx = value self.Rcy = value self._check_Rc(value) # NOTE this is a bit hacky but gets around using surface.R = value (etc.) # directly in an axis scan without being warned ... ...
 ... ... @@ -125,7 +125,7 @@ class TestSurface(TestComponent, metaclass=abc.ABCMeta): """Test that setting a surface's Rc to a single value sets Rcx and Rcy to that value.""" obj = component(name="cmp1") obj.Rc = 3.141 assert float(obj.Rc) == 3.141 assert np.all(obj.Rc == 3.141) assert float(obj.Rcx) == 3.141 assert float(obj.Rcy) == 3.141 ... ... @@ -138,24 +138,3 @@ class TestSurface(TestComponent, metaclass=abc.ABCMeta): assert (float(part_a), float(part_b)) == (3.141, 6.282) assert float(obj.Rcx) == 3.141 assert float(obj.Rcy) == 6.282 def test_same_rcx_and_rcy_makes_rc_return_single_number(self, component): """Test that setting a surface's Rcx and Rcy to the same number makes Rc return a single \ number.""" obj = component(name="cmp1") obj.Rcx = 3.141 obj.Rcy = 3.141 assert float(obj.Rc) == 3.141 assert float(obj.Rcx) == 3.141 assert float(obj.Rcy) == 3.141 def test_different_rcx_and_rcy_makes_rc_return_sequence(self, component): """Test that setting a surface's Rcx and Rcy to different numbers makes Rc return a \ two-valued sequence.""" obj = component(name="cmp1") obj.Rcx = 3.141 obj.Rcy = 6.282 part_a, part_b = obj.Rc assert (float(part_a), float(part_b)) == (3.141, 6.282) assert float(obj.Rcx) == 3.141 assert float(obj.Rcy) == 6.282
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!