Skip to content

Commit

Permalink
Fix changing the depth of unloaded multidimensional columns
Browse files Browse the repository at this point in the history
- Bump to 1.0.15
  • Loading branch information
smathot committed Dec 17, 2024
1 parent 144c1fb commit e7c832a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion datamatrix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
from datamatrix._datamatrix._nifticolumn import NiftiColumn
from datamatrix._datamatrix._datamatrix import DataMatrix

__version__ = '1.0.14'
__version__ = '1.0.15'
NAN = float('nan')
INF = float('inf')
3 changes: 3 additions & 0 deletions datamatrix/_datamatrix/_multidimensionalcolumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def depth(self, depth):
if self.defaultnan:
seq[:] = np.nan
seq[:, :self.depth] = self._seq
# If the depth is changed, we need to take this into account by
# setting the current shape based on the target shape
self._shape = seq.shape[1:]
self._seq = seq
self._shape = (depth, )
return
Expand Down
11 changes: 10 additions & 1 deletion testcases/test_memmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from datamatrix.py3compat import *
from datamatrix import cfg, io
from datamatrix import DataMatrix, MultiDimensionalColumn, INF, \
functional as fnc
functional as fnc, SeriesColumn
from testcases.test_tools import check_dm
import itertools as it

Expand Down Expand Up @@ -125,3 +125,12 @@ def test_memmap_multiprocess_stack():
cfg.min_mem_free_rel = .5
cfg.min_mem_free_abs = 4294967296
cfg.always_load_max_size = 134217728


def test_memmap_seriescolumn_depth():
dm = DataMatrix(length=2)
dm.s = SeriesColumn(depth=3)
dm.s.loaded = False
assert not dm.s.loaded
dm.s.depth = 4
assert not dm.s.loaded

0 comments on commit e7c832a

Please sign in to comment.