Skip to content

Commit

Permalink
Merge pull request #1078 from nipy/rel/3.2.2
Browse files Browse the repository at this point in the history
REL: 3.2.2
  • Loading branch information
effigies authored Feb 7, 2022
2 parents 3c2961b + 96e1229 commit 14db79e
Show file tree
Hide file tree
Showing 24 changed files with 92 additions and 37 deletions.
8 changes: 4 additions & 4 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ implementation of methods, on finding technical solutions, establishing best pra
otherwise. We are accepting of all who wish to take part in our activities, fostering an
environment where anyone can participate and everyone can make a difference.

#### Be collaborative!
#### Collaborative

Our work will be used by other people, and in turn we will depend on the work of others. When we
make something for the benefit of others, we are willing to explain to others how it works, so that
they can build on the work to make it even better. We are willing to provide constructive criticism
on the work of others and accept criticism of our own work, as the experiences and skill sets of
other members contribute to the whole of our efforts.

#### Be inquisitive!
#### Inquisitive

Nobody knows everything! Asking questions early avoids many problems later, so questions are
encouraged, though they may be directed to the appropriate forum. Those who are asked should be
Expand All @@ -51,7 +51,7 @@ efforts of others, keeping in mind that often-times the labor was completed simp
the community. We are attentive in our communications, whether in person or online, and we are
tactful when approaching differing views.

#### Be careful in the words that you choose:
#### Careful in the words we choose

We value courtesy, kindness and inclusiveness in all our interactions. Therefore, we take
responsibility for our own speech. In particular, we avoid:
Expand All @@ -66,7 +66,7 @@ responsibility for our own speech. In particular, we avoid:
* Repeated harassment of others. In general, if someone asks you to stop, then stop.
* Advocating for, or encouraging, any of the above behaviour.

#### Try to be concise in communication
#### Concise

Keep in mind that what you write once will be read by many others. Writing a short email means
people can understand the conversation as efficiently as possible. Even short emails should always
Expand Down
3 changes: 2 additions & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Christopher J. Markiewicz <[email protected]> Christopher J. Markiewicz <e
Cindee Madison <[email protected]> CindeeM <[email protected]>
Cindee Madison <[email protected]> cindeem <[email protected]>
Demian Wassermann <[email protected]> Demian Wassermann <[email protected]>
Dimitri Papadopoulos Orfanos <[email protected]> Dimitri Papadopoulos <[email protected]>
Dimitri Papadopoulos Orfanos <[email protected]> <[email protected]>
Dimitri Papadopoulos Orfanos <[email protected]> <[email protected]>
Eric Larson <[email protected]> Eric89GXL <[email protected]>
Eric Larson <[email protected]> larsoner <[email protected]>
Fernando Pérez-García <[email protected]> Fernando <[email protected]>
Expand Down
25 changes: 18 additions & 7 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@
"orcid": "0000-0001-9791-4404"
},
{
"name": "Lepp\u00e4kangas, Jaakko"
"name": "S\u00f3lon, Anibal"
},
{
"name": "S\u00f3lon, Anibal"
"name": "Lepp\u00e4kangas, Jaakko"
},
{
"name": "van den Bosch, Jasper J.F."
Expand Down Expand Up @@ -228,6 +228,11 @@
{
"name": "St-Jean, Samuel"
},
{
"affiliation": "CEA",
"name": "Papadopoulos Orfanos, Dimitri",
"orcid": "0000-0002-1242-8990"
},
{
"name": "Panfilov, Egor",
"orcid": "0000-0002-2500-6375"
Expand Down Expand Up @@ -286,6 +291,9 @@
{
"name": "Baratz, Zvi"
},
{
"name": "Van, Andrew"
},
{
"affiliation": "Hospital for Sick Children",
"name": "Darwin, Benjamin C"
Expand All @@ -298,11 +306,6 @@
{
"name": "Gauthier, Carl"
},
{
"affiliation": "CEA",
"name": "Papadopoulos Orfanos, Dimitri",
"orcid": "0000-0002-1242-8990"
},
{
"name": "Solovey, Igor"
},
Expand All @@ -326,6 +329,11 @@
"affiliation": "National Technical University of Athens, Greece",
"name": "Raktivan, Konstantinos"
},
{
"affiliation": "Charite Universitatsmedizin Berlin, Germany",
"name": "Waller, Lea",
"orcid": "0000-0002-3239-6957"
},
{
"name": "Cal\u00e1bkov\u00e1, Mark\u00e9ta"
},
Expand All @@ -346,6 +354,9 @@
{
"name": "Roos, Thomas"
},
{
"name": "Hrn\u010diar, Tom\u00e1\u0161"
},
{
"affiliation": "National Institute of Mental Health and Neuro-Sciences, India",
"name": "Reddam, Venkateswara Reddy",
Expand Down
30 changes: 30 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,36 @@ Eric Larson (EL), Demian Wassermann, Stephan Gerhard and Ross Markello (RM).

References like "pr/298" refer to github pull request numbers.

3.2.2 (Monday 7 February 2022)
=================================

Bug fix release in the 3.2.x series.

Bug fixes
---------
* Reshape CIFTI-2 affines to 4x4 when encoded as row-major sequence (pr/1059)
(Andrew Van, reviewed by CM)
* Suggest nibabel.save() on calls to deprecated giftiio.write() (pr/1055)
(Anibal Solon, reviewed by CM)
* Various bugs and style issues detected by LGTM (pr/1043, pr/1048)
(Dimitri Papadopoulos, reviewed by CM)
* Resolve unclosed file warning in GiftiImage (pr/1038) (Lea Waller, reviewed by CM)
* Fix typos preventing deprecation warnings from being raised (pr/991)
(Jonathan Daniel, reviewed by MB)
* Work around numpy SystemError to maintain expected error types (pr/1051) (CM)
* Use more constrained mock when testing optpkg (pr/983) (CM, reviewed by YOH)

Maintenance
-----------
* Add setuptools requirement to match usage (pr/1009)
(Tomáš Hrnčiar, reviewed by CM)
* Fix grammar of headings in CoC (pr/996) (MB, reviewed by CM, Ariel Rokem)
* Set minimum pydicom to 1.0.0 (pr/1050) (CM)
* Submit coverage to codecov via pinned PyPI package (pr/1008) (CM)
* Upgrade versioneer to 0.19 (pr/967) (CM)
* Migrate to GitHub actions (pr/972) (CM, reviewed by Serge Koudoro)


3.2.1 (Saturday 28 November 2020)
=================================

Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

# General information about the project.
project = u'NiBabel'
copyright = f"2006-2020, {metadata['maintainer']} <{metadata['author_email']}>"
copyright = f"2006-2022, {metadata['maintainer']} <{metadata['author_email']}>"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
3 changes: 3 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ contributed code and discussion (in rough order of appearance):
* Markéta Calábková
* Carl Gauthier
* Julian Klug
* Lea Waller
* Tomáš Hrnčiar
* Andrew Van

License reprise
===============
Expand Down
1 change: 1 addition & 0 deletions min-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Auto-generated by tools/update_requirements.py
numpy ==1.14
packaging ==14.3
setuptools
3 changes: 1 addition & 2 deletions nibabel/cifti2/cifti2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,8 +1156,7 @@ def get_index_map(self, index):
a2md = self._get_indices_from_mim(v)
if index in a2md:
return v
else:
raise Cifti2HeaderError("Index not mapped")
raise Cifti2HeaderError("Index not mapped")

def _validate_new_mim(self, value):
if value.applies_to_matrix_dimension is None:
Expand Down
3 changes: 2 additions & 1 deletion nibabel/cifti2/parse_cifti2.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,8 @@ def flush_chardata(self):
# conversion to numpy array
c = BytesIO(data.strip().encode('utf-8'))
transform = self.struct_state[-1]
transform.matrix = np.loadtxt(c, dtype=np.float64)
matrix = np.loadtxt(c, dtype=np.float64)
transform.matrix = matrix.reshape(4, 4)
c.close()

elif self.write_to == 'Label':
Expand Down
5 changes: 5 additions & 0 deletions nibabel/cifti2/tests/test_cifti2io_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
datafiles = [DATA_FILE2, DATA_FILE3, DATA_FILE4, DATA_FILE5, DATA_FILE6]


def test_space_separated_affine():
img = ci.Cifti2Image.from_filename(
pjoin(NIBABEL_TEST_DATA, "row_major.dconn.nii"))


def test_read_nifti2():
# Error trying to read a CIFTI-2 image from a NIfTI2-only image.
filemap = ci.Cifti2Image.make_file_map()
Expand Down
6 changes: 3 additions & 3 deletions nibabel/cmdline/dicomfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_paths(self):
for study in dft.get_studies(self.dicom_path, self.followlinks):
pd = paths.setdefault(study.patient_name_or_uid(), {})
patient_info = 'patient information\n'
patient_info = f'name: {study.patient_name}\n'
patient_info += f'name: {study.patient_name}\n'
patient_info += f'ID: {study.patient_id}\n'
patient_info += f'birth date: {study.patient_birth_date}\n'
patient_info += f'sex: {study.patient_sex}\n'
Expand Down Expand Up @@ -172,9 +172,9 @@ def open(self, path, flags):
elif isinstance(matched_path, tuple):
self.fhs[i] = matched_path[1]()
else:
raise -errno.EFTYPE
return -errno.EFTYPE
return FileHandle(i)
raise -errno.ENFILE
return -errno.ENFILE

# not done
def read(self, path, size, offset, fh):
Expand Down
2 changes: 1 addition & 1 deletion nibabel/filebasedimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def __init__(self, header=None, extra=None, file_map=None):
def header(self):
return self._header

def __getitem__(self):
def __getitem__(self, key):
""" No slicing or dictionary interface for images
"""
raise TypeError("Cannot slice image objects.")
Expand Down
10 changes: 5 additions & 5 deletions nibabel/gifti/gifti.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def from_dict(klass, data_dict):

@deprecate_with_version(
'get_metadata method deprecated. '
"Use the metadata property instead."
"Use the metadata property instead.",
'2.1', '4.0')
def get_metadata(self):
return self.metadata
Expand Down Expand Up @@ -155,7 +155,7 @@ def __init__(self, key=0, red=None, green=None, blue=None, alpha=None):

@deprecate_with_version(
'get_rgba method deprecated. '
"Use the rgba property instead."
"Use the rgba property instead.",
'2.1', '4.0')
def get_rgba(self):
return self.rgba
Expand Down Expand Up @@ -523,7 +523,7 @@ def print_summary(self):

@deprecate_with_version(
'get_metadata method deprecated. '
"Use the metadata property instead."
"Use the metadata property instead.",
'2.1', '4.0')
def get_metadata(self):
return self.meta.metadata
Expand Down Expand Up @@ -877,8 +877,8 @@ def to_file_map(self, file_map=None):
"""
if file_map is None:
file_map = self.file_map
f = file_map['image'].get_prepare_fileobj('wb')
f.write(self.to_xml())
with file_map['image'].get_prepare_fileobj('wb') as f:
f.write(self.to_xml())

@classmethod
def from_file_map(klass, file_map, buffer_size=35000000):
Expand Down
2 changes: 1 addition & 1 deletion nibabel/gifti/giftiio.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def read(filename):


@deprecate_with_version('giftiio.write function deprecated. '
"Use nibabel.load() instead.",
"Use nibabel.save() instead.",
'2.1', '4.0')
def write(image, filename):
""" Save the current image to a new file
Expand Down
12 changes: 11 additions & 1 deletion nibabel/gifti/tests/test_gifti.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import numpy as np

from nibabel.tmpdirs import InTemporaryDirectory

from ... import load
from .. import (GiftiImage, GiftiDataArray, GiftiLabel,
GiftiLabelTable, GiftiMetaData, GiftiNVPairs,
Expand Down Expand Up @@ -40,7 +42,7 @@ def test_agg_data():

assert_array_equal(surf_gii_img.agg_data('pointset'), point_data)
assert_array_equal(surf_gii_img.agg_data('triangle'), triangle_data)
assert_array_equal(func_gii_img.agg_data('time series'), func_data)
assert_array_equal(func_gii_img.agg_data('time series'), func_data)
assert_array_equal(shape_gii_img.agg_data('shape'), shape_data)

assert surf_gii_img.agg_data('time series') == ()
Expand Down Expand Up @@ -443,3 +445,11 @@ def test_darray_dtype_coercion_failures():
da_copy = gii_copy.darrays[0]
assert np.dtype(da_copy.data.dtype) == np.dtype(darray_dtype)
assert_array_equal(da_copy.data, da.data)


def test_gifti_file_close():
gii = load(test_data('gifti', 'ascii.gii'))
with pytest.WarningsRecorder() as record:
with InTemporaryDirectory():
gii.to_filename('test.gii')
assert not any(isinstance(r.message, ResourceWarning) for r in record.list)
1 change: 0 additions & 1 deletion nibabel/pydicom_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
# Module has (apparently) unused imports; stop flake8 complaining
# flake8: noqa

import numpy as np
from .deprecated import deprecate_with_version

have_dicom = True
Expand Down
Binary file added nibabel/tests/data/row_major.dconn.nii
Binary file not shown.
2 changes: 1 addition & 1 deletion nibabel/volumeutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ class BinOpener(Opener):
__doc__ = Opener.__doc__

@deprecate_with_version('BinOpener class deprecated. '
"Please use Opener class instead."
"Please use Opener class instead.",
'2.1', '4.0')
def __init__(self, *args, **kwargs):
return super(BinOpener, self).__init__(*args, **kwargs)
Expand Down
3 changes: 0 additions & 3 deletions nisext/py3builder.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
""" distutils utilities for porting to python 3 within 2-compatible tree """


import sys
import re

try:
from distutils.command.build_py import build_py_2to3
except ImportError:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Auto-generated by tools/update_requirements.py
numpy >=1.14
packaging >=14.3
setuptools
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ python_requires = >=3.6
install_requires =
numpy >=1.14
packaging >=14.3
setuptools
zip_safe = False
packages = find:

Expand All @@ -58,6 +59,7 @@ style =
test =
coverage
pytest !=5.3.4
pytest <7 ; python_version == "3.6"
pytest-cov
pytest-doctestplus !=0.9.0
all =
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"""Build helper."""

import sys
import os

from setuptools import setup
import versioneer
Expand Down
2 changes: 0 additions & 2 deletions tools/make_tarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import commands
import os
import sys
import shutil

from toollib import *

Expand Down
2 changes: 0 additions & 2 deletions tools/mpkg_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
__docformat__ = 'restructuredtext'

import sys
import setuptools
import bdist_mpkg

def main():
del sys.argv[0]
Expand Down

0 comments on commit 14db79e

Please sign in to comment.