Dash Data Explorer
Contents
Dash Data Explorer¶
An application written in python that uses the dash modules from plotly to create a (relatively) fast, interactive graph of raw binary data (.Net.Mat) collected in Bonsai-rx.
Get the app¶
Click on this link to the application file. Then hit CONTROL+S and a “Save As” window will pop up (or right mouse click in the window over the text and and select ‘Save As…’). Save the file to your computer (using the default file name ‘Data-Explorer’ with file extension ‘py’). Save the file somewhere easy to access, like your documents folder.
If you are on WindowsOS, the OS often automatically appends ‘txt’ to the end when you Save As. This will prevent the application from running. Use Sublime Text Editor to open the file. In the Sublime text editor, select
File>SaveAs
and select thePython
file type option. Delete the txt file.
Usage¶
Install Anaconda¶
Make sure you have installed Anaconda Individual Edition by downloading and executing the appropriate installer for your operating system.
Launch Command Line¶
Launch a Command Line prompt to run Anaconda programs (slightly different for Mac and PC)
PC:
Launch the Anaconda Navigator
Open the PowerShell Prompt application
Create an environment with dash if you have not yet done so
If you have not already done so, you will need to create an environment to run the application in. The environment must have dash installed.
Execute the following commands at the PowerShell Prompt command line and follow given instructions along the way.conda create --name neurolab --clone base
After the environment has been created, you must activate it before proceeding with:
conda activate neurolab
conda install -c conda-forge dash
Type Y followed by the Enter/Return key when prompted.
MAC:
Open Terminal (comes with Mac computers)
Create an environment with dash if you have not yet done so
If you have not already done so, you will need to create an environment to run the application in. The environment must have dash installed.
Execute the following commands at the PowerShell Prompt command line and follow given instructions along the way.conda create --name neurolab --clone base
After the environment has been created, you must activate it before proceeding with:
conda activate neurolab
conda install -c conda-forge dash
Type Y followed by the Enter/Return key when prompted.
Run the Dash Data Explorer¶
Running the Dash Data Explorer once Anaconda and the neurolab environment are set up on your computer:
Activate the neurolab anaconda environment (created in step 3: ‘Creating an environment with dash’) by typing the text
conda activate neurolab
into the PowerShell Prompt command line and then hitting the Enter key.Navigate the command line to the folder that contains the Data-Explorer.py application file that you downloaded/saved.
Navigating the command line on MacOS
cd folderpath
To get the folder path, right mouse click the folder in the “Finder”, then press the option key, then select “Copy as Pathname”. You can then CONTROL+P to paste it into the command line. Note that Mac does not include the quotation marks around the filepath when you paste it, so you must do so manually.Navigating the command line on WindowsOS
cd folderpath
will work most of the time. If you are changing drives (C drive to E drive, for example) you may need to docd /D folderpath(including prepended drive letter)
To get the folder path, hold down the Shift key while right-clicking the folder name. then select “Copy Full Path”. You can then CONTROL+P to paste it into the command line.Follow the command line syntax below to provide the application with all the necessary information about your file and how you want it plotted in the Data Explorer when it launches.
filepath TIP
copy the full filepath to your data from the file browswer so that you can paste it into the command line rather than typing it out.
on a Mac right mouse click the filename, then press the option key, then select “Copy as Pathname”
on a Windows hold down the Shift key while right-clicking the file name. then select “Copy Full Path”
command line syntax: python Data-Explorer.py [-h] -filepath FILEPATH -fs FS -n NUMBER_CHANNELS -p NUMBER_SUBPLOTS -c CHANNELS_PER_SUBPLOT [provide additional -c flags for additional subplots >1]
optional arguments:
-h, –help show this help message and exit required arguments:
-filepath FILEPATH full path to the file location on your local computer
-fs FS sampling rate of the data in file
-n NUMBER_CHANNELS number of channels data in file
-p NUMBER_SUBPLOTS number of subplots to create
-c CHANNELS_PER_SUBPLOT [CHANNELS_PER_SUBPLOT …] list of channels to plot on each subplot (listed in order of appearance)
Open a browser window (Chrome recommended) and go to your local server (127.0.0.1:8050)
Note that this link will only work if you have already run the Data Explorer application from the terminal
Shut down the application appropriately
Mac: hold down the Control key while you press the C key.
Windows: hold down the Control key while you press the Pause/Break key.
If you get an error next time you try to run the applicaiton
If you can an error that the application is already running on the server, then it did not get shut down appropriately the last time. In the terminal, use the command
sudo lsof -1:8050
to shut down the server and free it up for the application again.