Skip to content

Improve the construction of a 'Sample' from a Python script

Ammar Nejati requested to merge a.cleanUpSWIG_ImportSample into main

Construction of a Sample from a Python script is redesingned and fatal bugs are eliminated.

Based on the recent changes in the SWIG layer, the task of obtaining a Sample from a Python script is divided into two parts:

  • Reading and running the Python script, performed in PyCore/Embed/PyInterpreter module.
  • Constructing a C++ Sample instance from a Python Sample instance, performed in the SWIG layer libBornAgainSample.i.

This redesign leads to some simplifications and improvements in the BornAgain structure:

  • The module PyCore/Sample/ImportSample is not needed.
  • The extra SWIG header file swig_runtime.h is not needed.
  • The extraction of the C++ Sample instance from the Python object is performed in the Sample module (not in the PyCore module).

The module PyCore/Embed/PyInterpreter is reviewed and improved. The initialization and finalization of the embedded Python interpreter is performed properly.

Tests are done with Python scripts under Linux.

Resolves issue #1028 (closed)

Merge request reports

Loading