#ask the user for database to process files = getFilesToProcess() for file in files: # connect to database connection = sqlite3.connect(file) # create an animalPool, which basically contains your animals animalPool = AnimalPool() # load infos about the animals animalPool.loadAnimals(connection) # load all detection (positions) of all animals for the first hour animalPool.loadDetection(start=0, end=oneHour) eventTimeLine = EventTimeLine(connection, "Oral-genital Contact", idA=1, idB=2, minFrame=0, maxFrame=oneHour) print("Event list for label ", eventTimeLine.eventNameWithId) print("for animal 1:", animalPool.getAnimalDictionnary()[1].RFID) print("for animal 2:", animalPool.getAnimalDictionnary()[2].RFID) print("Number of events:", len(eventTimeLine.getEventList())) print("start frame", "end frame", "duration(in frame)") for event in eventTimeLine.eventList:
@author: Fab ''' import sqlite3 from lmtanalysis.FileUtil import getFilesToProcess from lmtanalysis.Animal import AnimalPool from lmtanalysis.Measure import oneHour if __name__ == '__main__': #ask the user for database to process files = getFilesToProcess() for file in files: # connect to database connection = sqlite3.connect(file) # create an animalPool, which basically contains your animals animalPool = AnimalPool() # load infos about the animals animalPool.loadAnimals(connection) # load all detection (positions) of all animals for the first hour animalPool.loadDetection(start=0, end=oneHour, lightLoad=True) # plot and show trajectory animalPool.plotTrajectory()
if __name__ == '__main__': #ask the user for database to process files = getFilesToProcess() for file in files: # connect to database connection = sqlite3.connect( file ) # create an animalPool, which basically contains your animals animalPool = AnimalPool() # load infos about the animals animalPool.loadAnimals( connection ) animalPool.loadDetection( 0, 3*24*oneHour ) min = 0 max = 24*oneHour for animal in animalPool.getAnimalList(): bt = animal.getBodyThreshold( tmin= min, tmax = max ) bs = animal.getMedianBodyHeight( tmin= min , tmax = max ) print ( "min:\t" , str(min), "\tmax:\t", str(max), "\tAnimal:\t" , str(animal.baseId), "\tBT:\t " , str(bt) , "\tBS:\t" , str(bs) ) min = 24*oneHour max = 2*24*oneHour for animal in animalPool.getAnimalList(): bt = animal.getBodyThreshold( tmin= min, tmax = max ) bs = animal.getMedianBodyHeight( tmin= min , tmax = max ) print ( "min:\t" , str(min), "\tmax:\t", str(max), "\tAnimal:\t" , str(animal.baseId), "\tBT:\t " , str(bt) , "\tBS:\t" , str(bs) )
from lmtanalysis.FileUtil import getFilesToProcess from lmtanalysis.Animal import AnimalPool from lmtanalysis.Measure import oneHour, oneMinute if __name__ == '__main__': #ask the user for database to process files = getFilesToProcess() for file in files: # connect to database connection = sqlite3.connect(file) # create an animalPool, which basically contains your animals animalPool = AnimalPool() # load infos about the animals animalPool.loadAnimals(connection) # load all detection (positions) of all animals for the first hour animalPool.loadDetection(start=0, end=10 * oneMinute) # filter detection by area (in cm from the top left of the cage) animalPool.filterDetectionByArea(0, 30, 25, 50) # loop over all animals in this database for animal in animalPool.getAnimalList(): animal.plotTrajectory3D()
minT = 6 * oneHour #maxT = 3*oneDay maxT = (6 + 1) * oneHour for file in files: # connect to database connection = sqlite3.connect(file) # create an animalPool, which basically contains your animals animalPool = AnimalPool() # load infos about the animals animalPool.loadAnimals(connection) animalPool.loadDetection(0, 1 * oneHour) ''' min = 0 max = 24*oneHour for animal in animalPool.getAnimalList(): bt = animal.getBodyThreshold( tmin= min, tmax = max ) bs = animal.getMedianBodyHeight( tmin= min , tmax = max ) print ( "min:\t" , str(min), "\tmax:\t", str(max), "\tAnimal:\t" , str(animal.baseId), "\tBT:\t " , str(bt) , "\tBS:\t" , str(bs) ) print("---") for start in range( 0,24 ): print("**********") min = start*oneHour max = (start+1)*oneHour for animal in animalPool.getAnimalList(): bt = animal.getBodyThreshold( tmin= min, tmax = max )