Skip to content

Commit bb1394e

Browse files
committed
Bump NumPy Version
1 parent e242fe4 commit bb1394e

27 files changed

+186
-170
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v1.1.0 - 2025/03/11 - 00 - Bump NumPy Version
4+
* Updated all modules to support for NumPy 2.x.x.
5+
* Added deprecation warning to `qom.solvers.stochastic.MCQTSolver` class.
6+
* Updated `requirements` and `setup`.
7+
* Updated documentation and `README`.
8+
39
## v1.0.2 - 2024/06/23 - 00 - GUI Hotfix
410
* String support in axis values in `qom.loopers.base.BaseLooper` class.
511
* Updated `qom.solvers` package:

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# The Quantum Optomechanics Toolbox
22

3-
![Latest Version](https://img.shields.io/badge/version-1.0.2-red?style=for-the-badge)
3+
![Latest Version](https://img.shields.io/badge/version-1.1.0-red?style=for-the-badge)
44
[![Last Commit](https://img.shields.io/github/last-commit/sampreet/qom?style=for-the-badge)](https://github.com/sampreet/qom/blob/master/CHANGELOG.md)
55

6-
[![Last Release](https://img.shields.io/github/release-date/sampreet/qom?style=flat-square&label=Last%20Release)](https://github.com/sampreet/qom/releases/tag/v1.0.1)
6+
[![Last Release](https://img.shields.io/github/release-date/sampreet/qom?style=flat-square&label=Last%20Release)](https://github.com/sampreet/qom/releases/tag/v1.1.0)
77
[![Open Issues](https://img.shields.io/github/issues-raw/sampreet/qom?style=flat-square)](https://github.com/sampreet/qom/issues?q=is%3Aopen+is%3Aissue)
88
[![Closed Issues](https://img.shields.io/github/issues-closed-raw/sampreet/qom?style=flat-square)](https://github.com/sampreet/qom/issues?q=is%3Aissue+is%3Aclosed)
99

@@ -12,18 +12,22 @@
1212
The Quantum Optomechanics Toolbox (packaged as `qom`) is a wrapper-styled, scalable toolbox featuring multiple modules for the calculation of stationary as well as dynamical properties of many-body quantum optomechanical systems.
1313
Backed by numerical libraries like NumPy and SciPy, and featuring the highly customizable visualizations offered by Matplotlib and Seaborn APIs, the toolbox aims to serve as an easy-to-use alternative to writing code explicitly and avoiding repetitive exercises for presentable visuals.
1414

15+
> **Note**
16+
> The toolbox is not under active maintenance since 2023 and addition of newer features are not planned for the near future.
17+
> However, the current CPU-based modules fully support the simulation of linearized quantum optomechanical systems and their related analysis.
18+
> For the simulation of more general systems, ``QuTiP`` (``> v5.0``) provides a much faster interface.
19+
1520
### Key Features!
1621

1722
* Run automatically-managed loops in parallel and pool results.
1823
* Solve for stability and classical/quantum signatures seamlessly.
1924
* Configure plots across plotting libraries with a common syntax.
2025

21-
### What's New in v1.0!
26+
### What's New in v1.x!
2227

2328
* Non-linear Schrodinger equation solver with integration support.
2429
* Attractor detection and bifurcation for non-linear dynamical systems.
2530
* Huge performance boost with NumPy-based vectorization.
26-
* Faster Monte-Carlo quantum trajectories solver for low-dimensional Hilbert spaces (deprecated since `qom-v1.0.2`).
2731

2832
| Dynamical Stability | Quantum Correlations |
2933
|---|---|
@@ -58,6 +62,7 @@ Backed by numerical libraries like NumPy and SciPy, and featuring the highly cus
5862
| Wigner distribution depicting the evolution of mechanical squeezing in a modulated optomechanical system. | Soliton propagation in an array of optomechanical systems at different phase lags between the input solitons. |
5963

6064
A set of notebooks and scripts to demonstrate the usage of the toolbox can be found in the [examples repository](https://github.com/sampreet/qom-examples).
65+
Research papers solved using the toolbox can be found in the [papers repository](https://github.com/sampreet/qom-papers).
6166

6267
## Installation
6368

@@ -71,20 +76,20 @@ conda create -n qom python
7176
conda activate qom
7277
```
7378

74-
The toolbox primarily relies on `numpy` (for fast numerical algebra), `scipy` (for numerical methods), `sympy` (for symbolic algebra), `seaborn` (for color palettes) and `matplotlib` (for plotting results).
79+
The toolbox primarily relies on `numpy` (for fast numerical algebra), `scipy` (for numerical methods), `sympy` (for symbolic algebra), `matplotlib` (for plotting results) and `seaborn` (for color palettes).
7580
These libraries can be installed using:
7681

7782
```bash
78-
conda install matplotlib numpy scipy sympy seaborn
83+
conda install numpy scipy sympy matplotlib seaborn "pyqt<6.0.0"
7984
```
8085

81-
***Note: To run the GUI modules, `pyqt` should be installed separately.***
86+
***Note: PyQt5 is only required to run the GUI modules and can skipped.***
8287

83-
Once the dependencies are installed, the toolbox can be installed via PyPI or locally.
88+
Once the dependencies are installed, the toolbox can be installed via GitHub or locally.
8489

8590
The documentation of the latest release is available [here](https://sampreet.github.io/qom-docs).
8691

87-
### Installing via PyPI
92+
### Installing via GitHub
8893

8994
To install the last release via the Python Package Index, execute:
9095

docs/source/index.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. Quantum Optomechanics Toolbox documentation master file, created by
22
sphinx-quickstart on Fri Dec 4 15:06:12 2020.
33
4-
Welcome to the ``qom-v1.0.2`` Documentation!
4+
Welcome to the ``qom-v1.1.0`` Documentation!
55
============================================
66

77
The Quantum Optomechanics Toolbox (packaged as ``qom``) is a wrapper-styled, scalable toolbox featuring multiple modules for the calculation of stationary as well as dynamical properties of linearized quantum optomechanical systems.
@@ -19,13 +19,12 @@ Key Features
1919
* Solve for stability and classical/quantum signatures seamlessly.
2020
* Configure plots across plotting libraries with a common syntax.
2121

22-
What's New in v1.0!
22+
What's New in v1.x!
2323
-------------------
2424

2525
* Non-linear Schrodinger equation solver with integration support.
2626
* Attractor detection and bifurcation for non-linear dynamical systems.
2727
* Huge performance boost with NumPy-based vectorization.
28-
* Faster Monte-Carlo quantum trajectories solver for low-dimensional Hilbert spaces (deprecated since ``qom-v1.0.2``).
2928

3029
.. list-table::
3130
:widths: 50 50
@@ -97,6 +96,7 @@ Examples
9796
- Soliton propagation in an array of optomechanical systems at different phase lags between the input solitons.
9897

9998
A set of notebooks and scripts to demonstrate the usage of the toolbox can be found in the `examples repository <https://github.com/sampreet/qom-examples>`_.
99+
Research papers solved using the toolbox can be found in the `papers repository<https://github.com/sampreet/qom-papers>`_.
100100

101101
Installation
102102
============
@@ -112,21 +112,21 @@ Once ``Anaconda`` is set up, create and activate a new ``conda`` environment usi
112112
conda create -n qom python
113113
conda activate qom
114114
115-
The toolbox primarily relies on ``numpy`` (for fast numerical algebra), ``scipy`` (for numerical methods), ``sympy`` (for symbolic algebra), ``seaborn`` (for color palettes) and ``matplotlib`` (for plotting results).
115+
The toolbox primarily relies on ``numpy`` (for fast numerical algebra), ``scipy`` (for numerical methods), ``sympy`` (for symbolic algebra), ``matplotlib`` (for plotting results) and ``seaborn`` (for color palettes).
116116
These libraries can be installed using:
117117

118118
.. code-block:: bash
119119
120-
conda install matplotlib numpy scipy sympy seaborn
120+
conda install matplotlib numpy scipy sympy seaborn "pyqt<6.0.0"
121121
122-
.. note:: To run the GUI modules, ``pyqt`` should be installed separately.
122+
.. note:: PyQt5 is only required to run the GUI modules and can skipped..
123123

124-
Once the dependencies are installed, the toolbox can be installed via PyPI or locally.
124+
Once the dependencies are installed, the toolbox can be installed via GitHub or locally.
125125

126126
The documentation of the latest release is available `here <https://sampreet.github.io/qom-docs>`_.
127127

128-
Installing via PyPI
129-
-------------------
128+
Installing via GitHub
129+
---------------------
130130

131131
To install the packages via the Python Package Index (PyPI), execute:
132132

qom/loopers/base.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
__name__ = 'qom.loopers.base'
77
__authors__ = ["Sampreet Kalita"]
88
__created__ = "2020-12-21"
9-
__updated__ = "2023-10-28"
9+
__updated__ = "2025-03-11"
1010

1111
# dependencies
1212
from decimal import Decimal
@@ -168,7 +168,7 @@ def set_axis(self, axis:str):
168168
if type(_val[0]) is int:
169169
_val = np.array(_val, dtype=np.int32)
170170
elif type(_val[0]) is float:
171-
_val = np.array(_val, dtype=np.float_)
171+
_val = np.array(_val, dtype=np.float64)
172172
else:
173173
_val = np.array(_val)
174174
# update values
@@ -181,14 +181,14 @@ def set_axis(self, axis:str):
181181
assert 'min' in _axis and 'max' in _axis, "Key ``'{}'`` should contain keys ``'min'`` and ``'max'`` to define axis range".format(axis)
182182

183183
# extract dimension
184-
_min = np.float_(_axis['min'])
185-
_max = np.float_(_axis['max'])
184+
_min = np.float64(_axis['min'])
185+
_max = np.float64(_axis['max'])
186186
_dim = int(_axis.get('dim', 101))
187187
_scale = str(_axis.get('scale', 'linear'))
188188

189189
# handle single value
190190
if _dim == 1:
191-
_val = np.array([_min], dtype=np.float_)
191+
_val = np.array([_min], dtype=np.float64)
192192

193193
# set values
194194
else:
@@ -326,15 +326,15 @@ def get_X_results(self):
326326
for i in range(len(vals)):
327327
count = len(vals[i]) if len(vals[i]) > count else count
328328
dtype = type(vals[i][0]) if len(vals[i]) > 0 and dtype is None else dtype
329-
vs = np.empty((len(vals), count), dtype=np.float_ if dtype is None else dtype)
329+
vs = np.empty((len(vals), count), dtype=np.float64 if dtype is None else dtype)
330330
# update info
331331
self.updater.update_info(
332332
status="-" * (12 - len(self.name) - len(str(count))) + "Reshaping with NaN values (BaseLooper): New Length = {}".format(count)
333333
)
334334
# update extra entries to NaN
335335
for i in range(len(vals)):
336336
vs[i, :len(vals[i])] = vals[i]
337-
vs[i, len(vals[i]):] = np.NaN
337+
vs[i, len(vals[i]):] = np.nan
338338
# convert to lists
339339
vs = vs.tolist()
340340

qom/misc.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"""Module containing different operators."""
55

66
__name__ = 'qom.misc'
7-
__authors__ = ['Sampreet Kalita']
8-
__created__ = '2023-08-13'
9-
__updated__ = '2024-06-21'
7+
__authors__ = ["Sampreet Kalita"]
8+
__created__ = "2023-08-13"
9+
__updated__ = "2025-03-11"
1010

1111
# dependencies
1212
from copy import deepcopy
@@ -28,11 +28,11 @@ def op_annihilation(N):
2828
"""
2929

3030
# data
31-
data = np.sqrt(np.arange(1, N, dtype=np.complex_))
31+
data = np.sqrt(np.arange(1, N, dtype=np.complex128))
3232
# column indices
33-
indices = np.arange(1, N, dtype=np.int_)
33+
indices = np.arange(1, N, dtype=np.int32)
3434
# pointers to column indices
35-
indptr = np.arange(N + 1, dtype=np.int_)
35+
indptr = np.arange(N + 1, dtype=np.int32)
3636
indptr[-1] = N - 1
3737
# return annihilation operator
3838
return sp.csr_matrix((data, indices, indptr), shape=(N, N)).toarray()
@@ -69,11 +69,11 @@ def op_identity(N):
6969
"""
7070

7171
# data
72-
data = np.ones(N, dtype=np.complex_)
72+
data = np.ones(N, dtype=np.complex128)
7373
# column indices
74-
indices = np.arange(0, N, dtype=np.int_)
74+
indices = np.arange(0, N, dtype=np.int32)
7575
# pointers to column indices
76-
indptr = np.arange(N + 1, dtype=np.int_)
76+
indptr = np.arange(N + 1, dtype=np.int32)
7777
indptr[-1] = N
7878
# return identity operator
7979
return sp.csr_matrix((data, indices, indptr), shape=(N, N)).toarray()
@@ -92,7 +92,7 @@ def op_sigma_x():
9292
Pauli-X operator.
9393
"""
9494

95-
return np.array([[0, 1], [1, 0]], dtype=np.complex_)
95+
return np.array([[0, 1], [1, 0]], dtype=np.complex128)
9696

9797
def op_sigma_y():
9898
"""Function to obtain the Pauli-Y operator.
@@ -108,7 +108,7 @@ def op_sigma_y():
108108
Pauli-Y operator.
109109
"""
110110

111-
return np.array([[0, -1j], [1j, 0]], dtype=np.complex_)
111+
return np.array([[0, -1j], [1j, 0]], dtype=np.complex128)
112112

113113
def op_sigma_z():
114114
"""Function to obtain the Pauli-Z operator.
@@ -124,7 +124,7 @@ def op_sigma_z():
124124
Pauli-Z operator.
125125
"""
126126

127-
return np.array([[1, 0], [0, -1]], dtype=np.complex_)
127+
return np.array([[1, 0], [0, -1]], dtype=np.complex128)
128128

129129
def dagger(A):
130130
"""Function to obtain the Hermitian conjugate of an operator.
@@ -187,11 +187,11 @@ def state_fock(N, n):
187187
assert N > n, "Hilbert space dimension insufficient"
188188

189189
# data
190-
data = np.array([1], dtype=np.complex_)
190+
data = np.array([1], dtype=np.complex128)
191191
# row indices
192-
indices = np.array([n], dtype=np.int_)
192+
indices = np.array([n], dtype=np.int32)
193193
# pointers to row indices
194-
indptr = np.array([0, 1], dtype=np.int_)
194+
indptr = np.array([0, 1], dtype=np.int32)
195195
# return fock state
196196
return sp.csc_matrix((data, indices, indptr), shape=(N, 1)).toarray()
197197

qom/solvers/base.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
__name__ = 'qom.solvers.base'
77
__authors__ = ["Sampreet Kalita"]
88
__created__ = "2023-07-04"
9-
__updated__ = "2023-08-13"
9+
__updated__ = "2025-03-08"
1010

1111
# dependencies
1212
from decimal import Decimal
@@ -35,8 +35,8 @@ def get_all_times(params):
3535
"""
3636

3737
# extract frequently used variables
38-
t_min = np.float_(params['t_min'])
39-
t_max = np.float_(params['t_max'])
38+
t_min = np.float64(params['t_min'])
39+
t_max = np.float64(params['t_max'])
4040
t_dim = int(params['t_dim'])
4141

4242
# calculate times
@@ -80,8 +80,8 @@ def validate_Modes_Corrs(Modes=None, Corrs=None, is_modes_required:bool=False, i
8080
assert Corrs is not None if is_corrs_required else True, "Missing required parameter ``Corrs``"
8181

8282
# handle list
83-
Modes = np.array(Modes, dtype=np.complex_) if Modes is not None and type(Modes) is list else Modes
84-
Corrs = np.array(Corrs, dtype=np.float_) if Corrs is not None and type(Corrs) is list else Corrs
83+
Modes = np.array(Modes, dtype=np.complex128) if Modes is not None and type(Modes) is list else Modes
84+
Corrs = np.array(Corrs, dtype=np.float64) if Corrs is not None and type(Corrs) is list else Corrs
8585

8686
# validate shapes
8787
assert len(Modes.shape) == 2 if Modes is not None else True, "``Modes`` should be of shape ``(dim, num_modes)``"
@@ -116,15 +116,15 @@ def validate_As_Coeffs(As=None, Coeffs=None):
116116
# validate drift matrix
117117
assert isinstance(As, Union[list, np.ndarray].__args__), "``As`` should be of type ``list`` or ``numpy.ndarray``"
118118
# convert to numpy array
119-
As = np.array(As, dtype=np.float_) if type(As) is list else As
119+
As = np.array(As, dtype=np.float64) if type(As) is list else As
120120
# validate shape
121121
assert len(As.shape) == 3 and As.shape[1] == As.shape[2], "``As`` should be of shape ``(dim_0, 2 * num_modes, 2 * num_modes)``"
122122
# if coefficients are given
123123
else:
124124
# validate coefficients
125125
assert isinstance(Coeffs, Union[list, np.ndarray].__args__), "``Coeffs`` should be of type ``list`` or ``numpy.ndarray``"
126126
# convert to numpy array
127-
Coeffs = np.array(Coeffs, dtype=np.float_) if type(Coeffs) is list else Coeffs
127+
Coeffs = np.array(Coeffs, dtype=np.float64) if type(Coeffs) is list else Coeffs
128128
# validate shape
129129
assert len(Coeffs.shape) == 2, "``Coeffs`` should be of shape ``(dim_0, 2 * num_modes + 1)``"
130130

0 commit comments

Comments
 (0)