brainunit 0.0.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- brainunit-0.0.16/PKG-INFO +174 -0
- brainunit-0.0.16/README.md +133 -0
- brainunit-0.0.16/brainunit/__init__.py +65 -0
- brainunit-0.0.16/brainunit/_base.py +20 -0
- brainunit-0.0.16/brainunit/_celsius.py +20 -0
- brainunit-0.0.16/brainunit/_unit_common.py +19 -0
- brainunit-0.0.16/brainunit/_unit_constants.py +20 -0
- brainunit-0.0.16/brainunit/_unit_shortcuts.py +20 -0
- brainunit-0.0.16/brainunit/autograd/__init__.py +30 -0
- brainunit-0.0.16/brainunit/autograd/_hessian.py +19 -0
- brainunit-0.0.16/brainunit/autograd/_jacobian.py +19 -0
- brainunit-0.0.16/brainunit/autograd/_value_and_grad.py +19 -0
- brainunit-0.0.16/brainunit/autograd/_vector_grad.py +19 -0
- brainunit-0.0.16/brainunit/constants.py +20 -0
- brainunit-0.0.16/brainunit/fft/__init__.py +25 -0
- brainunit-0.0.16/brainunit/fft/_fft_change_unit.py +19 -0
- brainunit-0.0.16/brainunit/fft/_fft_keep_unit.py +20 -0
- brainunit-0.0.16/brainunit/lax/__init__.py +45 -0
- brainunit-0.0.16/brainunit/lax/_lax_accept_unitless.py +19 -0
- brainunit-0.0.16/brainunit/lax/_lax_array_creation.py +19 -0
- brainunit-0.0.16/brainunit/lax/_lax_change_unit.py +20 -0
- brainunit-0.0.16/brainunit/lax/_lax_keep_unit.py +20 -0
- brainunit-0.0.16/brainunit/lax/_lax_linalg.py +20 -0
- brainunit-0.0.16/brainunit/lax/_lax_remove_unit.py +20 -0
- brainunit-0.0.16/brainunit/lax/_misc.py +20 -0
- brainunit-0.0.16/brainunit/linalg/__init__.py +25 -0
- brainunit-0.0.16/brainunit/linalg/_linalg_change_unit.py +19 -0
- brainunit-0.0.16/brainunit/linalg/_linalg_keep_unit.py +19 -0
- brainunit-0.0.16/brainunit/linalg/_linalg_remove_unit.py +20 -0
- brainunit-0.0.16/brainunit/math/__init__.py +61 -0
- brainunit-0.0.16/brainunit/math/_activation.py +20 -0
- brainunit-0.0.16/brainunit/math/_alias.py +20 -0
- brainunit-0.0.16/brainunit/math/_einops.py +20 -0
- brainunit-0.0.16/brainunit/math/_fun_accept_unitless.py +20 -0
- brainunit-0.0.16/brainunit/math/_fun_array_creation.py +20 -0
- brainunit-0.0.16/brainunit/math/_fun_change_unit.py +20 -0
- brainunit-0.0.16/brainunit/math/_fun_keep_unit.py +20 -0
- brainunit-0.0.16/brainunit/math/_fun_remove_unit.py +20 -0
- brainunit-0.0.16/brainunit/math/_misc.py +20 -0
- brainunit-0.0.16/brainunit/math/fft.py +20 -0
- brainunit-0.0.16/brainunit/math/linalg.py +20 -0
- brainunit-0.0.16/brainunit/sparse/__init__.py +22 -0
- brainunit-0.0.16/brainunit/sparse/_block_csr.py +20 -0
- brainunit-0.0.16/brainunit/sparse/_block_ell.py +20 -0
- brainunit-0.0.16/brainunit/sparse/_coo.py +20 -0
- brainunit-0.0.16/brainunit/sparse/_csr.py +20 -0
- brainunit-0.0.16/brainunit.egg-info/PKG-INFO +174 -0
- brainunit-0.0.16/brainunit.egg-info/SOURCES.txt +52 -0
- brainunit-0.0.16/brainunit.egg-info/dependency_links.txt +1 -0
- brainunit-0.0.16/brainunit.egg-info/requires.txt +15 -0
- brainunit-0.0.16/brainunit.egg-info/top_level.txt +1 -0
- brainunit-0.0.16/pyproject.toml +70 -0
- brainunit-0.0.16/setup.cfg +4 -0
- brainunit-0.0.16/setup.py +33 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: brainunit
|
|
3
|
+
Version: 0.0.16
|
|
4
|
+
Summary: Physical Units and Unit-Aware Mathematical System for General-Purpose Brain Dynamics Modeling
|
|
5
|
+
Author-email: BrainUnit Developers <chao.brain@qq.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: homepage, https://github.com/chaobrain/brainunit
|
|
8
|
+
Project-URL: repository, https://github.com/chaobrain/brainunit
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/chaobrain/brainunit/issues
|
|
10
|
+
Project-URL: Documentation, https://brainunit.readthedocs.io/
|
|
11
|
+
Keywords: physical unit,physical quantity,brain modeling
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
Requires-Dist: numpy
|
|
31
|
+
Requires-Dist: typing_extensions
|
|
32
|
+
Requires-Dist: saiunit==0.0.16
|
|
33
|
+
Provides-Extra: testing
|
|
34
|
+
Requires-Dist: pytest; extra == "testing"
|
|
35
|
+
Provides-Extra: cpu
|
|
36
|
+
Requires-Dist: jax[cpu]; extra == "cpu"
|
|
37
|
+
Provides-Extra: cuda12
|
|
38
|
+
Requires-Dist: jax[cuda12]; extra == "cuda12"
|
|
39
|
+
Provides-Extra: tpu
|
|
40
|
+
Requires-Dist: jax[tpu]; extra == "tpu"
|
|
41
|
+
|
|
42
|
+
<h1 align='center'>BrainUnit</h1>
|
|
43
|
+
<h2 align='center'>Physical units and unit-aware math system for general-purpose brain dynamics modeling</h2>
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<img alt="Header image of brainunit." src="https://raw.githubusercontent.com/chaobrain/saiunit/main/docs/_static/brainunit.png" width=30%>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
<p align="center">
|
|
52
|
+
<a href="https://pypi.org/project/brainunit/"><img alt="Supported Python Version" src="https://img.shields.io/pypi/pyversions/brainunit"></a>
|
|
53
|
+
<a href="https://github.com/chaobrain/brainunit/blob/main/LICENSE"><img alt="LICENSE" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a>
|
|
54
|
+
<a href='https://brainunit.readthedocs.io/?badge=latest'>
|
|
55
|
+
<img src='https://readthedocs.org/projects/brainunit/badge/?version=latest' alt='Documentation Status' />
|
|
56
|
+
</a>
|
|
57
|
+
<a href="https://badge.fury.io/py/brainunit"><img alt="PyPI version" src="https://badge.fury.io/py/brainunit.svg"></a>
|
|
58
|
+
<a href="https://pepy.tech/projects/brainunit"><img src="https://static.pepy.tech/badge/brainunit" alt="PyPI Downloads"></a>
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
[BrainUnit](https://github.com/chaobrain/brainunit) provides physical units and unit-aware mathematical system in JAX for brain dynamics modeling. It introduces rigoirous physical units into high-performance AI-driven abstract numerical computing.
|
|
65
|
+
|
|
66
|
+
BrainUnit is initially designed to enable unit-aware computations in brain dynamics modeling (see our [BDP ecosystem](https://ecosystem-for-brain-dynamics.readthedocs.io/)). However, its features and capacities can be applied to general domains in scientific computing and AI4Science. Starting in 2025/02, BrainUnit has been fully integrated into [SAIUnit](https://github.com/chaobrain/saiunit) (the **Unit** system for **S**cientific **AI**).
|
|
67
|
+
|
|
68
|
+
Functionalities are the same for both ``brainunit`` and ``saiunit``, and their functions and data structures are interoperable, sharing the same set of APIs, and eliminating any potential conflicts. This meas that
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import brainunit as u
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
equals to
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
import saiunit as u
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
For users primarily engaged in general scientific computing, `saiunit` is likely the preferred choice. However, for those focused on brain modeling, we recommend `brainunit`, as it is more closely aligned with our specialized brain dynamics programming ecosystem.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## Documentation
|
|
85
|
+
|
|
86
|
+
The official documentation of BrainUnit is hosted on Read the Docs: [https://brainunit.readthedocs.io](https://brainunit.readthedocs.io)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## Features
|
|
91
|
+
|
|
92
|
+
`brainunit` can be seamlessly integrated into every aspect of our [brain dynamics programming ecosystem](https://ecosystem-for-brain-dynamics.readthedocs.io/), such as, the checkpointing of [braintools](https://github.com/chaobrain/braintools), the event-driven operators in [brainevent](https://github.com/chaobrain/brainevent), the state-based JIT compilation in [brainstate](https://github.com/chaobrain/brainstate), online learning rules in [brainscale](https://github.com/chaobrain/brainscale), or event more.
|
|
93
|
+
|
|
94
|
+
A quick example for this kind of integration:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
|
|
98
|
+
import braintools
|
|
99
|
+
import brainevent
|
|
100
|
+
import brainstate
|
|
101
|
+
import brainunit as u
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class EINet(brainstate.nn.Module):
|
|
105
|
+
def __init__(self):
|
|
106
|
+
super().__init__()
|
|
107
|
+
self.n_exc = 3200
|
|
108
|
+
self.n_inh = 800
|
|
109
|
+
self.num = self.n_exc + self.n_inh
|
|
110
|
+
self.N = brainstate.nn.LIFRef(
|
|
111
|
+
self.num, V_rest=-60. * u.mV, V_th=-50. * u.mV, V_reset=-60. * u.mV,
|
|
112
|
+
tau=20. * u.ms, tau_ref=5. * u.ms,
|
|
113
|
+
V_initializer=brainstate.init.Normal(-55., 2., unit=u.mV)
|
|
114
|
+
)
|
|
115
|
+
self.E = brainstate.nn.AlignPostProj(
|
|
116
|
+
comm=brainstate.nn.EventFixedProb(self.n_exc, self.num, 0.02, 0.6 * u.mS),
|
|
117
|
+
syn=brainstate.nn.Expon.desc(self.num, tau=5. * u.ms),
|
|
118
|
+
out=brainstate.nn.COBA.desc(E=0. * u.mV),
|
|
119
|
+
post=self.N
|
|
120
|
+
)
|
|
121
|
+
self.I = brainstate.nn.AlignPostProj(
|
|
122
|
+
comm=brainstate.nn.EventFixedProb(self.n_inh, self.num, 0.02, 6.7 * u.mS),
|
|
123
|
+
syn=brainstate.nn.Expon.desc(self.num, tau=10. * u.ms),
|
|
124
|
+
out=brainstate.nn.COBA.desc(E=-80. * u.mV),
|
|
125
|
+
post=self.N
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
def update(self, t, inp):
|
|
129
|
+
with brainstate.environ.context(t=t):
|
|
130
|
+
spk = self.N.get_spike() != 0.
|
|
131
|
+
self.E(spk[:self.n_exc])
|
|
132
|
+
self.I(spk[self.n_exc:])
|
|
133
|
+
self.N(inp)
|
|
134
|
+
return self.N.get_spike()
|
|
135
|
+
|
|
136
|
+
def save_checkpoint(self):
|
|
137
|
+
braintools.file.msgpack_save('states.msgpack', self.states())
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
## Installation
|
|
144
|
+
|
|
145
|
+
You can install ``brainunit`` via pip:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
pip install brainunit --upgrade
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
## Citation
|
|
153
|
+
|
|
154
|
+
If you use `brainunit` in your research, please consider citing the following paper:
|
|
155
|
+
|
|
156
|
+
```bibtex
|
|
157
|
+
@article{wang2025integrating,
|
|
158
|
+
title={Integrating physical units into high-performance AI-driven scientific computing},
|
|
159
|
+
author={Wang, Chaoming and He, Sichao and Luo, Shouwei and Huan, Yuxiang and Wu, Si},
|
|
160
|
+
journal={Nature Communications},
|
|
161
|
+
volume={16},
|
|
162
|
+
number={1},
|
|
163
|
+
pages={3609},
|
|
164
|
+
year={2025},
|
|
165
|
+
publisher={Nature Publishing Group UK London},
|
|
166
|
+
url={https://doi.org/10.1038/s41467-025-58626-4}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## See also the BDP ecosystem
|
|
173
|
+
|
|
174
|
+
We are building the [brain dynamics programming (BDP) ecosystem](https://ecosystem-for-brain-dynamics.readthedocs.io/). [brainunit](https://github.com/chaobrain/brainunit) has been deeply integrated into our BDP ecosystem.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<h1 align='center'>BrainUnit</h1>
|
|
2
|
+
<h2 align='center'>Physical units and unit-aware math system for general-purpose brain dynamics modeling</h2>
|
|
3
|
+
|
|
4
|
+
<p align="center">
|
|
5
|
+
<img alt="Header image of brainunit." src="https://raw.githubusercontent.com/chaobrain/saiunit/main/docs/_static/brainunit.png" width=30%>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://pypi.org/project/brainunit/"><img alt="Supported Python Version" src="https://img.shields.io/pypi/pyversions/brainunit"></a>
|
|
12
|
+
<a href="https://github.com/chaobrain/brainunit/blob/main/LICENSE"><img alt="LICENSE" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a>
|
|
13
|
+
<a href='https://brainunit.readthedocs.io/?badge=latest'>
|
|
14
|
+
<img src='https://readthedocs.org/projects/brainunit/badge/?version=latest' alt='Documentation Status' />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://badge.fury.io/py/brainunit"><img alt="PyPI version" src="https://badge.fury.io/py/brainunit.svg"></a>
|
|
17
|
+
<a href="https://pepy.tech/projects/brainunit"><img src="https://static.pepy.tech/badge/brainunit" alt="PyPI Downloads"></a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
[BrainUnit](https://github.com/chaobrain/brainunit) provides physical units and unit-aware mathematical system in JAX for brain dynamics modeling. It introduces rigoirous physical units into high-performance AI-driven abstract numerical computing.
|
|
24
|
+
|
|
25
|
+
BrainUnit is initially designed to enable unit-aware computations in brain dynamics modeling (see our [BDP ecosystem](https://ecosystem-for-brain-dynamics.readthedocs.io/)). However, its features and capacities can be applied to general domains in scientific computing and AI4Science. Starting in 2025/02, BrainUnit has been fully integrated into [SAIUnit](https://github.com/chaobrain/saiunit) (the **Unit** system for **S**cientific **AI**).
|
|
26
|
+
|
|
27
|
+
Functionalities are the same for both ``brainunit`` and ``saiunit``, and their functions and data structures are interoperable, sharing the same set of APIs, and eliminating any potential conflicts. This meas that
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
import brainunit as u
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
equals to
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import saiunit as u
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For users primarily engaged in general scientific computing, `saiunit` is likely the preferred choice. However, for those focused on brain modeling, we recommend `brainunit`, as it is more closely aligned with our specialized brain dynamics programming ecosystem.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## Documentation
|
|
44
|
+
|
|
45
|
+
The official documentation of BrainUnit is hosted on Read the Docs: [https://brainunit.readthedocs.io](https://brainunit.readthedocs.io)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
`brainunit` can be seamlessly integrated into every aspect of our [brain dynamics programming ecosystem](https://ecosystem-for-brain-dynamics.readthedocs.io/), such as, the checkpointing of [braintools](https://github.com/chaobrain/braintools), the event-driven operators in [brainevent](https://github.com/chaobrain/brainevent), the state-based JIT compilation in [brainstate](https://github.com/chaobrain/brainstate), online learning rules in [brainscale](https://github.com/chaobrain/brainscale), or event more.
|
|
52
|
+
|
|
53
|
+
A quick example for this kind of integration:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
|
|
57
|
+
import braintools
|
|
58
|
+
import brainevent
|
|
59
|
+
import brainstate
|
|
60
|
+
import brainunit as u
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class EINet(brainstate.nn.Module):
|
|
64
|
+
def __init__(self):
|
|
65
|
+
super().__init__()
|
|
66
|
+
self.n_exc = 3200
|
|
67
|
+
self.n_inh = 800
|
|
68
|
+
self.num = self.n_exc + self.n_inh
|
|
69
|
+
self.N = brainstate.nn.LIFRef(
|
|
70
|
+
self.num, V_rest=-60. * u.mV, V_th=-50. * u.mV, V_reset=-60. * u.mV,
|
|
71
|
+
tau=20. * u.ms, tau_ref=5. * u.ms,
|
|
72
|
+
V_initializer=brainstate.init.Normal(-55., 2., unit=u.mV)
|
|
73
|
+
)
|
|
74
|
+
self.E = brainstate.nn.AlignPostProj(
|
|
75
|
+
comm=brainstate.nn.EventFixedProb(self.n_exc, self.num, 0.02, 0.6 * u.mS),
|
|
76
|
+
syn=brainstate.nn.Expon.desc(self.num, tau=5. * u.ms),
|
|
77
|
+
out=brainstate.nn.COBA.desc(E=0. * u.mV),
|
|
78
|
+
post=self.N
|
|
79
|
+
)
|
|
80
|
+
self.I = brainstate.nn.AlignPostProj(
|
|
81
|
+
comm=brainstate.nn.EventFixedProb(self.n_inh, self.num, 0.02, 6.7 * u.mS),
|
|
82
|
+
syn=brainstate.nn.Expon.desc(self.num, tau=10. * u.ms),
|
|
83
|
+
out=brainstate.nn.COBA.desc(E=-80. * u.mV),
|
|
84
|
+
post=self.N
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
def update(self, t, inp):
|
|
88
|
+
with brainstate.environ.context(t=t):
|
|
89
|
+
spk = self.N.get_spike() != 0.
|
|
90
|
+
self.E(spk[:self.n_exc])
|
|
91
|
+
self.I(spk[self.n_exc:])
|
|
92
|
+
self.N(inp)
|
|
93
|
+
return self.N.get_spike()
|
|
94
|
+
|
|
95
|
+
def save_checkpoint(self):
|
|
96
|
+
braintools.file.msgpack_save('states.msgpack', self.states())
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## Installation
|
|
103
|
+
|
|
104
|
+
You can install ``brainunit`` via pip:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install brainunit --upgrade
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## Citation
|
|
112
|
+
|
|
113
|
+
If you use `brainunit` in your research, please consider citing the following paper:
|
|
114
|
+
|
|
115
|
+
```bibtex
|
|
116
|
+
@article{wang2025integrating,
|
|
117
|
+
title={Integrating physical units into high-performance AI-driven scientific computing},
|
|
118
|
+
author={Wang, Chaoming and He, Sichao and Luo, Shouwei and Huan, Yuxiang and Wu, Si},
|
|
119
|
+
journal={Nature Communications},
|
|
120
|
+
volume={16},
|
|
121
|
+
number={1},
|
|
122
|
+
pages={3609},
|
|
123
|
+
year={2025},
|
|
124
|
+
publisher={Nature Publishing Group UK London},
|
|
125
|
+
url={https://doi.org/10.1038/s41467-025-58626-4}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## See also the BDP ecosystem
|
|
132
|
+
|
|
133
|
+
We are building the [brain dynamics programming (BDP) ecosystem](https://ecosystem-for-brain-dynamics.readthedocs.io/). [brainunit](https://github.com/chaobrain/brainunit) has been deeply integrated into our BDP ecosystem.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
import saiunit
|
|
18
|
+
|
|
19
|
+
__version__ = saiunit.__version__
|
|
20
|
+
|
|
21
|
+
from . import autograd
|
|
22
|
+
from . import constants
|
|
23
|
+
from . import fft
|
|
24
|
+
from . import lax
|
|
25
|
+
from . import linalg
|
|
26
|
+
from . import math
|
|
27
|
+
from . import sparse
|
|
28
|
+
from ._base import *
|
|
29
|
+
from ._base import __all__ as _base_all
|
|
30
|
+
from ._celsius import *
|
|
31
|
+
from ._celsius import __all__ as _celsius_all
|
|
32
|
+
from ._unit_common import *
|
|
33
|
+
from ._unit_common import __all__ as _common_all
|
|
34
|
+
from ._unit_constants import *
|
|
35
|
+
from ._unit_constants import __all__ as _constants_all
|
|
36
|
+
from ._unit_shortcuts import *
|
|
37
|
+
from ._unit_shortcuts import __all__ as _std_units_all
|
|
38
|
+
|
|
39
|
+
__all__ = (
|
|
40
|
+
[
|
|
41
|
+
'math',
|
|
42
|
+
'linalg',
|
|
43
|
+
'autograd',
|
|
44
|
+
'fft',
|
|
45
|
+
'constants',
|
|
46
|
+
'sparse'
|
|
47
|
+
] +
|
|
48
|
+
_common_all +
|
|
49
|
+
_std_units_all +
|
|
50
|
+
_base_all +
|
|
51
|
+
_constants_all +
|
|
52
|
+
_celsius_all
|
|
53
|
+
)
|
|
54
|
+
del _common_all, _std_units_all, _base_all, _celsius_all, _constants_all, saiunit
|
|
55
|
+
|
|
56
|
+
# old version compatibility
|
|
57
|
+
avogadro_constant = constants.avogadro
|
|
58
|
+
boltzmann_constant = constants.boltzmann
|
|
59
|
+
electric_constant = constants.electric
|
|
60
|
+
electron_mass = constants.electron_mass
|
|
61
|
+
elementary_charge = constants.elementary_charge
|
|
62
|
+
faraday_constant = constants.faraday
|
|
63
|
+
gas_constant = constants.gas
|
|
64
|
+
magnetic_constant = constants.magnetic
|
|
65
|
+
molar_mass_constant = constants.molar_mass
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit._base import *
|
|
19
|
+
from saiunit._base import __all__
|
|
20
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit._celsius import *
|
|
19
|
+
from saiunit._celsius import __all__
|
|
20
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit._unit_common import *
|
|
19
|
+
from saiunit._unit_common import __all__
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit._unit_constants import *
|
|
19
|
+
from saiunit._unit_constants import __all__
|
|
20
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit._unit_shortcuts import *
|
|
19
|
+
from saiunit._unit_shortcuts import __all__
|
|
20
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
'value_and_grad',
|
|
19
|
+
'grad',
|
|
20
|
+
'vector_grad',
|
|
21
|
+
'jacobian',
|
|
22
|
+
'jacrev',
|
|
23
|
+
'jacfwd',
|
|
24
|
+
'hessian',
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
from ._hessian import *
|
|
28
|
+
from ._jacobian import *
|
|
29
|
+
from ._value_and_grad import *
|
|
30
|
+
from ._vector_grad import *
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit.autograd._hessian import *
|
|
19
|
+
from saiunit.autograd._hessian import __all__
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit.autograd._jacobian import *
|
|
19
|
+
from saiunit.autograd._jacobian import __all__
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit.autograd._value_and_grad import *
|
|
19
|
+
from saiunit.autograd._value_and_grad import __all__
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit.autograd._vector_grad import *
|
|
19
|
+
from saiunit.autograd._vector_grad import __all__
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit.constants import *
|
|
19
|
+
from saiunit.constants import __all__
|
|
20
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
from ._fft_change_unit import *
|
|
17
|
+
from ._fft_change_unit import __all__ as _fft_change_unit_all
|
|
18
|
+
from ._fft_keep_unit import *
|
|
19
|
+
from ._fft_keep_unit import __all__ as _fft_keep_unit_all
|
|
20
|
+
|
|
21
|
+
__all__ = (_fft_change_unit_all +
|
|
22
|
+
_fft_keep_unit_all)
|
|
23
|
+
|
|
24
|
+
del (_fft_change_unit_all,
|
|
25
|
+
_fft_keep_unit_all,)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
|
|
16
|
+
# -*- coding: utf-8 -*-
|
|
17
|
+
|
|
18
|
+
from saiunit.fft._fft_change_unit import *
|
|
19
|
+
from saiunit.fft._fft_change_unit import __all__
|