Exemple #1
0
    def test_cls(self):

        print "testIFC.test_cls"
        PySpectra.command("cls")
        print "testIFC.test_cls DONE"

        return
Exemple #2
0
    def test_comment(self):
        print "testIFC.test_comment"
        PySpectra.cls()
        PySpectra.delete()
        PySpectra.command("setComment AComment")

        ret = PySpectra.getComment()
        self.assertEqual(ret, "AComment")
        print "testIFC.test_comment DONE"

        return
Exemple #3
0
    def test_show(self):

        print "testIFC.test_show"

        PySpectra.cls()
        PySpectra.delete()
        PySpectra.command("create s1")
        PySpectra.command("show s1")
        print "testIFC.test_show DONE"

        return
Exemple #4
0
    def test_title(self):
        print "testIFC.test_title"
        PySpectra.cls()
        PySpectra.delete()
        PySpectra.command("create s1")
        PySpectra.command("setTitle hallo")

        ret = PySpectra.getTitle()
        self.assertEqual(ret, "hallo")
        print "testIFC.test_title DONE"

        return
Exemple #5
0
    def test_y2my(self):
        print "testIFC.test_y2my"
        PySpectra.cls()
        PySpectra.delete()
        PySpectra.command("create s1")
        PySpectra.command("y2my s1")

        lst = PySpectra.getGqeList()
        self.assertEqual(lst[1].name, "s1_y2my")
        self.assertEqual(len(lst), 2)
        print "testIFC.test_y2my DONE"

        return
Exemple #6
0
    def test_create1(self):
        print "testIFC.test_create1"
        PySpectra.cls()
        PySpectra.delete()
        PySpectra.command("create s1 0 10 100")
        lst = PySpectra.getGqeList()
        self.assertEqual(len(lst), 1)
        self.assertEqual(lst[0].name, "s1")
        self.assertEqual(lst[0].nPts, 100)
        self.assertEqual(lst[0].xMin, 0.)
        self.assertEqual(lst[0].xMax, 10.)
        PySpectra.delete()
        print "testIFC.test_create1 DONE"

        return
Exemple #7
0
    def test_pdf(self):
        print "testIFC.test_pdf"
        PySpectra.command("cls")
        PySpectra.command("delete")
        PySpectra.command("create s1")
        PySpectra.command("createPDF testPDF")
        self.assertEqual(os.path.exists('testPDF.pdf'), True)
        #os.remove( 'testPDF.pdf')
        print "testIFC.test_pdf DONE"

        return
Exemple #8
0
    def test_setText(self):
        print "testIFC.test_setText"
        PySpectra.command("cls")
        PySpectra.command("delete")
        PySpectra.command("create s1")
        o = PySpectra.getGqe("s1")
        self.assertEqual(len(o.textList), 0)
        PySpectra.command(
            "setText s1 comment string \"this is a comment\" x 0.05 y 0.95 hAlign left vAlign top color blue"
        )
        self.assertEqual(len(o.textList), 1)
        self.assertEqual(o.textList[0].text, "this is a comment")
        self.assertEqual(o.textList[0].x, 0.05)
        self.assertEqual(o.textList[0].y, 0.95)
        self.assertEqual(o.textList[0].hAlign, 'left')
        self.assertEqual(o.textList[0].vAlign, 'top')
        self.assertEqual(o.textList[0].color, 'blue')

        PySpectra.command("display")
        PySpectra.display()
        PySpectra.processEventsLoop(1)
        print "testIFC.test_setText DONE"

        return
Exemple #9
0
    def test_overlay(self):
        print "testIFC.test_overlay"
        PySpectra.cls()
        PySpectra.delete()
        PySpectra.command("create s1")
        PySpectra.command("create s2")
        PySpectra.command("overlay s1 s2")
        s1 = PySpectra.getGqe('s1')
        self.assertEqual(s1.overlay, "s2")
        print "testIFC.test_overlay DONE"

        return
 def cb_lineEdit( self): 
     pysp.command( str(self.lineEdit.text()))
     self.lineEdit.clear()
Exemple #11
0
    def test_create(self):

        print "testIFC.test_create"

        PySpectra.cls()
        PySpectra.delete()
        PySpectra.command("create s1")
        lst = PySpectra.getGqeList()
        self.assertEqual(len(lst), 1)
        self.assertEqual(lst[0].name, "s1")
        PySpectra.command("display s1")

        PySpectra.command("derivative s1")
        lst = PySpectra.getGqeList()
        self.assertEqual(lst[1].name, "s1_derivative")
        self.assertEqual(len(lst), 2)

        PySpectra.command("antiderivative s1")
        lst = PySpectra.getGqeList()
        self.assertEqual(lst[2].name, "s1_antiderivative")
        self.assertEqual(len(lst), 3)

        PySpectra.command("delete s1")
        PySpectra.command("delete s1_derivative")
        PySpectra.command("delete s1_antiderivative")
        lst = PySpectra.getGqeList()
        self.assertEqual(len(lst), 0)
        print "testIFC.test_create DONE"

        return
