Generating .ka from kappy after parse_project

11 views
Skip to first unread message

Alex

unread,
Nov 27, 2018, 5:13:26 PM11/27/18
to kappa-users
Hi there,

Before I write my own and/or create a pull request, I was wondering if there is a undocumented way to use Kappy to output a .ka file?  in other words, I have a bunch of code that reads in several .ka files and does some overrides, but then I'd like to capture and save the model after it has been parsed as a .ka file.  e.g.  let's say I am constructing a model along the lines of the following:

    client = KappaStd()

    client.add_model_file("foo.ka")

    # vary the parameter
    initial_conds=[{'var': parameter_name, 'val': parameter_val}]
   
    if model == 'bar':
        client.add_model_file("bar.ka")
    elif model == 'baz':
        initial_conds.append({'var': 'something', 'val': '1.0'})
        client.add_model_file("baz.ka")
    else:
        print "can't find model"

    client.project_parse(overwrites=initial_conds)


At this point, I want to write the model out as a .ka file, so it can be reused outside the kappy framework, e.g. something like?

    client.write_model_file("full-model.ka")

I see the building blocks for this in file_create in kappa_common.py, so I can probably create a method to do this if I'm pointed at the right direction, and I can work on pull-request.

Cheers,
Alex
Reply all
Reply to author
Forward
0 new messages