Skip to main content

A Python toolbox for modeling and analyzing data converters

Project description

pyDataconverter

A Python toolbox for modeling and analyzing Data Converters (ADCs and DACs) and their performance metrics.

Features

  • Signal Generation

    • Sine waves, ramps, and multi-tone signals
    • Support for both single-ended and differential signals
    • Configurable signal parameters (frequency, amplitude, etc.)
  • Data Converter Modeling

    • Base ADC class with extensible architecture
    • Support for various ADC architectures (SAR, Pipeline, etc.)
    • Configurable parameters (resolution, reference voltage, etc.)
  • Analysis Tools

    • Dynamic performance metrics (SNR, SFDR, THD, etc.)
    • Static performance metrics (DNL, INL, etc.)
    • Spectral analysis with FFT tools
    • Histogram analysis for both uniform and sine wave inputs

Installation

git clone https://github.com/yourusername/pyDataconverter.git
cd pyDataconverter
pip install -e .

This can also be installed as a python module with pip install pyDataconverter

Quick Start

from pyDataconverter import SimpleADC
from pyDataconverter.utils.signal_gen import generate_sine
from pyDataconverter.utils.metrics import calculate_dynamic_metrics

# Create ADC instance
adc = SimpleADC(n_bits=12, v_ref=1.0)

# Generate test signal
fs = 1e6  # 1 MHz sampling rate
f_in = 10e3  # 10 kHz input
signal = generate_sine(f_in, fs, amplitude=0.9)

# Convert signal
output = [adc.convert(v) for v in signal]

# Calculate metrics
metrics = calculate_dynamic_metrics(output, fs, f_in)
print(f"SNDR: {metrics['SNDR']:.1f} dB")
print(f"SFDR: {metrics['SFDR']:.1f} dB")
print(f"THD: {metrics['THD']:.1f} dB")

Documentation

Signal Generation

# Generate single tone
signal = generate_sine(frequency=10e3, 
                      sampling_rate=1e6, 
                      amplitude=0.9)

# Generate two-tone signal
signal = generate_two_tone(f1=10e3, 
                          f2=11e3,
                          sampling_rate=1e6)

# Generate differential signals
v_pos, v_neg = convert_to_differential(signal, vcm=0.5)

Analysis Functions

Dynamic Metrics

metrics = calculate_dynamic_metrics(
    time_data=output,
    fs=1e6,
    f0=10e3,
    full_scale=1.0  # Optional: for dBFS results
)

Static Metrics

metrics = calculate_static_metrics(
    input_voltages=ramp_in,
    output_codes=codes,
    n_bits=12
)

Histogram Analysis

hist = calculate_histogram(
    codes=output_codes,
    n_bits=12,
    input_type='sine',
    remove_pdf=True
)

Project Structure

pyDataconverter/
├── __init__.py
├── architectures/     # Data converter architecture implementations
├── examples/     # Example files that illustrate usage
├── utils/            # Utility functions
└── analysis/         # Analysis tools

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the GPL-3.0 license - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydataconverter-0.3.tar.gz (63.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydataconverter-0.3-py3-none-any.whl (48.2 kB view details)

Uploaded Python 3

File details

Details for the file pydataconverter-0.3.tar.gz.

File metadata

  • Download URL: pydataconverter-0.3.tar.gz
  • Upload date:
  • Size: 63.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pydataconverter-0.3.tar.gz
Algorithm Hash digest
SHA256 f9b0ef0d47b999fdbf2a00f5b4f80f777af14d03b14202ac0dd2543e90fa3792
MD5 6e14d7f66e6d21f2ff67390d693f9957
BLAKE2b-256 6d28e115526ee9a563a39037a8c3ad5cca225b2014a43702d3ee327f875c2c17

See more details on using hashes here.

File details

Details for the file pydataconverter-0.3-py3-none-any.whl.

File metadata

  • Download URL: pydataconverter-0.3-py3-none-any.whl
  • Upload date:
  • Size: 48.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pydataconverter-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ec18c09b71ec8a76336be486cf2790deabc36743568beba67d586844feed5067
MD5 42bcdf940d8a8fd6a332068deb61213d
BLAKE2b-256 fe8f5ec13ed15e3c764b1244a6bc31054a2993bee02306dfebf4f6688de38cda

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page