Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Autocnet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Autocnet
Commits
43de44f8
Commit
43de44f8
authored
Dec 7, 2021
by
Gavin
Browse files
Options
Downloads
Patches
Plain Diff
updated network.py to use logging
parent
b2751694
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
autocnet/graph/network.py
+13
-11
13 additions, 11 deletions
autocnet/graph/network.py
with
13 additions
and
11 deletions
autocnet/graph/network.py
+
13
−
11
View file @
43de44f8
...
@@ -7,7 +7,7 @@ import os
...
@@ -7,7 +7,7 @@ import os
from
shutil
import
copyfile
from
shutil
import
copyfile
import
threading
import
threading
from
time
import
gmtime
,
strftime
,
time
from
time
import
gmtime
,
strftime
,
time
import
warn
ing
s
import
logg
ing
from
itertools
import
combinations
from
itertools
import
combinations
import
networkx
as
nx
import
networkx
as
nx
...
@@ -58,6 +58,8 @@ from autocnet.spatial.isis import point_info
...
@@ -58,6 +58,8 @@ from autocnet.spatial.isis import point_info
from
autocnet.spatial.surface
import
GdalDem
,
EllipsoidDem
from
autocnet.spatial.surface
import
GdalDem
,
EllipsoidDem
from
autocnet.transformation.spatial
import
reproject
,
og2oc
from
autocnet.transformation.spatial
import
reproject
,
og2oc
# set up the logging file
log
=
logging
.
getLogger
(
__name__
)
#np.warnings.filterwarnings('ignore')
#np.warnings.filterwarnings('ignore')
# The total number of pixels squared that can fit into the keys number of GB of RAM for SIFT.
# The total number of pixels squared that can fit into the keys number of GB of RAM for SIFT.
...
@@ -237,7 +239,7 @@ class CandidateGraph(nx.Graph):
...
@@ -237,7 +239,7 @@ class CandidateGraph(nx.Graph):
if
fp
and
fp
.
IsValid
():
if
fp
and
fp
.
IsValid
():
valid_datasets
.
append
(
i
)
valid_datasets
.
append
(
i
)
else
:
else
:
warning
s
.
warn
(
log
.
warning
(
'
Missing or invalid geospatial data for {}
'
.
format
(
i
.
base_name
))
'
Missing or invalid geospatial data for {}
'
.
format
(
i
.
base_name
))
# Grab the footprints and test for intersection
# Grab the footprints and test for intersection
...
@@ -250,7 +252,7 @@ class CandidateGraph(nx.Graph):
...
@@ -250,7 +252,7 @@ class CandidateGraph(nx.Graph):
adjacency_dict
[
i
.
file_name
].
append
(
j
.
file_name
)
adjacency_dict
[
i
.
file_name
].
append
(
j
.
file_name
)
adjacency_dict
[
j
.
file_name
].
append
(
i
.
file_name
)
adjacency_dict
[
j
.
file_name
].
append
(
i
.
file_name
)
except
:
except
:
warning
s
.
warn
(
log
.
warning
(
'
Failed to calculate intersection between {} and {}
'
.
format
(
i
,
j
))
'
Failed to calculate intersection between {} and {}
'
.
format
(
i
,
j
))
return
cls
.
from_adjacency
(
adjacency_dict
)
return
cls
.
from_adjacency
(
adjacency_dict
)
...
@@ -377,7 +379,7 @@ class CandidateGraph(nx.Graph):
...
@@ -377,7 +379,7 @@ class CandidateGraph(nx.Graph):
else
:
else
:
image_path
=
image_name
image_path
=
image_name
if
not
os
.
path
.
exists
(
image_path
):
if
not
os
.
path
.
exists
(
image_path
):
warning
s
.
warn
(
"
Cannot find {}
"
.
format
(
image_path
))
log
.
warning
(
"
Cannot find {}
"
.
format
(
image_path
))
return
return
n
=
self
.
graph
[
"
node_counter
"
]
n
=
self
.
graph
[
"
node_counter
"
]
self
.
graph
[
"
node_counter
"
]
+=
1
self
.
graph
[
"
node_counter
"
]
+=
1
...
@@ -395,7 +397,7 @@ class CandidateGraph(nx.Graph):
...
@@ -395,7 +397,7 @@ class CandidateGraph(nx.Graph):
if
new_node
is
not
None
and
adj
is
not
None
:
if
new_node
is
not
None
and
adj
is
not
None
:
for
adj_img
in
adj
:
for
adj_img
in
adj
:
if
adj_img
not
in
self
.
graph
[
"
node_name_map
"
].
keys
():
if
adj_img
not
in
self
.
graph
[
"
node_name_map
"
].
keys
():
warning
s
.
warn
(
"
{} not found in the graph
"
.
format
(
adj_img
))
log
.
warning
(
"
{} not found in the graph
"
.
format
(
adj_img
))
continue
continue
new_idx
=
new_node
[
"
node_id
"
]
new_idx
=
new_node
[
"
node_id
"
]
adj_idx
=
self
.
graph
[
"
node_name_map
"
][
adj_img
]
adj_idx
=
self
.
graph
[
"
node_name_map
"
][
adj_img
]
...
@@ -1007,7 +1009,7 @@ class CandidateGraph(nx.Graph):
...
@@ -1007,7 +1009,7 @@ class CandidateGraph(nx.Graph):
"""
"""
if
not
self
.
is_connected
():
if
not
self
.
is_connected
():
warning
s
.
warn
(
log
.
warning
(
'
The given graph is not complete and may yield garbage.
'
)
'
The given graph is not complete and may yield garbage.
'
)
for
s
,
d
,
edge
in
self
.
edges
.
data
(
'
edge
'
):
for
s
,
d
,
edge
in
self
.
edges
.
data
(
'
edge
'
):
...
@@ -1630,7 +1632,7 @@ class NetworkCandidateGraph(CandidateGraph):
...
@@ -1630,7 +1632,7 @@ class NetworkCandidateGraph(CandidateGraph):
Push messages to the redis queue for DB objects e.g., Points, Measures
Push messages to the redis queue for DB objects e.g., Points, Measures
"""
"""
if
filters
and
query_string
:
if
filters
and
query_string
:
warning
s
.
warn
(
'
Use of filters and query_string are mutually exclusive.
'
)
log
.
warning
(
'
Use of filters and query_string are mutually exclusive.
'
)
with
self
.
session_scope
()
as
session
:
with
self
.
session_scope
()
as
session
:
# Support either an SQL query string, or a simple dict based query
# Support either an SQL query string, or a simple dict based query
...
@@ -1943,7 +1945,7 @@ class NetworkCandidateGraph(CandidateGraph):
...
@@ -1943,7 +1945,7 @@ class NetworkCandidateGraph(CandidateGraph):
fpaths
=
[
self
.
nodes
[
i
][
'
data
'
][
'
image_path
'
]
for
i
in
ids
]
fpaths
=
[
self
.
nodes
[
i
][
'
data
'
][
'
image_path
'
]
for
i
in
ids
]
for
f
in
self
.
files
:
for
f
in
self
.
files
:
if
f
not
in
fpaths
:
if
f
not
in
fpaths
:
warning
s
.
warn
(
f
'
{
f
}
in candidate graph but not in output network.
'
)
log
.
warning
(
f
'
{
f
}
in candidate graph but not in output network.
'
)
# Remap the df columns back to ISIS
# Remap the df columns back to ISIS
df
.
rename
(
columns
=
{
'
pointtype
'
:
'
pointType
'
,
df
.
rename
(
columns
=
{
'
pointtype
'
:
'
pointType
'
,
...
@@ -2038,7 +2040,7 @@ class NetworkCandidateGraph(CandidateGraph):
...
@@ -2038,7 +2040,7 @@ class NetworkCandidateGraph(CandidateGraph):
elif
os
.
path
.
exists
(
filelist
):
elif
os
.
path
.
exists
(
filelist
):
filelist
=
io_utils
.
file_to_list
(
filelist
)
filelist
=
io_utils
.
file_to_list
(
filelist
)
else
:
else
:
warning
s
.
warn
(
'
Unable to parse the passed filelist
'
)
log
.
warning
(
'
Unable to parse the passed filelist
'
)
if
clear_db
:
if
clear_db
:
self
.
clear_db
()
self
.
clear_db
()
...
@@ -2257,7 +2259,7 @@ class NetworkCandidateGraph(CandidateGraph):
...
@@ -2257,7 +2259,7 @@ class NetworkCandidateGraph(CandidateGraph):
try
:
try
:
session
.
execute
(
f
'
ALTER SEQUENCE
{
t
}
_id_seq RESTART WITH 1
'
)
session
.
execute
(
f
'
ALTER SEQUENCE
{
t
}
_id_seq RESTART WITH 1
'
)
except
Exception
as
e
:
except
Exception
as
e
:
warning
s
.
warn
(
f
'
Failed to reset primary id sequence for table
{
t
}
'
)
log
.
warning
(
f
'
Failed to reset primary id sequence for table
{
t
}
'
)
def
cnet_to_db
(
self
,
cnet
):
def
cnet_to_db
(
self
,
cnet
):
"""
"""
...
@@ -2559,7 +2561,7 @@ class NetworkCandidateGraph(CandidateGraph):
...
@@ -2559,7 +2561,7 @@ class NetworkCandidateGraph(CandidateGraph):
walltime
=
'
00:20:00
'
,
walltime
=
'
00:20:00
'
,
chunksize
=
1000
,
chunksize
=
1000
,
exclude
=
None
):
exclude
=
None
):
warning
s
.
warn
(
'
This function is not well tested. No tests currently exists
\
log
.
warning
(
'
This function is not well tested. No tests currently exists
\
in the test suite for this version of the function.
'
)
in the test suite for this version of the function.
'
)
# Setup the redis queue
# Setup the redis queue
...
...
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