-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetEngineConfig.py
More file actions
34 lines (31 loc) · 1.23 KB
/
Copy pathGetEngineConfig.py
File metadata and controls
34 lines (31 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
This file contains a function dedicated to reading the Bioptigen Engine's configuration file,
e.g. Engine_xxxx.ini.
The INI file contains spectrometer calibration data that is useful when reconstructing the
raw spectrum files (e.g. .OCU files) into OCT images (e.g. B-scans).
"""
import configparser
def ConfigParser(filePath):
"""
Input: a path to an .ini file to be parsed.
Output: a dictionary containing data useful for
the reconstruction of spectrometer data into OCT data.
"""
# A parser object:
parser = configparser.ConfigParser()
try:
parser.read(filePath)
# The output dictionary:
calDict = {}
# Let's get the spectrometer calibration data:
for el in parser['SPECTROMETER']:
calDict[el] = float(parser['SPECTROMETER'][el])
# As well as some data about the frame-grabber (e.g. number of pixels on the line-scan camera)
for el in parser['CAPTURE_DRIVER']:
if el == "line_length" or el == "frame_duration":
calDict[el] = float(parser['CAPTURE_DRIVER'][el])
# return the output
return calDict
except:
print("error parsing config file, returning None object")
return None