wright-group / WrightTools

Tools for loading, processing, and plotting multidimensional spectroscopy data.
http://wright.tools
MIT License
17 stars 9 forks source link

Lack of bidirectionality in converting units from mm to nm #1106

Open kelsonoram opened 1 year ago

kelsonoram commented 1 year ago

This issue is related to the weird position that nanometers finds itself in as both a unit of length and a unit that describes the energy of light. @ksunden and I found that there is no bidirectionality for converting between mm and nm.

wt.units.is_valid_conversion('mm','nm')
Out[20]: True

wt.units.is_valid_conversion('nm','mm')
Out[21]: False

A discussion should happen about how we want to handle this unit conversion going forward.

darienmorrow commented 1 year ago

In the past this oddity was handled by separating nm wavelength from nm position. wt.units.is_valid_conversion('nm_p','mm_p') is valid.

I'll note that mm energy units to nm energy units should be a valid conversion. Everyone needs to be able to convert their kitchen microwave's wavelength to energy ( 2.45 GHz to 122 mm) :P

The primary question to answer is: should WrightTools assume that nm, mm, cm, m, etc are energy or distance units?