paddle 1.1.15__tar.gz → 1.2.0__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 (44) hide show
  1. {paddle-1.1.15 → paddle-1.2.0}/.bumpversion.cfg +1 -1
  2. {paddle-1.1.15 → paddle-1.2.0}/PKG-INFO +2 -3
  3. {paddle-1.1.15 → paddle-1.2.0}/example_py_scripts/robert.yaml +1 -1
  4. {paddle-1.1.15 → paddle-1.2.0}/example_py_scripts/test_saturn_adiabat.py +2 -1
  5. {paddle-1.1.15 → paddle-1.2.0}/paddle/__init__.py +1 -1
  6. {paddle-1.1.15 → paddle-1.2.0}/paddle/crm.py +3 -3
  7. {paddle-1.1.15 → paddle-1.2.0}/paddle/evolve_kinetics.py +3 -2
  8. paddle-1.2.0/paddle/example_save.py +22 -0
  9. {paddle-1.1.15 → paddle-1.2.0}/paddle/find_init_params.py +2 -1
  10. {paddle-1.1.15 → paddle-1.2.0}/paddle/setup_profile.py +7 -6
  11. {paddle-1.1.15 → paddle-1.2.0}/paddle/write_profile.py +3 -2
  12. {paddle-1.1.15 → paddle-1.2.0}/pyproject.toml +2 -3
  13. {paddle-1.1.15 → paddle-1.2.0}/.github/workflows/cd.yml +0 -0
  14. {paddle-1.1.15 → paddle-1.2.0}/.github/workflows/ci.yml +0 -0
  15. {paddle-1.1.15 → paddle-1.2.0}/.gitignore +0 -0
  16. {paddle-1.1.15 → paddle-1.2.0}/.pre-commit-config.yaml +0 -0
  17. {paddle-1.1.15 → paddle-1.2.0}/LICENSE +0 -0
  18. {paddle-1.1.15 → paddle-1.2.0}/Makefile +0 -0
  19. {paddle-1.1.15 → paddle-1.2.0}/README.md +0 -0
  20. {paddle-1.1.15 → paddle-1.2.0}/docker/.dockerignore +0 -0
  21. {paddle-1.1.15 → paddle-1.2.0}/docker/Dockerfile +0 -0
  22. {paddle-1.1.15 → paddle-1.2.0}/docker/Dockerfile.cuda +0 -0
  23. {paddle-1.1.15 → paddle-1.2.0}/docker/entrypoint.sh +0 -0
  24. {paddle-1.1.15 → paddle-1.2.0}/docker/nvim/init.lua +0 -0
  25. {paddle-1.1.15 → paddle-1.2.0}/docker/nvim/lua/plugins.lua +0 -0
  26. {paddle-1.1.15 → paddle-1.2.0}/docker/requirements.txt +0 -0
  27. {paddle-1.1.15 → paddle-1.2.0}/docker/scripts/git-done +0 -0
  28. {paddle-1.1.15 → paddle-1.2.0}/docker/scripts/git-send +0 -0
  29. {paddle-1.1.15 → paddle-1.2.0}/docker-compose.override.yaml.tmp +0 -0
  30. {paddle-1.1.15 → paddle-1.2.0}/docker-compose.yaml +0 -0
  31. {paddle-1.1.15 → paddle-1.2.0}/docs/_static/readme-attach.png +0 -0
  32. {paddle-1.1.15 → paddle-1.2.0}/docs/_static/readme-extension.png +0 -0
  33. {paddle-1.1.15 → paddle-1.2.0}/docs/_static/readme-open-folder.png +0 -0
  34. {paddle-1.1.15 → paddle-1.2.0}/docs/_static/temp_paddle.jpg +0 -0
  35. {paddle-1.1.15 → paddle-1.2.0}/docs/content/notebooks/Tutorial-1-SaturnAdiabat.ipynb +0 -0
  36. {paddle-1.1.15 → paddle-1.2.0}/example_py_scripts/.gitignore +0 -0
  37. {paddle-1.1.15 → paddle-1.2.0}/example_py_scripts/robert.py +0 -0
  38. {paddle-1.1.15 → paddle-1.2.0}/example_py_scripts/saturn1d.yaml +0 -0
  39. {paddle-1.1.15 → paddle-1.2.0}/example_py_scripts/shock.py +0 -0
  40. {paddle-1.1.15 → paddle-1.2.0}/example_py_scripts/shock.yaml +0 -0
  41. {paddle-1.1.15 → paddle-1.2.0}/example_py_scripts/straka.py +0 -0
  42. {paddle-1.1.15 → paddle-1.2.0}/example_py_scripts/straka.yaml +0 -0
  43. {paddle-1.1.15 → paddle-1.2.0}/paddle/nc2pt.py +0 -0
  44. {paddle-1.1.15 → paddle-1.2.0}/paddle/pt2nc.py +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 1.1.15
2
+ current_version = 1.2.0
3
3
  commit = True
4
4
  tag = True
