예제 #1
0
            '-t Maple --compute-full-jacobian': '.mpl'
        })
    if gen_jacobian:
        transforms.update({'J': '_J.m'})
elif haskell:
    transforms = {'-t Haskell': '.hs', '-p -t Haskell': '_pe.hs'}
    prefix = 'Cml_'
else:
    transforms = {
        '': '.hpp',
        '-l': '_lut.hpp',
        '-p': '_pe.hpp',
        '-l -p': '_pe_lut.hpp'
    }

v = validator.CellMLValidator()
notifier = translate.NotifyHandler(level=logging.WARNING_TRANSLATE_ERROR)
logging.getLogger('validator').addHandler(notifier)


def transform(model_file):
    if not os.path.exists(model_file):
        print model_file, "does not exist!"
        return
    model_base = os.path.splitext(model_file)[0]
    if prefix:
        # We need to add a prefix to the file name
        d = os.path.dirname(model_base)
        b = os.path.basename(model_base)
        model_base = os.path.join(d, prefix + b)
예제 #2
0
## Debugging
#print """<p>
#show_warnings=%s<br />
#show_errors=%s
#</p>""" % (show_warnings, show_errors)

#print "<code>%s</code>" % str(dir(cellml.file))
#print "<p>%s</p>" % cellml.file.readline().replace('<', '&lt;')

#cgi.print_directory()
#cgi.print_environ()

# Load validator module and create validator
import validator as val_mod
validator = val_mod.CellMLValidator()

# Create StringIO objects to collect any warning/error messages,
# if required
if show_warnings:
    warnings = StringIO()
else:
    warnings = None
if show_errors:
    errors = StringIO()
else:
    errors = None

print """
  <h2>Validating file '%s'</h2>
""" % cellml.filename