Skip to content

Commit

Permalink
fix: doc examples
Browse files Browse the repository at this point in the history
  • Loading branch information
acarvalh-work committed Aug 4, 2023
1 parent 836ada2 commit ee6ae04
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 49 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ instance/

# Sphinx documentation
doc/_build/
_autosummary
doc/source/examples
doc/build_errors.txt

# PyBuilder
.pybuilder/
Expand Down
10 changes: 5 additions & 5 deletions doc/source/examples/00-pyunits/basic_usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Accessing different quantity properties\nQuantity objects have a total of 7 properties:\n 1. value : float | int\n 2. units : str\n 3. si_value : float | int\n 4. si_units : str\n 5. dimensions : list\n 6. is_dimensionless : bool\n 7. type : str\n\n"
"## Quantity properties\nQuantity objects have a total of 7 properties:\n 1. value : float | int\n 2. units : str\n 3. si_value : float | int\n 4. si_units : str\n 5. dimensions : list\n 6. is_dimensionless : bool\n 7. type : str\n\n"
]
},
{
Expand All @@ -87,7 +87,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Performing arithmetic operations\nQuantity objects support all mathematical operations.\n\n"
"## Arithmetic operations\nQuantity objects support all mathematical operations.\n\n"
]
},
{
Expand All @@ -105,7 +105,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Performing unit conversions\nConversions can be performed between Quantities with compatible units.\n\n"
"## Unit conversions\nConversions can be performed between Quantities with compatible units.\n\n"
]
},
{
Expand All @@ -123,7 +123,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Creating unit systems\nUnit Systems can be instantiated with 1 of 2 methods:\n 1. Custom Units\n 2. Pre-defined Unit System\n\n"
"## Unit systems\nUnit Systems can be instantiated with 1 of 2 methods:\n 1. Custom Units\n 2. Pre-defined Unit System\n\n"
]
},
{
Expand All @@ -141,7 +141,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Applying unit systems to quantities\nUnit Systems can be created independently and applied to desired Quantities.\n\n"
"## Unit systems and Quantities\nUnit Systems can be created independently and applied to desired Quantities.\n\n"
]
},
{
Expand Down
20 changes: 10 additions & 10 deletions doc/source/examples/00-pyunits/basic_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
torque = q.Quantity(value=5, quantity_map=tor_map)

###############################################################################
# Accessing different quantity properties
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Quantity properties
# ~~~~~~~~~~~~~~~~~~~
# Quantity objects have a total of 7 properties:
# 1. value : float | int
# 2. units : str
Expand All @@ -91,8 +91,8 @@
capacitance.type # >>> "Derived"

###############################################################################
# Performing arithmetic operations
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Arithmetic operations
# ~~~~~~~~~~~~~~~~~~~~~
# Quantity objects support all mathematical operations.

import math
Expand Down Expand Up @@ -146,8 +146,8 @@
math.cos(q.Quantity(math.pi, "radian")) # >>> -1.0

###############################################################################
# Performing unit conversions
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Unit conversions
# ~~~~~~~~~~~~~~~~
# Conversions can be performed between Quantities with compatible units.

slug = q.Quantity(value=5, units="slug")
Expand All @@ -169,8 +169,8 @@
pas.units # >>> "Pa s"

###############################################################################
# Creating unit systems
# ~~~~~~~~~~~~~~~~~~~~~
# Unit systems
# ~~~~~~~~~~~~
# Unit Systems can be instantiated with 1 of 2 methods:
# 1. Custom Units
# 2. Pre-defined Unit System
Expand All @@ -191,8 +191,8 @@
cgs.base_units # >>> ['g', 'cm', 's', 'K', 'radian', 'mol', 'cd', 'A', 'sr']

###############################################################################
# Applying unit systems to quantities
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Unit systems and Quantities
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Unit Systems can be created independently and applied to desired Quantities.

si = q.UnitSystem(unit_sys="SI")
Expand Down
2 changes: 1 addition & 1 deletion doc/source/examples/00-pyunits/basic_usage.py.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9f3ae7a96044bd25153dea208b1db395
4fd8bb2946f8a5e7f2a79c2308123052
22 changes: 11 additions & 11 deletions doc/source/examples/00-pyunits/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ Quantities can be instantiated with 1 of 3 methods:
.. GENERATED FROM PYTHON SOURCE LINES 71-81
Accessing different quantity properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quantity properties
~~~~~~~~~~~~~~~~~~~
Quantity objects have a total of 7 properties:
1. value : float | int
2. units : str
Expand Down Expand Up @@ -167,8 +167,8 @@ Quantity objects have a total of 7 properties:
.. GENERATED FROM PYTHON SOURCE LINES 94-97
Performing arithmetic operations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Arithmetic operations
~~~~~~~~~~~~~~~~~~~~~
Quantity objects support all mathematical operations.

.. GENERATED FROM PYTHON SOURCE LINES 97-148
Expand Down Expand Up @@ -241,8 +241,8 @@ Quantity objects support all mathematical operations.
.. GENERATED FROM PYTHON SOURCE LINES 149-152
Performing unit conversions
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unit conversions
~~~~~~~~~~~~~~~~
Conversions can be performed between Quantities with compatible units.

.. GENERATED FROM PYTHON SOURCE LINES 152-171
Expand Down Expand Up @@ -283,8 +283,8 @@ Conversions can be performed between Quantities with compatible units.
.. GENERATED FROM PYTHON SOURCE LINES 172-177
Creating unit systems
~~~~~~~~~~~~~~~~~~~~~
Unit systems
~~~~~~~~~~~~
Unit Systems can be instantiated with 1 of 2 methods:
1. Custom Units
2. Pre-defined Unit System
Expand Down Expand Up @@ -324,8 +324,8 @@ Unit Systems can be instantiated with 1 of 2 methods:
.. GENERATED FROM PYTHON SOURCE LINES 194-197
Applying unit systems to quantities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unit systems and Quantities
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unit Systems can be created independently and applied to desired Quantities.

.. GENERATED FROM PYTHON SOURCE LINES 197-205
Expand Down Expand Up @@ -356,7 +356,7 @@ Unit Systems can be created independently and applied to desired Quantities.
.. rst-class:: sphx-glr-timing

**Total running time of the script:** ( 0 minutes 3.435 seconds)
**Total running time of the script:** ( 0 minutes 3.446 seconds)


.. _sphx_glr_download_examples_00-pyunits_basic_usage.py:
Expand Down
Binary file modified doc/source/examples/00-pyunits/basic_usage_codeobj.pickle
Binary file not shown.
4 changes: 2 additions & 2 deletions doc/source/examples/00-pyunits/sg_execution_times.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

Computation times
=================
**00:03.435** total execution time for **examples_00-pyunits** files:
**00:03.446** total execution time for **examples_00-pyunits** files:

+-------------------------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_examples_00-pyunits_basic_usage.py` (``basic_usage.py``) | 00:03.435 | 0.0 MB |
| :ref:`sphx_glr_examples_00-pyunits_basic_usage.py` (``basic_usage.py``) | 00:03.446 | 0.0 MB |
+-------------------------------------------------------------------------+-----------+--------+
21 changes: 1 addition & 20 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,7 @@ the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>

License
-------
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

PyUnits is Licensed under the MIT License.

Project index
-------------
Expand Down

0 comments on commit ee6ae04

Please sign in to comment.