Commit 3090e238 authored by Thomas Vincent's avatar Thomas Vincent

compute cunking depending on saved image size

parent 36c8df6f
......@@ -49,6 +49,19 @@ from ...io import XsocsH5
_logger = logging.getLogger(__name__)
def divisors(n, start=1):
"""Returns array of divisors of n that are >= start
:param int n: Number for which to find divisors
:param int start: Returns divisors >= to this value
:return: Array of divisors of n
:rtype: numpy.ndarray
"""
divisors_range = np.arange(start, n + 1)
return divisors_range[np.remainder(n, divisors_range) == 0]
class KmapMerger(object):
(READY, RUNNING, DONE,
ERROR, CANCELED, UNKNOWN) = __STATUSES = range(6)
......@@ -788,8 +801,11 @@ def _add_edf_data(scan_id,
dset_shape = n_images, img_shape[0], img_shape[1]
# TODO rework chunking
chunks = 1, dset_shape[1]//4, dset_shape[2]//4
chunks = (1,
divisors(dset_shape[1],
start=min(dset_shape[1], 150))[0],
divisors(dset_shape[2],
start=min(dset_shape[2], 150))[0])
with entry_h5f.image_dset_ctx(entry=entry,
create=True,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment