convert_freq¶
-
dqc.utils.
convert_freq
(a: torch.Tensor, from_unit: Optional[str] = None, to_unit: Optional[str] = None) → torch.Tensor[source]¶ Convert the frequency from a unit to another unit. Available units are (case-insensitive):
['cm-1', 'cm^-1', 'hz', 'khz', 'mhz', 'ghz', 'thz']
- Parameters
a (torch.Tensor) – The tensor to be converter.
from_unit (str or None) – The unit of
a
. IfNone
, it is assumed to be in atomic unit.to_unit (str or None) – The unit for
a
to be converted to. IfNone
, it is assumed to be converted to the atomic unit.
- Returns
The tensor in the new unit.
- Return type
torch.Tensor