I'm trying to simulate the effects of spectral pileup in a detector.  
Incoming event are transformed into a pseudo-Gaussian shaped signal
(f(t)).  If two or more events occur too close together their signals
overlap.

As a prototype I thought I could use the range operator to construct
views onto a piddle that would allow me to easily add overlapping
signals.

For example, given

        $ph : the signal function with dimension [$nsample]
        $t:   the arrival time of events with dimension [$nevents]
        $buffer: the coadded signals
        
Then

        $bp = $buffer->range($t->transpose,$nsample)->transpose;

is a set of $nsample windows onto $buffer, some of which may overlap.
Theoretically I could then perform

        $bp += $ph

and $buffer would contain the coadded signals.  Alas, this doesn't seem
to work.  Here's an abstracted example

        $z = xvals(20);
        $v = $z->range( pdl( 1,8 )->transpose, 9 )->transpose;
        
        p $z
        [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19]
        
        p $v
        
        [
         [ 1  2  3  4  5  6  7  8  9]
         [ 8  9 10 11 12 13 14 15 16]
        ]

So, $v is a set of two overlapping windows onto $z.  But,
          
        $v += 1;
        
        p $v
        
        [
         [ 2  3  4  5  6  7  8  9 10]
         [ 9 10 11 12 13 14 15 16 17]
        ]
        
        p $z
        [0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 17 18 19]
        
The addition is only done once per element in $z, not once per element
in $v. I expected $v to look like this:

        [
         [ 2  3  4  5  6  7  8 10 11]
         [10 11 11 12 13 14 15 16 17]
        ]
        
and thus for $z to look like this
        
        [0 2 3 4 5 6 7 8 10 11 11 12 13 14 15 16 17 17 18 19]
        

Bug or feature?

Thanks,

Diab



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to