Example #1
0
def example_Create56x3Plots():
    '''
    create 56x3 plots
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("56 x 3 Scans")
    PySpectra.setComment("Display many Scans")
    PySpectra.setWsViewport("DINA4")
    for i in range(56):
        t = PySpectra.Scan(name="t%d_a" % i,
                           lineColor='blue',
                           nPts=200,
                           yLabel='rand')
        t.y = np.random.random_sample((len(t.x), )) * 1000.
        t = PySpectra.Scan(name="t%d_b" % i,
                           lineColor='red',
                           nPts=200,
                           yLabel='rand',
                           overlay="t%d_a" % i)
        t.y = np.random.random_sample((len(t.x), )) * 1000.
        t = PySpectra.Scan(name="t%d_c" % i,
                           lineColor='green',
                           nPts=200,
                           yLabel='rand',
                           overlay="t%d_a" % i)
        t.y = np.random.random_sample((len(t.x), )) * 1000.
    PySpectra.display()
    return
Example #2
0
def example_Overlay2BothLog():
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("2 Overlay Scans, both with log scale")
    PySpectra.setComment("both axes have different ranges")
    PySpectra.setWsViewport("DINA5")
    g1 = utils.createGauss(name="gauss",
                           xMin=-5.,
                           xMax=5.,
                           nPts=101,
                           lineColor='red',
                           x0=0.,
                           sigma=1.,
                           amplitude=1.)
    g1.yLog = True
    g2 = utils.createGauss(name="gauss2",
                           xMin=-5.,
                           xMax=5.,
                           nPts=101,
                           lineColor='green',
                           x0=0.5,
                           sigma=1.2,
                           amplitude=1.)
    g2.yLog = True
    g2.yMin = 0.001
    g2.yMax = 1.

    PySpectra.overlay("gauss2", "gauss")

    PySpectra.display()
Example #3
0
def example_Overlay2FirstLog():
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("2 Overlay Scans, first (red) has log scale")
    PySpectra.setComment(
        "Sadly, there are no major tick mark strings at the right axis")
    PySpectra.setWsViewport("DINA5")

    g1 = utils.createGauss(name="gauss",
                           xMin=-5.,
                           xMax=5.,
                           nPts=101,
                           lineColor='red',
                           x0=0.,
                           sigma=1.,
                           amplitude=1.)

    g1.yLog = True

    g2 = utils.createGauss(name="gauss2",
                           xMin=-5.,
                           xMax=5.,
                           nPts=101,
                           lineColor='green',
                           x0=0.5,
                           sigma=1.2,
                           amplitude=1.)

    PySpectra.overlay("gauss2", "gauss")

    PySpectra.display()
Example #4
0
def example_PlotsWithTextContainer():
    '''
    create 3 scans and a text container
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("here could be a title")
    PySpectra.setComment("this is a comment")
    PySpectra.setWsViewport("DINA5")
    textScan = PySpectra.Scan(name="textContainer", textOnly=True)
    textScan.addText(text="some information", x=0., y=0.95, color='blue')
    textScan.addText(text="and more infos", x=0., y=0.85, color='blue')
    t1 = PySpectra.Scan("t1",
                        lineColor='blue',
                        xLabel='Position',
                        yLabel='sin')
    t1.y = np.sin(t1.x)
    t2 = PySpectra.Scan("t2",
                        xLabel='Position',
                        yLabel='cos',
                        symbol='o',
                        symbolColor='red',
                        symbolSize=5)
    t2.y = np.cos(t2.x)
    t3 = PySpectra.Scan("t3",
                        xLabel='Position',
                        yLabel='tan',
                        symbol='+',
                        lineColor='cyan',
                        symbolColor='green',
                        symbolSize=5)
    t3.y = np.tan(t3.x)
    PySpectra.display()
