Skip to content

Commit

Permalink
👌Make setting dataset["matrix"] type(self._group.matrices) dependent
Browse files Browse the repository at this point in the history
- 🩹 Fix Crash in optimization_group_calculator_linked when using guidance spectra Type: Bug (glotaran#950)

Closes: glotaran#950
  • Loading branch information
jsnel committed Jan 4, 2022
1 parent 60b7028 commit d29606d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions glotaran/analysis/optimization_group_calculator_linked.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,14 +461,24 @@ def create_index_independent_result_dataset(
) -> xr.Dataset:
"""Creates a result datasets for index independent matrices."""

dataset["matrix"] = (
(
(self._global_dimension),
(self._model_dimension),
("clp_label"),
),
np.asarray([m.matrix for m in self._group.matrices[label]]),
)
dummy = self._group.matrices[label]
if isinstance(dummy, CalculatedMatrix):
dataset["matrix"] = (
(
(self._model_dimension),
("clp_label"),
),
self._group.matrices[label].matrix,
)
else:
dataset["matrix"] = (
(
(self._global_dimension),
(self._model_dimension),
("clp_label"),
),
np.asarray([m.matrix for m in self._group.matrices[label]]),
)
dataset["clp"] = self._group.clps[label]

for index, grouped_problem in enumerate(self.bag):
Expand Down

0 comments on commit d29606d

Please sign in to comment.