Skip to content

Add some functions to SessionReader's Python interface

Issue/feature addressed

When analysing a simulation in Python, it's useful to be able to retrieve the variable names and parameter values that were set in a session.

Proposed solution

Add 'GetParameters' and 'GetVariables' functions to SessionReader's Python interface.

Implementation

The two functions populate a boost::python::dict and a boost::python::list respectively, rather than using map_indexing_suite and map_indexing_suite to do the conversions. I'd argue that having slightly uglier code on the c++ side is a price worth paying for returning native Python containers (that come with a sensible __str__() method built in, for example), but I'm happy to change it if others disagree!

Tests

None added.

Checklist

  • Functions and classes, or changes to them, are documented.
  • User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by Owen Parry

Merge request reports