pyvale 2025.5.3__cp311-cp311-musllinux_1_2_aarch64.whl → 2025.7.0__cp311-cp311-musllinux_1_2_aarch64.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.

Potentially problematic release.


This version of pyvale might be problematic. Click here for more details.

Files changed (96) hide show
  1. pyvale/__init__.py +12 -0
  2. pyvale/blendercalibrationdata.py +3 -1
  3. pyvale/blenderscene.py +7 -5
  4. pyvale/blendertools.py +27 -5
  5. pyvale/camera.py +1 -0
  6. pyvale/cameradata.py +3 -0
  7. pyvale/camerasensor.py +147 -0
  8. pyvale/camerastereo.py +4 -4
  9. pyvale/cameratools.py +23 -61
  10. pyvale/cython/rastercyth.c +1657 -1352
  11. pyvale/cython/rastercyth.cpython-311-aarch64-linux-musl.so +0 -0
  12. pyvale/cython/rastercyth.py +71 -26
  13. pyvale/data/plate_hole_def0000.tiff +0 -0
  14. pyvale/data/plate_hole_def0001.tiff +0 -0
  15. pyvale/data/plate_hole_ref0000.tiff +0 -0
  16. pyvale/data/plate_rigid_def0000.tiff +0 -0
  17. pyvale/data/plate_rigid_def0001.tiff +0 -0
  18. pyvale/data/plate_rigid_ref0000.tiff +0 -0
  19. pyvale/dataset.py +96 -6
  20. pyvale/dic/cpp/dicbruteforce.cpp +370 -0
  21. pyvale/dic/cpp/dicfourier.cpp +648 -0
  22. pyvale/dic/cpp/dicinterpolator.cpp +559 -0
  23. pyvale/dic/cpp/dicmain.cpp +215 -0
  24. pyvale/dic/cpp/dicoptimizer.cpp +675 -0
  25. pyvale/dic/cpp/dicrg.cpp +137 -0
  26. pyvale/dic/cpp/dicscanmethod.cpp +677 -0
  27. pyvale/dic/cpp/dicsmooth.cpp +138 -0
  28. pyvale/dic/cpp/dicstrain.cpp +383 -0
  29. pyvale/dic/cpp/dicutil.cpp +563 -0
  30. pyvale/dic2d.py +164 -0
  31. pyvale/dic2dcpp.cpython-311-aarch64-linux-musl.so +0 -0
  32. pyvale/dicchecks.py +476 -0
  33. pyvale/dicdataimport.py +247 -0
  34. pyvale/dicregionofinterest.py +887 -0
  35. pyvale/dicresults.py +55 -0
  36. pyvale/dicspecklegenerator.py +238 -0
  37. pyvale/dicspecklequality.py +305 -0
  38. pyvale/dicstrain.py +387 -0
  39. pyvale/dicstrainresults.py +37 -0
  40. pyvale/errorintegrator.py +10 -8
  41. pyvale/examples/basics/ex1_1_basicscalars_therm2d.py +124 -113
  42. pyvale/examples/basics/ex1_2_sensormodel_therm2d.py +124 -132
  43. pyvale/examples/basics/ex1_3_customsens_therm3d.py +199 -195
  44. pyvale/examples/basics/ex1_4_basicerrors_therm3d.py +125 -121
  45. pyvale/examples/basics/ex1_5_fielderrs_therm3d.py +145 -141
  46. pyvale/examples/basics/ex1_6_caliberrs_therm2d.py +96 -101
  47. pyvale/examples/basics/ex1_7_spatavg_therm2d.py +109 -105
  48. pyvale/examples/basics/ex2_1_basicvectors_disp2d.py +92 -91
  49. pyvale/examples/basics/ex2_2_vectorsens_disp2d.py +96 -90
  50. pyvale/examples/basics/ex2_3_sensangle_disp2d.py +88 -89
  51. pyvale/examples/basics/ex2_4_chainfielderrs_disp2d.py +172 -171
  52. pyvale/examples/basics/ex2_5_vectorfields3d_disp3d.py +88 -86
  53. pyvale/examples/basics/ex3_1_basictensors_strain2d.py +90 -90
  54. pyvale/examples/basics/ex3_2_tensorsens2d_strain2d.py +93 -91
  55. pyvale/examples/basics/ex3_3_tensorsens3d_strain3d.py +172 -160
  56. pyvale/examples/basics/ex4_1_expsim2d_thermmech2d.py +154 -148
  57. pyvale/examples/basics/ex4_2_expsim3d_thermmech3d.py +249 -231
  58. pyvale/examples/dic/ex1_region_of_interest.py +98 -0
  59. pyvale/examples/dic/ex2_plate_with_hole.py +149 -0
  60. pyvale/examples/dic/ex3_plate_with_hole_strain.py +93 -0
  61. pyvale/examples/dic/ex4_dic_blender.py +95 -0
  62. pyvale/examples/dic/ex5_dic_challenge.py +102 -0
  63. pyvale/examples/imagedef2d/ex_imagedef2d_todisk.py +4 -2
  64. pyvale/examples/renderblender/ex1_1_blenderscene.py +152 -105
  65. pyvale/examples/renderblender/ex1_2_blenderdeformed.py +151 -100
  66. pyvale/examples/renderblender/ex2_1_stereoscene.py +183 -116
  67. pyvale/examples/renderblender/ex2_2_stereodeformed.py +185 -112
  68. pyvale/examples/renderblender/ex3_1_blendercalibration.py +164 -109
  69. pyvale/examples/renderrasterisation/ex_rastenp.py +74 -35
  70. pyvale/examples/renderrasterisation/ex_rastercyth_oneframe.py +6 -13
  71. pyvale/examples/renderrasterisation/ex_rastercyth_static_cypara.py +2 -2
  72. pyvale/examples/renderrasterisation/ex_rastercyth_static_pypara.py +2 -4
  73. pyvale/imagedef2d.py +3 -2
  74. pyvale/imagetools.py +137 -0
  75. pyvale/rastercy.py +34 -4
  76. pyvale/rasternp.py +300 -276
  77. pyvale/rasteropts.py +58 -0
  78. pyvale/renderer.py +47 -0
  79. pyvale/rendermesh.py +52 -62
  80. pyvale/renderscene.py +51 -0
  81. pyvale/sensorarrayfactory.py +2 -2
  82. pyvale/sensortools.py +19 -35
  83. pyvale/simcases/case21.i +1 -1
  84. pyvale/simcases/run_1case.py +8 -0
  85. pyvale/simtools.py +2 -2
  86. pyvale/visualsimplotter.py +180 -0
  87. {pyvale-2025.5.3.dist-info → pyvale-2025.7.0.dist-info}/METADATA +11 -57
  88. {pyvale-2025.5.3.dist-info → pyvale-2025.7.0.dist-info}/RECORD +94 -56
  89. {pyvale-2025.5.3.dist-info → pyvale-2025.7.0.dist-info}/WHEEL +1 -1
  90. pyvale.libs/libgcc_s-69c45f16.so.1 +0 -0
  91. pyvale.libs/libgomp-b626072d.so.1.0.0 +0 -0
  92. pyvale.libs/libstdc++-1f1a71be.so.6.0.33 +0 -0
  93. pyvale/examples/visualisation/ex1_1_plot_traces.py +0 -102
  94. pyvale/examples/visualisation/ex2_1_animate_sim.py +0 -89
  95. {pyvale-2025.5.3.dist-info → pyvale-2025.7.0.dist-info}/licenses/LICENSE +0 -0
  96. {pyvale-2025.5.3.dist-info → pyvale-2025.7.0.dist-info}/top_level.txt +0 -0
