Package org.scictrl.csshell.python
Class PythonRunner
java.lang.Object
org.scictrl.csshell.python.PythonRunner
- Direct Known Subclasses:
EmittanceCalculator
PythonRunner executes python scripts in working directory and parses returned output as double array.
- Author:
- igor@scictrl.com
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstantPYTHON_BIN="/usr/bin/python3", points to Python executable, but be present on system. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecuteArrayTransaction(double... inputs) Executes string, add input double values are provided as list of input parameters for script, separated by space.Getter for the fielddirectory.double[]Getter for the fieldlastData.Getter for the fieldlastResult.Getter for the fieldscript.static final doubleparseDouble(String value) Parse string representing Python number and return as Java numeral.voidsetDirectory(File directory) Setter for the fielddirectory.voidSetter for the fieldscript.
-
Field Details
-
PYTHON_BIN
ConstantPYTHON_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
Parse string representing Python number and return as Java numeral.- Parameters:
value- string representing Python number- Returns:
- number
-
setDirectory
Setter for the field
directory.- Parameters:
directory- aFileobject
-
getDirectory
Getter for the field
directory.- Returns:
- a
Fileobject
-
setScript
Setter for the field
script.- Parameters:
script- aStringobject
-
getScript
Getter for the field
script.- Returns:
- a
Stringobject
-
executeArrayTransaction
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.Resultobject
-
getLastData
public double[] getLastData()Getter for the field
lastData.- Returns:
- an array of
objects
invalid reference
double
-
getLastResult
Getter for the field
lastResult.- Returns:
- a
PythonRunner.Resultobject
-