Skip to content

Commit

Permalink
🩹 Fix prepare_dataset's add_svd_to_dataset function (#1522)
Browse files Browse the repository at this point in the history
Use raw numpy array instead of xarray dataarray by accessing the dataarray's .data attribute. This resolved an issues with numpy>2.
  • Loading branch information
jsnel authored Aug 25, 2024
1 parent f21ca65 commit 2ef4cea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion glotaran/io/prepare_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def add_svd_to_dataset(
if data_array is None:
data_array = dataset[name] if name != "data" else dataset.data
if f"{name}_singular_values" not in dataset:
lsv, sv, rsv = np.linalg.svd(data_array, full_matrices=False)
lsv, sv, rsv = np.linalg.svd(data_array.data, full_matrices=False)
dataset[f"{name}_left_singular_vectors"] = ((lsv_dim, "left_singular_value_index"), lsv)
dataset[f"{name}_singular_values"] = (("singular_value_index"), sv)
dataset[f"{name}_right_singular_vectors"] = (
Expand Down

0 comments on commit 2ef4cea

Please sign in to comment.