Class PythonRunner

java.lang.Object
org.scictrl.csshell.python.PythonRunner
Direct Known Subclasses:
EmittanceCalculator

public class PythonRunner extends Object

PythonRunner executes python scripts in working directory and parses returned output as double array.

Author:
igor@scictrl.com
  • Field Details

    • PYTHON_BIN

      public static final String PYTHON_BIN
      Constant PYTHON_BIN="/usr/bin/python3", points to Python executable, but be present on system.
      See Also:
  • Constructor Details

    • PythonRunner

      public PythonRunner()

      Constructor for PythonRunner.

  • Method Details

    • parseDouble

      public static final double parseDouble(String value)
      Parse string representing Python number and return as Java numeral.
      Parameters:
      value - string representing Python number
      Returns:
      number
    • setDirectory

      public void setDirectory(File directory)

      Setter for the field directory.

      Parameters:
      directory - a File object
    • getDirectory

      public File getDirectory()

      Getter for the field directory.

      Returns:
      a File object
    • setScript

      public void setScript(String script)

      Setter for the field script.

      Parameters:
      script - a String object
    • getScript

      public String getScript()

      Getter for the field script.

      Returns:
      a String object
    • executeArrayTransaction

      public PythonRunner.Result executeArrayTransaction(double... inputs)

      Executes string, add input double values are provided as list of input parameters for script, separated by space.

      Returned result is expected to be series of string lines. If line is started by # or empty space it is added to string result. If starts with character, then results are search within ( ) ad array separated by comma.

      Parameters:
      inputs - a double
      Returns:
      a PythonRunner.Result object
    • getLastData

      public double[] getLastData()

      Getter for the field lastData.

      Returns:
      an array of
      invalid reference
      double
      objects
    • getLastResult

      public PythonRunner.Result getLastResult()

      Getter for the field lastResult.

      Returns:
      a PythonRunner.Result object