=head1 $a = interval( $source, $interval, $number_bins) Calculates inter-event interval histogram of the source (arrayref). The $interval gives the maximum inter-event interval that should be counted. The $number_bins denotes the number of bins of the interval. =cut $PDL = <<'_PDL'; _interval_ extract arguments prepare return empty histogram unless the source has more than two items get the first item of the series as a reference walk over series assign current item to reference calculate difference between item and reference add the buffer to the histogram return the histogram _PDL sub interval { my $source = shift; my $interval = shift; my $interval_bins = shift; my @times = @$source; my $start_time = $times[0]; my @interval_histo = (0) x $interval_bins; return \@interval_histo unless scalar(@times)>1; my $prev = shift @times; my @buff = map { my $time = $_ - $prev; $prev = $_; $time} @times; buffer2histo( \@buff, \@interval_histo, 0, $interval, $interval_bins ) if scalar @buff; \@interval_histo; }