Example #5
0
def example_Overlay2():
    '''
    create 2 overlaid scans
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("Overlay 2 Scans")
    PySpectra.setComment("no comment")
    PySpectra.setWsViewport("DINA5")
    g = utils.createGauss(name="gauss",
                          xMin=-5.,
                          xMax=5.,
                          nPts=101,
                          lineColor='red',
                          x0=0.,
                          sigma=1.,
                          amplitude=1.)
    t1 = PySpectra.Scan(name="sinus",
                        lineColor='blue',
                        xMin=-5,
                        xMax=5.,
                        yMin=-1.5,
                        yMax=1.5,
                        yLabel='sin')
    t1.y = np.sin(t1.x)
    PySpectra.overlay("sinus", "gauss")
    PySpectra.display()
Example #6
0
    def testMotorArrowMisc(self):

        print("testPySpectra.testMotorArrowMisc")

        PySpectra.cls()
        PySpectra.delete()

        g = utils.createGauss(name="gauss",
                              xMin=-5.,
                              xMax=5.,
                              nPts=101,
                              lineColor='red',
                              x0=0.,
                              sigma=1.,
                              amplitude=1.)

        g.x += 50

        g.motorNameList = ["eh_mot66"]
        PySpectra.setComment(
            "testPySpectra.testArrowMisc: an arrow should appear at 50.3")
        g.display()
        g.setArrowMisc(50.3)

        g.display()
        time.sleep(3.0)
        return
Example #7
0
def example_Create22Plots():
    '''
    create 22 plots
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("22 Scans")
    PySpectra.setComment("and a comment")
    PySpectra.setWsViewport("DINA4")
    for i in range(22):
        t = PySpectra.Scan(name="t%d" % i,
                           lineColor='blue',
                           xLabel='Position',
                           yLabel='rand')
        t.y = np.random.random_sample((len(t.x), )) * 1000.
    PySpectra.display()
Example #8
0
def example_FSA_StepRealData():
    '''
    step function from P23 data
    '''

    data = [
        "-2.4298828125 37681148972.8", "-2.4048828125 38401871477.4",
        "-2.3798828125 38288686270.4", "-2.3548828125 39185991728.4",
        "-2.3298828125 38456517187.0", "-2.3048828125 39194360929.6",
        "-2.2798828125 37675200637.4", "-2.2548828125 38996830621.8",
        "-2.2298828125 38551627446.6", "-2.2048828125 37100623732.0",
        "-2.1798828125 36825602737.3", "-2.1548828125 34963557105.2",
        "-2.1298828125 32163944722.6", "-2.1048828125 29299318167.0",
        "-2.0798828125 27794769897.0", "-2.0548828125 26176477795.0",
        "-2.0298828125 24897579745.6", "-2.0048828125 22452187722.0",
        "-1.9798828125 20009478027.1", "-1.9548828125 17694863875.7",
        "-1.9298828125 15497083354.3", "-1.9048828125 12901608052.8",
        "-1.8798828125 10673203037.1", "-1.8548828125 7980209447.64",
        "-1.8298828125 5662638085.9", "-1.8048828125 3098076234.4",
        "-1.7798828125 1296338340.95", "-1.7548828125 708398132.123",
        "-1.7298828125 592764964.744", "-1.7048828125 252664555.849",
        "-1.6798828125 81626386.5509", "-1.6548828125 971789.900217",
        "-1.6298828125 3887184.77659", "-1.6048828125 0.0",
        "-1.5798828125 0.0", "-1.5548828125 3887285.48112",
        "-1.5298828125 0.0", "-1.5048828125 4858729.21921",
        "-1.4798828125 2915256.41246", "-1.4548828125 0.0", "-1.4298828125 0.0"
    ]

    xArr = []
    yArr = []
    for line in data:
        (x, y) = line.split(' ')
        xArr.append(float(x))
        yArr.append(float(y))

    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("Real data")
    PySpectra.setComment(
        "See that FSA(stepm) failes but FSA(stepmssa) produces a result")
    PySpectra.setWsViewport("DINA5")

    g = PySpectra.Scan(name='realdata', x=xArr, y=yArr)

    PySpectra.display()
    return
