Moose/Instrument/Rigol_DG5000.pm

filter: Statementstmt 17.4% 39 / 224 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 15.4% 11 / 71 Podpod 91.5% 54 / 59 totaltotal 27.2% 104 / 382 CC 13 SCAR 17.2
CC
13
Cov
16%
gen_arb_step
42.0
play_coefficient
12.0
set_pulsewidth
6.0
CRAP 5.6
« Moose/Sweep/Continuous/Magnet.pm ↑ Summary Moose/Instrument/Cache.pm »
1 package Lab::Moose::Instrument::Rigol_DG5000;
2 1 $Lab::Moose::Instrument::Rigol_DG5000::VERSION = '3.931';
3 #ABSTRACT: Rigol DG5000 series Function/Arbitrary Waveform Generator
4  
5 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Moose::Util::TypeConstraints qw/enum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use List::Util qw/sum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use List::MoreUtils qw/minmax/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Math::Round;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 use Lab::Moose::Instrument
14 1 ▶ qw/validated_channel_getter validated_channel_setter validated_getter validated_setter/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Lab::Moose::Instrument::Cache;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 extends 'Lab::Moose::Instrument';
20  
21 1 has instrument_nselect => (
22 is => 'ro',
23 isa => 'Int',
24 default => 1
25 );
26  
27 0 ▶around default_connection_options => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
28 0 my $orig = shift;
29 0 my $self = shift;
30 0 my $options = $self->$orig();
31 0 my $usb_opts = { vid => 0x1ab1, pid => 0x0640 };
32 0 $options->{USB} = $usb_opts;
33 0 $options->{'VISA::USB'} = $usb_opts;
34 0 return $options;
35 1 };
36  
37 0 ▶sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
38 0 my $self = shift;
39 0 $self->clear();
40 0 $self->cls();
41 }
42  
43 0 ▶sub get_default_channel {
Subroutine get_default_channel: not called CC=1 SCAR=6.9
Pod undocumented
44 0 my $self = shift;
45 0 return $self->instrument_nselect;
46 }
47  
48  
49 #
50 # MY FUNCTIONS
51 #
52  
53  
54 0 ▶sub gen_arb_step {
Subroutine gen_arb_step: not called CC=6 SCAR=37.4
Pod documented
55 0 my ( $self, $channel, %args ) = validated_channel_getter(
56 \@_,
57 sequence => { isa => 'ArrayRef' },
58 bdelay => { isa => 'Num', default => 0 },
59 bcycles => { isa => 'Num', default => 1 }
60 );
61 my ( $sequence, $bdelay, $bcycles )
62 0 = delete @args{qw/sequence bdelay bcycles/};
63 0 my @data = @$sequence; # Dereference the input data
64  
65 # If number of input data points is uneven croak
66 0 ▶ if ( @data % 2 != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@data % 2 != 0) 0 0 0
67 0 croak "Please enter an even number of arguments with
68 the layout <amplitude1[V]>,<length1[s]>,<amplitude2[V]>,<length2[s]>,...";
69 }
70  
71 # Split input data into the time lengths and amplitude values...
72 0 my @times = @data[ grep { $_ % 2 == 1 } 0 .. @data - 1 ];
73 0 my @amps = @data[ grep { $_ % 2 == 0 } 0 .. @data - 1 ];
74  
75 # ...and compute the period lentgth as well as the min and max amplitude
76 0 my $period = sum @times;
77 0 my ( $minamp, $maxamp ) = minmax @amps;
78  
79 # now apply everything to the Rigol: Frequency = 1/T, amplitude and offset
80 # are computed, so that the whole waveform lies within that amplitude range
81 0 $self->source_apply_arb(
82 channel => $channel, freq => 1 / $period,
83 amp => 2 * abs($maxamp) + 2 * abs($minamp),
84 offset => $maxamp + $minamp, phase => 0.0
85 );
86 0 $self->arb_mode( channel => $channel, value => 'INTernal' );
87 0 $self->trace_data_points_interpolate( value => 'OFF' );
88  
89 # Convert all amplitudes into values from 0 to 16383 (14Bit) and generate
90 # 16384 data points in total
91 0 my $input = "";
92 0 my $counter;
93  
94 # go through each amp (or time) value
95 0 foreach ( 0 .. @amps - 1 ) {
96  
97 # Compute what length in units of the resolution (16384) each step has
98 0 my $c = round( 16383 * $times[$_] / $period );
99 0 $counter += $c; # Count them all up
100 # On the last iteration check, if there are really 16384 data points,
101 # there might be less because of rounding. Add the remaining at the end if
102 # necessary
103 0 ▶ if ( $_ == @amps - 1 && $counter != 16384 ) { $c += 16384 - $counter }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ == @amps - 1 and $counter != 16384) 0 0 0
Condition0%0/3
$_ == @amps - 1 and $counter != 16384
!ll&&!rl&&r
000
MC/DC0%0/2
$_ == @amps - 1 and $counter != 16384
$_ == @amps - 1 $counter != 16384
Truth table0%0/3
A and B
A= $_ == @amps - 1B= $counter != 16384
ABresult
0X0
100
111
104  
105 # Lastly append the according amplitude value (in 14Bit resolution) to the
106 # whole string
107 0 $input = $input
108 . (
109 ","
110 . round(
111 16383 * $amps[$_] / ( 1.5 * $maxamp - 0.5 * $minamp )
112 )
113 ) x $c;
114 }
115  
116 # Finally download everything to the volatile memory
117 0 $self->trace_data_points( value => 16384 );
118 0 $self->trace_data_dac( value => $input );
119  
120 # WIP: If a burst delay and number of cycles is given, enable burst mode
121 0 my $off = 0;
122 0 ▶ if ( $bdelay > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bdelay > 0) 0 0 0
123 0 $self->source_burst_mode( channel => $channel, value => 'TRIG' );
124 0 $self->source_burst_tdelay( channel => $channel, value => $bdelay );
125 0 $self->source_burst_ncycles( channel => $channel, value => $bcycles );
126 0 $self->source_burst_state( channel => $channel, value => 'ON' );
127  
128 0 $self->trace_data_value( point => 0, data => 0 );
129 0 $self->trace_data_value( point => 16383, data => 0 );
130 0 $off = $amps[0];
131 }
132 }
133  
134  
135 0 ▶sub arb_mode {
Subroutine arb_mode: not called CC=1 SCAR=6.9
Pod documented
136 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
137 \@_,
138 value => { isa => enum( [qw/INT INTernal PLAY/] ) }
139 );
140  
141 0 $self->write(
142 command => ":SOURCE${channel}:FUNCtion:ARB:MODE $value",
143 %args
144 );
145 }
146  
147  
148 0 ▶sub play_coefficient {
Subroutine play_coefficient: not called CC=3 SCAR=24.8
Pod documented
149 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
150 \@_,
151 value => { isa => 'Num' }
152 );
153 0 ▶ if ( $value < 0 or $value > 268435456 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value < 0 or $value > 268435456) 0 0 0
Condition0%0/3
$value < 0 or $value > 268435456
l!l&&r!l&&!r
000
MC/DC0%0/2
$value < 0 or $value > 268435456
$value < 0 $value > 268435456
Truth table0%0/3
A or B
A= $value < 0B= $value > 268435456
ABresult
1X1
011
000
154 0 croak
155 "The the frequency division coefficient must be between 0 and 268435456";
156 }
157  
158 $self->write(
159 0 command => ":SOURCE${channel}:FUNCtion:ARB:SAMPLE $value",
160 %args
161 );
162 }
163  
164  
165 0 ▶sub phase_align {
Subroutine phase_align: not called CC=1 SCAR=6.9
Pod documented
166 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_, );
167  
168 0 $self->write( command => ":SOURce${channel}:PHASe:INITiate", %args );
169 }
170  
171  
172 0 ▶sub output_on {
Subroutine output_on: not called CC=1 SCAR=6.9
Pod documented
173 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
174  
175 0 $self->write( command => ":OUTPut${channel}:STATe ON" );
176 }
177  
178 0 ▶sub output_off {
Subroutine output_off: not called CC=1 SCAR=6.9
Pod documented
179 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
180  
181 0 $self->write( command => ":OUTPut${channel}:STATe OFF" );
182 }
183  
184  
185 0 ▶sub set_pulsewidth {
Subroutine set_pulsewidth: not called CC=2 SCAR=17.9
Pod documented
186 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
187 \@_,
188 value => { isa => 'Num' },
189 constant_delay => { isa => 'Bool', default => 0 }
190 );
191 0 my $constant_delay = delete $args{'constant_delay'};
192 0 ▶ if ($constant_delay) {
Branch: 1 branch
BranchTrueFalseTotal
if ($constant_delay) 0 0 0
193 0 my $delay = $self->get_pulsedelay();
194 0 $self->set_period( channel => $channel, value => $delay + $value );
195 }
196  
197 0 $self->write( command => ":SOURce${channel}:PULSe:WIDTh $value", %args );
198 }
199  
200 0 ▶sub get_pulsewidth {
Subroutine get_pulsewidth: not called CC=1 SCAR=6.9
Pod documented
201 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
202  
203 0 return $self->query( command => ":SOURce${channel}:PULSe:WIDTh?", %args );
204 }
205  
206  
207 0 ▶sub set_pulsedelay {
Subroutine set_pulsedelay: not called CC=2 SCAR=17.9
Pod documented
208 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
209 \@_,
210 value => { isa => 'Num' },
211 constant_width => { isa => 'Bool', default => 0 }
212 );
213 0 my $constant_width = delete $args{'constant_width'};
214 0 ▶ if ($constant_width) {
Branch: 1 branch
BranchTrueFalseTotal
if ($constant_width) 0 0 0
215 0 my $width = $self->get_pulsewidth();
216 0 $self->set_period( channel => $channel, value => $width + $value );
217 }
218  
219 0 $self->write( command => ":SOURce${channel}:PULSe:DELay $value", %args );
220 }
221  
222 0 ▶sub get_pulsedelay {
Subroutine get_pulsedelay: not called CC=1 SCAR=6.9
Pod documented
223 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
224  
225 0 return $self->query( command => ":SOURce${channel}:PULSe:DELay?", %args );
226 }
227  
228  
229 0 ▶sub set_period {
Subroutine set_period: not called CC=1 SCAR=6.9
Pod documented
230 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
231 \@_,
232 value => { isa => 'Num' }
233 );
234  
235 0 $self->write( command => ":SOURce${channel}:PERiod $value", %args );
236 }
237  
238 0 ▶sub get_period {
Subroutine get_period: not called CC=1 SCAR=6.9
Pod documented
239 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
240  
241 0 return $self->query( command => ":SOURce${channel}:PERiod?", %args );
242 }
243  
244  
245 0 ▶sub set_frq {
Subroutine set_frq: not called CC=1 SCAR=6.9
Pod documented
246 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
247 \@_,
248 value => { isa => 'Num' }
249 );
250  
251 0 $self->write( command => ":SOURce${channel}:FREQuency $value", %args );
252 }
253  
254 0 ▶sub get_frq {
Subroutine get_frq: not called CC=1 SCAR=6.9
Pod documented
255 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
256  
257 0 return $self->query( command => ":SOURce${channel}:FREQuency?", %args );
258 }
259  
260  
261 0 ▶sub set_voltage {
Subroutine set_voltage: not called CC=1 SCAR=6.9
Pod documented
262 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
263 \@_,
264 value => { isa => 'Num' }
265 );
266  
267 0 $self->write(
268 command => ":SOURce${channel}:VOLTage:AMPLitude $value",
269 %args
270 );
271 }
272  
273 0 ▶sub get_voltage {
Subroutine get_voltage: not called CC=1 SCAR=6.9
Pod documented
274 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
275  
276 0 return $self->query(
277 command => ":SOURce${channel}:VOLTage:AMPLitude?",
278 %args
279 );
280 }
281  
282  
283 0 ▶sub set_level {
Subroutine set_level: not called CC=1 SCAR=6.9
Pod documented
284 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
285 \@_,
286 value => { isa => 'Num' }
287 );
288  
289 0 $self->write( command => ":SOURce${channel}:VOLTage:HIGH $value", %args );
290 }
291  
292 0 ▶sub get_level {
Subroutine get_level: not called CC=1 SCAR=6.9
Pod documented
293 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
294  
295 0 return $self->query(
296 command => ":SOURce${channel}:VOLTage:HIGH?",
297 %args
298 );
299 }
300  
301  
302 0 ▶sub set_level_low {
Subroutine set_level_low: not called CC=1 SCAR=6.9
Pod documented
303 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
304 \@_,
305 value => { isa => 'Num' }
306 );
307  
308 0 $self->write( command => ":SOURce${channel}:VOLTage:LOW $value", %args );
309 }
310  
311 0 ▶sub get_level_low {
Subroutine get_level_low: not called CC=1 SCAR=6.9
Pod documented
312 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
313  
314 0 return $self->query( command => ":SOURce${channel}:VOLTage:LOW?", %args );
315 }
316  
317  
318 0 ▶sub set_offset {
Subroutine set_offset: not called CC=1 SCAR=6.9
Pod documented
319 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
320 \@_,
321 value => { isa => 'Num' }
322 );
323  
324 0 $self->write(
325 command => ":SOURce${channel}:AMPLitude:OFFSet $value",
326 %args
327 );
328 }
329  
330 0 ▶sub get_offset {
Subroutine get_offset: not called CC=1 SCAR=6.9
Pod documented
331 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
332  
333 0 return $self->query(
334 command => ":SOURce${channel}:AMPLitude:OFFSet?",
335 %args
336 );
337 }
338  
339 #
340 # SOURCE APPLY
341 #
342  
343  
344 0 ▶sub source_apply_pulse {
Subroutine source_apply_pulse: not called CC=1 SCAR=6.9
Pod documented
345 0 my ( $self, $channel, %args ) = validated_channel_getter(
346 \@_,
347 freq => { isa => 'Num' },
348 amp => { isa => 'Num' },
349 offset => { isa => 'Num' },
350 delay => { isa => 'Num' },
351 );
352  
353 my ( $freq, $amp, $offset, $delay )
354 0 = delete @args{qw/freq amp offset delay/};
355  
356 0 $self->write(
357 command => "SOURCE${channel}:APPLY:PULSE $freq,$amp,$offset,$delay",
358 %args
359 );
360 }
361  
362  
363 0 ▶sub source_apply_ramp {
Subroutine source_apply_ramp: not called CC=1 SCAR=6.9
Pod documented
364 0 my ( $self, $channel, %args ) = validated_channel_getter(
365 \@_,
366 freq => { isa => 'Num' },
367 amp => { isa => 'Num' },
368 offset => { isa => 'Num' },
369 phase => { isa => 'Num' },
370 );
371  
372 my ( $freq, $amp, $offset, $phase )
373 0 = delete @args{qw/freq amp offset phase/};
374  
375 0 $self->write(
376 command => "SOURCE${channel}:APPLY:RAMP $freq,$amp,$offset,$phase",
377 %args
378 );
379 }
380  
381 0 ▶sub source_apply_sinusoid {
Subroutine source_apply_sinusoid: not called CC=1 SCAR=6.9
Pod undocumented
382 0 my ( $self, $channel, %args ) = validated_channel_getter(
383 \@_,
384 freq => { isa => 'Num' },
385 amp => { isa => 'Num' },
386 offset => { isa => 'Num' },
387 phase => { isa => 'Num' },
388 );
389  
390 my ( $freq, $amp, $offset, $phase )
391 0 = delete @args{qw/freq amp offset phase/};
392  
393 0 $self->write(
394 command =>
395 "SOURCE${channel}:APPLY:SINUSOID $freq,$amp,$offset,$phase",
396 %args
397 );
398 }
399  
400 0 ▶sub source_apply_square {
Subroutine source_apply_square: not called CC=1 SCAR=6.9
Pod undocumented
401 0 my ( $self, $channel, %args ) = validated_channel_getter(
402 \@_,
403 freq => { isa => 'Num' },
404 amp => { isa => 'Num' },
405 offset => { isa => 'Num' },
406 phase => { isa => 'Num' },
407 );
408  
409 my ( $freq, $amp, $offset, $phase )
410 0 = delete @args{qw/freq amp offset phase/};
411  
412 0 $self->write(
413 command => "SOURCE${channel}:APPLY:SQUare $freq,$amp,$offset,$phase",
414 %args
415 );
416 }
417  
418 0 ▶sub source_apply_arb {
Subroutine source_apply_arb: not called CC=1 SCAR=6.9
Pod undocumented
419 0 my ( $self, $channel, %args ) = validated_channel_getter(
420 \@_,
421 freq => { isa => 'Num' },
422 amp => { isa => 'Num' },
423 offset => { isa => 'Num' },
424 phase => { isa => 'Num' },
425 );
426  
427 my ( $freq, $amp, $offset, $phase )
428 0 = delete @args{qw/freq amp offset phase/};
429  
430 0 $self->write(
431 command => "SOURCE${channel}:APPLY:USER $freq,$amp,$offset,$phase",
432 %args
433 );
434 }
435  
436 #
437 # SOURCE BURST
438 #
439  
440  
441 0 ▶sub source_burst_mode {
Subroutine source_burst_mode: not called CC=1 SCAR=6.9
Pod documented
442 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
443 \@_,
444 value => { isa => enum( [qw/TRIG GAT INF/] ) }
445 );
446  
447 0 $self->write( command => "SOURCE${channel}:BURST:MODE $value", %args );
448 }
449  
450 0 ▶sub source_burst_mode_query {
Subroutine source_burst_mode_query: not called CC=1 SCAR=6.9
Pod documented
451 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
452 0 return $self->query( command => "SOURCE${channel}:BURST:MODE?", %args );
453 }
454  
455  
456 0 ▶sub source_burst_ncycles {
Subroutine source_burst_ncycles: not called CC=1 SCAR=6.9
Pod documented
457 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
458 \@_,
459 value => { isa => 'Lab::Moose::PosInt' }
460 );
461  
462 0 $self->write( command => "SOURCE${channel}:BURST:NCYCLES $value", %args );
463 }
464  
465 0 ▶sub source_burst_ncycles_query {
Subroutine source_burst_ncycles_query: not called CC=1 SCAR=6.9
Pod documented
466 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
467 0 return $self->query(
468 command => "SOURCE${channel}:BURST:NCYCLES?",
469 %args
470 );
471 }
472  
473  
474 0 ▶sub source_burst_state {
Subroutine source_burst_state: not called CC=1 SCAR=6.9
Pod documented
475 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
476 \@_,
477 value => { isa => enum( [qw/ON OFF/] ) }
478 );
479  
480 0 $self->write( command => "SOURCE${channel}:BURST:STATE $value", %args );
481 }
482  
483 0 ▶sub source_burst_state_query {
Subroutine source_burst_state_query: not called CC=1 SCAR=6.9
Pod documented
484 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
485 0 return $self->query( command => "SOURCE${channel}:BURST:STATE?", %args );
486 }
487  
488  
489 0 ▶sub source_burst_tdelay {
Subroutine source_burst_tdelay: not called CC=1 SCAR=6.9
Pod documented
490 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
491 \@_,
492 value => { isa => 'Lab::Moose::PosNum' }
493 );
494  
495 0 $self->write( command => "SOURCE${channel}:BURST:TDELAY $value", %args );
496 }
497  
498 0 ▶sub source_burst_tdelay_query {
Subroutine source_burst_tdelay_query: not called CC=1 SCAR=6.9
Pod documented
499 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
500 0 return $self->query( command => "SOURCE${channel}:BURST:TDELAY?", %args );
501 }
502  
503  
504 0 ▶sub source_burst_trigger {
Subroutine source_burst_trigger: not called CC=1 SCAR=6.9
Pod documented
505 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
506 0 $self->write(
507 command => "SOURCE${channel}:BURST:TRIGGER:IMMEDIATE",
508 %args
509 );
510 }
511  
512  
513 0 ▶sub source_burst_trigger_slope {
Subroutine source_burst_trigger_slope: not called CC=1 SCAR=6.9
Pod documented
514 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
515 \@_,
516 value => { isa => enum( [qw/POS NEG/] ) }
517 );
518  
519 0 $self->write(
520 command => "SOURCE${channel}:BURST:TRIGGER:SLOPE $value",
521 %args
522 );
523 }
524  
525 0 ▶sub source_burst_trigger_slope_query {
Subroutine source_burst_trigger_slope_query: not called CC=1 SCAR=6.9
Pod documented
526 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
527 0 return $self->query(
528 command => "SOURCE${channel}:BURST:TRIGGER:SLOPE?",
529 %args
530 );
531 }
532  
533  
534 0 ▶sub source_burst_trigger_trigout {
Subroutine source_burst_trigger_trigout: not called CC=1 SCAR=6.9
Pod documented
535 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
536 \@_,
537 value => { isa => enum( [qw/OFF POS NEG/] ) }
538 );
539  
540 0 $self->write(
541 command => "SOURCE${channel}:BURST:TRIGGER:TRIGOUT $value",
542 %args
543 );
544 }
545  
546 0 ▶sub source_burst_trigger_trigout_query {
Subroutine source_burst_trigger_trigout_query: not called CC=1 SCAR=6.9
Pod documented
547 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
548 0 return $self->query(
549 command => "SOURCE${channel}:BURST:TRIGGER:TRIGOUT?",
550 %args
551 );
552 }
553  
554  
555 0 ▶sub source_burst_trigger_source {
Subroutine source_burst_trigger_source: not called CC=1 SCAR=6.9
Pod documented
556 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
557 \@_,
558 value => { isa => enum( [qw/INT EXT/] ) }
559 );
560  
561 0 $self->write(
562 command => "SOURCE${channel}:BURST:TRIGGER:SOURCE $value",
563 %args
564 );
565 }
566  
567 0 ▶sub source_burst_trigger_source_query {
Subroutine source_burst_trigger_source_query: not called CC=1 SCAR=6.9
Pod documented
568 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
569 0 return $self->query(
570 command => "SOURCE${channel}:BURST:TRIGGER:SOURCE?",
571 %args
572 );
573 }
574  
575  
576 0 ▶sub source_burst_period {
Subroutine source_burst_period: not called CC=1 SCAR=6.9
Pod documented
577 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
578 \@_,
579 value => { isa => 'Lab::Moose::PosNum' }
580 );
581  
582 0 $self->write(
583 command => "SOURCE${channel}:BURST:INTERNAL:PERIOD $value",
584 %args
585 );
586 }
587  
588 #
589 # SOURCE FUNCTION
590 #
591  
592  
593 0 ▶sub source_function_shape {
Subroutine source_function_shape: not called CC=1 SCAR=6.9
Pod documented
594 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
595 \@_,
596 value => {
597 isa => enum(
598 [
599 qw/SIN SQU RAMP PULSE NOISE USER DC SINC EXPR EXPF CARD GAUS HAV LOR ARBPULSE DUA/
600 ]
601 )
602 }
603 );
604  
605 0 $self->write(
606 command => "SOURCE${channel}:FUNCTION:SHAPE $value",
607 %args
608 );
609 }
610  
611 0 ▶sub source_function_shape_query {
Subroutine source_function_shape_query: not called CC=1 SCAR=6.9
Pod documented
612 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
613 0 return $self->query(
614 command => "SOURCE${channel}:FUNCTION:SHAPE?",
615 %args
616 );
617 }
618  
619  
620 0 ▶sub source_function_ramp_symmetry {
Subroutine source_function_ramp_symmetry: not called CC=1 SCAR=6.9
Pod documented
621 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
622 \@_,
623 value => { isa => 'Lab::Moose::PosNum' }
624 );
625  
626 0 $self->write(
627 command => "SOURCE${channel}:FUNCTION:RAMP:SYMMETRY $value",
628 %args
629 );
630 }
631  
632 0 ▶sub source_function_ramp_symmetry_query {
Subroutine source_function_ramp_symmetry_query: not called CC=1 SCAR=6.9
Pod documented
633 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
634 0 return $self->query(
635 command => "SOURCE${channel}:FUNCTION:RAMP:SYMMETRY?", %args );
636 }
637  
638 #
639 # SOURCE PERIOD
640 #
641  
642  
643 0 ▶sub source_period_fixed {
Subroutine source_period_fixed: not called CC=1 SCAR=6.9
Pod documented
644 0 my ( $self, $channel, $value, %args ) = validated_channel_setter(
645 \@_,
646 value => { isa => 'Lab::Moose::PosNum' }
647 );
648  
649 0 $self->write( command => "SOURCE${channel}:PERIOD:FIXED $value", %args );
650 }
651  
652 0 ▶sub source_period_fixed_query {
Subroutine source_period_fixed_query: not called CC=1 SCAR=6.9
Pod documented
653 0 my ( $self, $channel, %args ) = validated_channel_getter( \@_ );
654 0 return $self->query( command => "SOURCE${channel}:PERIOD:FIXED?", %args );
655 }
656  
657 #
658 # TRACE
659 #
660  
661  
662 0 ▶sub trace_data_data {
Subroutine trace_data_data: not called CC=2 SCAR=17.9
Pod documented
663 0 my ( $self, %args ) = validated_getter(
664 \@_,
665 data => { isa => 'ArrayRef[Num]' }
666 );
667  
668 0 my $data = delete $args{data};
669 0 my @data = @{$data};
670 0 ▶ if ( @data < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@data < 1) 0 0 0
671 0 croak("empty data argument");
672 }
673  
674 0 $data = join( ',', @data );
675  
676 0 $self->write( command => "TRACE:DATA:DATA VOLATILE,$data", %args );
677 }
678  
679  
680 0 ▶sub trace_data_value {
Subroutine trace_data_value: not called CC=1 SCAR=6.9
Pod documented
681 0 my ( $self, %args ) = validated_getter(
682 \@_,
683 point => { isa => 'Lab::Moose::PosInt' },
684 data => { isa => 'Num' }
685 );
686 0 my $point = delete $args{point};
687 0 my $data = delete $args{data};
688  
689 0 $self->write(
690 command => "TRACE:DATA:VALUE VOLATILE,$point,$data",
691 %args
692 );
693 }
694  
695 0 ▶sub trace_data_value_query {
Subroutine trace_data_value_query: not called CC=1 SCAR=6.9
Pod documented
696 0 my ( $self, %args ) = validated_getter(
697 \@_,
698 point => { isa => 'Lab::Moose::PosInt' },
699 );
700 0 my $point = delete $args{point};
701  
702 0 return $self->query(
703 command => "TRACE:DATA:VALUE? VOLATILE,$point",
704 %args
705 );
706 }
707  
708  
709 0 ▶sub trace_data_points {
Subroutine trace_data_points: not called CC=2 SCAR=17.9
Pod documented
710 0 my ( $self, $value, %args ) = validated_setter(
711 \@_,
712 value => { isa => 'Lab::Moose::PosInt' }
713 );
714  
715 0 ▶ if ( $value < 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value < 2) 0 0 0
716 0 croak("The minimum number of inital data points is 2");
717 }
718  
719 0 $self->write( command => "TRACE:DATA:POINTS VOLATILE,$value", %args );
720 }
721  
722 0 ▶sub trace_data_points_query {
Subroutine trace_data_points_query: not called CC=1 SCAR=6.9
Pod documented
723 0 my ( $self, %args ) = validated_getter( \@_ );
724 0 return $self->query( command => "TRACE:DATA:POINTS? VOLATILE", %args );
725 }
726  
727  
728 0 ▶sub trace_data_points_interpolate {
Subroutine trace_data_points_interpolate: not called CC=1 SCAR=6.9
Pod documented
729 0 my ( $self, $value, %args ) = validated_setter(
730 \@_,
731 value => { isa => enum( [qw/LIN SINC OFF/] ) },
732 );
733 0 $self->write( command => "TRACE:DATA:POINTS:INTERPOLATE $value", %args );
734 }
735  
736 0 ▶sub trace_data_points_interpolate_query {
Subroutine trace_data_points_interpolate_query: not called CC=1 SCAR=6.9
Pod documented
737 0 my ( $self, %args ) = validated_getter( \@_ );
738 0 return $self->query( command => "TRACE:DATA:POINTS:INTERPOLATE?", %args );
739 }
740  
741  
742 0 ▶sub trace_data_dac {
Subroutine trace_data_dac: not called CC=2 SCAR=17.9
Pod documented
743 0 my ( $self, $value, %args ) = validated_setter(
744 \@_,
745 value => { isa => 'Str' }
746 );
747 0 ▶ if ( substr( $value, 0, 1 ) eq ',' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($value, 0, 1) eq ',') { } 0 0 0
748 0 $self->write( command => "TRACE:DATA:DAC VOLATILE$value", %args );
749 }
750 else {
751 0 $self->write( command => "TRACE:DATA:DAC VOLATILE,$value", %args );
752 }
753 }
754  
755 1 with qw(
756 Lab::Moose::Instrument::Common
757 );
758  
759 1 __PACKAGE__->meta()->make_immutable();
760  
761 1 1;
762  
763 __END__
« Moose/Sweep/Continuous/Magnet.pm ↑ Summary Moose/Instrument/Cache.pm »