Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
navipy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olivier Bertrand
navipy
Commits
2acd50de
Commit
2acd50de
authored
7 years ago
by
Olivier Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Handle infinite value in blender and a scene checker
parent
5f67fbe1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
navipy/database/__init__.py
+13
-1
13 additions, 1 deletion
navipy/database/__init__.py
navipy/sensors/bee_sampling.py
+2
-1
2 additions, 1 deletion
navipy/sensors/bee_sampling.py
navipy/sensors/renderer.py
+11
-0
11 additions, 0 deletions
navipy/sensors/renderer.py
with
26 additions
and
2 deletions
navipy/database/__init__.py
+
13
−
1
View file @
2acd50de
...
@@ -8,7 +8,7 @@ import pandas as pd
...
@@ -8,7 +8,7 @@ import pandas as pd
import
sqlite3
import
sqlite3
import
io
import
io
import
warnings
import
warnings
from
navipy.scene
import
is_numeric_array
from
navipy.scene
import
is_numeric_array
,
check_scene
def
adapt_array
(
arr
):
def
adapt_array
(
arr
):
...
@@ -291,6 +291,16 @@ database
...
@@ -291,6 +291,16 @@ database
posorient
.
set_index
(
'
id
'
,
inplace
=
True
)
posorient
.
set_index
(
'
id
'
,
inplace
=
True
)
return
posorient
return
posorient
@property
def
normalisations
(
self
):
"""
Return the position orientations of all points in the
\
database
"""
posorient
=
pd
.
read_sql_query
(
"
select * from normalisation;
"
,
self
.
db
)
posorient
.
set_index
(
'
id
'
,
inplace
=
True
)
return
posorient
def
read_posorient
(
self
,
posorient
=
None
,
rowid
=
None
):
def
read_posorient
(
self
,
posorient
=
None
,
rowid
=
None
):
if
posorient
is
not
None
:
if
posorient
is
not
None
:
if
not
isinstance
(
posorient
,
pd
.
Series
):
if
not
isinstance
(
posorient
,
pd
.
Series
):
...
@@ -406,6 +416,7 @@ database
...
@@ -406,6 +416,7 @@ database
cmaxminrange
=
cmaxminrange
.
astype
(
float
)
cmaxminrange
=
cmaxminrange
.
astype
(
float
)
toreturn
=
self
.
denormalise_image
(
image
,
cmaxminrange
)
toreturn
=
self
.
denormalise_image
(
image
,
cmaxminrange
)
toreturn
=
toreturn
[...,
np
.
newaxis
]
toreturn
=
toreturn
[...,
np
.
newaxis
]
check_scene
(
toreturn
)
return
toreturn
return
toreturn
def
denormalise_image
(
self
,
image
,
cmaxminrange
):
def
denormalise_image
(
self
,
image
,
cmaxminrange
):
...
@@ -557,4 +568,5 @@ class DataBaseSave(DataBase):
...
@@ -557,4 +568,5 @@ class DataBaseSave(DataBase):
cmaxminrange
.
loc
[
str
(
chan_n
)
+
'
_max
'
]
=
cmax
cmaxminrange
.
loc
[
str
(
chan_n
)
+
'
_max
'
]
=
cmax
cmaxminrange
.
loc
[
str
(
chan_n
)
+
'
_min
'
]
=
cmin
cmaxminrange
.
loc
[
str
(
chan_n
)
+
'
_min
'
]
=
cmin
cmaxminrange
.
loc
[
str
(
chan_n
)
+
'
_range
'
]
=
crange
cmaxminrange
.
loc
[
str
(
chan_n
)
+
'
_range
'
]
=
crange
check_scene
(
normed_im
[...,
np
.
newaxis
])
return
normed_im
,
cmaxminrange
return
normed_im
,
cmaxminrange
This diff is collapsed.
Click to expand it.
navipy/sensors/bee_sampling.py
+
2
−
1
View file @
2acd50de
...
@@ -12,7 +12,7 @@ import os
...
@@ -12,7 +12,7 @@ import os
import
numpy
as
np
import
numpy
as
np
import
pandas
as
pd
import
pandas
as
pd
from
navipy.database
import
DataBaseSave
from
navipy.database
import
DataBaseSave
from
navipy.scene
import
check_scene
class
BeeSampling
():
class
BeeSampling
():
"""
"""
...
@@ -163,6 +163,7 @@ so that they are not rendered
...
@@ -163,6 +163,7 @@ so that they are not rendered
# and the cmaxminrange has not already been assigned
# and the cmaxminrange has not already been assigned
# so the image need to be rendered
# so the image need to be rendered
scene
=
self
.
renderer
.
scene
(
posorient
)
scene
=
self
.
renderer
.
scene
(
posorient
)
check_scene
(
scene
)
scene
=
scene
[...,
0
]
scene
=
scene
[...,
0
]
distance
=
scene
[...,
-
1
]
distance
=
scene
[...,
-
1
]
distance
[
distance
>
self
.
world_dim
]
=
self
.
world_dim
distance
[
distance
>
self
.
world_dim
]
=
self
.
world_dim
...
...
This diff is collapsed.
Click to expand it.
navipy/sensors/renderer.py
+
11
−
0
View file @
2acd50de
...
@@ -324,4 +324,15 @@ is the distance.
...
@@ -324,4 +324,15 @@ is the distance.
self
.
update
(
posorient
)
self
.
update
(
posorient
)
toreturn
=
np
.
concatenate
((
self
.
image
,
toreturn
=
np
.
concatenate
((
self
.
image
,
self
.
distance
),
axis
=
2
)
self
.
distance
),
axis
=
2
)
ninffound
=
0
for
chan_i
in
range
(
4
):
cim
=
toreturn
[...,
chan_i
]
cmax
=
cim
.
max
()
if
np
.
isinf
(
cmax
):
ninffound
+=
np
.
sum
(
np
.
isinf
(
cim
))
cmax
=
cim
[
np
.
isinf
(
cim
)
==
0
].
max
()
toreturn
[
np
.
isinf
(
cim
)
==
1
]
=
cmax
if
ninffound
>
0
:
warnings
.
warn
(
'
{} Inf found in image
'
.
format
(
ninffound
))
return
toreturn
[...,
np
.
newaxis
]
return
toreturn
[...,
np
.
newaxis
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment