diff --git a/Common/Interfaces/ReceiversInterface/idl/DewarPositioner.idl b/Common/Interfaces/ReceiversInterface/idl/DewarPositioner.idl index 536d2ecaa1ce43bd9e86f3d008e441b0142f55e0..b6befd73dc7a900d0d78765de7b10a144d52997a 100644 --- a/Common/Interfaces/ReceiversInterface/idl/DewarPositioner.idl +++ b/Common/Interfaces/ReceiversInterface/idl/DewarPositioner.idl @@ -52,16 +52,6 @@ module Receivers { void setup(in string code) raises (ComponentErrors::ComponentErrorsEx); - /** Call clearSource() before starting a scan over a new source. - * - * This method has been introduced to avoid a change of sign of the - * parallactic angle at 180°. - * The issue is reported here: https://github.com/discos/discos/issues/328 - * - */ - void clearSource(); - - /** Put the derotator in the park position and reset the configuration * * This method sets the default values: @@ -115,6 +105,7 @@ module Receivers { * @param elevation the elevation (radians) at the beginning of the scan * @param ra the RA (radians) at the beginning of the scan * @param dec the DEC (radians) at the beginning of the scan + * @param new_source True in case there will be a change of source * @param feasible_time the closest time for the dewar positioner to be * able to execute the scan. * @@ -144,6 +135,7 @@ module Receivers { in double elevation, in double ra, in double dec, + in boolean new_source, out ACS::Time feasible_time ) raises (ComponentErrors::ComponentErrorsEx); @@ -160,6 +152,7 @@ module Receivers { * @param elevation the elevation (radians) at the beginning of the scan * @param ra the RA (radians) at the beginning of the scan * @param dec the DEC (radians) at the beginning of the scan + * @param new_source True in case there will be a change of source * @throw ComponentErrors::ComponentErrorsEx */ void startUpdating( @@ -168,7 +161,8 @@ module Receivers { in double azimuth, in double elevation, in double ra, - in double dec + in double dec, + in boolean new_source ) raises (ComponentErrors::ComponentErrorsEx); diff --git a/Common/Servers/PyDewarPositioner/src/DewarPositioner/DewarPositionerImpl.py b/Common/Servers/PyDewarPositioner/src/DewarPositioner/DewarPositionerImpl.py index 4f25d5f1fad9e9853c20a44b44d2688bd70cfce3..b16d7242a555f9d7bc75e9325d3b0b262b9548c7 100644 --- a/Common/Servers/PyDewarPositioner/src/DewarPositioner/DewarPositionerImpl.py +++ b/Common/Servers/PyDewarPositioner/src/DewarPositioner/DewarPositionerImpl.py @@ -205,11 +205,6 @@ class DewarPositionerImpl(POA, cc, services, lcycle): logger.logNotice('derotator parked') - def clearSource(self): - logger.logNotice('cleaning the parallacting angle sign') - self.positioner._clearSign() - - def getPosition(self): try: return self.positioner.getPosition() @@ -358,10 +353,10 @@ class DewarPositionerImpl(POA, cc, services, lcycle): return ScanInfo(**self.positioner.getScanInfo()) - def checkUpdating(self, stime, axis, sector, az, el, ra, dec): + def checkUpdating(self, stime, axis, sector, az, el, ra, dec, new_source): try: return self.positioner.checkUpdating( - stime, axis, sector, az, el, ra, dec + stime, axis, sector, az, el, ra, dec, new_source ) except PositionerError, ex: logger.logError(ex.message) @@ -381,10 +376,12 @@ class DewarPositionerImpl(POA, cc, services, lcycle): raise exc.getComponentErrorsEx() - def startUpdating(self, axis, sector, az, el, ra, dec): + def startUpdating(self, axis, sector, az, el, ra, dec, new_source): logger.logNotice('starting the derotator position updating') try: - self.positioner.startUpdating(axis, sector, az, el, ra, dec) + self.positioner.startUpdating( + axis, sector, az, el, ra, dec, new_source + ) except PositionerError, ex: logger.logError(ex.message) exc = ComponentErrorsImpl.OperationErrorExImpl() diff --git a/Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py b/Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py index fd2fd3941ffda53c148d624dc625f77ab6e4206b..ba4dd8ee1ab029848b1e7a339de2f39536571eb2 100644 --- a/Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py +++ b/Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py @@ -59,7 +59,7 @@ class Positioner(object): self.device = device self.device.setup() self._clearOffset() - self._clearSign() + self.sign = None self.is_setup = True time.sleep(0.4) # Give the device the time to accomplish the setup self.control.updateScanInfo({'iStaticPos': setupPosition}) @@ -147,8 +147,9 @@ class Positioner(object): %(self.control.target, self.device.getMinLimit(), self.device.getMaxLimit())) - def checkUpdating(self, stime, axis, sector, az, el, ra, dec): + def checkUpdating(self, stime, axis, sector, az, el, ra, dec, new_source): sectors = ('ANT_NORTH', 'ANT_SOUTH') + sign = None if new_source else self.sign if not self.isSetup(): raise NotAllowedError('positioner not configured: a setup() is required') elif str(axis) == 'MNG_BEAMPARK': @@ -170,9 +171,9 @@ class Positioner(object): lat = self.siteInfo['latitude'] try: if coordinateFrame == 'horizontal': - iParallacticPos = getAngleFunction(lat, az, el) + iParallacticPos = getAngleFunction(lat, az, el, sign) elif coordinateFrame == 'equatorial': - iParallacticPos = getAngleFunction(lat, az, el, ra, dec) + iParallacticPos = getAngleFunction(lat, az, el, ra, dec, sign) else: raise PositionerError('coordinate frame %s unknown' % coordinateFrame) except ZeroDivisionError: @@ -219,8 +220,9 @@ class Positioner(object): return (ready, future_time) - def startUpdating(self, axis, sector, az, el, ra, dec): + def startUpdating(self, axis, sector, az, el, ra, dec, new_source): sectors = ('ANT_NORTH', 'ANT_SOUTH') + sign = None if new_source else self.sign try: Positioner.generalLock.acquire() if not self.isSetup(): @@ -267,9 +269,9 @@ class Positioner(object): lat = self.siteInfo['latitude'] try: if coordinateFrame == 'horizontal': - iParallacticPos = getAngleFunction(lat, az, el, self.sign) + iParallacticPos = getAngleFunction(lat, az, el, sign) elif coordinateFrame == 'equatorial': - iParallacticPos = getAngleFunction(lat, az, el, ra, dec, self.sign) + iParallacticPos = getAngleFunction(lat, az, el, ra, dec, sign) else: raise PositionerError('coordinate frame %s unknown' %coordinateFrame) except ZeroDivisionError: @@ -760,16 +762,13 @@ class Positioner(object): finally: Positioner.generalLock.release() - def _clearSign(self): - self.sign = None - def _setDefault(self): self.t = None self.is_setup = False self.control = Control() self.conf.clearConfiguration() self._clearOffset() - self._clearSign() + self.sign = None class Control(object): diff --git a/Common/Servers/PyDewarPositioner/test/functional/test_checkUpdating.py b/Common/Servers/PyDewarPositioner/test/functional/test_checkUpdating.py index 95dfcfcf4298d9161b6d610a6cd9107052859224..db8d430a7d360431605efa3e4c642a7ab16363cf 100644 --- a/Common/Servers/PyDewarPositioner/test/functional/test_checkUpdating.py +++ b/Common/Servers/PyDewarPositioner/test/functional/test_checkUpdating.py @@ -36,7 +36,9 @@ class TestCheckUpdating(unittest.TestCase): with self.assertRaisesRegexp(ComponentErrorsEx, 'positioner not configured'): self.positioner.park() time.sleep(0.5) - self.positioner.checkUpdating(0, MNG_TRACK, ANT_SOUTH, 0, 0, 0, 0) + self.positioner.checkUpdating( + 0, MNG_TRACK, ANT_SOUTH, 0, 0, 0, 0, False + ) def test_mng_beampark(self): @@ -47,7 +49,8 @@ class TestCheckUpdating(unittest.TestCase): starting_time, MNG_BEAMPARK, ANT_SOUTH, - az, el, ra, dec + az, el, ra, dec, + False ) self.assertEqual(value, True) self.assertEqual(feasible_time, starting_time) @@ -61,7 +64,8 @@ class TestCheckUpdating(unittest.TestCase): starting_time = 0 az, el, ra, dec = 0.6109, 0.6109, 0, 0 # 0.6109 -> 35 degrees self.antenna.setOffsets(az, el, ANT_HORIZONTAL) - self.positioner.startUpdating(MNG_TRACK, ANT_NORTH, az, el, ra, dec) + self.positioner.startUpdating( + MNG_TRACK, ANT_NORTH, az, el, ra, dec, False) time.sleep(0.5) self.positioner.stopUpdating() time.sleep(0.5) @@ -70,7 +74,8 @@ class TestCheckUpdating(unittest.TestCase): starting_time, MNG_TRACK, ANT_NORTH, - az, el, ra, dec + az, el, ra, dec, + False # new_source ) self.assertEqual(value, True) self.assertGreater(feasible_time, timestamp) @@ -95,7 +100,8 @@ class TestCheckUpdating(unittest.TestCase): starting_time, MNG_TRACK, ANT_NORTH, - az, el, 0, 0 + az, el, 0, 0, + False # new_source ) self.assertEqual(value, False) minimum_time = timestamp + int(required_time) @@ -121,7 +127,8 @@ class TestCheckUpdating(unittest.TestCase): starting_time, MNG_TRACK, ANT_NORTH, - az, el, 0, 0 + az, el, 0, 0, + False # new_source ) self.assertEqual(value, True) self.assertLess(feasible_time, starting_time) @@ -146,7 +153,8 @@ class TestCheckUpdating(unittest.TestCase): starting_time, MNG_TRACK, ANT_NORTH, - az, el, 0, 0 + az, el, 0, 0, + False # new_source ) self.assertEqual(value, False) self.assertGreater(feasible_time, starting_time) diff --git a/Common/Servers/PyDewarPositioner/test/functional/test_rewind.py b/Common/Servers/PyDewarPositioner/test/functional/test_rewind.py index b9a1764ef630544cfc03d8c3761080b5e2380c45..de748221c87068bbd2edac43bacc9ada0fb5ea2d 100644 --- a/Common/Servers/PyDewarPositioner/test/functional/test_rewind.py +++ b/Common/Servers/PyDewarPositioner/test/functional/test_rewind.py @@ -38,7 +38,7 @@ class StartUpdatingTest(unittest.TestCase): self.positioner.setRewindingMode('MANUAL') az, el, target = self.prepare_negative_oor() # after prepare_negative_oor(), startUpdating() will cause oor - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, True) time.sleep(0.5) self.assertTrue(self.positioner.isRewindingRequired()) self.positioner.rewind(0) @@ -49,7 +49,7 @@ class StartUpdatingTest(unittest.TestCase): self.positioner.setRewindingMode('MANUAL') az, el, target = self.prepare_negative_oor() # after prepare_negative_oor(), startUpdating() will cause oor - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, True) time.sleep(0.5) self.assertTrue(self.positioner.isRewindingRequired()) self.positioner.rewind(4) @@ -59,7 +59,7 @@ class StartUpdatingTest(unittest.TestCase): self.positioner.setRewindingMode('MANUAL') az, el, target = self.prepare_negative_oor() # after prepare_negative_oor(), startUpdating() will cause oor - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, True) time.sleep(0.5) self.assertEqual(self.positioner.isRewindingRequired(), True) self.assertEqual(self.positioner.isRewinding(), False) @@ -70,7 +70,7 @@ class StartUpdatingTest(unittest.TestCase): self.positioner.setRewindingMode('MANUAL') az, el, target = self.prepare_negative_oor() # after prepare_negative_oor(), startUpdating() will cause oor - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, True) time.sleep(0.5) self.positioner.stopUpdating() time.sleep(1) @@ -81,7 +81,7 @@ class StartUpdatingTest(unittest.TestCase): self.positioner.setRewindingMode('MANUAL') az, el, target = self.prepare_negative_oor() # after prepare_negative_oor(), startUpdating() will cause oor - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, True) time.sleep(0.5) self.assertTrue(self.positioner.isRewindingRequired()) steps = 2 @@ -120,7 +120,7 @@ class StartUpdatingTest(unittest.TestCase): self.assertLess(target, min_limit) # If sector is SOUTH, we expect a rewind of 60 degrees: -93 + 60 -> -33 expected = target + 60 - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, True) time.sleep(0.5) self.assertAlmostEqual(expected, self.device.getActPosition(), delta=0.1) @@ -134,7 +134,7 @@ class StartUpdatingTest(unittest.TestCase): target = Pis + parallactic self.assertLess(target, min_limit) expected = target + 120 - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, True) time.sleep(0.5) self.assertAlmostEqual(expected, self.device.getActPosition(), delta=0.1) @@ -153,7 +153,7 @@ class StartUpdatingTest(unittest.TestCase): self.assertGreater(target, min_limit) # We do not expect a rewind expected = target - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, False) time.sleep(0.5) self.assertAlmostEqual(expected, self.device.getActPosition(), delta=0.1) @@ -184,7 +184,7 @@ class StartUpdatingTest(unittest.TestCase): self.antenna.setOffsets(az, el, ANT_HORIZONTAL) target = Pis + parallactic self.assertLess(target, max_limit) - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, True) time.sleep(0.5) self.assertAlmostEqual(target, self.device.getActPosition(), delta=0.1) self.assertTrue(self.positioner.isUpdating()) @@ -245,7 +245,7 @@ class StartUpdatingTest(unittest.TestCase): self.antenna.setOffsets(az, el, ANT_HORIZONTAL) target = Pis + parallactic self.assertLess(target, max_limit) - self.positioner.startUpdating(MNG_TRACK, ANT_NORTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_NORTH, az, el, 0, 0, True) time.sleep(0.5) self.assertAlmostEqual(target, self.device.getActPosition(), delta=0.1) self.assertTrue(self.positioner.isUpdating()) @@ -294,7 +294,7 @@ class StartUpdatingTest(unittest.TestCase): self.antenna.setOffsets(az, el, ANT_HORIZONTAL) target = Pis + parallactic self.assertGreater(target, min_limit) - self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) + self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0, True) time.sleep(0.5) self.assertAlmostEqual(target, self.device.getActPosition(), delta=0.1) self.assertTrue(self.positioner.isUpdating()) diff --git a/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_getScanInfo.py b/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_getScanInfo.py index 45501810eef4c82123bb84202144b3cadce34643..93472f73f4c917a07e7ad39d11a0afa9c7e92e84 100644 --- a/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_getScanInfo.py +++ b/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_getScanInfo.py @@ -40,7 +40,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): posgen = PosGenerator() gen = posgen.parallactic(self.source, site_info) self.assertEqual(self.p.getScanInfo()['axis'], Management.MNG_NO_AXIS) - self.p.startUpdating(Management.MNG_TRACK, Antenna.ANT_NORTH, az, el, None, None) + self.p.startUpdating( + Management.MNG_TRACK, Antenna.ANT_NORTH, az, el, None, None, True + ) self.assertEqual(self.p.getScanInfo()['axis'], Management.MNG_TRACK) self.p.stopUpdating() self.assertEqual(self.p.getScanInfo()['axis'], Management.MNG_NO_AXIS) @@ -60,7 +62,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.p.setup(site_info, self.source, self.device) az = el = math.radians(60) Pip = PosGenerator.getParallacticAngle(latitude, az, el) - self.p.startUpdating(Management.MNG_TRACK, Antenna.ANT_NORTH, az, el, None, None) + self.p.startUpdating( + Management.MNG_TRACK, Antenna.ANT_NORTH, az, el, None, None, True + ) self.assertEqual(self.p.getScanInfo()['iStaticPos'], -19.2) self.assertEqual(self.p.getScanInfo()['iParallacticPos'], Pip) @@ -72,7 +76,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.p.setup(site_info, self.source, self.device) posgen = PosGenerator() gen = posgen.parallactic(self.source, site_info) - self.p.startUpdating(Management.MNG_TRACK, Antenna.ANT_NORTH, az, el, None, None) + self.p.startUpdating( + Management.MNG_TRACK, Antenna.ANT_NORTH, az, el, None, None, True + ) self.assertEqual(self.p.getScanInfo()['axis'], Management.MNG_TRACK) self.p.stopUpdating() self.assertEqual(self.p.getScanInfo()['axis'], Management.MNG_NO_AXIS) diff --git a/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_init.py b/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_init.py index b37d29686b8012ec21577fc595a0234bf49cf74b..1711a19782c977ac347504acb4b1dfed209dcd31 100644 --- a/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_init.py +++ b/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_init.py @@ -16,7 +16,10 @@ class PositionerInitTest(unittest.TestCase): self.assertEqual(p.isTerminated(), True) self.assertEqual(p.getOffset(), 0.0) self.assertRaises(NotAllowedError, p.getDeviceName) - self.assertRaises(NotAllowedError, p.startUpdating, 'axis', 'sector', 1, 1, None, None) + self.assertRaises( + NotAllowedError, + p.startUpdating, 'axis', 'sector', 1, 1, None, None, True + ) if __name__ == '__main__': unittest.main() diff --git a/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_offset.py b/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_offset.py index 94397b49663055352b66fda2902d9a94e0fb01c0..97df694ff1430bdcb1dafa474429f5608fa93b4f 100644 --- a/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_offset.py +++ b/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_offset.py @@ -78,7 +78,9 @@ class PositionerOffsetTest(unittest.TestCase): expected = Pis - max_rewinding_steps*self.device.getStep() + offset self.source.setAzimuth(az) self.source.setElevation(el) - self.p.startUpdating('MNG_TRACK', 'ANT_NORTH', az, el, None, None) + self.p.startUpdating( + 'MNG_TRACK', 'ANT_NORTH', az, el, None, None, True + ) time.sleep(0.2) if self.using_mock else time.sleep(3) self.p.setOffset(offset) time.sleep(0.2) if self.using_mock else time.sleep(5) diff --git a/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_startUpdating.py b/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_startUpdating.py index bf9d4e6c6ab8f7afe9799a4e2c8b01182f28be9c..f365db927ce9e9f1782f5edeec6e10667bd1e4e1 100644 --- a/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_startUpdating.py +++ b/Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_startUpdating.py @@ -36,10 +36,10 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.p.setup(site_info, self.source, self.device) try: - self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None) + self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None, True) time.sleep(0.2) self.assertEqual(self.p.isUpdating(), True) - self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None) + self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None, False) time.sleep(0.2) self.assertEqual(self.p.isUpdating(), True) finally: @@ -55,7 +55,7 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.p.setup(site_info, self.source, self.device) try: - self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None) + self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None, True) time.sleep(0.2) self.assertRaises(NotAllowedError, self.p.setPosition, 0) finally: @@ -71,7 +71,7 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.p.setup(site_info, self.source, self.device) try: - self.p.startUpdating(MNG_BEAMPARK, ANT_NORTH, az, el, None, None) + self.p.startUpdating(MNG_BEAMPARK, ANT_NORTH, az, el, None, None, True) time.sleep(0.2) self.assertFalse(self.p.isUpdating()) finally: @@ -81,39 +81,39 @@ class PositionerStartUpdatingTest(unittest.TestCase): def test_notYetConfigured(self): """Verify startUpdating()""" # startUpdating() raises NotAllowedError when the system is not configured - self.assertRaises(NotAllowedError, self.p.startUpdating, 'axis', 'sector', 1, 1, None, None) + self.assertRaises(NotAllowedError, self.p.startUpdating, 'axis', 'sector', 1, 1, None, None, True) self.assertEqual(self.p.isConfigured(), False) self.p.setup(siteInfo={}, source=None, device=self.device) # startUpdating() raises NotAllowedError when the system is not configured - self.assertRaises(NotAllowedError, self.p.startUpdating, 'axis', 'sector', 1, 1, None, None) + self.assertRaises(NotAllowedError, self.p.startUpdating, 'axis', 'sector', 1, 1, None, None, True) self.cdbconf.setup('KKG') self.cdbconf.setConfiguration('BSC') - self.assertRaises(NotAllowedError, self.p.startUpdating, 'axis', 'sector', 1, 1, None, None) + self.assertRaises(NotAllowedError, self.p.startUpdating, 'axis', 'sector', 1, 1, None, None, True) with self.assertRaisesRegexp(NotAllowedError, '^no site information available'): - self.p.startUpdating('axis', 'sector', 1, 1, None, None) + self.p.startUpdating('axis', 'sector', 1, 1, None, None, True) self.p.setup(siteInfo={'foo': 'foo'}, source=None, device=self.device) self.cdbconf.setConfiguration('BSC') with self.assertRaisesRegexp(NotAllowedError, "no source available"): - self.p.startUpdating('axis', 'sector', 1, 1, None, None) + self.p.startUpdating('axis', 'sector', 1, 1, None, None, True) self.p.setup(siteInfo={'foo': 'foo'}, source='source', device=self.device) self.cdbconf.setConfiguration('FIXED') - self.p.startUpdating('axis', 'sector', 1, 1, None, None) # Do not raise an exception + self.p.startUpdating('axis', 'sector', 1, 1, None, None, True) # Do not raise an exception self.p.stopUpdating() # Do not raise exception self.cdbconf.setConfiguration('BSC') sector = 'WRONG_SECTOR' with self.assertRaisesRegexp(NotAllowedError, '^sector %s not in' %sector): - self.p.startUpdating('axis', sector, 1, 1, None, None) + self.p.startUpdating('axis', sector, 1, 1, None, None, True) axis = 'WRONG_AXIS' sector = ANT_NORTH with self.assertRaisesRegexp(PositionerError, '^configuration problem:'): - self.p.startUpdating(axis, sector, 1, 1, None, None) + self.p.startUpdating(axis, sector, 1, 1, None, None, True) axis = MNG_TRACK # Raise value error (wrong unpacking) self.cdbconf.UpdatingPosition['MNG_TRACK'] = [10] # expected [position, functionName] - self.assertRaises(PositionerError, self.p.startUpdating, axis, sector, 1, 1, None, None) + self.assertRaises(PositionerError, self.p.startUpdating, axis, sector, 1, 1, None, None, True) # Raise AttributeError: fooName does not exist self.cdbconf.UpdatingPosition['ANT_NORTH'] = [10, 'fooName'] # [position, functionName] - self.assertRaises(PositionerError, self.p.startUpdating, axis, sector, 1, 1, None, None) + self.assertRaises(PositionerError, self.p.startUpdating, axis, sector, 1, 1, None, None, True) def test_custom(self): @@ -134,7 +134,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.source.setAzimuth(az) self.source.setElevation(el) if i == begin_idx: - self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None) + self.p.startUpdating( + MNG_TRACK, ANT_NORTH, az, el, None, None, True + ) time.sleep(0.11) expected = Pis + gen.next() self.assertEqual(expected, self.device.getActPosition()) @@ -180,8 +182,8 @@ class PositionerStartUpdatingTest(unittest.TestCase): p0 = angle - def test_clearSource(self): - "Put the parallactic angle sign to None" + def test_setSign(self): + "Set the parallactic angle sign" self.cdbconf.setup('KKG') self.cdbconf.setConfiguration('CUSTOM') latitude = radians(50) @@ -192,11 +194,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.source.setAzimuth(az) self.source.setElevation(el) self.assertIsNone(self.p.sign) - self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None) + self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None, True) time.sleep(0.5) self.assertIsNotNone(self.p.sign) - self.p._clearSign() - self.assertIsNone(self.p.sign) def test_custom_auto_rewinding(self): @@ -220,7 +220,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.source.setAzimuth(az) self.source.setElevation(el) - self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None) + self.p.startUpdating( + MNG_TRACK, ANT_NORTH, az, el, None, None, False + ) # For the K Band, we expect a rewind of 180 degrees # rewind_angle = self.p.getAutoRewindingSteps() * self.device.getStep() @@ -262,11 +264,13 @@ class PositionerStartUpdatingTest(unittest.TestCase): setPosition(value) time.sleep(sleep_time) self.device.setPosition = mockSetPosition - self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None) + self.p.startUpdating( + MNG_TRACK, ANT_NORTH, az, el, None, None, True + ) time.sleep(sleep_time/2) self.cdbconf.updateInitialPositions(0) az, el = 0.6109, 0.6109 - self.p.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, None, None) + self.p.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, None, None, True) time.sleep(sleep_time/2 + 1) finally: self.device.setPosition = setPosition @@ -297,7 +301,7 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.source.setElevation(el) if i == begin_idx: Pip = PosGenerator.getParallacticAngle(latitude, az, el) - self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None) + self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None, True) time.sleep(0.11) expected = Pis + gen.next() - Pip # Only the delta self.assertEqual(expected, self.device.getActPosition()) @@ -324,7 +328,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.source.setAzimuth(az) self.source.setElevation(el) if i == begin_idx: - self.p.startUpdating(axisCode, ANT_NORTH, az, el, None, None) + self.p.startUpdating( + axisCode, ANT_NORTH, az, el, None, None, True + ) time.sleep(0.11) expected = Pis + gen.next() self.assertAlmostEqual(expected, self.device.getActPosition(), places=2) @@ -352,7 +358,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.source.setElevation(el) if i == begin_idx: Pip = PosGenerator.getParallacticAngle(latitude, az, el) - self.p.startUpdating(axisCode, ANT_NORTH, az, el, None, None) + self.p.startUpdating( + axisCode, ANT_NORTH, az, el, None, None, True + ) time.sleep(0.11) expected = Pis + gen.next() - Pip # Only the delta self.assertAlmostEqual(expected, self.device.getActPosition(), places=2) @@ -379,7 +387,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.source.setAzimuth(az) self.source.setElevation(el) if i == begin_idx: - self.p.startUpdating(axisCode, ANT_NORTH, az, el, None, None) + self.p.startUpdating( + axisCode, ANT_NORTH, az, el, None, None, True + ) time.sleep(0.11) expected = initialPosition + staticValue self.assertEqual(expected, self.device.getActPosition()) @@ -407,7 +417,9 @@ class PositionerStartUpdatingTest(unittest.TestCase): self.source.setAzimuth(az) self.source.setElevation(el) if i == begin_idx: - self.p.startUpdating(axisCode, ANT_NORTH, az, el, None, None) + self.p.startUpdating( + axisCode, ANT_NORTH, az, el, None, None, True + ) time.sleep(0.11) expected = initialPosition + staticValue self.assertEqual(expected, self.device.getActPosition())