Skip to content

Commit

Permalink
adding hyperparameters for dataAPI.reassignMultipleAnimalsId executio…
Browse files Browse the repository at this point in the history
…n in tracking post processing + enhancement to fixing empty plot when no bouts detected problem: trace origin now always as a blue point
  • Loading branch information
oliviermirat committed Feb 4, 2025
1 parent 8ef8119 commit 89ac9c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions zebrazoom/code/GUI/GUI_InitialClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from zebrazoom.code.GUI.configFilePrepare import StoreValidationVideoWidget
from zebrazoom.code.GUI.GUI_InitialFunctions import chooseConfigFile, launchZebraZoom
from zebrazoom.code.GUI.readValidationVideo import readValidationVideo
from zebrazoom.code.paths import getDefaultZZoutputFolder


LARGE_FONT= QFont("Verdana", 12)
Expand Down Expand Up @@ -1749,25 +1750,27 @@ def showGraphForAllBoutsCombined(self, numWell, numPoiss, dataRef, visualization

headXFinal = []
headYFinal = []
if len(dataRef["wellPoissMouv"][numWell][numPoiss]) == 0:

ZZoutputPath = getDefaultZZoutputFolder()
resultsPath = os.path.join(ZZoutputPath, self.currentResultFolder)
if os.path.exists(resultsPath):
try:
from zebrazoom.dataAPI.getDataPerTimeInterval import getDataPerTimeInterval
HeadPos = getDataPerTimeInterval(self.currentResultFolder, numWell, numPoiss, None, None, "HeadPos")
headXFinal.extend([HeadPos[0][0]])
headYFinal.extend([HeadPos[0][1]])
plt.plot(headXFinal, headYFinal, 'o')
except Exception as e:
print(f"An error occurred: {e}")
except KeyboardInterrupt: # Allow manual interruption (CTRL+C)
print("Program interrupted by user!")
except SystemExit:
print("System exit requested!")

for numMouv in range(0, len(dataRef["wellPoissMouv"][numWell][numPoiss])):
headXFinal.extend(dataRef["wellPoissMouv"][numWell][numPoiss][numMouv]["HeadX"])
headYFinal.extend(dataRef["wellPoissMouv"][numWell][numPoiss][numMouv]["HeadY"])
if len(dataRef["wellPoissMouv"][numWell][numPoiss]) == 0:
plt.plot(headXFinal, headYFinal, 'o')
else:
plt.plot(headXFinal, headYFinal)
plt.plot(headXFinal, headYFinal)
if not(graphScaling):
plt.xlim(0, dataRef["wellPositions"][numWell]["lengthX"])
plt.ylim(dataRef["wellPositions"][numWell]["lengthY"], 0)
Expand Down
2 changes: 1 addition & 1 deletion zebrazoom/zebraZoomVideoAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def run(self):
# DataAPI calls
if self._hyperparameters['storeH5']:
if "reassignMultipleAnimalsId" in self._hyperparameters and self._hyperparameters["reassignMultipleAnimalsId"]:
dataAPI.reassignMultipleAnimalsId(self._hyperparameters['H5filename'], self._hyperparameters["nbWells"], self._hyperparameters["nbAnimalsPerWell"], self._hyperparameters["freqAlgoPosFollow"] if ("freqAlgoPosFollow" in self._hyperparameters and self._hyperparameters["freqAlgoPosFollow"]) else 10)
dataAPI.reassignMultipleAnimalsId(self._hyperparameters['H5filename'], self._hyperparameters["nbWells"], self._hyperparameters["nbAnimalsPerWell"], self._hyperparameters.get("freqAlgoPosFollow", 100), None, None, self._hyperparameters.get("max_distance_threshold", 100), self._hyperparameters.get("max_dist_disapearedAnimal_step", 0), self._hyperparameters.get("max_NbFramesAllowedToDisapeared", 50), self._hyperparameters.get("minimumTraceLength", 5), self._hyperparameters.get("removeNewDetectionsTooClose", 8), self._hyperparameters.get("minDistTravel", 1), self._hyperparameters.get("minimumProbaDetectionForNewTrajectory", 0), self._hyperparameters.get("removeStationaryPointMinDist", 0), self._hyperparameters.get("removeStationaryPointInterval", 0))

if "smoothHeadPositionsWindow" in self._hyperparameters and self._hyperparameters["smoothHeadPositionsWindow"]:
dataAPI.smoothHeadPositions(self._hyperparameters['H5filename'], self._hyperparameters["nbWells"], self._hyperparameters["nbAnimalsPerWell"], self._hyperparameters["smoothHeadPositionsWindow"])
Expand Down

1 comment on commit 89ac9c3

@oliviermirat
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2

  • adding hyperparameters for dataAPI.reassignMultipleAnimalsId execution in tracking post processing
  • enhancement to fixing empty plot when no bouts detected problem: trace origin now always as a blue point

Please sign in to comment.