brainunit 0.2.0__tar.gz → 0.2.2__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.
Files changed (63) hide show
  1. {brainunit-0.2.0 → brainunit-0.2.2}/PKG-INFO +14 -2
  2. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/__init__.py +33 -1
  3. brainunit-0.2.2/brainunit/_backend.py +17 -0
  4. brainunit-0.2.2/brainunit/_exceptions.py +17 -0
  5. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/linalg/__init__.py +6 -2
  6. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit.egg-info/PKG-INFO +14 -2
  7. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit.egg-info/SOURCES.txt +2 -2
  8. brainunit-0.2.2/brainunit.egg-info/requires.txt +37 -0
  9. {brainunit-0.2.0 → brainunit-0.2.2}/pyproject.toml +8 -2
  10. brainunit-0.2.0/brainunit/sparse/_block_csr.py +0 -20
  11. brainunit-0.2.0/brainunit/sparse/_block_ell.py +0 -20
  12. brainunit-0.2.0/brainunit.egg-info/requires.txt +0 -19
  13. {brainunit-0.2.0 → brainunit-0.2.2}/README.md +0 -0
  14. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_base_decorators.py +0 -0
  15. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_base_dimension.py +0 -0
  16. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_base_getters.py +0 -0
  17. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_base_quantity.py +0 -0
  18. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_base_unit.py +0 -0
  19. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_celsius.py +0 -0
  20. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_misc.py +0 -0
  21. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_unit_common.py +0 -0
  22. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_unit_constants.py +0 -0
  23. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/_unit_shortcuts.py +0 -0
  24. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/autograd/__init__.py +0 -0
  25. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/autograd/_hessian.py +0 -0
  26. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/autograd/_jacobian.py +0 -0
  27. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/autograd/_value_and_grad.py +0 -0
  28. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/autograd/_vector_grad.py +0 -0
  29. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/constants.py +0 -0
  30. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/custom_array.py +0 -0
  31. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/fft/__init__.py +0 -0
  32. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/fft/_fft_change_unit.py +0 -0
  33. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/fft/_fft_keep_unit.py +0 -0
  34. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/lax/__init__.py +0 -0
  35. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/lax/_lax_accept_unitless.py +0 -0
  36. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/lax/_lax_array_creation.py +0 -0
  37. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/lax/_lax_change_unit.py +0 -0
  38. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/lax/_lax_keep_unit.py +0 -0
  39. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/lax/_lax_linalg.py +0 -0
  40. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/lax/_lax_remove_unit.py +0 -0
  41. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/lax/_misc.py +0 -0
  42. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/linalg/_linalg_change_unit.py +0 -0
  43. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/linalg/_linalg_keep_unit.py +0 -0
  44. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/linalg/_linalg_remove_unit.py +0 -0
  45. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/__init__.py +0 -0
  46. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/_activation.py +0 -0
  47. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/_alias.py +0 -0
  48. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/_einops.py +0 -0
  49. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/_fun_accept_unitless.py +0 -0
  50. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/_fun_array_creation.py +0 -0
  51. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/_fun_change_unit.py +0 -0
  52. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/_fun_keep_unit.py +0 -0
  53. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/_fun_remove_unit.py +0 -0
  54. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/_misc.py +0 -0
  55. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/fft.py +0 -0
  56. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/math/linalg.py +0 -0
  57. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/sparse/__init__.py +0 -0
  58. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/sparse/_coo.py +0 -0
  59. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/sparse/_csr.py +0 -0
  60. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit/typing.py +0 -0
  61. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit.egg-info/dependency_links.txt +0 -0
  62. {brainunit-0.2.0 → brainunit-0.2.2}/brainunit.egg-info/top_level.txt +0 -0
  63. {brainunit-0.2.0 → brainunit-0.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: brainunit
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Physical Units and Unit-Aware Mathematical System for General-Purpose Brain Dynamics Modeling
5
5
  Author-email: BrainUnit Developers <chao.brain@qq.com>
6
6
  License-Expression: Apache-2.0
@@ -30,10 +30,12 @@ Requires-Python: >=3.10
30
30
  Description-Content-Type: text/markdown
31
31
  Requires-Dist: numpy
32
32
  Requires-Dist: typing_extensions
33
- Requires-Dist: saiunit==0.2.0
33
+ Requires-Dist: saiunit==0.2.2
34
34
  Provides-Extra: testing
35
35
  Requires-Dist: pytest; extra == "testing"
36
36
  Requires-Dist: brainstate; extra == "testing"
37
+ Provides-Extra: jax
38
+ Requires-Dist: jax; extra == "jax"
37
39
  Provides-Extra: cpu
38
40
  Requires-Dist: jax[cpu]; extra == "cpu"
39
41
  Provides-Extra: cuda12
@@ -42,6 +44,16 @@ Provides-Extra: cuda13
42
44
  Requires-Dist: jax[cuda13]; extra == "cuda13"
43
45
  Provides-Extra: tpu
44
46
  Requires-Dist: jax[tpu]; extra == "tpu"
47
+ Provides-Extra: cupy
48
+ Requires-Dist: cupy-cuda12x>=13.0; extra == "cupy"
49
+ Provides-Extra: torch
50
+ Requires-Dist: torch>=2.0; extra == "torch"
51
+ Provides-Extra: dask
52
+ Requires-Dist: dask[array]>=2024.1; extra == "dask"
53
+ Provides-Extra: ndonnx
54
+ Requires-Dist: ndonnx>=0.9; extra == "ndonnx"
55
+ Provides-Extra: all
56
+ Requires-Dist: brainunit[cupy,dask,jax,ndonnx,torch]; extra == "all"
45
57
 
46
58
  <h1 align='center'>BrainUnit</h1>
47
59
  <h2 align='center'>Physical units and unit-aware math system for general-purpose brain dynamics modeling</h2>
@@ -18,6 +18,7 @@ __version__ = saiunit.__version__
18
18
  __version_info__ = saiunit.__version_info__
19
19
 
20
20
  from . import autograd
21
+ from saiunit._matplotlib_compat import enable_matplotlib_support
21
22
  from . import constants
22
23
  from . import fft
23
24
  from . import lax
@@ -34,6 +35,18 @@ from ._base_dimension import (
34
35
  get_dim_for_display,
35
36
  get_or_create_dimension,
36
37
  )
38
+ from ._backend import (
39
+ get_default_backend,
40
+ is_cupy_array,
41
+ is_dask_array,
42
+ is_jax_array,
43
+ is_ndonnx_array,
44
+ is_numpy_array,
45
+ is_torch_array,
46
+ set_default_backend,
47
+ using_backend,
48
+ )
49
+ from ._exceptions import BackendError
37
50
  from ._base_getters import (
38
51
  array_with_unit,
39
52
  assert_quantity,
@@ -48,6 +61,7 @@ from ._base_getters import (
48
61
  have_same_dim,
49
62
  is_dimensionless,
50
63
  is_scalar_type,
64
+ is_unit_equal_math,
51
65
  is_unitless,
52
66
  maybe_decimal,
53
67
  split_mantissa_unit,
@@ -55,7 +69,7 @@ from ._base_getters import (
55
69
  )
56
70
  from ._base_quantity import Quantity, compatible_with_equinox
57
71
  from ._base_unit import UNITLESS, Unit, add_standard_unit, parse_unit
58
- from ._celsius import celsius2kelvin, kelvin2celsius
72
+ from ._celsius import celsius2kelvin, kelvin2celsius, fahrenheit2kelvin, kelvin2fahrenheit
59
73
  from ._misc import maybe_custom_array, maybe_custom_array_tree
60
74
  from ._unit_common import *
61
75
  from ._unit_common import __all__ as _common_all
@@ -100,6 +114,18 @@ __all__ = [
100
114
  'DIMENSIONLESS',
101
115
  'DimensionMismatchError',
102
116
  'UnitMismatchError',
117
+ 'BackendError',
118
+
119
+ # _backend
120
+ 'get_default_backend',
121
+ 'set_default_backend',
122
+ 'using_backend',
123
+ 'is_jax_array',
124
+ 'is_numpy_array',
125
+ 'is_cupy_array',
126
+ 'is_torch_array',
127
+ 'is_dask_array',
128
+ 'is_ndonnx_array',
103
129
  'get_or_create_dimension',
104
130
  'get_dim_for_display',
105
131
 
@@ -125,6 +151,7 @@ __all__ = [
125
151
  'assert_quantity',
126
152
  'have_same_dim',
127
153
  'has_same_unit',
154
+ 'is_unit_equal_math',
128
155
  'unit_scale_align_to_first',
129
156
  'array_with_unit',
130
157
 
@@ -140,6 +167,11 @@ __all__ = [
140
167
  # _celsius
141
168
  'celsius2kelvin',
142
169
  'kelvin2celsius',
170
+ 'fahrenheit2kelvin',
171
+ 'kelvin2fahrenheit',
172
+
173
+ # _matplotlib_compat
174
+ 'enable_matplotlib_support',
143
175
 
144
176
  # old version compatibility
145
177
  'avogadro_constant',
@@ -0,0 +1,17 @@
1
+ # Copyright 2026 BrainX 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 saiunit._backend import *
17
+ from saiunit._backend import __all__
@@ -0,0 +1,17 @@
1
+ # Copyright 2026 BrainX 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 saiunit._exceptions import *
17
+ from saiunit._exceptions import __all__
@@ -17,9 +17,13 @@ from ._linalg_change_unit import *
17
17
  from ._linalg_change_unit import __all__ as _linalg_change_unit_all
18
18
  from ._linalg_keep_unit import *
19
19
  from ._linalg_keep_unit import __all__ as _linalg_keep_unit_all
20
+ from ._linalg_remove_unit import *
21
+ from ._linalg_remove_unit import __all__ as _linalg_remove_unit_all
20
22
 
21
23
  __all__ = (_linalg_change_unit_all +
22
- _linalg_keep_unit_all)
24
+ _linalg_keep_unit_all +
25
+ _linalg_remove_unit_all)
23
26
 
24
27
  del (_linalg_change_unit_all,
25
- _linalg_keep_unit_all)
28
+ _linalg_keep_unit_all,
29
+ _linalg_remove_unit_all)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: brainunit
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Physical Units and Unit-Aware Mathematical System for General-Purpose Brain Dynamics Modeling
5
5
  Author-email: BrainUnit Developers <chao.brain@qq.com>
6
6
  License-Expression: Apache-2.0
@@ -30,10 +30,12 @@ Requires-Python: >=3.10
30
30
  Description-Content-Type: text/markdown
31
31
  Requires-Dist: numpy
32
32
  Requires-Dist: typing_extensions
33
- Requires-Dist: saiunit==0.2.0
33
+ Requires-Dist: saiunit==0.2.2
34
34
  Provides-Extra: testing
35
35
  Requires-Dist: pytest; extra == "testing"
36
36
  Requires-Dist: brainstate; extra == "testing"
37
+ Provides-Extra: jax
38
+ Requires-Dist: jax; extra == "jax"
37
39
  Provides-Extra: cpu
38
40
  Requires-Dist: jax[cpu]; extra == "cpu"
39
41
  Provides-Extra: cuda12
@@ -42,6 +44,16 @@ Provides-Extra: cuda13
42
44
  Requires-Dist: jax[cuda13]; extra == "cuda13"
43
45
  Provides-Extra: tpu
44
46
  Requires-Dist: jax[tpu]; extra == "tpu"
47
+ Provides-Extra: cupy
48
+ Requires-Dist: cupy-cuda12x>=13.0; extra == "cupy"
49
+ Provides-Extra: torch
50
+ Requires-Dist: torch>=2.0; extra == "torch"
51
+ Provides-Extra: dask
52
+ Requires-Dist: dask[array]>=2024.1; extra == "dask"
53
+ Provides-Extra: ndonnx
54
+ Requires-Dist: ndonnx>=0.9; extra == "ndonnx"
55
+ Provides-Extra: all
56
+ Requires-Dist: brainunit[cupy,dask,jax,ndonnx,torch]; extra == "all"
45
57
 
46
58
  <h1 align='center'>BrainUnit</h1>
47
59
  <h2 align='center'>Physical units and unit-aware math system for general-purpose brain dynamics modeling</h2>
@@ -1,12 +1,14 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  brainunit/__init__.py
4
+ brainunit/_backend.py
4
5
  brainunit/_base_decorators.py
5
6
  brainunit/_base_dimension.py
6
7
  brainunit/_base_getters.py
7
8
  brainunit/_base_quantity.py
8
9
  brainunit/_base_unit.py
9
10
  brainunit/_celsius.py
11
+ brainunit/_exceptions.py
10
12
  brainunit/_misc.py
11
13
  brainunit/_unit_common.py
12
14
  brainunit/_unit_constants.py
@@ -52,7 +54,5 @@ brainunit/math/_misc.py
52
54
  brainunit/math/fft.py
53
55
  brainunit/math/linalg.py
54
56
  brainunit/sparse/__init__.py
55
- brainunit/sparse/_block_csr.py
56
- brainunit/sparse/_block_ell.py
57
57
  brainunit/sparse/_coo.py
58
58
  brainunit/sparse/_csr.py
@@ -0,0 +1,37 @@
1
+ numpy
2
+ typing_extensions
3
+ saiunit==0.2.2
4
+
5
+ [all]
6
+ brainunit[cupy,dask,jax,ndonnx,torch]
7
+
8
+ [cpu]
9
+ jax[cpu]
10
+
11
+ [cuda12]
12
+ jax[cuda12]
13
+
14
+ [cuda13]
15
+ jax[cuda13]
16
+
17
+ [cupy]
18
+ cupy-cuda12x>=13.0
19
+
20
+ [dask]
21
+ dask[array]>=2024.1
22
+
23
+ [jax]
24
+ jax
25
+
26
+ [ndonnx]
27
+ ndonnx>=0.9
28
+
29
+ [testing]
30
+ pytest
31
+ brainstate
32
+
33
+ [torch]
34
+ torch>=2.0
35
+
36
+ [tpu]
37
+ jax[tpu]
@@ -16,7 +16,7 @@ exclude = [
16
16
 
17
17
  [project]
18
18
  name = "brainunit"
19
- version = "0.2.0"
19
+ version = "0.2.2"
20
20
  description = "Physical Units and Unit-Aware Mathematical System for General-Purpose Brain Dynamics Modeling"
21
21
  readme = 'README.md'
22
22
  license = 'Apache-2.0'
@@ -48,7 +48,7 @@ keywords = ['physical unit', 'physical quantity', 'brain modeling']
48
48
  dependencies = [
49
49
  'numpy',
50
50
  'typing_extensions',
51
- 'saiunit==0.2.0',
51
+ 'saiunit==0.2.2',
52
52
  ]
53
53
 
54
54
  [tool.flit.module]
@@ -62,7 +62,13 @@ repository = 'https://github.com/chaobrain/brainunit'
62
62
 
63
63
  [project.optional-dependencies]
64
64
  testing = ["pytest", "brainstate"]
65
+ jax = ["jax"]
65
66
  cpu = ["jax[cpu]"]
66
67
  cuda12 = ["jax[cuda12]"]
67
68
  cuda13 = ["jax[cuda13]"]
68
69
  tpu = ["jax[tpu]"]
70
+ cupy = ["cupy-cuda12x>=13.0"]
71
+ torch = ["torch>=2.0"]
72
+ dask = ["dask[array]>=2024.1"]
73
+ ndonnx = ["ndonnx>=0.9"]
74
+ all = ["brainunit[jax,cupy,torch,dask,ndonnx]"]
@@ -1,20 +0,0 @@
1
- # Copyright 2025 BrainX 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.sparse._block_csr import *
19
- from saiunit.sparse._block_csr import __all__
20
-
@@ -1,20 +0,0 @@
1
- # Copyright 2025 BrainX 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.sparse._block_ell import *
19
- from saiunit.sparse._block_ell import __all__
20
-
@@ -1,19 +0,0 @@
1
- numpy
2
- typing_extensions
3
- saiunit==0.2.0
4
-
5
- [cpu]
6
- jax[cpu]
7
-
8
- [cuda12]
9
- jax[cuda12]
10
-
11
- [cuda13]
12
- jax[cuda13]
13
-
14
- [testing]
15
- pytest
16
- brainstate
17
-
18
- [tpu]
19
- jax[tpu]
File without changes
File without changes
File without changes
File without changes