XPRESS/Sweep/Amplitude.pm

filter: Statementstmt 35.9% 14 / 39 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 36.3% 4 / 11 Podpod 14.2% 1 / 7 totaltotal 28.7% 19 / 66 SCAR 22.4
CC
4
Cov
30%
exit_loop
12.0
new
6.0
go_to_sweep_start
2.0
CRAP 9.4
« Moose/Instrument/DummySource.pm ↑ Summary XPRESS/Sweep/Frequency.pm »
1 package Lab::XPRESS::Sweep::Amplitude;
2 1 $Lab::XPRESS::Sweep::Amplitude::VERSION = '3.881';
3 #ABSTRACT: Amplitude sweep of AC voltage/current
4  
5 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Lab::XPRESS::Sweep;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Time::HiRes qw/usleep/, qw/time/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our @ISA = ('Lab::XPRESS::Sweep');
12  
13 sub new {
14 0 ▶ my $proto = shift;
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
15 0 my @args = @_;
16 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
17 my $self->{default_config} = {
18 0 id => 'Amplitude_Sweep',
19 filename_extension => 'AMP=',
20 interval => 1,
21 points => [],
22 rate => [1],
23 mode => 'step',
24 allowed_instruments => [
25 qw/Lab::Instrument::SR830 Lab::Moose::Instrument::ZI_MFLI Lab::Moose::Instrument::ZI_MFIA/
26 ],
27 allowed_sweep_modes => [ 'list', 'step' ],
28 number_of_points => [undef]
29 };
30  
31 0 $self = $class->SUPER::new( $self->{default_config}, @args );
32 0 bless( $self, $class );
33  
34 0 return $self;
35 }
36  
37 sub go_to_sweep_start {
38 0 ▶ my $self = shift;
Subroutine go_to_sweep_start: not called CC=1 SCAR=6.9
Pod undocumented
39  
40 # go to start:
41 $self->{config}->{instrument}
42 0 ->set_amplitude( { value => @{ $self->{config}->{points} }[0] } );
43 }
44  
45 sub start_continuous_sweep {
46 0 ▶ my $self = shift;
Subroutine start_continuous_sweep: not called CC=1 SCAR=6.9
Pod undocumented
47  
48 0 return;
49  
50 }
51  
52 sub go_to_next_step {
53 0 ▶ my $self = shift;
Subroutine go_to_next_step: not called CC=1 SCAR=6.9
Pod undocumented
54  
55 $self->{config}->{instrument}->set_amplitude(
56 0 { value => @{ $self->{config}->{points} }[ $self->{iterator} ] } );
57  
58 }
59  
60 sub exit_loop {
61 0 ▶ my $self = shift;
Subroutine exit_loop: not called CC=3 SCAR=24.8
Pod undocumented
62  
63 0 ▶ if ( $self->{config}->{mode} =~ /step|list/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"config"}{"mode"} =~ /step|list/u) 0 0 0
64 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (not defined @{$$self{'config'}{'points'};}[$self->{'iterator'} + 1]) { } 0 0 0
65 not
66 0 defined @{ $self->{config}->{points} }[ $self->{iterator} + 1 ] )
67 {
68 0 return 1;
69 }
70 else {
71 0 return 0;
72 }
73 }
74 }
75  
76 sub get_value {
77 0 ▶ my $self = shift;
Subroutine get_value: not called CC=1 SCAR=6.9
Pod documented
78 0 return $self->{config}->{instrument}->get_amplitude();
79 }
80  
81 sub exit {
82 0 ▶ my $self = shift;
Subroutine exit: not called CC=1 SCAR=6.9
Pod undocumented
83 0 $self->{config}->{instrument}->abort();
84 }
85  
86 1 1;
87  
88 __END__
89  
90 =pod
91  
92 =encoding UTF-8
93  
94 =head1 NAME
95  
96 Lab::XPRESS::Sweep::Amplitude - Amplitude sweep of AC voltage/current
97  
98 =head1 VERSION
99  
100 version 3.881
101  
102 =head1 SYNOPSIS
103  
104 use Lab::Measurement
105
106 my $sweep_amplitude = Sweep('Amplitude',
107 {
108 instrument => $lock_in,
109 points => [0,1],
110 stepwidth => [0.1],
111 mode => 'step',
112 backsweep => 0
113 });
114  
115 =head1 CAVEATS/BUGS
116  
117 probably none
118  
119 =head1 SEE ALSO
120  
121 =over 4
122  
123 =item L<Lab::XPRESS::Sweep>
124  
125 =back
126  
127 =head1 COPYRIGHT AND LICENSE
128  
129 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
130  
131 Copyright 2019 Simon Reinhardt
132 2020 Andreas K. Huettel
133  
134  
135 This is free software; you can redistribute it and/or modify it under
136 the same terms as the Perl 5 programming language system itself.
137  
138 =cut
« Moose/Instrument/DummySource.pm ↑ Summary XPRESS/Sweep/Frequency.pm »