Function related to the LED dome hardware

For spherical coordinate system, we use the same as in physics:
https://en.wikipedia.org/wiki/Spherical_coordinate_system
where theta denotes the polar angle with respect to polar axis (same as inclination) and phi the azimuthal angle

get_dome_positions[source]

get_dome_positions(mode='cartesian')

Generates positions of all LEDs of the dome. Position of first and last LED of each stripe were estimated in Blender, and other in between LEDs position are interpolated from those two.

params:

- mode: What coordinates to obtain in set ["cartesian", "spherical"]

return:

- LED position of the LED dome, in shape (4, 237). shape[0] organized by quarter (q1 to q4) and shape[1] is the
concatenation of (left,right)

as_cartesian[source]

as_cartesian(rthetaphi, is_radian=True)

Convert 3D polar coordinate tuple into cartesian coordinates.

params:

- rthetaphi: Single or list of (r, theta, phi) iterable
- is_radian: Boolean to specify if in radians or in degrees

return:

- Single or list of converted (x, y, z) array.

as_spherical[source]

as_spherical(xyz)

Convert 3D cartesian coordinates tuple into polar coordinate.

params:

- xyz: Single or list of (x, y, z) iterable

return:

- Single or list of converted (r, theta, phi) array.

angular_distance[source]

angular_distance(theta_1, phi_1, theta_2, phi_2)

Computes the angle separating two points (or a list of points) on a sphere, in radians. params:

- theta_1: Theta angle of the first point.
- phi_1:   Phi angle of the first point.
- theta_2: Theta angle of the second point.
- phi_2:   Phi angle of the second point.
get_dome_positions(mode="spherical")
array([[[ 1.00911709e+02,  1.45941156e+00,  1.48787652e+00],
        [ 1.00913992e+02,  1.39316057e+00,  1.48574122e+00],
        [ 1.00917188e+02,  1.32691399e+00,  1.48355455e+00],
        ...,
        [ 1.00994145e+02,  1.82982730e-01,  1.80999280e+00],
        [ 1.00994632e+02,  1.19911782e-01,  1.94309113e+00],
        [ 1.00994918e+02,  6.32134647e-02,  2.33532331e+00]],

       [[ 1.00911709e+02,  1.45941156e+00, -8.29198024e-02],
        [ 1.00913992e+02,  1.39316057e+00, -8.50551089e-02],
        [ 1.00917188e+02,  1.32691399e+00, -8.72417763e-02],
        ...,
        [ 1.00994145e+02,  1.82982730e-01,  2.39196471e-01],
        [ 1.00994632e+02,  1.19911782e-01,  3.72294808e-01],
        [ 1.00994918e+02,  6.32134647e-02,  7.64526983e-01]],

       [[ 1.00911709e+02,  1.45941156e+00, -1.65371613e+00],
        [ 1.00913992e+02,  1.39316057e+00, -1.65585144e+00],
        [ 1.00917188e+02,  1.32691399e+00, -1.65803810e+00],
        ...,
        [ 1.00994145e+02,  1.82982730e-01, -1.33159986e+00],
        [ 1.00994632e+02,  1.19911782e-01, -1.19850152e+00],
        [ 1.00994918e+02,  6.32134647e-02, -8.06269344e-01]],

       [[ 1.00911709e+02,  1.45941156e+00,  3.05867285e+00],
        [ 1.00913992e+02,  1.39316057e+00,  3.05653754e+00],
        [ 1.00917188e+02,  1.32691399e+00,  3.05435088e+00],
        ...,
        [ 1.00994145e+02,  1.82982730e-01, -2.90239618e+00],
        [ 1.00994632e+02,  1.19911782e-01, -2.76929785e+00],
        [ 1.00994918e+02,  6.32134647e-02, -2.37706567e+00]]])

build_wave_stimulus_array[source]

build_wave_stimulus_array(epoch_sequence, wave_width=0.58, wave_speed=0.58, n_frame_epoch=640, n_frame_isi=50, frame_rate=100)

Build the numpy stimulus matrix of the LED values for each frame. params:

- epoch_sequence: Sequence of indexes played randomly during the stimulation
- wave_width: Width of the wave in radians
- wave_speed: Speed of the wave in radians.s-1
- n_frame_epoch: Number of frames that an epoch last
- n_frame_isi: Number of frames during teh inter-stimulus-interval
- frame_rate: Frame rate of the display

returns:

- LED values for the wave stimulus, in shape (t, 4, 237), where t=n_epoch*(n_frame_epoch+n_frame_isi)

class Quaternion[source]

Quaternion(q0, qx, qy, qz)

Simplified Quaternion class for rotation of normalized vectors only!

get_waves_relative_position[source]

get_waves_relative_position(cell_sta_position, n_waves=100, mode='spherical')

Rotate the waves origins to obtain for the ref_led_flat_idx a spherical position of (0,0) params:

- cell_sta_position: (theta, phi) Tuple of the cell position in spherical coordinates
- n_waves: Number of waves in the wave stimulus (positions/density of waves determined by this parameter)
- mode: One of ["spherical", "cartesian"], for the returned position

return:

- The rotated waves position

get_led_relative_position[source]

get_led_relative_position(ref_led_flat_idx, mode='spherical')

Rotate the LED positions to obtain for the ref_led_flat_idx a spherical position of (0,0) params:

- ref_led_flat_idx: Flattened index of the reference LED (e.g. obtained with np.argmax on abs STA values)
- mode: One of ["spherical", "cartesian"], for the returned position

return:

- The rotated LED position