osiris-utils 1.1.7__py3-none-any.whl → 1.1.9__py3-none-any.whl

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.
docs/source/conf.py CHANGED
@@ -26,7 +26,7 @@ sys.path.append(os.path.abspath("../.."))
26
26
  project = "osiris_utils"
27
27
  copyright = "2025, João Biu, João Cândido, Diogo Carvalho"
28
28
  author = "João Biu, João Cândido, Diogo Carvalho"
29
- version = "v1.1.7"
29
+ version = "v1.1.9"
30
30
  release = version
31
31
 
32
32
 
osiris_utils/data/data.py CHANGED
@@ -203,7 +203,7 @@ class OsirisGridFile(OsirisData):
203
203
  "units": self._file["AXIS/" + ax].attrs["UNITS"][0].decode("utf-8"),
204
204
  "long_name": self._file["AXIS/" + ax].attrs["LONG_NAME"][0].decode("utf-8"),
205
205
  "type": self._file["AXIS/" + ax].attrs["TYPE"][0].decode("utf-8"),
206
- "plot_label": rf'${self._file["AXIS/"+ax].attrs["LONG_NAME"][0].decode("utf-8")}$ $[{self._file["AXIS/"+ax].attrs["UNITS"][0].decode("utf-8")}]$',
206
+ "plot_label": rf'${self._file["AXIS/" + ax].attrs["LONG_NAME"][0].decode("utf-8")}$ $[{self._file["AXIS/" + ax].attrs["UNITS"][0].decode("utf-8")}]$',
207
207
  }
208
208
  self._axis.append(axis_data)
209
209
 
@@ -777,9 +777,7 @@ def reorder_track_data(unordered_data, indexes, field_names):
777
777
  for time_iter in range(num_time_iter):
778
778
  index = indexes[particle][time_iter]
779
779
  if len(unordered_data[index]) != len(field_names):
780
- raise ValueError(
781
- f"Data at index {index} has {len(unordered_data[index])} elements, " f"but {len(field_names)} are expected."
782
- )
780
+ raise ValueError(f"Data at index {index} has {len(unordered_data[index])} elements, but {len(field_names)} are expected.")
783
781
  data_sorted[particle, time_iter] = tuple(unordered_data[index])
784
782
 
785
783
  return data_sorted
@@ -35,7 +35,7 @@ class Specie:
35
35
  self._q = q
36
36
  self._m = rqm * q
37
37
 
38
- def __repr__(self):
38
+ def __repr__(self) -> str:
39
39
  return f"Specie(name={self._name}, rqm={self._rqm}, q={self._q}, m={self._m})"
40
40
 
41
41
  @property
osiris_utils/utils.py CHANGED
@@ -1,4 +1,7 @@
1
+ from __future__ import annotations
2
+
1
3
  from datetime import datetime
4
+ from typing import cast
2
5
 
3
6
  import h5py
4
7
  import numpy as np
@@ -6,7 +9,7 @@ import pandas as pd
6
9
  import scipy
7
10
 
8
11
 
9
- def courant2D(dx, dy):
12
+ def courant2D(dx: float, dy: float) -> float:
10
13
  """
11
14
  Compute the Courant number for a 2D simulation.
12
15
 
@@ -23,10 +26,10 @@ def courant2D(dx, dy):
23
26
  The limit for dt.
24
27
  """
25
28
  dt = 1 / (np.sqrt(1 / dx**2 + 1 / dy**2))
26
- return dt
29
+ return cast(float, dt)
27
30
 
28
31
 
29
- def time_estimation(n_cells, ppc, t_steps, n_cpu, push_time=1e-7, hours=False):
32
+ def time_estimation(n_cells: int, ppc: int, t_steps: int, n_cpu: int, push_time: float = 1e-7, hours: bool = False) -> float:
30
33
  """
31
34
  Estimate the simulation time.
32
35
 
@@ -57,11 +60,11 @@ def time_estimation(n_cells, ppc, t_steps, n_cpu, push_time=1e-7, hours=False):
57
60
  return time
58
61
 
59
62
 
60
- def filesize_estimation(n_gridpoints):
63
+ def filesize_estimation(n_gridpoints: int) -> float:
61
64
  return n_gridpoints * 4 / (1024**2)
62
65
 
63
66
 
64
- def transverse_average(data):
67
+ def transverse_average(data: np.ndarray) -> np.ndarray:
65
68
  """
66
69
  Computes the transverse average of a 2D array.
67
70
 
@@ -81,10 +84,10 @@ def transverse_average(data):
81
84
 
82
85
  if len(data.shape) != 2:
83
86
  raise ValueError("The input data must be a 2D array.")
84
- return np.mean(data, axis=1)
87
+ return cast(np.ndarray, np.mean(data, axis=1))
85
88
 
86
89
 
