PySeascape Library#

A pythonic remotable interface to RedHawkSC and TotemSC that allows integration with other PyAnsys and Python libraries.

How to install#

Install from PyPI#

User installation can be performed by running:

pip install ansys-seascape

OR

python -m pip install ansys-seascape

Install from latest GitHub source#

Fetch latest source from GitHub:

cd <your-library-directory>
git clone https://github.com/pyansys/pyseascape.git

(Optional) Create and enable virtual environment. Please refer to official venv documentation for more help regarding virtual environment setup.

# Create a virtual environment
python -m venv .venv

# Activate it in a POSIX system
source .venv/bin/activate

# Activate it in Windows CMD environment
.venv\Scripts\activate.bat

# Activate it in Windows Powershell
.venv\Scripts\Activate.ps1

Run the setup script

cd pyseascape
python setup.py install

Install additional requirements (if needed):

python -m pip install -r requirements/requirements_build.txt
python -m pip install -r requirements/requirements_doc.txt
python -m pip install -r requirements/requirements_tests.txt

Usage#

Note: Either a local installation or remote connection to licensed RedHawk-SC is required to use the pyseascape library. This only offers a remotable frontend interface that can run directly in native Python on any machine.

Launching local RedHawk-SC in backend#

from ansys.seascape import RedHawkSC
gp = RedHawkSC(executable=path_to_executable)

OR

from ansys import seascape
gp = seascape.RedHawkSC(executable=path_to_executable)

Connecting to remote RedHawk-SC session#

from ansys.seascape import RedHawkSC
gp = RedHawkSC(url=url_or_ip_to_redhawksc_server:port)

All RedHawk-SC global functions can be called using prefix of RedHawkSC object name. Object methods can be called as normal.

Running RedHawk-SC commands#

For example:

# If gp = RedHawkSC(...)
db = gp.open_db(db_name)  # Returns a SeascapeDB remotable object
db.create_design_view(...)

# Creating RedHawk-SC objects
inst = gp.Instance('Inst_Name')

# RedHawk-SC modules must also be prefixed by gp
# E.g. using voltage_impact module
gp.voltage_impact.helpers.get_pgimpact_histograms(...)

Accessing RedHawk-SC help#

RedHawk-SC native help function supports command based as well as keyword based help. This help can be accessed remotely as well.

# If gp = RedHawkSC(...)

# command based help
gp.help(command='gp.Scatter')

# keyword based help
gp.help(keyword='scatter')

Known issues and limitations#

GUI features have not yet been implemented. Hence, commands like open_console_window, open_scheduler_window etc. will not work yet. Commands like gp.scatter_plot will also not work as it requires drawing GUI plots.

Documentation#

Please refer to RedHawk-SC Documentation.


Examples#

PySeascape can be used with local installation of RedHawk-SC or with a remote RedHawk-SC with running explorer_sc web service

PySeascape offers RedHawkSC (class) frontend client to connect to the RedHawk-SC (application) backend server

Connecting to local RedHawk-SC application#

If a local RedHawk-SC application exists, RedHawkSC can launch and connect to the application provided the executable path is provided.

Example:

from ansys.seascape.redhawk import RedHawkSC

exe_path = <path-to-redhawk_sc-executable>

gp = RedHawkSC(executable=exe_path)

Connecting to remote RedHawk-SC application#

In case of remote RedHawk-SC application, both RedHawk-SC application and explorer_sc server must be running. RedHawkSC can connect to the application using provided url to the explorer_sc server.

Example:

from ansys.seascape.redhawk import RedHawkSC

gp = RedHawkSC(url="http://<url-of-remote-explorer_sc-server>")

Using RedHawk-SC commands and scripts in pyseascape environment#

All RedHawk-SC commands and scripts can be used in PySeascape-Python environment with minimal or no changes. All RedHawk-SC function calls must be prefixed with name of RedHawkSC object.

For example:

"""
It is recommended to use gp as name for RedHawkSC object as it makes the script compatible
with almost direct execution on native RedHawk-SC application locally as well.
"""
gp = RedHawkSC(...)
db = gp.open_db("<path-to-db>")

# to call create_design_view on host
db.create_design_view()