Datasets:

Modalities:
Image
Languages:
English
Size:
< 1K
Libraries:
Datasets
License:
joesterle commited on
Commit
e4aacda
·
1 Parent(s): 132aa84

Document folder structure in README, remove duplicate top-level stimuli/

Browse files

The old stimuli/ folder duplicated data-2p/stimuli/; its only unique
file (chirp_stimulus.npy) is moved into data-2p/stimuli/global_chirp/.

README.md CHANGED
@@ -10,4 +10,33 @@ tags:
10
  pretty_name: Eyewire II - Resource paper - Data
11
  size_categories:
12
  - 10K<n<100K
13
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  pretty_name: Eyewire II - Resource paper - Data
11
  size_categories:
12
  - 10K<n<100K
13
+ ---
14
+
15
+ # Eyewire II - Resource paper - Data
16
+
17
+ Data accompanying the Eyewire II resource paper. Consumed by [eyewire2-functional-analysis](https://github.com/eyewire2/eyewire2-functional-analysis) and [eyewire2-figures](https://github.com/eyewire2/eyewire2-figures) — see those repos' READMEs for how to download and place this data.
18
+
19
+ ## Contents
20
+
21
+ - `data-2p/` — preprocessed 2P calcium-imaging data (5 recording fields), stored as parquet files. See [data-2p/README.md](data-2p/README.md).
22
+ - `smh/` — raw ScanM stimulus header files, one per recording field/stimulus.
23
+ - `stimuli/` — QDSpy stimulator scripts and stimulus descriptions (chirp, moving bar, mouse-cam movies). See [data-2p/stimuli/README.md](data-2p/stimuli/README.md).
24
+ - `data-em/`
25
+ - `dataframes/` — EM-derived analysis dataframes.
26
+ - `df_all_neurons_*.parquet` — dataframe holding cell information
27
+ - `df_ribbons_*.parquet` — dataframe holding ribbon information
28
+ - `fig8_df_rbc_celltype_*.parquet` — dataframe for figure 8
29
+ - `fig8_df_rbc_synapse_*.parquet` — dataframe for figure 8
30
+ - `misc/`
31
+ - `Movie_tissue-and-overview-supplemental-1.mp4` — Movie of EM stack
32
+ - `images/`
33
+ - `highres-images-2p/` — `GCL0.tif` … `GCL4.tif`. high-res versions of the five 2P recording fields
34
+ - `em-fields/` — images in EM of the five 2P fields
35
+ - `spreadsheets/` — master proofreading spreadsheets maintained in [eyewire2-master-sheet-cleanup](https://github.com/eyewire2/eyewire2-master-sheet-cleanup):
36
+ - `Eyewire II Proofread Cells Main List - All Cells {date}.csv` — the cell list (WIP)
37
+ - `Eyewire II Proofread Cells Main List - All BCs {date}.csv` — the current bipolar-cell list (WIP)
38
+ - `Eyewire II Proofread Cells Main List - All Glia {date}.csv` — the glia list (WIP)
39
+ - `Eyewire II Proofread Cells Main List - EM-2p-mapping {date}.csv` — known EM-cell ↔ 2P-ROI correspondences, used to fit the 2P-to-EM coordinate registration
40
+ - `Eyewire II Proofread Cells Main List - Cell types and properties {date}.csv` — current cell type description (WIP)
41
+ - `swc/`, `swc.zip`, `swc-examples.zip` — EM neuron skeletons in SWC format. `swc.zip` contains skeletons for all cells used in the paper (optional download); `swc-examples.zip` contains just the subset shown in the figures. `swc/` itself isn't committed (see `.gitignore`) — unzip one of the archives into it locally.
42
+ - `track_proofreading/`, `track_proofreading.zip` — per-cell proofreading changelogs (`changelogs_csv/segid_changelog_df_<segid>_<name>.csv`), one CSV per segment ID recording its proofreading edit history. Like `swc/`, only the zipped version is committed.
{stimuli → data-2p/stimuli}/global_chirp/chirp_stimulus.npy RENAMED
File without changes
stimuli/QDSpy/.ipynb_checkpoints/test_images_rand_right_marked-checkpoint.jpg DELETED

Git LFS Details

  • SHA256: 3eba11af268900c5b7cfa60eb053503d1493200056e158f0d103b648221dd195
  • Pointer size: 131 Bytes
  • Size of remote file: 755 kB
stimuli/QDSpy/Chirp.pickle DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:4f1337a3dc42a5d6df898375ef4b96fd5e0d213afafd7f9e8047dbd2d1b816ad
3
- size 4900117
 
 
 
 
stimuli/QDSpy/Chirp.py DELETED
@@ -1,104 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # ---------------------------------------------------------------------
4
- import QDS
5
- import math
6
-
7
- QDS.Initialize("RGC_Chirp", "'chirp' in fingerprinting stimulus set")
8
-
9
- # Define global stimulus parameters
10
- #
11
- p = {"nTrials" : 5,
12
- "chirpDur_s" : 8.0, # Rising chirp phase
13
- "chirpMaxFreq_Hz" : 8.0, # Peak frequency of chirp (Hz)
14
- "ContrastFreq_Hz" : 2.0, # Freqency at which contrast
15
- # is modulated
16
- "tSteadyOFF_s" : 3.0, # Light OFF at beginning ...
17
- "tSteadyOFF2_s" : 2.0, # ... and end of stimulus
18
- "tSteadyON_s" : 3.0, # Light 100% ON before and
19
- # after chirp
20
- "tSteadyMID_s" : 2.0, # Light at 50% for steps
21
- "IHalf" : 127,
22
- "IFull" : 254,
23
- "dxStim_um" : 1000, # Stimulus size
24
- "StimType" : 2, # 1 = Box, 2 = Circle/
25
- "durFr_s" : 1/60.0, # Frame duration
26
- "nFrPerMarker" : 3}
27
- QDS.LogUserParameters(p)
28
-
29
- # Some calculations
30
- #
31
- # Chirp formula is f(t) = sin( 2pi*F0 + pi*K*t^2))
32
- # where:
33
- # F0 is Starting Frequency
34
- # K = Acceleration (Hz / s)
35
- # t = time (s)
36
- #
37
- nPntChirp = int(p["chirpDur_s"] /p["durFr_s"])
38
- K_HzPerSec = p["chirpMaxFreq_Hz"] /p["chirpDur_s"] # acceleration in Hz/s
39
- durMarker_s = p["durFr_s"]*p["nFrPerMarker"]
40
-
41
- RGB_IHalf = (p["IHalf"],p["IHalf"],p["IHalf"])
42
- RGB_IFull = (p["IFull"],p["IFull"],p["IFull"])
43
-
44
- # Define stimulus objects
45
- #
46
- QDS.DefObj_Box(1, p["dxStim_um"], p["dxStim_um"], 0)
47
- QDS.DefObj_Ellipse(2, p["dxStim_um"], p["dxStim_um"])
48
-
49
- # Start of stimulus run
50
- #
51
- QDS.StartScript()
52
-
53
- for iL in range(p["nTrials"]):
54
- # Steady steps
55
- #
56
- QDS.Scene_Clear(durMarker_s, 1)
57
- QDS.Scene_Clear(p["tSteadyOFF2_s"] -durMarker_s, 0)
58
-
59
- QDS.SetObjColor(1, [p["StimType"]], [RGB_IFull])
60
- QDS.Scene_Render(p["tSteadyON_s"], 1, [p["StimType"]], [(0,0)], 0)
61
-
62
- QDS.Scene_Clear(durMarker_s, 1)
63
- QDS.Scene_Clear(p["tSteadyOFF_s"] -durMarker_s, 0)
64
-
65
- QDS.SetObjColor(1, [p["StimType"]], [RGB_IHalf])
66
- QDS.Scene_Render(p["tSteadyMID_s"], 1, [p["StimType"]], [(0,0)], 0)
67
-
68
- # Frequency chirp
69
- #
70
- for iT in range(nPntChirp):
71
- t_s = iT*p["durFr_s"] # in ms
72
- Intensity = math.sin(math.pi *K_HzPerSec *t_s**2) *p["IHalf"] +p["IHalf"]
73
- RGB = (int(Intensity),int(Intensity),int(Intensity)) # -> RGB tuple
74
- QDS.SetObjColor (1, [p["StimType"]], [RGB])
75
- QDS.Scene_Render(p["durFr_s"], 1, [p["StimType"]], [(0,0)], 0)
76
-
77
- # Gap between frequency chirp and contrast chirp
78
- #
79
- QDS.SetObjColor (1, [p["StimType"]], [RGB_IHalf])
80
- QDS.Scene_Render(p["tSteadyMID_s"], 1, [p["StimType"]], [(0,0)], 0)
81
-
82
- # Contrast chirp
83
- #
84
- for iPnt in range(nPntChirp):
85
- t_s = iPnt*p["durFr_s"]
86
- IRamp = int(p["IHalf"] *t_s /p["chirpDur_s"])
87
-
88
- Intensity = math.sin(2*math.pi *p["ContrastFreq_Hz"] *t_s) *IRamp +p["IHalf"]
89
- RGB = 3 *(int(Intensity),)
90
- QDS.SetObjColor(1, [p["StimType"]], [RGB])
91
- QDS.Scene_Render(p["durFr_s"], 1, [p["StimType"]], [(0,0)], 0)
92
-
93
- # Gap after contrast chirp
94
- #
95
- QDS.SetObjColor(1, [p["StimType"]], [RGB_IHalf])
96
- QDS.Scene_Render(p["tSteadyMID_s"], 1, [p["StimType"]], [(0,0)], 0)
97
-
98
- QDS.Scene_Clear(p["tSteadyOFF_s"], 0)
99
-
100
- # Finalize stimulus
101
- #
102
- QDS.EndScript()
103
-
104
- # -----------------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
stimuli/QDSpy/DS.pickle DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1c449a70598a17290d23a103b97148623a1cfd4f6019f4b094b9a12964a88d2d
3
- size 813877
 
 
 
 
stimuli/QDSpy/DS.py DELETED
@@ -1,81 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # --------------------------------------------------------------------------
4
- import QDS
5
- import math
6
-
7
- # --------------------------------------------------------------------------
8
- def MoveBarSeq():
9
- # A function that presents the moving bar in the given number of
10
- # directions (= moving bar sequence)
11
- #
12
- for rot_deg in p["DirList"]:
13
- # Calculate rotation angle and starting position of bar
14
- #
15
- rot_rad = (rot_deg)/360.0 *2 *math.pi # (rot_deg-90) WHY???
16
- x = math.cos(rot_rad) *( moveDist_um /2.0)
17
- y = math.sin(rot_rad) *(-moveDist_um /2.0)
18
-
19
- # Move the bar stepwise across the screen (as smooth as permitted
20
- # by the refresh frequency)
21
- #
22
- QDS.Scene_Clear(durMarker_s, 1)
23
- for iStep in range(int(nFrToMove)):
24
- QDS.Scene_RenderEx(p["durFr_s"], [1], [(x,y)], [(1.0,1.0)], [rot_deg],
25
- iStep < p["nFrPerMarker"])
26
- x -= math.cos(rot_rad) *umPerFr
27
- y += math.sin(rot_rad) *umPerFr
28
-
29
- # --------------------------------------------------------------------------
30
- # Main script
31
- # --------------------------------------------------------------------------
32
- QDS.Initialize("RGC_MovingBar", "'moving bar' in fingerprinting stimulus set")
33
-
34
- # Define global stimulus parameters
35
- #
36
- p = {"nTrials" : 3,
37
- "DirList" : [0,180, 45,225, 90,270, 135,315],
38
-
39
- "vel_umSec" : 1000.0, # speed of moving bar in um/sec
40
- "tMoveDur_s" : 4.0, # duration of movement (defines distance
41
- # the bar travels, not its speed)
42
- "barDx_um" : 1000.0, # bar dimensions in um
43
- "barDy_um" : 300.0,
44
- "bkgColor" : (0,0,0), # background color
45
- "barColor" : (255,255,255), # bar color
46
- "durFr_s" : 1/60.0, # Frame duration
47
- "nFrPerMarker" : 3
48
- }
49
- QDS.LogUserParameters(p)
50
-
51
- # Do some calculations
52
- #
53
- durMarker_s = p["durFr_s"]*p["nFrPerMarker"]
54
- freq_Hz = round(1.0 /p["durFr_s"])
55
- umPerFr = float(p["vel_umSec"]) /freq_Hz
56
- moveDist_um = p["vel_umSec"] *p["tMoveDur_s"]
57
- nFrToMove = float(moveDist_um) /umPerFr
58
-
59
- # Define stimulus objects
60
- #
61
- QDS.DefObj_Box(1, p["barDx_um"], p["barDy_um"])
62
-
63
- # Start of stimulus run
64
- #
65
- QDS.StartScript()
66
-
67
- QDS.SetObjColor(1, [1], [p["barColor"]])
68
- QDS.SetBkgColor(p["bkgColor"])
69
- QDS.Scene_Clear(3.0, 0)
70
-
71
- # Loop the moving bar sequence nTrial times
72
- #
73
- QDS.Loop(p["nTrials"], MoveBarSeq)
74
-
75
- QDS.Scene_Clear(1.0, 0)
76
-
77
- # Finalize stimulus
78
- #
79
- QDS.EndScript()
80
-
81
- # --------------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
stimuli/QDSpy/MouseCam_Right.py DELETED
@@ -1,135 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- #
4
- # ---------------------------------------------------------------------
5
- import QDS
6
- import random
7
- import numpy as np
8
- import os
9
-
10
- QDS.Initialize("MouseCam_Left")
11
-
12
- # Define global stimulus parameters
13
- #
14
- FrRefr_Hz = QDS.GetDefaultRefreshRate()
15
-
16
- p = {"nTrials" : 1, # number of stimulus presentations
17
- "movScale" : (12.5, 12.5), # movie scaling (x, y)
18
- "movOrient" : 0, # movie orientation
19
- "movAlpha" : 255, # transparency of movie
20
- "durSnippet_s" : 5.0, # duration of snippet
21
- "FrameRateMovie" : 30.0,
22
- "durFr_s" : 1/FrRefr_Hz, # frame duration
23
- "nFrPerMarker" : 3, # -> 50 ms markers
24
- "nFrRepeats" : 2, # -> 30 fps
25
- "movName_Test" : "//Katrin//RGCs//test_images_rand_right.jpg",
26
- "movName_Train" : "//Katrin//RGCs//train_images_right.jpg",
27
- "IndexName" : "RandomSequences"}
28
-
29
- """
30
- Preparation of movie montages in ImageJ (Fiji):
31
- 1. Open stack
32
- 2. image -> transform -> flip vertically
33
- 3. image -> stacks -> make montage
34
- If possible take values for columns and rows that fit all frames and
35
- result in a rather square image.
36
- scale factor=1, remaining parameters can stay as set by default
37
- 4. Resulting montage: image -> transform -> flip vertically
38
- 5. Save montage as .jpg (or .png, if montage is not too large)
39
- 6. Under the same name as the montage, make a text file (.txt) with
40
- the content analogous to this:
41
-
42
- [QDSMovie2Description]
43
- QDSVersionID=xQDS
44
- FrWidth=64
45
- FrHeight=64
46
- FrCount=750
47
- isFirstFrBottomLeft=True
48
- Comment=movies_test
49
-
50
- """
51
- QDS.LogUserParameters(p)
52
-
53
- # Define objects
54
-
55
- Indices = np.loadtxt("C://Users//AGEuler//Documents//QDSpy//Stimuli//Katrin//RGCs//RandomSequences.txt")
56
- UseColumn = random.randint(0,19)
57
- RandomValue = {"SequenceUsed" : UseColumn}
58
- QDS.LogUserParameters(RandomValue)
59
-
60
- print(os.getcwd())
61
-
62
- QDS.DefObj_Movie(1, p["movName_Test"])
63
- QDS.DefObj_Movie(2, p["movName_Train"])
64
- movparams_Test = QDS.GetMovieParameters(1)
65
- p["movparams_Test"] = movparams_Test
66
- movparams_Train = QDS.GetMovieParameters(2)
67
- p["movparams_Train"]= movparams_Train
68
- dFr = 1 /FrRefr_Hz
69
- nMark_Test = int(movparams_Test["nFr"]/(p["durSnippet_s"] *FrRefr_Hz /p["nFrRepeats"]))
70
- nMark_Train = int(movparams_Train["nFr"]/(p["durSnippet_s"] *FrRefr_Hz /p["nFrRepeats"]))
71
- dMark_s = p["nFrPerMarker"] *dFr
72
- nFr_Sequ = int(p["durSnippet_s"]*p["FrameRateMovie"])
73
-
74
- # Start of stimulus run
75
- #
76
- QDS.StartScript()
77
- QDS.Scene_Clear(1.00, 0)
78
-
79
- # Test set #1
80
-
81
- QDS.Start_Movie(1, (0,0), [0, movparams_Test["nFr"]-1, p["nFrRepeats"], 1], p["movScale"], p["movAlpha"], p["movOrient"])
82
-
83
- for iM in range(nMark_Test):
84
- QDS.Scene_Clear(dMark_s, 1)
85
- QDS.Scene_Clear(p["durSnippet_s"] -dMark_s, 0)
86
-
87
- # First half of training set
88
-
89
- for iF in range(int(nMark_Train/2)):
90
- FrameStart = int(Indices[iF][UseColumn])*nFr_Sequ
91
- FrameEnd = (int(Indices[iF][UseColumn])+1)*nFr_Sequ-1
92
- QDS.Start_Movie(2, (0,0), [FrameStart, FrameEnd, p["nFrRepeats"], 1], p["movScale"], p["movAlpha"], p["movOrient"])
93
- QDS.Scene_Clear(dMark_s, 1)
94
- QDS.Scene_Clear(p["durSnippet_s"] -dMark_s, 0)
95
-
96
- # Test set #2
97
-
98
- QDS.Start_Movie(1, (0,0), [0, movparams_Test["nFr"]-1, p["nFrRepeats"], 1], p["movScale"], p["movAlpha"], p["movOrient"])
99
-
100
- for iM in range(nMark_Test):
101
- QDS.Scene_Clear(dMark_s, 1)
102
- QDS.Scene_Clear(p["durSnippet_s"] -dMark_s, 0)
103
-
104
- # Second half of training set
105
-
106
- for iF in range(int(nMark_Train/2)):
107
- a = iF + int(nMark_Train/2)
108
- FrameStart = int(Indices[a][UseColumn])*nFr_Sequ
109
- FrameEnd = (int(Indices[a][UseColumn])+1)*nFr_Sequ-1
110
- QDS.Start_Movie(2, (0,0), [FrameStart, FrameEnd, p["nFrRepeats"], 1], p["movScale"], p["movAlpha"], p["movOrient"])
111
- QDS.Scene_Clear(dMark_s, 1)
112
- QDS.Scene_Clear(p["durSnippet_s"] -dMark_s, 0)
113
-
114
- #QDS.Start_Movie(2, (0,0), [int((movparams_Train["nFr"]/2)), movparams_Train["nFr"]-1, p["nFrRepeats"], 1], p["movScale"], p["movAlpha"], p["movOrient"])
115
-
116
- #for iM in range(int(nMark_Train/2)):
117
- # QDS.Scene_Clear(dMark_s, 1)
118
- # QDS.Scene_Clear(p["durSnippet_s"] -dMark_s, 0)
119
-
120
- # Test set #3
121
-
122
- QDS.Start_Movie(1, (0,0), [0, movparams_Test["nFr"]-1, p["nFrRepeats"], 1], p["movScale"], p["movAlpha"], p["movOrient"])
123
-
124
- for iM in range(nMark_Test):
125
- QDS.Scene_Clear(dMark_s, 1)
126
- QDS.Scene_Clear(p["durSnippet_s"] -dMark_s, 0)
127
-
128
- QDS.Scene_Clear(1.00, 0)
129
-
130
- # Finalize stimulus
131
- #
132
- QDS.EndScript()
133
-
134
- # -----------------------------------------------------------------------------
135
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
stimuli/QDSpy/RandomSequences.txt DELETED
@@ -1,108 +0,0 @@
1
- 26 39 23 107 77 50 63 77 76 57 68 67 100 26 83 0 14 78 28 5
2
- 22 72 22 13 105 33 88 103 72 95 85 27 88 9 39 85 76 105 30 51
3
- 61 0 29 38 55 96 105 12 10 24 14 41 18 66 86 44 87 50 12 97
4
- 49 84 71 84 22 38 28 50 44 68 10 29 39 52 19 38 18 80 103 78
5
- 42 43 86 66 61 21 36 84 64 105 47 15 8 0 0 31 53 81 34 33
6
- 53 10 38 82 48 92 68 8 37 89 5 106 72 83 47 100 77 40 2 100
7
- 63 37 78 43 104 42 84 73 23 22 21 72 60 25 35 12 47 12 8 42
8
- 41 92 47 1 64 89 65 32 38 78 51 8 86 53 36 9 104 13 19 84
9
- 30 28 74 39 45 80 58 29 53 58 12 20 63 35 59 91 93 48 22 43
10
- 3 40 103 79 35 9 81 91 58 39 50 64 59 6 6 56 103 10 50 37
11
- 97 30 6 16 82 62 37 36 86 7 93 49 103 70 87 53 43 68 20 13
12
- 39 34 41 62 107 100 99 97 73 71 42 19 104 3 81 25 81 34 39 101
13
- 68 94 72 24 65 87 24 69 19 42 64 42 10 105 13 4 45 11 75 69
14
- 46 48 89 26 89 2 102 87 89 45 103 75 49 104 84 68 36 70 7 25
15
- 24 86 30 8 100 35 60 46 34 81 22 10 17 97 46 39 79 91 9 67
16
- 47 59 76 14 36 93 14 28 69 12 26 71 54 45 56 77 89 62 45 7
17
- 76 62 98 45 33 79 2 6 0 93 71 97 82 86 62 69 52 1 99 52
18
- 101 8 106 71 17 4 61 44 100 55 11 61 85 99 7 50 21 20 68 86
19
- 29 88 79 28 66 16 92 102 21 85 60 32 19 36 8 30 66 43 15 1
20
- 25 35 26 29 16 53 96 101 56 2 25 17 44 43 107 57 35 15 36 79
21
- 23 99 63 104 96 55 8 64 75 16 37 66 40 49 67 99 64 64 66 65
22
- 90 46 60 101 34 99 26 9 83 33 46 89 37 71 69 95 65 52 3 63
23
- 83 60 35 98 74 51 16 47 67 56 39 39 6 14 88 32 80 61 76 44
24
- 50 98 12 41 1 40 71 10 30 14 0 90 28 20 64 64 97 95 60 8
25
- 73 56 88 93 42 71 78 38 51 82 70 51 69 63 66 41 29 97 18 30
26
- 45 61 49 32 28 3 98 105 15 54 34 65 14 58 15 40 51 92 97 91
27
- 100 49 5 34 5 106 29 13 54 53 82 62 70 72 14 51 0 51 32 106
28
- 93 20 104 15 8 1 22 62 26 17 17 99 11 93 94 70 92 104 89 59
29
- 60 95 24 50 103 101 80 33 2 34 65 37 55 84 68 20 105 29 81 9
30
- 106 93 15 69 41 27 1 16 46 70 16 105 78 46 54 5 88 8 52 95
31
- 10 13 66 89 50 41 50 104 3 60 43 12 101 5 25 65 7 33 6 57
32
- 54 27 53 30 40 97 67 18 96 11 31 101 38 51 33 3 40 89 43 16
33
- 1 90 68 99 10 69 3 98 4 100 105 6 50 42 38 15 54 60 101 22
34
- 102 42 70 40 54 25 15 35 101 19 90 86 33 12 100 78 90 77 86 62
35
- 98 101 95 51 88 54 20 51 71 9 95 28 87 50 10 82 84 7 88 28
36
- 15 66 19 59 59 24 49 83 42 25 104 78 67 15 44 94 13 83 13 74
37
- 17 7 54 83 11 31 25 88 52 3 7 25 31 1 50 101 19 71 46 76
38
- 31 104 8 105 6 19 93 70 55 84 84 80 36 37 58 17 73 65 27 23
39
- 87 70 7 49 9 8 62 23 99 18 6 3 76 79 30 47 49 36 72 82
40
- 16 41 11 87 52 98 35 90 104 76 36 95 95 11 37 61 59 66 21 14
41
- 8 68 96 75 2 32 11 30 66 40 4 85 35 60 28 28 56 54 11 49
42
- 89 65 55 65 31 43 10 7 14 29 94 35 107 80 27 46 101 28 98 2
43
- 67 14 69 48 3 23 52 80 105 47 91 92 3 2 4 102 24 90 49 19
44
- 85 64 28 25 92 39 86 45 63 23 86 2 46 74 9 73 33 88 84 53
45
- 34 67 43 96 37 11 27 96 78 98 30 93 52 82 101 16 58 106 87 39
46
- 33 3 46 12 87 61 91 82 94 44 96 9 9 19 98 7 74 4 92 104
47
- 62 23 21 19 97 29 59 99 41 10 101 50 71 41 40 29 9 58 67 47
48
- 79 45 10 35 7 72 17 17 12 96 78 68 64 59 12 2 61 3 54 73
49
- 64 58 51 63 62 17 39 65 28 27 87 16 61 103 5 103 11 42 16 32
50
- 77 76 3 61 58 0 9 26 61 106 13 100 22 31 60 59 60 69 57 10
51
- 66 87 37 3 76 18 48 48 103 59 44 1 23 68 18 45 71 17 47 35
52
- 59 32 25 0 70 20 74 76 27 5 81 96 80 85 43 48 85 25 79 61
53
- 37 53 84 67 39 59 0 74 32 49 18 88 84 107 34 42 6 0 41 93
54
- 5 63 48 97 68 14 69 15 88 46 66 14 5 32 45 98 57 96 73 26
55
- 57 50 32 20 38 57 30 14 102 99 89 0 56 90 92 43 70 98 95 55
56
- 52 97 18 5 84 68 6 57 24 43 2 74 73 54 90 79 82 24 23 36
57
- 38 55 97 72 15 84 19 86 90 32 79 11 53 30 17 62 38 102 44 66
58
- 44 36 13 10 4 48 4 1 79 64 100 13 105 48 76 49 30 30 25 40
59
- 96 105 87 85 44 78 21 68 84 36 23 33 20 75 96 81 72 87 48 98
60
- 105 31 65 21 80 107 64 25 74 65 67 56 65 95 77 22 86 76 26 15
61
- 51 78 14 11 27 105 55 22 59 20 92 4 66 40 63 14 41 84 93 17
62
- 32 91 1 54 29 65 103 24 25 73 41 34 34 10 73 83 50 27 100 60
63
- 82 102 80 100 47 83 94 58 9 87 74 77 41 102 65 88 5 94 58 99
64
- 48 24 100 86 78 86 100 72 31 86 1 40 21 8 97 36 34 47 14 70
65
- 43 71 107 6 20 6 40 42 1 62 3 7 16 29 57 55 78 63 53 41
66
- 28 15 17 70 51 82 83 54 95 26 88 57 81 87 103 33 46 19 38 4
67
- 11 107 56 64 12 28 72 75 43 75 35 45 96 64 11 71 25 32 80 3
68
- 92 9 105 37 43 104 23 67 29 72 19 47 32 89 93 90 99 101 59 90
69
- 56 12 27 80 101 63 75 95 13 15 20 63 15 94 42 105 16 86 83 12
70
- 35 11 40 23 49 60 57 59 92 61 76 60 102 81 24 104 17 74 51 20
71
- 27 85 73 106 79 64 79 92 107 8 63 38 94 28 53 75 106 59 77 83
72
- 13 29 0 55 60 46 42 21 62 80 29 30 68 67 70 87 69 45 4 31
73
- 19 1 57 58 25 90 43 66 82 102 33 102 89 69 74 93 2 79 0 81
74
- 88 44 45 91 56 77 41 56 85 103 73 73 48 56 89 63 42 100 5 6
75
- 107 25 36 52 99 26 54 37 60 91 55 22 47 57 20 89 44 46 65 21
76
- 86 38 42 77 14 22 13 34 49 101 61 83 57 18 52 37 26 2 85 107
77
- 55 96 67 22 53 47 12 85 17 1 106 58 25 77 21 8 94 93 24 54
78
- 40 21 44 88 57 45 104 53 11 13 45 87 24 61 23 54 39 37 17 24
79
- 9 6 91 73 75 56 107 3 22 69 58 70 92 106 75 18 20 107 56 50
80
- 91 51 59 46 30 75 45 94 20 21 62 23 2 101 102 97 27 18 91 75
81
- 95 80 58 95 85 85 32 20 18 30 75 76 30 44 82 6 23 41 37 92
82
- 80 57 39 36 23 66 101 19 16 52 69 54 79 7 16 107 8 6 102 102
83
- 2 106 2 103 86 52 5 106 57 63 15 44 29 39 1 76 55 56 42 29
84
- 74 79 34 102 24 5 7 43 36 6 102 36 58 73 22 74 12 38 64 11
85
- 12 19 90 90 13 37 46 78 87 74 53 81 27 62 51 10 32 55 62 48
86
- 99 17 77 76 32 7 53 79 65 107 52 48 43 16 72 52 15 31 105 96
87
- 94 89 92 7 73 94 73 11 80 31 72 31 51 24 2 72 3 23 10 46
88
- 72 100 82 78 81 58 90 2 5 104 24 69 13 91 61 21 75 35 29 80
89
- 21 103 75 42 83 30 38 107 70 48 49 55 62 13 104 24 91 9 70 94
90
- 58 83 94 47 95 49 77 41 33 90 40 26 77 27 80 34 31 75 107 77
91
- 20 75 20 27 106 103 82 27 47 4 99 18 106 38 99 19 100 39 63 0
92
- 84 54 61 92 72 81 18 100 93 88 8 46 45 34 95 11 63 21 1 105
93
- 103 26 62 57 21 15 33 89 6 83 48 82 26 47 32 66 4 73 55 18
94
- 7 22 33 68 0 70 56 61 97 41 56 91 7 88 31 58 96 99 40 88
95
- 104 69 4 18 18 12 51 63 39 50 27 98 97 4 106 13 67 5 90 38
96
- 69 74 102 17 102 102 95 5 8 0 54 59 93 23 49 26 28 103 61 87
97
- 75 2 83 33 71 76 70 60 98 67 59 5 74 76 91 60 107 22 96 45
98
- 6 73 52 60 67 91 87 4 7 38 98 107 98 65 3 84 102 67 74 89
99
- 36 47 81 74 94 44 44 39 68 94 38 53 42 17 41 86 98 49 35 68
100
- 65 52 99 2 91 74 85 40 81 35 97 21 99 33 26 80 83 26 106 56
101
- 14 4 64 44 46 67 76 49 45 28 28 52 91 21 71 96 10 53 69 64
102
- 4 77 31 81 90 13 89 71 77 79 32 79 1 55 29 1 22 16 94 34
103
- 71 16 50 9 93 88 31 31 106 37 80 103 12 22 79 27 48 14 71 27
104
- 81 5 16 56 69 73 47 52 50 66 83 94 4 78 55 35 1 72 31 58
105
- 0 81 9 31 19 36 97 0 48 97 107 84 0 98 85 67 37 57 104 71
106
- 18 18 101 94 98 34 34 93 35 51 77 43 83 100 48 23 68 85 33 103
107
- 78 33 85 53 63 10 106 55 91 77 9 24 75 92 105 106 95 82 82 85
108
- 70 82 93 4 26 95 66 81 40 92 57 104 90 96 78 92 62 44 78 72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
stimuli/QDSpy/test_images_rand_right.jpg DELETED

Git LFS Details

  • SHA256: bc1459e460deb8dd36ce62542d6a55dc4f075d71c1f8ca47bfe2425bbe733a2f
  • Pointer size: 131 Bytes
  • Size of remote file: 524 kB
stimuli/QDSpy/test_images_rand_right.txt DELETED
@@ -1,7 +0,0 @@
1
- [QDSMovie2Description]
2
- QDSVersionID=xQDS
3
- FrWidth=56
4
- FrHeight=56
5
- FrCount=750
6
- isFirstFrBottomLeft=True
7
- Comment=test_images_rand_right
 
 
 
 
 
 
 
 
stimuli/QDSpy/test_images_rand_right_marked.jpg DELETED

Git LFS Details

  • SHA256: 3eba11af268900c5b7cfa60eb053503d1493200056e158f0d103b648221dd195
  • Pointer size: 131 Bytes
  • Size of remote file: 755 kB
stimuli/QDSpy/train_images_right.jpg DELETED

Git LFS Details

  • SHA256: 995456676921aedb58e617ebe0dfe8023038309b194ef32035b11188ff2dfa1f
  • Pointer size: 132 Bytes
  • Size of remote file: 9.66 MB
stimuli/QDSpy/train_images_right.txt DELETED
@@ -1,7 +0,0 @@
1
- [QDSMovie2Description]
2
- QDSVersionID=xQDS
3
- FrWidth=56
4
- FrHeight=56
5
- FrCount=16200
6
- isFirstFrBottomLeft=True
7
- Comment=train_images_right
 
 
 
 
 
 
 
 
stimuli/QDSpy/train_images_right_marked.jpg DELETED

Git LFS Details

  • SHA256: 995456676921aedb58e617ebe0dfe8023038309b194ef32035b11188ff2dfa1f
  • Pointer size: 132 Bytes
  • Size of remote file: 9.66 MB
stimuli/README.md DELETED
@@ -1,48 +0,0 @@
1
- # Stimulus description
2
- In Eyewire2 stimuli were chirp, moving bar (MB) and mouse camera movies (MCs).
3
-
4
- The original QDSpy stimulator scripts for [chirp](./QDSpy/Chirp.py), [MB](./QDSpy//DS.py)
5
- and [MCs](./QDSpy/MouseCam_Right.py) are included in this folder.
6
-
7
- ## Chirp
8
- The chirp had a spot with a diameter of 1000 µm and otherwise follows previous publications.
9
- [Chirp PDF](./global_chirp/chirp1000_setup3.pdf)
10
-
11
- ## Moving bar
12
- The moving bar directions in the script were (0, 180, 45, 225, 90, 270, 135, 315) degrees.
13
- In the setup chamber this resulted in the following directions of the moving bar (↓, ↑, ↙, ↗, ←, →, ↖, ↘), where e.g. "↓" means back to front.
14
- The bar width (the dimension that is orthogonal to the direction of motion) was 300 µm, the speed 1000 µm/s, and the length 1000 µm.
15
- [Moving Bar PDF](./moving_bar/DS_setup3.pdf)
16
-
17
- ### Retina orientation
18
- The retina was from the right eye. Ventral was in the back of the setup chamber.
19
- So this is the orientation of the retina in the setup chamber:
20
- ```
21
- ----- Ventral ----
22
- Nasal ---- Temporal
23
- ----- Dorsal -----
24
- ```
25
- For the MB, 0° therefore means ventral to dorsal motion.
26
- 90° means temporal to nasal motion.
27
-
28
- In the manuscript the retina is depicted as (i.e. with a 180° rotation compared to the setup chamber):
29
- ```
30
- ------ Dorsal -----
31
- Temporal ---- Nasal
32
- ------ Ventral ----
33
- ```
34
- In this projection (0, 180, 45, 225, 90, 270, 135, 315) corresponds to (↑, ↓, ↗, ↙, →, ←, ↘, ↖).
35
-
36
- ## Mouse camera movies
37
- MCs were similar as in [Höfling et al. 2024](https://elifesciences.org/articles/86860) which were derived from recordings by [Qiu et al. 2021](https://www.cell.com/current-biology/fulltext/S0960-9822(21)00676-X).
38
- There are different MC stimuli, e.g. MC-16 and MC-20, that are all based on the same 113 five-second movie clips.
39
- Each MC stimulus MC-X is described by a sequence [test/train1-X/test/train2-X/test](https://iiif.elifesciences.org/lax:86860%2Felife-86860-fig1-v1.tif/full/1500,/0/default.jpg),
40
- where:
41
- - the test sequence, consisting of five movie clips, is the same for all MC versions and is shown three times (the beginning, the middle and the end),
42
- - and the train sequences train1-X and train2-X consist of 54 movie clips, each, that are differently ordered for each MC stimuli MC-X.
43
-
44
- Each MC therefore consists of a sequence of 123 five-second movie clips, with 123 corresponding triggertimes.
45
- The order of the train sequences is stored in [RandomSequences.txt]().
46
- With [mc_to_numpy.py]() you can generate numpy arrays that correspond to the MC stimuli.
47
- With [mc_arrays/load_mc_array.ipynb]() you can display them as they would appear in QDSpy.
48
- In the setup chamber the movies were rotated by 90 degrees counter-clockwise.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
stimuli/global_chirp/chirp1000_setup3.pdf DELETED
Binary file (27.4 kB)
 
stimuli/global_chirp/chirp1000_setup3_movie_and_trigger.npz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:dacff1cf7aaa305135215c34539f3239eb8417518a764b5a1dbc9268d3d290ce
3
- size 638327
 
 
 
 
stimuli/mouse_cam_movies/.ipynb_checkpoints/mc_to_numpy-checkpoint.py DELETED
@@ -1,169 +0,0 @@
1
- import numpy as np
2
- from PIL import Image
3
- import random
4
-
5
- # -----------------------------
6
- # Helper Functions
7
- # -----------------------------
8
- def load_montage(image_path, frame_width, frame_height, color_sequence='BGR'):
9
- """
10
- Load a montage image and split it into individual frames.
11
- The coordinate system is defined such that (0,0) is at the bottom-left.
12
-
13
- Args:
14
- image_path: Path to the montage image file.
15
- frame_width: Width of each frame in pixels.
16
- frame_height: Height of each frame in pixels.
17
- color_sequence: 'BGR' or 'RGB' indicating the color channel order.
18
-
19
- Returns:
20
- frames: NumPy array of shape (num_frames, height, width, 3)
21
- """
22
- # Load image and convert to RGB
23
- img = Image.open(image_path).convert('RGB')
24
- if color_sequence == 'BGR':
25
- r, g, b = img.split()
26
- img = Image.merge("RGB", (b, g, r))
27
- elif color_sequence != 'RGB':
28
- raise ValueError("color_sequence must be 'BGR' or 'RGB'")
29
- img_np = np.array(img)
30
-
31
- total_height, total_width, _ = img_np.shape
32
- cols = total_width // frame_width
33
- rows = total_height // frame_height
34
- num_frames = rows * cols
35
-
36
- frames = []
37
- for row in range(rows):
38
- # Flip row index to make 0,0 at the bottom-left
39
- flipped_row = rows - 1 - row
40
- for col in range(cols):
41
- x_start = col * frame_width
42
- y_start = flipped_row * frame_height
43
- frame = img_np[y_start:y_start + frame_height, x_start:x_start + frame_width, :]
44
- frames.append(frame)
45
-
46
- frames = np.array(frames, dtype=np.uint8)
47
- assert num_frames == len(frames)
48
-
49
- return frames
50
-
51
-
52
- def build_movie(p, sequence_column=None, color_sequence='BGR'):
53
- """
54
- Build the full stimulus sequence following the logic of the original QDSpy script.
55
-
56
- Args:
57
- p: Dictionary with parameters.
58
- sequence_column: If None, a random column will be chosen.
59
- color_sequence: 'BGR' or 'RGB' indicating the color channel order.
60
-
61
- Returns:
62
- movie: NumPy array of shape (height, width, time, 3)
63
- used_column: The actual random sequence column that was used.
64
- """
65
- # Load random sequence file
66
- indices = np.loadtxt(p["IndexName"])
67
- num_columns = indices.shape[1]
68
-
69
- # Choose which random sequence column to use
70
- if sequence_column is None:
71
- sequence_column = random.randint(0, num_columns - 1)
72
-
73
- height, width = p["frame_height"], p["frame_width"]
74
-
75
- # Load montages
76
- test_frames = load_montage(p["movName_Test"], width, height, color_sequence=color_sequence)
77
- print('Test frames loaded:', test_frames.shape)
78
- train_frames = load_montage(p["movName_Train"], width, height, color_sequence=color_sequence)
79
- print('Train frames loaded:', train_frames.shape)
80
-
81
- # Frame counts
82
- nFr_Test = test_frames.shape[0]
83
- nFr_Train = train_frames.shape[0]
84
- nSeqs_Train = int(nFr_Train / (p["durSnippet_s"] * p["FrameRateMovie"]))
85
- nFr_Sequ = int(p["durSnippet_s"] * p["FrameRateMovie"])
86
-
87
- print(f"Test frames: {nFr_Test}, Train frames: {nFr_Train}"
88
- f"Train sequences: {nSeqs_Train}, Frames per sequence: {nFr_Sequ}")
89
-
90
- # Total sequence length (upper bound estimate)
91
- total_frames = 3 * nFr_Test + nFr_Train
92
-
93
- # Initialize sequence
94
- movie = np.zeros((total_frames, height, width, 3), dtype=np.uint8)
95
- t = 0
96
-
97
- def insert_test_block():
98
- nonlocal t
99
- movie[t:t+nFr_Test] = test_frames
100
- t += nFr_Test
101
-
102
- # -----------------------------
103
- # Test Set #1
104
- # -----------------------------
105
- insert_test_block()
106
-
107
- # -----------------------------
108
- # First half of training set
109
- # -----------------------------
110
- for iF in range(int(nSeqs_Train / 2)):
111
- FrameStart = int(indices[iF][sequence_column]) * nFr_Sequ
112
- FrameEnd = (int(indices[iF][sequence_column]) + 1) * nFr_Sequ - 1
113
- movie[t:t + nFr_Sequ] = train_frames[FrameStart:FrameEnd + 1]
114
- t += nFr_Sequ
115
-
116
- # -----------------------------
117
- # Test Set #2
118
- # -----------------------------
119
- insert_test_block()
120
-
121
- # -----------------------------
122
- # Second half of training set
123
- # -----------------------------
124
- for iF in range(int(nSeqs_Train / 2)):
125
- a = iF + int(nSeqs_Train / 2)
126
- FrameStart = int(indices[a][sequence_column]) * nFr_Sequ
127
- FrameEnd = (int(indices[a][sequence_column]) + 1) * nFr_Sequ - 1
128
- movie[t:t + nFr_Sequ] = train_frames[FrameStart:FrameEnd + 1]
129
- t += nFr_Sequ
130
-
131
- # -----------------------------
132
- # Test Set #3
133
- # -----------------------------
134
- insert_test_block()
135
-
136
- # Trim excess sequence
137
- movie = movie[:, :, :t, :]
138
-
139
- return movie, sequence_column
140
-
141
-
142
- # -----------------------------
143
- # Main Entry Point
144
- # -----------------------------
145
- def main(sequence_column=None, color_sequence='BGR'):
146
- """
147
- Main function to generate the stimulus sequence.
148
- Set sequence_column to force a specific column, or leave as None for random.
149
- """
150
- # Parameter dictionary
151
- p = {
152
- "durSnippet_s": 5.0, # each snippet is 5 seconds
153
- "FrameRateMovie": 30.0, # frames per second
154
- "movName_Test": "test_images_rand_right.jpg",
155
- "movName_Train": "train_images_right.jpg",
156
- "IndexName": "RandomSequences.txt",
157
- "frame_width": 56, # from movparams
158
- "frame_height": 56,
159
- }
160
-
161
- sequence, used_column = build_movie(p, sequence_column, color_sequence=color_sequence)
162
- np.save(f"mc_arrays/MC{used_column}.npy", sequence)
163
-
164
-
165
- if __name__ == "__main__":
166
- #main(sequence_column=0)
167
-
168
- for i in range(20):
169
- main(sequence_column=i)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
stimuli/mouse_cam_movies/mc_arrays/.ipynb_checkpoints/load_mc_array-checkpoint.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
stimuli/mouse_cam_movies/mc_arrays/MC15.npy DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:831038931371219349d7a013358b1518ae687f9a6189a4051348535525c6e183
3
- size 173577728
 
 
 
 
stimuli/mouse_cam_movies/mc_arrays/load_mc_array.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
stimuli/mouse_cam_movies/mc_to_numpy.py DELETED
@@ -1,185 +0,0 @@
1
- import os
2
- import numpy as np
3
- from PIL import Image
4
- import random
5
-
6
- # -----------------------------
7
- # Helper Functions
8
- # -----------------------------
9
- def load_montage(image_path, frame_width, frame_height, color_sequence='BGR'):
10
- """
11
- Load a montage image and split it into individual frames.
12
- The coordinate system is defined such that (0,0) is at the bottom-left.
13
-
14
- Args:
15
- image_path: Path to the montage image file.
16
- frame_width: Width of each frame in pixels.
17
- frame_height: Height of each frame in pixels.
18
- color_sequence: 'BGR' or 'RGB' indicating the color channel order.
19
-
20
- Returns:
21
- frames: NumPy array of shape (num_frames, height, width, 3)
22
- """
23
- # Load image and convert to RGB
24
- img = Image.open(image_path).convert('RGB')
25
- if color_sequence == 'BGR':
26
- r, g, b = img.split()
27
- img = Image.merge("RGB", (b, g, r))
28
- elif color_sequence != 'RGB':
29
- raise ValueError("color_sequence must be 'BGR' or 'RGB'")
30
- img_np = np.array(img)
31
-
32
- total_height, total_width, _ = img_np.shape
33
- cols = total_width // frame_width
34
- rows = total_height // frame_height
35
- num_frames = rows * cols
36
-
37
- frames = []
38
- for row in range(rows):
39
- # Flip row index to make 0,0 at the bottom-left
40
- flipped_row = rows - 1 - row
41
- for col in range(cols):
42
- x_start = col * frame_width
43
- y_start = flipped_row * frame_height
44
- frame = img_np[y_start:y_start + frame_height, x_start:x_start + frame_width, :]
45
- frames.append(frame)
46
-
47
- frames = np.array(frames, dtype=np.uint8)
48
- assert num_frames == len(frames)
49
-
50
- return frames
51
-
52
-
53
- def build_movie(p, sequence_column=None, color_sequence='BGR'):
54
- """
55
- Build the full stimulus sequence following the logic of the original QDSpy script.
56
-
57
- Args:
58
- p: Dictionary with parameters.
59
- sequence_column: If None, a random column will be chosen.
60
- color_sequence: 'BGR' or 'RGB' indicating the color channel order.
61
-
62
- Returns:
63
- movie: NumPy array of shape (height, width, time, 3)
64
- used_column: The actual random sequence column that was used.
65
- """
66
- # Load random sequence file
67
- indices = np.loadtxt(p["IndexName"])
68
- num_columns = indices.shape[1]
69
-
70
- # Choose which random sequence column to use
71
- if sequence_column is None:
72
- sequence_column = random.randint(0, num_columns - 1)
73
-
74
- height, width = p["frame_height"], p["frame_width"]
75
-
76
- # Load montages
77
- test_frames = load_montage(p["movName_Test"], width, height, color_sequence=color_sequence)
78
- print('Test frames loaded:', test_frames.shape)
79
- train_frames = load_montage(p["movName_Train"], width, height, color_sequence=color_sequence)
80
- print('Train frames loaded:', train_frames.shape)
81
-
82
- # Frame counts
83
- nFr_Test = test_frames.shape[0]
84
- nFr_Train = train_frames.shape[0]
85
- nSeqs_Train = int(nFr_Train / (p["durSnippet_s"] * p["FrameRateMovie"]))
86
- nFr_Sequ = int(p["durSnippet_s"] * p["FrameRateMovie"])
87
-
88
- print(f"Test frames: {nFr_Test}, Train frames: {nFr_Train}"
89
- f"Train sequences: {nSeqs_Train}, Frames per sequence: {nFr_Sequ}")
90
-
91
- # Total sequence length (upper bound estimate)
92
- total_frames = 3 * nFr_Test + nFr_Train
93
-
94
- # Initialize sequence
95
- movie = np.zeros((total_frames, height, width, 3), dtype=np.uint8)
96
- t = 0
97
-
98
- def insert_test_block():
99
- nonlocal t
100
- movie[t:t+nFr_Test] = test_frames
101
- t += nFr_Test
102
-
103
- # -----------------------------
104
- # Test Set #1
105
- # -----------------------------
106
- insert_test_block()
107
-
108
- # -----------------------------
109
- # First half of training set
110
- # -----------------------------
111
- for iF in range(int(nSeqs_Train / 2)):
112
- FrameStart = int(indices[iF][sequence_column]) * nFr_Sequ
113
- FrameEnd = (int(indices[iF][sequence_column]) + 1) * nFr_Sequ - 1
114
- movie[t:t + nFr_Sequ] = train_frames[FrameStart:FrameEnd + 1]
115
- t += nFr_Sequ
116
-
117
- # -----------------------------
118
- # Test Set #2
119
- # -----------------------------
120
- insert_test_block()
121
-
122
- # -----------------------------
123
- # Second half of training set
124
- # -----------------------------
125
- for iF in range(int(nSeqs_Train / 2)):
126
- a = iF + int(nSeqs_Train / 2)
127
- FrameStart = int(indices[a][sequence_column]) * nFr_Sequ
128
- FrameEnd = (int(indices[a][sequence_column]) + 1) * nFr_Sequ - 1
129
- movie[t:t + nFr_Sequ] = train_frames[FrameStart:FrameEnd + 1]
130
- t += nFr_Sequ
131
-
132
- # -----------------------------
133
- # Test Set #3
134
- # -----------------------------
135
- insert_test_block()
136
-
137
- # Trim excess sequence
138
- movie = movie[:, :, :t, :]
139
-
140
- return movie, sequence_column
141
-
142
-
143
- # -----------------------------
144
- # Main Entry Point
145
- # -----------------------------
146
- def main(sequence_column=None, color_sequence='BGR',
147
- qdspy_path=os.path.join(os.path.abspath(os.path.dirname(__file__)), "../QDSpy")):
148
- """
149
- Main function to generate the stimulus sequence.
150
- Set sequence_column to force a specific column, or leave as None for random.
151
-
152
- Args:
153
- sequence_column: Column index of the random sequence to use (None = random).
154
- color_sequence: 'BGR' or 'RGB' color channel order.
155
- qdspy_path: Path to the folder containing the QDSpy stimulus files
156
- (montage images and index file).
157
- """
158
- # print absolute path to folder
159
- print("QDSpy path:", os.path.abspath(qdspy_path))
160
-
161
- assert os.path.exists(qdspy_path), f"QDSpy path does not exist: {qdspy_path}"
162
-
163
- # Parameter dictionary
164
- p = {
165
- "durSnippet_s": 5.0, # each snippet is 5 seconds
166
- "FrameRateMovie": 30.0, # frames per second
167
- "movName_Test": os.path.join(qdspy_path, "test_images_rand_right.jpg"),
168
- "movName_Train": os.path.join(qdspy_path, "train_images_right.jpg"),
169
- "IndexName": os.path.join(qdspy_path, "RandomSequences.txt"),
170
- "frame_width": 56, # from movparams
171
- "frame_height": 56,
172
- }
173
-
174
- sequence, used_column = build_movie(p, sequence_column, color_sequence=color_sequence)
175
- script_dir = os.path.abspath(os.path.dirname(__file__))
176
- out_path = os.path.join(script_dir, "mc_arrays", f"MC{used_column}.npy")
177
- os.makedirs(os.path.dirname(out_path), exist_ok=True)
178
- np.save(out_path, sequence)
179
-
180
-
181
- if __name__ == "__main__":
182
- #main(sequence_column=0)
183
-
184
- for i in range(20):
185
- main(sequence_column=i)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
stimuli/moving_bar/DS_setup3.pdf DELETED
Binary file (35.7 kB)
 
stimuli/moving_bar/DS_setup3_movie_and_trigger.npz DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:b408385bd75a46d9921cdce6640d2ab73ad79ff1a612ea88d6d16a7c82b7d198
3
- size 119072