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.
- pyvale/__init__.py +12 -0
- pyvale/blendercalibrationdata.py +3 -1
- pyvale/blenderscene.py +7 -5
- pyvale/blendertools.py +27 -5
- pyvale/camera.py +1 -0
- pyvale/cameradata.py +3 -0
- pyvale/camerasensor.py +147 -0
- pyvale/camerastereo.py +4 -4
- pyvale/cameratools.py +23 -61
- pyvale/cython/rastercyth.c +1657 -1352
- pyvale/cython/rastercyth.cp311-win32.pyd +0 -0
- pyvale/cython/rastercyth.py +71 -26
- pyvale/data/DIC_Challenge_Star_Noise_Def.tiff +0 -0
- pyvale/data/DIC_Challenge_Star_Noise_Ref.tiff +0 -0
- pyvale/data/plate_hole_def0000.tiff +0 -0
- pyvale/data/plate_hole_def0001.tiff +0 -0
- pyvale/data/plate_hole_ref0000.tiff +0 -0
- pyvale/data/plate_rigid_def0000.tiff +0 -0
- pyvale/data/plate_rigid_def0001.tiff +0 -0
- pyvale/data/plate_rigid_ref0000.tiff +0 -0
- pyvale/dataset.py +96 -6
- pyvale/dic/cpp/dicbruteforce.cpp +370 -0
- pyvale/dic/cpp/dicfourier.cpp +648 -0
- pyvale/dic/cpp/dicinterpolator.cpp +559 -0
- pyvale/dic/cpp/dicmain.cpp +215 -0
- pyvale/dic/cpp/dicoptimizer.cpp +675 -0
- pyvale/dic/cpp/dicrg.cpp +137 -0
- pyvale/dic/cpp/dicscanmethod.cpp +677 -0
- pyvale/dic/cpp/dicsmooth.cpp +138 -0
- pyvale/dic/cpp/dicstrain.cpp +383 -0
- pyvale/dic/cpp/dicutil.cpp +563 -0
- pyvale/dic2d.py +164 -0
- pyvale/dic2dcpp.cp311-win32.pyd +0 -0
- pyvale/dicchecks.py +476 -0
- pyvale/dicdataimport.py +247 -0
- pyvale/dicregionofinterest.py +887 -0
- pyvale/dicresults.py +55 -0
- pyvale/dicspecklegenerator.py +238 -0
- pyvale/dicspecklequality.py +305 -0
- pyvale/dicstrain.py +387 -0
- pyvale/dicstrainresults.py +37 -0
- pyvale/errorintegrator.py +10 -8
- pyvale/examples/basics/ex1_1_basicscalars_therm2d.py +124 -113
- pyvale/examples/basics/ex1_2_sensormodel_therm2d.py +124 -132
- pyvale/examples/basics/ex1_3_customsens_therm3d.py +199 -195
- pyvale/examples/basics/ex1_4_basicerrors_therm3d.py +125 -121
- pyvale/examples/basics/ex1_5_fielderrs_therm3d.py +145 -141
- pyvale/examples/basics/ex1_6_caliberrs_therm2d.py +96 -101
- pyvale/examples/basics/ex1_7_spatavg_therm2d.py +109 -105
- pyvale/examples/basics/ex2_1_basicvectors_disp2d.py +92 -91
- pyvale/examples/basics/ex2_2_vectorsens_disp2d.py +96 -90
- pyvale/examples/basics/ex2_3_sensangle_disp2d.py +88 -89
- pyvale/examples/basics/ex2_4_chainfielderrs_disp2d.py +172 -171
- pyvale/examples/basics/ex2_5_vectorfields3d_disp3d.py +88 -86
- pyvale/examples/basics/ex3_1_basictensors_strain2d.py +90 -90
- pyvale/examples/basics/ex3_2_tensorsens2d_strain2d.py +93 -91
- pyvale/examples/basics/ex3_3_tensorsens3d_strain3d.py +172 -160
- pyvale/examples/basics/ex4_1_expsim2d_thermmech2d.py +154 -148
- pyvale/examples/basics/ex4_2_expsim3d_thermmech3d.py +249 -231
- pyvale/examples/dic/ex1_region_of_interest.py +98 -0
- pyvale/examples/dic/ex2_plate_with_hole.py +149 -0
- pyvale/examples/dic/ex3_plate_with_hole_strain.py +93 -0
- pyvale/examples/dic/ex4_dic_blender.py +95 -0
- pyvale/examples/dic/ex5_dic_challenge.py +102 -0
- pyvale/examples/imagedef2d/ex_imagedef2d_todisk.py +4 -2
- pyvale/examples/renderblender/ex1_1_blenderscene.py +152 -105
- pyvale/examples/renderblender/ex1_2_blenderdeformed.py +151 -100
- pyvale/examples/renderblender/ex2_1_stereoscene.py +183 -116
- pyvale/examples/renderblender/ex2_2_stereodeformed.py +185 -112
- pyvale/examples/renderblender/ex3_1_blendercalibration.py +164 -109
- pyvale/examples/renderrasterisation/ex_rastenp.py +74 -35
- pyvale/examples/renderrasterisation/ex_rastercyth_oneframe.py +6 -13
- pyvale/examples/renderrasterisation/ex_rastercyth_static_cypara.py +2 -2
- pyvale/examples/renderrasterisation/ex_rastercyth_static_pypara.py +2 -4
- pyvale/imagedef2d.py +3 -2
- pyvale/imagetools.py +137 -0
- pyvale/rastercy.py +34 -4
- pyvale/rasternp.py +300 -276
- pyvale/rasteropts.py +58 -0
- pyvale/renderer.py +47 -0
- pyvale/rendermesh.py +52 -62
- pyvale/renderscene.py +51 -0
- pyvale/sensorarrayfactory.py +2 -2
- pyvale/sensortools.py +19 -35
- pyvale/simcases/case21.i +1 -1
- pyvale/simcases/run_1case.py +8 -0
- pyvale/simtools.py +2 -2
- pyvale/visualsimplotter.py +180 -0
- {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/METADATA +11 -57
- {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/RECORD +93 -56
- {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/WHEEL +1 -1
- pyvale/examples/visualisation/ex1_1_plot_traces.py +0 -102
- pyvale/examples/visualisation/ex2_1_animate_sim.py +0 -89
- {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/licenses/LICENSE +0 -0
- {pyvale-2025.5.3.dist-info → pyvale-2025.7.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// ================================================================================
|
|
2
|
+
// pyvale: the python validation engine
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Copyright (C) 2025 The Computer Aided Validation Team
|
|
5
|
+
// ================================================================================
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// STD library Header files
|
|
9
|
+
#include <iostream>
|
|
10
|
+
#include <cstring>
|
|
11
|
+
#include <omp.h>
|
|
12
|
+
#include <vector>
|
|
13
|
+
#include <signal.h>
|
|
14
|
+
|
|
15
|
+
// pybind header files
|
|
16
|
+
#include <pybind11/pybind11.h>
|
|
17
|
+
#include <pybind11/numpy.h>
|
|
18
|
+
#include <pybind11/stl.h>
|
|
19
|
+
|
|
20
|
+
// Program Header files
|
|
21
|
+
#include "./dicinterpolator.hpp"
|
|
22
|
+
#include "./dicbruteforce.hpp"
|
|
23
|
+
#include "./dicoptimizer.hpp"
|
|
24
|
+
#include "./dicscanmethod.hpp"
|
|
25
|
+
#include "./defines.hpp"
|
|
26
|
+
#include "./dicutil.hpp"
|
|
27
|
+
#include "./dicstrain.hpp"
|
|
28
|
+
#include "./dicfourier.hpp"
|
|
29
|
+
|
|
30
|
+
// cuda Header files
|
|
31
|
+
#include "../cuda/malloc.hpp"
|
|
32
|
+
|
|
33
|
+
namespace py = pybind11;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
void DICengine(const py::array_t<double>& img_ref_arr,
|
|
37
|
+
const py::array_t<double>& img_def_stack_arr,
|
|
38
|
+
const py::array_t<bool>& img_roi_arr,
|
|
39
|
+
util::Config &conf,
|
|
40
|
+
util::SaveConfig &saveconf){
|
|
41
|
+
|
|
42
|
+
// ------------------------------------------------------------------------
|
|
43
|
+
// Initialisation
|
|
44
|
+
// ------------------------------------------------------------------------
|
|
45
|
+
TITLE("Config");
|
|
46
|
+
INFO_OUT("Width of Images: ", conf.px_hori << " [px]");
|
|
47
|
+
INFO_OUT("Height of Images: ", conf.px_vert << " [px]");
|
|
48
|
+
INFO_OUT("Number of Deformed Images: ", conf.num_def_img);
|
|
49
|
+
INFO_OUT("Max number of solver iterations: ", conf.max_iter);
|
|
50
|
+
INFO_OUT("Correlation Criterion: ", conf.corr_crit);
|
|
51
|
+
INFO_OUT("Shape Function: ", conf.shape_func);
|
|
52
|
+
INFO_OUT("Interpolation Routine: ", conf.interp_routine);
|
|
53
|
+
INFO_OUT("FFT MAD outlier removal enabled: ", conf.fft_mad);
|
|
54
|
+
INFO_OUT("FFT MAD scale: ", conf.fft_mad_scale);
|
|
55
|
+
INFO_OUT("Image Scan Method: ", conf.scan_method);
|
|
56
|
+
INFO_OUT("Optimization Precision:", conf.precision);
|
|
57
|
+
INFO_OUT("Optimization Threshold:", conf.opt_threshold);
|
|
58
|
+
INFO_OUT("Estimate for Max Displacement:", conf.max_disp << " [px]");
|
|
59
|
+
INFO_OUT("Subset Size:", conf.ss_size << " [px]");
|
|
60
|
+
INFO_OUT("Subset Step:", conf.ss_step << " [px]" );
|
|
61
|
+
INFO_OUT("Number of OMP threads:", omp_get_max_threads());
|
|
62
|
+
if (conf.scan_method=="RG") INFO_OUT("Reliability Guided Seed central px location: ", "("
|
|
63
|
+
<< conf.rg_seed.first+conf.ss_size/2 << ", " << conf.rg_seed.second+conf.ss_size/2 << ") [px] " )
|
|
64
|
+
|
|
65
|
+
// Register signal handler for Ctrl+C
|
|
66
|
+
signal(SIGINT, scanmethod::signalHandler);
|
|
67
|
+
|
|
68
|
+
// get raw pointers
|
|
69
|
+
bool* img_roi = static_cast<bool*>(img_roi_arr.request().ptr);
|
|
70
|
+
double* img_ref = static_cast<double*>(img_ref_arr.request().ptr);
|
|
71
|
+
double* img_def_stack = static_cast<double*>(img_def_stack_arr.request().ptr);
|
|
72
|
+
|
|
73
|
+
// debugging
|
|
74
|
+
//for (int y = 0; y < conf.px_vert; y++){
|
|
75
|
+
// for (int x = 0; x < conf.px_hori; x++){
|
|
76
|
+
// std::cout << x << " " << y << " ";
|
|
77
|
+
// std::cout << img_ref[y*conf.px_hori + x] << " ";
|
|
78
|
+
// std::cout << img_def_stack[y*conf.px_hori + x] << " ";
|
|
79
|
+
// std::cout << img_roi[y*conf.px_hori+x] << std::endl;
|
|
80
|
+
// }
|
|
81
|
+
//}
|
|
82
|
+
//exit(0);
|
|
83
|
+
|
|
84
|
+
// ------------------------------------------------------------------------
|
|
85
|
+
// get a list of ss coordinates within RIO;
|
|
86
|
+
// ------------------------------------------------------------------------
|
|
87
|
+
std::vector<util::SubsetData> ssdata;
|
|
88
|
+
std::vector<int> ss_sizes, ss_steps;
|
|
89
|
+
if ((conf.scan_method == "FFT") || (conf.scan_method == "RG")){
|
|
90
|
+
util::Timer timer("subset list initialisation");
|
|
91
|
+
util::gen_size_and_step_vector(ss_sizes, ss_steps, conf.ss_size, conf.ss_step, conf.max_disp);
|
|
92
|
+
fourier::init(ssdata, ss_sizes, ss_steps, img_roi, conf);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
util::Timer timer("subset list initialisation");
|
|
96
|
+
ssdata.push_back(util::gen_ss_list(img_roi, conf.ss_step,
|
|
97
|
+
conf.ss_size, conf.px_hori,
|
|
98
|
+
conf.px_vert));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
// resize the results based on subset information
|
|
104
|
+
util::resize_results(conf.num_def_img, ssdata.back().num,
|
|
105
|
+
conf.num_params, saveconf.at_end);
|
|
106
|
+
|
|
107
|
+
// initialise the LM optimizer with shape func and corr crit
|
|
108
|
+
optimizer::init(conf.corr_crit, conf.shape_func);
|
|
109
|
+
|
|
110
|
+
// initialise the brute force scan
|
|
111
|
+
std::string brute_method = "EXPANDING_WAVEFRONT";
|
|
112
|
+
brute::init(conf.corr_crit, brute_method);
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
// -----------------------------------------------------------------------
|
|
117
|
+
// loop over deformed images and perform DIC
|
|
118
|
+
// -----------------------------------------------------------------------
|
|
119
|
+
std::cout << std::endl;
|
|
120
|
+
TITLE("Starting Correlation")
|
|
121
|
+
util::Timer timer("DIC Engine:");
|
|
122
|
+
for (int img_num = 0; img_num < conf.num_def_img; img_num++){
|
|
123
|
+
|
|
124
|
+
// pointer to starting location of deformed image in memory
|
|
125
|
+
int num_px_in_image = conf.px_hori * conf.px_vert;
|
|
126
|
+
double *img_def = img_def_stack + img_num*num_px_in_image;
|
|
127
|
+
|
|
128
|
+
// define our interpolator for the reference image
|
|
129
|
+
Interpolator interp_def(img_def, conf.px_hori, conf.px_vert);
|
|
130
|
+
|
|
131
|
+
// raster scan
|
|
132
|
+
if (conf.scan_method=="IMAGE_SCAN")
|
|
133
|
+
scanmethod::image(img_ref, interp_def, ssdata[0], conf, img_num);
|
|
134
|
+
|
|
135
|
+
// raster with brute force
|
|
136
|
+
else if (conf.scan_method=="IMAGE_SCAN_WITH_BF")
|
|
137
|
+
scanmethod::image_with_bf(img_ref, img_def, interp_def, ssdata[0], conf, img_num);
|
|
138
|
+
|
|
139
|
+
// reliability Guided
|
|
140
|
+
else if (conf.scan_method=="RG")
|
|
141
|
+
scanmethod::reliability_guided(img_ref, img_def, interp_def, ssdata, conf, img_num, saveconf.at_end);
|
|
142
|
+
|
|
143
|
+
// multi window fft
|
|
144
|
+
else if (conf.scan_method=="FFT")
|
|
145
|
+
scanmethod::multi_window_fourier(img_ref, img_def, interp_def, ssdata, conf, img_num);
|
|
146
|
+
|
|
147
|
+
// single window fft
|
|
148
|
+
else if (conf.scan_method=="FFT_test")
|
|
149
|
+
scanmethod::single_window_fourier(img_ref, img_def, interp_def, ssdata[0], conf, img_num);
|
|
150
|
+
|
|
151
|
+
if (!saveconf.at_end)
|
|
152
|
+
util::save_to_disk(img_num, saveconf, ssdata.back(), conf.num_def_img, conf.num_params, conf.filenames);
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (saveconf.at_end)
|
|
157
|
+
for (int img_num = 0; img_num < conf.num_def_img; img_num++)
|
|
158
|
+
util::save_to_disk(img_num, saveconf, ssdata.back(), conf.num_def_img, conf.num_params, conf.filenames);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
void build_info(){
|
|
163
|
+
//std::cout << "Buld Information:" << std::endl;
|
|
164
|
+
//INFO_OUT("- g++ version:", CPUCOMP);
|
|
165
|
+
//INFO_OUT("- Co
|
|
166
|
+
//INFO_OUT("- Git SHA:", GITINFO);
|
|
167
|
+
//INFO_OUT("- Number of dirty files:", GITDIRTY);
|
|
168
|
+
//INFO_OUT("- Compiled on Machine:", HOSTNAME);
|
|
169
|
+
//INFO_OUT("- Compiled on OS:", OSNAME);
|
|
170
|
+
//INFO_OUT("- Compiled at:", BUILDTIME);
|
|
171
|
+
//std::cout << std::endl;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
PYBIND11_MODULE(dic2dcpp, m) {
|
|
177
|
+
py::class_<util::Config>(m, "Config")
|
|
178
|
+
.def(py::init<>())
|
|
179
|
+
.def_readwrite("ss_step", &util::Config::ss_step)
|
|
180
|
+
.def_readwrite("ss_size", &util::Config::ss_size)
|
|
181
|
+
.def_readwrite("max_iter", &util::Config::max_iter)
|
|
182
|
+
.def_readwrite("precision", &util::Config::precision)
|
|
183
|
+
.def_readwrite("opt_threshold", &util::Config::opt_threshold)
|
|
184
|
+
.def_readwrite("bf_threshold", &util::Config::bf_threshold)
|
|
185
|
+
.def_readwrite("max_disp", &util::Config::max_disp)
|
|
186
|
+
.def_readwrite("corr_crit", &util::Config::corr_crit)
|
|
187
|
+
.def_readwrite("shape_func", &util::Config::shape_func)
|
|
188
|
+
.def_readwrite("interp_routine", &util::Config::interp_routine)
|
|
189
|
+
.def_readwrite("scan_method", &util::Config::scan_method)
|
|
190
|
+
.def_readwrite("px_hori", &util::Config::px_hori)
|
|
191
|
+
.def_readwrite("px_vert", &util::Config::px_vert)
|
|
192
|
+
.def_readwrite("num_def_img", &util::Config::num_def_img)
|
|
193
|
+
.def_readwrite("rg_seed", &util::Config::rg_seed)
|
|
194
|
+
.def_readwrite("num_params", &util::Config::num_params)
|
|
195
|
+
.def_readwrite("fft_mad", &util::Config::fft_mad)
|
|
196
|
+
.def_readwrite("fft_mad_scale", &util::Config::fft_mad_scale)
|
|
197
|
+
.def_readwrite("filenames", &util::Config::filenames);
|
|
198
|
+
|
|
199
|
+
py::class_<util::SaveConfig>(m, "SaveConfig")
|
|
200
|
+
.def(py::init<>())
|
|
201
|
+
.def_readwrite("basepath", &util::SaveConfig::basepath)
|
|
202
|
+
.def_readwrite("binary", &util::SaveConfig::binary)
|
|
203
|
+
.def_readwrite("prefix", &util::SaveConfig::prefix)
|
|
204
|
+
.def_readwrite("delimiter", &util::SaveConfig::delimiter)
|
|
205
|
+
.def_readwrite("at_end", &util::SaveConfig::at_end);
|
|
206
|
+
|
|
207
|
+
// Bind the engine function
|
|
208
|
+
m.def("build_info", &build_info, "build information");
|
|
209
|
+
m.def("dic_engine", &DICengine, "Run 2D analysis on input images with config");
|
|
210
|
+
m.def("strain_engine", &strain::engine, "Strain C++ calculations");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|