diff --git a/ersilia/core/tracking.py b/ersilia/core/tracking.py index d3e7b272c..7ac50550c 100644 --- a/ersilia/core/tracking.py +++ b/ersilia/core/tracking.py @@ -3,6 +3,11 @@ import pandas as pd +def read_csv(file): + # reads csv file and returns Pandas dataframe + return pd.read_csv(file) + + class RunTracker: """ This class will be responsible for tracking model runs. It calculates the desired metadata based on a model's @@ -11,6 +16,12 @@ class RunTracker: NOTE: Currently, the Splunk connection is not set up. For now, we will print tracking results to the console. """ + def sample_df(self, df, num_rows, num_cols): + """ + Returns a sample of the dataframe, with the specified number of rows and columns. + """ + return df.sample(num_rows, axis=0).sample(num_cols, axis=1) + def __init__(self): self.time_start = None @@ -18,20 +29,16 @@ def __init__(self): def start_tracking(self): self.time_start = datetime.now() - def read_csv(self, file): - # reads csv file and returns Pandas dataframe - return pd.read_csv(file) - def track(self, input, result, meta): """ Tracks the results after a model run. """ print("Run input file:", input) - print(self.read_csv(input)) + print(read_csv(input)) print("Run output file:", result) - print(self.read_csv(result)) + print(read_csv(result)) print("Model metadata:", meta)