Skip to content

Support β-tensor displacement parameters and fix dark-mode plots#199

Merged
AndrewSazonov merged 52 commits into
developfrom
adp-beta-tensor
Jun 11, 2026
Merged

Support β-tensor displacement parameters and fix dark-mode plots#199
AndrewSazonov merged 52 commits into
developfrom
adp-beta-tensor

Conversation

@AndrewSazonov

@AndrewSazonov AndrewSazonov commented Jun 11, 2026

Copy link
Copy Markdown
Member

EasyDiffraction now supports the dimensionless β-tensor convention for anisotropic atomic displacement parameters, alongside the existing B and U (isotropic and anisotropic) forms.

You can now:

  • Load structures and FullProf/SHELX-style data that report anisotropic displacements as β values, without converting them by hand.
  • Set adp_type='beta' directly when creating an atom and fill in the components afterwards.
  • Switch an atom between β, U, and B, with the values converted automatically from the unit cell.
  • Export β tensors back to CIF.
  • Use negative off-diagonal displacement components, as the physics requires.

This release also fixes interactive plots in JupyterLab dark mode, so the reflection-comparison plot's metrics box no longer stays light-grey against the dark theme.

AndrewSazonov and others added 30 commits June 10, 2026 19:24
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AndrewSazonov and others added 21 commits June 11, 2026 08:05
The live-notebook loader (ed-figures.js) could not detect JupyterLab's
theme and only re-coloured annotation fonts, so the comparison plot's
metrics box kept its baked light-grey background in dark mode. Teach the
loader to detect the JupyterLab (and baked) theme, re-theme the metrics
box background and border, and observe the Jupyter theme attributes.

Make the loader the single source of theme-sync, resize, and the legend
toggle: expose those entry points on window.edFigures and have the
standalone/report HTML path delegate to them, deleting the duplicated
inline post-scripts that had drifted out of parity.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cover the called_by_minimizer branch of _apply_adp_symmetry_constraints
on a cubic special position: the minimizer path applies a symmetry-
averaged, out-of-range tensor value raw (via _set_value_from_minimizer)
without aborting, while the interactive path still validates and raises.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Record decision 7 in the plan and a matching ADR Extension bullet: the
symmetry-constraint pass writes aniso tensor components via
_set_value_from_minimizer during a fit, bypassing the diagonal range
validator so a transiently out-of-range averaged value cannot abort the
refinement. The interactive path keeps full validation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Document the two user-requested in-scope additions that landed beyond
the original checklist: inline create(adp_type='beta') ergonomics and
the Jupyter dark-mode / shared-figure-loader fix. Update the Suggested
PR section to mention both benefits.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A standalone snippet with external Plotly (include_plotlyjs=False) was
left without window.edFigures, silently dropping theme sync, resize, and
the legend toggle. Embed the shared loader by default via a new
include_helper_loader flag; the report renderer opts out only for
figures after the first so the loader is still embedded once per page.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AndrewSazonov AndrewSazonov added the [scope] enhancement Adds/improves features (major.MINOR.patch) label Jun 11, 2026
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.79343% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.22%. Comparing base (f118217) to head (b241c64).

Files with missing lines Patch % Lines
...ablocks/structure/categories/atom_sites/default.py 85.41% 7 Missing and 7 partials ⚠️
src/easydiffraction/analysis/calculators/cryspy.py 80.48% 3 Missing and 5 partials ⚠️
...ks/structure/categories/atom_site_aniso/default.py 85.18% 3 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #199      +/-   ##
===========================================
+ Coverage    90.12%   90.22%   +0.10%     
===========================================
  Files          271      271              
  Lines        23111    23273     +162     
  Branches      2683     2718      +35     
===========================================
+ Hits         20829    20999     +170     
+ Misses        1727     1707      -20     
- Partials       555      567      +12     
Flag Coverage Δ
unittests 90.22% <87.79%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...easydiffraction/crystallography/crystallography.py 88.46% <100.00%> (+1.19%) ⬆️
...atablocks/structure/categories/atom_sites/enums.py 85.71% <100.00%> (+1.09%) ⬆️
.../easydiffraction/datablocks/structure/item/base.py 98.13% <100.00%> (ø)
src/easydiffraction/display/plotters/plotly.py 93.74% <100.00%> (-0.05%) ⬇️
src/easydiffraction/display/structure/builder.py 93.82% <100.00%> (-0.08%) ⬇️
src/easydiffraction/display/tablers/pandas.py 81.96% <100.00%> (ø)
src/easydiffraction/io/cif/iucr_writer.py 96.45% <100.00%> (+0.48%) ⬆️
src/easydiffraction/io/cif/serialize.py 95.82% <100.00%> (+0.03%) ⬆️
src/easydiffraction/report/data_context.py 98.64% <100.00%> (-1.36%) ⬇️
src/easydiffraction/report/html_renderer.py 100.00% <100.00%> (ø)
... and 3 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AndrewSazonov AndrewSazonov merged commit beba720 into develop Jun 11, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant