Skip to content

Commit

Permalink
Merge pull request #260 from denis97/oceanfx
Browse files Browse the repository at this point in the history
Added oceanfx support for pyseabreeze over ipv4
  • Loading branch information
ap-- authored Sep 5, 2024
2 parents 9647720 + c393d58 commit e681d0e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/seabreeze/pyseabreeze/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,3 +1362,31 @@ class ST(SeaBreezeDevice):
sbf.rawusb.SeaBreezeRawUSBBusAccessFeature,
sbf.nonlinearity.NonlinearityCoefficientsFeatureOBP2,
)


class FX(SeaBreezeDevice):

model_name = "FX"

# communication config
transport = (IPv4Transport,)

ipv4_protocol = OBPProtocol

# spectrometer config
dark_pixel_indices = DarkPixelIndices.from_ranges()
integration_time_min = 6000
integration_time_max = 10000000
integration_time_base = 1
spectrum_num_pixel = 2136
spectrum_raw_length = (2136 * 2) + 64 # XXX: Metadata
spectrum_max_value = 65535
trigger_modes = TriggerMode.supported(
"OBP_NORMAL", "OBP_LEVEL", "OBP_EDGE", "DISABLED"
)

# features
feature_classes = (
sbf.spectrometer.SeaBreezeSpectrometerFeatureFX, # need to implement this
sbf.rawusb.SeaBreezeRawUSBBusAccessFeature,
)
12 changes: 12 additions & 0 deletions src/seabreeze/pyseabreeze/features/spectrometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,3 +742,15 @@ def get_wavelengths(self) -> NDArray[np.float_]:

class SeaBreezeSpectrometerFeatureHR4(SeaBreezeSpectrometerFeatureOBP2):
pass


class SeaBreezeSpectrometerFeatureFX(SeaBreezeSpectrometerFeatureOBP):
def _get_spectrum_raw(self) -> NDArray[np.uint8]:
timeout = int(
self._integration_time_max * 1e-3
+ self.protocol.transport.default_timeout_ms
)
# the message type is different than the default defined in the protocol,
# requires addition of a new message type in protocol to work
datastring = self.protocol.query(0x00101000, timeout_ms=timeout)
return numpy.frombuffer(datastring, dtype=numpy.uint8)

0 comments on commit e681d0e

Please sign in to comment.