Convert micrometer (μm) to inverse centimeter (cm/1)

How can I convert micrometer (μm) values to inverse centimeter (cm-1) and vice-versa in Infrared spectra? This question of how to convert from micrometers to inverse centimeter come up from time-to-time, and I think it might be helpful to have a script that simply address to unit conversion.

Convert micrometers to inverse centimeters

Frequency in cm-1
Wavelength in μm

Calculation behind the script:

In the Infrared spectrometry, wavelength is commonly reported in microns / micrometers (μm), and wavenumber is reported in inverse centimeters (cm-1).

  • 1 m = 100 cm = 106 μm
  • 1 cm = 104 μm
  • X cm-1 = 104 / Y μm
  • Y μm = 104 / X cm-1