예제 #1
0
    def VisitLibraryManager(self, library_manager):
        local_redocs = []
        for block in library_manager.eqnsets \
            + library_manager.libraries:
            redoc = MRedocWriterVisitor.build(block)
            local_redocs.append(redoc)

        title = 'LibraryManager Context'
        if library_manager.name:
            title += ': %s' % library_manager.name
        if library_manager.src_text:
            p = Section('Source', VerbatimBlock(library_manager.src_text))
            local_redocs = [p] + local_redocs

        # Check here;
        d = Section(title, local_redocs)
        return d
예제 #2
0
    def VisitLibrary(self, library):

        format_dim = lambda o: "$%s$"%FormatDimensionality( o.get_dimension() ) if not o.get_dimension().is_dimensionless(allow_non_zero_power_of_ten=False) else  "-"

        #symbol_format = lambda s:s

        #dep_string_indir = lambda s: ",".join( [symbol_format(o.symbol) for o in sorted( set(eqnset.getSymbolDependancicesIndirect(s, include_ass_in_output=False)), key=lambda s:s.symbol ) ] )

        #meta_format = lambda s: eqnset.getSymbolMetadata(s) or "-"
        #plts = build_figures( eqnset)


        return SectionNewPage('Library Summary: %s' % library.name,
                              Section('Imports'),
                              Section('Function Definitions',
                              EquationBlock(*[LatexEqnWriterN().visit(a) for a in library.functiondefs if not isinstance(a, BuiltInFunction)])),
                              #Section('Symbols', terminal_symbols)
                              )
예제 #3
0
    def VisitInterface(self, interface, **kwargs):
        connections = VerticalColTable(
            "Symbol  | Type    | Value  | Dimensions | Dependancies | Metadata",
            [
                "$%s$    | -       | -      | -          | -            | -       "
                % (p.symbol, ) for p in interface.connections
            ])

        return HierachyScope("Summary of '%s'" % interface.name,
                             Section('Connections', connections))
예제 #4
0
    def VisitEqnSet(self, eqnset):

        format_dim = lambda o: ('$%s$'
                                % FormatDimensionality(o.get_dimension()) if not o.get_dimension().is_dimensionless(allow_non_zero_power_of_ten=False) else '-'
                                )

        f = LatexEqnWriterN()  # FormatTerminalSymbol(self, symbol):
        symbol_format = lambda s: f.FormatTerminalSymbol(s)

        dep_string_indir = lambda s: ','.join([symbol_format(o.symbol)
                for o in
                sorted(set(eqnset.getSymbolDependancicesIndirect(s,
                include_ass_in_output=False)), key=lambda s: s.symbol)])

        meta_format = lambda s: eqnset.getSymbolMetadata(s) or '-'


        terminal_symbols = VerticalColTable("Symbol  | Type      | Value | Dimensions | Dependancies | Metadata",
                                            ["$%s$     | Param | -     | %s         | -            | %s  " % (symbol_format(p.symbol), format_dim(p), meta_format(p)) for p in eqnset.parameters] +
                                            ["$%s$     | Supp  | -     | %s         | -            | %s  " % (symbol_format(s.symbol), format_dim(s),meta_format(s) )  for s in eqnset.suppliedvalues] +
                                            ["$%s$     | Const | %s    | %s         | -            | -   " % (symbol_format(s.symbol), s.value, format_dim(s),    ) for s in eqnset.symbolicconstants] +
                                            ["$%s$     | Assd  | -     | %s         | $\{%s\}$     | %s  " % (symbol_format(a.symbol), format_dim(a), dep_string_indir(a), meta_format(a)   ) for a in eqnset.assignedvalues] +
                                            ["$%s$     | State | -     | %s         | $\{%s\}$     | %s  " % (symbol_format(s.symbol), format_dim(s), dep_string_indir(s), meta_format(s)  ) for s in eqnset.states]
                                            )

        plts = build_figures( eqnset)
        return HierachyScope(
            "Summary of '%s'" % eqnset.name,
            Section('Assignments',
                    EquationBlock(*[LatexEqnWriterN().visit(a) for a in
                    sorted(eqnset.assignments, key=lambda a: \
                    a.lhs.symbol)])),
            Section('State Variable Evolution',
                    EquationBlock(*[LatexEqnWriterN().visit(a) for a in
                    eqnset.timederivatives])),
            Section('Function Definitions',
                    EquationBlock(*[LatexEqnWriterN().visit(a) for a in
                    eqnset.functiondefs if not isinstance(a,
                    BuiltInFunction)])),
            Section('Symbols', terminal_symbols),
            Section('Imports'),
            Section('Events',
                    EquationBlock(*[LatexEqnWriterN().visit(a) for a in
                    eqnset.onevents])),
            Section('Plots', *plts),
            )
예제 #5
0
caption='Simulator Support'
)



#A	C	EREV	GLK	I	VS	V.max	V.min	V[102]	V[240:249].mean	V[90:99].mean
#10000	1.0	-51	0.3	0	-51	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***
#10000	1.0	-51	0.3	0	-31	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***
#10000	1.0	-31	0.3	0	-51	OK -31.000000 (-31.0 [eps:eps: 0.005 ])	OK -51.000000 (-51.0 [eps:eps: 0.005 ])	OK -31.000000 (-31.0 [eps:eps: 0.005 ])	OK -31.000000 (-31.0 [eps:eps: 0.005 ])	OK -31.000000 (-31.0 [eps:eps: 0.005 ])
#10000	1.0	-31	0.3	0	-31	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***
#10000	1.0	-51	0.3	120	-51	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***
#10000	1.0	-31	0.3	120	-31	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***
#10000	1.0	-51	1.3	120	-51	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***
#10000	1.0	-51	0.3	200	-51	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***
#10000	1.0	-31	0.3	200	-31	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***
#10000	1.0	-51	1.3	200	-51	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***	 *** MISSING! ***




s = Section('Scenario001 - Response of passive cell to step current injection',
        Section('Overview',
            Section('Description', VerbatimBlock(code, caption='Machine Readble Desc.')  ),
            Section('Notes', Paragraph(notes) ),
            Section('At a glance',  table1 ),
            ),
        )

#s.to_pdf(filename=os.path.expanduser("~/Desktop/f1.pdf"))
s.to_html(output_dir=os.path.expanduser("~/Desktop/test_html_out/"))
예제 #6
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import pylab, numpy
from mredoc import Section, Figure, Table

# A simple function that returns a matplotlib Figure
def generate_figure():
    fig = pylab.figure()
    t = numpy.linspace(0, 10)
    pylab.plot(t, numpy.exp(-t) * numpy.sin(10 * t))
    return fig

# Create the summary of the simulations
# and write to HTML and LaTeX
summary = Section("My Document",
        Section("A Sub-Section",
            "This is an introductory paragraph",
            Figure( generate_figure(), caption="$e^{-t}*sin(10t)$" ),
            Table(['x', '2x'], [('%d' % x, '%d' % (2*x) ) for x in [0, 1, 2, 3]]),
            "Some more text describing the results"
        )
    )
summary.to_pdf( filename="./_output/example1_minimal/pdf/output.pdf")
summary.to_html( output_dir="./_output/example1_minimal/html/")