Exemplo n.º 1
0
def main(file, geojson=False, classes=None):
    (root, extension) = os.path.splitext(file)
    if not extension:
        extension = '.xml'

    diagram = parse(root + extension)

    if classes:
        utils.mkdir(root)
        utils.mkdir('{}/images'.format(root))
        utils.mkdir('{}/features'.format(root))
        defines_top = DefinesStore.top()
        export_diagram_layer(diagram, 'background', root, geojson, excludes=frozenset(classes))
        for cls in classes:
            DefinesStore.reset(defines_top)
            export_diagram_layer(diagram, cls, root, geojson)
    else:
        try:
            import OpenCOR as oc
            svg = diagram.svg()
            browser = oc.browserWebView()
            browser.setContent(svg, "image/svg+xml")
        except ModuleNotFoundError:
            export_diagram_layer(diagram, None, root, geojson)
Exemplo n.º 2
0
    s.data().setEndingPoint(0.6)
    s.data().setPointInterval(0.005)
    s.reset()
    s.run()
'''
    s = oc.simulation()

    diagram = Diagram('noble_1962.svg', s, 0.04, 0.60, 's')

    diagram.add_channel('sodium_channel/i_Na', 'i_Na', (183.849, 49.756), 'V', 'red')
    diagram.add_channel('potassium_channel/i_K', 'i_K', (80.867, 49.756), 'V-', '#b666d2')
    diagram.add_channel('leakage_current/i_Leak', 'i_Leak', (133.551, 167.485), 'V', 'orange')

    svg = diagram.generate_svg(speed=0.5, period=25)

    browser = oc.browserWebView()
    browser.setContent(svg, "image/svg+xml")

    f = open('noble_1962_animated.svg', 'w')
    f.write(svg)
    f.close()

    '''
#    svg = animate_diagram('ten_tusscher_2004.svg', s, {'sodium_dynamics/Na_i': 'i_Na'}, 0, 1000, 10)

'i_up'
'i_leak'
'i_rel'
'i_Kr'
'i_Ks'
'i_K1'