The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lab::Moose::DataFile::Gnuplot - Text based data file ('Gnuplot style')

VERSION

version 3.600

SYNOPSIS

 use Lab::Moose;

 my $folder = datafolder();
 
 my $file = datafile(
     type => 'Gnuplot',
     folder => $folder,
     filename => 'gnuplot-file.dat',
     columns => [qw/gate bias current/]
     );

 $file->log_comment(comment => "some extra comment");
 $file->log_newline();
 
 $file->log(gate => 1, bias => 2, current => 3);

 $block = [1, 2, 3, 4, 5, 6];
 $file->log_block(
    prefix => {gate => 1, bias => 2},
    block => $block
 );

METHODS

new

Supports the following attributtes in addition to the Lab::Moose::DataFile requirements:

  • columns

    (mandatory) arrayref of column names

  • precision

    The numbers are formatted with a %.${precision}g format specifier. Default is 10.

log

 $file->log(column1 => $value1, column2 => $value2, ...);

Log one line of data.

log_block

 $file->log_block(
     prefix => {column1 => $value1, ...},
     block => $block,
     add_newline => 0
 );

Log a 1D or 2D PDL or array ref. The first dimension runs over the datafile rows. You can add prefix columns, which will be the same for each line in the block. E.g. when using a spectrum analyzer inside a voltage sweep, one would log the returned PDL prefixed with the sweep voltage.

log_newline

 $file->log_newline();

print "\n" to the datafile.

log_comment

 $file->log_comment(comment => $string);

log a comment string, which will be prefixed with '#'. If $string contains newline characters, several lines of comments will be written.

COPYRIGHT AND LICENSE

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

  Copyright 2016       Simon Reinhardt
            2017       Andreas K. Huettel, 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.