ngscopeclient 0.1-dev+51fbda87c
AseqSpectrometer.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2024 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
77 {
80
83
86 };
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
136
139
141 std::vector<float> m_wavelengths;
142
144 std::vector<float> m_flatcal;
145
147 std::vector<float> m_irrcal;
148
151
154 {
157
160 };
161
164
167
168public:
169 static std::string GetDriverNameInternal();
170 SPECTROMETER_INITPROC(AseqSpectrometer)
171};
172
173#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
bool m_triggerArmed
Indicates trigger is armed.
Definition: AseqSpectrometer.h:135
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition: AseqSpectrometer.cpp:256
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition: AseqSpectrometer.cpp:175
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:149
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition: AseqSpectrometer.cpp:144
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition: AseqSpectrometer.cpp:198
virtual void Stop() override
Stops triggering.
Definition: AseqSpectrometer.cpp:216
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition: AseqSpectrometer.cpp:168
float m_irrcoeff
Global scaling factor for irradiance calibration.
Definition: AseqSpectrometer.h:150
std::vector< float > m_irrcal
Irradiance calibration (if available) for each spectral bin.
Definition: AseqSpectrometer.h:147
virtual void FlushConfigCache() override
Instruments are allowed to cache configuration settings to reduce round trip queries to the device.
Definition: AseqSpectrometer.cpp:238
SpectrometerDarkFrameChannel * m_darkframe
Dark frame input.
Definition: AseqSpectrometer.h:163
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition: AseqSpectrometer.cpp:224
virtual bool AcquireData() override
Pull data from the instrument.
Definition: AseqSpectrometer.cpp:265
virtual void PushTrigger() override
Pushes changes made to m_trigger to the instrument.
Definition: AseqSpectrometer.cpp:243
virtual void PullTrigger() override
Updates m_trigger with any changes made from the instrument side.
Definition: AseqSpectrometer.cpp:247
int64_t m_integrationTime
Integration time, in femtoseconds.
Definition: AseqSpectrometer.h:166
channelids
Channel indexes.
Definition: AseqSpectrometer.h:154
@ CHAN_DARKFRAME
Dark frame correction input.
Definition: AseqSpectrometer.h:159
@ CHAN_SPECTRUM
Spectral output.
Definition: AseqSpectrometer.h:156
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition: AseqSpectrometer.cpp:180
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition: AseqSpectrometer.cpp:207
std::vector< float > m_flatcal
Flatness calibration coefficient for each spectral bin.
Definition: AseqSpectrometer.h:144
virtual uint64_t GetSampleDepth() override
Gets the current sample depth of this scope.
Definition: AseqSpectrometer.cpp:185
AseqSpectrometer(SCPITransport *transport)
Initialize the driver.
Definition: AseqSpectrometer.cpp:56
std::vector< float > m_wavelengths
Wavelength (in picometers) at each spectral bin.
Definition: AseqSpectrometer.h:141
virtual bool IsTriggerArmed() override
Checks if the trigger is currently armed.
Definition: AseqSpectrometer.cpp:251
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition: AseqSpectrometer.cpp:194
virtual void SetSampleDepth(uint64_t depth) override
Sets the sample depth of the scope.
Definition: AseqSpectrometer.cpp:190
bool m_triggerOneShot
Indicates most recent trigger arm was a one-shot rather than continuous trigger.
Definition: AseqSpectrometer.h:138
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:50
TriggerMode
Definition: Oscilloscope.h:411
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:47
A dark frame input for a spectrometer.
Definition: SpectrometerDarkFrameChannel.h:39
A unit of measurement, plus conversion to pretty-printed output.
Definition: Unit.h:57