From 98c317102c8789387e94b7dbec00a312b0280bba Mon Sep 17 00:00:00 2001 From: fdechaumont Date: Thu, 8 Sep 2022 13:48:27 +0200 Subject: [PATCH] analysis correction (thanks to the reading of Egon) --- LMT/lmtanalysis/Animal.py | 4 +++- LMT/lmtanalysis/BuildEventFollowZone.py | 4 +++- LMT/lmtanalysis/BuildEventNest4.py | 2 +- LMT/lmtanalysis/BuildEventWallJump.py | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/LMT/lmtanalysis/Animal.py b/LMT/lmtanalysis/Animal.py index f40ee9e..1994f36 100644 --- a/LMT/lmtanalysis/Animal.py +++ b/LMT/lmtanalysis/Animal.py @@ -622,7 +622,9 @@ def getMeanBodyLength (self, tmin=0, tmax=None): continue a = self.detectionDictionnary.get( key ) - bodySizeList.append(a.getBodySize()) + + if (a.isHeadAndTailDetected()): + bodySizeList.append(a.getBodySize()) mean = np.nanmean(bodySizeList) print( "mean animal bodysize: " , mean ) diff --git a/LMT/lmtanalysis/BuildEventFollowZone.py b/LMT/lmtanalysis/BuildEventFollowZone.py index 0d5f928..da7634c 100644 --- a/LMT/lmtanalysis/BuildEventFollowZone.py +++ b/LMT/lmtanalysis/BuildEventFollowZone.py @@ -83,7 +83,7 @@ def reBuildEvent( connection, file, tmin=None, tmax=None, pool = None ): for idAnimalB in pool.animalDictionnary.keys(): print(pool.animalDictionnary[idAnimalB]) - meanSizeB = pool.animalDictionnary[idAnimalB].getMeanBodyLength( tmax = tmax ) + #meanSizeB = pool.animalDictionnary[idAnimalB].getMeanBodyLength( tmax = tmax ) for animal in pool.animalDictionnary.keys(): if( idAnimalB == animal ): @@ -94,6 +94,8 @@ def reBuildEvent( connection, file, tmin=None, tmax=None, pool = None ): for idAnimalB in pool.animalDictionnary.keys(): + meanSizeB = pool.animalDictionnary[idAnimalB].getMeanBodyLength( tmax = tmax ) + for animal in pool.animalDictionnary.keys(): if( animal == idAnimalB ): continue diff --git a/LMT/lmtanalysis/BuildEventNest4.py b/LMT/lmtanalysis/BuildEventNest4.py index 9e27ccb..e4700b9 100644 --- a/LMT/lmtanalysis/BuildEventNest4.py +++ b/LMT/lmtanalysis/BuildEventNest4.py @@ -228,7 +228,7 @@ def reBuildEvent( connection, file, tmin=None, tmax=None , pool = None ): if isinstance( animal , Animal ): if not ( t in stopDictionnary[animal.baseId] ): allStoppedInBiggestGroup = False - break + break if allStoppedInBiggestGroup: isNest= True diff --git a/LMT/lmtanalysis/BuildEventWallJump.py b/LMT/lmtanalysis/BuildEventWallJump.py index 13bd8a4..d611b4a 100644 --- a/LMT/lmtanalysis/BuildEventWallJump.py +++ b/LMT/lmtanalysis/BuildEventWallJump.py @@ -88,8 +88,8 @@ def reBuildEvent( connection, file, tmin=None, tmax=None, pool = None, showGraph if ( tt in dicA ): - directionAnimalA = dicA[t].getDirection() - directionCenterAnimal = math.atan2( centerY - dicA[t].massY, centerX - dicA[t].massX ) + directionAnimalA = dicA[tt].getDirection() + directionCenterAnimal = math.atan2( centerY - dicA[tt].massY, centerX - dicA[tt].massX ) #same direction angleDif1 = math.atan2( math.sin(directionCenterAnimal-directionAnimalA), math.cos(directionCenterAnimal-directionAnimalA) )