Skip to content

Commit

Permalink
Pass is_integrated flag to SourceTime constructor (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHogan authored and stevengj committed Dec 19, 2018
1 parent d0a9dd1 commit 5be326d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions python/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def __init__(self, is_integrated=False):
class ContinuousSource(SourceTime):

def __init__(self, frequency=None, start_time=0, end_time=1.0e20, width=0,
fwidth=float('inf'), cutoff=3.0, wavelength=None):
fwidth=float('inf'), cutoff=3.0, wavelength=None, **kwargs):

if frequency is None and wavelength is None:
raise ValueError("Must set either frequency or wavelength in {}.".format(self.__class__.__name__))

super(ContinuousSource, self).__init__()
super(ContinuousSource, self).__init__(**kwargs)
self.frequency = 1 / wavelength if wavelength else float(frequency)
self.start_time = start_time
self.end_time = end_time
Expand All @@ -52,11 +52,12 @@ def __init__(self, frequency=None, start_time=0, end_time=1.0e20, width=0,

class GaussianSource(SourceTime):

def __init__(self, frequency=None, width=0, fwidth=float('inf'), start_time=0, cutoff=5.0, wavelength=None):
def __init__(self, frequency=None, width=0, fwidth=float('inf'), start_time=0, cutoff=5.0, wavelength=None,
**kwargs):
if frequency is None and wavelength is None:
raise ValueError("Must set either frequency or wavelength in {}.".format(self.__class__.__name__))

super(GaussianSource, self).__init__()
super(GaussianSource, self).__init__(**kwargs)
self.frequency = 1 / wavelength if wavelength else float(frequency)
self.width = max(width, 1 / fwidth)
self.start_time = start_time
Expand All @@ -68,8 +69,8 @@ def __init__(self, frequency=None, width=0, fwidth=float('inf'), start_time=0, c

class CustomSource(SourceTime):

def __init__(self, src_func, start_time=-1.0e20, end_time=1.0e20):
super(CustomSource, self).__init__()
def __init__(self, src_func, start_time=-1.0e20, end_time=1.0e20, **kwargs):
super(CustomSource, self).__init__(**kwargs)
self.src_func = src_func
self.start_time = start_time
self.end_time = end_time
Expand Down

0 comments on commit 5be326d

Please sign in to comment.