NAME

Lab::Moose::Sweep::Continuous - Base class for continuous sweeps (time, temperature, magnetic field)

VERSION

version 3.631

SYNOPSIS

use Lab::Moose;

#
# 1D sweep of magnetic field
#

my $ips = instrument(
    type => 'OI_Mercury::Magnet'
    connection_type => ...,
    connection_options => {...}
);

my $multimeter = instrument(...);

my $sweep = sweep(
    type => 'Continuous::Magnet',
    instrument => $ips,
    from => -1, # Tesla
    to => 1,
    rate => 0.1, (Tesla/min, always positive)
    start_rate => 1, (optional) rate to approach start point
    interval => 0.5, # one measurement every 0.5 seconds
);


# alternative: points/rates
# my $sweep = sweep(
#     type => 'Continuous::Magnet',
#     instrument => $ips,
#     points => [-1, -0.1, 0.1, 1],
#     # start rate: 1
#     # use slow rate 0.01 between points -0.1 and 0.1
#     rates => [1, 0.1, 0.01, 0.1], 
#     intervals => [0.5], # one measurement every 0.5 seconds
# );


my $datafile = sweep_datafile(columns => ['B-field', 'current']);
$datafile->add_plot(x => 'B-field', y => 'current');

my $meas = sub {
    my $sweep = shift;
    my $field = $ips->get_field();
    my $current = $multimeter->get_value();
    $sweep->log('B-field' => $field, current => $current);
};

$sweep->start(
    datafiles => [$datafile],
    measurement => $meas,
);

DESCRIPTION

Continuous sweep constructure. The sweep can be configured with either

  • from/to

  • rate

  • interval (default: 0)

or by providing the arrayrefs

  • points

  • rates

  • intervals (default: [0])

If an interval is 0, do as much measurements as possible. Otherwise, warn if measurement requires more time than interval.

Do backsweep if backsweep attribute is set to 1.

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by the Lab::Measurement team; in detail:

Copyright 2018       Simon Reinhardt

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.