ngscopeclient v0.2.1
Loading...
Searching...
No Matches
AseqSpectrometer.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
37#ifndef AseqSpectrometer_h
38#define AseqSpectrometer_h
39
40class EdgeTrigger;
41
42#include "RemoteBridgeOscilloscope.h"
43
50{
51public:
52
62 Oscilloscope* scope,
63 const std::string& hwname,
64 const std::string& color,
65 size_t index)
66 : OscilloscopeChannel(scope, hwname, color, Unit(Unit::UNIT_PM), index)
67 {
69
70 AddStream(Unit::UNIT_COUNTS, "RawCounts", Stream::STREAM_TYPE_ANALOG);
71 AddStream(Unit::UNIT_COUNTS, "FlattenedCounts", Stream::STREAM_TYPE_ANALOG);
72 AddStream(Unit::UNIT_W_M2_NM, "AbsoluteIrradiance", Stream::STREAM_TYPE_ANALOG);
73 }
74
87};
88
94class AseqSpectrometer : public virtual SCPISpectrometer
95{
96public:
98 virtual ~AseqSpectrometer();
99
100 //not copyable or assignable
101 AseqSpectrometer(const AseqSpectrometer& rhs) =delete;
102 AseqSpectrometer& operator=(const AseqSpectrometer& rhs) =delete;
103
104public:
105
106 virtual unsigned int GetInstrumentTypes() const override;
107 uint32_t GetInstrumentTypesForChannel(size_t i) const override;
108
109 virtual void FlushConfigCache() override;
110
111 //Triggering
112 virtual Oscilloscope::TriggerMode PollTrigger() override;
113 virtual bool AcquireData() override;
114 virtual bool IsTriggerArmed() override;
115 virtual void PushTrigger() override;
116 virtual void PullTrigger() override;
117
118 virtual void Start() override;
119 virtual void StartSingleTrigger() override;
120 virtual void Stop() override;
121 virtual void ForceTrigger() override;
122 virtual OscilloscopeChannel* GetExternalTrigger() override;
123 virtual uint64_t GetSampleRate() override;
124 virtual uint64_t GetSampleDepth() override;
125 virtual void SetSampleDepth(uint64_t depth) override;
126 virtual void SetSampleRate(uint64_t rate) override;
127 virtual std::vector<uint64_t> GetSampleDepthsNonInterleaved() override;
128
129 virtual int64_t GetIntegrationTime() override;
130 virtual void SetIntegrationTime(int64_t t) override;
131
132protected:
133
135 std::vector<float> m_wavelengths;
136
138 std::vector<float> m_flatcal;
139
141 std::vector<float> m_irrcal;
142
145
155
158
161
162public:
163
164 //This is intentionally not virtual since it's a static method used by enumeration
165 //cppcheck-suppress duplInheritedMember
166 static std::vector<SCPIInstrumentModel> GetDriverSupportedModels()
167 {
168 return
169 {
170 {"lr1", {{ SCPITransportType::TRANSPORT_TWINLAN, "localhost:5025:5026" }}}
171 };
172 }
173
174 static std::string GetDriverNameInternal();
175 SPECTROMETER_INITPROC(AseqSpectrometer)
176};
177
178#endif
Helper class for creating output streams.
Definition AseqSpectrometer.h:50
StreamIndex
Indexes of output streams.
Definition AseqSpectrometer.h:77
@ STREAM_RAW_COUNTS
Raw counts without any corrections applied.
Definition AseqSpectrometer.h:79
@ STREAM_FLATTENED_COUNTS
Flattened counts after dark frame subtraction and sensor response correction.
Definition AseqSpectrometer.h:82
@ STREAM_ABSOLUTE_IRRADIANCE
Absolute irradiance (if the spectrometer is calibrated with absolute data)
Definition AseqSpectrometer.h:85
AseqSpectrometerChannel(Oscilloscope *scope, const std::string &hwname, const std::string &color, size_t index)
Initialize the channel.
Definition AseqSpectrometer.h:61
Driver for Aseq Instruments LR1/HR1 spectrometers via the scopehal-aseq-bridge server.
Definition AseqSpectrometer.h:95
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition AseqSpectrometer.cpp:254
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition AseqSpectrometer.cpp:173
uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition AseqSpectrometer.cpp:147
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition AseqSpectrometer.cpp:142
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition AseqSpectrometer.cpp:196
virtual void Stop() override
Stops triggering.
Definition AseqSpectrometer.cpp:214
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition AseqSpectrometer.cpp:166
float m_irrcoeff
Global scaling factor for irradiance calibration.
Definition AseqSpectrometer.h:144
std::vector< float > m_irrcal
Irradiance calibration (if available) for each spectral bin.
Definition AseqSpectrometer.h:141
virtual void FlushConfigCache() override
Instruments are allowed to cache configuration settings to reduce round trip queries to the device.
Definition AseqSpectrometer.cpp:236
SpectrometerDarkFrameChannel * m_darkframe
Dark frame input.
Definition AseqSpectrometer.h:157
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition AseqSpectrometer.cpp:222
virtual bool AcquireData() override
Pull data from the instrument.
Definition AseqSpectrometer.cpp:263
virtual void PushTrigger() override
Pushes changes made to m_trigger to the instrument.
Definition AseqSpectrometer.cpp:241
virtual void PullTrigger() override
Updates m_trigger with any changes made from the instrument side.
Definition AseqSpectrometer.cpp:245
int64_t m_integrationTime
Integration time, in femtoseconds.
Definition AseqSpectrometer.h:160
channelids
Channel indexes.
Definition AseqSpectrometer.h:148
@ CHAN_DARKFRAME
Dark frame correction input.
Definition AseqSpectrometer.h:153
@ CHAN_SPECTRUM
Spectral output.
Definition AseqSpectrometer.h:150
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition AseqSpectrometer.cpp:178
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition AseqSpectrometer.cpp:205
std::vector< float > m_flatcal
Flatness calibration coefficient for each spectral bin.
Definition AseqSpectrometer.h:138
virtual uint64_t GetSampleDepth() override
Gets the current sample depth of this scope.
Definition AseqSpectrometer.cpp:183
std::vector< float > m_wavelengths
Wavelength (in picometers) at each spectral bin.
Definition AseqSpectrometer.h:135
virtual bool IsTriggerArmed() override
Checks if the trigger is currently armed.
Definition AseqSpectrometer.cpp:249
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition AseqSpectrometer.cpp:192
virtual void SetSampleDepth(uint64_t depth) override
Sets the sample depth of the scope.
Definition AseqSpectrometer.cpp:188
Simple edge trigger.
Definition EdgeTrigger.h:44
virtual size_t AddStream(Unit yunit, const std::string &name, Stream::StreamType stype, uint8_t flags=0)
Adds a new data stream to the channel.
Definition InstrumentChannel.cpp:125
virtual void ClearStreams()
Clears out any existing streams.
Definition InstrumentChannel.cpp:113
A single channel on an oscilloscope.
Definition OscilloscopeChannel.h:49
Generic representation of an oscilloscope, logic analyzer, or spectrum analyzer.
Definition Oscilloscope.h:51
TriggerMode
Definition Oscilloscope.h:398
Generic representation of an optical (UV-VIS-IR) spectrometer.
Definition SCPISpectrometer.h:43
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition SCPITransport.h:53
A dark frame input for a spectrometer.
Definition SpectrometerDarkFrameChannel.h:39
A unit of measurement, plus conversion to pretty-printed output.
Definition Unit.h:59