adctoolbox 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- adctoolbox-0.1.0/LICENSE +38 -0
- adctoolbox-0.1.0/PKG-INFO +263 -0
- adctoolbox-0.1.0/README.md +227 -0
- adctoolbox-0.1.0/pyproject.toml +52 -0
- adctoolbox-0.1.0/setup.cfg +4 -0
- adctoolbox-0.1.0/src/adctoolbox/__init__.py +42 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/__init__.py +23 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/err_auto_correlation.py +58 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/err_envelope_spectrum.py +33 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/err_hist_sine.py +274 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/err_pdf.py +74 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/inl_sine.py +111 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/spec_plot.py +274 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/spec_plot_2tone.py +264 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/spec_plot_phase.py +271 -0
- adctoolbox-0.1.0/src/adctoolbox/aout/tom_decomp.py +218 -0
- adctoolbox-0.1.0/src/adctoolbox/common/__init__.py +21 -0
- adctoolbox-0.1.0/src/adctoolbox/common/alias.py +20 -0
- adctoolbox-0.1.0/src/adctoolbox/common/bit_in_band.py +45 -0
- adctoolbox-0.1.0/src/adctoolbox/common/cap2weight.py +46 -0
- adctoolbox-0.1.0/src/adctoolbox/common/find_bin.py +100 -0
- adctoolbox-0.1.0/src/adctoolbox/common/find_fin.py +21 -0
- adctoolbox-0.1.0/src/adctoolbox/common/find_vinpp.py +94 -0
- adctoolbox-0.1.0/src/adctoolbox/common/sine_fit.py +163 -0
- adctoolbox-0.1.0/src/adctoolbox/data_generation/__init__.py +7 -0
- adctoolbox-0.1.0/src/adctoolbox/data_generation/generate_jitter_data.py +68 -0
- adctoolbox-0.1.0/src/adctoolbox/dout/__init__.py +13 -0
- adctoolbox-0.1.0/src/adctoolbox/dout/fg_cal_sine.py +500 -0
- adctoolbox-0.1.0/src/adctoolbox/dout/fg_cal_sine_2freq.py +198 -0
- adctoolbox-0.1.0/src/adctoolbox/dout/fg_cal_sine_os.py +166 -0
- adctoolbox-0.1.0/src/adctoolbox/dout/overflow_chk.py +147 -0
- adctoolbox-0.1.0/src/adctoolbox/oversampling/__init__.py +7 -0
- adctoolbox-0.1.0/src/adctoolbox/oversampling/ntf_analyzer.py +54 -0
- adctoolbox-0.1.0/src/adctoolbox/utils/__init__.py +9 -0
- adctoolbox-0.1.0/src/adctoolbox/utils/calculate_jitter.py +91 -0
- adctoolbox-0.1.0/src/adctoolbox/utils/debug_jitter.py +101 -0
- adctoolbox-0.1.0/src/adctoolbox/utils/multimodal_report.py +469 -0
- adctoolbox-0.1.0/src/adctoolbox.egg-info/PKG-INFO +263 -0
- adctoolbox-0.1.0/src/adctoolbox.egg-info/SOURCES.txt +40 -0
- adctoolbox-0.1.0/src/adctoolbox.egg-info/dependency_links.txt +1 -0
- adctoolbox-0.1.0/src/adctoolbox.egg-info/requires.txt +8 -0
- adctoolbox-0.1.0/src/adctoolbox.egg-info/top_level.txt +1 -0
adctoolbox-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Zhishuai Zhang, Lu Jie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
CITATION NOTICE
|
|
26
|
+
|
|
27
|
+
If you use this software in academic research or publications, please cite:
|
|
28
|
+
|
|
29
|
+
Zhishuai Zhang, Lu Jie, "ADCToolbox: A comprehensive toolbox for ADC testing
|
|
30
|
+
and characterization"
|
|
31
|
+
|
|
32
|
+
BibTeX:
|
|
33
|
+
@software{adctoolbox2025,
|
|
34
|
+
author = {Zhang, Zhishuai and Jie, Lu},
|
|
35
|
+
title = {ADCToolbox: A comprehensive toolbox for ADC testing and characterization},
|
|
36
|
+
year = {2025},
|
|
37
|
+
url = {https://github.com/yourusername/ADCToolbox}
|
|
38
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: adctoolbox
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A comprehensive toolbox for ADC testing and characterization
|
|
5
|
+
Author: Zhishuai Zhang, Lu Jie
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Arcadia-1/ADCToolbox
|
|
8
|
+
Project-URL: Documentation, https://github.com/Arcadia-1/ADCToolbox#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/Arcadia-1/ADCToolbox
|
|
10
|
+
Project-URL: Issues, https://github.com/Arcadia-1/ADCToolbox/issues
|
|
11
|
+
Keywords: ADC,analog-to-digital,converter,testing,characterization,signal-processing
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: numpy>=1.20.0
|
|
29
|
+
Requires-Dist: scipy>=1.7.0
|
|
30
|
+
Requires-Dist: matplotlib>=3.4.0
|
|
31
|
+
Requires-Dist: pandas>=1.3.0
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# ADCToolbox
|
|
38
|
+
|
|
39
|
+
A comprehensive Python toolbox for **ADC (Analog-to-Digital Converter)** characterization and analysis.
|
|
40
|
+
|
|
41
|
+
Delivers clear **multi-angle diagnostic views** of ADC behavior, enabling deeper insight and faster issue location.
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- **Spectrum Analysis**: ENOB, SNDR, SFDR, SNR, THD, Noise Floor
|
|
46
|
+
- **Error Analysis**: PDF, Autocorrelation, Envelope Spectrum, Histogram Analysis
|
|
47
|
+
- **Jitter Detection**: Amplitude vs Phase Noise Decomposition
|
|
48
|
+
- **Calibration**: Foreground Calibration for SAR/Pipeline ADCs
|
|
49
|
+
- **INL/DNL Extraction**: Histogram-based nonlinearity analysis
|
|
50
|
+
- **100% MATLAB Parity**: Validated against reference MATLAB implementation
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install adctoolbox
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
or (recommended)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv pip install adctoolbox
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Requirements**: Python >= 3.8, numpy, scipy, matplotlib, pandas
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
### Spectrum Analysis
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from adctoolbox.aout import spec_plot
|
|
76
|
+
import numpy as np
|
|
77
|
+
|
|
78
|
+
# Load ADC output data
|
|
79
|
+
data = np.loadtxt("adc_output.csv", delimiter=',')
|
|
80
|
+
|
|
81
|
+
# Analyze spectrum and get performance metrics
|
|
82
|
+
ENoB, SNDR, SFDR, SNR, THD, pwr, NF, _ = spec_plot(data)
|
|
83
|
+
|
|
84
|
+
print(f"ENOB: {ENoB:.2f} bits")
|
|
85
|
+
print(f"SNDR: {SNDR:.2f} dB")
|
|
86
|
+
print(f"SFDR: {SFDR:.2f} dB")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Sine Wave Fitting
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from adctoolbox.common import sine_fit
|
|
93
|
+
|
|
94
|
+
# Fit sine wave and extract parameters
|
|
95
|
+
data_fit, freq, mag, dc, phi = sine_fit(data)
|
|
96
|
+
err = data - data_fit
|
|
97
|
+
|
|
98
|
+
print(f"Frequency: {freq:.6f}")
|
|
99
|
+
print(f"Magnitude: {mag:.4f}")
|
|
100
|
+
print(f"DC offset: {dc:.4f}")
|
|
101
|
+
print(f"Phase: {phi:.2f} deg")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Jitter Analysis
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from adctoolbox.aout import err_hist_sine
|
|
108
|
+
|
|
109
|
+
# Extract jitter from error histogram
|
|
110
|
+
emean, erms, phase, anoi, pnoi, err, xx = err_hist_sine(
|
|
111
|
+
data, bin=99, fin=freq, disp=0
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
# Calculate jitter RMS (assuming input frequency Fin in Hz)
|
|
115
|
+
jitter_rms = pnoi / (2 * np.pi * Fin)
|
|
116
|
+
print(f"Jitter RMS: {jitter_rms*1e15:.2f} fs")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Error PDF Analysis
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from adctoolbox.aout import err_pdf
|
|
123
|
+
|
|
124
|
+
# Analyze error distribution
|
|
125
|
+
noise_lsb, mu, sigma, KL_div, x, fx, gauss = err_pdf(err)
|
|
126
|
+
|
|
127
|
+
print(f"Noise RMS: {noise_lsb:.4f} LSB")
|
|
128
|
+
print(f"Mean: {mu:.4f} LSB")
|
|
129
|
+
print(f"Std Dev: {sigma:.4f} LSB")
|
|
130
|
+
print(f"KL Divergence: {KL_div:.4f}")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### INL/DNL Extraction
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from adctoolbox.aout import inl_sine
|
|
137
|
+
|
|
138
|
+
# Extract INL and DNL from sine histogram
|
|
139
|
+
INL, DNL, code = inl_sine(data)
|
|
140
|
+
|
|
141
|
+
print(f"Max INL: {np.max(np.abs(INL)):.4f} LSB")
|
|
142
|
+
print(f"Max DNL: {np.max(np.abs(DNL)):.4f} LSB")
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Available Tools
|
|
148
|
+
|
|
149
|
+
### Spectrum Analysis (`adctoolbox.aout`)
|
|
150
|
+
- **`spec_plot`** - FFT spectrum with ENOB, SNDR, SFDR, SNR, THD, noise floor
|
|
151
|
+
- **`spec_plot_phase`** - Phase spectrum with polar plot
|
|
152
|
+
- **`tom_decomp`** - Thompson decomposition (deterministic vs random error)
|
|
153
|
+
|
|
154
|
+
### Error Analysis (`adctoolbox.aout`)
|
|
155
|
+
- **`err_pdf`** - Error PDF with KDE and Gaussian fitting
|
|
156
|
+
- **`err_hist_sine`** - Histogram-based error analysis with jitter detection
|
|
157
|
+
- **`err_auto_correlation`** - Error autocorrelation function
|
|
158
|
+
- **`err_envelope_spectrum`** - Envelope spectrum via Hilbert transform
|
|
159
|
+
- **`inl_sine`** - INL/DNL extraction from sine histogram
|
|
160
|
+
|
|
161
|
+
### Common Utilities (`adctoolbox.common`)
|
|
162
|
+
- **`sine_fit`** - Multi-parameter sine fitting with auto frequency search
|
|
163
|
+
- **`find_bin`** - FFT bin finder with sub-bin resolution
|
|
164
|
+
- **`find_fin`** - Input frequency finder
|
|
165
|
+
- **`alias`** - Frequency aliasing calculator
|
|
166
|
+
- **`cap2weight`** - Capacitor array to weight conversion
|
|
167
|
+
|
|
168
|
+
### Calibration (`adctoolbox.dout`)
|
|
169
|
+
- **`fg_cal_sine`** - Foreground calibration using sinewave
|
|
170
|
+
- **`overflow_chk`** - Overflow detection and validation
|
|
171
|
+
|
|
172
|
+
### Oversampling (`adctoolbox.oversampling`)
|
|
173
|
+
- **`ntf_analyzer`** - Noise Transfer Function analysis
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Package Structure
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
adctoolbox/
|
|
181
|
+
├── aout/ # Analog output analysis
|
|
182
|
+
├── common/ # Common utilities
|
|
183
|
+
├── dout/ # Digital output calibration
|
|
184
|
+
├── oversampling/ # Oversampling analysis
|
|
185
|
+
└── utils/ # Utility functions
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Documentation
|
|
191
|
+
|
|
192
|
+
- **GitHub Repository**: [https://github.com/Arcadia-1/ADCToolbox](https://github.com/Arcadia-1/ADCToolbox)
|
|
193
|
+
- **Full Documentation**: See GitHub repository for complete guides
|
|
194
|
+
- **API Reference**: Comprehensive docstrings in all modules
|
|
195
|
+
- **Test Suite**: 15 unit tests with 100% MATLAB-Python parity validation
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Validation
|
|
200
|
+
|
|
201
|
+
**Tested against MATLAB reference implementation**:
|
|
202
|
+
- 15 Python unit tests
|
|
203
|
+
- 96 comparison test cases
|
|
204
|
+
- 100% numerical parity achieved
|
|
205
|
+
- Results: 27 PERFECT + 51 EXCELLENT + 13 GOOD + 5 ACCEPTABLE
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Example Use Cases
|
|
210
|
+
|
|
211
|
+
- **ADC Characterization**: Measure ENOB, SNDR, SFDR for performance verification
|
|
212
|
+
- **Jitter Analysis**: Separate amplitude noise from phase noise/jitter
|
|
213
|
+
- **Nonlinearity Testing**: Extract INL/DNL using sine histogram method
|
|
214
|
+
- **Calibration**: Foreground calibration for SAR and pipeline ADCs
|
|
215
|
+
- **Error Diagnosis**: Multi-view error analysis (time, frequency, phase domains)
|
|
216
|
+
- **Research**: ADC algorithm development with validated reference implementation
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
MIT License - See [LICENSE](https://github.com/Arcadia-1/ADCToolbox/blob/main/LICENSE) for details.
|
|
223
|
+
|
|
224
|
+
## Citation
|
|
225
|
+
|
|
226
|
+
If you use this toolbox in your research, please cite:
|
|
227
|
+
|
|
228
|
+
```bibtex
|
|
229
|
+
@software{adctoolbox2025,
|
|
230
|
+
author = {Zhang, Zhishuai and Jie, Lu},
|
|
231
|
+
title = {ADCToolbox},
|
|
232
|
+
year = {2025},
|
|
233
|
+
url = {https://github.com/Arcadia-1/ADCToolbox}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Authors
|
|
240
|
+
|
|
241
|
+
Zhishuai Zhang, Lu Jie
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Contributing
|
|
246
|
+
|
|
247
|
+
Contributions welcome! Please visit the [GitHub repository](https://github.com/Arcadia-1/ADCToolbox) for contribution guidelines.
|
|
248
|
+
|
|
249
|
+
**Development Setup**:
|
|
250
|
+
```bash
|
|
251
|
+
git clone https://github.com/Arcadia-1/ADCToolbox.git
|
|
252
|
+
cd ADCToolbox/python
|
|
253
|
+
pip install -e .[dev]
|
|
254
|
+
python tests/run_all_tests.py
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Links
|
|
260
|
+
|
|
261
|
+
- **GitHub**: [https://github.com/Arcadia-1/ADCToolbox](https://github.com/Arcadia-1/ADCToolbox)
|
|
262
|
+
- **Issues**: [https://github.com/Arcadia-1/ADCToolbox/issues](https://github.com/Arcadia-1/ADCToolbox/issues)
|
|
263
|
+
- **MATLAB Version**: Also available in the same repository
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# ADCToolbox
|
|
2
|
+
|
|
3
|
+
A comprehensive Python toolbox for **ADC (Analog-to-Digital Converter)** characterization and analysis.
|
|
4
|
+
|
|
5
|
+
Delivers clear **multi-angle diagnostic views** of ADC behavior, enabling deeper insight and faster issue location.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Spectrum Analysis**: ENOB, SNDR, SFDR, SNR, THD, Noise Floor
|
|
10
|
+
- **Error Analysis**: PDF, Autocorrelation, Envelope Spectrum, Histogram Analysis
|
|
11
|
+
- **Jitter Detection**: Amplitude vs Phase Noise Decomposition
|
|
12
|
+
- **Calibration**: Foreground Calibration for SAR/Pipeline ADCs
|
|
13
|
+
- **INL/DNL Extraction**: Histogram-based nonlinearity analysis
|
|
14
|
+
- **100% MATLAB Parity**: Validated against reference MATLAB implementation
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install adctoolbox
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
or (recommended)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
uv pip install adctoolbox
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Requirements**: Python >= 3.8, numpy, scipy, matplotlib, pandas
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
### Spectrum Analysis
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from adctoolbox.aout import spec_plot
|
|
40
|
+
import numpy as np
|
|
41
|
+
|
|
42
|
+
# Load ADC output data
|
|
43
|
+
data = np.loadtxt("adc_output.csv", delimiter=',')
|
|
44
|
+
|
|
45
|
+
# Analyze spectrum and get performance metrics
|
|
46
|
+
ENoB, SNDR, SFDR, SNR, THD, pwr, NF, _ = spec_plot(data)
|
|
47
|
+
|
|
48
|
+
print(f"ENOB: {ENoB:.2f} bits")
|
|
49
|
+
print(f"SNDR: {SNDR:.2f} dB")
|
|
50
|
+
print(f"SFDR: {SFDR:.2f} dB")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Sine Wave Fitting
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from adctoolbox.common import sine_fit
|
|
57
|
+
|
|
58
|
+
# Fit sine wave and extract parameters
|
|
59
|
+
data_fit, freq, mag, dc, phi = sine_fit(data)
|
|
60
|
+
err = data - data_fit
|
|
61
|
+
|
|
62
|
+
print(f"Frequency: {freq:.6f}")
|
|
63
|
+
print(f"Magnitude: {mag:.4f}")
|
|
64
|
+
print(f"DC offset: {dc:.4f}")
|
|
65
|
+
print(f"Phase: {phi:.2f} deg")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Jitter Analysis
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from adctoolbox.aout import err_hist_sine
|
|
72
|
+
|
|
73
|
+
# Extract jitter from error histogram
|
|
74
|
+
emean, erms, phase, anoi, pnoi, err, xx = err_hist_sine(
|
|
75
|
+
data, bin=99, fin=freq, disp=0
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Calculate jitter RMS (assuming input frequency Fin in Hz)
|
|
79
|
+
jitter_rms = pnoi / (2 * np.pi * Fin)
|
|
80
|
+
print(f"Jitter RMS: {jitter_rms*1e15:.2f} fs")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Error PDF Analysis
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from adctoolbox.aout import err_pdf
|
|
87
|
+
|
|
88
|
+
# Analyze error distribution
|
|
89
|
+
noise_lsb, mu, sigma, KL_div, x, fx, gauss = err_pdf(err)
|
|
90
|
+
|
|
91
|
+
print(f"Noise RMS: {noise_lsb:.4f} LSB")
|
|
92
|
+
print(f"Mean: {mu:.4f} LSB")
|
|
93
|
+
print(f"Std Dev: {sigma:.4f} LSB")
|
|
94
|
+
print(f"KL Divergence: {KL_div:.4f}")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### INL/DNL Extraction
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from adctoolbox.aout import inl_sine
|
|
101
|
+
|
|
102
|
+
# Extract INL and DNL from sine histogram
|
|
103
|
+
INL, DNL, code = inl_sine(data)
|
|
104
|
+
|
|
105
|
+
print(f"Max INL: {np.max(np.abs(INL)):.4f} LSB")
|
|
106
|
+
print(f"Max DNL: {np.max(np.abs(DNL)):.4f} LSB")
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Available Tools
|
|
112
|
+
|
|
113
|
+
### Spectrum Analysis (`adctoolbox.aout`)
|
|
114
|
+
- **`spec_plot`** - FFT spectrum with ENOB, SNDR, SFDR, SNR, THD, noise floor
|
|
115
|
+
- **`spec_plot_phase`** - Phase spectrum with polar plot
|
|
116
|
+
- **`tom_decomp`** - Thompson decomposition (deterministic vs random error)
|
|
117
|
+
|
|
118
|
+
### Error Analysis (`adctoolbox.aout`)
|
|
119
|
+
- **`err_pdf`** - Error PDF with KDE and Gaussian fitting
|
|
120
|
+
- **`err_hist_sine`** - Histogram-based error analysis with jitter detection
|
|
121
|
+
- **`err_auto_correlation`** - Error autocorrelation function
|
|
122
|
+
- **`err_envelope_spectrum`** - Envelope spectrum via Hilbert transform
|
|
123
|
+
- **`inl_sine`** - INL/DNL extraction from sine histogram
|
|
124
|
+
|
|
125
|
+
### Common Utilities (`adctoolbox.common`)
|
|
126
|
+
- **`sine_fit`** - Multi-parameter sine fitting with auto frequency search
|
|
127
|
+
- **`find_bin`** - FFT bin finder with sub-bin resolution
|
|
128
|
+
- **`find_fin`** - Input frequency finder
|
|
129
|
+
- **`alias`** - Frequency aliasing calculator
|
|
130
|
+
- **`cap2weight`** - Capacitor array to weight conversion
|
|
131
|
+
|
|
132
|
+
### Calibration (`adctoolbox.dout`)
|
|
133
|
+
- **`fg_cal_sine`** - Foreground calibration using sinewave
|
|
134
|
+
- **`overflow_chk`** - Overflow detection and validation
|
|
135
|
+
|
|
136
|
+
### Oversampling (`adctoolbox.oversampling`)
|
|
137
|
+
- **`ntf_analyzer`** - Noise Transfer Function analysis
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Package Structure
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
adctoolbox/
|
|
145
|
+
├── aout/ # Analog output analysis
|
|
146
|
+
├── common/ # Common utilities
|
|
147
|
+
├── dout/ # Digital output calibration
|
|
148
|
+
├── oversampling/ # Oversampling analysis
|
|
149
|
+
└── utils/ # Utility functions
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Documentation
|
|
155
|
+
|
|
156
|
+
- **GitHub Repository**: [https://github.com/Arcadia-1/ADCToolbox](https://github.com/Arcadia-1/ADCToolbox)
|
|
157
|
+
- **Full Documentation**: See GitHub repository for complete guides
|
|
158
|
+
- **API Reference**: Comprehensive docstrings in all modules
|
|
159
|
+
- **Test Suite**: 15 unit tests with 100% MATLAB-Python parity validation
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Validation
|
|
164
|
+
|
|
165
|
+
**Tested against MATLAB reference implementation**:
|
|
166
|
+
- 15 Python unit tests
|
|
167
|
+
- 96 comparison test cases
|
|
168
|
+
- 100% numerical parity achieved
|
|
169
|
+
- Results: 27 PERFECT + 51 EXCELLENT + 13 GOOD + 5 ACCEPTABLE
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Example Use Cases
|
|
174
|
+
|
|
175
|
+
- **ADC Characterization**: Measure ENOB, SNDR, SFDR for performance verification
|
|
176
|
+
- **Jitter Analysis**: Separate amplitude noise from phase noise/jitter
|
|
177
|
+
- **Nonlinearity Testing**: Extract INL/DNL using sine histogram method
|
|
178
|
+
- **Calibration**: Foreground calibration for SAR and pipeline ADCs
|
|
179
|
+
- **Error Diagnosis**: Multi-view error analysis (time, frequency, phase domains)
|
|
180
|
+
- **Research**: ADC algorithm development with validated reference implementation
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT License - See [LICENSE](https://github.com/Arcadia-1/ADCToolbox/blob/main/LICENSE) for details.
|
|
187
|
+
|
|
188
|
+
## Citation
|
|
189
|
+
|
|
190
|
+
If you use this toolbox in your research, please cite:
|
|
191
|
+
|
|
192
|
+
```bibtex
|
|
193
|
+
@software{adctoolbox2025,
|
|
194
|
+
author = {Zhang, Zhishuai and Jie, Lu},
|
|
195
|
+
title = {ADCToolbox},
|
|
196
|
+
year = {2025},
|
|
197
|
+
url = {https://github.com/Arcadia-1/ADCToolbox}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Authors
|
|
204
|
+
|
|
205
|
+
Zhishuai Zhang, Lu Jie
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Contributing
|
|
210
|
+
|
|
211
|
+
Contributions welcome! Please visit the [GitHub repository](https://github.com/Arcadia-1/ADCToolbox) for contribution guidelines.
|
|
212
|
+
|
|
213
|
+
**Development Setup**:
|
|
214
|
+
```bash
|
|
215
|
+
git clone https://github.com/Arcadia-1/ADCToolbox.git
|
|
216
|
+
cd ADCToolbox/python
|
|
217
|
+
pip install -e .[dev]
|
|
218
|
+
python tests/run_all_tests.py
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Links
|
|
224
|
+
|
|
225
|
+
- **GitHub**: [https://github.com/Arcadia-1/ADCToolbox](https://github.com/Arcadia-1/ADCToolbox)
|
|
226
|
+
- **Issues**: [https://github.com/Arcadia-1/ADCToolbox/issues](https://github.com/Arcadia-1/ADCToolbox/issues)
|
|
227
|
+
- **MATLAB Version**: Also available in the same repository
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "adctoolbox"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A comprehensive toolbox for ADC testing and characterization"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Zhishuai Zhang"},
|
|
14
|
+
{name = "Lu Jie"}
|
|
15
|
+
]
|
|
16
|
+
keywords = ["ADC", "analog-to-digital", "converter", "testing", "characterization", "signal-processing"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.8",
|
|
25
|
+
"Programming Language :: Python :: 3.9",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Topic :: Scientific/Engineering",
|
|
30
|
+
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
|
|
31
|
+
]
|
|
32
|
+
dependencies = [
|
|
33
|
+
"numpy>=1.20.0",
|
|
34
|
+
"scipy>=1.7.0",
|
|
35
|
+
"matplotlib>=3.4.0",
|
|
36
|
+
"pandas>=1.3.0",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
dev = [
|
|
41
|
+
"pytest>=7.0.0",
|
|
42
|
+
"pytest-cov>=4.0.0",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.urls]
|
|
46
|
+
Homepage = "https://github.com/Arcadia-1/ADCToolbox"
|
|
47
|
+
Documentation = "https://github.com/Arcadia-1/ADCToolbox#readme"
|
|
48
|
+
Repository = "https://github.com/Arcadia-1/ADCToolbox"
|
|
49
|
+
Issues = "https://github.com/Arcadia-1/ADCToolbox/issues"
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.packages.find]
|
|
52
|
+
where = ["src"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ADCToolbox: A comprehensive toolbox for ADC testing and characterization.
|
|
3
|
+
|
|
4
|
+
This package provides tools for analyzing both analog and digital aspects of
|
|
5
|
+
Analog-to-Digital Converters, including spectrum analysis, error characterization,
|
|
6
|
+
calibration algorithms, and more.
|
|
7
|
+
|
|
8
|
+
Submodules:
|
|
9
|
+
-----------
|
|
10
|
+
- common: Common utility functions (alias, find_bin, find_fin, sine_fit, etc.)
|
|
11
|
+
- aout: Analog output / time-domain analysis (spectrum, error analysis, etc.)
|
|
12
|
+
- dout: Digital output / code-level analysis (calibration, overflow detection, etc.)
|
|
13
|
+
- oversampling: Oversampling and noise transfer function tools
|
|
14
|
+
- utils: Utility functions and reporting tools
|
|
15
|
+
- data_generation: Test data generation utilities
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
------
|
|
19
|
+
>>> from adctoolbox.aout import spec_plot
|
|
20
|
+
>>> from adctoolbox.common import sine_fit
|
|
21
|
+
>>> from adctoolbox.dout import fg_cal_sine
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
__version__ = '0.1.0'
|
|
25
|
+
|
|
26
|
+
# Expose submodules for convenience
|
|
27
|
+
from . import common
|
|
28
|
+
from . import aout
|
|
29
|
+
from . import dout
|
|
30
|
+
from . import oversampling
|
|
31
|
+
from . import utils
|
|
32
|
+
from . import data_generation
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
'common',
|
|
36
|
+
'aout',
|
|
37
|
+
'dout',
|
|
38
|
+
'oversampling',
|
|
39
|
+
'utils',
|
|
40
|
+
'data_generation',
|
|
41
|
+
'__version__',
|
|
42
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Analog output (time-domain) analysis tools."""
|
|
2
|
+
|
|
3
|
+
from .spec_plot import spec_plot
|
|
4
|
+
from .spec_plot_phase import spec_plot_phase
|
|
5
|
+
from .spec_plot_2tone import spec_plot_2tone
|
|
6
|
+
from .err_envelope_spectrum import err_envelope_spectrum
|
|
7
|
+
from .err_auto_correlation import err_auto_correlation
|
|
8
|
+
from .err_hist_sine import err_hist_sine
|
|
9
|
+
from .err_pdf import err_pdf
|
|
10
|
+
from .tom_decomp import tom_decomp
|
|
11
|
+
from .inl_sine import inl_sine
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
'spec_plot',
|
|
15
|
+
'spec_plot_phase',
|
|
16
|
+
'spec_plot_2tone',
|
|
17
|
+
'err_envelope_spectrum',
|
|
18
|
+
'err_auto_correlation',
|
|
19
|
+
'err_hist_sine',
|
|
20
|
+
'err_pdf',
|
|
21
|
+
'tom_decomp',
|
|
22
|
+
'inl_sine',
|
|
23
|
+
]
|