UnitConversion

class jdaviz.configs.specviz.UnitConversion(*args, **kwargs)[source] [edit on github]

Bases: jdaviz.core.template_mixin.TemplateMixin

Public constructor

Attributes Summary

current_flux_unit

A trait for unicode strings.

current_spectral_axis_unit

A trait for unicode strings.

dc_items

An instance of a Python list.

flux_unit_equivalencies

An instance of a Python list.

new_flux_unit

A trait which allows any value.

new_spectral_axis_unit

A trait which allows any value.

selected_data

A trait for unicode strings.

spectral_axis_unit_equivalencies

An instance of a Python list.

template_file

Methods Summary

convert_units_to_strings(unit_list)

Convert equivalencies into readable versions of the units.

create_flux_equivalencies_list()

Gets all possible conversions for flux from current flux units.

create_spectral_equivalencies_list()

Gets all possible conversions from current spectral_axis_unit.

process_unit_conversion(spectrum[, ...])

Parameters

set_spectrum(spectrum, label)

Set spectrum for unit conversion.

update_ui()

Set up UI to have all values of currently visible spectra.

vue_data_selected(event)

vue_unit_conversion(*args, **kwargs)

Runs when the apply button is hit.

Attributes Documentation

current_flux_unit

A trait for unicode strings.

current_spectral_axis_unit

A trait for unicode strings.

dc_items

An instance of a Python list.

flux_unit_equivalencies

An instance of a Python list.

new_flux_unit

A trait which allows any value.

new_spectral_axis_unit

A trait which allows any value.

selected_data

A trait for unicode strings.

spectral_axis_unit_equivalencies

An instance of a Python list.

template_file = ('/home/docs/checkouts/readthedocs.org/user_builds/jdaviz/envs/v2.1.0/lib/python3.8/site-packages/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py', 'unit_conversion.vue')

Methods Documentation

convert_units_to_strings(unit_list)[source] [edit on github]

Convert equivalencies into readable versions of the units.

Parameters
unit_listlist

List of either astropy.units or strings that can be converted to astropy.units.

Returns
list

A list of the units with their best (i.e., most readable) string version.

create_flux_equivalencies_list()[source] [edit on github]

Gets all possible conversions for flux from current flux units.

create_spectral_equivalencies_list()[source] [edit on github]

Gets all possible conversions from current spectral_axis_unit.

process_unit_conversion(spectrum, new_flux=None, new_spectral_axis=None)[source] [edit on github]
Parameters
spectrumspecutils.Spectrum1D

The spectrum that will have its units converted.

new_flux

The flux of spectrum will be converted to these units if they are provided.

new_spectral_axis

The spectral_axis of spectrum will be converted to these units if they are provided.

Returns
converted_spectrumspecutils.Spectrum1D

A new spectrum with converted units.

set_spectrum(spectrum, label)[source] [edit on github]

Set spectrum for unit conversion.

Parameters
spectrumSpectrum1D

Spectrum for unit conversion.

labelstr

Label used to represent spectrum.

update_ui()[source] [edit on github]

Set up UI to have all values of currently visible spectra.

vue_data_selected(event)[source] [edit on github]
vue_unit_conversion(*args, **kwargs)[source] [edit on github]

Runs when the apply button is hit. Tries to change units if new units are set and are valid.