NAME
Lab::Moose::Instrument::SpectrumAnalyzer - Role of Generic Spectrum Analyzer for Lab::Moose::Instrument
VERSION
version 3.881
DESCRIPTION
Basic commands to make functional basic spectrum analyzer
NAME
Lab::Moose::Instrument::SpectrumAnalyzer - Role of Generic Spectrum Analyzer
Hardware capabilities and presets attributes
Not all devices implemented full set of SCPI commands. With following we can mark what is available
capable_to_query_number_of_X_points_in_hardware
Can hardware report the number of points in a sweep. I.e. can it respont to analog of [:SENSe]:SWEep:POINts?
command.
Default is 1, i.e true.
capable_to_set_number_of_X_points_in_hardware
Can hardware set the number of points in a sweep. I.e. can it respont to analog of [:SENSe]:SWEep:POINts
command.
Default is 1, i.e true.
hardwired_number_of_X_points
Some hardware has fixed/unchangeable number of points in the sweep. So we can set it here to simplify the logic of some commands.
This is not set by default. Use has_hardwired_number_of_X_points
to check for its availability.
METHODS
Driver assuming this role must implements the following high-level method:
get_traceXY
$data = $sa->traceXY(timeout => 10, trace => 2);
Perform a single sweep and return the resulting spectrum as a 2D PDL:
[
[freq1, freq2, freq3, ..., freqN],
[power1, power2, power3, ..., powerN],
]
I.e. the first dimension runs over the sweep points.
This method accepts a hash with the following options:
- timeout
-
timeout for the sweep operation. If this is not given, use the connection's default timeout.
- trace
-
number of the trace (1..3). Defaults to 1.
get_StartX and get_StopX
Returns start and stop frequency
get_traceY
$data = $inst->get_traceY(timeout => 1, trace => 2, precision => 'single');
Return Y points of a given trace in a 1D PDL:
This implementation is SCPI friendly.
- timeout
-
timeout for the sweep operation. If this is not given, use the connection's default timeout.
- trace
-
number of the trace 1, 2, 3 and so on. Defaults to 1. It is hardware depended and validated by
validate_trace_papam
, which need to be implemented by a specific instrument driver. - precision
-
floating point type. Has to be 'single' or 'double'. Defaults to 'single'.
Required hardware dependent methods
validate_trace_param
Validates or applies hardware friendly aliases to trace parameter. Need to be implemented by the instrument driver. For example
sub validate_trace_param {
my ( $self, $trace ) = @_;
if ( $trace < 1 || $trace > 3 ) {
confess "trace has to be in (1..3)";
}
return $trace;
}
Use like this
$trace = $self->validate_trace_param( $trace );
COPYRIGHT AND LICENSE
This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
Copyright 2018 Eugeniy E. Mikhailov
2020 Andreas K. Huettel
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.