| 1 | package Lab::Moose::Instrument::ZI_MFLI; | ||||||||||
| 2 | 3 | $Lab::Moose::Instrument::ZI_MFLI::VERSION = '3.931'; | |||||||||
| 3 | #ABSTRACT: Zurich Instruments MFLI Lock-in Amplifier | ||||||||||
| 4 | |||||||||||
| 5 | 3 | ▶ | use v5.20; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 3 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 3 | ▶ | use MooseX::Params::Validate; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 3 | ▶ | use Lab::Moose::Instrument::Cache; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 3 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 3 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 3 | ▶ | use Moose::Util::TypeConstraints 'enum'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 3 | ▶ | use Lab::Moose::Instrument qw/validated_setter validated_getter/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 3 | ▶ | use Lab::Moose::Instrument::Cache; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 3 | ▶ | use constant { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 3 | ZI_LIST_NODES_RECURSIVE => 1, | |||||||||
| 17 | ZI_LIST_NODES_ABSOLUTE => 2, | ||||||||||
| 18 | 3 | }; | |||||||||
| 19 | |||||||||||
| 20 | 3 | extends 'Lab::Moose::Instrument::Zhinst'; | |||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | # FIXME: warn/croak on AUTO freq, bw, ... | ||||||||||
| 24 | |||||||||||
| 25 | 3 | has num_demods => ( | |||||||||
| 26 | is => 'ro', | ||||||||||
| 27 | isa => 'Int', | ||||||||||
| 28 | builder => '_get_num_demods', | ||||||||||
| 29 | lazy => 1, | ||||||||||
| 30 | init_arg => undef, | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | 3 | my %oscillator_arg | |||||||||
| 34 | = ( oscillator => { isa => 'Lab::Moose::PosInt', optional => 1 } ); | ||||||||||
| 35 | |||||||||||
| 36 | 3 | my %sigin_arg = ( sigin => { isa => 'Lab::Moose::PosInt' } ); | |||||||||
| 37 | |||||||||||
| 38 | 3 | has oscillator => ( | |||||||||
| 39 | is => 'ro', | ||||||||||
| 40 | isa => 'Lab::Moose::PosInt', | ||||||||||
| 41 | default => 0 | ||||||||||
| 42 | ); | ||||||||||
| 43 | |||||||||||
| 44 | 4 | ▶ | sub _get_oscillator { | ||||||||
|
Subroutine
_get_oscillator: called CC=2 SCAR=7.0
| |||||||||||
| 45 | 4 | my $self = shift; | |||||||||
| 46 | 4 | my %args = @_; | |||||||||
| 47 | 4 | my $osc = delete $args{oscillator}; | |||||||||
| 48 | 4 | ▶ | if ( not defined $osc ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 4 | $osc = $self->oscillator(); | |||||||||
| 50 | } | ||||||||||
| 51 | 4 | $osc; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub _get_num_demods { | ||||||||
|
Subroutine
_get_num_demods: not called CC=2 SCAR=17.9
| |||||||||||
| 55 | 0 | my $self = shift; | |||||||||
| 56 | 0 | my $nodes = $self->list_nodes( | |||||||||
| 57 | path => '/', | ||||||||||
| 58 | mask => ZI_LIST_NODES_ABSOLUTE | ZI_LIST_NODES_RECURSIVE | ||||||||||
| 59 | ); | ||||||||||
| 60 | |||||||||||
| 61 | 0 | my @demods = $nodes =~ m{^/dev\w+/demods/[0-9]+/}gmi; | |||||||||
| 62 | @demods = map { | ||||||||||
| 63 | 0 | my $s = $_; | |||||||||
| 64 | 0 | $s =~ m{/([0-9]+)/$}; | |||||||||
| 65 | 0 | $1; | |||||||||
| 66 | } @demods; | ||||||||||
| 67 | 0 | my %hash = map { $_ => 1 } @demods; | |||||||||
| 68 | 0 | @demods = keys %hash; | |||||||||
| 69 | 0 | ▶ | if ( @demods == 0 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 0 | croak "did not find any demods"; | |||||||||
| 71 | } | ||||||||||
| 72 | 0 | return ( @demods + 0 ); | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | |||||||||||
| 76 | 3 | cache frequency => ( getter => 'get_frequency' ); | |||||||||
| 77 | |||||||||||
| 78 | 2 | ▶ | sub get_frequency { | ||||||||
|
Subroutine
get_frequency: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 79 | 2 | my ( $self, %args ) = validated_hash( | |||||||||
| 80 | \@_, | ||||||||||
| 81 | %oscillator_arg, | ||||||||||
| 82 | ); | ||||||||||
| 83 | |||||||||||
| 84 | 2 | my $osc = $self->_get_oscillator(%args); | |||||||||
| 85 | |||||||||||
| 86 | 2 | return $self->cached_frequency( | |||||||||
| 87 | $self->get_value( | ||||||||||
| 88 | path => $self->device() . "/oscs/$osc/freq", | ||||||||||
| 89 | type => 'D' | ||||||||||
| 90 | ) | ||||||||||
| 91 | ); | ||||||||||
| 92 | |||||||||||
| 93 | } | ||||||||||
| 94 | |||||||||||
| 95 | 0 | ▶ | sub get_frq { | ||||||||
|
Subroutine
get_frq: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 96 | 0 | my $self = shift; | |||||||||
| 97 | 0 | return $self->get_frequency(@_); | |||||||||
| 98 | } | ||||||||||
| 99 | |||||||||||
| 100 | |||||||||||
| 101 | |||||||||||
| 102 | 2 | ▶ | sub set_frequency { | ||||||||
|
Subroutine
set_frequency: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 103 | 2 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 104 | \@_, | ||||||||||
| 105 | %oscillator_arg, | ||||||||||
| 106 | value => { isa => 'Num' }, | ||||||||||
| 107 | ); | ||||||||||
| 108 | 2 | my $osc = $self->_get_oscillator(%args); | |||||||||
| 109 | 2 | return $self->cached_frequency( | |||||||||
| 110 | $self->sync_set_value( | ||||||||||
| 111 | path => $self->device() . "/oscs/$osc/freq", type => 'D', | ||||||||||
| 112 | value => $value | ||||||||||
| 113 | ) | ||||||||||
| 114 | ); | ||||||||||
| 115 | |||||||||||
| 116 | } | ||||||||||
| 117 | |||||||||||
| 118 | |||||||||||
| 119 | 0 | ▶ | sub set_frq { | ||||||||
|
Subroutine
set_frq: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 120 | 0 | my $self = shift; | |||||||||
| 121 | 0 | return $self->set_frequency(@_); | |||||||||
| 122 | } | ||||||||||
| 123 | |||||||||||
| 124 | |||||||||||
| 125 | 3 | cache voltage_sens => ( getter => 'voltage_sens' ); | |||||||||
| 126 | |||||||||||
| 127 | 0 | ▶ | sub get_voltage_sens { | ||||||||
|
Subroutine
get_voltage_sens: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 128 | 0 | my $self = shift; | |||||||||
| 129 | 0 | my ($sigin) = validated_list( | |||||||||
| 130 | \@_, | ||||||||||
| 131 | %sigin_arg, | ||||||||||
| 132 | ); | ||||||||||
| 133 | |||||||||||
| 134 | 0 | return $self->cached_voltage_sens( | |||||||||
| 135 | $self->get_value( | ||||||||||
| 136 | path => $self->device() . "/sigins/$sigin/range", | ||||||||||
| 137 | type => 'D' | ||||||||||
| 138 | ) | ||||||||||
| 139 | ); | ||||||||||
| 140 | } | ||||||||||
| 141 | |||||||||||
| 142 | |||||||||||
| 143 | 0 | ▶ | sub set_voltage_sens { | ||||||||
|
Subroutine
set_voltage_sens: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 144 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 145 | \@_, | ||||||||||
| 146 | value => { isa => 'Num' }, | ||||||||||
| 147 | %sigin_arg, | ||||||||||
| 148 | ); | ||||||||||
| 149 | 0 | my $sigin = delete $args{sigin}; | |||||||||
| 150 | 0 | return $self->cached_voltage_sens( | |||||||||
| 151 | $self->sync_set_value( | ||||||||||
| 152 | path => $self->device() . "/sigins/$sigin/range", | ||||||||||
| 153 | type => 'D', | ||||||||||
| 154 | value => $value | ||||||||||
| 155 | ) | ||||||||||
| 156 | ); | ||||||||||
| 157 | } | ||||||||||
| 158 | |||||||||||
| 159 | |||||||||||
| 160 | # add methods for various "ON/OFF" properties of the inputs | ||||||||||
| 161 | 3 | for my $sigin_arg (qw/diff ac imp50 float autorange on/) { | |||||||||
| 162 | 18 | my $meta = __PACKAGE__->meta(); | |||||||||
| 163 | 18 | my $set_function = "set_sigin_$sigin_arg"; | |||||||||
| 164 | 18 | my $get_function = "get_sigin_$sigin_arg"; | |||||||||
| 165 | |||||||||||
| 166 | # create setter function | ||||||||||
| 167 | $meta->add_method( | ||||||||||
| 168 | 0 | ▶ | $set_function => sub { | ||||||||
|
Subroutine
set_sigin_imp50: not called CC=1 SCAR=6.9
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
set_sigin_autorange: not called CC=1 SCAR=6.9
| |||||||||||
| 169 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 170 | \@_, | ||||||||||
| 171 | value => { isa => enum( [ 0, 1 ] ) }, | ||||||||||
| 172 | %sigin_arg, | ||||||||||
| 173 | ); | ||||||||||
| 174 | 0 | my $sigin = delete $args{sigin}; | |||||||||
| 175 | 0 | return $self->sync_set_value( | |||||||||
| 176 | path => $self->device() . "/sigins/$sigin/$sigin_arg", | ||||||||||
| 177 | type => 'I', | ||||||||||
| 178 | value => $value | ||||||||||
| 179 | ); | ||||||||||
| 180 | } | ||||||||||
| 181 | 18 | ); | |||||||||
| 182 | |||||||||||
| 183 | # create getter function | ||||||||||
| 184 | $meta->add_method( | ||||||||||
| 185 | 0 | ▶ | $get_function => sub { | ||||||||
|
Subroutine
get_sigin_float: not called CC=1 SCAR=6.9
| |||||||||||
| 186 | 0 | my $self = shift; | |||||||||
| 187 | 0 | my ($sigin) = validated_list( | |||||||||
| 188 | \@_, | ||||||||||
| 189 | %sigin_arg, | ||||||||||
| 190 | ); | ||||||||||
| 191 | |||||||||||
| 192 | 0 | return $self->get_value( | |||||||||
| 193 | path => $self->device() . "/sigins/$sigin/$sigin_arg", | ||||||||||
| 194 | type => 'I', | ||||||||||
| 195 | ); | ||||||||||
| 196 | } | ||||||||||
| 197 | 18 | ); | |||||||||
| 198 | } | ||||||||||
| 199 | |||||||||||
| 200 | 0 | ▶ | sub set__sens { | ||||||||
|
Subroutine
set__sens: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 201 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 202 | \@_, | ||||||||||
| 203 | value => { isa => 'Num' }, | ||||||||||
| 204 | %sigin_arg, | ||||||||||
| 205 | ); | ||||||||||
| 206 | 0 | my $sigin = delete $args{sigin}; | |||||||||
| 207 | 0 | return $self->cached_voltage_sens( | |||||||||
| 208 | $self->sync_set_value( | ||||||||||
| 209 | path => $self->device() . "/sigins/$sigin/range", | ||||||||||
| 210 | type => 'D', | ||||||||||
| 211 | value => $value | ||||||||||
| 212 | ) | ||||||||||
| 213 | ); | ||||||||||
| 214 | } | ||||||||||
| 215 | |||||||||||
| 216 | |||||||||||
| 217 | 3 | cache current_sens => ( getter => 'get_current_sens' ); | |||||||||
| 218 | |||||||||||
| 219 | 0 | ▶ | sub get_current_sens { | ||||||||
|
Subroutine
get_current_sens: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 220 | 0 | my $self = shift; | |||||||||
| 221 | 0 | return $self->cached_current_sens( | |||||||||
| 222 | $self->get_value( | ||||||||||
| 223 | path => $self->device() . "/currins/0/range", | ||||||||||
| 224 | type => 'D' | ||||||||||
| 225 | ) | ||||||||||
| 226 | ); | ||||||||||
| 227 | } | ||||||||||
| 228 | |||||||||||
| 229 | |||||||||||
| 230 | 0 | ▶ | sub set_current_sens { | ||||||||
|
Subroutine
set_current_sens: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 231 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 232 | \@_, | ||||||||||
| 233 | value => { isa => 'Num' }, | ||||||||||
| 234 | ); | ||||||||||
| 235 | |||||||||||
| 236 | 0 | return $self->cached_current_sens( | |||||||||
| 237 | $self->sync_set_value( | ||||||||||
| 238 | path => $self->device() . "/currins/0/range", | ||||||||||
| 239 | type => 'D', | ||||||||||
| 240 | value => $value | ||||||||||
| 241 | ) | ||||||||||
| 242 | ); | ||||||||||
| 243 | } | ||||||||||
| 244 | |||||||||||
| 245 | sub set_sigin_diff { | ||||||||||
| 246 | my ( $self, $value, %args ) = validated_setter( | ||||||||||
| 247 | \@_, | ||||||||||
| 248 | value => { isa => enum( [ 0, 1 ] ) }, | ||||||||||
| 249 | %sigin_arg, | ||||||||||
| 250 | ); | ||||||||||
| 251 | my $sigin = delete $args{sigin}; | ||||||||||
| 252 | |||||||||||
| 253 | return $self->sync_set_value( | ||||||||||
| 254 | path => $self->device() . "/sigins/$sigin/diff", | ||||||||||
| 255 | type => 'I', | ||||||||||
| 256 | value => $value | ||||||||||
| 257 | ); | ||||||||||
| 258 | } | ||||||||||
| 259 | |||||||||||
| 260 | |||||||||||
| 261 | 3 | cache amplitude_range => ( getter => 'get_amplitude_range' ); | |||||||||
| 262 | |||||||||||
| 263 | 0 | ▶ | sub get_amplitude_range { | ||||||||
|
Subroutine
get_amplitude_range: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 264 | 0 | my $self = shift; | |||||||||
| 265 | 0 | return $self->cached_amplitude_range( | |||||||||
| 266 | $self->get_value( | ||||||||||
| 267 | path => $self->device() . "/sigouts/0/range", | ||||||||||
| 268 | type => 'D' | ||||||||||
| 269 | ) | ||||||||||
| 270 | ); | ||||||||||
| 271 | } | ||||||||||
| 272 | |||||||||||
| 273 | |||||||||||
| 274 | 0 | ▶ | sub set_amplitude_range { | ||||||||
|
Subroutine
set_amplitude_range: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 275 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 276 | \@_, | ||||||||||
| 277 | value => { isa => 'Num' } | ||||||||||
| 278 | ); | ||||||||||
| 279 | |||||||||||
| 280 | 0 | return $self->cached_amplitude_range( | |||||||||
| 281 | $self->sync_set_value( | ||||||||||
| 282 | path => $self->device() . "/sigouts/0/range", | ||||||||||
| 283 | type => 'D', | ||||||||||
| 284 | value => $value | ||||||||||
| 285 | ) | ||||||||||
| 286 | ); | ||||||||||
| 287 | } | ||||||||||
| 288 | |||||||||||
| 289 | |||||||||||
| 290 | 0 | ▶ | sub set_output_status { | ||||||||
|
Subroutine
set_output_status: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 291 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 292 | \@_, | ||||||||||
| 293 | value => { isa => enum( [ 0, 1 ] ) }, | ||||||||||
| 294 | ); | ||||||||||
| 295 | |||||||||||
| 296 | 0 | return $self->sync_set_value( | |||||||||
| 297 | path => $self->device() . "/sigouts/0/on", | ||||||||||
| 298 | type => 'I', | ||||||||||
| 299 | value => $value, | ||||||||||
| 300 | ); | ||||||||||
| 301 | } | ||||||||||
| 302 | |||||||||||
| 303 | 3 | cache offset_voltage => ( getter => 'get_offset_voltage' ); | |||||||||
| 304 | |||||||||||
| 305 | |||||||||||
| 306 | 0 | ▶ | sub get_offset_voltage { | ||||||||
|
Subroutine
get_offset_voltage: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 307 | 0 | my $self = shift; | |||||||||
| 308 | 0 | return $self->cached_offset_voltage( | |||||||||
| 309 | $self->get_value( | ||||||||||
| 310 | path => $self->device() . "/sigouts/0/offset", | ||||||||||
| 311 | type => 'D' | ||||||||||
| 312 | ) | ||||||||||
| 313 | ); | ||||||||||
| 314 | } | ||||||||||
| 315 | |||||||||||
| 316 | |||||||||||
| 317 | 0 | ▶ | sub set_offset_voltage { | ||||||||
|
Subroutine
set_offset_voltage: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 318 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 319 | \@_, | ||||||||||
| 320 | value => { isa => 'Num' } | ||||||||||
| 321 | ); | ||||||||||
| 322 | 0 | return $self->cached_offset_voltage( | |||||||||
| 323 | $self->sync_set_value( | ||||||||||
| 324 | path => $self->device() . "/sigouts/0/offset", | ||||||||||
| 325 | type => 'D', | ||||||||||
| 326 | value => $value | ||||||||||
| 327 | ) | ||||||||||
| 328 | ); | ||||||||||
| 329 | } | ||||||||||
| 330 | |||||||||||
| 331 | |||||||||||
| 332 | 0 | ▶ | sub set_offset_status { | ||||||||
|
Subroutine
set_offset_status: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 333 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 334 | \@_, | ||||||||||
| 335 | value => { isa => enum( [ 0, 1 ] ) }, | ||||||||||
| 336 | ); | ||||||||||
| 337 | |||||||||||
| 338 | 0 | return $self->sync_set_value( | |||||||||
| 339 | path => $self->device() . "/sigouts/0/add", | ||||||||||
| 340 | type => 'I', | ||||||||||
| 341 | value => $value, | ||||||||||
| 342 | ); | ||||||||||
| 343 | } | ||||||||||
| 344 | |||||||||||
| 345 | # | ||||||||||
| 346 | # compatibility with XPRESS::Sweep::Voltage sweep | ||||||||||
| 347 | # | ||||||||||
| 348 | |||||||||||
| 349 | 0 | ▶ | sub get_level { | ||||||||
|
Subroutine
get_level: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 350 | 0 | my $self = shift; | |||||||||
| 351 | 0 | return $self->get_offset_voltage(); | |||||||||
| 352 | } | ||||||||||
| 353 | |||||||||||
| 354 | 0 | ▶ | sub sweep_to_level { | ||||||||
|
Subroutine
sweep_to_level: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 355 | 0 | my $self = shift; | |||||||||
| 356 | 0 | my ( $target, $time, $stepwidth ) = @_; | |||||||||
| 357 | 0 | $self->set_offset_voltage( value => $target ); | |||||||||
| 358 | } | ||||||||||
| 359 | |||||||||||
| 360 | 0 | ▶ | sub config_sweep { | ||||||||
|
Subroutine
config_sweep: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 361 | 0 | croak "ZI_MFLI only supports step/list sweep with 'jump => 1'"; | |||||||||
| 362 | } | ||||||||||
| 363 | |||||||||||
| 364 | 0 | ▶ | sub set_voltage { | ||||||||
|
Subroutine
set_voltage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 365 | 0 | my $self = shift; | |||||||||
| 366 | 0 | my $value = shift; | |||||||||
| 367 | 0 | $self->set_offset_voltage( value => $value ); | |||||||||
| 368 | } | ||||||||||
| 369 | |||||||||||
| 370 | 3 | my %adcselect_signals = ( | |||||||||
| 371 | 0 => 'sigin1', | ||||||||||
| 372 | 1 => 'currin1', | ||||||||||
| 373 | 2 => 'trigger1', | ||||||||||
| 374 | 3 => 'trigger2', | ||||||||||
| 375 | 4 => 'auxout1', | ||||||||||
| 376 | 5 => 'auxout2', | ||||||||||
| 377 | 6 => 'auxout3', | ||||||||||
| 378 | 7 => 'auxout4', | ||||||||||
| 379 | 8 => 'auxin1', | ||||||||||
| 380 | 9 => 'auxin2', | ||||||||||
| 381 | 174 => 'constant_input', | ||||||||||
| 382 | ); | ||||||||||
| 383 | 3 | my %adcselect_signals_revers = reverse %adcselect_signals; | |||||||||
| 384 | 3 | my @adcselect_signals = values %adcselect_signals; | |||||||||
| 385 | |||||||||||
| 386 | # | ||||||||||
| 387 | # Demodulators | ||||||||||
| 388 | # | ||||||||||
| 389 | |||||||||||
| 390 | |||||||||||
| 391 | 0 | ▶ | sub set_input { | ||||||||
|
Subroutine
set_input: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 392 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 393 | \@_, | ||||||||||
| 394 | value => { isa => enum( [@adcselect_signals] ) }, | ||||||||||
| 395 | demod => { isa => 'Int' }, | ||||||||||
| 396 | ); | ||||||||||
| 397 | |||||||||||
| 398 | 0 | $value = $adcselect_signals_revers{$value}; | |||||||||
| 399 | 0 | my $demod = delete $args{demod}; | |||||||||
| 400 | 0 | $self->sync_set_value( | |||||||||
| 401 | path => $self->device() . "/demods/$demod/adcselect", | ||||||||||
| 402 | type => 'I', value => $value | ||||||||||
| 403 | ); | ||||||||||
| 404 | } | ||||||||||
| 405 | |||||||||||
| 406 | 0 | ▶ | sub get_input { | ||||||||
|
Subroutine
get_input: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 407 | 0 | my $self = shift; | |||||||||
| 408 | 0 | my ($demod) = validated_list( | |||||||||
| 409 | \@_, demod => { isa => 'Int' }, | ||||||||||
| 410 | ); | ||||||||||
| 411 | 0 | my $v = $self->get_value( | |||||||||
| 412 | path => $self->device() . "/demods/$demod/adcselect", | ||||||||||
| 413 | type => 'I' | ||||||||||
| 414 | ); | ||||||||||
| 415 | 0 | return $adcselect_signals{$v}; | |||||||||
| 416 | } | ||||||||||
| 417 | |||||||||||
| 418 | |||||||||||
| 419 | 3 | cache phase => ( getter => 'get_phase', index_arg => 'demod' ); | |||||||||
| 420 | |||||||||||
| 421 | 0 | ▶ | sub get_phase { | ||||||||
|
Subroutine
get_phase: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 422 | 0 | my $self = shift; | |||||||||
| 423 | 0 | my ($demod) = validated_list( | |||||||||
| 424 | \@_, | ||||||||||
| 425 | demod => { isa => 'Int' }, | ||||||||||
| 426 | ); | ||||||||||
| 427 | |||||||||||
| 428 | 0 | return $self->cached_phase( | |||||||||
| 429 | demod => $demod, | ||||||||||
| 430 | value => $self->get_value( | ||||||||||
| 431 | path => $self->device() . "/demods/$demod/phaseshift", | ||||||||||
| 432 | type => 'D' | ||||||||||
| 433 | ) | ||||||||||
| 434 | ); | ||||||||||
| 435 | } | ||||||||||
| 436 | |||||||||||
| 437 | |||||||||||
| 438 | 0 | ▶ | sub set_phase { | ||||||||
|
Subroutine
set_phase: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 439 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 440 | \@_, | ||||||||||
| 441 | value => { isa => 'Num' }, | ||||||||||
| 442 | demod => { isa => 'Int' }, | ||||||||||
| 443 | ); | ||||||||||
| 444 | 0 | my $demod = delete $args{demod}; | |||||||||
| 445 | 0 | return $self->cached_phase( | |||||||||
| 446 | demod => $demod, | ||||||||||
| 447 | value => $self->sync_set_value( | ||||||||||
| 448 | path => $self->device() . "/demods/$demod/phaseshift", | ||||||||||
| 449 | type => 'D', value => $value | ||||||||||
| 450 | ) | ||||||||||
| 451 | ); | ||||||||||
| 452 | } | ||||||||||
| 453 | |||||||||||
| 454 | |||||||||||
| 455 | 3 | cache tc => ( getter => 'get_tc', index_arg => 'demod' ); | |||||||||
| 456 | |||||||||||
| 457 | 0 | ▶ | sub get_tc { | ||||||||
|
Subroutine
get_tc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 458 | 0 | my $self = shift; | |||||||||
| 459 | 0 | my ($demod) = validated_list( | |||||||||
| 460 | \@_, | ||||||||||
| 461 | demod => { isa => 'Int' }, | ||||||||||
| 462 | ); | ||||||||||
| 463 | 0 | return $self->cached_tc( | |||||||||
| 464 | demod => $demod, | ||||||||||
| 465 | value => $self->get_value( | ||||||||||
| 466 | path => $self->device() . "/demods/$demod/timeconstant", | ||||||||||
| 467 | type => 'D' | ||||||||||
| 468 | ) | ||||||||||
| 469 | ); | ||||||||||
| 470 | } | ||||||||||
| 471 | |||||||||||
| 472 | |||||||||||
| 473 | 0 | ▶ | sub set_tc { | ||||||||
|
Subroutine
set_tc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 474 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 475 | \@_, | ||||||||||
| 476 | value => { isa => 'Num' }, | ||||||||||
| 477 | demod => { isa => 'Int' }, | ||||||||||
| 478 | ); | ||||||||||
| 479 | 0 | my $demod = delete $args{demod}; | |||||||||
| 480 | 0 | return $self->cached_tc( | |||||||||
| 481 | demod => $demod, | ||||||||||
| 482 | value => $self->sync_set_value( | ||||||||||
| 483 | path => $self->device() . "/demods/$demod/timeconstant", | ||||||||||
| 484 | type => 'D', | ||||||||||
| 485 | value => $value | ||||||||||
| 486 | ) | ||||||||||
| 487 | ); | ||||||||||
| 488 | } | ||||||||||
| 489 | |||||||||||
| 490 | |||||||||||
| 491 | 3 | cache order => ( getter => 'get_order', index_arg => 'demod' ); | |||||||||
| 492 | |||||||||||
| 493 | 0 | ▶ | sub get_order { | ||||||||
|
Subroutine
get_order: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 494 | 0 | my $self = shift; | |||||||||
| 495 | 0 | my ($demod) = validated_list( | |||||||||
| 496 | \@_, | ||||||||||
| 497 | demod => { isa => 'Int' }, | ||||||||||
| 498 | ); | ||||||||||
| 499 | 0 | return $self->cached_order( | |||||||||
| 500 | demod => $demod, | ||||||||||
| 501 | value => $self->get_value( | ||||||||||
| 502 | path => $self->device() . "/demods/$demod/order", | ||||||||||
| 503 | type => 'I' | ||||||||||
| 504 | ) | ||||||||||
| 505 | ); | ||||||||||
| 506 | } | ||||||||||
| 507 | |||||||||||
| 508 | |||||||||||
| 509 | 0 | ▶ | sub set_order { | ||||||||
|
Subroutine
set_order: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 510 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 511 | \@_, | ||||||||||
| 512 | value => { isa => 'Int' }, | ||||||||||
| 513 | demod => { isa => 'Int' }, | ||||||||||
| 514 | ); | ||||||||||
| 515 | 0 | my $demod = delete $args{demod}; | |||||||||
| 516 | 0 | return $self->cached_order( | |||||||||
| 517 | demod => $demod, | ||||||||||
| 518 | value => $self->sync_set_value( | ||||||||||
| 519 | path => $self->device() . "/demods/$demod/order", type => 'I', | ||||||||||
| 520 | value => $value | ||||||||||
| 521 | ) | ||||||||||
| 522 | ); | ||||||||||
| 523 | } | ||||||||||
| 524 | |||||||||||
| 525 | |||||||||||
| 526 | 3 | cache amplitude => ( getter => 'get_amplitude' ); | |||||||||
| 527 | |||||||||||
| 528 | 0 | ▶ | sub get_amplitude { | ||||||||
|
Subroutine
get_amplitude: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 529 | 0 | my ( $self, %args ) = validated_getter( | |||||||||
| 530 | \@_, | ||||||||||
| 531 | demod => { isa => 'Int' }, | ||||||||||
| 532 | ); | ||||||||||
| 533 | |||||||||||
| 534 | 0 | my $demod = delete $args{demod}; | |||||||||
| 535 | 0 | return $self->cached_amplitude( | |||||||||
| 536 | $self->get_value( | ||||||||||
| 537 | path => $self->device() . "/sigouts/0/amplitudes/$demod", | ||||||||||
| 538 | type => 'D' | ||||||||||
| 539 | ) | ||||||||||
| 540 | ); | ||||||||||
| 541 | } | ||||||||||
| 542 | |||||||||||
| 543 | |||||||||||
| 544 | 0 | ▶ | sub set_amplitude { | ||||||||
|
Subroutine
set_amplitude: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 545 | 0 | my ( $self, $value, %args ) = validated_setter( | |||||||||
| 546 | \@_, | ||||||||||
| 547 | value => { isa => 'Num' }, | ||||||||||
| 548 | demod => { isa => 'Int' }, | ||||||||||
| 549 | ); | ||||||||||
| 550 | 0 | my $demod = delete $args{demod}; | |||||||||
| 551 | 0 | return $self->cached_amplitude( | |||||||||
| 552 | $self->sync_set_value( | ||||||||||
| 553 | path => $self->device() . "/sigouts/0/amplitudes/$demod", | ||||||||||
| 554 | type => 'D', | ||||||||||
| 555 | value => $value | ||||||||||
| 556 | ) | ||||||||||
| 557 | ); | ||||||||||
| 558 | } | ||||||||||
| 559 | |||||||||||
| 560 | |||||||||||
| 561 | 0 | ▶ | sub get_amplitude_rms { | ||||||||
|
Subroutine
get_amplitude_rms: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 562 | 0 | my $self = shift; | |||||||||
| 563 | 0 | my $value = $self->get_amplitude(@_); | |||||||||
| 564 | 0 | return $value / sqrt(2); | |||||||||
| 565 | } | ||||||||||
| 566 | |||||||||||
| 567 | 0 | ▶ | sub set_amplitude_rms { | ||||||||
|
Subroutine
set_amplitude_rms: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 568 | 0 | my $self = shift; | |||||||||
| 569 | 0 | my %args = @_; | |||||||||
| 570 | 0 | $args{value} *= sqrt(2); | |||||||||
| 571 | 0 | return $self->set_amplitude(%args); | |||||||||
| 572 | } | ||||||||||
| 573 | |||||||||||
| 574 | # | ||||||||||
| 575 | # Output commands | ||||||||||
| 576 | # | ||||||||||
| 577 | |||||||||||
| 578 | |||||||||||
| 579 | 1 | ▶ | sub get_xy { | ||||||||
|
Subroutine
get_xy: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 580 | 1 | my $self = shift; | |||||||||
| 581 | 1 | my ($demod) = validated_list( | |||||||||
| 582 | \@_, | ||||||||||
| 583 | demod => { isa => 'Int' }, | ||||||||||
| 584 | ); | ||||||||||
| 585 | 1 | my $demod_sample = $self->get_value( | |||||||||
| 586 | path => $self->device() . "/demods/$demod/sample", | ||||||||||
| 587 | type => 'Demod' | ||||||||||
| 588 | ); | ||||||||||
| 589 | |||||||||||
| 590 | 1 | return { x => $demod_sample->{x}, y => $demod_sample->{y} }; | |||||||||
| 591 | } | ||||||||||
| 592 | |||||||||||
| 593 | 3 | __PACKAGE__->meta()->make_immutable(); | |||||||||
| 594 | |||||||||||
| 595 | 3 | 1; | |||||||||
| 596 | |||||||||||
| 597 | __END__ | ||||||||||