Skip to content

Commit

Permalink
deprecate CCP4 module (remove in 0.8.0)
Browse files Browse the repository at this point in the history
- deprecation warning raised
- test for warning
- add deprecation to docs
  • Loading branch information
orbeckst committed Feb 20, 2022
1 parent e639500 commit c373d92
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ The rules for this file:

Deprecations

* The CCP4 module will be removed in 0.8.0 and files will only be
read with mrc.
* The CCP4 module (replaced by mrc) will be removed in 0.8.0.


10/10/2021 eloyfelix, renehamburger1993, lilyminium, jvermaas, xiki-tempula,
Expand Down
14 changes: 12 additions & 2 deletions gridData/CCP4.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
# Copyright Science and Technologies Facilities Council, 2015.

"""
:mod:`CCP4` --- the CCP4 volumetric data format
===============================================
:mod:`CCP4` --- the CCP4 volumetric data format (DEPRECATED)
============================================================
.. versionadded:: 0.3.0
.. deprecated:: 0.7.0 The CCP4 module is replaced by :mod:`gridData.mrc` and
will be removed in 0.8.0.
.. _CCP4: http://www.ccp4.ac.uk/html/maplib.html#description
The module provides a simple implementation of a reader for CCP4_
Expand Down Expand Up @@ -160,6 +163,9 @@ class CCP4(object):
* symmetry records
* index ordering besides standard column-major and row-major
* non-standard fields, such any in filed in future use block
.. deprecated:: 0.7.0
Use :class:`gridData.mrc.MRC` instead. This class will be removed in 0.8.0.
"""

_axis_map = {1: 'x', 2: 'y', 3: 'z'}
Expand Down Expand Up @@ -196,6 +202,10 @@ def __init__(self, filename=None):
if filename is not None:
self.read(filename)

warnings.warn("CCP4.CCP4 is being replaced by mrc.MRC and will be removed "
"in release 0.8.0",
category=DeprecationWarning)

def read(self, filename):
"""Populate the instance from the ccp4 file *filename*."""
if filename is not None:
Expand Down
12 changes: 2 additions & 10 deletions gridData/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,8 @@
Formats
-------
The following formats are available (:ref:`supported-file-formats`):
:mod:`~gridData.OpenDX`
IBM's Data Explorer, http://www.opendx.org/
:mod:`~gridData.gOpenMol`
http://www.csc.fi/gopenmol/
:mod:`~gridData.CCP4`
CCP4 format http://www.ccp4.ac.uk/html/maplib.html#description
pickle
python pickle file (:mod:`pickle`)
For the available file formats see :ref:`supported-file-formats`.
"""
Expand Down
3 changes: 2 additions & 1 deletion gridData/mrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
.. [Burnley2017] Burnley T, Palmer C and Winn M (2017) Recent
developments in the CCP-EM software suite. *Acta
Cryst.* D73:469477. doi: `10.1107/S2059798317007859`_
Cryst.* D73:469-477. doi: `10.1107/S2059798317007859`_
.. _`10.1107/S2059798317007859`: https://doi.org/10.1107/S2059798317007859
Classes
-------
Expand Down
9 changes: 7 additions & 2 deletions gridData/tests/test_ccp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

@pytest.fixture(scope="module")
def g():
ccp4 = CCP4.CCP4()
with pytest.warns(DeprecationWarning,
match="CCP4.CCP4 is being replaced by mrc.MRC and will be removed"):
ccp4 = CCP4.CCP4()
ccp4.read(datafiles.CCP4)
grid, edges = ccp4.histogramdd()
return Grid(grid=grid, edges=edges)
Expand All @@ -27,7 +29,10 @@ def test_ccp4(g):

@pytest.fixture(scope="module")
def ccp4data():
return CCP4.CCP4(datafiles.CCP4_1JZV)
with pytest.warns(DeprecationWarning,
match="CCP4.CCP4 is being replaced by mrc.MRC and will be removed"):
ccp4 = CCP4.CCP4(datafiles.CCP4_1JZV)
return ccp4

@pytest.mark.parametrize('name,value', [
('nc', 96),
Expand Down

0 comments on commit c373d92

Please sign in to comment.