Skip to content

Commit

Permalink
add debug flag to getDynamicSpectrum()
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlam committed Jul 17, 2020
1 parent 0fc4e85 commit 8d5d93b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pypulse/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,8 @@ def fitPulses(self, template, nums, flatten=False, func=None, windowsize=None, *
#just bscrunch this?
def getDynamicSpectrum(self, window=None, template=None, mpw=None,
align=None, windowsize=None, weight=True,
verbose=False, snr=False, maketemplate=False):
verbose=False, snr=False, maketemplate=False,
debug=False):
"""
Return the dynamic spectrum
window: return the dynamic spectrum using only a certain phase bins
Expand Down Expand Up @@ -1241,7 +1242,7 @@ def getDynamicSpectrum(self, window=None, template=None, mpw=None,
if windowsize >= len(sptemp.data):
raise IndexError("Improper window size")
sptemp = SP.SinglePulse(sptemp.data, windowsize=windowsize)

gs = np.zeros((fullshape[0], fullshape[2]))
offs = np.zeros((fullshape[0], fullshape[2]))
sig_gs = np.zeros((fullshape[0], fullshape[2]))
Expand Down Expand Up @@ -1275,11 +1276,11 @@ def getDynamicSpectrum(self, window=None, template=None, mpw=None,
sp = SP.SinglePulse(data[i, j], opw=sptemp.opw, align=align)
baseline = sp.getOffpulseNoise(mean=True) #get mean value of offpulse
spfit = sp.fitPulse(sptemp.data)
#if spfit is None:
# print i,j, np.shape(data)
# plt.plot(data[i,j])
# plt.show()
# raise SystemExit
if spfit is None and debug:
print i,j, np.shape(data)
plt.plot(data[i,j])
plt.show()
#raise SystemExit
if spfit is not None:
gs[i, j] = spfit[ind] #bhat
offs[i, j] = baseline
Expand Down

0 comments on commit 8d5d93b

Please sign in to comment.