Skip to content

Commit

Permalink
Fixed percentTraversed issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewBCooke committed Aug 21, 2019
1 parent c6f69bf commit f4d5f18
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Pathfinder
# Pathfinder [![DOI](https://zenodo.org/badge/188258387.svg)](https://zenodo.org/badge/latestdoi/188258387)

Morris Water Maze search strategy and entropy analysis.

Created by **Matthew Cooke** at **The University of British Columbia**, **Jason Snyder Lab**

Visit us at [https://matthewbcooke.github.io/Pathfinder/](https://matthewbcooke.github.io/Pathfinder/)

[![DOI](https://zenodo.org/badge/188258387.svg)](https://zenodo.org/badge/latestdoi/188258387)

## Synopsis

The Pathfinder package is a search strategy analysis tool for the Morris Water Maze, and can be expanded for other spatial navigation tasks. The program analyses X-Y coordinate data exported from commercially available tracking software. Pathfinder currently supports outputs from: Ethovision, Anymazy, WaterMaze, and ezTrack. We then calculate the best-fit search strategy for the trial. Trials are fit into one of: Direct Swim, Directed Search, Focal Search, Spatial indirect, Chaining, Scanning, Thigmotaxis, and Random Search.
Expand Down
16 changes: 8 additions & 8 deletions SearchStrategyAnalysis/Pathfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import pickle
import datetime
import scipy.ndimage as sp
try:
try: #Tries to import local dependencies
from SearchStrategyAnalysis.appTrial import Trial, Experiment, Parameters, saveFileAsExperiment, Datapoint
import SearchStrategyAnalysis.heatmap
except:
Expand All @@ -35,10 +35,10 @@



try:
try: #Imports MATLAB engine if available
import matlab.engine
canUseMatlab = True
except:
except: #Notify user that MATLAB is unavailable
print("MATLAB Engine Unavailable")
canUseMatlab = False

Expand Down Expand Up @@ -383,7 +383,7 @@ def buildGUI(self, root): # Called in the __init__ to build the GUI window
self.mazeCentreE.grid(row=rowCount, column=1)
self.mazeCentre.bind("<Enter>", partial(self.on_enter, "Maze Centre. Example: 0.0,0.0 or Auto"))
self.mazeCentre.bind("<Leave>", self.on_leave)
rowCount = rowCount+1
rowCount = rowCount+ 1

self.headingError = Label(self.paramFrame, text="Angular Corridor Width (degrees):", bg="white")
self.headingError.grid(row=rowCount, column=0, sticky=E)
Expand Down Expand Up @@ -1286,7 +1286,7 @@ def guiHeatmap(self, aExperiment):
Button(self.top3, text="Generate", command=lambda: self.heatmap(aExperiment), fg="black", bg="white").pack()


def heatmap(self, aExperiment):
def heatmap(self, aExperiment): #Generates heatmaps for inputted trial data
logging.debug("Heatmap Called")
theStatus.set("Generating Heatmap...")
self.updateTasks()
Expand Down Expand Up @@ -1769,6 +1769,7 @@ def calculateValues(self, theTrial, goalX, goalY, mazeCentreX, mazeCentreY, corr

a, b = 0, 0


Matrix[int(aDatapoint.getx()/gridCellSize)][int(aDatapoint.gety()/gridCellSize)] = 1 # set matrix cells to 1 if we have visited them

if (mazeCentreX - aX) != 0:
Expand Down Expand Up @@ -1863,9 +1864,8 @@ def calculateValues(self, theTrial, goalX, goalY, mazeCentreX, mazeCentreY, corr
cellCounter = 0.0 # initialize our cell counter

percentTraversed = (((sum(sum(Matrix,[]))) / len(Matrix[0])**2) * scalingFactor) * 100.0 # turn our count into a percentage over how many cells we can visit

if percentTraversed > 1:
percentTraversed = 1
if percentTraversed > 100:
percentTraversed = 100

velocity = 0
idealDistance = distanceFromStartToGoal
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='jsl-pathfinder',
version='1.1.6',
version='1.1.7',
description='Morris Water Maze Search Strategy Analysis',
url='https://github.com/MatthewBCooke/Pathfinder',
author='Matthew Cooke',
Expand Down

0 comments on commit f4d5f18

Please sign in to comment.