Skip to content

Expose objcryst's anisotropic Pseudo-Voigt reflection profile - #112

Merged
vincefn merged 4 commits into
diffpy:mainfrom
clemisch:expose-aniso-pv
Aug 26, 2026
Merged

Expose objcryst's anisotropic Pseudo-Voigt reflection profile#112
vincefn merged 4 commits into
diffpy:mainfrom
clemisch:expose-aniso-pv

Conversation

@clemisch

Copy link
Copy Markdown
Contributor

pyobjcryst currently uses/exposes only objcryst's isotropic Pseudo-Voigt profile.
objcryst already has an anisotropic PV, which I want not necessarily for being anisotropic, but its finer control of Lorentz vs Gaussian peak shape parameters.

To expose it, we add explicit constructors for the different profiles, and add method PowderPatternDiffraction.SetProfile to assign them (by copy).

from pyobjcryst.reflectionprofile import (
    ReflectionProfilePseudoVoigt,
    ReflectionProfilePseudoVoigtAnisotropic,
)

profile = ReflectionProfilePseudoVoigtAnisotropic()
profile.GetPar("W").SetValue(1e-6)
profile.GetPar("G_HH").SetValue(2e-6)

for pdiff in pp.get_crystalline_components():
    pdiff.SetProfile(profile)

There already exists pdiff.SetReflectionProfilePar which is advertised to be used like

pdiff.SetReflectionProfilePar(ReflectionProfileType.PROFILE_PSEUDO_VOIGT, W)

but it actually ignores the profile type parameter and is hard-coded to create an isotropic PV profile. This PR doesn't change that, to avoid breaking existing code.

@clemisch

clemisch commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

The test is failing because objcryst's constructor for ReflectionProfilePseudoVoigtAnisotropic currently ignores its fwhmGaussP argument.

I proposed a fix in vincefn/objcryst#93.
But the test here won't succeed until a new (lib)objcryst release?
I adapted the tests to get/set the parameters more manually, now they work already.

@vincefn

vincefn commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

But the test here won't succeed until a new (lib)objcryst release?

Yes - have you finished the (lib)objcryst changes ? Then we'll do a release.

@vincefn
vincefn merged commit 984f9a0 into diffpy:main Aug 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants