From d83d973ed67e271b022907b68c02a00a21b69b5d Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Thu, 6 Aug 2026 08:50:38 +0800 Subject: [PATCH 1/4] fix: fix spelling and changelog, pre-commit auto-fix --- CHANGELOG.rst | 46 +++++++++---------- news/fix-spelling-and-changelog.rst | 23 ++++++++++ src/extensions/indexing_ext.cpp | 3 +- src/pyobjcryst/crystal.py | 1 - .../diffractiondatasinglecrystal.py | 6 +-- src/pyobjcryst/globaloptim.py | 1 + src/pyobjcryst/indexing.py | 4 +- src/pyobjcryst/molecule.py | 5 +- src/pyobjcryst/powderpattern.py | 10 ++-- src/pyobjcryst/utils.py | 2 - tests/pyobjcryst_test_mem.py | 5 +- tests/test_crystal.py | 1 - tests/test_indexing.py | 4 +- tests/test_molecule.py | 4 -- tests/test_spacegroup.py | 1 - 15 files changed, 67 insertions(+), 49 deletions(-) create mode 100644 news/fix-spelling-and-changelog.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1e8be2d..baf5ad9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,63 +17,63 @@ Release notes Version 2024.2.2 ----------------- +===== -**Fixes:** +**Fixed:** * Correct powder pattern plotting with a non-empty name Version 2024.2.1 ----------------- +===== -**Changes:** +**Changed:** * PowderPattern: * Fix re-using a matplotlib figure when plotting * Add ``figure`` property Version 2024.2 --------------- +===== -**Changes:** +**Changed:** * **DiffractionDataSingleCrystal**: add ``SetHklIobs``, ``SetIobs``, ``SetSigma``, ``GetSigma``, ``GetChi2``, ``FitScaleFactorForRw`` and ``FitScaleFactorForR`` (`issue #42 `_) * Add a single crystal data notebook example * Online documentation notebooks now include the plots ``_ -**Fixes:** +**Fixed:** * From libobjcryst: update the ScatteringComponentList when a Scatterer is removed from a Crystal (`issue #41 `_) Version 2024.1 --------------- +===== -**Changes:** +**Changed:** * Add python access to MolZAtom, for ``Molecule.AsZMatrix()`` Version 2.2.6 --------------- +===== -**Changes:** +**Changed:** * Support for Windows and Python>=3.8 * Added a zoom limit for 3D crystal views -**Fixes:** +**Fixed:** * Correct error preventing pyobjcryst import for Windows and Python>=3.8 (`issue #33 `_) * Fix for matplotlib >=3.7.0 when removing hkl labels Version 2.2.5 --------------- +===== -**Changes:** +**Changed:** * Raise an exception if ``alpha``, ``beta`` or ``gamma`` are not within ``]0;pi[`` when changing lattice angles * Add ``UnitCell.ChangeSpaceGroup()`` -**Fixes:** +**Fixed:** * Avoid duplication of plots when using ipympl (aka ``%matplotlib widget``) * Correct powder pattern tests to avoid warnings @@ -83,9 +83,9 @@ Version 2.2.5 * ``loadCrystal`` – use ``create_crystal_from_cif()`` instead Version 2.2.4 --------------- +===== -**Changes:** +**Changed:** * The list of HKL reflections will now be automatically re-generated for a ``PowderPatternDiffraction`` when the Crystal's spacegroup changes, or the lattice parameters are modified by more than 0.5% @@ -94,7 +94,7 @@ Version 2.2.4 * Fixed the powder pattern indexing test Version 2.2.3 --------------- +===== **Added:** @@ -104,9 +104,9 @@ Version 2.2.3 * Add ``gDiffractionDataSingleCrystalRegistry`` to globals Version 2.2.2 --------------- +===== -**Changes:** +**Changed:** * Add correct wrapping for C++-instantiated objects available through global registries, e.g. when loading an XML file. The objects are decorated with the python functions when accessed through the global registries ``GetObj()`` * Moved global object registries to ``pyobjcryst.globals`` @@ -118,7 +118,7 @@ Version 2.2.2 * Fix powder pattern plot issues (NaN and update of hkl text with recent matplotlib versions) Version 2.2.1 -- 2021-11-28 ----------------------------- +===== * Add quantitative phase analysis with ``PowderPattern.qpa()``, including an example notebook using the QPA Round-Robin data * Correct import of ``urllib.request.urllopen()`` when loading CIF or z-matrix files from HTTP URLs @@ -128,14 +128,14 @@ Version 2.2.1 -- 2021-11-28 * Fix issue when using ``Crystal.XMLInput()`` for a non-empty structure. Existing scattering power will be re-used when possible, and otherwise not deleted anymore (which could lead to crashes) Version 2.2.0 -- 2021-06-08 ----------------------------- +===== * Add access to ``Radiation`` class & functions to change RadiationType, wavelength in ``PowderPattern`` and ``ScatteringData`` (and hence ``DiffractionDataSingleCrystal``) classes * Fix the custodian_ward when creating a ``PowderPatternDiffraction``: ``PowderPatternDiffraction`` must persist while ``PowderPattern`` exists, and Crystal must persist while ``PowderPatternDiffraction`` exists * Add 3D Crystal viewer ``pyobjcryst.crystal.Crystal.widget_3d`` Version 2.1.0 -- 2019-03-11 ----------------------------- +===== **Added:** diff --git a/news/fix-spelling-and-changelog.rst b/news/fix-spelling-and-changelog.rst new file mode 100644 index 0000000..2c5bc3b --- /dev/null +++ b/news/fix-spelling-and-changelog.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Exposed the correctly spelled `ORTHORHOMBIC` while preserving `ORTHOROMBIC` as temporary backend compatible alias + +**Security:** + +* diff --git a/src/extensions/indexing_ext.cpp b/src/extensions/indexing_ext.cpp index f33aca2..180c46c 100644 --- a/src/extensions/indexing_ext.cpp +++ b/src/extensions/indexing_ext.cpp @@ -70,7 +70,7 @@ std::string __str__RecUnitCell(RecUnitCell& ruc) { case TRICLINIC:sys="TRICLINIC"; break; case MONOCLINIC:sys="MONOCLINIC"; break; - case ORTHOROMBIC:sys="ORTHOROMBIC"; break; + case ORTHORHOMBIC:sys="ORTHORHOMBIC"; break; case HEXAGONAL:sys="HEXAGONAL"; break; case RHOMBOEDRAL:sys="RHOMBOEDRAL"; break; case TETRAGONAL:sys="TETRAGONAL"; break; @@ -299,6 +299,7 @@ void wrap_indexing() .value("TRICLINIC", TRICLINIC) .value("MONOCLINIC", MONOCLINIC) .value("ORTHOROMBIC", ORTHOROMBIC) + .value("ORTHORHOMBIC", ORTHORHOMBIC) .value("HEXAGONAL", HEXAGONAL) .value("RHOMBOEDRAL", RHOMBOEDRAL) .value("TETRAGONAL", TETRAGONAL) diff --git a/src/pyobjcryst/crystal.py b/src/pyobjcryst/crystal.py index cc77ea2..89dbc51 100644 --- a/src/pyobjcryst/crystal.py +++ b/src/pyobjcryst/crystal.py @@ -277,7 +277,6 @@ def _display_list( independent atoms, no symmetry or translation is applied :return : the list of atoms and bonds to be displayed for 3dmol """ - spg = self.GetSpaceGroup() vv = [] idx = 0 diff --git a/src/pyobjcryst/diffractiondatasinglecrystal.py b/src/pyobjcryst/diffractiondatasinglecrystal.py index 59e23c1..cd287d8 100644 --- a/src/pyobjcryst/diffractiondatasinglecrystal.py +++ b/src/pyobjcryst/diffractiondatasinglecrystal.py @@ -36,9 +36,9 @@ def create_singlecrystaldata_from_cif(file, crystal): - """ - Create a DiffractionDataSingleCrystal object from a CIF file. Note that - this will use the last created Crystal as a reference structure. + """Create a DiffractionDataSingleCrystal object from a CIF file. + + Note that this will use the last created Crystal as a reference structure. Example using the COD to load both crystal and data: c=create_crystal_from_cif('http://www.crystallography.net/cod/2201530.cif') d=create_singlecrystaldata_from_cif('http://www.crystallography.net/cod/2201530.hkl', c) diff --git a/src/pyobjcryst/globaloptim.py b/src/pyobjcryst/globaloptim.py index 2567535..f0ab83f 100644 --- a/src/pyobjcryst/globaloptim.py +++ b/src/pyobjcryst/globaloptim.py @@ -16,6 +16,7 @@ Changes from ObjCryst::MonteCarloObj:: In development ! """ + __all__ = ["MonteCarlo", "AnnealingSchedule", "GlobalOptimType"] import warnings diff --git a/src/pyobjcryst/indexing.py b/src/pyobjcryst/indexing.py index 1e3251f..fda92f7 100644 --- a/src/pyobjcryst/indexing.py +++ b/src/pyobjcryst/indexing.py @@ -84,7 +84,7 @@ def quick_index( CrystalSystem.TETRAGONAL, CrystalSystem.RHOMBOEDRAL, CrystalSystem.HEXAGONAL, - CrystalSystem.ORTHOROMBIC, + CrystalSystem.ORTHORHOMBIC, CrystalSystem.MONOCLINIC, ]: if csys == CrystalSystem.CUBIC: @@ -99,7 +99,7 @@ def quick_index( vcen = [CrystalCentering.LATTICE_P] elif csys == CrystalSystem.HEXAGONAL: vcen = [CrystalCentering.LATTICE_P] - elif csys == CrystalSystem.ORTHOROMBIC: + elif csys == CrystalSystem.ORTHORHOMBIC: vcen = [ CrystalCentering.LATTICE_P, CrystalCentering.LATTICE_A, diff --git a/src/pyobjcryst/molecule.py b/src/pyobjcryst/molecule.py index 7d1ba73..9f04c13 100644 --- a/src/pyobjcryst/molecule.py +++ b/src/pyobjcryst/molecule.py @@ -126,8 +126,9 @@ def ImportFenskeHallZMatrix(cryst, src, named=False): - """Create a Molecule from a Fenske-Hall z-matrix. This is cleaner - than importing the Z-matrix into a ZScatterer object and then using + """Create a Molecule from a Fenske-Hall z-matrix. + + This is cleaner than importing the Z-matrix into a ZScatterer object and then using ZScatterer2Molecule, as it takes care of keeping only the created Molecule inside the Crystal. diff --git a/src/pyobjcryst/powderpattern.py b/src/pyobjcryst/powderpattern.py index bcb3f0a..ac2726a 100644 --- a/src/pyobjcryst/powderpattern.py +++ b/src/pyobjcryst/powderpattern.py @@ -338,11 +338,11 @@ def _do_plot_hkl(self, nb_max=100, fontsize_hkl=None): @property def figure(self): - """ - return: the figure used for plotting, or None. Note that - if you want to display it in a notebook using ipympl (aka - 'matplotlib widget'), you should 'figure.canvas' to display - also the toolbar (zoom, etc...). + """Return: the figure used for plotting, or None. + + Note that if you want to display it in a notebook using ipympl + (aka 'matplotlib widget'), you should 'figure.canvas' to display + also the toolbar (zoom, etc...). """ return self._plot_fig diff --git a/src/pyobjcryst/utils.py b/src/pyobjcryst/utils.py index d696bed..49bcb1a 100644 --- a/src/pyobjcryst/utils.py +++ b/src/pyobjcryst/utils.py @@ -14,7 +14,6 @@ ############################################################################## """Utilities for crystals.""" - # FIXME: check if this function does any meaningful job. @@ -95,7 +94,6 @@ def f(v): def _xyztostring(crystal): """Helper function to write xyz coordinates of a crystal to a string.""" - nsc = 0 out = "" scl = crystal.GetScatteringComponentList() diff --git a/tests/pyobjcryst_test_mem.py b/tests/pyobjcryst_test_mem.py index 197758d..f096b2c 100644 --- a/tests/pyobjcryst_test_mem.py +++ b/tests/pyobjcryst_test_mem.py @@ -12,8 +12,9 @@ # See LICENSE_DANSE.txt for license information. # ############################################################################## -"""Small tests for pyobjcryst. Not run by pytest, for memory leak -checks. +"""Small tests for pyobjcryst. + +Not run by pytest, for memory leak checks. To check for memory leaks, run valgrind --tool=memcheck --leak- check=full python ./pyobjcrysttest.py diff --git a/tests/test_crystal.py b/tests/test_crystal.py index 6a25942..872d553 100644 --- a/tests/test_crystal.py +++ b/tests/test_crystal.py @@ -141,7 +141,6 @@ def testDummyAtom(self): def testEmbedding(self): """Test integrity of mutually-embedded objects.""" - c = makeCrystal(*makeScatterer()) class Level1(object): diff --git a/tests/test_indexing.py b/tests/test_indexing.py index 6f54fe9..6c7664a 100644 --- a/tests/test_indexing.py +++ b/tests/test_indexing.py @@ -56,7 +56,7 @@ def test_estimate_cell_volume(self): 1 / 1.537, 1 / 47.326, 20, - CrystalSystem.ORTHOROMBIC, + CrystalSystem.ORTHORHOMBIC, CrystalCentering.LATTICE_F, 1.2, ) @@ -65,7 +65,7 @@ def test_estimate_cell_volume(self): 1 / 1.537, 1 / 47.326, 20, - CrystalSystem.ORTHOROMBIC, + CrystalSystem.ORTHORHOMBIC, CrystalCentering.LATTICE_I, 0.3, ) diff --git a/tests/test_molecule.py b/tests/test_molecule.py index 651ddce..9025f99 100644 --- a/tests/test_molecule.py +++ b/tests/test_molecule.py @@ -165,7 +165,6 @@ def testFindAtom(self): def testBonds(self): """Test the Bond methods.""" - a1 = self.m.GetAtom(0) a2 = self.m.GetAtom(1) a3 = self.m.GetAtom(2) @@ -746,7 +745,6 @@ def tearDown(self): def testStretchModeBondLength(self): """Test the StretchModeBondLength class.""" - # Measure the distance ac = self.m[0] # The 0, 0, z atom @@ -795,7 +793,6 @@ def tearDown(self): def testStretchModeBondAngle(self): """Test the StretchModeBondLength class.""" - a1 = self.m[1] ac = self.m[0] a2 = self.m[2] @@ -839,7 +836,6 @@ def tearDown(self): def testStretchModeTorsion(self): """Test the StretchModeBondLength class.""" - a1 = self.m[1] ac0 = self.m[3] ac1 = self.m[0] diff --git a/tests/test_spacegroup.py b/tests/test_spacegroup.py index 278523f..509c401 100644 --- a/tests/test_spacegroup.py +++ b/tests/test_spacegroup.py @@ -14,7 +14,6 @@ ############################################################################## """Unit tests for pyobjcryst.spacegroup.""" - import unittest from pyobjcryst.spacegroup import SpaceGroup From 3adfffd4cc5475b4aab292225dc61b80341f73f7 Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Sun, 9 Aug 2026 21:13:39 +0800 Subject: [PATCH 2/4] build: update the version dependency --- .pre-commit-config.yaml | 4 ++-- requirements/conda.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 11c689b..15dffec 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -83,8 +83,8 @@ repos: additional_dependencies: - "prettier@^3.2.4" # docformatter - PEP 257 compliant docstring formatter - - repo: https://github.com/s-weigand/docformatter - rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c + - repo: https://github.com/PyCQA/docformatter + rev: v1.7.8 hooks: - id: docformatter additional_dependencies: [tomli] diff --git a/requirements/conda.txt b/requirements/conda.txt index fe1eec1..476a320 100644 --- a/requirements/conda.txt +++ b/requirements/conda.txt @@ -1,5 +1,5 @@ numpy -libobjcryst>=2026.1 +libobjcryst>=2026.2.0 libboost-devel libboost-python packaging # for matplotlib version parsing in powderpattern.py From 355e15c18e675593ef869349fff5909fd524190d Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Sun, 9 Aug 2026 21:39:47 +0800 Subject: [PATCH 3/4] chore: retrigger PR workflow --- news/fix-spelling-and-changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/fix-spelling-and-changelog.rst b/news/fix-spelling-and-changelog.rst index 2c5bc3b..613f491 100644 --- a/news/fix-spelling-and-changelog.rst +++ b/news/fix-spelling-and-changelog.rst @@ -16,7 +16,7 @@ **Fixed:** -* Exposed the correctly spelled `ORTHORHOMBIC` while preserving `ORTHOROMBIC` as temporary backend compatible alias +* Exposed the correctly spelled `ORTHORHOMBIC` while preserving `ORTHOROMBIC` as temporary backend compatible alias. **Security:** From db3f280d78c75db4721036d0dfdfb0a0acaf3937 Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Sun, 9 Aug 2026 22:43:17 +0800 Subject: [PATCH 4/4] chore: reactivate PR workflow again --- news/fix-spelling-and-changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/fix-spelling-and-changelog.rst b/news/fix-spelling-and-changelog.rst index 613f491..2c5bc3b 100644 --- a/news/fix-spelling-and-changelog.rst +++ b/news/fix-spelling-and-changelog.rst @@ -16,7 +16,7 @@ **Fixed:** -* Exposed the correctly spelled `ORTHORHOMBIC` while preserving `ORTHOROMBIC` as temporary backend compatible alias. +* Exposed the correctly spelled `ORTHORHOMBIC` while preserving `ORTHOROMBIC` as temporary backend compatible alias **Security:**