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
Track Analyzer
track-analyzer
Commits
7214292c
Commit
7214292c
authored
Nov 26, 2021
by
amichaut
Browse files
map_analysis supports missing image_size
parent
652caff8
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
run_TA.ipynb
View file @
7214292c
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
track_analyzer/prepare.py
View file @
7214292c
...
...
@@ -1123,7 +1123,16 @@ def get_image(data_dir, filename=None, verbose=False):
image_dict
=
{
'image_fn'
:
filename
,
't_dim'
:
t_dim
,
'z_dim'
:
z_dim
,
'image_size'
:
im
.
shape
[
-
2
:]}
else
:
image_dict
=
{
'image_fn'
:
None
,
't_dim'
:
None
,
'z_dim'
:
None
,
'image_size'
:
None
}
# get image size
info
=
get_info
(
data_dir
)
if
'image_width'
in
info
.
keys
()
and
'image_height'
in
info
.
keys
():
if
info
[
'image_width'
]
is
not
None
and
info
[
'image_height'
]
is
not
None
:
image_size
=
(
info
[
'image_height'
],
info
[
'image_width'
])
else
:
image_size
=
None
print
(
"WARNING: no image in directory, and image size is not defined in info.txt"
)
image_dict
=
{
'image_fn'
:
None
,
't_dim'
:
None
,
'z_dim'
:
None
,
'image_size'
:
image_size
}
return
image_dict
...
...
track_analyzer/scripts/analyze_maps.py
View file @
7214292c
...
...
@@ -96,7 +96,13 @@ def map_analysis(data_dir, data=None, image=None, refresh=False, parallelize=Fal
df_list
=
[
df
[
df
[
'subset'
]
==
sub
]
for
sub
in
df
[
'subset'
].
unique
()]
# a list of df filtered by subset
# Make grid
image_size
=
[
image
[
'image_size'
][
1
],
image
[
'image_size'
][
0
]]
# image width,image height in px
if
image
[
'image_size'
]
is
None
:
# get image size using data, making it slighlty larger
xmax
=
df
[
'x'
].
max
()
+
0.05
*
(
df
[
'x'
].
max
()
-
df
[
'x'
].
min
())
ymax
=
df
[
'y'
].
max
()
+
0.05
*
(
df
[
'y'
].
max
()
-
df
[
'y'
].
min
())
image_size
=
(
xmax
,
ymax
)
# image width,image height in px
else
:
image_size
=
(
image
[
'image_size'
][
1
],
image
[
'image_size'
][
0
])
# image width,image height in px
grids
=
tpr
.
make_grid
(
image_size
,
x_num
=
grid_param
[
'x_num'
],
y_num
=
grid_param
[
'y_num'
],
...
...
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