Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added oceanfx support for pyseabreeze over ipv4 #260

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)