Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc/update #62

Merged
merged 10 commits into from
Jan 24, 2023
Binary file modified doc/source/_static/ansys_dt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions doc/source/api/examples/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. _ref_index_api_example:

Other Functions
===============

Other useful functions available and used for the examples implemented (see :ref:`ref_example_gallery`).

.. currentmodule:: pytwin

.. autosummary::
:toctree: _autosummary

pytwin.download_file
pytwin.load_data
5 changes: 5 additions & 0 deletions doc/source/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Global Settings
:ref:`ref_index_api_logging` describe the global settings (e.g. logging and working directory options) available from
PyTwin package and how to change them from their default values

Other Functions
---------------

Additional useful functions used for the examples implementation are described in :ref:`ref_index_api_example`.

.. currentmodule:: pytwin

Expand All @@ -40,3 +44,4 @@ PyTwin package and how to change them from their default values
sdk/index
evaluate/index
logging/index
examples/index
24 changes: 20 additions & 4 deletions src/ansys/pytwin/examples/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ def download_file(
Returns
-------
str
Path to the folder containing all example data files.
Path to the downloaded file.

Examples
--------
Download an example result file and return the path of the file
>>> from pytwin import examples
>>> path = examples.download_file("CoupledClutches_23R1_other.twin", "twin_files", force_download=True)
"""
Expand All @@ -146,8 +145,25 @@ def download_file(


def load_data(inputs: str):
"""Load a CSV input file into a Pandas Dataframe. Inputs is the path of the CSV file to be loaded,
containing the Time column and all the Twin inputs data"""
"""
Load a CSV input file into a Pandas Dataframe.

Parameters
----------
inputs : str
Path of the CSV file to be loaded, containing the Time column and all the Twin inputs data.

Returns
-------
inputs_df: pandas.DataFrame
A ``pandas.DataFrame`` storing time values as well as all the corresponding input data.

Examples
--------
>>> from pytwin import load_data, download_file
>>> csv_input = download_file("CoupledClutches_input.csv", "twin_input_files")
>>> twin_model_input_df = load_data(csv_input)
"""

# Clean CSV headers if exported from Twin builder
def clean_column_names(column_names):
Expand Down
13 changes: 13 additions & 0 deletions src/ansys/pytwin/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ class PyTwinLogLevel(Enum):
"""
Enum to choose logging level to be used by all pytwin objects.
It follows standard python logging levels.

PYTWIN_LOG_DEBUG:
Detailed information, typically of interest only when diagnosing problems.
PYTWIN_LOG_INFO:
Confirmation that things are working as expected.
PYTWIN_LOG_WARNING:
An indication that something unexpected happened, or indicative of some problem in the near future
(e.g. ‘disk space low’). The software is still working as expected.
PYTWIN_LOG_ERROR:
Due to a more serious problem, the software has not been able to perform some function.
PYTWIN_LOG_CRITICAL:
A serious error, indicating that the program itself may be unable to continue running.

"""

PYTWIN_LOG_DEBUG = logging.DEBUG
Expand Down