Exemple #12
0
    def test_setArrow(self):

        print "testIFC.test_setArrow"
        PySpectra.command("cls")
        PySpectra.command("delete")
        max = 20
        PySpectra.command(
            "setComment \"Arrows: Current: 5, Misc: 2, SetPoint: 6\"")
        PySpectra.command("create s1 0 10 %d" % max)

        gqe = PySpectra.getGqe("s1")
        gqe.motorNameList = ["eh_mot66"]

        PySpectra.command("setArrowCurrent s1 position 5.")
        PySpectra.command("setArrowMisc s1 position 2.")
        PySpectra.command("setArrowSetPoint s1 position 6.")
        PySpectra.command("display")
        PySpectra.processEventsLoop(1)

        pos = 5
        for i in range(20):
            pos = 5 + float(i) * 0.05
            PySpectra.command("setArrowCurrent s1 position %g" % pos)
            time.sleep(0.1)

        print "testIFC.test_setArrow DONE"
        return
Exemple #13
0
    def test_delete(self):

        print "testIFC.test_delete"
        PySpectra.command("cls")
        PySpectra.command("delete")
        max = 20
        PySpectra.command("setTitle \"s1,s2,s3,s4\"")
        PySpectra.command("create s1 0 10 %d" % max)
        PySpectra.command("create s2 0 10 %d" % max)
        PySpectra.command("create s3 0 10 %d" % max)
        PySpectra.command("create s4 0 10 %d" % max)
        PySpectra.command("display")
        PySpectra.processEventsLoop(1)
        gqeList = PySpectra.getGqeList()
        self.assertEqual(len(gqeList), 4)
        self.assertEqual(gqeList[0].name, "s1")
        self.assertEqual(gqeList[1].name, "s2")
        self.assertEqual(gqeList[2].name, "s3")
        self.assertEqual(gqeList[3].name, "s4")

        PySpectra.command("cls")
        PySpectra.command("delete s2")
        PySpectra.command("setTitle \"s1,s3,s4\"")
        PySpectra.command("display")
        PySpectra.processEventsLoop(1)
        gqeList = PySpectra.getGqeList()
        self.assertEqual(len(gqeList), 3)
        self.assertEqual(gqeList[0].name, "s1")
        self.assertEqual(gqeList[1].name, "s3")
        self.assertEqual(gqeList[2].name, "s4")

        PySpectra.command("cls")
        PySpectra.command("delete s3 s4")
        PySpectra.command("setTitle \"s1\"")
        PySpectra.command("display")
        PySpectra.processEventsLoop(1)
        gqeList = PySpectra.getGqeList()
        self.assertEqual(len(gqeList), 1)
        self.assertEqual(gqeList[0].name, "s1")
        print "testIFC.test_delete DONE"
        return
Exemple #14
0
    def test_setXY(self):
        import random

        print "testIFC.test_setXY"
        PySpectra.command("cls")
        PySpectra.command("delete")
        max = 20
        PySpectra.command("setTitle \"A title\"")
        PySpectra.command("setComment \"A comment\"")
        PySpectra.command("create s1 0 10 %d" % max)

        for i in range(max):
            PySpectra.command("setXY s1 %d %s %s" %
                              (i, float(i) / 100., random.random() * 10))
            PySpectra.command("display")
            time.sleep(0.1)

        PySpectra.processEventsLoop(1)
        print "testIFC.test_setXY DONE"
        return
Exemple #15
0
    def test_setX_Y(self):
        import random

        print "testIFC.test_setX_Y"
        PySpectra.command("cls")
        PySpectra.command("delete")

        max = 50
        PySpectra.command("create s1 0 10 %d" % max)

        s1 = PySpectra.getGqe("s1")
        self.assertEqual(s1.currentIndex, 49)
        self.assertEqual(s1.lastIndex, -1)
        PySpectra.command("display")
        self.assertEqual(s1.lastIndex, (max - 1))

        for i in range(max):
            PySpectra.command("setY s1 %d %g" % (i, random.random() * 10))
            PySpectra.command("setX s1 %d %g" % (i, float(i) / 100.))
            self.assertEqual(s1.currentIndex, i)
            PySpectra.command("display")
            time.sleep(0.1)

        PySpectra.processEventsLoop(1)
        print "testIFC.test_setX_Y DONE"

        return
Exemple #16
0
    def test_wsViewPort(self):

        if utils.getHostname() != 'haso107tk':
            return
        print "testIFC.test_wsViewPort"

        PySpectra.cls()
        PySpectra.delete()
        PySpectra.command("setWsViewport DINA4")
        PySpectra.processEventsLoop(1)
        PySpectra.command("setWsViewport DINA4P")
        PySpectra.processEventsLoop(1)
        PySpectra.command("setWsViewport DINA5")
        PySpectra.processEventsLoop(1)
        PySpectra.command("setWsViewport DINA5P")
        PySpectra.processEventsLoop(1)
        PySpectra.command("setWsViewport DINA6")
        PySpectra.processEventsLoop(1)
        PySpectra.command("setWsViewport DINA6P")
        PySpectra.processEventsLoop(1)
        print "testIFC.test_wsViewPort DONE"

        return