Skip to content

Commit

Permalink
copy to ensure new object
Browse files Browse the repository at this point in the history
  • Loading branch information
andped10 committed Jan 10, 2024
1 parent b1714e7 commit 6174a9a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions EasyReflectometry/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def plot(data: sc.DataGroup) -> None:
for i, refl_num in enumerate(refl_nums):
plot_data = sc.DataArray(
name=f'R_{refl_num}',
data=data['data'][f'R_{refl_num}'],
coords={f'Qz_{refl_num}': data['coords'][f'Qz_{refl_num}']}
data=data['data'][f'R_{refl_num}'].copy(),
coords={f'Qz_{refl_num}': data['coords'][f'Qz_{refl_num}'].copy()}
)
plot_data.data *= sc.scalar(10.**i, unit=plot_data.unit)
plot_data.coords[f'Qz_{refl_num}'].variances = None
Expand All @@ -43,10 +43,10 @@ def plot(data: sc.DataGroup) -> None:
try:
plot_model_data = sc.DataArray(
name=f'R_{refl_num}_model',
data=data['data'][f'R_{refl_num}_model'],
coords={f'Qz_{refl_num}': data['coords'][f'Qz_{refl_num}']}
data=data[f'R_{refl_num}_model'].copy(),
coords={f'Qz_{refl_num}': data['coords'][f'Qz_{refl_num}'].copy()}
)
plot_model_data.data *= sc.scalar(10.**float(i))
plot_model_data.data *= sc.scalar(10.**i, unit=plot_model_data.unit)
plot_model_data.coords[f'Qz_{refl_num}'].variances = None
sc.plot(
plot_model_data,
Expand All @@ -66,8 +66,8 @@ def plot(data: sc.DataGroup) -> None:
for i, refl_num in enumerate(refl_nums):
plot_sld_data = sc.DataArray(
name=f'SLD_{refl_num}',
data=data[f'SLD_{refl_num}'],
coords={f'z_{refl_num}': data['coords'][f'z_{refl_num}']}
data=data[f'SLD_{refl_num}'].copy(),
coords={f'z_{refl_num}': data['coords'][f'z_{refl_num}'].copy()}
)
sc.plot(
plot_sld_data,
Expand Down

0 comments on commit 6174a9a

Please sign in to comment.