5
5
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: paddle
3
- Version: 1.1.15
3
+ Version: 1.2.0
4
4
  Summary: Python Atmospheric Dynamics: Discovery and Learning about Exoplanets. An open-source, user-friendly python frontend of canoe
5
5
  Project-URL: Homepage, https://github.com/elijah-mullens/paddle
6
6
  Project-URL: Repository, https://github.com/elijah-mullens/paddle
@@ -22,9 +22,8 @@ Classifier: Topic :: Scientific/Engineering :: Astronomy
22
22
  Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
23
23
  Classifier: Topic :: Scientific/Engineering :: Physics
24
24
  Requires-Python: >=3.9
25
- Requires-Dist: kintera>=1.1.5
26
25
  Requires-Dist: scipy
27
- Requires-Dist: snapy>=0.8.1
26
+ Requires-Dist: snapy>=1.0.3
28
27
  Requires-Dist: torch<=2.7.1,>=2.7.0
29
28
  Provides-Extra: dev
30
29
  Requires-Dist: pytest>=7; extra == 'dev'
@@ -15,7 +15,7 @@ geometry:
15
15
  distribute:
16
16
  backend: gloo
17
17
  layout: slab
18
- nb2: 4
18
+ nb2: 1
19
19
  nb3: 1
20
20
  verbose: false
21
21
 
@@ -14,7 +14,8 @@ from pathlib import Path
14
14
 
15
15
  def setup_saturn_profile():
16
16
  # path = resources.files("paddle") / "data" / "saturn1d.yaml"
17
- path = Path("data") / "saturn1d.yaml"
17
+ # path = Path("data") / "saturn1d.yaml"
18
+ path = "saturn1d.yaml"
18
19
  print(f"Reading input file: {path}")
19
20
 
20
21
  op_block = MeshBlockOptions.from_yaml(str(path))
@@ -4,4 +4,4 @@ from .find_init_params import find_init_params
4
4
  from .evolve_kinetics import evolve_kinetics
5
5
 
6
6
  __all__ = ["setup_profile", "write_profile", "find_init_params", "evolve_kinetics"]
7
- __version__ = "1.1.15"
7
+ __version__ = "1.2.0"
@@ -4,7 +4,6 @@ import time
4
4
  import kintera
5
5
  import numpy as np
