pyvale 2025.5.3__cp311-cp311-macosx_14_0_arm64.whl → 2025.7.0__cp311-cp311-macosx_14_0_arm64.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/.dylibs/libomp.dylib +0 -0
  2. pyvale/.dylibs/libunwind.1.0.dylib +0 -0
  3. pyvale/__init__.py +12 -0
  4. pyvale/blendercalibrationdata.py +3 -1
  5. pyvale/blenderscene.py +7 -5
  6. pyvale/blendertools.py +27 -5
  7. pyvale/camera.py +1 -0
  8. pyvale/cameradata.py +3 -0
  9. pyvale/camerasensor.py +147 -0
  10. pyvale/camerastereo.py +4 -4
  11. pyvale/cameratools.py +23 -61
  12. pyvale/cython/rastercyth.c +1657 -1352
  13. pyvale/cython/rastercyth.cpython-311-darwin.so +0 -0
  14. pyvale/cython/rastercyth.py +71 -26
  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.cpython-311-darwin.so +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.0.dist-info}/METADATA +11 -57
  90. {pyvale-2025.5.3.dist-info → pyvale-2025.7.0.dist-info}/RECORD +93 -57
  91. {pyvale-2025.5.3.dist-info → pyvale-2025.7.0.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.0.dist-info}/licenses/LICENSE +0 -0
  95. {pyvale-2025.5.3.dist-info → pyvale-2025.7.0.dist-info}/top_level.txt +0 -0
@@ -10,10 +10,8 @@ NOTE: this module is a feature under developement.
10
10
 
11
11
  import numpy as np
12
12
  import cython
13
- from cython.parallel import prange, parallel, threadid
13
+ #from cython.parallel import prange, parallel, threadid
14
14
  from cython.cimports.libc.math import floor, ceil
15
-
16
- from pyvale.rendermesh import RenderMeshData
17
15
  from pyvale.cameradata import CameraData
18
16
 
19
17
  # NOTE: This module is a feature under developement.
@@ -334,11 +332,11 @@ def _average_image(image_buff_subpx_in: cython.double[:,:],
334
332
  @cython.boundscheck(False) # Turn off array bounds checking
335
333
  @cython.wraparound(False) # Turn off negative indexing
336
334
  @cython.cdivision(True) # Turn off divide by zero check
337
- def raster_frame(coords: cython.double[:,:],
338
- connect: cython.size_t[:,:],
339
- fields_to_render: cython.double[:,:],
340
- cam_data: CameraData,
341
- ) -> tuple[np.ndarray,np.ndarray,int]:
335
+ def raster_static_frame(coords: cython.double[:,:],
336
+ connect: cython.size_t[:,:],
337
+ fields_to_render: cython.double[:,:],
338
+ cam_data: CameraData,
339
+ ) -> tuple[np.ndarray,np.ndarray,int]:
342
340
 
343
341
 
344
342
  world_to_cam_mat: cython.double[:,:] = cam_data.world_to_cam_mat
@@ -375,11 +373,14 @@ def raster_frame(coords: cython.double[:,:],
375
373
  field_raster_np = np.empty((nodes_per_elem,),dtype=np.float64)
376
374
  field_raster_buff: cython.double[:] = field_raster_np
377
375
 
378
- px_coord_np = np.zeros((nodes_per_elem,),np.float64)
379
- px_coord_buff: cython.double[:] = px_coord_np
380
-
381
376
  weights_np = np.zeros((nodes_per_elem,),np.float64)
382
377
  weights_buff: cython.double[:] = weights_np
378
+
379
+ # Only used for edge function in raster coords - need x,y
380
+ px_coord_np = np.zeros((2,),np.float64)
381
+ px_coord_buff: cython.double[:] = px_coord_np
382
+
383
+
383
384
  #---------------------------------------------------------------------------
384
385
 
385
386
  elems_in_image: cython.size_t = _raster_frame(coords[:,:],
@@ -401,6 +402,18 @@ def raster_frame(coords: cython.double[:,:],
401
402
 
402
403
  return (image_buff_avg_np,depth_buff_avg_np,elems_in_image)
403
404
 
405
+ #///////////////////////////////////////////////////////////////////////////////
406
+ @cython.ccall # python+C or cython.cfunc for C only
407
+ @cython.boundscheck(False) # Turn off array bounds checking
408
+ @cython.wraparound(False) # Turn off negative indexing
409
+ @cython.cdivision(True) # Turn off divide by zero check
410
+ def raster_deform_frame(coords: cython.double[:,:],
411
+ connect: cython.size_t[:,:],
412
+ fields_to_render: cython.double[:,:],
413
+ cam_data: CameraData,
414
+ field_disp: cython.double[:,:],
415
+ ) -> tuple[np.ndarray,np.ndarray,int]:
416
+ pass
404
417
 
405
418
  #///////////////////////////////////////////////////////////////////////////////
406
419
  #@cython.nogil
@@ -461,13 +474,13 @@ def _raster_frame(coords: cython.double[:,:],
461
474
  depth_buff_subpx : cython.double[:,:]
462
475
  Processing buffer (output). shape=(num_subpx_y,num_subpx_x)
463
476
  nodes_raster_buff : cython.double[:,:]
464
- Processing buffer (output). shape=(nodes_per_elem, 4 coord[x,y,z,w])
477
+ Processing buffer. shape=(nodes_per_elem, 4 coord[x,y,z,w])
465
478
  field_raster_buff : cython.double[:]
466
- Processing buffer (output). shape=(nodes_per_elem,)
479
+ Processing buffer. shape=(nodes_per_elem,)
467
480
  px_coord_buff : cython.double[:]
468
- Processing buffer (output). shape=(nodes_per_elem,)
481
+ Processing buffer. shape=(2,)
469
482
  weights_buff : cython.double[:]
470
- Processing buffer (output). shape=(nodes_per_elem,)
483
+ Processing buffer. shape=(nodes_per_elem,)
471
484
 
472
485
  Returns
473
486
  -------
@@ -489,6 +502,10 @@ def _raster_frame(coords: cython.double[:,:],
489
502
  #elem_count: cython.size_t = 1
490
503
  elems_in_image: cython.size_t = 0
491
504
 
505
+ # Lifted constants
506
+ coord_step: cython.double = 1.0/float(sub_samp)
507
+ coord_offset: cython.double = 1.0/(2.0*float(sub_samp))
508
+
492
509
  ee: cython.size_t = 0
493
510
  nn: cython.size_t = 0
494
511
  ii: cython.size_t = 0
@@ -515,11 +532,11 @@ def _raster_frame(coords: cython.double[:,:],
515
532
  if elem_area < -tol: # Backface culling
516
533
  continue
517
534
 
518
- print(f"{nodes_raster_buff[0,0]},{nodes_raster_buff[0,1]},{nodes_raster_buff[0,2]}")
519
- print(f"{nodes_raster_buff[1,0]},{nodes_raster_buff[1,1]},{nodes_raster_buff[1,2]}")
520
- print(f"{nodes_raster_buff[2,0]},{nodes_raster_buff[2,1]},{nodes_raster_buff[2,2]}")
521
- print(f"{ee} ELEM AREA : {elem_area}")
522
- print()
535
+ # print(f"{nodes_raster_buff[0,0]},{nodes_raster_buff[0,1]},{nodes_raster_buff[0,2]}")
536
+ # print(f"{nodes_raster_buff[1,0]},{nodes_raster_buff[1,1]},{nodes_raster_buff[1,2]}")
537
+ # print(f"{nodes_raster_buff[2,0]},{nodes_raster_buff[2,1]},{nodes_raster_buff[2,2]}")
538
+ # print(f"{ee} ELEM AREA : {elem_area}")
539
+ # print()
523
540
 
524
541
  x_min: cython.double = vec_min_double(nodes_raster_buff[:,xx])
525
542
  x_max: cython.double = vec_max_double(nodes_raster_buff[:,xx])
@@ -533,6 +550,11 @@ def _raster_frame(coords: cython.double[:,:],
533
550
  if ((y_min > num_pixels[yy]-1) or (y_max < 0)): # y crop
534
551
  continue
535
552
 
553
+ # print(f"Elem {ee}: x, min {x_min}")
554
+ # print(f"Elem {ee}: x, max {x_max}")
555
+ # print(f"Elem {ee}: y, min {y_min}")
556
+ # print(f"Elem {ee}: y, max {y_max}\n")
557
+
536
558
  elems_in_image += 1
537
559
 
538
560
  xi_min: cython.size_t = bound_index_min(x_min)
@@ -540,26 +562,40 @@ def _raster_frame(coords: cython.double[:,:],
540
562
  yi_min: cython.size_t = bound_index_min(y_min)
541
563
  yi_max: cython.size_t = bound_index_max(y_max,num_pixels[yy])
542
564
 
565
+ # print(f"Elem {ee}: xi, min {xi_min}")
566
+ # print(f"Elem {ee}: xi, max {xi_max}")
567
+ # print(f"Elem {ee}: yi, min {yi_min}")
568
+ # print(f"Elem {ee}: yi, max {yi_max}\n")
569
+
543
570
  for nn in range(nodes_per_elem):
544
571
  nodes_raster_buff[nn,zz] = 1/nodes_raster_buff[nn,zz]
545
572
 
546
573
  num_bound_x: cython.size_t = range_len_double(float(xi_min),
547
574
  float(xi_max),
548
- 1.0/float(sub_samp))
575
+ coord_step)
549
576
  num_bound_y: cython.size_t = range_len_double(float(yi_min),
550
577
  float(yi_max),
551
- 1.0/float(sub_samp))
578
+ coord_step)
579
+
580
+ bound_coord_x: cython.double = float(xi_min) + coord_offset
581
+ bound_coord_y: cython.double = float(yi_min) + coord_offset
552
582
 
553
- bound_coord_x: cython.double = float(xi_min) + 1.0/(2.0*float(sub_samp))
554
- bound_coord_y: cython.double = float(yi_min) + 1.0/(2.0*float(sub_samp))
555
- coord_step: cython.double = 1.0/float(sub_samp)
556
583
  bound_ind_x: cython.size_t = sub_samp*xi_min
557
584
  bound_ind_y: cython.size_t = sub_samp*yi_min
558
585
 
586
+ # print(f"Elem {ee}: bound_coord_x={bound_coord_x}")
587
+ # print(f"Elem {ee}: bound_coord_y={bound_coord_y}")
588
+ # print(f"Elem {ee}: bound_ind_x={bound_ind_x}")
589
+ # print(f"Elem {ee}: bound_ind_y={bound_ind_y}")
590
+ # print(f"Elem {ee}: coord_step={coord_step}")
591
+ # print(f"Elem {ee}: num_bound_x={num_bound_x}")
592
+ # print(f"Elem {ee}: num_bound_x={num_bound_y}")
593
+ # print()
594
+
559
595
 
560
596
  for jj in range(num_bound_y):
561
597
 
562
- bound_coord_x = float(xi_min) + 1.0/(2.0*float(sub_samp))
598
+ bound_coord_x = float(xi_min) + coord_offset
563
599
  bound_ind_x: cython.size_t = sub_samp*xi_min
564
600
 
565
601
  for ii in range(num_bound_x):
@@ -594,6 +630,13 @@ def _raster_frame(coords: cython.double[:,:],
594
630
  bound_ind_x += 1
595
631
  continue
596
632
 
633
+ # if (ee%6) == 0:
634
+ # print(f"Elem: {ee}")
635
+ # print(f"x bound ind={bound_ind_x}, coord={bound_coord_x}")
636
+ # print(f"y bound ind={bound_ind_y}, coord={bound_coord_y}")
637
+ # print(f"weights=[{weights_buff[0]},{weights_buff[1]},{weights_buff[2]}]")
638
+ # print()
639
+
597
640
 
598
641
  for ww in range(nodes_per_elem):
599
642
  weights_buff[ww] = weights_buff[ww] / elem_area
@@ -605,6 +648,8 @@ def _raster_frame(coords: cython.double[:,:],
605
648
  # Check the depth buffer, if the element is behind move on
606
649
  px_coord_z: cython.double = 1/weight_dot_nodes
607
650
  if px_coord_z >= depth_buff_subpx[bound_ind_y,bound_ind_x]:
651
+ bound_coord_x += coord_step
652
+ bound_ind_x += 1
608
653
  continue
609
654
 
610
655
  # We only need one depth buffer for all fields
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
pyvale/dataset.py CHANGED
@@ -15,6 +15,7 @@ from enum import Enum
15
15
  from pathlib import Path
16
16
  from importlib.resources import files
17
17
 
18
+ # TODO: finish doc strings for last functions
18
19
 
19
20
  SIM_CASE_COUNT = 26
20
21
  """Constant describing the number of simulation test case input files for moose
@@ -155,14 +156,10 @@ class DataSet:
155
156
  gradient along the x axis of the plate.
156
157
 
157
158
  The simulation parameters can be found in the corresponding MOOSE input
158
- file: case13.i which can be retrieved using `sim_ca_summary_
159
-
160
- Parameters
161
- ----------
162
- Exception : _type_
163
- _description_se_input_file_path`
159
+ file: case13.i which can be retrieved using `sim_case_input_file_path`
164
160
  in this class.
165
161
 
162
+
166
163
  Returns
167
164
  -------
168
165
  Path
@@ -321,5 +318,98 @@ class DataSet:
321
318
  return Path(files("pyvale.data")
322
319
  .joinpath(f"case00_{elem_type.value}_out.e"))
323
320
 
321
+ @staticmethod
322
+ def dic_plate_with_hole_ref() -> Path:
323
+ """Path to the reference image for the plate with hole example.
324
+ 1040x1540 image in .tiff format.
325
+
326
+ Parameters
327
+ ----------
328
+ elem_type : EElemTest
329
+ Enumeration specifying the element type for this test case.
330
+
331
+ Returns
332
+ -------
333
+ Path
334
+ Path to the reference image (*.tiff).
335
+ """
336
+ return Path(files("pyvale.data")
337
+ .joinpath("plate_hole_ref0000.tiff"))
338
+
339
+ @staticmethod
340
+ def dic_plate_with_hole_def() -> Path:
341
+ """Path to the deformed images for the plate with hole example.
342
+ 1040x1540 image in .tiff format.
343
+
344
+ Parameters
345
+ ----------
346
+ elem_type : EElemTest
347
+ Enumeration specifying the element type for this test case.
348
+
349
+ Returns
350
+ -------
351
+ Path
352
+ Path to the reference image (*.tiff).
353
+ """
354
+ return Path(files("pyvale.data")
355
+ .joinpath("plate_hole_def*.tiff"))
356
+
357
+ @staticmethod
358
+ def dic_plate_rigid_ref() -> Path:
359
+ """Path to the reference image for the plate with hole example.
360
+ 1040x1540 image in .tiff format.
361
+
362
+ Parameters
363
+ ----------
364
+ elem_type : EElemTest
365
+ Enumeration specifying the element type for this test case.
366
+
367
+ Returns
368
+ -------
369
+ Path
370
+ Path to the reference image (*.tiff).
371
+ """
372
+ return Path(files("pyvale.data")
373
+ .joinpath("plate_rigid_ref0000.tiff"))
374
+
375
+ @staticmethod
376
+ def dic_plate_rigid_def() -> Path:
377
+ """Path to the deformed images for the plate with hole example.
378
+ 1040x1540 image in .tiff format.
379
+
380
+ Returns
381
+ -------
382
+ Path
383
+ Path to the reference image (*.tiff).
384
+ """
385
+ return Path(files("pyvale.data")
386
+ .joinpath("plate_rigid_def*.tiff"))
387
+
388
+
389
+
390
+ @staticmethod
391
+ def dic_challenge_ref() -> Path:
392
+ """Path to the reference images for the 2D dic challenge.
393
+
394
+ Returns
395
+ -------
396
+ Path
397
+ Path to the reference image (*.tiff).
398
+ """
399
+ return Path(files("pyvale.data")
400
+ .joinpath("DIC_Challenge_Star_Noise_Ref.tif"))
401
+
402
+ @staticmethod
403
+ def dic_challenge_def() -> Path:
404
+ """Path to the reference images for the 2D dic challenge.
405
+
406
+ Returns
407
+ -------
408
+ Path
409
+ Path to the reference image (*.tiff).
410
+ """
411
+ return Path(files("pyvale.data")
412
+ .joinpath("DIC_Challenge_Star_Noise_Def.tif"))
413
+
324
414
 
325
415