Skip to content

Commit

Permalink
save: hotfix stripping sigma from 2D quantities. (#70)
Browse files Browse the repository at this point in the history
* Try-Except 2-D array strip export.

* Modify test.
  • Loading branch information
PeterKraus authored Jan 27, 2023
1 parent f8f5adf commit 88a2689
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/dgpost/utils/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ def save(
if not sigma:
logger.warning(f"Stripping uncertainties from table.")
for col in table.columns:
table[col] = unp.nominal_values(table[col].array)
try:
table[col] = unp.nominal_values(table[col].array)
except ValueError:
logger.warning(
f"Cannot strip uncertainties from array quantity '{col}'."
)

# find type of file in path or use default 'pkl'
if type is None:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_realworld/ts1_reflection/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ transform:
output: TM210
save:
- table: table
as: table.pkl
as: table.pkl
sigma: false
Binary file modified tests/test_realworld/ts1_reflection/ref.table.pkl
Binary file not shown.

0 comments on commit 88a2689

Please sign in to comment.