Skip to content

Commit 4a8691f

Browse files
committed
Apply mutable decorator to sources, delay, spectrum, FIR, converters, samplehold
1 parent bc1c62e commit 4a8691f

6 files changed

Lines changed: 20 additions & 2 deletions

File tree

src/pathsim/blocks/converters.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
from ._block import Block
1313
from ..utils.register import Register
1414
from ..events.schedule import Schedule
15+
from ..utils.mutable import mutable
1516

1617

1718
# MIXED SIGNAL BLOCKS ===================================================================
1819

20+
@mutable
1921
class ADC(Block):
2022
"""Models an ideal Analog-to-Digital Converter (ADC).
2123
@@ -104,6 +106,7 @@ def __len__(self):
104106
return 0
105107

106108

109+
@mutable
107110
class DAC(Block):
108111
"""Models an ideal Digital-to-Analog Converter (DAC).
109112

src/pathsim/blocks/delay.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
from ._block import Block
1313

1414
from ..utils.adaptivebuffer import AdaptiveBuffer
15+
from ..utils.mutable import mutable
1516

1617

1718
# BLOCKS ================================================================================
1819

20+
@mutable
1921
class Delay(Block):
2022
"""Delays the input signal by a time constant 'tau' in seconds.
2123

src/pathsim/blocks/fir.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
import numpy as np
1111
from collections import deque
1212

13-
from ._block import Block
13+
from ._block import Block
1414
from ..utils.register import Register
15-
from ..events.schedule import Schedule
15+
from ..events.schedule import Schedule
16+
from ..utils.mutable import mutable
1617

1718

1819
# FIR FILTER BLOCK ======================================================================
1920

21+
@mutable
2022
class FIR(Block):
2123
"""Models a discrete-time Finite-Impulse-Response (FIR) filter.
2224

src/pathsim/blocks/samplehold.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99

1010
from ._block import Block
1111
from ..events.schedule import Schedule
12+
from ..utils.mutable import mutable
1213

1314

1415
# MIXED SIGNAL BLOCKS ===================================================================
1516

17+
@mutable
1618
class SampleHold(Block):
1719
"""Samples the inputs periodically and produces them at the output.
1820

src/pathsim/blocks/sources.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from ._block import Block
1515
from ..utils.register import Register
1616
from ..utils.deprecation import deprecated
17+
from ..utils.mutable import mutable
1718
from ..events.schedule import Schedule, ScheduleList
1819
from .._constants import TOLERANCE
1920

@@ -169,6 +170,7 @@ def update(self, t):
169170

170171
# SPECIAL CONTINUOUS SOURCE BLOCKS ======================================================
171172

173+
@mutable
172174
class TriangleWaveSource(Source):
173175
"""Source block that generates an analog triangle wave
174176
@@ -214,6 +216,7 @@ def _triangle_wave(self, t, f):
214216
return 2 * abs(t*f - np.floor(t*f + 0.5)) - 1
215217

216218

219+
@mutable
217220
class SinusoidalSource(Source):
218221
"""Source block that generates a sinusoid wave
219222
@@ -289,6 +292,7 @@ def _gaussian(self, t, f_max):
289292
return np.exp(-(t/tau)**2)
290293

291294

295+
@mutable
292296
class SinusoidalPhaseNoiseSource(Block):
293297
"""Sinusoidal source with cumulative and white phase noise.
294298
@@ -703,6 +707,7 @@ class ChirpSource(ChirpPhaseNoiseSource):
703707

704708
# SPECIAL DISCRETE SOURCE BLOCKS ========================================================
705709

710+
@mutable
706711
class PulseSource(Block):
707712
"""Generates a periodic pulse waveform with defined rise and fall times.
708713
@@ -909,6 +914,7 @@ class Pulse(PulseSource):
909914
pass
910915

911916

917+
@mutable
912918
class ClockSource(Block):
913919
"""Discrete time clock source block.
914920
@@ -970,6 +976,7 @@ class Clock(ClockSource):
970976

971977

972978

979+
@mutable
973980
class SquareWaveSource(Block):
974981
"""Discrete time square wave source.
975982

src/pathsim/blocks/spectrum.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515

1616
from ..utils.realtimeplotter import RealtimePlotter
1717
from ..utils.deprecation import deprecated
18+
from ..utils.mutable import mutable
1819

1920
from .._constants import COLORS_ALL
2021

2122

2223
# BLOCKS FOR DATA RECORDING =============================================================
2324

25+
@mutable
2426
class Spectrum(Block):
2527
"""Block for fourier spectrum analysis (spectrum analyzer).
2628

0 commit comments

Comments
 (0)