Introduction to the Python API for NeurEco Parametric Frequency Sweep
Introduction to the Python API for NeurEco Parametric Frequency Sweep#
Note
The GUI functionality Export NeurEco to Python , see Export Parametric Frequency Sweep from the GUI to the Python API, facilitates the initial transition from the usage of NeurEco with the GUI to its usage with the Python API.
Two options are available for installing the python API:
Via the NeurEco GUI: Click on Python drop-list in the GUI and select Install NeurEco package to python. A window containing all the python environments found on the machine will appear. Select the environment to add NeurEco wrapper to it, and click on Install package. This will automatically install the python API for the chosen distribution.
Via the installation scripts: run the Install.py script that comes with the Python package (this will install it in the environment used to run the installation script).
Note
The Python API uses NumPy Python library. Make sure it is installed in the used environment.
To work with the Frequency Domain NeurEco models in Python, import NeurEcoFrequential library:
from NeurEco import NeurEcoFrequential as Frequential
To initialize a NeurEco model to handle the Parametric Frequency Sweep problem:
model= Frequential.PFS()
All the methods provided by the PFS class, can be viewed by calling the __method__ attributes:
print(model.__methods__)
**** NeurEco ParametricFrequencySweep methods: ****
- load
- save
- delete
- evaluate
- build
- get_input_count
- get_output_count
- load_model_from_checkpoint
- get_number_of_networks_from_checkpoint
- export_fmu
- compute_error
- perform_input_sweep
- get_denominator_size
To understand what each parameter of any method does and how to use it print the doc of the method, for example:
print(model.export_fmu.__doc__)
exports a neureco model to FMU (Functional Mock-up Interface)
:param fmu_path: string : path where to save the fmu file
:return: export_status: int: 0 if export is successful, other int if no