Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Raman Spectrometer Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BVT-HTBD
KIWI
TF3
Raman Spectrometer Server
Merge requests
!2
explicitly load the bwtek library
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
explicitly load the bwtek library
dockerfile_for_spectrometer_server
into
main
Overview
0
Commits
1
Pipelines
1
Changes
8
Merged
Christoph Lange
requested to merge
dockerfile_for_spectrometer_server
into
main
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
8
Expand
0
0
Merge request reports
Viewing commit
63e9e081
Show latest version
8 files
+
103
−
55
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
63e9e081
explicitly load the bwtek library
· 63e9e081
Christoph Lange
authored
1 year ago
py_raman_chef/grpc_interface/server.py
+
19
−
4
Options
import
ctypes
import
json
import
os
import
grpc
import
logging
@@ -17,11 +19,23 @@ logger = logging.getLogger(__name__)
class
SpectrometerServicer
(
RamanChefServicer
):
def
startup_procedure
(
self
,
default_channel
):
def
startup_procedure
(
self
,
default_channel
,
bwtek_dll_path
:
str
=
""
):
self
.
default_channel
=
default_channel
self
.
spectrometer_configs
=
initialize_spectrometer
()
logger
.
debug
(
"
Initialized %s spectrometers
"
,
len
(
self
.
spectrometer_configs
))
set_temperatures
(
self
.
spectrometer_configs
)
if
bool
(
os
.
environ
.
get
(
"
BWTEK_MOCK
"
,
"
False
"
)):
self
.
bwtek_dll
=
None
else
:
self
.
bwtek_dll
=
ctypes
.
CDLL
(
bwtek_dll_path
)
self
.
spectrometer_configs
=
initialize_spectrometer
(
bwtek_dll
=
self
.
bwtek_dll
,
)
logger
.
debug
(
"
Initialized %s spectrometers
"
,
len
(
self
.
spectrometer_configs
)
)
set_temperatures
(
self
.
spectrometer_configs
,
bwtek_dll
=
self
.
bwtek_dll
)
logger
.
debug
(
"
Set temperatures according to EEPROM values
"
)
def
record_spectrum
(
self
:
Self
,
@@ -33,6 +47,7 @@ class SpectrometerServicer(RamanChefServicer):
request
.
duration
,
request
.
laser_power
,
self
.
default_channel
,
bwtek_dll
=
self
.
bwtek_dll
)
response
=
RecordSpectrumResponse
(
spectrometer_config_json
=
json
.
dumps
(
Loading