Lab::Moose::Instrument::SpectrumAnalyzer - Role of Generic Spectrum Analyzer for Lab::Moose::Instrument
version 3.660
Basic commands to make functional basic spectrum analyzer
Lab::Moose::Instrument::SpectrumAnalyzer - Role of Generic Spectrum Analyzer
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.
[:SENSe]:SWEep:POINts?
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.
[:SENSe]:SWEep:POINts
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.
has_hardwired_number_of_X_points
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 for the sweep operation. If this is not given, use the connection's default timeout.
number of the trace (1..3). Defaults to 1.
Returns start and stop frequency
$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.
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.
validate_trace_papam
floating point type. Has to be 'single' or 'double'. Defaults to 'single'.
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 );
This software is copyright (c) 2018 by the Lab::Measurement team; in detail:
Copyright 2018 Eugeniy E. Mikhailov
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Lab::Measurement, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lab::Measurement
CPAN shell
perl -MCPAN -e shell install Lab::Measurement
For more information on module installation, please visit the detailed CPAN module installation guide.