Skip to content

Commit

Permalink
Merge pull request #271 from spacetelescope/270-thorlabs-tsp01-servic…
Browse files Browse the repository at this point in the history
…e-main-expects-2-external-temp-sensors

makes thorlabs_tsp01 temperature sensor heads optional per configuration
  • Loading branch information
lanemeier7 authored Dec 11, 2024
2 parents 825ce48 + 928c292 commit 8733f46
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions catkit2/services/thorlabs_tsp01/thorlabs_tsp01.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ def __init__(self):
self.serial_number = self.config['serial_number']
self.num_averaging = self.config.get('averaging', 1)
self.interval = self.config.get('interval', 10)
self.read_out_header_1 = self.config.get('read_out_header_1', True)
self.read_out_header_2 = self.config.get('read_out_header_2', True)

self.temperature_internal = self.make_data_stream('temperature_internal', 'float64', [1], 20)
self.temperature_header_1 = self.make_data_stream('temperature_header_1', 'float64', [1], 20)
self.temperature_header_2 = self.make_data_stream('temperature_header_2', 'float64', [1], 20)

if self.read_out_header_1:
self.temperature_header_1 = self.make_data_stream('temperature_header_1', 'float64', [1], 20)

if self.read_out_header_2:
self.temperature_header_2 = self.make_data_stream('temperature_header_2', 'float64', [1], 20)

self.humidity_internal = self.make_data_stream('humidity_internal', 'float64', [1], 20)

def main(self):
Expand All @@ -28,11 +35,13 @@ def main(self):
temperature = self.get_temperature(1)
self.temperature_internal.submit_data(np.array([temperature]))

temperature = self.get_temperature(2)
self.temperature_header_1.submit_data(np.array([temperature]))
if self.read_out_header_1:
temperature = self.get_temperature(2)
self.temperature_header_1.submit_data(np.array([temperature]))

temperature = self.get_temperature(3)
self.temperature_header_2.submit_data(np.array([temperature]))
if self.read_out_header_2:
temperature = self.get_temperature(3)
self.temperature_header_2.submit_data(np.array([temperature]))

humidity = self.get_humidity()
self.humidity_internal.submit_data(np.array([humidity]))
Expand Down

0 comments on commit 8733f46

Please sign in to comment.