Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Detection eddies
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab has been updated. More info
here
and
there
.
Show more breadcrumbs
IPSL
LMD
DPAO
Detection eddies
Commits
382d94da
Commit
382d94da
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Add timings
parent
738166b7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cost_function.py
+14
-4
14 additions, 4 deletions
cost_function.py
with
14 additions
and
4 deletions
cost_function.py
+
14
−
4
View file @
382d94da
...
@@ -78,6 +78,9 @@ def get_SHPC(array_d_ini, date_index):
...
@@ -78,6 +78,9 @@ def get_SHPC(array_d_ini, date_index):
assert
i_SHPC
>=
1
assert
i_SHPC
>=
1
return
i_SHPC
-
1
return
i_SHPC
-
1
t0
=
time
.
perf_counter
()
timings
=
open
(
"
timings.txt
"
,
"
w
"
)
if
len
(
sys
.
argv
)
==
1
:
if
len
(
sys
.
argv
)
==
1
:
sys
.
exit
(
"
Required arguments: SHPC-directory [SHPC-directory] ...
"
)
sys
.
exit
(
"
Required arguments: SHPC-directory [SHPC-directory] ...
"
)
...
@@ -100,8 +103,6 @@ delta_r_mean = -0.0094709 * 1000 #[m]
...
@@ -100,8 +103,6 @@ delta_r_mean = -0.0094709 * 1000 #[m]
delta_r_std
=
8.6953
*
1000
delta_r_std
=
8.6953
*
1000
# Load the graph_tool file:
# Load the graph_tool file:
t0
=
time
.
perf_counter
()
timings
=
open
(
"
timings.txt
"
,
"
w
"
)
print
(
'
Loading graph...
'
)
print
(
'
Loading graph...
'
)
g
=
graph_tool
.
Graph
()
g
=
graph_tool
.
Graph
()
...
@@ -110,15 +111,15 @@ try:
...
@@ -110,15 +111,15 @@ try:
except
FileNotFoundError
:
except
FileNotFoundError
:
g
.
load
(
'
segments.graphml
'
)
g
.
load
(
'
segments.graphml
'
)
t1
=
time
.
perf_counter
()
print
(
'
Loading done...
'
)
print
(
'
Loading done...
'
)
print
(
"
Input graph:
"
)
print
(
"
Input graph:
"
)
print
(
"
Number of vertices:
"
,
g
.
num_vertices
())
print
(
"
Number of vertices:
"
,
g
.
num_vertices
())
print
(
"
Number of edges:
"
,
g
.
num_edges
())
print
(
"
Number of edges:
"
,
g
.
num_edges
())
print
(
"
Internal properties:
"
)
print
(
"
Internal properties:
"
)
g
.
list_properties
()
g
.
list_properties
()
t1
=
time
.
perf_counter
()
timings
.
write
(
f
"
loading:
{
t1
-
t0
}
s
\n
"
)
timings
.
write
(
f
"
loading:
{
t1
-
t0
}
s
\n
"
)
t
imings
.
close
()
t
0
=
t1
g
.
set_fast_edge_removal
()
g
.
set_fast_edge_removal
()
g
.
vp
[
'
pos_first
'
]
=
g
.
new_vp
(
'
object
'
)
g
.
vp
[
'
pos_first
'
]
=
g
.
new_vp
(
'
object
'
)
...
@@ -235,6 +236,9 @@ for n in g.vertices():
...
@@ -235,6 +236,9 @@ for n in g.vertices():
g
.
vp
.
first_av_rad
[
n
]
=
radii
g
.
vp
.
first_av_rad
[
n
]
=
radii
g
.
vp
.
last_av_rad
[
n
]
=
radii
g
.
vp
.
last_av_rad
[
n
]
=
radii
t1
=
time
.
perf_counter
()
timings
.
write
(
f
"
iterating on vertices:
{
t1
-
t0
}
s
\n
"
)
t0
=
t1
print
(
"
Iterating on edges...
"
)
print
(
"
Iterating on edges...
"
)
for
edge
in
g
.
edges
():
for
edge
in
g
.
edges
():
...
@@ -292,6 +296,12 @@ for edge in g.edges():
...
@@ -292,6 +296,12 @@ for edge in g.edges():
g
.
ep
.
nl_cost_function
[
edge
]
=
cf
g
.
ep
.
nl_cost_function
[
edge
]
=
cf
t1
=
time
.
perf_counter
()
timings
.
write
(
f
"
iterating on edges:
{
t1
-
t0
}
s
\n
"
)
t0
=
t1
print
(
"
Saving...
"
)
print
(
"
Saving...
"
)
g
.
save
(
'
segments_cost_functions.gt
'
)
g
.
save
(
'
segments_cost_functions.gt
'
)
print
(
'
All done
'
)
print
(
'
All done
'
)
t1
=
time
.
perf_counter
()
timings
.
write
(
f
"
saving:
{
t1
-
t0
}
s
\n
"
)
timings
.
close
()
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