updated test.py with new functions
This commit is contained in:
parent
2401bcbc16
commit
8ccd633f85
33
code/test.py
33
code/test.py
@ -100,14 +100,41 @@ def AM(EODf, stimulus):
|
|||||||
return AM, nyquist
|
return AM, nyquist
|
||||||
|
|
||||||
def remove_poor(files):
|
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
|
return good_files
|
||||||
|
|
||||||
#find example data
|
#find example data
|
||||||
datafolder = "../../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
|
#load dataset
|
||||||
dataset = rlx.Dataset(example_file)
|
dataset = rlx.Dataset(example_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user