forked from jgrewe/fishbook
docstrings and added Dataset totalcount function
This commit is contained in:
parent
59e6d4c0da
commit
b4d03325de
@ -80,14 +80,16 @@ class Cell:
|
|||||||
|
|
||||||
|
|
||||||
class Dataset:
|
class Dataset:
|
||||||
"""[summary]
|
"""The Dataset class represents an entry in the "datasets" table in the database. In the relacs context a Dataset represents all that has been recorded between pressing enter. For example all that is stored in the folder 2020-01-01-aa.
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, dataset_id=None, tuple=None):
|
def __init__(self, dataset_id=None, tuple=None):
|
||||||
"""[summary]
|
"""Constructor of a Dataset entity.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
dataset_id ([type], optional): [description]. Defaults to None.
|
dataset_id (str, optional): the id. Defaults to None.
|
||||||
tuple ([type], optional): [description]. Defaults to None.
|
tuple (tuple, optional): The properties used to identify the entity in the database. Usually only for internal use. Defaults to None.
|
||||||
"""
|
"""
|
||||||
self.__samplerate = 0.0
|
self.__samplerate = 0.0
|
||||||
if tuple:
|
if tuple:
|
||||||
@ -113,7 +115,7 @@ class Dataset:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def experimenter(self):
|
def experimenter(self):
|
||||||
"""The person who recording the dataset.
|
"""The person who did record the dataset.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: The experimenter
|
str: The experimenter
|
||||||
@ -122,6 +124,11 @@ class Dataset:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def recording_date(self):
|
def recording_date(self):
|
||||||
|
"""The Dataset's recording date.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: the recording date.
|
||||||
|
"""
|
||||||
return self.__tuple["recording_date"]
|
return self.__tuple["recording_date"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -162,8 +169,27 @@ class Dataset:
|
|||||||
def samplerate(self):
|
def samplerate(self):
|
||||||
return self.__samplerate
|
return self.__samplerate
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def totalDatasetCount():
|
||||||
|
"""Returns the total number of datasets defined in the database.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
int: the count
|
||||||
|
"""
|
||||||
|
return len(Datasets)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def find(min_duration=None, experimenter=None, quality=None):
|
def find(min_duration=None, experimenter=None, quality=None):
|
||||||
|
"""Find dataset entries in the database. You may restrict the search by providing the following arguments.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
min_duration (float, optional): minimum duration of the recording session, if not given, any length datasets will be returned. Defaults to None.
|
||||||
|
experimenter (str, optional): the name of the one who did the recording. The name does not need to be the full name. Defaults to None.
|
||||||
|
quality (str, optional): the quality assigned to the dataset during recording (e.g. good, fair, poor). Defaults to None.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
list: list of Dataset object matching the search criteria.
|
||||||
|
"""
|
||||||
dataset_list = Datasets
|
dataset_list = Datasets
|
||||||
if min_duration:
|
if min_duration:
|
||||||
dataset_list = dataset_list & "duration > %.2f" % min_duration
|
dataset_list = dataset_list & "duration > %.2f" % min_duration
|
||||||
|
Loading…
Reference in New Issue
Block a user