emsutil 0.2.1__tar.gz → 0.2.2__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.
- {emsutil-0.2.1 → emsutil-0.2.2}/.bumpversion.toml +1 -1
- {emsutil-0.2.1 → emsutil-0.2.2}/PKG-INFO +1 -1
- {emsutil-0.2.1 → emsutil-0.2.2}/pyproject.toml +1 -1
- emsutil-0.2.2/src/emsutil/inexport/ffdata.py +58 -0
- emsutil-0.2.2/src/emsutil/inexport/strutil.py +22 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/display.py +6 -2
- {emsutil-0.2.1 → emsutil-0.2.2}/uv.lock +1 -1
- {emsutil-0.2.1 → emsutil-0.2.2}/.gitignore +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/.python-version +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/README.md +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/__init__.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/const.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/emdata.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/isola.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/lib.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/material.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/plot/__init__.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/plot/plot2d.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/__init__.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/cmap_maker.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/display_settings.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/textures/background.png +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/textures/tex1.png +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/textures/tex2.png +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/textures/tex3.png +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/textures/tex4.png +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/textures/tex5.png +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/textures/tex6.png +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/pyvista/utils.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/rogers.py +0 -0
- {emsutil-0.2.1 → emsutil-0.2.2}/src/emsutil/themes.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: emsutil
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Common utilities for Emerge projects EMerge, Optycal and Heavi
|
|
5
5
|
Project-URL: Homepage, https://github.com/FennisRobert/emsutil
|
|
6
6
|
Project-URL: Issues, https://github.com/FennisRobert/emsutil/issues
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from .strutil import arry_to_line, matrix_to_lines, arry_to_fwl
|
|
3
|
+
from ..emdata import EHFieldFF
|
|
4
|
+
|
|
5
|
+
def export_ffdata(filename: str,
|
|
6
|
+
thetas: np.ndarray,
|
|
7
|
+
phis: np.ndarray,
|
|
8
|
+
frequencies: np.ndarray,
|
|
9
|
+
fields: list[EHFieldFF],
|
|
10
|
+
precision: int = 4) -> None:
|
|
11
|
+
|
|
12
|
+
lines = []
|
|
13
|
+
lines.append('% Theta (deg)')
|
|
14
|
+
lines.append(arry_to_line(thetas, precision=precision))
|
|
15
|
+
lines.append('% Phi (deg)')
|
|
16
|
+
lines.append(arry_to_line(phis, precision=precision))
|
|
17
|
+
lines.append('')
|
|
18
|
+
nF = frequencies.shape[0]
|
|
19
|
+
|
|
20
|
+
actual_frequencies = []
|
|
21
|
+
blocks = []
|
|
22
|
+
|
|
23
|
+
T, P = np.meshgrid(thetas, phis, indexing='ij')
|
|
24
|
+
|
|
25
|
+
thetal = T.flatten()
|
|
26
|
+
phil = P.flatten()
|
|
27
|
+
|
|
28
|
+
for iF in range(nF):
|
|
29
|
+
freq = frequencies[iF]
|
|
30
|
+
actual_frequencies.append(freq)
|
|
31
|
+
|
|
32
|
+
farfield = fields[iF]._E
|
|
33
|
+
Fx = farfield[0,:,:].squeeze().flatten()
|
|
34
|
+
Fy = farfield[1,:,:].squeeze().flatten()
|
|
35
|
+
Fz = farfield[2,:,:].squeeze().flatten()
|
|
36
|
+
|
|
37
|
+
block_lines = []
|
|
38
|
+
|
|
39
|
+
block_lines.append(f'# {freq} (Hz)')
|
|
40
|
+
block_lines.append('$ Theta(deg); Phi(deg); E_x[re](V/m); E_x[im](V/m); E_y[re](V/m); E_y[im](V/m); E_z[re](V/m); E_z[im](V/m)')
|
|
41
|
+
positions = (0, 14, 24, 38, 52, 66, 80, 94)
|
|
42
|
+
for th, ph, ex, ey, ez in zip(thetal, phil, Fx, Fy, Fz):
|
|
43
|
+
re_ex = np.real(ex)
|
|
44
|
+
im_ex = np.imag(ex)
|
|
45
|
+
re_ey = np.real(ey)
|
|
46
|
+
im_ey = np.imag(ey)
|
|
47
|
+
re_ez = np.real(ez)
|
|
48
|
+
im_ez = np.imag(ez)
|
|
49
|
+
line_values = np.array([th, ph, re_ex, im_ex, re_ey, im_ey, re_ez, im_ez])
|
|
50
|
+
line = arry_to_fwl(line_values, positions, precision=precision)
|
|
51
|
+
block_lines.append(line)
|
|
52
|
+
|
|
53
|
+
lines.extend(block_lines)
|
|
54
|
+
lines.extend('')
|
|
55
|
+
|
|
56
|
+
text = '\n'.join(lines)
|
|
57
|
+
with open(filename, 'w') as f:
|
|
58
|
+
f.write(text)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
def arry_to_line(array: np.ndarray, separator: str = ' ', precision: int = 4) -> str:
|
|
4
|
+
return separator.join([f"{x:.{precision}f}" for x in array.squeeze()])
|
|
5
|
+
|
|
6
|
+
def arry_to_fwl(array: np.ndarray, start_positions: list[int], precision: int = 4) -> str:
|
|
7
|
+
# Place the numbers at the starting position indices provided by the start-positions list
|
|
8
|
+
line_length = max(start_positions) + 10 # Extra space for number
|
|
9
|
+
line = [' ']*line_length
|
|
10
|
+
for i, pos in enumerate(start_positions):
|
|
11
|
+
num_str = f"{array[i]:.{precision}f}"
|
|
12
|
+
for j, ch in enumerate(num_str):
|
|
13
|
+
if pos + j < line_length:
|
|
14
|
+
line[pos + j] = ch
|
|
15
|
+
return ''.join(line)
|
|
16
|
+
|
|
17
|
+
def matrix_to_lines(matrix: np.ndarray, separator: str = ',', precision: int = 4) -> str:
|
|
18
|
+
lines = []
|
|
19
|
+
for row in matrix:
|
|
20
|
+
line = arry_to_line(row, separator, precision)
|
|
21
|
+
lines.append(line)
|
|
22
|
+
return '\n'.join(lines)
|
|
@@ -413,7 +413,7 @@ class EMergeDisplay:
|
|
|
413
413
|
# Turn off directional lighting
|
|
414
414
|
self._plot.remove_all_lights()
|
|
415
415
|
|
|
416
|
-
if self.set.theme.draw_pvgrid:
|
|
416
|
+
if self.set.theme.draw_pvgrid and not self._bwdrawing:
|
|
417
417
|
pv.set_plot_theme('dark')
|
|
418
418
|
bounds = self._bounds
|
|
419
419
|
extra_factor = 0.1
|
|
@@ -439,6 +439,10 @@ class EMergeDisplay:
|
|
|
439
439
|
else:
|
|
440
440
|
self._plot.disable_anti_aliasing()
|
|
441
441
|
self._plot.title = 'EMerge'
|
|
442
|
+
if self._bwdrawing:
|
|
443
|
+
self._plot.set_background('white', top='white') # type: ignore
|
|
444
|
+
else:
|
|
445
|
+
self._plot.set_background(self.set.theme.backgroung_grad_1, top=self.set.theme.backgroung_grad_2) # type: ignore
|
|
442
446
|
|
|
443
447
|
def _reset(self):
|
|
444
448
|
self._plot.close()
|
|
@@ -1369,7 +1373,7 @@ class EMergeDisplay:
|
|
|
1369
1373
|
light.set_direction_angle(*self.set.light_angle) # type: ignore
|
|
1370
1374
|
self._plot.add_light(light)
|
|
1371
1375
|
|
|
1372
|
-
|
|
1376
|
+
|
|
1373
1377
|
self._plot.add_axes(color=self.set.theme.text_color,
|
|
1374
1378
|
x_color=col_x,
|
|
1375
1379
|
y_color=col_y,
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|