File Coverage

blib/lib/Lab/XPRESS/Sweep/PulseLength.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::PulseLength;
2             #ABSTRACT: Pulse length sweep
3             $Lab::XPRESS::Sweep::PulseLength::VERSION = '3.880';
4 1     1   1684 use v5.20;
  1         5  
5              
6 1     1   9 use Lab::XPRESS::Sweep;
  1         3  
  1         26  
7 1     1   6 use Time::HiRes qw/usleep/, qw/time/;
  1         2  
  1         6  
8 1     1   96 use strict;
  1         3  
  1         493  
9              
10             our @ISA = ('Lab::XPRESS::Sweep');
11              
12             sub new {
13 0     0 0   my $proto = shift;
14 0           my @args = @_;
15 0   0       my $class = ref($proto) || $proto;
16             my $self->{default_config} = {
17 0           id => 'PulseLength_Sweep',
18             filename_extension => 'PulseLength=',
19             interval => 1,
20             points => [],
21             rate => [1],
22             mode => 'step',
23             allowed_instruments => ['Lab::Instrument::RSSMB100A'],
24             allowed_sweep_modes => [ 'list', 'step' ],
25             number_of_points => [undef]
26             };
27              
28 0           $self = $class->SUPER::new( $self->{default_config}, @args );
29 0           bless( $self, $class );
30              
31 0           return $self;
32             }
33              
34             sub go_to_sweep_start {
35 0     0 0   my $self = shift;
36              
37             # go to start:
38             $self->{config}->{instrument}
39 0           ->set_pulselength( { value => @{ $self->{config}->{points} }[0] } );
  0            
40             }
41              
42             sub start_continuous_sweep {
43 0     0 0   my $self = shift;
44              
45 0           return;
46              
47             }
48              
49             sub go_to_next_step {
50 0     0 0   my $self = shift;
51              
52             $self->{config}->{instrument}->set_pulselength(
53 0           { value => @{ $self->{config}->{points} }[ $self->{iterator} ] } );
  0            
54              
55             }
56              
57             sub exit_loop {
58 0     0 0   my $self = shift;
59              
60 0 0         if ( $self->{config}->{mode} =~ /step|list/ ) {
61 0 0         if (
62             not
63 0           defined @{ $self->{config}->{points} }[ $self->{iterator} + 1 ] )
64             {
65 0           return 1;
66             }
67             else {
68 0           return 0;
69             }
70             }
71             }
72              
73             sub get_value {
74 0     0 1   my $self = shift;
75 0           return $self->{config}->{instrument}->get_pulselength();
76             }
77              
78             sub exit {
79 0     0 0   my $self = shift;
80 0           $self->{config}->{instrument}->abort();
81             }
82              
83             1;
84              
85             __END__
86              
87             =pod
88              
89             =encoding UTF-8
90              
91             =head1 NAME
92              
93             Lab::XPRESS::Sweep::PulseLength - Pulse length sweep
94              
95             =head1 VERSION
96              
97             version 3.880
98              
99             =head1 SYNOPSIS
100              
101             use Lab::XPRESS::hub;
102             my $hub = new Lab::XPRESS::hub();
103            
104            
105             my $Osc = $hub->Instrument('SignalRecovery726x',
106             {
107             connection_type => 'VISA_GPIB',
108             gpib_address => 2
109             });
110            
111             my $sweep_voltage = $hub->Sweep('Frequency',
112             {
113             instrument => $Osc,
114             points => [100,1e5],
115             stepwidth => [1e5,100],
116             mode => 'step',
117             backsweep => 0
118             });
119              
120             .
121              
122             =head1 DESCRIPTION
123              
124             Parent: Lab::XPRESS::Sweep
125              
126             The Lab::XPRESS::Sweep::Frequency class implements a module for frequncy sweeps in the Lab::XPRESS::Sweep framework.
127              
128             .
129              
130             =head1 CONSTRUCTOR
131              
132             my $sweep_voltage = $hub->Sweep('Frequency',
133             {
134             instrument => $Osc,
135             points => [100,1e5],
136             stepwidth => [1e5,100],
137             mode => 'step',
138             backsweep => 0
139             });
140              
141             Instantiates a new frequency-sweep.
142              
143             .
144              
145             =head1 PARAMETERS
146              
147             =head2 instrument [Lab::Instrument] (mandatory)
148              
149             Instrument, conducting the sweep. Must be of type Lab:Instrument.
150             Allowed instruments: Lab::Instrument::SignalRecovery726x
151              
152             .
153              
154             =head2 mode [string] (default = 'step' | 'list')
155              
156             step: measurements will be performed at discrete values of the frequency between start and end points defined in parameter points, seperated by steps defined in parameter stepwidth
157              
158             list: measurements will be performed at a list frequencies defined in parameter points
159              
160             .
161              
162             =head2 points [float array] (mandatory)
163              
164             array of values (in Hz) that defines the characteristic points of the sweep.
165             First value is appraoched before measurement begins.
166              
167             Case mode => 'step' :
168             Same as in 'continuous' but frequency will be swept in stop and go mode.
169              
170             Case mode => 'list' :
171             Array of values, with minimum length 1, that are approached in sequence to perform a measurment.
172              
173             .
174              
175             =head2 stepwidth [float array]
176              
177             This parameter is relevant only if mode = 'step' has been selected.
178             Stepwidth has to be an array of length '1' or greater. The values define the width for each step within the corresponding sweep sequence.
179             If the length of the defined sweep sequence devided by the stepwidth is not an integer number, the last step will be smaller in order to reach the defined points-value.
180              
181             points = [100, 3000, 300]
182             stepwidth = [500, 1000]
183            
184             ==> steps: 100, 600, 1100, 1600, 2100, 2600, 3000, 2000, 1000, 300
185              
186             .
187              
188             =head2 number_of_points [int array]
189              
190             can be used instead of 'stepwidth'. Attention: Use only the 'number_of_points' or the 'stepwidth' parameter. Using both will cause an Error!
191             This parameter is relevant only if mode = 'step' has been selected.
192             Number_of_points has to be an array of length '1' or greater. The values defines the number of steps within the corresponding sweep sequence.
193              
194             points = [100, 3000, 300]
195             number_of_points = [10, 2]
196            
197             ==> steps: 100, 390, 680, 970, 1260, 1550, 1840, 2130, 2420, 2710, 3000, 1650, 300
198              
199             .
200              
201             =head2 backsweep [int] (default = 0 | 1 | 2)
202              
203             0 : no backsweep (default)
204             1 : a backsweep will be performed
205             2 : no backsweep performed automatically, but sweep sequence will be reverted every second time the sweep is started (relevant eg. if sweep operates as a slave. This way the sweep sequence is reverted at every second step of the master)
206              
207             .
208              
209             =head2 id [string] (default = 'Frequency_Sweep')
210              
211             Just an ID.
212              
213             .
214              
215             =head2 filename_extention [string] (default = 'FRQ=')
216              
217             Defines a postfix, that will be appended to the filenames if necessary.
218              
219             .
220              
221             =head2 delay_before_loop [int] (default = 0)
222              
223             defines the time in seconds to wait after the starting point has been reached.
224              
225             .
226              
227             =head2 delay_in_loop [int] (default = 0)
228              
229             This parameter is relevant only if mode = 'step' or 'list' has been selected.
230             Defines the time in seconds to wait after the value for the next step has been reached.
231              
232             .
233              
234             =head2 delay_after_loop [int] (default = 0)
235              
236             Defines the time in seconds to wait after the sweep has been finished. This delay will be executed before an optional backsweep or optional repetitions of the sweep.
237              
238             .
239              
240             =head1 CAVEATS/BUGS
241              
242             probably none
243              
244             .
245              
246             =head1 SEE ALSO
247              
248             =over 4
249              
250             =item L<Lab::XPRESS::Sweep>
251              
252             =back
253              
254             .
255              
256             =head1 COPYRIGHT AND LICENSE
257              
258             This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
259              
260             Copyright 2013 Alois Dirnaichner, Andreas K. Huettel, Christian Butschkow, Stefan Geissler
261             2014 Andreas K. Huettel
262             2016 Simon Reinhardt
263             2017 Andreas K. Huettel
264             2020 Andreas K. Huettel
265              
266              
267             This is free software; you can redistribute it and/or modify it under
268             the same terms as the Perl 5 programming language system itself.
269              
270             =cut