calibrate¶
Calibration workflows for brazilian_disk and coupon_test experiments.
This module provides:
- Calibration profile loading/validation
- Dark/blank scalar correction estimation
- Robust fitting of per-channel stress-optic coefficients (
C) - Fitting of incoming Stokes state (
S_i_hat) - End-to-end calibration execution and report/profile output
calibrate
¶
Calibration workflows for photoelastimetry experiments.
This module fits per-wavelength stress-optic coefficients (C) for an explicit fixed incoming polarisation state (S_i_hat), and optional detector blank correction from a multi-load calibration sequence.
Supported calibration methods:
- brazilian_disk: diametrically-loaded disk with analytical stress field.
- coupon_test: uniaxial coupon with nominal stress in a gauge ROI.
Functions¶
load_calibration_profile(profile_file)
¶
Load and validate a calibration profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_file
|
str
|
Path to calibration JSON/JSON5 profile. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Validated calibration profile. |
Source code in photoelastimetry/calibrate.py
compute_blank_correction(dark_frame, blank_frame, eps=1e-06)
¶
Compute per-channel/per-angle scalar blank correction coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dark_frame
|
ndarray
|
Dark reference image stack [H, W, C, 4]. |
required |
blank_frame
|
ndarray
|
Blank reference image stack [H, W, C, 4]. |
required |
eps
|
float
|
Minimum denominator for stability. |
1e-06
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with |
Source code in photoelastimetry/calibrate.py
apply_blank_correction(data, blank_correction)
¶
Apply per-channel/per-angle blank correction to an image stack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ndarray
|
Image data [H, W, C, 4]. |
required |
blank_correction
|
dict
|
Blank correction dictionary containing |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Corrected image stack with same shape as input. |
Source code in photoelastimetry/calibrate.py
validate_calibration_config(config)
¶
Validate and normalise calibration configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
Calibration configuration loaded from JSON5. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Normalised configuration with defaults. |
Source code in photoelastimetry/calibrate.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | |
interactive_geometry_wizard(config)
¶
Interactively pick geometry from the first load-step image.
- brazilian_disk: click center, then one edge point on the disk.
- coupon_test: click top-left then bottom-right gauge ROI corners.
Source code in photoelastimetry/calibrate.py
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | |
calibration_residuals(params, dataset, fixed_s_i_hat)
¶
Compute calibration residuals for least-squares fitting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ndarray
|
1D parameter vector containing one C value per wavelength channel. |
required |
dataset
|
dict
|
Dataset dictionary from |
required |
fixed_s_i_hat
|
array - like
|
Fixed source state used for the forward model. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
1D residual vector. |
Source code in photoelastimetry/calibrate.py
fit_calibration_parameters(dataset, fit_config)
¶
Fit C from calibration dataset with fixed S_i_hat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
dict
|
Dataset dictionary from |
required |
fit_config
|
dict
|
Fitting options. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Fit results containing estimated C, fixed S_i_hat, metrics, and optimizer state. |
Source code in photoelastimetry/calibrate.py
930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 | |
fit_dispersion_parameters(dataset, initial_C, fit_config)
¶
Fit wavelength dispersion using multi-fringe retardance residuals (Stage 2).
Whereas Stage 1 (:func:fit_calibration_parameters) fits independent per-channel
C values from Stokes residuals — which is most sensitive at first-order retardances —
Stage 2 fits a parametric dispersion curve C(λ) from retardance-domain residuals
that handle multiple fringe orders automatically. This makes the dispersion shape
(C-ratio between channels) much better constrained.
For best results, supply a calibration dataset that spans several fringe orders (i.e. a higher load or larger specimen than Stage 1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
dict
|
Dataset from :func: |
required |
initial_C
|
array - like
|
Per-channel C values from Stage 1, used to initialise the dispersion parameters. |
required |
fit_config
|
dict
|
Fit configuration. Relevant keys:
|
required |
Returns:
| Type | Description |
|---|---|
dict
|
Fit result with keys |
Source code in photoelastimetry/calibrate.py
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 | |
run_calibration(config)
¶
Run full calibration workflow from config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
Calibration input configuration. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Result dictionary containing the calibration profile and metadata. |
Source code in photoelastimetry/calibrate.py
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | |