File Coverage

blib/lib/Lab/XPRESS/Sweep/Amplitude.pm
Criterion Covered Total %
statement 11 36 30.5
branch 0 4 0.0
condition 0 3 0.0
subroutine 4 11 36.3
pod 1 7 14.2
total 16 61 26.2


line stmt bran cond sub pod time code
1             package Lab::XPRESS::Sweep::Amplitude;
2             $Lab::XPRESS::Sweep::Amplitude::VERSION = '3.880';
3             #ABSTRACT: Amplitude sweep of AC voltage/current
4              
5 1     1   2019 use v5.20;
  1         4  
6              
7 1     1   5 use Lab::XPRESS::Sweep;
  1         2  
  1         26  
8 1     1   4 use Time::HiRes qw/usleep/, qw/time/;
  1         2  
  1         6  
9 1     1   97 use strict;
  1         2  
  1         485  
10              
11             our @ISA = ('Lab::XPRESS::Sweep');
12              
13             sub new {
14 0     0 0   my $proto = shift;
15 0           my @args = @_;
16 0   0       my $class = ref($proto) || $proto;
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     0 0   my $self = shift;
39              
40             # go to start:
41             $self->{config}->{instrument}
42 0           ->set_amplitude( { value => @{ $self->{config}->{points} }[0] } );
  0            
43             }
44              
45             sub start_continuous_sweep {
46 0     0 0   my $self = shift;
47              
48 0           return;
49              
50             }
51              
52             sub go_to_next_step {
53 0     0 0   my $self = shift;
54              
55             $self->{config}->{instrument}->set_amplitude(
56 0           { value => @{ $self->{config}->{points} }[ $self->{iterator} ] } );
  0            
57              
58             }
59              
60             sub exit_loop {
61 0     0 0   my $self = shift;
62              
63 0 0         if ( $self->{config}->{mode} =~ /step|list/ ) {
64 0 0         if (
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     0 1   my $self = shift;
78 0           return $self->{config}->{instrument}->get_amplitude();
79             }
80              
81             sub exit {
82 0     0 0   my $self = shift;
83 0           $self->{config}->{instrument}->abort();
84             }
85              
86             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.880
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