From 01e0aaa8335499d78dcb4f4f093b09201e6ba9ad Mon Sep 17 00:00:00 2001 From: Michael Lam Date: Sun, 24 Jan 2021 23:31:48 -0500 Subject: [PATCH] getWeff raises error if no period is set --- pypulse/singlepulse.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pypulse/singlepulse.py b/pypulse/singlepulse.py index db1a94a..7faa37a 100644 --- a/pypulse/singlepulse.py +++ b/pypulse/singlepulse.py @@ -148,12 +148,12 @@ def getFW(self, value=0.5, simple=False, timeunits=True): factor = self.getPeriod()/self.getNbins() return factor*dbin - def getWeff(self, fourier=False, sumonly=False, timeunits=True): + def getWeff(self, fourier=False, sumonly=False): """ Calculate the effective width of the pulse """ - if not timeunits or self.getPeriod() is None: - return None + if self.getPeriod() is None: + raise ValueError("Cannot calculate Weff; period is not set") P = self.getPeriod() N = self.getNbins() U = u.normalize(self.data, simple=True) #remove baseline?