NAME

Lab::Moose::Sweep::Step - Base class for step/list sweeps

VERSION

version 3.692

SYNOPSIS

use Lab::Moose;

#
# basic 1D sweep (e.g. IV curve)
#

my $source = instrument(
    type => ...,
    connection_type => ...,
    connection_options => {...}
);
my $multimeter = instrument(...);

my $sweep = sweep(
    type => 'Step::Voltage',
    instrument => $instrument,
    from => -1,
    to => 1,
    step => 0.1,
    backsweep => 1, # points: -1, -0.9, ..., 0.9, 1, 0.9, ..., -1
);

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

my $meas = sub {
    my $sweep = shift;
    my $volt = $source->cached_level();
    my $current = $multimeter->get_value();
    $sweep->log(volt => $volt, current => $current);
};

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

#
# 2D sweep (quantum dot stability diagram)
#

my $gate = instrument(...);
my $bias = instrument(...);
my $multimeter = instrument(...);

# master sweep
my $gate_sweep = sweep(
    type => 'Step::Voltage',
    instrument => $gate,
    from => -5,
    to => 5,
    step => 0.01
);

# slave sweep
my $bias_sweep = sweep(
    type => 'Step::Voltage',
    instrument => $bias,
    from => -1,
    to => 1,
    step => 0.01
);

my $datafile = sweep_datafile(columns => [qw/gate bias current/]);
$datafile->add_plot(
    type => 'pm3d',
    x => 'gate',
    y => 'bias',
    z => 'current'
);

my $meas = sub {
    my $sweep = shift;
    my $gate_v = $gate->cached_level();
    my $bias_v = $bias->cached_level();
    my $current = $multimeter->get_value();
    $sweep->log(gate => $gate_v, bias => $bias_v, current => $current);
};

$gate_sweep->start(
    slaves => [$bias_sweep],
    datafiles => [$datafile],
    measurement => $meas
);

DESCRIPTION

This sweep constructor defines the following arguments

  • from/to/step

    define a linear range of points.

  • list

    alternative to from/to/step, give an arbitrary arrayref of points.

  • points/steps

    alternative to from/to/step. Lets define multiple segments with different steps, e.g.

    points => [0,1,2],
    steps => [0.5, 0.2],

    is equivalent to

    list => [0, 0.5, 1, 1, 1.2, 1.4, 1.6, 1.8, 2]

    If steps has fewer elements than segments provided in points, reuse the last value in steps.

  • points/step

    points => [...],
    step => $x, # equivalent to steps => [$x]
  • backsweep

    Include a backsweep: After finishing the sweep, go through all points in reverse.

  • setter

    A coderef which will be called to change the source level. Use this if you do some arcane type of sweep which does not justify its own sweep subclass. Sweep subclasses like Lab::Moose::Sweep::Step::Voltage will define defaults for this. E.g. for the Voltage sweep:

    sub {
        my $sweep = shift;
        my $value = shift;
        $sweep->instrument->set_level(value => $value);
    };

COPYRIGHT AND LICENSE

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

Copyright 2017-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.