Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GstLAL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lscsoft
GstLAL
Commits
607d9781
Commit
607d9781
authored
8 years ago
by
Stephen Privitera
Browse files
Options
Downloads
Patches
Plain Diff
treebank: store tiles in cube object
parent
0f722dc3
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
gstlal-ugly/python/tree.py
+13
-12
13 additions, 12 deletions
gstlal-ugly/python/tree.py
with
13 additions
and
12 deletions
gstlal-ugly/python/tree.py
+
13
−
12
View file @
607d9781
...
...
@@ -37,6 +37,7 @@ class HyperCube(object):
self
.
metric
=
metric
self
.
metric_tensor
=
self
.
metric
.
metric_tensor
(
self
.
center
,
self
.
deltas
)
self
.
size
=
self
.
_size
()
self
.
tiles
=
[]
self
.
symmetry_func
=
symmetry_func
self
.
__mismatch
=
mismatch
...
...
@@ -70,7 +71,7 @@ class HyperCube(object):
return
HyperCube
(
leftbound
,
self
.
__mismatch
,
self
.
symmetry_func
,
metric
=
self
.
metric
),
HyperCube
(
rightbound
,
self
.
__mismatch
,
self
.
symmetry_func
,
metric
=
self
.
metric
)
def
tile
(
self
,
mismatch
,
verbose
=
True
):
tiles
=
[]
popcount
=
0
# Find the coordinate transformation matrix
...
...
@@ -78,15 +79,15 @@ class HyperCube(object):
M
=
numpy
.
linalg
.
cholesky
(
self
.
metric_tensor
)
Minv
=
numpy
.
linalg
.
inv
(
M
)
except
numpy
.
linalg
.
LinAlgError
:
tiles
.
append
(
self
.
center
)
self
.
tiles
.
append
(
self
.
center
)
print
>>
sys
.
stderr
,
"
tiling failed: %f
"
%
numpy
.
linalg
.
det
(
self
.
metric_tensor
)
raise
return
tiles
,
popcount
return
self
.
tiles
,
popcount
if
False
:
# To Stephen with love
# From Chad
tiles
=
[
self
.
center
]
self
.
tiles
=
[
self
.
center
]
N
=
self
.
N
()
target
=
numpy
.
ceil
(
self
.
num_templates
(
mismatch
))
dl
=
self
.
dl
(
mismatch
)
...
...
@@ -94,13 +95,13 @@ class HyperCube(object):
rand_coords
=
numpy
.
random
.
rand
(
1e4
,
len
(
self
.
deltas
))
for
randcoord
in
rand_coords
:
randcoord
=
(
randcoord
-
0.5
)
*
self
.
deltas
+
self
.
center
distances
=
[
metric_module
.
distance
(
self
.
metric_tensor
,
randcoord
,
t
)
for
t
in
tiles
]
distances
=
[
metric_module
.
distance
(
self
.
metric_tensor
,
randcoord
,
t
)
for
t
in
self
.
tiles
]
maxdist
=
max
(
distances
)
mindist
=
min
(
distances
)
assert
randcoord
in
self
if
mindist
>
dl
*
N
**
.
5
:
tiles
.
append
(
randcoord
)
if
len
(
tiles
)
>
target
:
self
.
tiles
.
append
(
randcoord
)
if
len
(
self
.
tiles
)
>
target
:
break
if
True
:
...
...
@@ -137,16 +138,16 @@ class HyperCube(object):
# FIXME take care of ratty edges
if
primed_coords
in
self
:
tiles
.
append
(
primed_coords
)
self
.
tiles
.
append
(
primed_coords
)
# Gaurantee at least one
if
len
(
tiles
)
==
0
:
tiles
.
append
(
self
.
center
)
if
len
(
self
.
tiles
)
==
0
:
self
.
tiles
.
append
(
self
.
center
)
if
verbose
:
print
"
placing %04d tiles in hyperrectangle with boundary:
"
%
len
(
tiles
)
print
"
placing %04d tiles in hyperrectangle with boundary:
"
%
len
(
self
.
tiles
)
for
row
in
self
.
boundaries
:
print
"
\t
"
,
row
return
list
(
tiles
),
popcount
return
list
(
self
.
tiles
),
popcount
def
__contains__
(
self
,
coords
):
size
=
self
.
size
...
...
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