Example #9
0
def example_PlotWithSeveralTexts():
    '''
    create 1 scan with several texts
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("Here could be the title")
    PySpectra.setComment("comment: Sinus(), shifted up by 1.1")
    PySpectra.setWsViewport("DINA5")
    t1 = PySpectra.Scan(name="t1",
                        xMin=0.01,
                        xMax=10.,
                        nPts=101,
                        lineColor='blue',
                        xLabel='Position',
                        yLabel='sin')
    t1.addText(text="a left/center aligned text",
               x=0.05,
               y=0.8,
               hAlign='left',
               vAlign='center')
    t1.addText(text="a right/centeraligned text",
               x=0.95,
               y=0.8,
               hAlign='right',
               vAlign='center')
    t1.addText(text="a center/top aligned text, red, fontSize: 10",
               x=0.5,
               y=0.5,
               hAlign='center',
               vAlign='top',
               fontSize=10,
               color='red')
    t1.addText(text="a center/center aligned text",
               x=0.5,
               y=0.5,
               hAlign='center',
               vAlign='center')
    t1.addText(text="a center/bottom aligned text",
               x=0.5,
               y=0.5,
               hAlign='center',
               vAlign='bottom')
    t1.y = np.sin(t1.x) + 1.001
    PySpectra.display()
Example #10
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"
Example #11
0
def _setComment(line):
    '''
    setComment "some comment"
      set the comment string for the whole plot
    '''
    argout = "done"
    if not PySpectra.setComment(line):
        argout = "trouble from PySpectra.setComment()"
    return argout
Example #12
0
def example_FSA_StepNoisy():
    '''
    step function
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("a noisy Step")
    PySpectra.setComment("Input for Utils->FSA/SSA")
    PySpectra.setWsViewport("DINA5")
    g = utils.createStep(name="step",
                         xMin=-10.,
                         xMax=10.,
                         nPts=101,
                         lineColor='red',
                         amplitude=3.)
    g.y += np.random.random_sample((len(g.x), )) * 0.5
    PySpectra.display()
    return
Example #13
0
def example_Gauss():
    '''
    gauss plot
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("A simple Gauss curve")
    PySpectra.setComment("Can be used with SSA, calculating derivative and so")
    PySpectra.setWsViewport("DINA5")
    g = utils.createGauss(name="gauss",
                          xMin=-5.,
                          xMax=5.,
                          nPts=101,
                          lineColor='red',
                          x0=0.,
                          sigma=1.,
                          amplitude=1.)
    PySpectra.display()
    return
Example #14
0
def example_Gauss2():
    ''' 
    2 gauss plot
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("Two Gauss curves")
    PySpectra.setComment(
        "To demonstrate how SSA limits can be defined with VLines")
    PySpectra.setWsViewport("DINA5")
    g = PySpectra.Scan(name="gauss", xMin=-10., xMax=10., nPts=101)
    mu1 = 0.
    sigma1 = 1.
    mu2 = 6.5
    sigma2 = 1.2
    g.y = 1./(sigma1*np.sqrt(2.*np.pi))*np.exp( -(g.y-mu1)**2/(2*sigma1**2)) + \
          2./(sigma2*np.sqrt(2.*np.pi))*np.exp( -(g.y-mu2)**2/(2*sigma2**2))
    PySpectra.display()
    return
Example #15
0
    def testCommentTitle( self):
        '''
        '''
        print "testMplGraphics.testCommentTitel"

        PySpectra.mtpltlb.graphics.cls()
        PySpectra.delete()
        PySpectra.setComment( "this is a comment")
        PySpectra.setTitle( "check comment and title")

        sinus = PySpectra.Scan( name = 'sinus', 
                                xMin = 0., xMax = 6.0, nPts = 101, lineColor = 'red')
        sinus.y = np.sin( sinus.y)

        PySpectra.mtpltlb.graphics.display()

        #PySpectra.show()
        PySpectra.mtpltlb.graphics.processEventsLoop( 1)

        print "testMplGraphics.testCommentTitle, DONE"
