Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion adc_eval/adcs/sar.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def __init__(self, nbits=8, fs=1, vref=1, seed=1, **kwargs):
self._comp_noise = 0

# Get keyword arguments
self._weights = kwargs.get("weights", None)
self._weights = None
self.weights = kwargs.get("weights", self.weights)

@property
def weights(self):
Expand All @@ -75,6 +76,7 @@ def weights(self):
def weights(self, values):
"""Sets the capacitor unit weights."""
self._weights = np.array(values)
self.dbits = np.zeros(len(values))
if self._weights.size < self.nbits:
print(
f"WARNING: Capacitor weight array size is {self._weights.size} for {self.nbits}-bit ADC."
Expand Down