Ejemplo n.º 1
0
def test_arrow_calc_1():
    path = 'data/lwcsample.tsv'
    elements = arrows.read_lwcfile(path, 16, castfunc=list)
    arrpos = ([elem['head'], elem['tail']] for elem in elements)
    calc = ArrowCalc()
    data = calc(arrpos)
    return data
Ejemplo n.º 2
0
    def render(cls, args, outfile):
        calc = ArrowCalc(args.alpha, args.beta, args.h1, args.h2)
        for filename in args.filenames:
            elements = arrows.read_lwcfile(filename, args.scale, castfunc=list)
            # print('debug: elements', elements, file=sys.stderr)
            ypos = args.h2 * 4
            maxpos = max(max(elem['head'], elem['tail']) for elem in elements)
            arrpos = ([elem['head'], elem['tail'], ypos] for elem in elements)
            results = calc(arrpos)
            polygons = arrows.format_points(results)

            for elem, pg in zip(elements, polygons):
                elem['polygon'] = pg
                elem['text_x'] = (elem['head'] + elem['tail']) / 2.
                elem['text_y'] = args.h2 * 3
            res = arrows.render_svg(elements=elements, height=args.h2*5, width=maxpos)
            outfile.write(res)
Ejemplo n.º 3
0
def test_read_lwcfile():
    path = 'data/lwcsample.tsv'
    table = arrows.read_lwcfile(path, 16, castfunc=list)
    for x in table:
        print(x)