pyvale/imagetools.py ADDED
@@ -0,0 +1,137 @@
1
+ #===============================================================================
2
+ # pyvale: the python validation engine
3
+ # License: MIT
4
+ # Copyright (C) 2025 The Computer Aided Validation Team
5
+ #===============================================================================
6
+ import warnings
7
+ from enum import Enum
8
+ from pathlib import Path
9
+ import numpy as np
10
+ import matplotlib.image as mplim
11
+ from PIL import Image
12
+
13
+ class EImageType(Enum):
14
+ TIFF = ".tiff"
15
+ BMP = ".bmp"
16
+
17
+ def __str__(self):
18
+ return self.value
19
+
20
+
21
+
22
+ class ImageTools:
23
+ @staticmethod
24
+ def load_image_rgb(im_path: Path) -> np.ndarray:
25
+ return mplim.imread(im_path).astype(np.float64)
26
+
27
+
28
+ @staticmethod
29
+ def load_image_greyscale(im_path: Path) -> np.ndarray:
30
+
31
+ input_im = mplim.imread(im_path).astype(np.float64)
32
+ # If we have RGB then get rid of it
33
+ # TODO: make sure this is collapsing RGB to grey scale correctly
34
+ if input_im.ndim > 2:
35
+ input_im = input_im[:,:,0]
36
+
37
+ return input_im
38
+
39
+ @staticmethod
40
+ def save_image(save_file: Path,
41
+ image: np.ndarray,
42
+ image_type: EImageType,
43
+ bits: int = 16) -> None:
44
+
45
+ # TODO: check this flip is needed
46
+ image_save = np.copy(image[::-1,:])
47
+ im = Image.fromarray(_image_to_uint(image_save,bits))
48
+ im.save(save_file.with_suffix(image_type.value))
49
+
50
+ @staticmethod
51
+ def scale_digitise_save(save_file: Path,
52
+ image: np.ndarray,
53
+ image_type: EImageType,
54
+ bits: int = 16,
55
+ min_frac: float = 0.0,
56
+ max_frac: float = 1.0,
57
+ background: float = 0.5) -> None:
58
+
59
+ image_save = ImageTools.digitise(image,bits,min_frac,max_frac,background)
60
+ # TODO: check this flip is needed
61
+ image_save = image_save[::-1,:]
62
+ im = Image.fromarray(_image_to_uint(image_save,bits))
63
+ im.save(save_file.with_suffix(image_type.value))
64
+
65
+
66
+ @staticmethod
67
+ def scale(image: np.ndarray, min_frac: float = 0.0, max_frac: float = 1.0) -> np.ndarray:
68
+
69
+ im_scale = np.copy(image)
70
+ im_max = np.nanmax(np.nanmax(image,axis=0),axis=0)
71
+ im_min = np.nanmin(np.nanmin(image,axis=0),axis=0)
72
+
73
+ # Scale image 0->1
74
+ im_scale = (im_scale - im_min)/(im_max-im_min)
75
+
76
+ # Scale to between min->max
77
+ im_scale = im_scale*(max_frac-min_frac) + min_frac
78
+
79
+ return im_scale
80
+
81
+ @staticmethod
82
+ def digitise(image: np.ndarray,
83
+ bits: int = 16,
84
+ min_frac: float = 0.0,
85
+ max_frac: float = 1.0,
86
+ background_frac: float = 0.5) -> np.ndarray:
87
+ im_dig = ImageTools.scale(image,min_frac,max_frac)
88
+ mask_nan = np.isnan(image)
89
+ im_dig[mask_nan] = background_frac
90
+ im_dig = _image_to_uint(np.round(2**bits*im_dig),bits)
91
+ return im_dig
92
+
93
+ @staticmethod
94
+ def add_noise(image: np.ndarray) -> np.ndarray:
95
+ pass
96
+
97
+ @staticmethod
98
+ def get_num_str(im_num: int, width: int , cam_num: int = -1) -> str:
99
+ num_str = str(im_num)
100
+ num_str = num_str.zfill(width)
101
+
102
+ if cam_num >= 0:
103
+ num_str = num_str+'_'+str(cam_num)
104
+
105
+ return num_str
106
+
107
+ @staticmethod
108
+ def get_save_name(cam_num: int,
109
+ frame_num: int,
110
+ field_num: int | None,
111
+ cam_width: int = 2,
112
+ frame_width: int = 4,
113
+ field_width: int = 2) -> str:
114
+ cam_str = str(cam_num).zfill(cam_width)
115
+ frame_str = str(frame_num).zfill(frame_width)
116
+
117
+ if field_num is None:
118
+ return f"cam{cam_str}_frame{frame_str}"
119
+
120
+ field_str = str(field_num).zfill(field_width)
121
+ return f"cam{cam_str}_frame{frame_str}_field{field_str}"
122
+
123
+
124
+ def _image_to_uint(image: np.ndarray, bits: int) -> np.ndarray:
125
+ if (bits > 16) and (bits <= 32):
126
+ return image.astype(np.uint32)
127
+
128
+ if (bits > 8) and (bits <= 16):
129
+ return image.astype(np.uint16)
130
+
131
+ if (bits > 0) and (bits <= 8):
132
+ return image.astype(np.uint8)
133
+
134
+ warnings.warn(f"Number of bits={bits} should be between 0 and 32, defaulting to 16 bits.")
135
+ return image.astype(np.uint16)
136
+
137
+
pyvale/rastercy.py CHANGED
@@ -12,13 +12,43 @@ from pathlib import Path
12
12
  from multiprocessing.pool import Pool
