Skip to content

Commit

Permalink
fix(ingestion_schemas): downsampling Encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
ttngu207 committed Oct 16, 2024
1 parent 8725e8f commit 0f210e1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aeon/schema/ingestion_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def read(self, file: PathLike[str], sr_hz: int = 50) -> pd.DataFrame:
data = super().read(file)
data.index = aeon_time(data.index)
first_index = data.first_valid_index()
freq = 1 / sr_hz * 1e3 # convert to ms
if first_index is not None:
data = data.resample(f"{1/sr_hz}s").first() # take first sample in each resampled bin
data = data.resample(f"{freq}ms").first() # take first sample in each resampled bin
return data


Expand All @@ -35,7 +36,7 @@ def __init__(self, pattern):
def read(self, file):
"""Reads video metadata from the specified file."""
data = pd.read_csv(file, header=0, names=self._rawcolumns)
drop_cols = [c for c in data.columns if c not in self.columns]
drop_cols = [c for c in data.columns if c not in self.columns + ["time"]]
data.drop(columns=drop_cols, errors="ignore", inplace=True)
data.set_index("time", inplace=True)
return data
Expand Down

0 comments on commit 0f210e1

Please sign in to comment.