Skip to content

Commit

Permalink
Merge pull request #200 from remsforian/master
Browse files Browse the repository at this point in the history
Debugging the pulsar injector
  • Loading branch information
scottransom authored Jun 22, 2024
2 parents 7281fa5 + ee14b29 commit 80cbda4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/presto/injectpsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Patrick Lazarus, June 26, 2012
"""
from __future__ import print_function
from builtins import zip
from builtins import object
import sys
Expand Down Expand Up @@ -222,6 +223,8 @@ def smear(self, smearphs, delayphs=0, npts=4096):
Output:
smeared: The smeared Profile.
"""

# todo: (gijs) bug, scatterphs not defined
if smearphs < 0:
raise ValueError("Amount of phase to smear by (%g) " \
"cannot be negative!" % scatterphs)
Expand Down Expand Up @@ -884,7 +887,7 @@ def inject(infile, outfn, prof, period, dm, nbitsout=None,

# Loop over data
lobin = 0
spectra = fil.get_spectra(0, block_size)
spectra = fil.get_spectra(0, block_size).data.T
numread = spectra.shape[0]
while numread:
if pulsar_only:
Expand All @@ -898,8 +901,8 @@ def inject(infile, outfn, prof, period, dm, nbitsout=None,
phases = get_phases(times)
profvals = prof(phases)
shape = list(profvals.shape)
shape[1:1] = [NINTEG_PER_BIN]
shape[0] /= NINTEG_PER_BIN
shape[1:1] = [NINTEG_PER_BIN] # these next lines add a new axis=1
shape[0] //= NINTEG_PER_BIN
profvals.shape = shape
toinject = profvals.mean(axis=1)
#toinject = profvals
Expand All @@ -922,7 +925,7 @@ def inject(infile, outfn, prof, period, dm, nbitsout=None,

# Prepare for next iteration
lobin = hibin
spectra = fil.get_spectra(lobin, lobin+block_size)
spectra = fil.get_spectra(lobin, block_size).data.T
numread = spectra.shape[0]

sys.stdout.write("Done \n")
Expand Down

0 comments on commit 80cbda4

Please sign in to comment.