Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Update more detailed and clearer documentation #22

Merged
merged 14 commits into from
Jun 20, 2024
22 changes: 21 additions & 1 deletion brainunit/_unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
get_basic_unit,
have_same_unit,
in_unit,
is_scalar_type,
is_scalar_type, in_best_unit,
)
# from braincore.math import ufuncs_integers
from brainunit._unit_shortcuts import Hz, cm, kHz, ms, mV, nS
Expand Down Expand Up @@ -1456,6 +1456,26 @@ def f2(a):
r = f2(val)
bu.math.allclose(val + 1 * bu.siemens / bu.cm ** 2, r)

@jax.jit
def f3(a):
b = a * bu.siemens / bu.cm ** 2
print(in_unit(b, bu.siemens / bu.meter ** 2))
return b

val = np.random.rand(3)
r = f3(val)
bu.math.allclose(val * bu.siemens / bu.cm ** 2, r)

@jax.jit
def f4(a):
b = a * bu.siemens / bu.cm ** 2
print(in_best_unit(b))
return b

val = np.random.rand(3)
r = f4(val)
bu.math.allclose(val * bu.siemens / bu.cm ** 2, r)


def test_jit_array2():
a = 2.0 * (bu.farad / bu.metre ** 2)
Expand Down
Binary file added docs/_static/mechanism.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading