File Coverage

blib/lib/Lab/Moose/Instrument/RS_ZVA.pm
Criterion Covered Total %
statement 46 52 88.4
branch 1 2 50.0
condition n/a
subroutine 13 15 86.6
pod 0 7 0.0
total 60 76 78.9


line stmt bran cond sub pod time code
1             package Lab::Moose::Instrument::RS_ZVA;
2             $Lab::Moose::Instrument::RS_ZVA::VERSION = '3.881';
3             #ABSTRACT: Rohde & Schwarz ZVA Vector Network Analyzer
4              
5 2     2   1148 use v5.20;
  2         7  
6              
7 2     2   12 use Moose;
  2         4  
  2         14  
8 2     2   13328 use Moose::Util::TypeConstraints;
  2         7  
  2         23  
9 2     2   4476 use MooseX::Params::Validate;
  2         5  
  2         18  
10             use Lab::Moose::Instrument
11 2     2   953 qw/validated_getter validated_setter validated_channel_getter validated_channel_setter /;
  2         5  
  2         140  
12 2     2   992 use Lab::Moose::Instrument::Cache;
  2         6  
  2         9  
13 2     2   1134 use Carp;
  2         9  
  2         104  
14 2     2   16 use namespace::autoclean;
  2         4  
  2         7  
15              
16             extends 'Lab::Moose::Instrument';
17              
18             with qw(
19             Lab::Moose::Instrument::VNASweep
20              
21             Lab::Moose::Instrument::SCPI::Output::State
22             );
23              
24             sub BUILD {
25 1     1 0 3 my $self = shift;
26 1         6 $self->clear();
27 1         7 $self->cls();
28             }
29              
30             cache calculate_data_call_catalog => (
31             getter => 'calculate_data_call_catalog',
32             isa => 'ArrayRef'
33             );
34              
35             sub calculate_data_call_catalog {
36 1     1 0 13 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
37              
38 1         11 my $string
39             = $self->query( command => "CALC${channel}:DATA:CALL:CAT?", %args );
40 1         20 $string =~ s/'//g;
41              
42 1         21 return $self->cached_calculate_data_call_catalog(
43             [ split ',', $string ] );
44             }
45              
46             sub calculate_data_call {
47 3     3 0 16 my ( $self, $channel, %args ) = validated_channel_getter(
48             \@_,
49             format => { isa => 'Str' } # {isa => enum([qw/FDATA SDATA MDATA/])}
50             );
51              
52 3         12 my $format = delete $args{format};
53              
54 3         25 return $self->binary_query(
55             command => "CALC${channel}:DATA:CALL? $format",
56             %args
57             );
58              
59             }
60              
61             sub sparam_catalog {
62 4     4 0 100213 my $self = shift;
63              
64 4         139 my $catalog = $self->cached_calculate_data_call_catalog();
65 4         14 my @complex_catalog;
66              
67 4         9 for my $sparam ( @{$catalog} ) {
  4         16  
68 4         23 push @complex_catalog, "Re($sparam)", "Im($sparam)";
69             }
70              
71 4         21 return \@complex_catalog;
72             }
73              
74             sub sparam_sweep_data {
75 3     3 0 14 my ( $self, %args ) = validated_getter( \@_ );
76              
77 3         2055 my $byte_order = $self->cached_format_border();
78 3 50       17 if ( $byte_order ne 'SWAP' ) {
79 0         0 carp 'setting network byteorder to little endian.';
80 0         0 $self->format_border( value => 'SWAP' );
81             }
82              
83             # Start single sweep.
84 3         17 $self->initiate_immediate();
85              
86             # Wait until single sweep is finished.
87 3         33 $self->wai();
88              
89 3         20 return $self->calculate_data_call( format => 'SDATA', %args );
90             }
91              
92              
93              
94             sub set_power {
95 0     0 0   my ( $self, $value, %args ) = validated_setter( \@_ );
96 0           $self->source_power_level_immediate_amplitude( value => $value );
97             }
98              
99             sub get_power {
100 0     0 0   my $self = shift;
101 0           return $self->source_power_level_immediate_amplitude_query();
102             }
103              
104              
105              
106              
107             __PACKAGE__->meta->make_immutable();
108              
109             1;
110              
111             __END__
112              
113             =pod
114              
115             =encoding UTF-8
116              
117             =head1 NAME
118              
119             Lab::Moose::Instrument::RS_ZVA - Rohde & Schwarz ZVA Vector Network Analyzer
120              
121             =head1 VERSION
122              
123             version 3.881
124              
125             =head1 SYNOPSIS
126              
127             my $data = $zva->sparam_sweep(timeout => 10);
128              
129             =head1 METHODS
130              
131             See L<Lab::Moose::Instrument::VNASweep> for the high-level C<sparam_sweep> and
132             C<sparam_catalog> methods.
133              
134             =head1 COPYRIGHT AND LICENSE
135              
136             This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
137              
138             Copyright 2016 Simon Reinhardt
139             2017 Andreas K. Huettel, Simon Reinhardt
140             2020 Andreas K. Huettel, Simon Reinhardt
141             2023 Andreas K. Huettel
142              
143              
144             This is free software; you can redistribute it and/or modify it under
145             the same terms as the Perl 5 programming language system itself.
146              
147             =cut