Skip to content

Commit

Permalink
Merge pull request #14 from jung235/feat/version
Browse files Browse the repository at this point in the history
feat: update version 0.0.3
  • Loading branch information
jung235 authored Jul 30, 2024
2 parents 8d74f27 + b0ef1f5 commit e4b293a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If properly installed, you can run:

```console
$ pydiffuser --version
pydiffuser, version 0.0.2
pydiffuser, version 0.0.3
```

## Quickstart
Expand Down
2 changes: 1 addition & 1 deletion docs/features/configs/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"model_alias": "abp",
"pydiffuser_version": "0.0.2",
"pydiffuser_version": "0.0.3",
"realization": 10,
"length": 1000,
"dimension": 2,
Expand Down
2 changes: 1 addition & 1 deletion pydiffuser/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.2"
__version__ = "0.0.3"
33 changes: 32 additions & 1 deletion tests/utils/test_jitted.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
from scipy.stats import expon, norm, pareto

import pydiffuser as pyd
from pydiffuser.utils.jitted import get_noise, normalize
from pydiffuser.utils.jitted import (
get_noise,
normalize,
polar_to_cartesian,
spherical_to_cartesian,
)


def test_normalize():
Expand All @@ -23,6 +28,32 @@ def test_normalize():
assert jnp.all(normed_arr == expected_arr)


@pytest.mark.parametrize(
"r, phi",
[
(1, [jnp.pi / 6, jnp.pi / 4, jnp.pi / 3, jnp.pi / 2, jnp.pi]),
(2, [jnp.pi / 6, jnp.pi / 4, jnp.pi / 3, jnp.pi / 2, jnp.pi]),
],
)
def test_polar_to_cartesian(r, phi):
phi = jnp.array(phi)
x1, x2 = polar_to_cartesian(r, phi)
assert jnp.all(x1 == r * jnp.cos(phi))
assert jnp.all(x2 == r * jnp.sin(phi))


def test_spherical_to_cartesian():
r = 1
theta = rand(50) * jnp.pi
phi = rand(50) * 2 * jnp.pi
x1, x2, x3 = spherical_to_cartesian(
r=r, theta=theta.reshape(5, 10), phi=phi.reshape(5, 10)
)
assert x1.shape == (5, 10)
assert x2.shape == (5, 10)
assert x3.shape == (5, 10)


@pytest.mark.parametrize(
"generator",
[
Expand Down

0 comments on commit e4b293a

Please sign in to comment.