Skip to content

Commit

Permalink
BUG: Fix front-end parsing of table.
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Oct 27, 2023
1 parent d1974d7 commit e8ff573
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3134,18 +3134,20 @@ def float_precision(column, item):
if column in ('slice', 'index'):
# stored in astropy table as a float so we can also store nans,
# but should display in the UI without any decimals
return int(item)
return f"{item:.0f}"
elif column in ('pixel', ):
return f"{item:0.03f}"
return f"{item:0.3f}"
elif column in ('xcenter', 'ycenter'):
return f"{item:0.1f}"
elif column in ('sum', ):
return f"{item:.3e}"
else:
return f"{item:0.05f}"
return f"{item:0.5f}"

if isinstance(item, SkyCoord):
return item.to_string('hmsdms', precision=4)
if isinstance(item, u.Quantity) and not np.isnan(item):
return (float_precision(column, item.value) * item.unit).to_string()
return f"{float_precision(column, item.value)} {item.unit.to_string()}"

if hasattr(item, 'to_string'):
return item.to_string()
Expand Down

0 comments on commit e8ff573

Please sign in to comment.