StollLab / EasySpin

MATLAB toolbox for Electron Paramagnetic Resonance (EPR) spectroscopy
http://easyspin.org
MIT License
48 stars 26 forks source link

Better names for `mt2mhz` and `mhz2mt` #267

Closed stestoll closed 1 year ago

stestoll commented 1 year ago

The names of these two functions are based on units rather than the associated quantities and therefore not ideally named.

field2freq and freq2field would be better.

Also, there is a bit of overlap (or a chance for a merger?) between field2freq and larmorfrq.

eprconvert is related.

stestoll commented 1 year ago

One idea is to introduce a more general unit conversion function unitconvert:


unitconvert(1e-4,'cm^-1->K')
unitconvert(1e-4,'cm^-1->MHz')
unitconvert(350,'mT->MHz')
unitconvert(350,'mT->MHz',2.1)
unitconvert(350,'mT->MHz','1H')
unitconvert(3500,'G->mT') 
unitconvert(350,'mT->MHz') 

mt2mhz(350)
unitconvert(350,'mT->MHz')

mt2mhz(350,2.1)
unitconvert(350,'mT->MHz',2.1)

The unit string should probably be interpreted in a case-insensitive manner, i.e. mT->MHz and mt->mhz should both be understood.

Note that Matlab has a unitconv function as well as a unitConvert function (Symbolic Math toolbox).

larmorfrq should be kept separate, since it's such a fundamental notion in magnetic resonance.

stestoll commented 1 year ago

Implemented by https://github.com/StollLab/EasySpin/pull/294