Skip to content

0354: control software for automated tissue clearing system

License

Notifications You must be signed in to change notification settings

AllenNeuralDynamics/brainwasher

Repository files navigation

brainslosher

Package Installation

To use the software, in the root directory, run

uv run --group brainslosher_group brainslosher --simulated 

brainwasher

License Python

Note that this package is intended to run on a Raspberry Pi with a particular hardware configuration.

Quick Links

Wiring Setup

See the hardware configuration for the device's wiring configuration.

Raspberry Pi Setup

Enable I2C interface via Raspi-Config under Interface Options.

sudo raspi-config

Ensure virtual environments can be created

sudo apt install python3-venv

Recommended(!!): Create a new environment.

python3 -m venv brainwasher

Enter the environment.

source ~/brainwasher/bin/activate

Package Installation

To use the software, in the root directory, run

pip install -e .

To develop the code, run

pip install -e .[dev]

If Python drivers were not installed automatically with the first command, you can install them manually from their respective repositories here:

Developing

There are two strategies for editing code on the Raspberry Pi.

Developing Remotely

Since the Raspberry Pi doesn't have all the text editing bells-and-whistles of your PC, you can develop all the code on your PC and synchronize the code folder with the Pi to execute the result. To do so, in Linux, use the rsync command

rsync -a /path/to/brainwasher/ pi@raspberrypi.local:/path/to/destination_folder --exclude=".*"

Note that the slash at the end of the source directory path is required.

Then run

uv sync

Now you can avoid installing Github credentials to push code from the device itself, and simply develop entirely on your PC!

Developing Locally

The Raspberry Pi 4 and 5 are fast enough that you can develop code on the Pi itself if needed. To do so, login to the Pi, setup Git, and edit files on the device itself.

Deploying

TODO: systemd setup.

Job Files

A job file is a sequence of wash steps along with some metadata.

A sample job file looks like the following:

history:
  events: []
name: test_thf_and_dcm
protocol:
- duration_s: 3.0
  mix_speed_rpm: 1200.0
  solution:
    deionized_water: 7000.0
    thf: 3000.0
- duration_s: 3.0
  mix_speed_rpm: 1200.0
  solution:
    deionized_water: 1000.0
    thf: 9000.0
- duration_s: 3.0
  mix_speed_rpm: 1200.0
  solution:
    thf: 10000.0
- duration_s: 3.0
  mix_speed_rpm: 1200.0
  solution:
    dcm: 10000.0
- duration_s: 3.0
  mix_speed_rpm: 1200.0
  solution:
    dcm: 10000.0
- duration_s: 0.0
  mix_speed_rpm: 0.0
  solution:
    deionized_water: 10000.0
source_protocol:
  path: /home/brainwasher/protocols/demo_protocol.csv # This value is ignored right now.
starting_solution:
  pbs: 10000.0

A step in the protocol has the following required steps:

- duration_s: 60  # [seconds]. How long to remain in this step.
  mix_speed_rpm: 0.0 # [rpm]. 0 for "no mixing." Minimum on-speed: 360; max: 6000.
  solution:  # a dictionary, keyed by solution name, of volumes in microliters.
    deionized_water: 10000.0

These additional steps are optional:

  start_empty: true # If true, empty the reaction vessel before filling with solution for this step. Default is true. 
  end_empty: false  # If true, empty the reaction vessel before exiting this step. Default is false.
  intermittent_mixing_on_time: None # Float. If specified, duty cycle of leaving the motor on at the specified RPM.
  intermittent_mixing_off_time: None # Float. If specified, duty cycle of of leaving the motor off at the specified RPM.

Once the job file is executed, extra (computed) fields will be added afterwards. These fields are not required will be recomputed if the required fields change.

Creating a new job file:

To create a new job, you can simply copy the following skeleton of required fields and then add a list of protocol steps.

history:
  events: []
name: <sample name here>
protocol:
- # Add steps here!
- # Step 0
- # Step 1 ...
source_protocol:
  path: /dev/null # This value is ignored right now.
starting_solution:
  pbs: 10000.0 # This is what the reaction vessel is first filled with.

Running a Job File

  1. If the job was created elsewhere, load the job onto the machine via USB stick or scp.
  2. Load the reaction vessel with brain along with starting liquid (most likely PBS).
  3. Ensure reagents are fresh and topped off.
  4. Ensure waste bottles are empty or have sufficient empty volume.
  5. Launch the console by running main.py in the project bin folder.
  6. From the console, type in run /path/to/job_file.yaml and press

About

0354: control software for automated tissue clearing system

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages