Skip to content

Commit ba7194d

Browse files
committed
fix: error exporting CharacteristicLine to DCM and update version to 0.1.7
1 parent b094d0c commit ba7194d

2 files changed

Lines changed: 6 additions & 15 deletions

File tree

dcm/dcm.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -563,12 +563,8 @@ def __str__(self) -> str:
563563
if self.x_mapping:
564564
s += f"*SSTX {self.x_mapping}\n"
565565

566-
index: list[float] = self.index
567-
if index:
568-
s += f" ST/X {' '.join(str(x) for x in index)}\n"
569-
values = self.series.values
570-
if values:
571-
s += f" WERT {' '.join(str(x) for x in values)}\n"
566+
s += f" ST/X {' '.join(str(x) for x in self.series.index)}\n"
567+
s += f" WERT {' '.join(str(x) for x in self.series.values)}\n"
572568
for name, var in self.variants.items():
573569
s += f" VAR {name}={var}" + "\n"
574570
return s + "END"
@@ -591,13 +587,7 @@ def from_dataframe(cls, df: pd.DataFrame, name: str) -> "Self":
591587
else:
592588
raise ValueError("DataFrame must have exactly one row or column")
593589

594-
values = df.values.flatten()
595-
if index and isnan(index[0]):
596-
index_name = ""
597-
index = index[1:]
598-
values = values[1:]
599-
600-
series = pd.Series(values, index=index, name=name)
590+
series = pd.Series(df.values.flatten(), index=index, name=name)
601591
series.index.name = index_name
602592
return cls(
603593
name=name,
@@ -1180,7 +1170,7 @@ def load_from_excel(
11801170
"""
11811171
return (
11821172
self.load_maps(maps_path)
1183-
.load_curves(curves_path)
1173+
.load_lines(curves_path)
11841174
.load_parameters(parameters_path)
11851175
.load_parameter_blocks(parameter_blocks_path)
11861176
)
@@ -1219,6 +1209,7 @@ def load_curves(self, excel_path: PathOrReadable) -> "Self":
12191209

12201210
@property
12211211
def load_lines(self) -> Callable[[PathOrReadable], "Self"]:
1212+
# Alias for load_curves
12221213
return self.load_curves
12231214

12241215
def load_parameter_blocks(self, excel_path: PathOrReadable) -> "Self":

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "python-dcm"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
description = "A high-performance Python package for handling ETAS DCM(Data Conversion Format) files used in engine calibration tools like INCA, MDA, EHANDBOOK, and CANape."
55
authors = ["c0sogi <dcas@naver.com>"]
66
license = "MIT"

0 commit comments

Comments
 (0)