From 281f32be11920088201a24aa5c930671937f7d84 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Fri, 24 May 2024 13:30:28 -0400 Subject: [PATCH] bypass jdaviz unit converter --- lcviz/helper.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lcviz/helper.py b/lcviz/helper.py index 8ec097a..f696572 100644 --- a/lcviz/helper.py +++ b/lcviz/helper.py @@ -4,13 +4,28 @@ from lightkurve import LightCurve +from glue.config import settings as glue_settings from glue.core.component_id import ComponentID from glue.core.link_helpers import LinkSame +from glue.core.units import unit_converter from jdaviz.core.helpers import ConfigHelper from lcviz.viewers import TimeScatterView __all__ = ['LCviz'] + +@unit_converter('custom-lcviz') +class UnitConverter: + def equivalent_units(self, data, cid, units): + return set(list(map(str, u.Unit(units).find_equivalent_units( + include_prefix_units=True, equivalencies=u.spectral())))) + + def to_unit(self, data, cid, values, original_units, target_units): + return (values * u.Unit(original_units)).to_value(u.Unit(target_units)) + + +glue_settings.UNIT_CONVERTER = 'custom-lcviz' + custom_components = {'plugin-ephemeris-select': 'components/plugin_ephemeris_select.vue'} # Register pure vue component. This allows us to do recursive component instantiation only in the