High precision calibration tool for Pt100/Pt25 sensors (ITS-90 & CVD)
Project description
ptcal - Precision Pt100/Pt25 Calibration Library
Precision Pt100/Pt25 Calibration Library
ptcal is a professional Python library for calibrating Platinum Resistance Thermometers (PRT). It supports both ITS-90 and CVD (Callendar-Van-Dusen) standards, providing high-precision fitting, residual analysis, visualization, and Excel reporting.
Ideal for metrology labs, industrial calibration, and precision measurement applications.
Features
- Standard Support:
- ITS-90: Full implementation of deviation functions (ranges 8-11 and sub-ranges).
- IEC 60751 (CVD): Fitting of R0, A, B, (and C) coefficients.
- Visual Analysis:
- Comparison plots (Deviations vs. DIN/IEC classes).
- Residual scatter plots to verify fit quality.
- "All-in-One" overview for multiple sensors.
- Reporting:
- Automated Excel export with scientific formatting.
- Generates coefficients ready for measurement devices.
- Modular Design:
- Use
PtSensorto easily calculate Temperature from Resistance (and vice versa) in your own scripts.
- Use
Installation
Clone the repository and install it in editable mode:
git clone https://github.com/Zeit-Geist/ptcal.git cd ptcal pip install -e . Note: Requires Python 3.9+
Usage
1. Calibrating Sensors (From Excel Data)
Use the PtCalibrator class to process measurement data from an Excel file.
Input Format: An Excel file with columns: [SerialNumber, Temperature, Uncertainty, Resistance].
from ptcal import PtCalibrator
import pandas as pd
# 1. Load Data
df = pd.read_excel("measurements.xlsx")
# 2. Initialize & Calibrate
cal = PtCalibrator(df, sensor_type="Pt100")
cal.calculate_cvd()
cal.calculate_its90()
# 3. Export Results
cal.export_excel("results.xlsx")
# 4. Create Plots (Comparison, Residuals, etc.)
cal.plot(
output_dir="plots",
din_class="A",
mode="BOTH",
graphs=['SINGLE', 'RESIDUALS']
)
2. Using Coefficients (Application)
Use the PtSensor class to apply the calculated coefficients in your application.
Option A: Load from Result-Excel
from ptcal import PtSensor
# Load specific sensor from the calibration result file
sensor = PtSensor.from_excel("results.xlsx", serial_number="SN12345", standard="ITS90")
temp = sensor.get_temperature(108.45)
print(f"Temperature: {temp:.4f} °C")
Option B: Manual Parameters
# Manually define a CVD sensor
sensor = PtSensor("MySensor", standard="CVD", R0=100.01, A=3.9083e-3, B=-5.775e-7)
res = sensor.get_resistance(100.0)
print(f"Resistance at 100°C: {res:.4f} Ohm")
Project Structure
src/ptcal/core.py: Mathematical formulas (ITS-90 / CVD).src/ptcal/calibrator.py: Fitting algorithms and data handling.src/ptcal/sensor.py: Application logic (T <-> R conversion).src/ptcal/plotting.py: Visualization using Matplotlib.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ptcal-0.1.1.tar.gz.
File metadata
- Download URL: ptcal-0.1.1.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1ca488b2541a49a0212676108eb850625b2567e3b83878488c184aaf78e6c6e
|
|
| MD5 |
4ed82a7efaac71477339e7d791f549b1
|
|
| BLAKE2b-256 |
f1e2305f4d71d95c0f9a91d5e8e4c11ac3d8069c54ed94937154ba5ab15805e4
|
File details
Details for the file ptcal-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ptcal-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
293aa7b6e3adb6052308e922d45f702fd1a99342cae0c8c1bc6b7c73c99581ef
|
|
| MD5 |
7901906b5cbc9800b08423b59c4b8a63
|
|
| BLAKE2b-256 |
3a3b4fc445b94e214b4b821913106ddf2272260910646449171af9dbb56e2774
|