Skip to content

Commit

Permalink
adds first line to CSV reports helping operators copy data
Browse files Browse the repository at this point in the history
  • Loading branch information
andySigler committed Aug 1, 2023
1 parent 06b0df8 commit b53e004
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion hardware-testing/hardware_testing/data/csv_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ def stored(self) -> bool:
"""Line stored."""
return self._stored

@property
def num_data_points(self) -> int:
"""Get the number of data points saved in this line."""
return len(self._data_types)

def cache_start_time(self, start_time: float) -> None:
"""Line cache start time."""
self._start_time = start_time
Expand Down Expand Up @@ -349,7 +354,17 @@ def _refresh_results_overview_values(self) -> None:

def __str__(self) -> str:
"""CSV Report string."""
return "\n".join([str(s) for s in self._sections])
max_cols = max(
[
line.num_data_points
for section in self._sections
for line in section.lines
]
)
max_cols += 2 # all lines are prepended with the timestamp and tag
# the first line in the CSV should be populated with "copy"
first_line = ",".join(["copy"] * max_cols)
return f"{first_line}\n" + "\n".join([str(s) for s in self._sections])

@property
def completed(self) -> bool:
Expand Down

0 comments on commit b53e004

Please sign in to comment.