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
230 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 | |
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
539 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 | |
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
929 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 | |
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
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 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | |