Metadata-Version: 2.4
Name: dip-measurement-core
Version: 1.0.0
Summary: Core 4-wire resistance measurement algorithm using Keithley K2450 and DAQ6510
Author: Dip Measurement Team
License: MIT
Keywords: measurement,resistance,keithley,gpib,4-wire,daq6510,k2450
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: ki488
Requires-Dist: k2450-gpib
Requires-Dist: daq-gpib
Dynamic: license-file

# Dip Measurement Core Algorithm

Core 4-wire resistance measurement module using current reversal technique for high-accuracy offset-compensated measurements.

## Instruments

- **Keithley K2450 SourceMeter** — programmable current source
- **DAQ6510 with 7702 Multiplexer** — multi-channel voltage measurement

## Features

- Current reversal technique: V_true = (V+ − V−) / 2 to cancel thermal EMF
- 4-wire relay addressing on 7702 multiplexer (up to 20 channels)
- Dynamic per-channel current calibration to target 2 mV excitation
- PT100/PT1000 resistance-to-temperature conversion
- Support for PT1000, PT100, Thermistor, Diode, and Zirconium Oxynitride sensors

## Installation

### From PyPI (after publishing)

```bash
pip install dip-measurement-core
```

### From GitHub

```bash
pip install git+https://github.com/YOUR_USERNAME/dip-measurement-core.git
```

### Local development install

```bash
git clone https://github.com/YOUR_USERNAME/dip-measurement-core.git
cd dip-measurement-core
pip install -e .
```

## Dependencies

- `numpy`
- [`ki488`](https://github.com/YOUR_USERNAME/ki488) — GPIB interface layer
- [`k2450-gpib`](https://github.com/YOUR_USERNAME/k2450-gpib) — Keithley K2450 driver
- [`daq-gpib`](https://github.com/YOUR_USERNAME/daq-gpib) — DAQ6510 driver

> **Note:** The `ki488`, `k2450-gpib`, and `daq-gpib` packages must also be pip-installable
> (either on PyPI or installable via `pip install git+https://...`).

## Quick Start

```python
from dip_measurement_core import DipMeasurement

dip = DipMeasurement()

# Connect to instruments via GPIB
success, msg = dip.connect(k2450_address=18, daq_address=20)

# Configure measurement
dip.configure(current_ma=0.1, sensor_type='ZIRCONIUM')

# Measure a single channel
result = dip.measure_channel(1)
print(f"Channel 1: {result['resistance']:.4f} Ω")

# Measure multiple channels
results = dip.measure_all_channels([1, 2, 3, 4, 5])
for ch, data in sorted(results.items()):
    print(f"  Ch {ch}: R={data['resistance']:.4f} Ω")

# Disconnect
dip.disconnect()
```

## Dynamic Current Calibration

To automatically adjust excitation current per channel (targeting 2 mV):

```python
dip.configure(current_ma=0.01, dynamic_current=True)
success, msg = dip.calibrate_currents(channels=[1, 2, 3, 4, 5])
print(msg)

# Subsequent measurements use calibrated currents
results = dip.measure_all_channels([1, 2, 3, 4, 5])
```

## Publishing to PyPI

```bash
# Install build tools
pip install build twine

# Build the package
python -m build

# Upload to PyPI (you'll need a PyPI account and API token)
python -m twine upload dist/*
```

## License

MIT