Example #16
0
def example_FSA_GaussVeryNoisy():
    '''
    gauss plot
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("a very noisy Gauss at 0.12345")
    PySpectra.setComment("Input for Util->FSA/SSA")
    PySpectra.setWsViewport("DINA5")
    g = utils.createGauss(name="gauss",
                          xMin=-5.,
                          xMax=5.,
                          nPts=101,
                          lineColor='red',
                          x0=0.12345,
                          sigma=1.,
                          amplitude=1.)
    g.y += np.random.random_sample((len(g.x), )) * 0.3
    PySpectra.display()
    return
Example #17
0
def example_Create5Plots():
    '''
    create 5 scans, different colors, demonstrate overlay feature
    '''
    PySpectra.cls()
    PySpectra.delete()
    PySpectra.setTitle("5 Scans, t5 is overlaid to t3")
    PySpectra.setComment("Notice that sin has autoscalY == False")
    PySpectra.setWsViewport("DINA5")
    t1 = PySpectra.Scan(name="t1",
                        lineColor='blue',
                        yLabel='sin',
                        yMin=-2,
                        yMax=2,
                        autoscaleY=False)
    t1.y = np.sin(t1.x)
    t2 = PySpectra.Scan("t2", xLabel='Position', yLabel='cos', symbol='+')
    t2.y = np.cos(t2.x)
    t3 = PySpectra.Scan(name="t3",
                        lineColor='green',
                        xLabel='Position',
                        yLabel='tan')
    t3.y = np.tan(t3.x)
    t4 = PySpectra.Scan(name="t4",
                        lineColor='NONE',
                        xLabel='Position',
                        yLabel='random',
                        symbol='+',
                        symbolColor='CYAN')
    t4.y = np.random.random_sample((len(t4.y), ))
    t5 = PySpectra.Scan(name="t5",
                        lineColor='magenta',
                        xLabel='Position',
                        yLabel='x**2')
    t5.y = t5.x * t5.x
    PySpectra.overlay('t5', 't3')
    PySpectra.display()
Example #18
0
def setComment(line):
    if spectraInstalled and useSpectra:
        argout = None
    else:
        argout = PySpectra.setComment(line)
    return argout
Example #19
0
    def __init__(self, name=None, **kwargs):

        #print( "graPyspIfc.Scan: %s" % repr( kwargs))
        if name is None:
            raise ValueError("graPyspIfc.Scan: 'name' is missing")

        self.name = name

        DctOut = {}

        if 'start' in kwargs:
            DctOut['xMin'] = kwargs['start']
            del kwargs['start']
        elif 'xMin' in kwargs:
            DctOut['xMin'] = kwargs['xMin']
            del kwargs['xMin']
        elif 'x' in kwargs:
            DctOut['xMin'] = kwargs['x'][0]
        elif 'y' in kwargs:
            DctOut['xMin'] = 0.
        else:
            DctOut['xMin'] = 0.

        if 'stop' in kwargs:
            DctOut['xMax'] = kwargs['stop']
            del kwargs['stop']
        elif 'xMax' in kwargs:
            DctOut['xMax'] = kwargs['xMax']
            del kwargs['xMax']
        elif 'x' in kwargs:
            DctOut['xMax'] = kwargs['x'][-1]
        elif 'y' in kwargs:
            DctOut['xMax'] = float(len(kwargs['y']) - 1)
        else:
            DctOut['xMax'] = 10.

        if 'np' in kwargs:
            DctOut['nPts'] = kwargs['np']
            del kwargs['np']
        elif 'nPts' in kwargs:
            DctOut['nPts'] = kwargs['nPts']
            del kwargs['nPts']
        elif 'x' in kwargs:
            DctOut['nPts'] = len(kwargs['x'])
        elif 'y' in kwargs:
            DctOut['nPts'] = len(kwargs['y'])
        else:
            DctOut['nPts'] = 101

        if 'yMin' in kwargs:
            DctOut['yMin'] = kwargs['yMin']
            del kwargs['yMin']

        if 'yMax' in kwargs:
            DctOut['yMax'] = kwargs['yMax']
            del kwargs['yMax']

        if 'xlabel' in kwargs:
            DctOut['xLabel'] = kwargs['xlabel']
            del kwargs['xlabel']
        if 'xLabel' in kwargs:
            DctOut['xLabel'] = kwargs['xLabel']
            del kwargs['xLabel']

        if 'ylabel' in kwargs:
            DctOut['yLabel'] = kwargs['ylabel']
            del kwargs['ylabel']
        if 'yLabel' in kwargs:
            DctOut['yLabel'] = kwargs['yLabel']
            del kwargs['yLabel']

        if 'colour' in kwargs:
            DctOut['lineColor'] = kwargs['colour']
            del kwargs['colour']
        if 'color' in kwargs:
            DctOut['lineColor'] = kwargs['color']
            del kwargs['color']
        if 'lineColor' in kwargs:
            DctOut['lineColor'] = kwargs['lineColor']
            del kwargs['lineColor']

        if 'at' in kwargs:
            DctOut['at'] = kwargs['at']
            del kwargs['at']
        else:
            DctOut['at'] = '(1,1,1)'

        #
        # do not use 'x' here because this causes recursion in the
        # Scan() call caused by __getattr__()
        #
        if 'x' in kwargs:
            DctOut['x'] = kwargs['x'][:]
            del kwargs['x']
        else:
            DctOut['x'] = None

        if 'y' in kwargs:
            DctOut['y'] = kwargs['y'][:]
            del kwargs['y']
        else:
            DctOut['y'] = None
        #
        # Spectra
        #
        if spectraInstalled and useSpectra:
            if kwargs:
                raise ValueError(
                    "graPyspIfs.Scan (Spectra): dct not empty %s" %
                    str(kwargs))

            DctOut['lineColor'] = utils.colorPyspToSpectra(DctOut['lineColor'])

            #
            # Spectra has to 'x' or 'y' parameter in the constructor
            #
            self.scan = Spectra.SCAN(
                name=name,
                start=DctOut['xMin'],
                stop=DctOut['xMax'],
                np=DctOut['nPts'],
                #xlabel = DctOut[ 'xLabel'],
                #ylabel = DctOut[ 'yLabel'],
                colour=DctOut['lineColor'],
                at=DctOut['at'])

            #
            # set x and y to values provided by the user or to
            # some default, x: linspace(), y: zeros()
            #
            if 'x' in DctOut and DctOut['x'] is not None:
                for i in range(len(DctOut['x'])):
                    self.scan.setX(i, DctOut['x'][i])
            else:
                x = np.linspace(DctOut['xMin'], DctOut['xMax'], DctOut['nPts'])
                for i in range(len(x)):
                    self.scan.setX(i, x[i])

            if 'y' in DctOut and DctOut['y'] is not None:
                for i in range(len(DctOut['y'])):
                    self.scan.setY(i, DctOut['y'][i])
            else:
                y = np.zeros(DctOut['nPts'], np.float64)
                for i in range(len(y)):
                    self.scan.setY(i, y[i])

            self.nPts = self.scan.np
            self.xMin = self.scan.x_min
            self.xMax = self.scan.x_max
            self.lineColor = utils.colorSpectraToPysp(self.scan.colour)
        else:
            #
            # PySpectra
            #
            if 'lineColor' in DctOut:
                if type(DctOut['lineColor']) == int:
                    DctOut['lineColor'] = utils.colorSpectraToPysp(
                        DctOut['lineColor'])
            else:
                DctOut['lineColor'] = 'blue'

            if 'comment' in kwargs:
                PySpectra.setComment(kwargs['comment'])
                del kwargs['comment']

            if 'motorNameList' in kwargs:
                DctOut['motorNameList'] = kwargs['motorNameList'][:]
                del kwargs['motorNameList']
            else:
                DctOut['motorNameList'] = None

            if 'logWidget' in kwargs:
                DctOut['logWidget'] = kwargs['logWidget']
                del kwargs['logWidget']
            else:
                DctOut['logWidget'] = None

            if kwargs:
                raise ValueError(
                    "graPyspIfs.Scan (PySPectra): dct not empty %s" %
                    str(kwargs))

            self.scan = PySpectra.Scan(name=name,
                                       x=DctOut['x'],
                                       y=DctOut['y'],
                                       xMin=DctOut['xMin'],
                                       xMax=DctOut['xMax'],
                                       lineColor=DctOut['lineColor'],
                                       motorNameList=DctOut['motorNameList'],
                                       logWidget=DctOut['logWidget'],
                                       nPts=DctOut['nPts'])

            self.nPts = self.scan.nPts
            self.xMin = self.scan.xMin
            self.xMax = self.scan.xMax
            self.lineColor = self.scan.lineColor

        return
Example #20
0
def createScansByColumns( hsh):
    """
    called from zmqIfc.putData()
        hsh = { 'putData': {'columns': [{'data': x, 'name': 'xaxis'},
                                        {'data': tan, 'name': 'tan'},
                                        {'data': cos, 'name': 'cos'},
                                        {'data': sin, 'name': 'sin',
                                         'showGridY': False, 'symbolColor': 'blue', 'showGridX': False, 
                                         'yLog': False, 'symbol': '+', 
                                         'xLog': False, 'symbolSize':5}]}}
    """

    if len( hsh[ 'columns']) < 2: 
        raise Exception( "PySpectra.createScansByColumns", "less than 2 columns")

    if 'title' in hsh: 
        PySpectra.setTitle( hsh[ 'title'])

    if 'comment' in hsh: 
        PySpectra.setComment( hsh[ 'comment'])

    columns = []
    xcol = hsh[ 'columns'][0]
    for elm in hsh[ 'columns'][1:]:
        if 'name' not in elm:
            raise Exception( "PySpectra.createScansByColumns", "missing 'name'")
        if 'data' not in elm:
            raise Exception( "PySpectra.createScansByColumns", "missing 'data'")
        data = elm[ 'data']
        del elm[ 'data']
        if len( data) != len( xcol[ 'data']):
            raise Exception( "PySpectra.createScansByColumns", 
                             "column length differ %s: %d, %s: %d" % ( xcol[ 'name'], len( xcol[ 'data']),
                                                                       elm[ 'name'], len( data)))

        lineColor = 'red'
        if 'lineColor' in elm:
            lineColor = elm[ 'lineColor']
            del elm[ 'lineColor'] 
            symbolColor = 'NONE'
        elif 'symbolColor' not in elm:
            lineColor = 'red'
            symbolColor = 'NONE'
        else: 
            symbolColor= 'red'
            lineColor = 'NONE'
            if 'symbolColor' in elm:
                symbolColor = elm[ 'symbolColor']
                del elm[ 'symbolColor'] 

        lineWidth = 1
        if 'lineWidth' in elm:
            lineWidth = elm[ 'lineWidth']
            del elm[ 'lineWidth'] 
        lineStyle = 'SOLID'
        if 'lineStyle' in elm:
            lineStyle = elm[ 'lineStyle']
            del elm[ 'lineStyle'] 
        showGridX = False
        if 'showGridX' in elm:
            showGridX = elm[ 'showGridX']
            del elm[ 'showGridX'] 
        showGridY = False
        if 'showGridY' in elm:
            showGridY = elm[ 'showGridY']
            del elm[ 'showGridY'] 
        xLog = False
        if 'xLog' in elm:
            xLog = elm[ 'xLog']
            del elm[ 'xLog'] 
        yLog = False
        if 'yLog' in elm:
            yLog = elm[ 'yLog']
            del elm[ 'yLog'] 
        symbol = '+'
        if 'symbol' in elm:
            symbol = elm[ 'symbol']
            del elm[ 'symbol'] 
        symbolSize= 10
        if 'symbolSize' in elm:
            symbolSize = elm[ 'symbolSize']
            del elm[ 'symbolSize'] 

        name = elm['name']
        del elm[ 'name']

        if len( list( elm.keys())) > 0: 
            raise ValueError( "PySpectra.createScansByColumns: dct not empty %s" % repr( elm))

        scan = PySpectra.Scan( name = name, 
                     xMin = data[0], xMax = data[-1], nPts = len(data),
                     xLabel = xcol[ 'name'], yLabel = name,
                     lineColor = lineColor, lineWidth = lineWidth, lineStyle = lineStyle,
                     showGridX = showGridX, showGridY = showGridY, 
                     xLog = xLog, yLog = yLog, 
                     symbol = symbol, symbolColor = symbolColor, symbolSize = symbolSize, 
                )
        for i in range(len(data)):
            scan.setX( i, xcol[ 'data'][i])
            scan.setY( i, data[i])
    PySpectra.display()

    return "done"