Skip to content
Snippets Groups Projects
Commit 7860a3c0 authored by JOSSOUD Olivier's avatar JOSSOUD Olivier
Browse files

Conductcalib. Fix columns order for result export as CSV.

parent df5dbe12
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,6 @@ import datetime
import os
import re
import utils
class ConductCalibProvider:
used_channels = ["C1", "C2"]
......@@ -22,7 +21,12 @@ class ConductCalibProvider:
return calib_run
def export_set_as_file(self, filename: str):
def export_set_as_file(self, filename: str) -> None:
# Test if filename already has a extension ('.' followed by 3 letters) ; if not: append '.csv'
if not re.match(".*\.[a-zA-Z]{3}$", filename):
filename += '.csv'
# Concatenate the data of all runs of the calibration set in a single pd.Dataframe
set_df = pd.DataFrame()
for run_id in self.calib_runs:
calib_run = self.calib_runs[run_id]
......@@ -31,9 +35,26 @@ class ConductCalibProvider:
run_df["run_id"] = run_id
set_df = set_df.append(run_df)
set_df.to_csv(path_or_buf=filename,
sep="\t",
index=False)
# Fix column order. Otherwise they can be randomly set.
column_order = ["run_id",
"standard_cond",
"channel",
"step",
"start_datetime",
"end_datetime",
"stable_start_datetime",
"stable_end_datetime",
"frequency",
"excite",
"headgain",
"mean",
"std",
"valid_auto",
"valid_manu"]
set_df[column_order].to_csv(path_or_buf=filename,
sep="\t",
index=False)
class CalibRun:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment