| 1 | package Lab::Moose::Sweep::Continuous::Magnet; | ||||||||||
| 2 | 1 | $Lab::Moose::Sweep::Continuous::Magnet::VERSION = '3.931'; | |||||||||
| 3 | #ABSTRACT: Continuous sweep of magnetic field | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use v5.20; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Time::HiRes 'time'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | extends 'Lab::Moose::Sweep::Continuous'; | |||||||||
| 13 | |||||||||||
| 14 | 1 | has filename_extension => ( is => 'ro', isa => 'Str', default => 'Field=' ); | |||||||||
| 15 | |||||||||||
| 16 | # field value for filename extensions. | ||||||||||
| 17 | # Only used if separate datafiles are produces for different fields. | ||||||||||
| 18 | # Should use 'step' sweep for this in most cases. | ||||||||||
| 19 | 0 | ▶ | sub get_value { | ||||||||
|
Subroutine
get_value: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 20 | 0 | my $self = shift; | |||||||||
| 21 | 0 | my $from = $self->from; | |||||||||
| 22 | 0 | my $to = $self->to; | |||||||||
| 23 | 0 | my $rate = abs( $self->rate ); | |||||||||
| 24 | 0 | ▶ | my $sign = $to > $from ? 1 : -1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | |||||||||||
| 26 | # Only estimate field. | ||||||||||
| 27 | # Do not query field for performance reasons. | ||||||||||
| 28 | # Will give wrong results, if the sweep slowly saturates to the setpoint. | ||||||||||
| 29 | |||||||||||
| 30 | 0 | my $t0 = $self->start_time(); | |||||||||
| 31 | 0 | ▶ | if ( not defined $t0 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | croak "sweep not started"; | |||||||||
| 33 | } | ||||||||||
| 34 | 0 | my $t = time(); | |||||||||
| 35 | 0 | return $from + ( $t - $to ) * $sign * $rate / 60; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 1 | __PACKAGE__->meta->make_immutable(); | |||||||||
| 39 | 1 | 1; | |||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||