I have a npz
file that looks like this.
data = np.load('Data_5_iteration.npz') # Load data from file
keys = list(data.keys()) # all keys in the dictionary
print(keys)
(base) hell@hell:~$ ['nodes', 'temperature', 'max_iter', 'best_error_vec', 'best_u_pred', 'final_error_vec', 'final_u_pred', 'best_iter', 'PDE_loss_array', 'BC_loss_array', 'total_loss_array']
I want to store all these numpy arrays in different arrays with the same name as in the list without writing them line by line.
For example, I don't want to write:
nodes = data[keys[0]]
temperature = data[keys[1]]
max_iter = data[keys[2]]
best_error_vec = data[keys[3]]
best_u_pred = data[keys[4]]
final_error_vec = data[keys[5]]
final_u_pred = data[keys[6]]
best_iter = data[keys[7]]
PDE_loss_array = data[keys[8]]
BC_loss_array = data[keys[9]]
total_loss_array = data[keys[10]]
Can I do this with some automated way?