예제 #1
0
def _adjustFigure(nDisplay):
    '''
    configures the figure
    '''
    left = 0.125  # the left side of the subplots of the figure
    right = 0.9  # the right side of the subplots of the figure
    bottom = 0.1  # the bottom of the subplots of the figure
    top = 0.9  # 0.9, the top of the subplots of the figure
    wspace = 0.2  # the amount of width reserved for space between subplots,
    # expressed as a fraction of the average axis width
    hspace = 0.2  # the amount of height reserved for space between subplots,
    # expressed as a fraction of the average axis height

    if nDisplay == 3:
        nDisplay = 4
    if nDisplay > 4:
        nDisplay = 10

    if PySpectra.getTitle() is not None:
        top -= 0.05
    if PySpectra.getComment() is not None:
        top -= 0.05

    hsh = {
        '1': {
            'top': top,
            'bottom': 0.10,
            'left': 0.125,
            'right': 0.9,
            'hspace': 0.2,
            'wspace': 0.2
        },
        '2': {
            'top': top,
            'bottom': 0.10,
            'left': 0.12,
            'right': 0.90,
            'hspace': 0.42,
            'wspace': 0.20
        },
        '4': {
            'top': top + 0.02,
            'bottom': 0.10,
            'left': 0.10,
            'right': 0.96,
            'hspace': 0.44,
            'wspace': 0.34
        },
        '10': {
            'top': top + 0.02,
            'bottom': 0.07,
            'left': 0.07,
            'right': 0.97,
            'hspace': 0.62,
            'wspace': 0.20
        }
    }
    Fig.subplots_adjust(**hsh[str(nDisplay)])

    return
예제 #2
0
    def test_titleAndComment(self):

        PySpectra.cls()

        PySpectra.delete()
        PySpectra.setTitle("a_title")
        self.assertEqual(PySpectra.getTitle(), "a_title")
        PySpectra.delete()
        self.assertEqual(PySpectra.getTitle(), None)
        PySpectra.setTitle("a_title")
        PySpectra.setTitle(None)
        self.assertEqual(PySpectra.getTitle(), None)

        PySpectra.delete()
        PySpectra.setComment("a_comment")
        self.assertEqual(PySpectra.getComment(), "a_comment")
        PySpectra.delete()
        self.assertEqual(PySpectra.getComment(), None)
        PySpectra.setComment("a_comment")
        PySpectra.setComment(None)
        self.assertEqual(PySpectra.getComment(), None)

        PySpectra.delete()
        PySpectra.setTitle("there must be this title")
        PySpectra.setComment("and there must be this comment")
        PySpectra.Scan("t1")
        PySpectra.display()
        PySpectra.show()
        PySpectra.processEventsLoop(1)

        PySpectra.cls()
        PySpectra.delete()
        PySpectra.setTitle("there is only a title, no comment")
        PySpectra.Scan("t1")
        PySpectra.display()
        PySpectra.processEventsLoop(1)

        PySpectra.cls()
        PySpectra.delete()
        PySpectra.setComment("there is only a comment")
        PySpectra.Scan("t1")
        PySpectra.display()
        PySpectra.processEventsLoop(1)

        print "testPySpectra.test_titleAndComment DONE"
예제 #3
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
예제 #4
0
def _displayTitleComment(nameList):
    '''
    '''
    #fontSize = PySpectra.getFontSize( nameList)

    title = PySpectra.getTitle()
    if title is not None:
        if not _textIsOnDisplay(title):
            t = Fig.text(0.5, 0.95, title, va='center', ha='center')
            #t.set_fontsize( fontSize)

    comment = PySpectra.getComment()
    if comment is not None:
        if title is not None:
            if not _textIsOnDisplay(comment):
                t = Fig.text(0.5, 0.90, comment, va='center', ha='center')
                #t.set_fontsize( fontSize)
        else:
            if not _textIsOnDisplay(comment):
                t = Fig.text(0.5, 0.95, comment, va='center', ha='center')
                #t.set_fontsize( sz)
    return
예제 #5
0
def getComment():
    if spectraInstalled and useSpectra:
        argout = "NoComment"
    else:
        argout = PySpectra.getComment()
    return argout