87
- def integrate(array, dx):
90
+ def integrate(array: np.ndarray, dx: float) -> np.ndarray:
88
91
  """
89
92
  Integrate a 1D from the left to the right. This may be changed in the future to allow
90
93
  for integration in both directions or for other more general cases.
@@ -109,10 +112,10 @@ def integrate(array, dx):
109
112
  flip_array = np.flip(array)
110
113
  # int = -scipy.integrate.cumulative_trapezoid(flip_array, dx = dx, initial = flip_array[0])
111
114
  int = -scipy.integrate.cumulative_simpson(flip_array, dx=dx, initial=0)
112
- return np.flip(int)
115
+ return cast(np.ndarray, np.flip(int))
113
116
 
114
117
 
115
- def save_data(data, savename, option="numpy"):
118
+ def save_data(data: np.ndarray, savename: str, option: str = "numpy") -> None:
116
119
  """
117
120
  Save the data to a .txt (with Numpy) or .csv (with Pandas) file.
118
121
 
@@ -133,7 +136,7 @@ def save_data(data, savename, option="numpy"):
133
136
  raise ValueError("Option must be 'numpy' or 'pandas'.")
134
137
 
135
138
 
136
- def read_data(filename, option="numpy"):
139
+ def read_data(filename: str, option: str = "numpy") -> np.ndarray:
137
140
  """
138
141
  Read the data from a .txt file.
139
142
 
@@ -151,7 +154,7 @@ def read_data(filename, option="numpy"):
151
154
  return np.loadtxt(filename) if option == "numpy" else pd.read_csv(filename).values
152
155
 
153
156
 
154
- def convert_tracks(filename_in):
157
+ def convert_tracks(filename_in: str) -> str:
155
158
  """
156
159
  Converts a new OSIRIS track file aka IDL-formatted aka tracks-2 to an older format that is more human-readable.
157
160
  In the old format, each particle is stored in a separate folder, with datasets for each quantity.
@@ -245,7 +248,7 @@ def convert_tracks(filename_in):
245
248
  return filename_out
246
249
 
247
250
 
