Kappa-Dev/KappaTools

bug in kappy retrieval of snapshots with variables in their name

Opened this issue · 0 comments

Hi all,

It looks like parsing of snapshots via kappy is broken in newer versions of KappaTools. When the snapshots have variables like [E] in their name, kappy doesn't parse them. Example:

model_code = '''
%agent: A()
%init: 100 A()
'r1' A() -> . @ 0.001
%obs: 'A' |A()|
// model with snapshot
%mod: alarm 500.0 do $SNAPSHOT "snap".[E].".json";
'''
runtime = kappa_std.KappaStd(kappa_sim.KAPPY_URL_TO_USE)
runtime.add_model_string(model_code)
runtime.project_parse()
sim_params = kappy.SimulationParameter(pause_condition="[T] > 600", plot_period=0.1)
runtime.simulation_start(sim_params)
runtime.wait_for_simulation_stop()
result = runtime.simulation_plot()

then if we retrieve the snapshot IDs with:

runtime.simulation_snapshots()

yields, ['snap[E].json'], which is incorrect. (Though kappy will still give you the contents of that snapshot with runtime.simulation_snapshot('snap[E].json').)

If I run the same model via the command KaSim it of course works, producing snapshots such as snap36.json. This used to work with kappy too, if I remember correctly, but I recently upgraded and can't trace now which version had it working. Unless perhaps something else in the interface changed that I'm missing? Thanks.