osiris-utils 1.1.7__py3-none-any.whl → 1.1.8__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 +1 -1
- osiris_utils/data/data.py +2 -4
- osiris_utils/decks/species.py +1 -1
- osiris_utils/utils.py +15 -12
- {osiris_utils-1.1.7.dist-info → osiris_utils-1.1.8.dist-info}/METADATA +1 -8
- {osiris_utils-1.1.7.dist-info → osiris_utils-1.1.8.dist-info}/RECORD +9 -9
- {osiris_utils-1.1.7.dist-info → osiris_utils-1.1.8.dist-info}/WHEEL +0 -0
- {osiris_utils-1.1.7.dist-info → osiris_utils-1.1.8.dist-info}/licenses/LICENSE.txt +0 -0
- {osiris_utils-1.1.7.dist-info → osiris_utils-1.1.8.dist-info}/top_level.txt +0 -0
docs/source/conf.py
CHANGED
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
|
osiris_utils/decks/species.py
CHANGED
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.
|
|
3
|
+
Version: 1.1.8
|
|
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=
|
|
1
|
+
docs/source/conf.py,sha256=lsV-7ZobHJRTiP7cHbuUvRDz2tCGoX_VLcm1LjLLPl4,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=
|
|
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=
|
|
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=
|
|
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.
|
|
1059
|
-
osiris_utils-1.1.
|
|
1060
|
-
osiris_utils-1.1.
|
|
1061
|
-
osiris_utils-1.1.
|
|
1062
|
-
osiris_utils-1.1.
|
|
1058
|
+
osiris_utils-1.1.8.dist-info/licenses/LICENSE.txt,sha256=Cawy2v7wKc7n8yL8guFu-cH9sQw9r1gll1pEFPFAB-Q,1084
|
|
1059
|
+
osiris_utils-1.1.8.dist-info/METADATA,sha256=nCDv5NkredCzbLaQbMgCyfZRpLJnT_B7n1jNlVuCtcI,4345
|
|
1060
|
+
osiris_utils-1.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
1061
|
+
osiris_utils-1.1.8.dist-info/top_level.txt,sha256=8FzwamPQqVoj13it2XTog8aXYQ7cuyYyCFyGNz4tn3s,27
|
|
1062
|
+
osiris_utils-1.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|