Skip to content

SWIG: redirect standard output/error when running under IPython

Description

This MR calls lal.swig_redirect_standard_output_error() to redirect standard output/error when running under IPython. The presence of the function get_ipython() is used to detect whether lal is being imported under IPython; this should detect terminal ipython sessions and Jupyter notebooks. In particular this should ensure that standard output/error from LAL functions is captured and written out in Jupyter notebooks.

(It is assumed that IPython is never used for production/cluster execution, which might be impacted by the small I/O overhead of lal.swig_redirect_standard_output_error().)

API Changes and Justification

Backwards Compatible Changes

  • This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions
  • This change adds new classes/functions/structs/types to a public C header file or Python module

Backwards Incompatible Changes

  • This change modifies an existing class/function/struct/type definition in a public C header file or Python module
  • This change removes an existing class/function/struct/type from a public C header file or Python module

Review Status

cc @adam-mercer feel free to approve & merge this for the release

Merge request reports