248
- def create_file_tags(filename, tags_array):
251
+ def create_file_tags(filename: str, tags_array: np.ndarray) -> str:
249
252
  """
250
253
  Function to write a file_tags file from a (number_of_tags, 2) NumPy array of tags.
251
254
  this file is used to choose particles for the OSIRIS track diagnostic.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osiris_utils
3
- Version: 1.1.7
3
+ Version: 1.1.9
4
4
  Summary: Utilities to manipulate and visualise OSIRIS plasma PIC output data
5
5
  Author: João Cândido, Diogo Carvalho
6
6
  Author-email: João Pedro Ferreira Biu <joaopedrofbiu@tecnico.ulisboa.pt>
@@ -34,7 +34,6 @@ Requires-Dist: pytest-cov; extra == "dev"
34
34
  Requires-Dist: pre-commit>=3.7; extra == "dev"
35
35
  Requires-Dist: ruff>=0.4; extra == "dev"
36
36
  Requires-Dist: isort>=5.13; extra == "dev"
37
- Requires-Dist: mypy>=1.10; extra == "dev"
38
37
  Requires-Dist: types-tqdm; extra == "dev"
39
38
  Requires-Dist: types-Pillow; extra == "dev"
40
39
  Provides-Extra: docs
@@ -44,8 +43,6 @@ Requires-Dist: myst-parser; extra == "docs"
44
43
  Requires-Dist: sphinx-copybutton<=0.5.2; extra == "docs"
45
44
  Requires-Dist: sphinx-rtd-theme<3.0.3; extra == "docs"
46
45
  Requires-Dist: sphinx-github-style<=1.2.2; extra == "docs"
47
- Provides-Extra: plot
48
- Requires-Dist: seaborn>=0.13; extra == "plot"
49
46
  Dynamic: license-file
50
47
 
51
48
  OSIRIS_UTILS
@@ -99,10 +96,6 @@ Quick-start
99
96
  cd osiris_utils
100
97
  python examples/quick_start.py examples/example_data/thermal.1d
101
98
 
102
- .. image:: docs/source/_static/quick_start_ez.png
103
- :alt: Example Ez plot produced by the quick-start
104
- :width: 400px
105
-
106
99
  Documentation
107
100
  -------------
108
101
 
@@ -1,4 +1,4 @@
1
- docs/source/conf.py,sha256=JpYzgkHPpf9Nvy50zDB2jH7Ptbq_5L1acv2FT4MwFjM,6141
1
+ docs/source/conf.py,sha256=EJ1e_TprMsuEl1MRnzuhGi30MLJ3jWBJjnX5HE_1ZNA,6141
2
2
  docs/source/contrib.rst,sha256=CkYSzy3msde38fy0zROAjDsdRHYYvQSAJwjkJczFmGI,35
3
3
  docs/source/index.rst,sha256=9DQxea3_rZIe9g_nQs9MDJ7XXmeWpB59lDflyrKi66Q,508
4
4
  docs/source/_static/custom.css,sha256=aLsKMK8rejJzzCdISkHhDG8Eq-f7T4v4DmQInYzeRDI,909
@@ -1038,14 +1038,14 @@ examples/example_data/MS/UDIST/electrons/vfl1/vfl1-electrons-000253.h5,sha256=Kt
1038
1038
  examples/example_data/TIMINGS/timings-final,sha256=1i_dcQ1hIxs78eeD4e6WNWUxJ_vXKRvbIVDAPGl9_R4,2910
1039
1039
  osiris_utils/__init__.py,sha256=YcD7gApMN-CPz_rkx7ZHnIoqA2yAWetUhgd7b0hABto,2461
1040
1040
  osiris_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1041
- osiris_utils/utils.py,sha256=Y935G6ryagoHnxb0dtc02I_a0zaUFZ4K_1VRXurqBJY,8056
1041
+ osiris_utils/utils.py,sha256=5XxFFZd1cK-xujlKIR1-21jPZwNJge7rqkNZlTyCgCs,8401
1042
1042
  osiris_utils/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1043
- osiris_utils/data/data.py,sha256=Hzz2HS-PK0rVP3sw1ExVZvn7hZ27Vo5fxWColesfv3M,28017
1043
+ osiris_utils/data/data.py,sha256=OdmArrWPmLlBwibZZL0ct1Mg_ApPL15HPQna49EvnNs,27979
1044
1044
  osiris_utils/data/diagnostic.py,sha256=Ed3w4G7X3vxwvwWpnIXl3QeXIe5IvPsCYjyjgrGlp4E,48710
1045
1045
  osiris_utils/data/simulation.py,sha256=r3YN9jdyLtF5fpovc8-xYDYkKJ3eTibNNqxWdHudNjg,6854
1046
1046
  osiris_utils/decks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1047
1047
  osiris_utils/decks/decks.py,sha256=r0dyg4lZyxvEFcL6p-H7rn-UyawPlYItcftJ4Xb_GpI,9925
1048
- osiris_utils/decks/species.py,sha256=uZA1oMSltofc2m1s3rK__wjxXfTAQ_3wB2aKRG_PmKo,1066
1048
+ osiris_utils/decks/species.py,sha256=hHWfK0vPGcEiFfRWssMjRleDHjlqgsN47655yeVlWNM,1073
1049
1049
  osiris_utils/postprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1050
1050
  osiris_utils/postprocessing/derivative.py,sha256=_AO8qEEAXRQKrRNGpk8lpFOeKycGZ-cIlF3AsxgPE7Y,10120
1051
1051
  osiris_utils/postprocessing/fft.py,sha256=rPu7-qJ2joaiP9I_saVj6V1pKGo58OEIgloIr0BBDj8,8954
@@ -1055,8 +1055,8 @@ osiris_utils/postprocessing/mft.py,sha256=KPoUZmwXcKbOGSHz01FPsDKlMSZDUrSeHQhlVb
1055
1055
  osiris_utils/postprocessing/mft_for_gridfile.py,sha256=EGTghHliN9Q7KDYasnkKdc2QolD4tdlAxWnkPonS2aQ,1502
1056
1056
  osiris_utils/postprocessing/postprocess.py,sha256=tcYVJR5eWeCTiWfnu9OKUfHk_E7-H8ek_QkMGVvRRg4,1077
1057
1057
  osiris_utils/postprocessing/pressure_correction.py,sha256=FFi-KaV0pD5I6vBPFMRkyRZym2n8lb_m-CB0onihpRQ,6443
1058
- osiris_utils-1.1.7.dist-info/licenses/LICENSE.txt,sha256=Cawy2v7wKc7n8yL8guFu-cH9sQw9r1gll1pEFPFAB-Q,1084
1059
- osiris_utils-1.1.7.dist-info/METADATA,sha256=KCJYK2elZlNe3swt4REjQDb0bdYTRt6r2q-xyeoBOAU,4575
1060
- osiris_utils-1.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1061
- osiris_utils-1.1.7.dist-info/top_level.txt,sha256=8FzwamPQqVoj13it2XTog8aXYQ7cuyYyCFyGNz4tn3s,27
1062
- osiris_utils-1.1.7.dist-info/RECORD,,
1058
+ osiris_utils-1.1.9.dist-info/licenses/LICENSE.txt,sha256=Cawy2v7wKc7n8yL8guFu-cH9sQw9r1gll1pEFPFAB-Q,1084
1059
+ osiris_utils-1.1.9.dist-info/METADATA,sha256=QM6FOq4Kc4gmTDtPSuWJl2yM5jvgBb_j3bhbbOmIvnA,4345
1060
+ osiris_utils-1.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1061
+ osiris_utils-1.1.9.dist-info/top_level.txt,sha256=8FzwamPQqVoj13it2XTog8aXYQ7cuyYyCFyGNz4tn3s,27
1062
+ osiris_utils-1.1.9.dist-info/RECORD,,