Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gstlal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Duncan Macleod
gstlal
Commits
7c6fbf40
Commit
7c6fbf40
authored
7 years ago
by
Chad Hanna
Browse files
Options
Downloads
Patches
Plain Diff
metric.py: use fixed dx spacing
parent
c13af550
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gstlal-ugly/python/metric.py
+45
-54
45 additions, 54 deletions
gstlal-ugly/python/metric.py
with
45 additions
and
54 deletions
gstlal-ugly/python/metric.py
+
45
−
54
View file @
7c6fbf40
...
...
@@ -199,35 +199,30 @@ class Metric(object):
#def __set_diagonal_metric_tensor_component(self, i, center, deltas, g, w1, min_d2 = numpy.finfo(numpy.float32).eps * 5, max_d2 = numpy.finfo(numpy.float32).eps * 100):
def
__set_diagonal_metric_tensor_component
(
self
,
i
,
center
,
deltas
,
g
,
w1
):
#max_match = 1.0 - 6 * numpy.finfo(numpy.float32).eps
#min_match = 1.0 - 24 * numpy.finfo(numpy.float32).eps
max_match
=
1.0
-
10
*
numpy
.
finfo
(
numpy
.
float32
).
eps
min_match
=
1.0
-
100
*
numpy
.
finfo
(
numpy
.
float32
).
eps
# make the vector to solve for the metric by choosing
# either a principle axis or a bisector depending on if
# this is a diagonal component or not
x
=
numpy
.
zeros
(
len
(
deltas
))
x
[
i
]
=
deltas
[
i
]
# get the positive side of the central difference
try
:
plus_match
=
self
.
match
(
w1
,
self
.
waveform
(
center
+
x
))
except
TypeError
:
return
self
.
__set_diagonal_metric_tensor_component
(
i
,
center
,
deltas
*
1.1
,
g
,
w1
)
if
(
plus_match
<
min_match
):
return
self
.
__set_diagonal_metric_tensor_component
(
i
,
center
,
deltas
/
8
,
g
,
w1
)
if
(
plus_match
>
max_match
):
return
self
.
__set_diagonal_metric_tensor_component
(
i
,
center
,
deltas
*
2
,
g
,
w1
)
else
:
minus_match
=
self
.
match
(
w1
,
self
.
waveform
(
center
-
x
))
minus_match2
=
self
.
match
(
w1
,
self
.
waveform
(
center
-
2
*
x
))
plus_match2
=
self
.
match
(
w1
,
self
.
waveform
(
center
+
2
*
x
))
# second order
#d2mbydx2 = (plus_match + minus_match - 2.0) / x[i]**2
# forth order
d2mbydx2
=
(
4.
/
3.
*
(
plus_match
+
minus_match
)
-
1.
/
12.
*
(
plus_match2
+
minus_match2
)
-
5.
/
2.
)
/
x
[
i
]
**
2
# - 1/2 the second partial derivative
g
[
i
,
i
]
=
-
0.5
*
d2mbydx2
return
x
[
i
]
# then the negative side
minus_match
=
self
.
match
(
w1
,
self
.
waveform
(
center
-
x
))
# second order
d2mbydx2
=
(
plus_match
+
minus_match
-
2.0
)
/
x
[
i
]
**
2
# fourth order
#minus_match2 = self.match(w1, self.waveform(center-2*x))
#plus_match2 = self.match(w1, self.waveform(center+2*x))
#d2mbydx2 = (4./3. * (plus_match + minus_match) - 1./12. * (plus_match2 + minus_match2) - 5./2.) / x[i]**2
# - 1/2 the second partial derivative
g
[
i
,
i
]
=
-
0.5
*
d2mbydx2
return
x
[
i
]
def
__set_tt_metric_tensor_component
(
self
,
center
,
w1
):
...
...
@@ -238,43 +233,39 @@ class Metric(object):
# evaluate symmetrically
if
j
<=
i
:
return
None
# make the vector to solve for the metric by choosing
# either a principle axis or a bisector depending on if
# this is a diagonal component or not
xmm
=
numpy
.
zeros
(
len
(
deltas
))
xmp
=
numpy
.
zeros
(
len
(
deltas
))
xpm
=
numpy
.
zeros
(
len
(
deltas
))
xpp
=
numpy
.
zeros
(
len
(
deltas
))
xmm
[
i
]
=
-
deltas
[
i
]
xmm
[
j
]
=
-
deltas
[
j
]
xmp
[
i
]
=
-
deltas
[
i
]
xmp
[
j
]
=
+
deltas
[
j
]
xpm
[
i
]
=
+
deltas
[
i
]
xpm
[
j
]
=
-
deltas
[
j
]
xpp
[
i
]
=
+
deltas
[
i
]
xpp
[
j
]
=
+
deltas
[
j
]
# second order
d2mbydxdy
=
(
self
.
match
(
w1
,
self
.
waveform
(
center
+
xmm
))
+
self
.
match
(
w1
,
self
.
waveform
(
center
+
xpp
))
-
self
.
match
(
w1
,
self
.
waveform
(
center
+
xmp
))
-
self
.
match
(
w1
,
self
.
waveform
(
center
+
xpm
)))
/
4.
/
xpp
[
i
]
/
xpp
[
j
]
# NOTE: SECOND ORDER, BUT NEEDED IF USING FOURTH ORDER FOR DIAG
# xmm = numpy.zeros(len(deltas))
# xmp = numpy.zeros(len(deltas))
# xpm = numpy.zeros(len(deltas))
# xpp = numpy.zeros(len(deltas))
# xmm[i] = -deltas[i]
# xmm[j] = -deltas[j]
# xmp[i] = -deltas[i]
# xmp[j] = +deltas[j]
# xpm[i] = +deltas[i]
# xpm[j] = -deltas[j]
# xpp[i] = +deltas[i]
# xpp[j] = +deltas[j]
# d2mbydxdy = (self.match(w1, self.waveform(center+xmm)) + self.match(w1, self.waveform(center+xpp)) - self.match(w1, self.waveform(center+xmp)) - self.match(w1, self.waveform(center+xpm))) / 4. / xpp[i] / xpp[j]
# g[i,j] = g[j,i] = -0.5 * d2mbydxdy
# return None
# NOTE: SECOND ORDER, ASSUMES SECOND ORDER FOR DIAG
x
=
numpy
.
zeros
(
len
(
deltas
))
x
[
i
]
=
deltas
[
i
]
x
[
j
]
=
deltas
[
j
]
fii
=
-
2
*
g
[
i
,
i
]
*
deltas
[
i
]
**
2
+
2.0
fjj
=
-
2
*
g
[
j
,
j
]
*
deltas
[
j
]
**
2
+
2.0
g
[
i
,
j
]
=
g
[
j
,
i
]
=
-
0.5
*
d2mbydxdy
# Second order
plus_match
=
self
.
match
(
w1
,
self
.
waveform
(
center
+
x
))
minus_match
=
self
.
match
(
w1
,
self
.
waveform
(
center
-
x
))
g
[
i
,
j
]
=
g
[
j
,
i
]
=
-
0.5
*
(
plus_match
+
minus_match
-
fii
-
fjj
+
2.0
)
/
2
/
deltas
[
i
]
/
deltas
[
j
]
return
None
#x = numpy.zeros(len(deltas))
#x[i] = deltas[i]
#x[j] = deltas[j]
#fii = -2 * g[i,i] * deltas[i]**2 + 2.0
#fjj = -2 * g[j,j] * deltas[j]**2 + 2.0
# Check the match
#d2 = 1 - self.match(w1, self.waveform(center+x))
#plus_match = self.match(w1, self.waveform(center+x))
#minus_match = self.match(w1, self.waveform(center-x))
#g[i,j] = g[j,i] = (d2 - g[i,i] * deltas[i]**2 - g[j,j] * deltas[j]**2) / 2 / deltas[i] / deltas[j]
#g[i,j] = g[j,i] = -0.5 * (plus_match + minus_match - fii - fjj + 2.0) / 2 / deltas[i] / deltas[j]
#return None
def
__set_offdiagonal_time_metric_tensor_component
(
self
,
j
,
center
,
deltas
,
g
,
g_tt
,
delta_t
,
w1
):
# make the vector to solve for the metric by choosing
# either a principle axis or a bisector depending on if
...
...
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