Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
km3beam
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Massimiliano Lincetto
km3beam
Commits
07e56fc2
Commit
07e56fc2
authored
4 years ago
by
Massimiliano Lincetto
Browse files
Options
Downloads
Patches
Plain Diff
test selfcalibration
parent
8cfdcba9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Beamformer_v3.ipynb
+75
-834
75 additions, 834 deletions
Beamformer_v3.ipynb
km3beam.py
+43
-16
43 additions, 16 deletions
km3beam.py
with
118 additions
and
850 deletions
Beamformer_v3.ipynb
+
75
−
834
View file @
07e56fc2
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
km3beam.py
+
43
−
16
View file @
07e56fc2
...
...
@@ -3,8 +3,6 @@ import scipy.signal as ssg
from
functools
import
partial
from
tqdm
import
tqdm_notebook
as
tqdm
"""
Calculates distance(s) between a point
'
p
'
and a(n array of) point(s)
'
q
'
as the norm of the difference vector(s)
'
pq
'
...
...
@@ -34,10 +32,12 @@ def xcorr(u1, u2):
def
chirp_template
(
f0
,
t1
,
f1
):
return
partial
(
wchirp
,
f0
=
f0
,
t1
=
t1
,
f1
=
f1
)
class
BeamStreamer
():
O
=
(
0
,
0
,
0
)
# origin of coordinates
c0
=
1500
# speed of sound [m/s]
class
AcouEnv
():
O
=
(
0
,
0
,
0
)
# origin
c0
=
1500
# speed of sound [m/s]
h
=
2500
class
AcouStreamer
(
AcouEnv
):
def
__init__
(
self
,
f_s
,
footprint
,
beacon
,
noise_level
=
0.0
,
t_margin
=
0.0
):
self
.
f_s
=
f_s
self
.
beacon
=
beacon
...
...
@@ -45,7 +45,7 @@ class BeamStreamer():
self
.
calc_delays
(
footprint
)
self
.
init_timebase
(
t_margin
)
self
.
reset_noise
(
noise_level
)
def
calc_delays
(
self
,
footprint
):
self
.
distances
=
dist
(
footprint
,
self
.
beacon
)
-
dist
(
self
.
O
,
self
.
beacon
)
...
...
@@ -63,8 +63,32 @@ class BeamStreamer():
def
sim_signals
(
self
,
template
):
self
.
reference
=
template
(
self
.
timebase
)
for
stream
,
delay
in
zip
(
tqdm
(
self
.
streams
)
,
self
.
delays
):
for
stream
,
delay
in
zip
(
self
.
streams
,
self
.
delays
):
stream
[
self
.
sect
]
+=
template
(
self
.
timebase
[
self
.
sect
]
-
delay
)
def
calibrate_delays
(
self
):
self
.
rec_shifts
=
np
.
empty_like
(
self
.
delays
,
dtype
=
int
)
for
i
,
stream
in
enumerate
(
self
.
streams
):
cross_correlation
=
xcorr
(
stream
[
self
.
sect
],
self
.
reference
[
self
.
sect
])
self
.
rec_shifts
[
i
]
=
np
.
argmax
(
cross_correlation
)
-
self
.
sect
.
start
@property
def
t
(
self
):
return
self
.
timebase
[
self
.
sect
]
@property
def
s
(
self
):
return
self
.
streams
[:,
self
.
sect
]
@property
def
delays
(
self
):
return
self
.
distances
/
self
.
c0
@property
def
calibrated_distances
(
self
):
return
dist
(
self
.
O
,
self
.
beacon
)
+
(
self
.
rec_shifts
/
self
.
f_s
)
*
self
.
c0
class
BeamFormer
(
AcouStreamer
):
def
beamform
(
self
,
nominal_footprint
,
probe
):
W
=
np
.
zeros_like
(
self
.
timebase
[
self
.
sect
])
...
...
@@ -80,13 +104,7 @@ class BeamStreamer():
def
delays
(
self
):
return
self
.
distances
/
self
.
c0
@property
def
t
(
self
):
return
self
.
timebase
[
self
.
sect
]
@property
def
s
(
self
):
return
self
.
streams
[:,
self
.
sect
]
'''
meshgrid helper
'''
...
...
@@ -126,4 +144,13 @@ class BeamScanner:
self
.
W
.
append
(
W
)
self
.
X
.
append
(
X
)
Q
=
np
.
max
(
X
)
self
.
Z
[
i
,
j
]
=
Q
\ No newline at end of file
self
.
Z
[
i
,
j
]
=
Q
def
mse
(
P
,
locations
,
distances
):
mse
=
0.0
for
location
,
distance
in
zip
(
locations
,
distances
):
d
=
dist
(
P
,
location
)
mse
+=
(
d
-
distance
)
**
2
mse
/=
len
(
locations
)
return
mse
\ No newline at end of file
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