Commit f0ebc5bf authored by marco-buttu's avatar marco-buttu
Browse files

Fixed a bug when setting the sign

The sign was never set becouse of a wrong if condition.
parent 62f2b7a6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ from __future__ import with_statement
import threading
import datetime
import time
import numpy

import Management
import Antenna
@@ -200,7 +201,7 @@ class Positioner(object):
                            raise NotAllowedError('zero division error computing p(%.2f, %.2f)' %(az, el))

                        # Remember the sign of the first scan of the map
                        if self.sign is not None:
                        if self.sign is None:
                            self.sign = int(numpy.sign(iParallacticPos))

                        self.control.setScanInfo(
+20 −0
Original line number Diff line number Diff line
@@ -171,6 +171,26 @@ class PositionerStartUpdatingTest(unittest.TestCase):
                self.assertLess(delta, 180)
            p0 = angle


    def test_clearSource(self):
        "Put the parallactic angle sign to None"
        self.cdbconf.setup('KKG')
        self.cdbconf.setConfiguration('CUSTOM')
        latitude = radians(50)
        site_info = {'latitude': latitude}
        self.p.setup(site_info, self.source, self.device)
        az = radians(45)
        el  = radians(45)
        self.source.setAzimuth(az)
        self.source.setElevation(el)
        self.assertIsNone(self.p.sign)
        self.p.startUpdating(MNG_TRACK, ANT_NORTH, az, el, None, None)
        time.sleep(0.5)
        self.assertIsNotNone(self.p.sign)
        self.p._clearSign()
        self.assertIsNone(self.p.sign)


    def test_custom_auto_rewinding(self):
        self.cdbconf.setup('KKG')
        self.cdbconf.setConfiguration('CUSTOM')