Skip to content

Commit 2869284

Browse files
committed
Bump version to 0.1.4, update package description, and adjust Python version requirements in pyproject.toml and poetry.lock
1 parent 14c8442 commit 2869284

4 files changed

Lines changed: 208 additions & 260 deletions

File tree

README.md

Lines changed: 89 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,193 +1,144 @@
1-
# DCM
2-
3-
A Python package for reading and writing DCM (Data Conservation Format) files used in various ECU calibration tools such as INCA, MDA, EHANDBOOK, CANape, and more.
4-
5-
## Table of Contents
6-
7-
- [Features](#features)
8-
- [Installation](#installation)
9-
- [Usage](#usage)
10-
- [Reading a DCM File](#reading-a-dcm-file)
11-
- [Writing a DCM File](#writing-a-dcm-file)
12-
- [Accessing Data](#accessing-data)
13-
- [Loading Data from Excel](#loading-data-from-excel)
14-
- [Interpolation Functions](#interpolation-functions)
15-
- [Examples](#examples)
16-
- [Dependencies](#dependencies)
17-
- [License](#license)
18-
- [Contributing](#contributing)
19-
- [Contact](#contact)
20-
21-
## Features
22-
23-
- **Read and Write DCM Files**: Parse and generate DCM files used in ECU calibration.
24-
- **Data Manipulation**: Access and modify parameters, curves, maps, and other calibration data.
25-
- **Excel Integration**: Load calibration data from Excel files.
26-
- **Interpolation**: Perform 1D and 2D linear interpolation on calibration data.
27-
- **Visualization**: Plot characteristic lines and maps using Matplotlib.
28-
- **Support for Various Data Types**: Handle parameters, parameter blocks, characteristic lines, characteristic maps, distributions, and text strings.
1+
Let me revise it with a more user-friendly approach in English:
292

30-
## Installation
31-
32-
Ensure you have Python 3.11 or higher installed. Install the package using `pip`:
33-
34-
```bash
35-
pip install git+https://github.com/c0sogi/python-dcm.git
36-
```
3+
# python-dcm
374

38-
Or if you have the package files locally:
5+
A high-performance Python package for handling ETAS DCM(Data Conversion Format) files used in engine calibration tools like INCA, MDA, EHANDBOOK, and CANape.
396

40-
```bash
41-
pip install .
42-
```
43-
44-
## Usage
45-
46-
### Reading a DCM File
7+
## Quick Start
478

489
```python
4910
from dcm import DCM
5011

5112
# Read a DCM file
52-
dcm = DCM.from_file('path/to/your_file.dcm')
53-
```
13+
dcm = DCM.from_file('calibration.dcm')
5414

55-
### Writing a DCM File
15+
# Access calibration data
16+
parameter_value = dcm.parameters['ENGINE_SPEED'].value
17+
map_data = dcm.maps['FUEL_MAP'].dataframe
18+
curve_data = dcm.curves['BOOST_CURVE'].series
5619

57-
```python
58-
# Write the DCM object to a file
59-
dcm.write('path/to/output_file.dcm')
60-
```
61-
62-
### Accessing Data
63-
64-
```python
65-
# Access a parameter
66-
parameter = dcm.parameters['PARAMETER_NAME']
67-
print(parameter.value)
20+
# Interpolate values
21+
x_points = [1000, 1500, 2000] # RPM
22+
y_points = [50, 75, 100] # Load %
23+
interpolated = dcm.maps['FUEL_MAP'].as_function(x_points, y_points)
6824

69-
# Access a characteristic line (curve)
70-
curve = dcm.curves['CURVE_NAME']
71-
print(curve.series)
72-
73-
# Access a characteristic map
74-
char_map = dcm.maps['MAP_NAME']
75-
print(char_map.dataframe)
25+
# Visualize data
26+
dcm.maps['FUEL_MAP'].to_figure()
7627
```
7728

78-
### Loading Data from Excel
79-
80-
You can load calibration data from Excel files into the DCM object.
29+
## Key Features
8130

82-
```python
83-
# Load maps from an Excel file
84-
dcm.load_maps('maps.xlsx')
31+
- **Easy Data Access**: Directly access parameters, curves, and maps with Pandas integration
32+
- **Interpolation**: Built-in 1D/2D linear interpolation for real-time value calculation
33+
- **Visualization**: One-line plotting of characteristic curves and maps
34+
- **Excel Integration**: Import/export calibration data from Excel spreadsheets
35+
- **Set Operations**: Compare and merge DCM files with `|`, `-`, `&`, and `%` operators
36+
- **Type Support**: Handle all DCM data types including fixed/group characteristics
8537

86-
# Load curves from an Excel file
87-
dcm.load_lines('curves.xlsx')
38+
## Installation
8839

89-
# Load parameters from an Excel file
90-
dcm.load_parameters('parameters.xlsx')
40+
Requires Python ≥ 3.10
9141

92-
# Load parameter blocks from an Excel file
93-
dcm.load_parameter_blocks('parameter_blocks.xlsx')
42+
```bash
43+
pip install python-dcm
9444
```
9545

96-
### Interpolation Functions
97-
98-
Perform interpolation using the calibration data.
99-
100-
#### 1D Interpolation (Characteristic Line)
46+
## Common Use Cases
10147

48+
### Data Access & Manipulation
10249
```python
103-
# Get the interpolation function for a curve
104-
curve_function = curve.as_function
50+
# Get parameter value
51+
rpm_limit = dcm.parameters['MAX_RPM'].value
10552

106-
# Interpolate at specific points
107-
import numpy as np
108-
x_values = np.array([1.0, 2.0, 3.0])
109-
interpolated_values = curve_function(x_values)
110-
```
53+
# Access map as DataFrame
54+
fuel_map = dcm.maps['FUEL_MAP'].dataframe
55+
fuel_map.iloc[0, 0] = 14.7 # Modify value
11156

112-
#### 2D Interpolation (Characteristic Map)
57+
# Get curve data
58+
boost_curve = dcm.curves['BOOST_CURVE'].series
59+
max_boost = boost_curve.max()
60+
```
11361

62+
### Excel Integration
11463
```python
115-
# Get the interpolation function for a map
116-
map_function = char_map.as_function
117-
118-
# Interpolate at specific x and y points
119-
x_values = np.array([1.0, 2.0, 3.0])
120-
y_values = np.array([4.0, 5.0, 6.0])
121-
interpolated_values = map_function(x_values, y_values)
64+
# Load calibration data from Excel
65+
dcm.load_from_excel(
66+
maps_path='maps.xlsx',
67+
curves_path='curves.xlsx',
68+
parameters_path='params.xlsx'
69+
)
70+
71+
# Each sheet name becomes the calibration object name
12272
```
12373

124-
## Examples
125-
126-
### Plotting a Characteristic Line
127-
74+
### Visualization
12875
```python
12976
import matplotlib.pyplot as plt
13077

131-
# Plot the curve
132-
fig, ax = curve.to_figure()
78+
# Plot a map with custom settings
79+
fig, ax = dcm.maps['FUEL_MAP'].to_figure(
80+
cmap='viridis',
81+
fontsize=12
82+
)
13383
plt.show()
84+
85+
# Plot multiple curves
86+
fig, ax = plt.subplots()
87+
dcm.curves['BOOST_LOW'].to_figure(ax=ax, label='Low')
88+
dcm.curves['BOOST_HIGH'].to_figure(ax=ax, label='High')
89+
plt.legend()
13490
```
13591

136-
### Plotting a Characteristic Map
92+
### Advanced Features
13793

94+
#### Parameter Type Conversion
13895
```python
139-
import matplotlib.pyplot as plt
140-
141-
# Plot the map
142-
fig, ax = char_map.to_figure()
143-
plt.show()
96+
param = dcm.parameters['CONTROL_BITS']
97+
binary = param.as_bin() # [1, 3, 5] (bits set to 1)
98+
hex_val = param.as_hex() # [A, F, 1] (hexadecimal digits)
14499
```
145100

146-
### Combining DCM Objects
147-
148-
You can combine DCM objects using set operations:
149-
101+
#### DCM File Comparison
150102
```python
151-
# Union of two DCM objects
152-
combined_dcm = dcm1 | dcm2
103+
# Find differences between calibrations
104+
modified = old_dcm % new_dcm
105+
print(modified.parameters.keys()) # Changed parameters
153106

154-
# Difference between two DCM objects
155-
difference_dcm = dcm1 - dcm2
107+
# Merge calibrations
108+
combined = dcm1 | dcm2
109+
```
156110

157-
# Intersection of two DCM objects
158-
intersection_dcm = dcm1 & dcm2
111+
## Supported Data Types
159112

160-
# Modifications between two DCM objects
161-
modifications_dcm = dcm1 % dcm2
162-
```
113+
- Parameters (FESTWERT)
114+
- Parameter Blocks (FESTWERTEBLOCK)
115+
- Characteristic Lines (KENNLINIE/FESTKENNLINIE/GRUPPENKENNLINIE)
116+
- Characteristic Maps (KENNFELD/FESTKENNFELD/GRUPPENKENNFELD)
117+
- Distributions (STUETZSTELLENVERTEILUNG)
118+
- Text Strings (TEXTSTRING)
163119

164120
## Dependencies
165121

166-
- Python >= 3.11
167-
- [NumPy](https://numpy.org/) >= 1.20.0
168-
- [Pandas](https://pandas.pydata.org/) >= 1.5.0
169-
- [Matplotlib](https://matplotlib.org/) >= 3.0.0
170-
- [OpenPyXL](https://openpyxl.readthedocs.io/en/stable/) >= 3.1.0
122+
- NumPy ≥ 1.20.0
123+
- Pandas ≥ 1.5.0
124+
- Matplotlib ≥ 3.0.0
125+
- OpenPyXL ≥ 3.1.0
171126

172127
## License
173128

174-
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
129+
MIT License
175130

176131
## Contributing
177132

178-
Contributions are welcome! Please follow these steps:
133+
Contributions welcome! Please format code with [ruff](https://docs.astral.sh/ruff/) before submitting PRs.
179134

180-
1. Fork the repository.
181-
2. Create a new branch (`git checkout -b feature/YourFeature`).
182-
3. Commit your changes (`git commit -am 'Add new feature'`).
183-
4. Push to the branch (`git push origin feature/YourFeature`).
184-
5. Create a new Pull Request.
135+
## Contact
185136

186-
Please ensure that your code adheres to the existing style and that all tests pass.
137+
- Author: c0sogi
138+
- Email: dcas@naver.com or cosogi1@gmail.com
187139

188-
## Contact
140+
Feel free to reach out for questions or suggestions.
189141

190-
Author: c0sogi
191-
Email: [dcas@naver.com](mailto:dcas@naver.com) or [cosogi1@gmail.com](mailto:cosogi1@gmail.com)
142+
---
192143

193-
Feel free to reach out for questions or discussions.
144+
For detailed documentation and examples, visit our [GitHub repository](https://github.com/c0sogi/python-dcm).

0 commit comments

Comments
 (0)