コード例 #1
0
def lines(color):
    reddots = graphite.PointPlot()
    reddots.lineStyle = graphite.LineStyle(width=1,
                                           color=color,
                                           kind=graphite.SOLID)
    reddots.symbol = None
    return reddots
コード例 #2
0
def draw_layout(graph, optics):
    if optics is None:
        return

    colorline = graphite.PointPlot()
    colorline.lineStyle = graphite.LineStyle(width=1,
                                             color=graphite.orange,
                                             kind=graphite.SOLID)
    colorline.symbol = None
    for i in optics.keys():
        olist = optics[i].polygon_list()
        for o in olist:
            if o is not None:
                d = graphite.Dataset()
                d.x = o[:, 2]
                d.y = o[:, 0]
                d.z = o[:, 1]
                # set coordinates to z=+right, x=+up, y=+out of paper
                graph.datasets.append(d)
                graph.formats.append(colorline)
コード例 #3
0
def draw_trace(graph, optics_trace):
    if optics_trace is None:
        return

    colorline = graphite.PointPlot()
    if optics_trace.color is None:
        color = graphite.black
    else:
        color = optics_trace.color

    colorline.lineStyle = graphite.LineStyle(width=1,
                                             color=color,
                                             kind=graphite.SOLID)
    colorline.symbol = None

    count = len(optics_trace)
    coords = Numeric.zeros((count, 3), Numeric.Float)
    for i in range(count):
        xy = optics_trace[i].x0
        coords[i] = (xy[2], xy[0], xy[1])  # z is horizontal, x is vertical!

    graph.datasets.append(graphite.Dataset(coords))
    graph.formats.append(colorline)
コード例 #4
0
        f1 = graphite.PointPlot()
        f1.lineStyle = None
        f1.symbol = graphite.CircleSymbol
        f1.symbolStyle = graphite.SymbolStyle(size=5,
                                              fillColor=graphite.red,
                                              edgeColor=graphite.red)
        g.formats = []
        g.formats.append(f1)
        finex = numpy.array(range(-20, 181), float) * 0.1
        finey = splint(xx, yy, yy2, finex)
        ds2 = graphite.Dataset()
        ds2.x = finex
        ds2.y = finey
        g.datasets.append(ds2)
        f2 = graphite.PointPlot()
        f2.lineStyle = graphite.LineStyle(width=1,
                                          color=graphite.green,
                                          kind=graphite.SOLID)
        f2.symbol = None
        g.formats.append(f2)
        g.bottom = 400
        g.right = 700
        try:
            graphite.genOutput(g, 'QD', size=(800, 500))
        except:
            graphite.genOutput(g, 'PDF', size=(800, 500))
    except:
        import traceback
        traceback.print_exc()
        print "Graphite not available... plotted results not shown"
コード例 #5
0
def plotq(trace):
    qxl = []
    qyl = []
    zl = []
    for i in trace:
        zl.append(i.total_drift)
        qi = i.incoming_q
        qix, qiy = i.transform_q_to_table(qi)
        #xform, qix, qiy=qi.qi_moments()
        qxl.append(qi.rw(qix)[1])
        qyl.append(qi.rw(qiy)[1])
        zl.append(i.total_drift)
        qi = i.q
        qix, qiy = i.transform_q_to_table(qi)
        #xform, qix, qiy=qi.qi_moments()
        qxl.append(qi.rw(qix)[1])
        qyl.append(qi.rw(qiy)[1])

    g = graphite.Graph()
    g.top = 10
    g.left = 100
    g.right = g.left + 700
    g.bottom = g.top + 300
    # g.axes[graphite.X].range=xrange
    # g.axes[graphite.Y].range=yrange
    g.formats = []

    dsx = graphite.Dataset()
    dsx.x = zl
    dsx.y = qxl
    g.datasets.append(dsx)
    colorline = graphite.PointPlot()
    colorline.lineStyle = graphite.LineStyle(width=1,
                                             color=graphite.red,
                                             kind=graphite.SOLID)
    colorline.symbol = None
    g.formats.append(colorline)

    dsy = graphite.Dataset()
    dsy.x = zl
    dsy.y = qyl
    g.datasets.append(dsy)
    colorline = graphite.PointPlot()
    colorline.lineStyle = graphite.LineStyle(width=1,
                                             color=graphite.blue,
                                             kind=graphite.SOLID)
    colorline.symbol = None
    g.formats.append(colorline)

    g.axes[graphite.Y].tickMarks[0].labels = "%+.3f"
    g.axes[graphite.Y].label.text = "meters"
    g.axes[graphite.Y].tickMarks[0].inextent = 0.02
    g.axes[graphite.Y].tickMarks[0].labelStyle = graphite.TextStyle(
        hjust=graphite.RIGHT,
        vjust=graphite.CENTER,
        font=graphite.Font(10, 0, 0, 0, None),
        color=graphite.Color(0.00, 0.00, 0.00))
    g.axes[graphite.Y].tickMarks[0].labeldist = -0.01

    g.axes[graphite.X].tickMarks[0].labels = "%+.0f"
    g.axes[graphite.X].label.text = "meters"
    g.axes[graphite.X].tickMarks[0].inextent = 0.02
    g.axes[graphite.X].tickMarks[0].labelStyle = graphite.TextStyle(
        hjust=graphite.CENTER,
        vjust=graphite.TOP,
        font=graphite.Font(10, 0, 0, 0, None),
        color=graphite.Color(0.00, 0.00, 0.00))
    g.axes[graphite.X].tickMarks[0].labeldist = -0.01

    if show_qd:
        graphite.genOutput(g, 'QD', canvasname="Beam size", size=(900, 500))
    if show_pdf:
        graphite.genOutput(g, 'PDF', canvasname="Q_plot", size=(900, 500))