Skip to content

Commit

Permalink
Update installation instructions to include issues we encountered on …
Browse files Browse the repository at this point in the history
…the RPi. Add a clarifying comment to the gating code
  • Loading branch information
jmtayloruk committed Jan 25, 2022
1 parent 4147bbc commit b79a617
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ Then, to install on any platform, run the following command:

`python3 -m pip install --user git+https://github.com/Glasgow-ICG/open-optical-gating.git@main#egg=open-optical-gating`

(Note: if you get the error `python3: command not found`, substitute `python` for `python3` throughout these instructions)
If you get the error `python3: command not found`, substitute `python` for `python3` throughout these instructions.

If you get an error about not being able to write to `site-packages`, run the following command instead:

`python3 -m pip install --prefix=/home/pi/.local git+https://github.com/Glasgow-ICG/open-optical-gating.git@main#egg=open-optical-gating`

### Installation - troubleshooting

Expand All @@ -62,6 +66,10 @@ Fix by running `python3 -m pip install numpy`, and then rerun the installation c
- If you are installing inside a virtual environment, rerun the install command but omit the `--user` flag. [A newer version of `pip` would have warned you about the problem - see above]
- If you have a *very* old version of pip installed, you will see this error after a suspiciously fast installation process. Run `python3 -m pip install --upgrade pip` and then repeat the original installation instructions.

- Installation fails, with the Raspberry Pi hanging completely and requiring a reboot. This can happen if the Pi runs out of memory.
You can probably fix this by quitting all other programs that are currently running, other than the terminal window.
TeamViewer will use up most of the RAM on a Pi with 1GB RAM, so you probably need to run the initial install in person, without using TeamViewer.
(Note that TeamViewer is also likely to use too much CPU for you to be able to run live optical gating while connected over TeamViewer).

## Testing an installation

Expand Down Expand Up @@ -91,6 +99,13 @@ Instead of the standard `pip install` command given above, run the following com

`python3 -m pip install --src "." -e git+https://github.com/Glasgow-ICG/open-optical-gating.git@main#egg=open-optical-gating`

As with the main install command above, you may need to add `--prefix=/home/pi/.local` on the RPi.

*Upgrading* is awkward because we aren't recording proper version numbers for our modules yet.
If you have the editable source then it should be sufficient to do a `git pull`.
If you don't have the source (which is probably the case for `optical_gating_alignment`) then you probably need to specify `--force-reinstall`.
I still need to test that. In the past I have simply gone into ` /home/pi/.local/lib/python3.7/site-packages` and manually deleted the source and egg.

### Tests for developers

We are currently in the process of building a pytest framework for this repository.
Expand Down
4 changes: 4 additions & 0 deletions open_optical_gating/cli/prospective_optical_gating.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ def predict_trigger_wait(self, full_frame_history, targetSyncPhase, frameInterva
logger.debug("Fit failed due to too few frames")
return -1

# We need to look back through the recent frame history and pick out 'framesForFit' frames
# to use in our linear fit. Note the care taken here to only pass those relevant frames
# to get_metadata_from_list, so that the time taken inside that function doesn't get longer
# and longer as the experiment continues (when our history is large)
frame_history = pa.get_metadata_from_list(
full_frame_history[-framesForFit:], ["timestamp", "unwrapped_phase", "sad_min"]
)
Expand Down

0 comments on commit b79a617

Please sign in to comment.