| 1 | package Lab::XPRESS::Data::XPRESS_DataFile; | ||||||||||||||||||||
| 2 | 8 | $Lab::XPRESS::Data::XPRESS_DataFile::VERSION = '3.881'; | |||||||||||||||||||
| 3 | #ABSTRACT: XPRESS data file module | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 8 | ▶ | use v5.20; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 8 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 8 | ▶ | use Time::HiRes qw/usleep/, qw/time/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 8 | ▶ | use Storable qw(dclone); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 8 | ▶ | use File::Copy; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 8 | ▶ | use Lab::XPRESS::Data::XPRESS_logger; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 8 | ▶ | use Lab::XPRESS::Sweep; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 8 | our $counter = 0; | |||||||||||||||||||
| 15 | 8 | our $GLOBAL_PATH = "./"; | |||||||||||||||||||
| 16 | 8 | our $GLOBAL_FOLDER = undef; | |||||||||||||||||||
| 17 | 8 | our $DEFAULT_FOLDER = "MEAS"; | |||||||||||||||||||
| 18 | 8 | our $DEFAULT_HEADER = "#"; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | sub new { | ||||||||||||||||||||
| 21 | 2 | ▶ | my $proto = shift; | ||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||
| 22 | 2 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 23 | 2 | my $self = {}; | |||||||||||||||||||
| 24 | 2 | bless( $self, $class ); | |||||||||||||||||||
| 25 | 2 | $self->{COLUMN_NAMES}; | |||||||||||||||||||
| 26 | 2 | $self->{NUMBER_OF_COLUMNS} = 0; | |||||||||||||||||||
| 27 | 2 | $self->{COLUMNS} = (); | |||||||||||||||||||
| 28 | 2 | $self->{BLOCK_NUM} = 0; | |||||||||||||||||||
| 29 | 2 | $self->{LOG_STARTED} = 0; | |||||||||||||||||||
| 30 | 2 | $self->{loop}->{interval} = 1; | |||||||||||||||||||
| 31 | 2 | $self->{loop}->{overtime} = 0; | |||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 2 | $self->{autolog} = 1; | |||||||||||||||||||
| 34 | 2 | $self->{skiplog} = 0; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 2 | my $filenamebase = shift; | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 2 | ▶ | if ( not $filenamebase =~ /(.+)(\..+)\b/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 39 | 2 | $filenamebase .= ".dat"; | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 2 | my $foldername = $DEFAULT_FOLDER; | |||||||||||||||||||
| 43 | 2 | ▶ | $foldername = shift if @_; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 2 | $self->{filenamebase} = $filenamebase; | |||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 2 | my @plots = @_; | |||||||||||||||||||
| 48 | 2 | $self->{plots} = []; | |||||||||||||||||||
| 49 | 2 | foreach my $plot (@plots) { | |||||||||||||||||||
| 50 | 0 | $self->add_plot($plot); | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 2 | $self->{plot_count} = @plots; | |||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | # create file-handle: | ||||||||||||||||||||
| 56 | $self->{filenamebase} | ||||||||||||||||||||
| 57 | 2 | = $self->create_folder( $self->{filenamebase}, $foldername ); | |||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | 2 | $self->open_logger( $self->{filenamebase}, $self->{plots} ); | |||||||||||||||||||
| 60 | 2 | $self->{file} = $self->{filenamebase}; | |||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 2 | return $self; | |||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | sub create_folder { | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | 2 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
create_folder: called CC=7 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||
| 69 | 2 | my $filenamebase = shift; | |||||||||||||||||||
| 70 | 2 | ▶ | my $foldername = shift || $DEFAULT_FOLDER; | ||||||||||||||||||
|
Condition33%1/3
shift() || $Lab::XPRESS::Data::XPRESS_DataFile::DEFAULT_FOLDER
MC/DC0%0/2
shift() || $Lab::XPRESS::Data::XPRESS_DataFile::DEFAULT_FOLDER
shift()
$Lab::XPRESS::Data::XPRESS_DataFile::DEFAULT_FOLDER
Truth table33%1/3
A || B
A= shift()B= $Lab::XPRESS::Data::XPRESS_DataFile::DEFAULT_FOLDER
| |||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 2 | $filenamebase =~ s/\\/\//g; | |||||||||||||||||||
| 73 | 2 | $filenamebase =~ s/\.\///g; | |||||||||||||||||||
| 74 | 2 | $filenamebase =~ s/\.\.\///g; | |||||||||||||||||||
| 75 | 2 | $filenamebase =~ s/[a-zA-Z]\:\///g; | |||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 2 | my @filename = split( /\//, $filenamebase ); | |||||||||||||||||||
| 78 | 2 | my $filename = pop(@filename); | |||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 2 | my $folder = join( '/', @filename ); | |||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | 2 | ▶ | if ( not defined $GLOBAL_FOLDER ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 83 | 2 | ▶ | if ( not -d $GLOBAL_PATH ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 84 | 0 | mkdir $GLOBAL_PATH; | |||||||||||||||||||
| 85 | } | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | # look for existing files: | ||||||||||||||||||||
| 88 | 2 | opendir( DIR, $GLOBAL_PATH ); | |||||||||||||||||||
| 89 | 2 | my @files = readdir(DIR); | |||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | 2 | my $max_index = 0; | |||||||||||||||||||
| 92 | 2 | foreach my $file (@files) { | |||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | 4 | ▶ | if ( $file =~ /($foldername)_([0-9]+)\b/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 95 | 0 | ▶ | if ( $2 > $max_index ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 96 | 0 | $max_index = $2; | |||||||||||||||||||
| 97 | } | ||||||||||||||||||||
| 98 | 0 | $max_index++; | |||||||||||||||||||
| 99 | } | ||||||||||||||||||||
| 100 | } | ||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | 2 | closedir(DIR); | |||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | 2 | $GLOBAL_PATH =~ s/\/$//; | |||||||||||||||||||
| 105 | 2 | $GLOBAL_FOLDER | |||||||||||||||||||
| 106 | = sprintf( "%s/%s_%03d", $GLOBAL_PATH, $foldername, $max_index ); | ||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | 2 | mkdir($GLOBAL_FOLDER); | |||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | 2 | copy( $0, $GLOBAL_FOLDER ); | |||||||||||||||||||
| 111 | |||||||||||||||||||||
| 112 | 2 | $self->create_InfoFile(); | |||||||||||||||||||
| 113 | } | ||||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | 2 | my $folder = $GLOBAL_FOLDER . "/" . $folder; | |||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | 2 | return $folder . "/" . $filename; | |||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | } | ||||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | sub create_InfoFile { | ||||||||||||||||||||
| 122 | 2 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
create_InfoFile: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | 2 | ▶ | open( my $LOG, ">" . $GLOBAL_FOLDER . "/Config.txt" ) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 125 | or die "cannot open Config.txt"; | ||||||||||||||||||||
| 126 | 2 | print $LOG "Instrument Configuration\n"; | |||||||||||||||||||
| 127 | 2 | print $LOG "-" x 100, "\n\n"; | |||||||||||||||||||
| 128 | 2 | print $LOG $self->timestamp(), "\n"; | |||||||||||||||||||
| 129 | 2 | print $LOG "-" x 100, "\n\n"; | |||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | 2 | foreach my $instrument ( @{Lab::Instrument::REGISTERED_INSTRUMENTS} ) { | |||||||||||||||||||
| 132 | 2 | print $LOG $instrument->get_id() . " ( " | |||||||||||||||||||
| 133 | . $instrument->get_name() | ||||||||||||||||||||
| 134 | . " )", "\n\n"; | ||||||||||||||||||||
| 135 | 2 | print $LOG $instrument->sprint_config(), "\n"; | |||||||||||||||||||
| 136 | 2 | print $LOG "-" x 100, "\n\n"; | |||||||||||||||||||
| 137 | } | ||||||||||||||||||||
| 138 | |||||||||||||||||||||
| 139 | } | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | # ------------------------------- CONFIG --------------------------------------------------------- | ||||||||||||||||||||
| 142 | sub add_measurement { | ||||||||||||||||||||
| 143 | 2 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
add_measurement: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 144 | 2 | my $methode = shift; | |||||||||||||||||||
| 145 | |||||||||||||||||||||
| 146 | 2 | my $name = "measurement"; | |||||||||||||||||||
| 147 | 2 | $self->{measurement} = $methode; | |||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | 2 | my $package = ref($self) . "_" . $counter++; | |||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | 8 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 152 | 2 | *{ $package . "::" . $name } = $methode; | |||||||||||||||||||
| 153 | 2 | @{ $package . '::ISA' } = ( ref($self) ); | |||||||||||||||||||
| 154 | 2 | bless $self, $package; | |||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | 2 | return $self; | |||||||||||||||||||
| 157 | } | ||||||||||||||||||||
| 158 | |||||||||||||||||||||
| 159 | sub add_header { | ||||||||||||||||||||
| 160 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
add_header: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 161 | 0 | my $header = shift; | |||||||||||||||||||
| 162 | |||||||||||||||||||||
| 163 | 0 | ▶ | if ( not defined $header ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 164 | 0 | return $self->{HEADER}; | |||||||||||||||||||
| 165 | } | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 0 | my @header = split( /\n/, $header ); | |||||||||||||||||||
| 168 | 0 | foreach (@header) { | |||||||||||||||||||
| 169 | 0 | $self->{HEADER} .= "#HEADER#\t" . $_ . "\n"; | |||||||||||||||||||
| 170 | } | ||||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | 0 | return $self; | |||||||||||||||||||
| 173 | } | ||||||||||||||||||||
| 174 | |||||||||||||||||||||
| 175 | sub add_config { | ||||||||||||||||||||
| 176 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
add_config: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 177 | 0 | my $config = shift; | |||||||||||||||||||
| 178 | |||||||||||||||||||||
| 179 | 0 | ▶ | if ( not defined $config ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 180 | 0 | return $self->{CONFIG}; | |||||||||||||||||||
| 181 | } | ||||||||||||||||||||
| 182 | |||||||||||||||||||||
| 183 | 0 | my @config = split( /\n/, $config ); | |||||||||||||||||||
| 184 | 0 | foreach (@config) { | |||||||||||||||||||
| 185 | 0 | $self->{HEADER} .= "#CONFIG#\t" . $_ . "\n"; | |||||||||||||||||||
| 186 | } | ||||||||||||||||||||
| 187 | |||||||||||||||||||||
| 188 | 0 | return $self; | |||||||||||||||||||
| 189 | } | ||||||||||||||||||||
| 190 | |||||||||||||||||||||
| 191 | sub add_column { | ||||||||||||||||||||
| 192 | 15 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
add_column: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 193 | 15 | my $col = shift; | |||||||||||||||||||
| 194 | |||||||||||||||||||||
| 195 | 15 | ▶ | if ( eval "return exists &Lab::XPRESS::Sweep::$col;" ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 196 | 0 | Lab::Exception::Warning->throw( | |||||||||||||||||||
| 197 | "$col is not an alowed column name. Sorry. \n"); | ||||||||||||||||||||
| 198 | } | ||||||||||||||||||||
| 199 | |||||||||||||||||||||
| 200 | 15 | ▶ | if ( not defined $col ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 201 | 11 | return $self->{COLUMNS}; | |||||||||||||||||||
| 202 | } | ||||||||||||||||||||
| 203 | |||||||||||||||||||||
| 204 | $self->{COLUMN_NAMES}{$col} | ||||||||||||||||||||
| 205 | 4 | = scalar( keys %{ $self->{COLUMN_NAMES} } ) + 1; | |||||||||||||||||||
| 206 | 4 | push( @{ $self->{COLUMNS} }, $col ); | |||||||||||||||||||
| 207 | 4 | $self->{NUMBER_OF_COLUMNS} += 1; | |||||||||||||||||||
| 208 | 4 | $self->{logger}->{COLUMN_NAMES} = $self->{COLUMN_NAMES}; | |||||||||||||||||||
| 209 | 4 | $self->{logger}->{NUMBER_OF_COLUMNS} = $self->{NUMBER_OF_COLUMNS}; | |||||||||||||||||||
| 210 | 4 | return $self; | |||||||||||||||||||
| 211 | } | ||||||||||||||||||||
| 212 | |||||||||||||||||||||
| 213 | sub add_plot { | ||||||||||||||||||||
| 214 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
add_plot: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 215 | 0 | my $plot; | |||||||||||||||||||
| 216 | |||||||||||||||||||||
| 217 | 0 | ▶ | if ( ref( @_[0] ) eq 'HASH' ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 218 | 0 | $plot = @_[0]; | |||||||||||||||||||
| 219 | } | ||||||||||||||||||||
| 220 | else { | ||||||||||||||||||||
| 221 | 0 | $plot = shift; | |||||||||||||||||||
| 222 | } | ||||||||||||||||||||
| 223 | |||||||||||||||||||||
| 224 | 0 | ▶ | if ( not defined $plot->{'autosave'} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 225 | 0 | $plot->{'autosave'} = 'last'; | |||||||||||||||||||
| 226 | } | ||||||||||||||||||||
| 227 | 0 | push( @{ $self->{plots} }, $plot ); | |||||||||||||||||||
| 228 | $self->{logger}->{COLUMN_NAMES} | ||||||||||||||||||||
| 229 | 0 | = $self->{COLUMN_NAMES}; # refresh logger->column_names | |||||||||||||||||||
| 230 | 0 | my $plot_copy = dclone( \%{$plot} ); | |||||||||||||||||||
| 231 | 0 | $self->{logger}->add_plots($plot_copy); | |||||||||||||||||||
| 232 | 0 | $self->{plot_count}++; | |||||||||||||||||||
| 233 | |||||||||||||||||||||
| 234 | 0 | return $self; | |||||||||||||||||||
| 235 | } | ||||||||||||||||||||
| 236 | |||||||||||||||||||||
| 237 | sub open_logger { | ||||||||||||||||||||
| 238 | 2 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
open_logger: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 239 | 2 | my $filenamebase = shift; | |||||||||||||||||||
| 240 | 2 | my $plots = shift; | |||||||||||||||||||
| 241 | |||||||||||||||||||||
| 242 | 2 | my $plots_copy = []; | |||||||||||||||||||
| 243 | |||||||||||||||||||||
| 244 | 2 | ▶ | if ( defined $plots ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 245 | 2 | my $plots_copy = dclone($plots); | |||||||||||||||||||
| 246 | } | ||||||||||||||||||||
| 247 | |||||||||||||||||||||
| 248 | $self->{logger} | ||||||||||||||||||||
| 249 | 2 | = new Lab::XPRESS::Data::XPRESS_logger( $filenamebase, $plots_copy ); | |||||||||||||||||||
| 250 | 2 | $self->{logger}->{COLUMN_NAMES} = $self->{COLUMN_NAMES}; | |||||||||||||||||||
| 251 | } | ||||||||||||||||||||
| 252 | |||||||||||||||||||||
| 253 | sub change_filenamebase { | ||||||||||||||||||||
| 254 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
change_filenamebase: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 255 | 0 | my $filenamebase = shift; | |||||||||||||||||||
| 256 | 0 | ▶ | if ( not $filenamebase =~ /\// ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 257 | 0 | $filenamebase = "./" . $filenamebase; | |||||||||||||||||||
| 258 | } | ||||||||||||||||||||
| 259 | |||||||||||||||||||||
| 260 | #$self->{filenamebase} = $filenamebase; | ||||||||||||||||||||
| 261 | |||||||||||||||||||||
| 262 | 0 | my $old_file = $self->{logger}->{filename}; | |||||||||||||||||||
| 263 | 0 | my $old_directory = $self->{logger}->{directory}; | |||||||||||||||||||
| 264 | |||||||||||||||||||||
| 265 | 0 | delete $self->{logger}; | |||||||||||||||||||
| 266 | 0 | $self->{LOG_STARTED} = 0; | |||||||||||||||||||
| 267 | |||||||||||||||||||||
| 268 | 0 | ▶ | if ( -z $old_file ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 269 | 0 | unlink $old_file; | |||||||||||||||||||
| 270 | } | ||||||||||||||||||||
| 271 | |||||||||||||||||||||
| 272 | 0 | $self->open_logger($filenamebase); | |||||||||||||||||||
| 273 | 0 | $self->{file} = $self->{logger}->{filename}; | |||||||||||||||||||
| 274 | |||||||||||||||||||||
| 275 | 0 | $self->{logger}->{COLUMN_NAMES} = $self->{COLUMN_NAMES}; | |||||||||||||||||||
| 276 | 0 | $self->{logger}->{NUMBER_OF_COLUMNS} = $self->{NUMBER_OF_COLUMNS}; | |||||||||||||||||||
| 277 | |||||||||||||||||||||
| 278 | 0 | my $plots_copy = dclone( $self->{plots} ); | |||||||||||||||||||
| 279 | 0 | $self->{logger}->add_plots($plots_copy); | |||||||||||||||||||
| 280 | |||||||||||||||||||||
| 281 | } | ||||||||||||||||||||
| 282 | |||||||||||||||||||||
| 283 | sub start_log { | ||||||||||||||||||||
| 284 | 2 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
start_log: called CC=4 SCAR=14.9
Pod
undocumented
| |||||||||||||||||||||
| 285 | |||||||||||||||||||||
| 286 | 2 | ▶ | if ( defined $self->{HEADER} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 287 | 0 | chomp $self->{HEADER}; | |||||||||||||||||||
| 288 | 0 | $self->{logger}->LOG( $self->{HEADER} ); | |||||||||||||||||||
| 289 | } | ||||||||||||||||||||
| 290 | 2 | ▶ | if ( defined $self->{CONFIG} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 291 | 0 | $self->{logger}->LOG( $self->{CONFIG} ); | |||||||||||||||||||
| 292 | } | ||||||||||||||||||||
| 293 | 2 | ▶ | if ( defined @{ $self->{COLUMNS} }[0] ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 294 | 2 | my $columns = $DEFAULT_HEADER; | |||||||||||||||||||
| 295 | 2 | $columns .= join( "\t", @{ $self->{COLUMNS} } ); | |||||||||||||||||||
| 296 | |||||||||||||||||||||
| 297 | 2 | $self->{logger}->LOG($columns); | |||||||||||||||||||
| 298 | } | ||||||||||||||||||||
| 299 | 2 | $self->{LOG_STARTED} = 1; | |||||||||||||||||||
| 300 | 2 | return $self; | |||||||||||||||||||
| 301 | } | ||||||||||||||||||||
| 302 | |||||||||||||||||||||
| 303 | sub start_block { | ||||||||||||||||||||
| 304 | 2 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
start_block: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 305 | |||||||||||||||||||||
| 306 | 2 | ▶ | if ( not $self->{LOG_STARTED} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 307 | 2 | $self->start_log(); | |||||||||||||||||||
| 308 | } | ||||||||||||||||||||
| 309 | |||||||||||||||||||||
| 310 | 2 | $self->{BLOCK_NUM} = $self->{logger}->_log_start_block(); | |||||||||||||||||||
| 311 | 2 | print "Data block $self->{BLOCK_NUM}\n"; | |||||||||||||||||||
| 312 | |||||||||||||||||||||
| 313 | 2 | $self->{loop}->{overtime} = 0; | |||||||||||||||||||
| 314 | 2 | undef $self->{loop}->{t0}; | |||||||||||||||||||
| 315 | |||||||||||||||||||||
| 316 | 2 | return 1; | |||||||||||||||||||
| 317 | |||||||||||||||||||||
| 318 | } | ||||||||||||||||||||
| 319 | |||||||||||||||||||||
| 320 | sub set_loop_interval { | ||||||||||||||||||||
| 321 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
set_loop_interval: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 322 | 0 | my $interval = shift; | |||||||||||||||||||
| 323 | |||||||||||||||||||||
| 324 | 0 | $self->{loop}->{interval} = $interval; | |||||||||||||||||||
| 325 | |||||||||||||||||||||
| 326 | 0 | return $self; | |||||||||||||||||||
| 327 | |||||||||||||||||||||
| 328 | } | ||||||||||||||||||||
| 329 | |||||||||||||||||||||
| 330 | sub end_loop { | ||||||||||||||||||||
| 331 | |||||||||||||||||||||
| 332 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
end_loop: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 333 | |||||||||||||||||||||
| 334 | 0 | $self->{loop}->{t1} = time(); | |||||||||||||||||||
| 335 | |||||||||||||||||||||
| 336 | 0 | ▶ | if ( not defined $self->{loop}->{t0} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 337 | 0 | $self->{loop}->{t0} = time(); | |||||||||||||||||||
| 338 | 0 | return 0; | |||||||||||||||||||
| 339 | } | ||||||||||||||||||||
| 340 | |||||||||||||||||||||
| 341 | my $delta_time = ( $self->{loop}->{t1} - $self->{loop}->{t0} ) | ||||||||||||||||||||
| 342 | 0 | ; # + $self->{loop}->{overtime}; | |||||||||||||||||||
| 343 | 0 | ▶ | if ( $delta_time > $self->{loop}->{interval} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 344 | 0 | $self->{loop}->{overtime} = $delta_time - $self->{loop}->{interval}; | |||||||||||||||||||
| 345 | 0 | $delta_time = $self->{loop}->{interval}; | |||||||||||||||||||
| 346 | 0 | warn | |||||||||||||||||||
| 347 | "WARNING: Measurement Loop takes more time ($self->{loop}->{overtime}) than specified by measurement interval ($self->{loop}->{interval}).\n"; | ||||||||||||||||||||
| 348 | } | ||||||||||||||||||||
| 349 | else { | ||||||||||||||||||||
| 350 | 0 | $self->{loop}->{overtime} = 0; | |||||||||||||||||||
| 351 | } | ||||||||||||||||||||
| 352 | 0 | usleep( ( $self->{loop}->{interval} - $delta_time ) * 1e6 ); | |||||||||||||||||||
| 353 | 0 | $self->{loop}->{t0} = time(); | |||||||||||||||||||
| 354 | 0 | return $delta_time; | |||||||||||||||||||
| 355 | |||||||||||||||||||||
| 356 | } | ||||||||||||||||||||
| 357 | |||||||||||||||||||||
| 358 | sub timestamp { | ||||||||||||||||||||
| 359 | |||||||||||||||||||||
| 360 | 2 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
timestamp: called CC=6 SCAR=18.7
Pod
undocumented
| |||||||||||||||||||||
| 361 | my ( | ||||||||||||||||||||
| 362 | 2 | $Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, | |||||||||||||||||||
| 363 | $Jahr, $Wochentag, $Jahrestag, $Sommerzeit | ||||||||||||||||||||
| 364 | ) = localtime(time); | ||||||||||||||||||||
| 365 | |||||||||||||||||||||
| 366 | 2 | $Monat += 1; | |||||||||||||||||||
| 367 | 2 | $Jahrestag += 1; | |||||||||||||||||||
| 368 | 2 | ▶ | $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 369 | 2 | ▶ | $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 370 | 2 | ▶ | $Stunden = $Stunden < 10 ? $Stunden = "0" . $Stunden : $Stunden; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 371 | 2 | ▶ | $Minuten = $Minuten < 10 ? $Minuten = "0" . $Minuten : $Minuten; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 372 | 2 | ▶ | $Sekunden = $Sekunden < 10 ? $Sekunden = "0" . $Sekunden : $Sekunden; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 373 | 2 | $Jahr += 1900; | |||||||||||||||||||
| 374 | |||||||||||||||||||||
| 375 | 2 | return "$Stunden:$Minuten:$Sekunden $Monatstag.$Monat.$Jahr\n"; | |||||||||||||||||||
| 376 | |||||||||||||||||||||
| 377 | } | ||||||||||||||||||||
| 378 | |||||||||||||||||||||
| 379 | sub finish_measurement { | ||||||||||||||||||||
| 380 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
finish_measurement: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 381 | |||||||||||||||||||||
| 382 | 0 | my $num_of_plots = @{ $self->{logger}->{plots} }; | |||||||||||||||||||
| 383 | 0 | ▶ | for ( my $i = 0; $i < $num_of_plots; $i++ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 384 | |||||||||||||||||||||
| 385 | # close gnuplot-pipe: | ||||||||||||||||||||
| 386 | 0 | $self->{logger}->{plots}->[$i]->{plotter}->_stop_live_plot(); | |||||||||||||||||||
| 387 | } | ||||||||||||||||||||
| 388 | |||||||||||||||||||||
| 389 | 0 | $self = $self->{logger}->close_file(); | |||||||||||||||||||
| 390 | |||||||||||||||||||||
| 391 | 0 | delete $self->{logger}; | |||||||||||||||||||
| 392 | 0 | return $self; | |||||||||||||||||||
| 393 | } | ||||||||||||||||||||
| 394 | |||||||||||||||||||||
| 395 | sub save_plot { | ||||||||||||||||||||
| 396 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
save_plot: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||
| 397 | 0 | my $plot_index = shift; | |||||||||||||||||||
| 398 | 0 | my $type = shift; | |||||||||||||||||||
| 399 | 0 | my $filename = shift; | |||||||||||||||||||
| 400 | |||||||||||||||||||||
| 401 | 0 | ▶ | if ( not defined $plot_index ) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 402 | 0 | $plot_index = 0; | |||||||||||||||||||
| 403 | } | ||||||||||||||||||||
| 404 | 0 | elsif ( $plot_index > ( my $num_plots = @{ $self->{logger}->{plots} } ) ) | |||||||||||||||||||
| 405 | { | ||||||||||||||||||||
| 406 | 0 | warn "defined plotnumber $plot_index doesn't exist."; | |||||||||||||||||||
| 407 | } | ||||||||||||||||||||
| 408 | |||||||||||||||||||||
| 409 | 0 | ▶ | if ( not defined $filename ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 410 | |||||||||||||||||||||
| 411 | # create filename for saving plot as eps-file: | ||||||||||||||||||||
| 412 | 0 | $filename = $self->{logger}->{filename}; | |||||||||||||||||||
| 413 | 0 | $filename =~ /(.+)\.(.+)\b/; | |||||||||||||||||||
| 414 | 0 | $filename = sprintf( "%s_%02d", $1, $plot_index + 1 ); | |||||||||||||||||||
| 415 | } | ||||||||||||||||||||
| 416 | |||||||||||||||||||||
| 417 | 0 | ▶ | if ( not defined $type ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 418 | 0 | $type = 'png'; | |||||||||||||||||||
| 419 | } | ||||||||||||||||||||
| 420 | |||||||||||||||||||||
| 421 | 0 | $self->{logger}->{plots}->[$plot_index]->{plotter}->replot(); | |||||||||||||||||||
| 422 | $self->{logger}->{plots}->[$plot_index]->{plotter} | ||||||||||||||||||||
| 423 | 0 | ->save_plot( $type, $filename ); | |||||||||||||||||||
| 424 | |||||||||||||||||||||
| 425 | 0 | return $self; | |||||||||||||||||||
| 426 | |||||||||||||||||||||
| 427 | } | ||||||||||||||||||||
| 428 | |||||||||||||||||||||
| 429 | sub LOG { | ||||||||||||||||||||
| 430 | 44 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
LOG: called CC=4 SCAR=16.8
Pod
undocumented
| |||||||||||||||||||||
| 431 | |||||||||||||||||||||
| 432 | 44 | ▶ | if ( $self->{skiplog} == 1 ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 433 | 0 | $self->{skiplog} = 0; | |||||||||||||||||||
| 434 | 0 | return $self; | |||||||||||||||||||
| 435 | } | ||||||||||||||||||||
| 436 | |||||||||||||||||||||
| 437 | 44 | ▶ | if ( not $self->{LOG_STARTED} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 438 | 0 | $self->start_log(); | |||||||||||||||||||
| 439 | } | ||||||||||||||||||||
| 440 | |||||||||||||||||||||
| 441 | 44 | ▶ | if ( ref( $_[0] ) eq "HASH" ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 442 | 44 | $self->{logger}->LOG(@_); | |||||||||||||||||||
| 443 | } | ||||||||||||||||||||
| 444 | else { | ||||||||||||||||||||
| 445 | 0 | $self->{logger}->LOG( \@_ ); | |||||||||||||||||||
| 446 | } | ||||||||||||||||||||
| 447 | |||||||||||||||||||||
| 448 | 44 | return $self; | |||||||||||||||||||
| 449 | } | ||||||||||||||||||||
| 450 | |||||||||||||||||||||
| 451 | sub set_autolog { | ||||||||||||||||||||
| 452 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
set_autolog: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 453 | 0 | my $value = shift; | |||||||||||||||||||
| 454 | |||||||||||||||||||||
| 455 | 0 | $self->{autolog} = $value; | |||||||||||||||||||
| 456 | |||||||||||||||||||||
| 457 | 0 | return $self; | |||||||||||||||||||
| 458 | } | ||||||||||||||||||||
| 459 | |||||||||||||||||||||
| 460 | sub skiplog { | ||||||||||||||||||||
| 461 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
skiplog: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 462 | |||||||||||||||||||||
| 463 | 0 | $self->{skiplog} = 1; | |||||||||||||||||||
| 464 | |||||||||||||||||||||
| 465 | 0 | return $self; | |||||||||||||||||||
| 466 | } | ||||||||||||||||||||
| 467 | |||||||||||||||||||||
| 468 | sub gnuplot_cmd { | ||||||||||||||||||||
| 469 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
gnuplot_cmd: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 470 | 0 | my $plot_index = shift; | |||||||||||||||||||
| 471 | 0 | my $cmd = shift; | |||||||||||||||||||
| 472 | |||||||||||||||||||||
| 473 | 0 | ▶ | if ( not defined $cmd ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 474 | 0 | $cmd = $plot_index; | |||||||||||||||||||
| 475 | 0 | $plot_index = 0; | |||||||||||||||||||
| 476 | } | ||||||||||||||||||||
| 477 | |||||||||||||||||||||
| 478 | 0 | ▶ | if ( $plot_index > ( my $num_plots = @{ $self->{logger}->{plots} } ) ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 479 | 0 | warn "defined plotnumber $plot_index doesn't exist."; | |||||||||||||||||||
| 480 | } | ||||||||||||||||||||
| 481 | |||||||||||||||||||||
| 482 | 0 | $self->{logger}->{plots}->[$plot_index]->{plotter}->gnuplot_cmd($cmd); | |||||||||||||||||||
| 483 | |||||||||||||||||||||
| 484 | 0 | return $self; | |||||||||||||||||||
| 485 | |||||||||||||||||||||
| 486 | } | ||||||||||||||||||||
| 487 | |||||||||||||||||||||
| 488 | sub gnuplot_init_bindings { | ||||||||||||||||||||
| 489 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
gnuplot_init_bindings: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 490 | |||||||||||||||||||||
| 491 | 0 | foreach my $plot ( @{ $self->{logger}->{plots} } ) { | |||||||||||||||||||
| 492 | 0 | $plot->{plotter}->init_gnuplot_bindings(); | |||||||||||||||||||
| 493 | } | ||||||||||||||||||||
| 494 | |||||||||||||||||||||
| 495 | 0 | return 1; | |||||||||||||||||||
| 496 | } | ||||||||||||||||||||
| 497 | |||||||||||||||||||||
| 498 | sub gnuplot_restart { | ||||||||||||||||||||
| 499 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
gnuplot_restart: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||
| 500 | |||||||||||||||||||||
| 501 | 0 | my $i = 0; | |||||||||||||||||||
| 502 | 0 | foreach my $plot ( @{ $self->{logger}->{plots} } ) { | |||||||||||||||||||
| 503 | 0 | ▶ | if ( $plot->{plotter}->{PAUSE} < 0 ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 504 | 0 | $self->gnuplot_pause(); | |||||||||||||||||||
| 505 | } | ||||||||||||||||||||
| 506 | |||||||||||||||||||||
| 507 | 0 | my $gpipe = $plot->{plotter}->{gpipe}; | |||||||||||||||||||
| 508 | 0 | ▶ | if ( not defined $gpipe ) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 509 | $plot->{plotter} = new Lab::XPRESS::Data::XPRESS_plotter( | ||||||||||||||||||||
| 510 | 0 | $self->{logger}->{filename}, $plot ); | |||||||||||||||||||
| 511 | 0 | $plot->{plotter}->{ID} = $i; | |||||||||||||||||||
| 512 | 0 | $plot->{plotter}->{FILENAME} = $self->{logger}->{filename}; | |||||||||||||||||||
| 513 | $plot->{plotter}->{COLUMN_NAMES} | ||||||||||||||||||||
| 514 | 0 | = $self->{logger}->{COLUMN_NAMES}; | |||||||||||||||||||
| 515 | } | ||||||||||||||||||||
| 516 | elsif ( not( my $result = print $gpipe "" ) ) { | ||||||||||||||||||||
| 517 | $plot->{plotter} = new Lab::XPRESS::Data::XPRESS_plotter( | ||||||||||||||||||||
| 518 | 0 | $self->{logger}->{filename}, $plot ); | |||||||||||||||||||
| 519 | 0 | $plot->{plotter}->{ID} = $i; | |||||||||||||||||||
| 520 | 0 | $plot->{plotter}->{FILENAME} = $self->{logger}->{filename}; | |||||||||||||||||||
| 521 | $plot->{plotter}->{COLUMN_NAMES} | ||||||||||||||||||||
| 522 | 0 | = $self->{logger}->{COLUMN_NAMES}; | |||||||||||||||||||
| 523 | } | ||||||||||||||||||||
| 524 | |||||||||||||||||||||
| 525 | 0 | $plot->{plotter}->init_gnuplot(); | |||||||||||||||||||
| 526 | 0 | $plot->{plotter}->init_gnuplot_bindings(); | |||||||||||||||||||
| 527 | 0 | $plot->{plotter}->start_plot( $self->{BLOCK_NUM} ); | |||||||||||||||||||
| 528 | |||||||||||||||||||||
| 529 | 0 | ▶ | if ( $plot->{plotter}->{PAUSE} > 0 ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 530 | 0 | $self->gnuplot_pause(); | |||||||||||||||||||
| 531 | } | ||||||||||||||||||||
| 532 | |||||||||||||||||||||
| 533 | 0 | $i++; | |||||||||||||||||||
| 534 | } | ||||||||||||||||||||
| 535 | |||||||||||||||||||||
| 536 | 0 | return 1; | |||||||||||||||||||
| 537 | } | ||||||||||||||||||||
| 538 | |||||||||||||||||||||
| 539 | sub gnuplot_pause { | ||||||||||||||||||||
| 540 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
gnuplot_pause: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 541 | |||||||||||||||||||||
| 542 | 0 | foreach my $plot ( @{ $self->{logger}->{plots} } ) { | |||||||||||||||||||
| 543 | 0 | $plot->{plotter}->toggle_pause(); | |||||||||||||||||||
| 544 | } | ||||||||||||||||||||
| 545 | |||||||||||||||||||||
| 546 | 0 | return 1; | |||||||||||||||||||
| 547 | } | ||||||||||||||||||||
| 548 | |||||||||||||||||||||
| 549 | sub datazone { | ||||||||||||||||||||
| 550 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
datazone: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||
| 551 | 0 | my $plot_index = shift; | |||||||||||||||||||
| 552 | 0 | my $left = shift; | |||||||||||||||||||
| 553 | 0 | my $center = shift; | |||||||||||||||||||
| 554 | 0 | my $right = shift; | |||||||||||||||||||
| 555 | |||||||||||||||||||||
| 556 | 0 | my $x_min; | |||||||||||||||||||
| 557 | my $x_max; | ||||||||||||||||||||
| 558 | 0 | my $y_min; | |||||||||||||||||||
| 559 | 0 | my $y_max; | |||||||||||||||||||
| 560 | |||||||||||||||||||||
| 561 | my %plot | ||||||||||||||||||||
| 562 | 0 | = %{ $self->{logger}->{plots}->[$plot_index]->{plotter}->{plot} }; | |||||||||||||||||||
| 563 | 0 | ▶ | if ( not defined $plot{'x-min'} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 564 | 0 | $x_min = $self->{logger}->{DATA}[ $plot{'x-axis'} - 1 ][0]; | |||||||||||||||||||
| 565 | } | ||||||||||||||||||||
| 566 | else { | ||||||||||||||||||||
| 567 | 0 | $x_min = $plot{'x-min'}; | |||||||||||||||||||
| 568 | } | ||||||||||||||||||||
| 569 | 0 | ▶ | if ( not defined $plot{'x-max'} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 570 | 0 | $x_max = $self->{logger}->{DATA}[ $plot{'x-axis'} - 1 ][1]; | |||||||||||||||||||
| 571 | } | ||||||||||||||||||||
| 572 | else { | ||||||||||||||||||||
| 573 | 0 | $x_max = $plot{'x-max'}; | |||||||||||||||||||
| 574 | } | ||||||||||||||||||||
| 575 | 0 | ▶ | if ( not defined $plot{'y-min'} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 576 | 0 | $y_min = $self->{logger}->{DATA}[ $plot{'y-axis'} - 1 ][0]; | |||||||||||||||||||
| 577 | } | ||||||||||||||||||||
| 578 | else { | ||||||||||||||||||||
| 579 | 0 | $y_min = $plot{'y-min'}; | |||||||||||||||||||
| 580 | } | ||||||||||||||||||||
| 581 | 0 | ▶ | if ( not defined $plot{'y-max'} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 582 | 0 | $y_max = $self->{logger}->{DATA}[ $plot{'y-axis'} - 1 ][1]; | |||||||||||||||||||
| 583 | } | ||||||||||||||||||||
| 584 | else { | ||||||||||||||||||||
| 585 | 0 | $y_max = $plot{'y-max'}; | |||||||||||||||||||
| 586 | } | ||||||||||||||||||||
| 587 | $self->{logger}->{plots}->[$plot_index]->{plotter} | ||||||||||||||||||||
| 588 | 0 | ->datazone( $x_min, $x_max, $y_min, $y_max, $left, $center, $right ); | |||||||||||||||||||
| 589 | |||||||||||||||||||||
| 590 | 0 | return $self; | |||||||||||||||||||
| 591 | |||||||||||||||||||||
| 592 | } | ||||||||||||||||||||
| 593 | |||||||||||||||||||||
| 594 | sub DESTROY { | ||||||||||||||||||||
| 595 | 0 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||
| 596 | 0 | ▶ | if ( $self->{writer} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 597 | 0 | $self->finish_measurement(); | |||||||||||||||||||
| 598 | } | ||||||||||||||||||||
| 599 | } | ||||||||||||||||||||
| 600 | |||||||||||||||||||||
| 601 | 8 | 1; | |||||||||||||||||||
| 602 | |||||||||||||||||||||
| 603 | __END__ | ||||||||||||||||||||
| 604 | |||||||||||||||||||||
| 605 | =pod | ||||||||||||||||||||
| 606 | |||||||||||||||||||||
| 607 | =encoding UTF-8 | ||||||||||||||||||||
| 608 | |||||||||||||||||||||
| 609 | =head1 NAME | ||||||||||||||||||||
| 610 | |||||||||||||||||||||
| 611 | Lab::XPRESS::Data::XPRESS_DataFile - XPRESS data file module | ||||||||||||||||||||
| 612 | |||||||||||||||||||||
| 613 | =head1 VERSION | ||||||||||||||||||||
| 614 | |||||||||||||||||||||
| 615 | version 3.881 | ||||||||||||||||||||
| 616 | |||||||||||||||||||||
| 617 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 618 | |||||||||||||||||||||
| 619 | This software is copyright (c) 2023 by the Lab::Measurement team; in detail: | ||||||||||||||||||||
| 620 | |||||||||||||||||||||
| 621 | Copyright 2012 Stefan Geissler | ||||||||||||||||||||
| 622 | 2013 Alois Dirnaichner, Andreas K. Huettel, Christian Butschkow, Stefan Geissler | ||||||||||||||||||||
| 623 | 2014 Christian Butschkow | ||||||||||||||||||||
| 624 | 2016 Simon Reinhardt | ||||||||||||||||||||
| 625 | 2017 Andreas K. Huettel, Simon Reinhardt | ||||||||||||||||||||
| 626 | 2020 Andreas K. Huettel, Simon Reinhardt | ||||||||||||||||||||
| 627 | |||||||||||||||||||||
| 628 | |||||||||||||||||||||
| 629 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 630 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 631 | |||||||||||||||||||||
| 632 | =cut | ||||||||||||||||||||