Skip to content

Commit bcf1eba

Browse files
committed
Update ScatteringData extension so it works with libobjcryst 2022.1.3, allowing the automatic update of the reflection list in a PowderPatternDiffraction when the spacegroup or a lattice parameter changes.
Version 2.2.4
1 parent 9faab3e commit bcf1eba

File tree

6 files changed

+58
-6
lines changed

6 files changed

+58
-6
lines changed

CHANGELOG.md

+33-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,43 @@
11
# Release notes
22

3-
## Version X.Y.Z
3+
## Version 2.2.4
4+
5+
### Changes
6+
7+
- the list of HKL reflections will now be automatically be re-generated
8+
for a PowderPatternDiffraction when the Crystal's spacegroup changes,
9+
or the lattice parameters are modified by more than 0.5%
10+
11+
### Fixes
12+
13+
- Fixed the powder pattern indexing test
14+
15+
## Version 2.2.3
16+
17+
### Added
18+
19+
- Support for windows install (works with python 3.7, and
20+
also -only with pypy- 3.8 and 3.9)
21+
- Native support for Apple arm64 (M1, M2) processors
22+
- Fourier maps calculation
23+
- Add gDiffractionDataSingleCrystalRegistry to globals
24+
25+
## Version 2.2.2
26+
27+
### Changes
28+
29+
- Add correct wrapping for C++-instantiated objects available through global
30+
registries, e.g. when loading an XML file. The objects are decorated with
31+
the python functions when accessed through the global registries GetObj()
32+
- Moved global object registries to pyobjcryst.globals
33+
- Update documentation
434

535
### Fixed
636

737
- Fix access to PRISM_TETRAGONAL_DICAP, PRISM_TRIGONAL,
838
ICOSAHEDRON and TRIANGLE_PLANE.
9-
39+
- Fix powder pattern plot issues (NaN and update of hkl text with recent
40+
matplotlib versions)
1041

1142
## Version 2.2.1 -- 2021-11-28
1243

conda-recipe/conda_build_config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
python:
22
- 3.10
3+
- 3.11
34
- 3.9
45
- 3.8
56
- 3.7

conda-recipe/meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ requirements:
2626
- python
2727
- pip
2828
- numpy {{ numpy }}
29-
- libobjcryst 2022.1.2
29+
- libobjcryst 2022.1.3
3030
- boost {{ boost }}
3131

3232
run:

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
# Use this version when git data are not available as in a git zip archive.
2222
# Update when tagging a new release.
23-
FALLBACK_VERSION = '2.2.3'
23+
FALLBACK_VERSION = '2.2.4'
2424

2525
# define extension arguments here
2626
ext_kws = {

src/extensions/scatteringdata_ext.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ void wrap_scatteringdata()
9292
// Have to convert from Python array to C++ array
9393
//.def("SetHKL", &ScatteringData::SetHKL)
9494
.def("GenHKLFullSpace2",
95-
&ScatteringData::GenHKLFullSpace2,
95+
(void (ScatteringData::*)(const REAL,const bool)) &ScatteringData::GenHKLFullSpace2,
9696
(bp::arg("maxsithsl"), bp::arg("unique")=false))
9797
.def("GenHKLFullSpace",
98-
&ScatteringData::GenHKLFullSpace,
98+
(void (ScatteringData::*)(const REAL,const bool)) &ScatteringData::GenHKLFullSpace,
9999
(bp::arg("maxtheta"), bp::arg("unique")=false))
100100
// have to figure this out
101101
//.def("GetRadiationType", &ScatteringData::GetRadiationType,

src/pyobjcryst/tests/testpowderpattern.py

+20
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,26 @@ def test_spacegroup_explorer(self):
218218
# for s in spgex.GetScores():
219219
# print(s)
220220

221+
def test_update_nbrefl(self):
222+
c = loadcifdata("paracetamol.cif")
223+
p = PowderPattern()
224+
p.SetWavelength(1.5)
225+
x = np.linspace(0, 40, 4000)
226+
p.SetPowderPatternX(np.deg2rad(x))
227+
pd = p.AddPowderPatternDiffraction(c)
228+
p.GetPowderPatternCalc()
229+
self.assertEqual(pd.GetNbRefl(), 89)
230+
# Change lattice parameter, the reflection list is updated
231+
# during the next powder pattern calculation
232+
c.a *= 1.1
233+
p.GetPowderPatternCalc()
234+
self.assertEqual(pd.GetNbRefl(), 92)
235+
# Change the spacegroup, the reflection list is updated
236+
# during the next powder pattern calculation
237+
c.GetSpaceGroup().ChangeSpaceGroup("P1")
238+
p.GetPowderPatternCalc()
239+
self.assertEqual(pd.GetNbRefl(), 187)
240+
221241
# def test_SetScaleFactor(self): assert False
222242

223243

0 commit comments

Comments
 (0)