Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.11
- name: Install dependencies
run: pip install wheel
- name: Build package
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=775"]
args: ["--maxkb=900"]
- id: check-merge-conflict
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
Expand Down
64 changes: 39 additions & 25 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ the PySensors approach to reconstruction problems and Brunton et al.
literature review along with examples and additional tips for
using PySensors effectively.

The diagram below shows current Pysensors capabilities.

.. figure:: docs/figures/pysensors-capabilities.png
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figure does not show up, change to jpeg

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, same issue. Figures do now show up.

:align: center
:alt: A diagram showing current pysensors capabilities.
:figclass: align-center

Reconstruction
^^^^^^^^^^^^^^
Expand All @@ -43,12 +49,18 @@ feed them to a ``SSPOR`` instance with 10 sensors, and
model = pysensors.reconstruction.SSPOR(n_sensors=10)
model.fit(data)

Use the ``predict`` method to reconstruct a new function sampled at the chosen sensor locations:
Use the ``predict`` method to reconstruct a new function sampled at the chosen sensor locations. There are two methods of reconstruction using ``predict``: ``Unregularized Reconstruction`` and ``Regularized Reconstruction``.


.. code-block:: python

f = numpy.abs(x[model.selected_sensors]**2 - 0.5)
f_pred = model.predict(f)
# Unregularized reconstruction can be used using the method ``unregularized``
f_pred_unregularized = model.predict(f, method='unregularized')
# Regularized reconstruction, on the other hand is the default method for predict. It also requires other parameters like prior and noise
f_pred_regularized = model.predict(f, prior, noise)

See `reconstruction comparison example <https://python-sensors.readthedocs.io/en/latest/examples/reconstruction_comparison.html>`__ for more information on the methods of reconstruction.

.. figure:: docs/figures/vandermonde.png
:align: center
Expand Down Expand Up @@ -89,24 +101,10 @@ Three strategies to deal with constraints are currently developed:
We have further provided functions to compute the sensors in the constrained regions. For example if the user provides the center and radius of a circular
constrained region, the constraints in utils compute the constrained sensor indices. Direct constraint plotting capabilities have also been developed.

The constrained shapes currently implemented are:

* ``Circle``

* ``Cylinder``

* ``Line``

* ``Parabola``
The constrained shapes currently implemented are: ``Circle``, ``Cylinder``, ``Line``, ``Parabola``, ``Ellipse``, ``Polygon``.
A user can also define their own constraints using ``UserDefinedConstraints``, this type of constraint has the ability to take in either a function or a .py file which contains a functional definition of the constrained region.

* ``Ellipse``

* ``Polygon``

* ``UserDefinedConstraints``

- This type of constraint has the ability to take in either a function from the user or a
.py file which contains a functional definition of the constrained region.
See `this example <https://python-sensors.readthedocs.io/en/latest/examples/Olivetti_constrained_sensing.html>`__ for more information.

Classification
^^^^^^^^^^^^^^
Expand All @@ -126,7 +124,7 @@ Bases
^^^^^
The basis in which measurement data are represented can have a dramatic
effect on performance. PySensors implements the three bases most commonly
used for sparse sensor placement: raw measurements, SVD/POD/PCA modes, and random projections. Bases can be easily incorporated into ``SSPOR`` and ``SSPOC`` classes:
used for sparse sensor placement: raw measurements, SVD/POD/PCA modes, and random projections. A user can also define their own custom basis. Bases can be easily incorporated into ``SSPOR`` and ``SSPOC`` classes:

.. code-block:: python

Expand All @@ -141,7 +139,7 @@ Installation

Dependencies
^^^^^^^^^^^^
The high-level dependencies for PySensors are Linux or macOS and Python 3.6-3.8. ``pip`` is also recommended as is makes managing PySensors' other dependencies much easier. You can install it by following the instructions `here <https://packaging.python.org/tutorials/installing-packages/#ensure-you-can-run-pip-from-the-command-line>`__.
The high-level dependencies for PySensors are Linux or macOS and Python 3.9-3.12. ``pip`` is also recommended as is makes managing PySensors' other dependencies much easier. You can install it by following the instructions `here <https://packaging.python.org/tutorials/installing-packages/#ensure-you-can-run-pip-from-the-command-line>`__.

PySensors has not been tested on Windows.

Expand Down Expand Up @@ -191,10 +189,23 @@ The primary PySensors objects are the ``SSPOR`` and ``SSPOC`` classes, which are

- ``Identity`` - use raw measurement data
- ``SVD`` - efficiently compute first k left singular vectors
- ``RandomProjection`` - Gaussian random projections of measurements
- ``RandomProjection`` - gaussian random projections of measurements
- ``CustomBasis`` - user defined bases ranging from DMD modes to Chebyshev polynomials

* ``optimizers`` - submodule implementing different optimizers to fit data

- ``QR`` - greedy QR optimizer
- ``CCQR`` - greedy cost constrained QR optimizer
- ``GQR`` - general QR optimizer
- ``TPGR`` - two point greedy optmizer
* Convenience functions to aid in the analysis of error as number of sensors or basis modes are varied

The diagram below outlines a flow chart of how a user can utilize pysensors.
.. figure:: docs/figures/pysensors-methods.png
:align: center
:alt: A flow chart of pysensors methods.
:figclass: align-center

Documentation
-------------
PySensors has a `documentation site <https://python-sensors.readthedocs.io/en/latest/index.html>`__ hosted by readthedocs.
Expand Down Expand Up @@ -300,12 +311,15 @@ References
(2018): 2642-2656.
`[DOI] <https://doi.org/10.1109/JSEN.2018.2887044>`__

- Karnik, Niharika, Mohammad G. Abdo, Carlos E. Estrada-Perez, Jun Soo Yoo,
Joshua J. Cogliati, Richard S. Skifton, Pattrick Calderoni, Steven L. Brunton, and Krithika Manohar.
"Constrained Optimization of Sensor Plcaement for Nuclear Digital Twins" IEEE Sensors Journal 24, no. 9
- Karnik, Niharika, Mohammad G. Abdo, Carlos E. Estrada-Perez, Jun Soo Yoo, Joshua J. Cogliati, Richard S. Skifton, Pattrick Calderoni, Steven L. Brunton, and Krithika Manohar.
"Constrained Optimization of Sensor Placement for Nuclear Digital Twins" IEEE Sensors Journal 24, no. 9
(2024): 15501 - 15516.
`[DOI] <https://doi.org/10.1109/JSEN.2024.3368875>`__

- Klishin, Andrei A., J. Nathan Kutz, Krithika Manohar
"Data-Induced Interations of Sparse Sensors" (2023)
`[DOI] <https://doi.org/10.48550/arXiv.2307.11838>`__

.. |Build| image:: https://github.com/dynamicslab/pysensors/actions/workflows/main.yml/badge.svg?branch=master
:target: https://github.com/dynamicslab/pysensors/actions?query=workflow%3ACI

Expand Down
Binary file added docs/figures/pysensors-capabilities.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/figures/pysensors-methods.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 7 additions & 24 deletions examples/OPTI-TWIST_constrained_sensing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,30 @@
"\n",
"In this notebook we particularly showcase the functionalities offered by the constraints class.For example if the user provides the center and radius of a circular constrained region, the constraints in utils compute the constrained sensor indices. Direct constraint plotting capabilities have also been developed.\n",
"\n",
"The constrained shapes currently implemented are:\n",
"The constrained shapes currently implemented are: Circle, Cylinder, Line, Parabola, Ellipse, and Polygon\n",
"\n",
"Circle\n",
"\n",
"Cylinder\n",
"\n",
"Line\n",
"\n",
"Parabola\n",
"\n",
"Ellipse\n",
"\n",
"Polygon\n",
"\n",
"UserDefinedConstraints\n",
"\n",
"This type of constraint has the ability to take in either a function from the user or a\n",
"A user can define their own constrained shape using UserDefinedConstraints to take in either a function from the user or a\n",
".py file which contains a functional definition of the constrained region.\n",
"\n",
"See the following reference for more information ([link1](https://ieeexplore.ieee.org/abstract/document/10453459), [link2](https://www.mdpi.com/1996-1073/17/13/3355))\n",
"See the following reference for more information,\n",
"\n",
"Karnik N, Abdo MG, Estrada-Perez CE, Yoo JS, Cogliati JJ, Skifton RS, Calderoni P, Brunton SL, Manohar K. Constrained optimization of sensor placement for nuclear digital twins. IEEE Sensors Journal. 2024 Feb 28.\n",
"Karnik N, Abdo MG, Estrada-Perez CE, Yoo JS, Cogliati JJ, Skifton RS, Calderoni P, Brunton SL, Manohar K. Constrained optimization of sensor placement for nuclear digital twins. IEEE Sensors Journal. 2024 Feb 28. [(link)](https://ieeexplore.ieee.org/abstract/document/10453459)\n",
"\n",
"Karnik N, Wang C, Bhowmik PK, Cogliati JJ, Balderrama Prieto SA, Xing C, Klishin AA, Skifton R, Moussaoui M, Folsom CP, Palmer JJ, Sabharwall P, Manohar K, Abdo MG., Leveraging Optimal Sparse Sensor Placement to Aggregate a Network of Digital Twins for Nuclear Subsystems. Energies (19961073). 2024 Jul 1;17(13).\n",
"Karnik N, Wang C, Bhowmik PK, Cogliati JJ, Balderrama Prieto SA, Xing C, Klishin AA, Skifton R, Moussaoui M, Folsom CP, Palmer JJ, Sabharwall P, Manohar K, Abdo MG., Leveraging Optimal Sparse Sensor Placement to Aggregate a Network of Digital Twins for Nuclear Subsystems. Energies (19961073). 2024 Jul 1;17(13). [(link)](https://www.mdpi.com/1996-1073/17/13/3355)\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from time import time\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from sklearn import datasets\n",
"import warnings\n",
"warnings.filterwarnings('ignore')\n",
"import pysensors as ps\n",
"from mpl_toolkits.axes_grid1 import make_axes_locatable"
"import pysensors as ps"
]
},
{
Expand Down
Loading
Loading