Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ronny Eichler
dataman
Commits
2d27c95c
Commit
2d27c95c
authored
Mar 06, 2017
by
Ronny Eichler
Browse files
Get Open Ephys info from xml file
parent
3bb937fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
dataman/lib/dat.py
0 → 100644
View file @
2d27c95c
pass
\ No newline at end of file
dataman/vis/shaders/vis.vert
View file @
2d27c95c
...
...
@@ -33,7 +33,7 @@ void main() {
vec2
position
=
vec2
(
x
,
a_position
*
u_scale
.
y
);
// Find the affine transformation for the subplots.
vec2
a
=
vec2
(
1
.
/
ncols
,
1
.
/
nrows
)
*
.
96
;
vec2
a
=
vec2
(
1
.
/
ncols
,
1
.
/
nrows
)
*
1
.
0
;
// reduce to e.g. 0.98 for borders between columns
vec2
b
=
vec2
(
-
1
+
2
*
(
a_index
.
x
+
.
5
)
/
ncols
,
-
1
+
2
*
(
a_index
.
y
+
.
5
)
/
nrows
);
...
...
dataman/vis/vis.py
View file @
2d27c95c
...
...
@@ -33,7 +33,8 @@ with open(os.path.join(SHADER_PATH, 'vis.frag')) as fs:
class
Vis
(
app
.
Canvas
):
def
__init__
(
self
,
target_dir
,
n_cols
=
1
,
n_channels
=
64
,
max_samples_visible
=
30000
,
channels
=
None
):
app
.
Canvas
.
__init__
(
self
,
title
=
'Use your wheel to zoom!'
,
keys
=
'interactive'
)
app
.
Canvas
.
__init__
(
self
,
title
=
'Use your wheel to zoom!'
,
keys
=
'interactive'
,
size
=
(
1920
,
1080
),
position
=
(
0
,
0
))
self
.
logger
=
logging
.
getLogger
(
"Vis"
)
# running traces, looks cool, but useless for the most part
self
.
running
=
False
...
...
@@ -73,14 +74,13 @@ class Vis(app.Canvas):
# Color of each vertex
# TODO: make it more efficient by using a GLSL-based color map and the index.
color
=
np
.
repeat
(
np
.
random
.
uniform
(
size
=
(
self
.
n_rows
/
4
,
3
),
color
=
np
.
repeat
(
np
.
random
.
uniform
(
size
=
(
self
.
n_rows
/
/
4
,
3
),
low
=
.
1
,
high
=
.
9
),
self
.
max_samples_visible
*
self
.
n_cols
*
4
,
axis
=
0
).
astype
(
np
.
float32
)
print
()
cmap_path
=
os
.
path
.
join
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'shaders'
),
'4x4x8_half_vega20c_cmap.csv'
)
cmap
=
np
.
loadtxt
(
cmap_path
,
delimiter
=
','
)
# colors = np.repeat(cmap[:self.n_channels])
print
(
color
.
shape
,
cmap
.
shape
)
#
print(color.shape, cmap.shape)
# Signal 2D index of each vertex (row and col) and x-index (sample index
# within each signal).
...
...
@@ -138,7 +138,7 @@ class Vis(app.Canvas):
self
.
offset
=
0
elif
self
.
offset
>=
(
self
.
n_samples_total
-
self
.
max_samples_visible
)
//
self
.
block_size
:
self
.
offset
=
(
self
.
n_samples_total
-
self
.
max_samples_visible
)
//
self
.
block_size
print
(
self
.
offset
)
#
print(self.offset)
def
on_resize
(
self
,
event
):
gloo
.
set_viewport
(
0
,
0
,
*
event
.
physical_size
)
...
...
@@ -179,7 +179,7 @@ class Vis(app.Canvas):
shift_signal
=
dx
/
width
shift_samples
=
shift_signal
*
self
.
max_samples_visible
shift_offset
=
int
(
shift_samples
/
1024
)
print
(
self
.
drag_offset
-
shift_offset
)
#
print(self.drag_offset-shift_offset)
self
.
set_offset
(
absolute
=
self
.
drag_offset
-
shift_offset
)
if
event
.
button
==
2
:
...
...
@@ -209,6 +209,16 @@ class Vis(app.Canvas):
self
.
update
()
def
on_mouse_double_click
(
self
,
event
):
x
,
y
=
event
.
pos
x_r
=
x
/
self
.
size
[
0
]
y_r
=
y
/
self
.
size
[
1
]
# print(event.pos, self.size, x_r, y_r)
t_r
=
x_r
*
self
.
n_cols
-
math
.
floor
(
x_r
*
self
.
n_cols
)
t_sample
=
(
t_r
*
self
.
max_samples_visible
+
self
.
offset
*
self
.
block_size
)
t_sec
=
t_sample
/
self
.
fs
print
(
'Sample {} @ {}'
.
format
(
int
(
t_sample
),
tools
.
fmt_time
(
t_sec
)))
def
on_timer
(
self
,
event
):
"""Frame update callback."""
# FIXME: Sample precision positions
...
...
@@ -241,11 +251,11 @@ def run(*args, **kwargs):
parser
.
add_argument
(
'path'
,
help
=
'Relative or absolute path to directory'
,
default
=
'.'
,
nargs
=
'?'
)
parser
.
add_argument
(
'+c'
,
'++cols'
,
help
=
'Number of columns'
,
default
=
1
,
type
=
int
)
parser
.
add_argument
(
'+C'
,
'++channels'
,
help
=
'Number of channels'
,
default
=
32
,
type
=
int
)
parser
.
add_argument
(
'+C'
,
'++channels'
,
help
=
'Number of channels'
,
default
=
64
,
type
=
int
)
parser
.
add_argument
(
'+l'
,
'++layout'
,
help
=
'Path to probe file defining channel order'
)
cli_args
=
parser
.
parse_args
(
*
args
)
if
'layout'
in
cli_args
:
if
'layout'
in
cli_args
and
cli_args
.
layout
is
not
None
:
channels
=
oio_util
.
flat_channel_list
(
cli_args
.
layout
)[:
cli_args
.
channels
]
print
(
channels
)
else
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment