Commit 34ae51ac authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Automatically drop columns for opposite side.

parent 94c7a13d
...@@ -2,12 +2,73 @@ data_files: ...@@ -2,12 +2,73 @@ data_files:
sender: "rtn2017/results/on/2017_03_28_09_33_00_Sender.csv" sender: "rtn2017/results/on/2017_03_28_09_33_00_Sender.csv"
receiver: "rtn2017/results/on/2017_03_28_09_33_00_Receiver.csv" receiver: "rtn2017/results/on/2017_03_28_09_33_00_Receiver.csv"
stamps: stamps:
- PrrtSendStart: PrrtSendStart:
Source: sender
Type: time
PrrtSendEnd:
Source: sender
Type: time
PrrtSubmitPackage:
Source: sender
Type: cycle
PrrtEncodeStart:
Source: sender
Type: cycle
PrrtEncodeEnd:
Source: sender
Type: cycle
PrrtTransmitStart:
Source: sender
Type: cycle
PrrtTransmitStart:
Source: sender
Type: cycle
PrrtTransmitEnd:
Source: sender
Type: cycle
LinkTransmitStart:
Source: sender Source: sender
Type: cycle Type: cycle
- PrrtSendEnd: LinkTransmitEnd:
Source: sender Source: sender
Type: time
LinkReceive:
Source: receiver
Type: time
PrrtDeliver:
Source: receiver
Type: time
SendFeedbackStart:
Source: receiver
Type: cycle Type: cycle
SendFeedbackEnd:
Source: receiver
Type: cycle
DecodeStart:
Source: receiver
Type: cycle
DecodeEnd:
Source: receiver
Type: cycle
HandlePacketStart:
Source: receiver
Type: cycle
HandlePacketEnd:
Source: receiver
Type: cycle
CopyOutputStart:
Source: receiver
Type: cycle
CopyOutputEnd:
Source: receiver
Type: cycle
PrrtReturnPackage:
Source: receiver
Type: cycle
PrrtReceivePackage:
Source: receiver
Type: time
durations: durations:
Send: Send:
Start: PrrtSendStart Start: PrrtSendStart
......
...@@ -28,7 +28,7 @@ def main(): ...@@ -28,7 +28,7 @@ def main():
print("{} is not a known analysis task.".format(command)) print("{} is not a known analysis task.".format(command))
continue continue
df_data = evaluate(data_files["sender"], data_files["receiver"],kind=0) df_data = evaluate(data_files["sender"], data_files["receiver"], stamps=config["stamps"], kind=0)
params = { "export": args.export} params = { "export": args.export}
......
...@@ -5,59 +5,20 @@ import collections ...@@ -5,59 +5,20 @@ import collections
from operator import itemgetter from operator import itemgetter
from sklearn import datasets, linear_model from sklearn import datasets, linear_model
def _evaluate_file(fileName,kind,sender=False): def _extract_stamps_by_type(all_stamps, src):
columns = [c for c,v in all_stamps.items() if v["Source"] == src]
stamps = [x + "_T" for x in columns] + [x + "_C" for x in columns]
return stamps
def _evaluate_file(fileName, stamps, kind, sender=False):
# Remove first line, as this is the dummy line for intermittently storing data. # Remove first line, as this is the dummy line for intermittently storing data.
df = pd.read_csv(fileName)[1:] df = pd.read_csv(fileName)[1:]
df = df[df["Kind"] == kind].drop(["Kind"],axis=1).set_index("SeqNo") df = df[df["Kind"] == kind].drop(["Kind"], axis=1).set_index("SeqNo")
if sender: if sender:
df.drop(["LinkReceive_T", df.drop(_extract_stamps_by_type(stamps,"receiver"),axis=1,inplace=True)
"LinkReceive_C",
"PrrtDeliver_T",
"PrrtDeliver_C",
"SendFeedbackStart_T",
"SendFeedbackStart_C",
"SendFeedbackEnd_T",
"SendFeedbackEnd_C",
"DecodeStart_T",
"DecodeStart_C",
"DecodeEnd_T",
"DecodeEnd_C",
"HandlePacketStart_T",
"HandlePacketStart_C",
"HandlePacketEnd_T",
"HandlePacketEnd_C",
"CopyOutputStart_T",
"CopyOutputStart_C",
"CopyOutputEnd_T",
"CopyOutputEnd_C",
"PrrtReturnPackage_T",
"PrrtReturnPackage_C",
"PrrtReceivePackage_T",
"PrrtReceivePackage_C"
],axis=1,inplace=True)
df = df[df["LinkTransmitEnd_T"] != 0] # remove empty rows
else: else:
df.drop(["PrrtSendStart_T", df.drop(_extract_stamps_by_type(stamps,"sender"),axis=1,inplace=True)
"PrrtSendStart_C", df = df[pd.notnull(df).all(axis=1)]
"PrrtSendEnd_T",
"PrrtSendEnd_C",
"PrrtSubmitPackage_T",
"PrrtSubmitPackage_C",
"PrrtEncodeStart_T",
"PrrtEncodeStart_C",
"PrrtEncodeEnd_T",
"PrrtEncodeEnd_C",
"PrrtTransmitStart_T",
"PrrtTransmitStart_C",
"PrrtTransmitEnd_T",
"PrrtTransmitEnd_C",
"LinkTransmitStart_T",
"LinkTransmitStart_C",
"LinkTransmitEnd_T",
"LinkTransmitEnd_C",
],axis=1,inplace=True)
df = df[df["LinkReceive_T"] != 0] # remove empty rows
return df return df
def _restore_timestamp(df, column, cycle_time, base_c, base_t): def _restore_timestamp(df, column, cycle_time, base_c, base_t):
...@@ -82,9 +43,9 @@ def _generate_duration(df, name, start, stop, cycleTimeColumn): ...@@ -82,9 +43,9 @@ def _generate_duration(df, name, start, stop, cycleTimeColumn):
df[name + "Cycles"] = diff df[name + "Cycles"] = diff
df[name + "Time"] = diff * df[cycleTimeColumn] df[name + "Time"] = diff * df[cycleTimeColumn]
def evaluate(sender_file, receiver_file, kind=0): def evaluate(sender_file, receiver_file, stamps, kind=0):
df1 = _evaluate_file(sender_file,kind,True) df1 = _evaluate_file(sender_file,stamps, kind,True)
df2 = _evaluate_file(receiver_file,kind) df2 = _evaluate_file(receiver_file,stamps, kind)
df = df1.join(df2) df = df1.join(df2)
# Processing Times and Cycle Durations # Processing Times and Cycle Durations
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment