pyvale 2025.5.3__cp311-cp311-win32.whl → 2025.7.1__cp311-cp311-win32.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 (95) 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.cp311-win32.pyd +0 -0
  12. pyvale/cython/rastercyth.py +71 -26
  13. pyvale/data/DIC_Challenge_Star_Noise_Def.tiff +0 -0
  14. pyvale/data/DIC_Challenge_Star_Noise_Ref.tiff +0 -0
  15. pyvale/data/plate_hole_def0000.tiff +0 -0
  16. pyvale/data/plate_hole_def0001.tiff +0 -0
  17. pyvale/data/plate_hole_ref0000.tiff +0 -0
  18. pyvale/data/plate_rigid_def0000.tiff +0 -0
  19. pyvale/data/plate_rigid_def0001.tiff +0 -0
  20. pyvale/data/plate_rigid_ref0000.tiff +0 -0
  21. pyvale/dataset.py +96 -6
  22. pyvale/dic/cpp/dicbruteforce.cpp +370 -0
  23. pyvale/dic/cpp/dicfourier.cpp +648 -0
  24. pyvale/dic/cpp/dicinterpolator.cpp +559 -0
  25. pyvale/dic/cpp/dicmain.cpp +215 -0
  26. pyvale/dic/cpp/dicoptimizer.cpp +675 -0
  27. pyvale/dic/cpp/dicrg.cpp +137 -0
  28. pyvale/dic/cpp/dicscanmethod.cpp +677 -0
  29. pyvale/dic/cpp/dicsmooth.cpp +138 -0
  30. pyvale/dic/cpp/dicstrain.cpp +383 -0
  31. pyvale/dic/cpp/dicutil.cpp +563 -0
  32. pyvale/dic2d.py +164 -0
  33. pyvale/dic2dcpp.cp311-win32.pyd +0 -0
  34. pyvale/dicchecks.py +476 -0
  35. pyvale/dicdataimport.py +247 -0
  36. pyvale/dicregionofinterest.py +887 -0
  37. pyvale/dicresults.py +55 -0
  38. pyvale/dicspecklegenerator.py +238 -0
  39. pyvale/dicspecklequality.py +305 -0
  40. pyvale/dicstrain.py +387 -0
  41. pyvale/dicstrainresults.py +37 -0
  42. pyvale/errorintegrator.py +10 -8
  43. pyvale/examples/basics/ex1_1_basicscalars_therm2d.py +124 -113
  44. pyvale/examples/basics/ex1_2_sensormodel_therm2d.py +124 -132
  45. pyvale/examples/basics/ex1_3_customsens_therm3d.py +199 -195
  46. pyvale/examples/basics/ex1_4_basicerrors_therm3d.py +125 -121
  47. pyvale/examples/basics/ex1_5_fielderrs_therm3d.py +145 -141
  48. pyvale/examples/basics/ex1_6_caliberrs_therm2d.py +96 -101
  49. pyvale/examples/basics/ex1_7_spatavg_therm2d.py +109 -105
  50. pyvale/examples/basics/ex2_1_basicvectors_disp2d.py +92 -91
  51. pyvale/examples/basics/ex2_2_vectorsens_disp2d.py +96 -90
  52. pyvale/examples/basics/ex2_3_sensangle_disp2d.py +88 -89
  53. pyvale/examples/basics/ex2_4_chainfielderrs_disp2d.py +172 -171
  54. pyvale/examples/basics/ex2_5_vectorfields3d_disp3d.py +88 -86
  55. pyvale/examples/basics/ex3_1_basictensors_strain2d.py +90 -90
  56. pyvale/examples/basics/ex3_2_tensorsens2d_strain2d.py +93 -91
  57. pyvale/examples/basics/ex3_3_tensorsens3d_strain3d.py +172 -160
  58. pyvale/examples/basics/ex4_1_expsim2d_thermmech2d.py +154 -148
  59. pyvale/examples/basics/ex4_2_expsim3d_thermmech3d.py +249 -231
  60. pyvale/examples/dic/ex1_region_of_interest.py +98 -0
  61. pyvale/examples/dic/ex2_plate_with_hole.py +149 -0
  62. pyvale/examples/dic/ex3_plate_with_hole_strain.py +93 -0
  63. pyvale/examples/dic/ex4_dic_blender.py +95 -0
  64. pyvale/examples/dic/ex5_dic_challenge.py +102 -0
  65. pyvale/examples/imagedef2d/ex_imagedef2d_todisk.py +4 -2
  66. pyvale/examples/renderblender/ex1_1_blenderscene.py +152 -105
  67. pyvale/examples/renderblender/ex1_2_blenderdeformed.py +151 -100
  68. pyvale/examples/renderblender/ex2_1_stereoscene.py +183 -116
  69. pyvale/examples/renderblender/ex2_2_stereodeformed.py +185 -112
  70. pyvale/examples/renderblender/ex3_1_blendercalibration.py +164 -109
  71. pyvale/examples/renderrasterisation/ex_rastenp.py +74 -35
  72. pyvale/examples/renderrasterisation/ex_rastercyth_oneframe.py +6 -13
  73. pyvale/examples/renderrasterisation/ex_rastercyth_static_cypara.py +2 -2
  74. pyvale/examples/renderrasterisation/ex_rastercyth_static_pypara.py +2 -4
  75. pyvale/imagedef2d.py +3 -2
  76. pyvale/imagetools.py +137 -0
  77. pyvale/rastercy.py +34 -4
  78. pyvale/rasternp.py +300 -276
  79. pyvale/rasteropts.py +58 -0
  80. pyvale/renderer.py +47 -0
  81. pyvale/rendermesh.py +52 -62
  82. pyvale/renderscene.py +51 -0
  83. pyvale/sensorarrayfactory.py +2 -2
  84. pyvale/sensortools.py +19 -35
  85. pyvale/simcases/case21.i +1 -1
  86. pyvale/simcases/run_1case.py +8 -0
  87. pyvale/simtools.py +2 -2
  88. pyvale/visualsimplotter.py +180 -0
  89. {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/METADATA +11 -57
  90. {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/RECORD +93 -56
  91. {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/WHEEL +1 -1
  92. pyvale/examples/visualisation/ex1_1_plot_traces.py +0 -102
  93. pyvale/examples/visualisation/ex2_1_animate_sim.py +0 -89
  94. {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/licenses/LICENSE +0 -0
  95. {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/top_level.txt +0 -0
@@ -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
+
7
+ // STD library Header files
8
+ #include <csignal>
9
+ #include <cstdlib>
10
+ #include <vector>
11
+ #include <iostream>
12
+ #include <omp.h>
13
+ #include <memory>
14
+
15
+
16
+
17
+ // Program Header files
18
+ #include "./dicutil.hpp"
19
+ #include "./defines.hpp"
20
+ #include "./dicrg.hpp"
21
+ #include "./dicfourier.hpp"
22
+
23
+
24
+ namespace rg {
25
+
26
+ int next_pow2(int n) {
27
+ if (n <= 0){
28
+ std::cerr << __FILE__ << " " << __LINE__ << std::endl;
29
+ std::cerr << "Expected a positive integer to calculate next power of 2 " << std::endl;
30
+ std::cerr << "n = " << n << std::endl;
31
+ exit(EXIT_FAILURE);
32
+ }
33
+
34
+ // If already a power of 2, return as-is
35
+ if ((n & (n - 1)) == 0) return n;
36
+
37
+ n--;
38
+ n |= n >> 1;
39
+ n |= n >> 2;
40
+ n |= n >> 4;
41
+ n |= n >> 8;
42
+ n |= n >> 16;
43
+ n++;
44
+
45
+ // Handle possible overflow
46
+ if (n < 0) return std::numeric_limits<int>::max();
47
+
48
+ return n;
49
+ }
50
+
51
+
52
+ std::vector<int> pow2_between(int n, int x) {
53
+ std::vector<int> result;
54
+ int power = next_pow2(n);
55
+ while (power >= x) {
56
+ result.push_back(power);
57
+ power /= 2;
58
+ }
59
+ return result;
60
+ }
61
+
62
+ bool is_valid_point(const int ss_x, const int ss_y, const util::SubsetData &ssdata) {
63
+
64
+ int x = ss_x / ssdata.step;
65
+ int y = ss_y / ssdata.step;
66
+
67
+ int idx = y * ssdata.num_ss_x + x;
68
+
69
+ if ((ss_x % ssdata.step) || (ss_y % ssdata.step)){
70
+ std::cerr << "Subset coordinates (" << ss_x << ", " << ss_y << ") are not a valid subset location." << std::endl;
71
+ std::cerr << "Subset ss_step size: " << ssdata.step << std::endl;
72
+ return false;
73
+ exit(EXIT_FAILURE);
74
+ }
75
+ else if (ssdata.mask[idx] == -1){
76
+ std::cerr << "Subset coordinates (" << ss_x << ", " << ss_y << ") are not a valid subset location." << std::endl;
77
+ std::cerr << "subset mask index: " << idx << std::endl;
78
+ return false;
79
+ exit(EXIT_FAILURE);
80
+ }
81
+ else return true;
82
+
83
+ //auto it = ssdata.coords_to_idx.find({ss_x, ss_y});
84
+
85
+ //// check if coordinates are in the coordinate list
86
+ //if (it == ssdata.coords_to_idx.end()) {
87
+ // std::cerr << "Error: coordinates not found in the coordinate list." << std::endl;
88
+ // std::cerr << "Coordinates: " << ss_x << ", " << ss_y << std::endl;
89
+ // exit(EXIT_FAILURE);
90
+ //}
91
+ //else return true;
92
+ }
93
+
94
+
95
+ void get_rigid_shift(double &shift_x, double &shift_y,
96
+ const int ss_x, const int ss_y,
97
+ std::vector<std::unique_ptr<fourier::FFT>>& fft_windows,
98
+ const Interpolator &interp_ref,
99
+ const double *img_def){
100
+
101
+
102
+ const int px_hori = interp_ref.px_hori;
103
+ const int px_vert = interp_ref.px_vert;
104
+
105
+ double prev_x = 0, prev_y = 0;
106
+
107
+ // loop over window sizes
108
+ for (size_t w = 0; w < fft_windows.size(); w++){
109
+
110
+ // get the deformed subset values
111
+ util::extract_ss(fft_windows[w]->ss_def, ss_x, ss_y, px_hori, px_vert, img_def);
112
+
113
+ // add shift from previous window size;
114
+ double ss_x_shft = ss_x-prev_x;
115
+ double ss_y_shft = ss_y-prev_y;
116
+
117
+ // get the reference subset values from interpolator
118
+ util::extract_ss_subpx(fft_windows[w]->ss_ref, ss_x_shft, ss_y_shft, interp_ref);
119
+
120
+ // zero normalise the subsets
121
+ fourier::zero_norm_subsets(fft_windows[w]->ss_def.vals, fft_windows[w]->ss_ref.vals, fft_windows[w]->ss_def.size);
122
+
123
+ // get peaks from the cross correlation
124
+ double peak_x = 0, peak_y = 0, max_val = 0.0;
125
+ fft_windows[w]->correlate();
126
+ fft_windows[w]->find_peak(peak_x, peak_y, max_val, true, "GAUSSIAN_2D");
127
+ prev_x += peak_x;
128
+ prev_y += peak_y;
129
+ }
130
+
131
+ // return the shift once we've reached smallest window size
132
+ shift_x = prev_x;
133
+ shift_y = prev_y;
134
+ }
135
+ }
136
+
137
+