6
6
  from snapy import (
7
- index,
8
7
  MeshBlockOptions,
9
8
  MeshBlock,
10
9
  OutputOptions,
@@ -16,6 +15,7 @@ from kintera import (
16
15
  KineticsOptions,
17
16
  Kinetics,
18
17
  )
18
+ from snapy import kIDN, kICY
19
19
 
20
20
  if __name__ == "__main__":
21
21
  # input file
@@ -59,7 +59,7 @@ if __name__ == "__main__":
59
59
 
60
60
  if count % 1 == 0:
61
61
  print(f"count = {count}, dt = {dt}, time = {current_time}")
62
- print("mass = ", u[interior][index.idn].sum())
62
+ print("mass = ", u[interior][kIDN].sum())
63
63
 
64
64
  for out in outs:
65
65
  out.increment_file_number()
@@ -70,7 +70,7 @@ if __name__ == "__main__":
70
70
  block.forward(dt, stage)
71
71
 
72
72
  # evolve kinetics
73
- u[index.icy :] += evolve_kinetics(block, kinet, thermo_x)
73
+ u[kICY:] += evolve_kinetics(block, kinet, thermo_x)
74
74
 
75
75
  current_time += dt
76
76
  count += 1
@@ -1,6 +1,7 @@
1
1
  import torch
2
2
  import snapy
3
3
  import kintera
4
+ from snapy import kIDN, kIPR, kICY
4
5
 
5
6
 
6
7
  def evolve_kinetics(
@@ -27,8 +28,8 @@ def evolve_kinetics(
27
28
  thermo_y = block.module("hydro.eos.thermo")
28
29
 
29
30
  temp = eos.compute("W->T", (hydro_w,))
30
- pres = hydro_w[snapy.index.ipr]
31
- xfrac = thermo_y.compute("Y->X", (hydro_w[snapy.index.icy :],))
31
+ pres = hydro_w[kIPR]
32
+ xfrac = thermo_y.compute("Y->X", (hydro_w[kICY:],))
32
33
  conc = thermo_x.compute("TPX->V", (temp, pres, xfrac))
33
34
  cp_vol = thermo_x.compute("TV->cp", (temp, conc))
34
35
 
@@ -0,0 +1,22 @@
1
+ import torch
2
+ import types
3
+
4
+
5
+ def save_tensors(tensor_map: dict[str, torch.Tensor], filename: str):
6
+ class TensorModule(torch.nn.Module):
7
+ def __init__(self, tensors):
8
+ super().__init__()
9
+ for name, tensor in tensors.items():
10
+ self.register_buffer(name, tensor)
11
+
12
+ module = TensorModule(tensor_map)
13
+ scripted = torch.jit.script(module) # Needed for LibTorch compatibility
14
+ scripted.save(filename)
15
+
16
+
17
+ if __name__ == "__main__":
18
+ tensors = {
19
+ "foo": torch.randn(3, 4),
20
+ "bar": torch.randn(5, 6),
21
+ }
22
+ save_tensors(tensors, "foo_bar.pt")
@@ -1,6 +1,7 @@
1
1
  from scipy.interpolate import interp1d
2
2
  import snapy
3
3
  import numpy as np
4
+ from snapy import kIPR
4
5
 
5
6
  from .setup_profile import setup_profile
6
7
 
@@ -46,7 +47,7 @@ def find_init_params(
46
47
  temp = eos.compute("W->T", (w,)).squeeze()
47
48
 
48
49
  # calculate 1D pressure
49
- pres = w[snapy.index.ipr, ...].squeeze()
50
+ pres = w[kIPR, ...].squeeze()
50
51
 
51
52
  # temperature function
52
53
  t_func = interp1d(
@@ -3,6 +3,7 @@ from typing import Tuple
3
3
  import torch
4
4
  import snapy
5
5
  import kintera
6
+ from snapy import kIDN, kIPR, kICY
6
7
 
7
8
 
8
9
  def integrate_neutral(
@@ -248,9 +249,9 @@ def setup_profile(
248
249
  xfrac /= xfrac.sum(dim=-1, keepdim=True)
249
250
  conc = thermo_x.compute("TPX->V", [temp, pres, xfrac])
250
251
 
251
- w[snapy.index.ipr, ..., i] = pres
252
- w[snapy.index.idn, ..., i] = thermo_x.compute("V->D", [conc])
253
- w[snapy.index.icy :, ..., i] = thermo_x.compute("X->Y", [xfrac])
252
+ w[kIPR, ..., i] = pres
253
+ w[kIDN, ..., i] = thermo_x.compute("V->D", [conc])
254
+ w[kICY:, ..., i] = thermo_x.compute("X->Y", [xfrac])
254
255
 
255
256
  dz = coord.buffer("dx1f")[i]
256
257
  if method.split("-")[0] == "dry":
@@ -279,7 +280,7 @@ def setup_profile(
279
280
  dz = coord.buffer("dx1f")[i]
280
281
  pres *= torch.exp(-grav * mu * dz / (kintera.constants.Rgas * temp))
281
282
  conc = thermo_x.compute("TPX->V", [temp, pres, xfrac])
282
- w[snapy.index.ipr, ..., i] = pres
283
- w[snapy.index.idn, ..., i] = thermo_x.compute("V->D", [conc])
284
- w[snapy.index.icy :, ..., i] = thermo_x.compute("X->Y", [xfrac])
283
+ w[kIPR, ..., i] = pres
284
+ w[kIDN, ..., i] = thermo_x.compute("V->D", [conc])
285
+ w[kICY:, ..., i] = thermo_x.compute("X->Y", [xfrac])
285
286
  return w
@@ -6,6 +6,7 @@ import numpy as np
6
6
  import torch
7
7
  import kintera
8
8
  import snapy
9
+ from snapy import kIPR, kICY
9
10
 
10
11
 
11
12
  def write_profile(
@@ -47,7 +48,7 @@ def write_profile(
47
48
  raise ValueError("hydro_w must have shape (N, 1, 1, L).")
48
49
 
49
50
  # calculate a height grid
50
- pres = hydro_w[snapy.index.ipr, ...].squeeze() / 1.0e5 # Pa -> bar
51
+ pres = hydro_w[kIPR, ...].squeeze() / 1.0e5 # Pa -> bar
51
52
  zlev_func = interp1d(
52
53
  pres.log().cpu().numpy(),
53
54
  coord.buffer("x1v").cpu().numpy(),
@@ -61,7 +62,7 @@ def write_profile(
61
62
  temp = eos.compute("W->T", (hydro_w,)).squeeze()
62
63
 
63
64
  # calculate mole fractions
64
- xfrac = thermo_y.compute("Y->X", (hydro_w[snapy.index.icy :, ...],)).squeeze()
65
+ xfrac = thermo_y.compute("Y->X", (hydro_w[kICY:, ...],)).squeeze()
65
66
 
66
67
  # calculate heat capacity
67
68
  conc = thermo_x.compute("TPX->V", (temp, pres * 1.0e5, xfrac))
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "paddle"
7
- version = "1.1.15"
7
+ version = "1.2.0"
8
8
  description = "Python Atmospheric Dynamics: Discovery and Learning about Exoplanets. An open-source, user-friendly python frontend of canoe"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -32,8 +32,7 @@ classifiers = [
32
32
 
33
33
  dependencies = [
34
34
  "torch>=2.7.0,<=2.7.1",
35
- "kintera>=1.1.5",
36
- "snapy>=0.8.1",
35
+ "snapy>=1.0.3",
37
36
  "scipy"
38
37
  ]
39
38
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes