Skip to content
Mack edited this page Sep 7, 2023 · 5 revisions

Setting up Leakdown Tester

If you are having issues or want to learn how to set LDT up to run successful tests, start here. Navigate to the relevant section for your needs. If you need to install python, keep reading from here. Otherwise, start at 'Cloning the GitHub Repository'.

Installing Python

First, to do any work with the code, we need to install python locally.

If you are a Linux user, you already have python installed, however it may be a different version than the V 3.10 native to the PFP software - LDT works in Python 3.11, but if you also want to run a local PFP instance you may want to think about setting up Python V 3.10. So far, the pipeline is working in 3.11, so it may not be all that important.

If you do want to run the pipeline locally, and in the native version, use a tool like pyenv to manage multiple python versions. Moving on.

There are two major ways to install python:

Manual Install (the Easy Way)

Open up python V 3.10.12 in your browser of choice and download the correct installer executable. Run it and finish the install.

Using a Package Manager

MacOS users with Homebrew can use that package manager like so:

brew install [email protected]

Windows users can use WinGet much the same:

winget install -e --id Python.Python -v 3.10.0

Linux users can use whatever package manager they prefer to do the same, if they want the right version of Python for the PFP. Use your console to check the python version (generally python -vers). Use your system's package manager (aptget, pacman, etc), and don't be afraid of using google or ole' ChatGPT for help if you have trouble.

Once you have python installed, verify that PIP came with it (it should by default). Use where pip in your terminal, verify that it gives you a filepath, then continue to the next section.

Cloning the GitHub Repository

To work with Leakdown Tester (and PFP) you'll need to clone the GitHub repository to your local machine. You can follow the older wiki pages for steps on manually downloading a repo clone, or just follow the steps below based on your operating system for a faster method:

macOS and Linux

  1. Open Terminal

    • If you're using macOS or Linux, open up the built-in terminal.
  2. Navigate to the Desired Directory

    • Make a "code" folder if you so choose, otherwise the following will create a folder in your documents file called Leakdown-Tester
    • Use the cd command to navigate to the directory where you want to clone the repository. For example:
      cd Documents/Code
  3. Clone the Repository

    • In the terminal, run the following command to clone the repository:
      git clone https://github.com/Display-Lab/Leakdown-Tester.git

Windows

  1. Open Git Bash

    • If you haven't already, install Git for Windows on your machine.
    • Once installed, find and open "Git Bash" from your start menu.
  2. Navigate to the Desired Directory

    • If you don't already have one, make a folder for your python code to live in as you see fit. Documents/Code is always a solid bet!
    • Use the cd command to navigate to the directory where you want to clone the repository. For example:
      cd C:/.../Documents/Code
  3. Clone the Repository

    • In Git Bash, run the following command to clone the repository:
      git clone https://github.com/Display-Lab/Leakdown-Tester.git

After completing these steps, you'll have a local copy of the GitHub repository on your machine.

Remember to replace the example directory (Documents/Code) with the actual directory where you want to clone the repository.

If you encounter any issues during the cloning process, feel free to seek help from the Display-Lab team, online resources, or the wikis on the Precision Feedback Pipeline GitHub page.

Setting up a virtual environment

  1. Open Terminal: Fire up your command line or terminal.

  2. Navigate to Project Folder: Use the cd command to navigate to the folder containing LDT:

    cd /path/.../Leakdown-Tester
  3. Create Virtual Environment: Run the following command to create a new virtual environment (replace "LDTvenv" with your preferred name, if you like):

    python3 -m venv LDTvenv
  4. Activate Virtual Environment:

    • On macOS and Linux:

      source LDTvenv/bin/activate
    • On Windows:

      LDTvenv\Scripts\activate
  5. Install Dependencies: While the virtual environment is active, you can install the requirements for LDT using pip:

    pip install -r requirements.txt
  6. Run LDT: With the virtual environment activated, run your Python script like you normally would:

    python3 LDT.py

Now, of course this will try to pull from a CSV file that you don't have a filepath set for, and send to a server that isn't running locally. That's okay! It SHOULD fail here, and give an output like so:

(LDTvenv) ... Leakdown-Tester % python3 LDT.py 

      Welcome to the Leakdown Tester, Version 2.0.0!
 Reading data from CSV file at '.../MpogData_Real.csv'...
 Reading in data with dimensions 10 by 12...
 Sending 1 total POST requests...
 Sending POST request(s) to API at 'http://127.0.0.1:8000/createprecisionfeedback/'...

 HTTPConnectionPool(host='127.0.0.1', port=8000): Max retries exceeded with url: /createprecisionfeedback/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x11a658c50>: Failed to establish a new connection: [Errno 61] Connection refused'))

      Leakdown test complete.

If you recieve a similar message, LDT and the LDTvenv are working properly. Your virtual environment is set up!

  1. Deactivate Virtual Environment: When everything is set up, deactivate the virtual environment:

    deactivate

Troubleshooting and Next Steps

For help, troubleshooting, or other questions, contact the development team.

Otherwise, you now have the Leakdown Tester working on your machine! Go to the next wiki article to learn how to test an API with LDT

Clone this wiki locally