From f55b5ad7826793c20d93a73fab01d028fbb44b00 Mon Sep 17 00:00:00 2001 From: Alvin Noe Ladines <ladinesalvinnoe@gmail.com> Date: Tue, 26 Jan 2021 18:21:19 +0100 Subject: [PATCH] Added error handler for calculate_bytes --- nomad_dos_fingerprints/DOSfingerprint.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nomad_dos_fingerprints/DOSfingerprint.py b/nomad_dos_fingerprints/DOSfingerprint.py index b102711..24f3b62 100644 --- a/nomad_dos_fingerprints/DOSfingerprint.py +++ b/nomad_dos_fingerprints/DOSfingerprint.py @@ -88,7 +88,10 @@ class DOSFingerprint(): """ grid_array = grid.grid() # cut the energy and dos to grid size - energy, dos = np.transpose([(e,d) for e,d in zip(energy, dos) if (e >= grid_array[0][0] and e <= grid_array[-1][0])]) + energy_dos = np.transpose([(e,d) for e,d in zip(energy, dos) if (e >= grid_array[0][0] and e <= grid_array[-1][0])]) + if len(energy_dos) != 2: + return [0, 0], '' + energy, dos = energy_dos # calculate fingerprint bin_fp = '' grid_index = 0 -- GitLab