[fishbook] add _tuple property that returns a copy of the db tuple
This commit is contained in:
parent
77c0460ca9
commit
d21c75cc7f
@ -84,6 +84,10 @@ class Cell:
|
||||
str += "Cell: %s \t type: %s\n"%(self.id, self.type)
|
||||
return str
|
||||
|
||||
@property
|
||||
def _tuple(self):
|
||||
return self.__tuple.copy()
|
||||
|
||||
|
||||
class Dataset:
|
||||
def __init__(self, dataset_id=None, tuple=None):
|
||||
@ -187,6 +191,10 @@ class Dataset:
|
||||
break
|
||||
self.__samplerate = 1000. / float(si)
|
||||
|
||||
@property
|
||||
def _tuple(self):
|
||||
return self.__tuple.copy()
|
||||
|
||||
|
||||
class RePro:
|
||||
def __init__(self, repro_id=None, tuple=None):
|
||||
@ -276,6 +284,10 @@ class RePro:
|
||||
repros = repros & p
|
||||
return [RePro(tuple=r) for r in repros]
|
||||
|
||||
@property
|
||||
def _tuple(self):
|
||||
return self.__tuple.copy()
|
||||
|
||||
|
||||
class Stimulus:
|
||||
def __init__(self, stimulus_id=None, tuple=None):
|
||||
@ -299,6 +311,21 @@ class Stimulus:
|
||||
def settings(self):
|
||||
return _safe_get_val(self.__tuple, "settings", "")
|
||||
|
||||
@property
|
||||
def _tuple(self):
|
||||
return self.__tuple.copy()
|
||||
|
||||
@staticmethod
|
||||
def find(cell_id=None, repro_id=None, settings=None):
|
||||
stims = Stimuli & True
|
||||
if cell_id:
|
||||
stims = stims & "cell_id = '{0:s}'".format(cell_id)
|
||||
if repro_id:
|
||||
stims = stims & "repro_id = '{0:s}'".format(repro_id)
|
||||
if settings:
|
||||
stims = stims & "settings like '%{0:s}%'".format(settings)
|
||||
return [Stimulus(tuple=s) for s in stims]
|
||||
|
||||
|
||||
class Subject:
|
||||
def __init__(self, subject_id=None, tuple=None):
|
||||
@ -329,6 +356,10 @@ class Subject:
|
||||
def properties(self):
|
||||
return (SubjectProperties & self.__tuple).fetch(as_dict=True)
|
||||
|
||||
@property
|
||||
def _tuple(self):
|
||||
return self.__tuple.copy()
|
||||
|
||||
@staticmethod
|
||||
def find(species=None):
|
||||
subjs = Subjects & True
|
||||
|
Loading…
Reference in New Issue
Block a user