13
13
  import numpy as np
14
14
  from pyvale.cameradata import CameraData
15
- from pyvale.rendermesh import RenderMeshData
15
+ from pyvale.rendermesh import RenderMesh
16
+ from pyvale.renderer import IRenderer
17
+ from pyvale.rasteropts import RasterOpts
16
18
  import pyvale.cython.rastercyth as rastercyth
17
19
 
20
+ # NOTE: This module is a feature under developement.
21
+
22
+
23
+ # class RasterCyth(IRenderEngine):
24
+ # __slots__ = ("opts",)
25
+
26
+ # def __init__(self, opts: RasterOpts) -> None:
27
+ # self.opts = opts
28
+
29
+
30
+ # def one_frame(self, frame_ind: int = 0) -> list[np.ndarray]:
31
+ # pass
32
+
33
+
34
+ # def all_frames(self, para_by_frame: int = 1) -> list[np.ndarray]:
35
+ # pass
36
+
37
+
38
+ # def one_frame_to_disk(self, frame_ind: int = 0) -> None:
39
+ # pass
40
+
41
+
42
+ # def all_frames_to_disk(self, para_by_frame: int = 1) -> None:
43
+ # pass
44
+
45
+
46
+
47
+
18
48
  class RasterCY:
19
49
  @staticmethod
20
50
  def raster_static_mesh(cam_data: CameraData,
21
- render_mesh: RenderMeshData,
51
+ render_mesh: RenderMesh,
22
52
  threads_num: int | None = None,
23
53
  ) -> tuple[np.ndarray,np.ndarray,np.ndarray] | None:
24
54
 
@@ -38,7 +68,7 @@ class RasterCY:
38
68
  for tt in range(frames_num):
39
69
  (image_buffer,
40
70
  depth_buffer,
41
- elems_in_image) = rastercyth.raster_frame(
71
+ elems_in_image) = rastercyth.raster_static_frame(
42
72
  render_mesh.coords,
43
73
  render_mesh.connectivity,
44
74
  render_mesh.fields_render[:,tt,:],
@@ -60,7 +90,7 @@ class RasterCY:
60
90
  render_mesh.fields_render[:,tt,:],
61
91
  cam_data)
62
92
 
63
- process = pool.apply_async(rastercyth.raster_frame, args=args)
93
+ process = pool.apply_async(rastercyth.raster_static_frame, args=args)
64
94
  processes_with_id.append({"process": process,
65
95
  "frame": tt})
66
96