Skip to content

modified code to use Q_broad_new attributes in libdiffpy peak widths #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/diffpy/srreal/pdfcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def _defineCommonInterface(cls):
Not applied when equal zero. Active for JeongPeakWidth model.
[0 1/A]''')

cls.qbroad_new = propertyFromExtDoubleAttr('qbroad_new',
'''PDF peak broadening from non-constant instrumental broadening
in Q-space. Active for JeongPeakWidth model.
[0 1/A]''')

cls.extendedrmin = propertyFromExtDoubleAttr('extendedrmin',
'''Low boundary of the extended r-range, read-only.
[A]''')
Expand Down
3 changes: 3 additions & 0 deletions src/diffpy/srreal/peakwidthmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
JeongPeakWidth.qbroad = propertyFromExtDoubleAttr('qbroad',
'PDF peak broadening from increased intensity noise at high Q.')

JeongPeakWidth.qbroad_new = propertyFromExtDoubleAttr('qbroad_new',
'PDF peak broadening from non-constant instrumental broadening in Q-space.')

# Import delayed tweaks of the extension classes.

_final_imports.import_now()
Expand Down
1 change: 1 addition & 0 deletions src/diffpy/srreal/tests/testdebyepdfcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def test_pickling(self):
dpdfc.delta2 = 0.3
dpdfc.maxextension = 10.1
dpdfc.qbroad = 0.01
dpdfc.qbroad_new = 0.01
dpdfc.qdamp = 0.05
dpdfc.qmax = 10
dpdfc.qmin = 0.5
Expand Down
1 change: 1 addition & 0 deletions src/diffpy/srreal/tests/testpdfcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def test_pickling(self):
pdfc.maxextension = 10.1
pdfc.peakprecision = 5e-06
pdfc.qbroad = 0.01
pdfc.qbroad_new = 0.01
pdfc.qdamp = 0.05
pdfc.qmax = 10
pdfc.qmin = 0.5
Expand Down
3 changes: 3 additions & 0 deletions src/diffpy/srreal/tests/testpeakwidthmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def test_type(self):
self.assertTrue(hasattr(self.pwm, 'delta1'))
self.assertTrue(hasattr(self.pwm, 'delta2'))
self.assertTrue(hasattr(self.pwm, 'qbroad'))
self.assertTrue(hasattr(self.pwm, 'qbroad_new'))
return


Expand All @@ -224,11 +225,13 @@ def test_pickling(self):
pwm.delta1 = 1
pwm.delta2 = 2
pwm.qbroad = 3
pwm.qbroad_new = 4
pwm2 = pickle.loads(pickle.dumps(pwm))
self.assertEqual(JeongPeakWidth, type(pwm2))
self.assertEqual(1, pwm2.delta1)
self.assertEqual(2, pwm2.delta2)
self.assertEqual(3, pwm2.qbroad)
self.assertEqual(4, pwm2.qbroad_new)
return

# ----------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/wrap_PeakWidthModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ const char* doc_JeongPeakWidth = "\
Calculate PDF peak width assuming I.-K. Jeong model of correlated motion.\n\
This returns mean-square displacement of atoms in the pair along their\n\
bond corrected for correlated motion and data noise at high-Q by a scaling\n\
factor sqrt(1 - delta1/r - delta2/r**2 + (qbroad * r)**2).\n\
and additive factor \n\
sqrt(1 - delta1/r - delta2/r**2 + (qbroad * r)**2) + (qbroad_new * r)**2.\n\
";

const char* doc_PeakWidthModelOwner = "\
Expand Down