4ed172063fc1ec493c91b327e4761192dbb227dd,pyemma/_base/serialization/jsonpickler_handlers.py,NumpyNPZHandler,flatten,#NumpyNPZHandler#Any#Any#,50
Before Change
def flatten(self, obj, data):
assert isinstance(obj, np.ndarray)
buff = BytesIO()
np.savez_compressed(buff, x=obj)
buff.seek(0)
flattened_bytes = util.b64encode(buff.read())
data["npz_file_bytes"] = flattened_bytes
return data
After Change
return self.context.h5_file
def flatten(self, obj, data):
if obj.dtype == np.object_:
raise NotImplementedError()
res = [self.context.flatten(x) for x in obj]
//raise Exception(str(obj))
// TODO: how to deal with obj dtype? eg. return list
//data.clear()
data["py/object"] = "list"
else:
import uuid
array_id = "{group}/{id}".format(group=self.file.name, id=uuid.uuid4())
self.file.create_dataset(name=array_id, data=obj,
chunks=True, compression="gzip", compression_opts=4, shuffle=True)
data["array_ref"] = array_id
return data
def restore(self, obj):
array_ref = obj["array_ref"]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: markovmodel/PyEMMA
Commit Name: 4ed172063fc1ec493c91b327e4761192dbb227dd
Time: 2017-08-31
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/serialization/jsonpickler_handlers.py
Class Name: NumpyNPZHandler
Method Name: flatten
Project Name: comic/grand-challenge.org
Commit Name: 4d9d2a1fc4e0d9289000a235340235802d51a97a
Time: 2021-02-12
Author: 57257130+MikeOverkamp-diag@users.noreply.github.com
File Name: app/grandchallenge/cases/image_builders/dicom.py
Class Name:
Method Name: _create_itk_from_dcm
Project Name: senarvi/theanolm
Commit Name: 189819853d6c8afcff68df77b60a4f5f89527036
Time: 2016-11-14
Author: seppo.git@marjaniemi.com
File Name: theanolm/iterators/linearbatchiterator.py
Class Name: LinearBatchIterator
Method Name: __init__