From 8ccd633f859fe6164952c20ffbc5b04bfd8b272b Mon Sep 17 00:00:00 2001 From: mbergmann Date: Tue, 22 Oct 2024 10:46:46 +0200 Subject: [PATCH] updated test.py with new functions --- code/test.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/code/test.py b/code/test.py index b407995..fe621f7 100644 --- a/code/test.py +++ b/code/test.py @@ -100,14 +100,41 @@ def AM(EODf, stimulus): return AM, nyquist def remove_poor(files): - good_files =files - print('x') + """ + Removes poor datasets from the set of files for analysis + + Parameters + ---------- + files : list + list of files. + + Returns + ------- + good_files : list + list of files without the ones with the label poor. + + """ + # create list for good files + good_files = [] + # loop over files + for i in range(len(files)): + # print(files[i]) + # load the file (takes some time) + data = rlx.Dataset(files[i]) + # get the quality + quality = str.lower(data.metadata["Recording"]["Recording quality"][0][0]) + # check the quality + if quality != "poor": + # if its good or fair add it to the good files + good_files.append(files[i]) return good_files #find example data datafolder = "../../data" -example_file = datafolder + "/" + "2024-10-16-ad-invivo-1.nix" +example_file = datafolder + "/" + "2024-10-16-ah-invivo-1.nix" + +data_files = glob.glob("../../data/*.nix") #load dataset dataset = rlx.Dataset(example_file)