Repository navigation
feat: add PowderDiffractionGenerator and methods for printing information - #12
Open
cadenmyers13 wants to merge 6 commits into
Open
cadenmyers13 wants to merge 6 commits into
cadenmyers13 wants to merge 6 commits into
Conversation
…n-pr.yml The pin predates the March-Dollase (#119) and TOF profile (#120) bindings, which later steps use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
@sbillinge ready for review, please see the section "What should the reviewer(s) do?" |
diffpy.cmistructure 0.1.1 requires Python <3.14, so CI's tests on 3.14 could not install it. Cap requires-python at <3.14 in pyproject.toml and cookiecutter.json, and use 3.13 in the getting-started docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12 +/- ##
==========================================
+ Coverage 97.72% 98.73% +1.01%
==========================================
Files 6 7 +1
Lines 658 1189 +531
==========================================
+ Hits 643 1174 +531
Misses 15 15
🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR address?
This adds
PowderDiffractionGenerator, an srfitProfileGeneratorthat calculates one phase's Bragg intensity with pyobjcryst. It is put together from the components of the earlier PRs: a structure, an instrument (#8) and a peak profile (#6, #10). Part of #1.Example
generator.print_info()shows what the generator holds:To refine one structure against two datasets, give both generators the same ParameterSet:
Design choices to review
set_structuretakes a structure, a path or a ParameterSet, matching diffpy.cmipdf's PDF generators. It reads CIF files only. A diffpy.structureStructureraises a two-part error, because ObjCryst can't calculate with it.settings_versionit last installed. It installs again when either changes, so a new component, a changed setting (such as a new x-ray tube) and a component set before the structure all go through one path.Component.get_settings()is new. It returns a component's settings, such as the radiation type or the x-ray tube, soprint_infocan show them next to the refinable Parameters. It returns{}by default;ConstantWavelengthInstrumentlists the settings in use._observers.scaleis applied in Python. ObjCryst's own scale factor stays at 1, because changing it doesn't invalidate its cached pattern.Prepare()runs before every calculation, because ObjCryst doesn't regenerate its reflection list when the wavelength or the grid changes. This adds about 0.6 ms per call.Tests compare the generator with plain pyobjcryst set up the same way. They cover:
conftest.py, standing in for one from another package, which works without any change to the generatorFitContributionprint_infoandget_settingsWhat should the reviewer(s) do?
Review the design choices above, and merge.