File: utils.py

package info (click to toggle)
python-renishawwire 0.1.16-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,056 kB
  • sloc: python: 1,368; makefile: 28
file content (16 lines) | stat: -rw-r--r-- 398 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Some tiny functions for converting things
from numpy import nan


def convert_wl(wn):
    """Convert wavenumber (cm^-1) to nm"""
    try:
        wl = 1 / (wn * 1e2) / 1e-9
    except ZeroDivisionError:
        wl = nan
    return wl


def convert_attr_name(s):
    """Convert all underline in string name to space and capitalize"""
    return " ".join(map(str.capitalize, s.strip().split("_")))