Menu

#57 Different values of -S to dspsr wipe giant pulses from output

version_1.0
open
nobody
None
5
2014-12-09
2014-12-08
No

Running dspsr with different values of -S causes giant pulses to "disappear".

Consider the analysis of a 200-second file of the Crab pulsar containing a giant pulse that is (according to dspsr) 184.154s into the file:


Step 1: Make directories for the single pulse archivesw

mkdir /data_02/hknight/0534/20130925A/testbed/example1
mkdir /data_02/hknight/0534/20130925A/testbed/example2


Step 2: Create single pulse archives with no '-S' (zero skip)

cd /data_02/hknight/0534/20130925A/testbed/example1

~/astro/dspsr/Signal/Pulsar/dspsr -b 256 -N J0534+2200 -s -K ~/data/fitsfiles/J0534+2200/20130925A/20130925A_0006.fits


Step 3: Create single pulse archives with '-S 100' (skip 100 seconds)

cd /data_02/hknight/0534/20130925A/testbed/example2

~/astro/dspsr/Signal/Pulsar/dspsr -b 256 -N J0534+2200 -s -K ~/data/fitsfiles/J0534+2200/20130925A/20130925A_0006.fits -S 100

Step 4: Check the start time of the GP archive

cd ..

vap -R -c MJD example?/pulse_42856338228.ar
filename MJD
example1/pulse_42856338228.ar 56559.854724
example2/pulse_42856338228.ar 56559.854724


Step 5: Inquire the maximum flux of the GP archive

vap2 -R --max_flux 8 example1/pulse_42856338228.ar example2/pulse_42856338228.ar | format
FILE max_flux
example1/pulse_42856338228.ar 0.0197926
example2/pulse_42856338228.ar 0.184013

The threshold for being a GP is approximately 0.04; this pulse goes from being a GP to being noise.

Running vap2 to inquire the maximum flux of all the pulse archives shows the GP is (a) not in a nearby pulse window nor (b) in any pulse. It does however, yield an allegedly different GP of similar strength in archive pulse_42856335260.ar:

Top 5 pulses: (note that GPs are so scattered they get spread into 2 pulses):

example1/pulse_42856336820.ar 0.0418854
example1/pulse_42856335259.ar 0.0466003
example2/pulse_42856338229.ar 0.0676422
example1/pulse_42856335260.ar 0.177853
example2/pulse_42856338228.ar 0.184013

vap -R -c MJD example1/pulse_42856335260.ar example2/pulse_42856338228.ar | awk '{print $1,($2-56559.852592592594360)*86400}'

example1/pulse_42856335260.ar 84.1888
example2/pulse_42856338228.ar 184.154

So the first GP is about 84.2s after the start of the file; the second GP is about 184.2s after the start of the file.

These numbers are suspiciously similar (approximately offset by 100s, the same offset used for -S).

It is as if 'dspsr -S' is causing the timestamps of the pulses to be offset but the same data to be fed in.

Discussion

  • Haydon Knight

    Haydon Knight - 2014-12-08

    Investigating at other skip factors yields:

    skip GP_archive max_flux offset
    0 skip0/pulse_42856335260.ar 0.177853 84.1888
    20 skip20/pulse_42856335853.ar 0.19393 104.147
    40 skip40/pulse_42856336447.ar 0.203661 124.106
    60 skip60/pulse_42856337041.ar 0.180002 144.15
    80 skip80/pulse_42856337635.ar 0.192757 164.109
    100 skip100/pulse_42856338228.ar 0.184013 184.154

    Here 'offset' is the number of seconds the MJD of the GP archive is past the start of the input data file.

    Clearly (a) the same GP is being found over and over; (b) it is being placed in archives with the wrong MJD

    At skip factors of 120s+ the GP is not found (For '-S 120' only 80s of data is processed so the GP is not found).

    Clearly 'dspsr -S' does not work.

     
  • Haydon Knight

    Haydon Knight - 2014-12-09

    The problem seems to be with the FITSFile loader - no capability to seek (i.e. change the current_byte counter) was built in. Adding in "seek_bytes" and "seek" functions appears to fix the problem.

    Here is the code I used (I don't think the return value to seek_bytes is right but it seems to work):

    //! Override File::seek_bytes
    int64_t dsp::FITSFile::seek_bytes (uint64_t bytes)
    {
    // Do nothing as FITS does not need to adjust its file descriptor

    // Not sure what to return so return 0
    return 0;
    }

    //! Override Input::seek
    void dsp::FITSFile::seek (int64_t offset, int whence)
    {
    const unsigned nchan = get_info()->get_nchan();
    const unsigned npol = get_info()->get_npol();
    const unsigned nbit = get_info()->get_nbit();

    if( nchannpolnbit % 8 )
    throw Error(InvalidState,"dsp::FITSFile::seek",
    "nchannpolnbit (%d bits) is not a whole number of bytes, so cannot seek for this mode of data",
    nchannpolnbit);

    const unsigned bytes_per_sample = (nchannpolnbit) / 8;

    // Adjust current_row and byte_offset depending on next sample to read.
    uint64_t next_sample = current_byte / bytes_per_sample;

    switch (whence) {

    case SEEK_SET:
    if (offset < 0)
    throw Error (InvalidRange, "dsp::FITSFile::seek", "SEEK_SET -ve offset");
    next_sample = offset;
    break;

    case SEEK_CUR:
    if (offset < -(int64_t)next_sample)
    throw Error (InvalidRange, "dsp::Input::seek", "SEEK_CUR -ve "
    "not allowed");
    next_sample += offset;
    break;

    case SEEK_END:
    if (!get_info()->get_ndat())
    throw Error (InvalidState, "dsp::FITSFile::seek", "SEEK_END unknown eod");

    if (offset < -int64_t(get_info()->get_ndat()))
      throw Error (InvalidRange, "dsp::FITSFile::seek", "SEEK_END -ve offset");
    
    next_sample = get_info()->get_ndat() + offset;
    break;
    

    default:
    throw Error (InvalidParam, "dsp::FITSFile::seek", "invalid whence");
    }

    current_byte += next_sample * bytes_per_sample;
    }

     
  • Haydon Knight

    Haydon Knight - 2014-12-09

    Now I seem to get dspsr repeating the message:

    Tempo2::Predictor::phase epoch=56559.8 frequency=192.64

    and running very slowly. Standard dspsr takes about 8.2s to fold 5s of data; new dspsr takes at least a very long time (> 6minutes) although it may be in an infinite loop.

     

Log in to post a comment.