Skip to content

Commit 27309a7

Browse files
committed
Update install docs.
1 parent 9f5fc3d commit 27309a7

File tree

10 files changed

+303
-127
lines changed

10 files changed

+303
-127
lines changed

ceed/view/teensy_estimation/readme.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
11
Teensy Frame Estimation
22
=======================
33

4-
`arduino-1.8.13/hardware/teensy/avr/cores/teensy4/usb_rawhid.c` edit `TX_NUM` to 1.
4+
The Teensy is used to help Ceed identify when a frame was rendered for two frames by the GPU, requiring
5+
Ceed to drop a frame. See more details in the [docs](https://matham.github.io/ceed/blueprint.html).
6+
7+
Programming Teensy
8+
------------------
9+
10+
If this is a new Teensy device, it'll need to be re-programmed. The easiest way is to download the
11+
pre-compiled
12+
[teensy_estimation.ino.hex file](https://github.com/matham/ceed/blob/master/ceed/view/teensy_estimation/teensy_estimation.ino.hex).
13+
Then, following the instructions and using the [Teensy Loader App](https://www.pjrc.com/teensy/loader.html),
14+
program the Teensy with the hex file.
15+
16+
If something has changed and the hex file needs to be recompiled, then follow the
17+
[instructions](https://www.pjrc.com/teensy/teensyduino.html) to install Teensyduino by installing the
18+
[Arduino IDE](https://www.arduino.cc/en/software) and then the
19+
[Teensyduino add-on](https://www.pjrc.com/teensy/td_download.html).
20+
21+
Then, get and open the source
22+
[teensy_estimation.ino file](https://github.com/matham/ceed/blob/master/ceed/view/teensy_estimation/teensy_estimation.ino).
23+
Then, locate the ``teensy4/usb_rawhid.c`` file, it'll be located under the arduino installation
24+
(e.g. ``arduino-1.8.13/hardware/teensy/avr/cores/teensy4/usb_rawhid.c``). You'll have to make three changes in the file
25+
to improve latency:
26+
27+
* change ``#define TX_NUM 4`` to ``#define TX_NUM 1``,
28+
* in the function ``usb_rawhid_recv`` change the line ``if (systick_millis_count - wait_begin_at > timeout) {`` to
29+
``if (systick_millis_count - wait_begin_at >= timeout) {``
30+
* similarly, in the function ``usb_rawhid_send`` change the line ``if (systick_millis_count - wait_begin_at > timeout) return 0;``
31+
to ``if (systick_millis_count - wait_begin_at >= timeout) return 0;``
32+
33+
Then after saving, in the Arduino IDE ensure that the USB type under tools is set to "Raw HID". And that for the
34+
board the Teensy 4.1 is selected. And finally, under port, select the Teensy device so it can be programmed.
35+
Finally, compile ``teensy_estimation.ino`` and upload it to the Teensy as described in the
36+
[docs](https://www.pjrc.com/teensy/td_usage.html).

doc/source/apps/optics_app.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _optics-app:
2+
13
.. automodule:: ceed.tools.optics
24
:members:
35
:show-inheritance:

doc/source/blueprint.rst

Lines changed: 67 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
.. _ceed-blueprint:
2+
13
System Blueprint
24
================
35

4-
The goal of the system is to optically stimulate brain tissue with temporal-spatial precision and to
5-
simultaneously record the voltage of the neurons in the tissue being stimulated with a dense
6-
electrode array (e.g. 256 electrodes).
6+
The goal of the system mostly controlled by Ceed is to:
7+
8+
1. visually locate neurons in the brain tissue,
9+
2. optically stimulate the tissue with temporal-spatial precision,
10+
3. simultaneously record the voltage of the neurons in the tissue
11+
being stimulated with a dense electrode array (e.g. 256 electrodes),
12+
4. temporally align the optical stimulation with electrode activity in a single data file post-hoc.
713

814
The overall system looks as follows
915

@@ -17,33 +23,42 @@ Users create spatial patterns in ceed, and associate temporal functions with the
1723
E.g. we may want to stimulate a single neuron with a sine wave, so we draw a circle around
1824
it and vary the circle's intensity temporally using a sine function.
1925

20-
Ceed uses Python 3 and Kivy for the GUI. We have a dedicated Ubuntu 18 computer that runs
21-
the software.
26+
Ceed generates the projector RGB output, as well as a synchronization signal recorded by MCS.
27+
After the experiment, Ceed temporally aligns and merges the MCS electrode data with the
28+
spacial-temporal patterns it generated.
29+
30+
Ceed uses Python 3 and Kivy for the GUI. We have a dedicated Ubuntu computer that runs
31+
ceed.
2232

2333
VPixx
2434
-----
2535

26-
To stimulate the tissue, we use a VPixx projector, that can output frames upto 1440 Hz in
27-
greyscale or 500 Hz in RGB. Ceed generates the frames, which is sent to the projector,
28-
and then through a lenses until it reaches the tissue.
36+
To stimulate the tissue, we use a `VPixx projector <https://vpixx.com/>`_ that can output
37+
frames upto 1440 Hz in greyscale or 500 Hz in RGB. Ceed generates the frames, which is sent
38+
to the projector, and then through the lenses until it reaches the tissue.
39+
40+
The VPixx controller is responsible for converting the corner pixel RGB 24-bit value of each
41+
frame into a 5v 24-bit port logic output. Upto 16 of the ports are connected to and recorded
42+
by the MCS controller. Ceed especially generates a pattern that it subsequently uses to
43+
temporally align the two systems.
2944

3045
Multichannel Systems (MCS)
3146
--------------------------
3247

33-
The MCS system is the electrode recording system and is responsible for
34-
recording any brain activity in the tissue. This is a dense electrode array recording from
35-
many cells simultaneously.
48+
The `MCS system <https://www.multichannelsystems.com/>`_ is the electrode recording system
49+
and is responsible for recording any brain activity in the tissue. This is a dense electrode
50+
array, recording from many cells simultaneously.
3651

3752
This system is controlled by MCS provided software that controls the electrode arrays
38-
and records the electrode data to files.
53+
and records the electrode data to ultimately HDF5 files.
3954

4055
Camera
4156
------
4257

43-
We use a Thor camera to capture light emitted by the tissue. In a typical experiment,
44-
first we broadly stimulate the tissue with light to see where the cells are present
45-
as captured by the camera. Then, we design stimulus in Ceed to stimulate the desired cells
46-
and observe the resulting electrical activity.
58+
We use a `Thor camera <https://www.thorlabs.com>`_ to capture light emitted by the tissue.
59+
In a typical experiment, first we broadly stimulate the tissue with light to see where
60+
the cells are present as captured by the camera. Then, we design stimulus in Ceed to
61+
stimulate the desired cells and observe the resulting electrical activity with MCS.
4762

4863
Data alignment
4964
--------------
@@ -62,6 +77,39 @@ Networked PCs
6277
Because the linux PC is used to generate the Ceed frames which is output to the projector,
6378
we cannot use that computer to view the camera images. When we tried attaching multiple
6479
screens, the GPU periodically missed frames, we suspect because the the two screens may not
65-
have supported the precise frame rate. Consequently, we use the Windows computer running
66-
the MCS software to control the Thor camera, display the images to the user and then
67-
pass them over the network to the Linux/Ceed PC.
80+
have supported the precise frame rate. Consequently, we use the Windows computer, already
81+
running the MCS software to control the Thor camera, display the images to the user and then
82+
pass them over the network to the Linux/Ceed PC for drawing.
83+
84+
85+
Teensy
86+
------
87+
88+
Although Ceed takes special care to reduce per-frame CPU, sometimes the CPU-GPU results in a
89+
frame taking two or more render cycles to render. E.g. at 120Hz, a single frame lasts 8.33ms.
90+
Sometimes the computer will miss the 8.33ms deadline and display the current frame twice before
91+
displaying the next frame. This effectively shifts all subsequent frames forward by 8.33ms,
92+
potentially disrupting the stimulated circuitry temporal patterns.
93+
94+
We can recognize such long frames based on internal timing with high confidence, but
95+
only after a few frames have passed. The `Teensy <https://www.pjrc.com/teensy/>`_,
96+
running in USB-interrupt mode at 8+ kHz, reduces the number of bad frames (typically to 2,
97+
the number of frames buffered) by giving Ceed quick feedback when it drops a frame. It
98+
notices the dropped frames by monitoring the above-mentioned VPixx 24-bits.
99+
100+
Additionally, Ceed uses the Tennsy built-in LED to indicate the experiment status since
101+
the PC monitor is used entirely to project the patterns and cannot provide such feedback.
102+
103+
The Teensy is optional and can be turned OFF within Ceed if it's not available.
104+
105+
Microscope
106+
----------
107+
108+
The microscope, including the dichroic mirror controls the flow of light from the projector
109+
to the issue and from the tissue to the camera.
110+
111+
The dichroic mirror reflects down the colors of light emitted by the projector onto the
112+
tissue. The tissue also emits different color wavelengths, which is passed through by the
113+
mirror to the camera.
114+
115+
See :ref:`microscope-optics` for a full specification of the Microscope.

doc/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
'sphinx.ext.coverage',
3737
'sphinx.ext.intersphinx',
3838
"sphinx_rtd_theme",
39+
"sphinx.ext.autosectionlabel",
3940
]
4041

4142
intersphinx_mapping = {

doc/source/getting_started.rst

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,40 @@ Getting Started
44
Introduction
55
-------------
66

7-
Ceed is an in vitro experiment that stimulates brain slices and records
8-
their activity.
7+
Ceed is a Python based application to help run in-vitro experiments that
8+
stimulates brain slices and records their activity.
9+
10+
Ceed is the user interface for describing and running the experiments.
11+
The overall system is described in :ref:`ceed-blueprint`.
12+
See the :ref:`ceed-guide` for the Ceed specific guide.
13+
14+
Complete developer API documentation is at :ref:`ceed-root-api`.
915

1016
Usage
1117
------
1218

13-
To use Ceed, you first need to install it, see :ref:`install-ceed`.
19+
Ceed is normally run on the PCs connected to the required hardware described
20+
in :ref:`ceed-blueprint`. However, it can also be run in a demo-mode on
21+
a Windows/Linux PC without any additional hardware.
22+
23+
To run Ceed, you first need to install it as a python package; see :ref:`install-ceed`.
1424

15-
After it's installed, it is run through the main module. For example::
25+
After it's installed, you can run it by running the ``run_app`` file, or by entering
26+
``ceed`` in the terminal. For example::
1627

17-
python -m ceed.main
28+
python ceed/run_app.py
29+
# or if you are in the python enviroenment where ceed was installed, just
30+
ceed
31+
32+
A compiled executable can be downloaded from the
33+
`release page <https://github.com/matham/ceed/releases>`_ for Windows. This can be run
34+
as a demo, without installation.
35+
36+
Configuration
37+
-------------
1838

19-
Complete API documentation is at :ref:`ceed-root-api`.
39+
Ceed can be fully configured through a
40+
`yaml file <https://github.com/matham/ceed/blob/master/ceed/data/CeedApp_config.yaml>`_.
41+
This file is normally in the data directory under ceed, where ceed is installed.
42+
Documentation for all the configuration options is listed in the `CEED Config
43+
section <#CEED Config>`_.

doc/source/guide.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. _ceed-guide:
2+
3+
Ceed Guide
4+
==========
5+

doc/source/index.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@ Contents:
88
.. toctree::
99
:maxdepth: 2
1010

11+
getting_started.rst
1112
blueprint.rst
1213
installation.rst
13-
getting_started.rst
14+
guide.rst
1415

15-
apps/apps.rst
1616
config.rst
1717

18-
optics/optics.rst
18+
example_code/example_code.rst
1919

20+
apps/apps.rst
2021
api/api.rst
2122

22-
example_code/example_code.rst
23+
optics/optics.rst
2324

2425

2526
* :ref:`genindex`

0 commit comments

Comments
 (0)