From 8a9c4fc2c80b4c2af20d24fd28c5ebbe74bc4f75 Mon Sep 17 00:00:00 2001 From: Krzysztof Rudnicki Date: Thu, 28 Nov 2024 18:08:06 +0100 Subject: [PATCH] feat: added code for splitting nemeth matrice --- .gitattributes | 2 ++ split_nemeth.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 split_nemeth.py diff --git a/.gitattributes b/.gitattributes index 56c11195..d167fafd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,5 @@ code/poli3.npz filter=lfs diff=lfs merge=lfs -text code/nemeth12.npz filter=lfs diff=lfs merge=lfs -text code/spd_5000.npz filter=lfs diff=lfs merge=lfs -text code/spd_10000.npz filter=lfs diff=lfs merge=lfs -text +code/nemeth12_1.npz filter=lfs diff=lfs merge=lfs -text +code/nemeth12_2.npz filter=lfs diff=lfs merge=lfs -text diff --git a/split_nemeth.py b/split_nemeth.py new file mode 100644 index 00000000..e7d28a1b --- /dev/null +++ b/split_nemeth.py @@ -0,0 +1,17 @@ +import numpy as np + +# Load the .npz file +input_file = 'code/nemeth12.npz' +data = np.load(input_file) + +# Create dictionaries to hold the split data +data_keys = list(data.keys()) +split_point = len(data_keys) // 2 +first_half = {key: data[key] for key in data_keys[:split_point]} +second_half = {key: data[key] for key in data_keys[split_point:]} + +# Save the halves to separate .npz files +np.savez('nemeth12_1.npz', **first_half) +np.savez('nemeth12_2.npz', **second_half) + +print(f"Data split into 'nemeth12_1.npz' and 'nemeth12_2.npz'")