Preserve offline geometry, marking, replay and evaluation pipelines with source manifests and synthetic tests. Research qualification does not activate these methods as production navigation.
14 lines
674 B
Python
14 lines
674 B
Python
"""Lossless bounded NPZ writer; trade a little disk for less CPU compression."""
|
|
import zipfile
|
|
import numpy as np
|
|
|
|
|
|
def save(path,**arrays):
|
|
with zipfile.ZipFile(path,'w',compression=zipfile.ZIP_DEFLATED,compresslevel=1,allowZip64=True)as archive:
|
|
for name,value in arrays.items():
|
|
if not name or '/'in name or '\\'in name:raise ValueError('Invalid array key')
|
|
array=np.asanyarray(value)
|
|
if array.dtype.hasobject:raise ValueError('Object arrays are not observation evidence')
|
|
with archive.open(name+'.npy','w',force_zip64=True)as member:
|
|
np.lib.format.write_array(member,array,allow_pickle=False)
|