Skip to content

Commit 862647a

Browse files
Merge pull request #100 from Computer-Aided-Validation-Laboratory/dev
Added user guide and formatting improvements to docs
2 parents 9348e66 + 6b8eb16 commit 862647a

19 files changed

+5813
-163
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pyvale-output/
3030
!reports/images/*.svg
3131
!images/*.png
3232
!images/*.svg
33+
!docs/source/_static/*.png
3334

3435
# Image deformation test cases
3536
*.pkl

README.md

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Pyvale
1+
# pyvale
22
![fig_pyvale_logo](https://raw.githubusercontent.com/Computer-Aided-Validation-Laboratory/pyvale/main/images/pyvale_logo.png)
33

4-
The python validation engine (`pyvale`): An all-in-one package for sensor simulation, sensor uncertainty quantification, sensor placement optimisation and simulation calibration/validation. Used to simulate experimental data from an input multi-physics simulation by explicitly modelling sensors with realistic uncertainties. Useful for experimental design, sensor placement optimisation, testing simulation validation metrics and virtually testing digital shadows/twins.
4+
The python validation engine (`pyvale`) is you virtual engineering laboratory: An all-in-one package for sensor simulation, sensor uncertainty quantification, sensor placement optimisation and simulation calibration/validation. Used to simulate experimental data from an input multi-physics simulation by explicitly modelling sensors with realistic uncertainties. Useful for experimental design, sensor placement optimisation, testing simulation validation metrics and virtually testing digital shadows/twins.
55

6-
We provide dedicated tools for simulation and uncertainty quantification of imaging sensors including digital image correlation (DIC) and infra-red thermography (IRT). Check out the [documentation](https://computer-aided-validation-laboratory.github.io/pyvale/examples.html) to get started with some of our examples.
6+
We provide dedicated tools for simulation and uncertainty quantification of imaging sensors including digital image correlation (DIC) and infra-red thermography (IRT). Check out the [documentation](https://computer-aided-validation-laboratory.github.io/pyvale/index.html) to get started with some of our examples.
77

88
## Quick Demo: Simulating Point Sensors
99
Here we demonstrate how `pyvale` can be used to simulate thermocouples and strain gauges applied to a [MOOSE](https://mooseframework.inl.gov/index.html) thermo-mechanical simulation of a fusion divertor armour heatsink. The figures below show visualisations of the virtual thermocouple and strain gauge locations on the simualtion mesh as well as time traces for each sensor over a series of simulated experiments.
@@ -25,72 +25,19 @@ The code to run the simulated experiments and produce the output shown here come
2525
pip install pyvale
2626
```
2727

28-
## Detailed Install: Ubuntu
29-
### Managing Python Versions
30-
To be compatible with `bpy` (the Blender python interface), `pyvale` uses python 3.11. To install python 3.11 without corrupting your operating systems python installation first add the deadsnakes repository to apt:
31-
```shell
32-
sudo add-apt-repository ppa:deadsnakes/ppa
33-
sudo apt update && sudo apt upgrade -y
34-
```
35-
36-
Install python 3.11 and the dev version:
37-
```shell
38-
sudo apt install python3.11
39-
sudo apt install python3.11-dev
40-
```
41-
42-
Add `venv` to your python 3.11 install:
43-
```shell
44-
sudo apt install python3.11-venv
45-
```
46-
47-
Check your python 3.11 install is working using the following command which should open an interactive python interpreter:
48-
```shell
49-
python3.11
50-
```
51-
52-
### Virtual Environment
53-
54-
We recommend installing `pyvale` in a virtual environment using `venv` or `pyvale` can be installed into an existing environment of your choice. To create a specific virtual environment for `pyvale` navigate to the directory you want to install the environment and use:
55-
56-
```shell
57-
python3.11 -m venv .pyvale-env
58-
source .pyvale-env/bin/activate
59-
```
60-
61-
### Standard Local Installation
62-
`pyvale` can be installed from pypi. Ensure you virtual environment is activated and run the following from the `pyvale` directory:
63-
```shell
64-
pip install pyvale
65-
```
66-
67-
### Developer Local Installation
68-
69-
Clone `pyvale` to your local system along with submodules using:
70-
```shell
71-
git clone --recurse-submodules git@github.com:Computer-Aided-Validation-Laboratory/pyvale.git
72-
```
73-
74-
`cd` to the root directory of `pyvale`. Ensure you virtual environment is activated and run the following commmand from the `pyvale` directory:
75-
```shell
76-
pip install -e .
77-
pip install -e ./dependencies/mooseherder
78-
```
79-
80-
### Running Physics Simulations with MOOSE
81-
`pyvale` come pre-packaged with example `moose` physics simulation inputs (.i) and outputs (as '.e' exodus files) to demonstrate its functionality. If you need to run additional simulation cases we recommend `proteus` (https://github.com/aurora-multiphysics/proteus) which has build scripts for common linux distributions.
28+
We recommend installing `pyvale` into a virtual environment of your choice as `pyvale` requires python 3.11. If you need help setting up your virtual environment and installing `pyvale` head over to the [installation guide](https://computer-aided-validation-laboratory.github.io/pyvale/install.html) in our docs.
8229

8330
## Contributors
8431
The Computer Aided Validation Team at UKAEA:
8532
- Lloyd Fletcher ([ScepticalRabbit](https://github.com/ScepticalRabbit)), UK Atomic Energy Authority
8633
- Joel Hirst ([JoelPhys](https://github.com/JoelPhys)), UK Atomic Energy Authority
87-
- John Charlton ([coolmule0](https://github.com/coolmule0)), UK Atomic Energy Authority
8834
- Lorna Sibson ([lornasibson](https://github.com/lornasibson)), UK Atomic Energy Authority
8935
- Megan Sampson ([meganasampson](https://github.com/meganasampson)), UK Atomic Energy Authority
9036
- Michael Atkinson ([mikesmic](https://github.com/mikesmic)), UK Atomic Energy Authority
9137
- Adel Tayeb ([3adelTayeb](https://github.com/3adelTayeb)), UK Atomic Energy Authority
9238
- Alex Marsh ([alexmarsh2](https://github.com/alexmarsh2)), UK Atomic Energy Authority
9339
- Rory Spencer ([fusmatrs](https://github.com/orgs/Computer-Aided-Validation-Laboratory/people/fusmatrs)), UK Atomic Energy Authority
40+
- John Charlton ([coolmule0](https://github.com/coolmule0)), UK Atomic Energy Authority
9441

9542

9643

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# ==============================================================================
2+
# pyvale: the python validation engine
3+
# License: MIT
4+
# Copyright (C) 2025 The Computer Aided Validation Team
5+
# ==============================================================================
6+
7+
import numpy as np
8+
import matplotlib.pyplot as plt
9+
import mooseherder as mh
10+
import pyvale as pyv
11+
12+
13+
#-------------------------------------------------------------------------------
14+
sim_path = pyv.DataSet.thermomechanical_3d_path()
15+
sim_data = mh.ExodusReader(sim_path).read_all_sim_data()
16+
sim_data = pyv.scale_length_units(scale=1000.0,
17+
sim_data=sim_data)
18+
19+
20+
#-------------------------------------------------------------------------------
21+
x_lims = (12.5,12.5)
22+
y_lims = (0.0,33.0)
23+
z_lims = (0.0,12.0)
24+
n_sens = (1,4,1)
25+
tc_sens_pos = pyv.create_sensor_pos_array(n_sens,x_lims,y_lims,z_lims)
26+
27+
sample_times = np.linspace(0.0,np.max(sim_data.time),50)
28+
29+
tc_sens_data = pyv.SensorData(positions=tc_sens_pos,
30+
sample_times=sample_times)
31+
32+
33+
tc_array = pyv.SensorArrayFactory \
34+
.thermocouples_no_errs(sim_data,
35+
tc_sens_data,
36+
elem_dims=3,
37+
field_name="temperature")
38+
39+
tc_err_chain = []
40+
tc_err_chain.append(pyv.ErrSysUnifPercent(low_percent=1.0,high_percent=1.0))
41+
tc_err_chain.append(pyv.ErrRandNormPercent(std=1.0))
42+
tc_error_int = pyv.ErrIntegrator(tc_err_chain,
43+
tc_sens_data,
44+
tc_array.get_measurement_shape())
45+
tc_array.set_error_integrator(tc_error_int)
46+
47+
48+
#-------------------------------------------------------------------------------
49+
exp_sim = pyv.ExperimentSimulator([sim_data,],
50+
[tc_array,],
51+
num_exp_per_sim=100)
52+
exp_data = exp_sim.run_experiments()
53+
exp_stats = exp_sim.calc_stats()
54+
55+
56+
57+
#-------------------------------------------------------------------------------
58+
pv_plot = pyv.plot_point_sensors_on_sim(tc_array,"temperature")
59+
pv_plot.camera_position = [(59.354, 43.428, 69.946),
60+
(-2.858, 13.189, 4.523),
61+
(-0.215, 0.948, -0.233)]
62+
63+
pv_plot.show()
64+
65+
66+
(fig,ax) = pyv.plot_exp_traces(exp_sim,
67+
component="temperature",
68+
sens_array_num=0,
69+
sim_num=0)
70+
71+
plt.show()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../images/pyvale_rabbit_only.png
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../images/thermomech3d_sg_traces.png
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../images/thermomech3d_sg_vis.png
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../images/thermomech3d_tc_traces.png
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../images/thermomech3d_tc_vis.png

docs/source/examples.rst

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,18 @@
1-
Examples
2-
========
1+
.. _examples_all:
32

4-
Basics
5-
------
3+
Examples
4+
================
65

6+
Basics for Point Sensors
7+
------------------------
78
.. toctree::
8-
:maxdepth: 1
9-
10-
examples/basics/ex1_1_basicscalars_therm2d.rst
11-
examples/basics/ex1_2_sensormodel_therm2d.rst
12-
examples/basics/ex1_3_customsens_therm3d.rst
13-
examples/basics/ex1_4_basicerrors_therm3d.rst
14-
examples/basics/ex1_5_fielderrs_therm3d.rst
15-
examples/basics/ex1_6_caliberrs_therm2d.rst
16-
examples/basics/ex1_7_spatavg_therm2d.rst
17-
examples/basics/ex2_1_basicvectors_disp2d.rst
18-
examples/basics/ex2_2_vectorsens_disp2d.rst
19-
examples/basics/ex2_3_sensangle_disp2d.rst
20-
examples/basics/ex2_4_chainfielderrs_disp2d.rst
21-
examples/basics/ex2_5_vectorfields3d_disp3d.rst
22-
examples/basics/ex3_1_basictensors_strain2d.rst
23-
examples/basics/ex3_2_tensorsens2d_strain2d.rst
24-
examples/basics/ex3_3_tensorsens3d_strain3d.rst
25-
examples/basics/ex4_1_expsim2d_thermmech2d.rst
26-
examples/basics/ex4_2_expsim3d_thermmech3d.rst
9+
:maxdepth: 2
2710

28-
Blender
29-
-------
11+
examples_basics.rst
3012

13+
Blender for Digital Image Correlation
14+
-------------------------------------
3115
.. toctree::
32-
:maxdepth: 1
16+
:maxdepth: 2
3317

34-
examples/renderblender/ex1_1_blenderscene.rst
35-
examples/renderblender/ex1_2_blenderdeformed.rst
36-
examples/renderblender/ex2_1_stereoscene.rst
37-
examples/renderblender/ex2_2_stereodeformed.rst
38-
examples/renderblender/ex3_1_blendercalibration.rst
18+
examples_blender.rst

docs/source/examples_basics.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.. _examples_basics:
2+
3+
Basics
4+
======
5+
6+
.. toctree::
7+
:maxdepth: 1
8+
9+
examples/basics/ex1_1_basicscalars_therm2d.rst
10+
examples/basics/ex1_2_sensormodel_therm2d.rst
11+
examples/basics/ex1_3_customsens_therm3d.rst
12+
examples/basics/ex1_4_basicerrors_therm3d.rst
13+
examples/basics/ex1_5_fielderrs_therm3d.rst
14+
examples/basics/ex1_6_caliberrs_therm2d.rst
15+
examples/basics/ex1_7_spatavg_therm2d.rst
16+
examples/basics/ex2_1_basicvectors_disp2d.rst
17+
examples/basics/ex2_2_vectorsens_disp2d.rst
18+
examples/basics/ex2_3_sensangle_disp2d.rst
19+
examples/basics/ex2_4_chainfielderrs_disp2d.rst
20+
examples/basics/ex2_5_vectorfields3d_disp3d.rst
21+
examples/basics/ex3_1_basictensors_strain2d.rst
22+
examples/basics/ex3_2_tensorsens2d_strain2d.rst
23+
examples/basics/ex3_3_tensorsens3d_strain3d.rst
24+
examples/basics/ex4_1_expsim2d_thermmech2d.rst
25+
examples/basics/ex4_2_expsim3d_thermmech3d.rst

0 commit comments

Comments
 (0)