Created
March 1, 2021 13:56
-
-
Save daguiam/aaf44efcf5cf70ed5bba17df2253622c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
def read_optical_profilometer_data(filename): | |
with open(filename, "r") as f: | |
line = f.readline() | |
# reading the resolutuon line | |
line = f.readline() | |
# Read the x-length and x-resolution | |
# example line: X-Maß = 17.50 X-Auflösung = 1000.00 Punkte/Zeile: 17501 | |
data = re.findall(r"[-+]?\d*\.\d+|\d+", line) | |
# print(line) | |
x_length, x_resolution, x_total = [float(value) for value in data] | |
# Load all the profile data and construct the x and y topography | |
profile = np.loadtxt(filename, skiprows=2) | |
xdata = np.linspace(0,x_length, int(x_total)) | |
return (xdata, profile) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment