From 3a2fc6685c9345cbdc07f3d637c33456dfe5181e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Fri, 24 Jun 2022 08:14:05 +0300 Subject: [PATCH] An ugly hack to convince newer version of numpy to save list of arrays --- misc/finiterectlat-constant-driving.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/misc/finiterectlat-constant-driving.py b/misc/finiterectlat-constant-driving.py index 777ae26..2762378 100755 --- a/misc/finiterectlat-constant-driving.py +++ b/misc/finiterectlat-constant-driving.py @@ -260,10 +260,15 @@ if not math.isnan(a.ccd_distance): logging.info("Far fields done") outfile = defaultprefix + ".npz" if a.output is None else a.output +for sir in scattered_ir:# An ugly hack to convince newer versions of numpy that we indeed want to save a list of arrays + if sir is None: + break +else: + scattered_ir.append(None) np.savez(outfile, meta={**vars(a), 'qpms_version' : qpms.__version__()}, omega=omega, wavenumber=wavenumber, nelem=nelem, wavevector=np.array(a.wavevector), phases=phases, positions = ss.positions[:,:2], - scattered_ir_packed = np.array(scattered_ir, dtype=np.object), + scattered_ir_packed = np.array(scattered_ir, dtype=object), scattered_full = scattered_full, ir_contained = ir_contained, t=t, l=l, m=m,