Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tkbd Using Raw Data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
coast
Tkbd Using Raw Data
Commits
ff6eb008
Commit
ff6eb008
authored
3 months ago
by
John Daniel Bossér
Browse files
Options
Downloads
Patches
Plain Diff
progress on making a whitening detection tracker
parent
9575d9ff
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
experiments/towards_array4.py
+67
-1
67 additions, 1 deletion
experiments/towards_array4.py
with
67 additions
and
1 deletion
experiments/towards_array4.py
+
67
−
1
View file @
ff6eb008
...
@@ -3,7 +3,7 @@ import math
...
@@ -3,7 +3,7 @@ import math
from
collections.abc
import
Generator
,
Iterable
from
collections.abc
import
Generator
,
Iterable
from
dataclasses
import
dataclass
from
dataclasses
import
dataclass
from
itertools
import
cycle
from
itertools
import
cycle
from
typing
import
Any
,
Protocol
from
typing
import
Any
,
Protocol
,
NewType
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
numpy
as
np
...
@@ -24,6 +24,11 @@ from sensor import get_beamformer, get_sensor
...
@@ -24,6 +24,11 @@ from sensor import get_beamformer, get_sensor
from
simulation.movement
import
line_movement
,
radius_to_snr
from
simulation.movement
import
line_movement
,
radius_to_snr
from
simulation.signal_generation
import
color_signal
from
simulation.signal_generation
import
color_signal
from
trackers.dbtk.setup
import
(
into_stonesoup_detector
,
)
from
.filters
import
DetectionPFTracker
,
FilterSolution
,
Gaussian
from
.filters
import
DetectionPFTracker
,
FilterSolution
,
Gaussian
relabel
=
{
relabel
=
{
...
@@ -38,6 +43,57 @@ strategy. This is because every set of sampling strategy requires
...
@@ -38,6 +43,57 @@ strategy. This is because every set of sampling strategy requires
a new set of parameters.
a new set of parameters.
"""
"""
# A hack to solve this question quickly:
# Use preprocessing from some other tracker, and use the tracking
# from the detection tracker. Needs a custom preprocessing step.
Time
=
float
Bearing
=
float
DetectionRaw
=
tuple
[
Time
,
Bearing
]
Detections
=
list
[
DetectionRaw
]
Prob
=
float
MapBearing
=
NewType
(
"
MapBearing
"
,
float
)
MeanBearing
=
NewType
(
"
MeanBearing
"
,
float
)
CovBearing
=
NewType
(
"
CovBearing
"
,
float
)
ProposedTrack
=
list
[
tuple
[
Time
,
Prob
,
MapBearing
,
MeanBearing
,
CovBearing
]]
@dataclass
class
WhiteningDetectionPFTracker
(
FilterSolution
):
detection_tracker
:
DetectionPFTracker
whitening_tracker
:
Gaussian
label
:
str
=
"
CFARVAR14
"
def
preprocess
(
self
,
samples
:
Iterable
[
np
.
ndarray
],
sampling_frequency
:
float
,
demodulation_frequency
:
float
)
->
Iterable
[
tuple
[
float
,
list
[
float
]]]:
energy_and_pva
=
self
.
whitening_tracker
.
preprocess
(
samples
,
sampling_frequency
,
demodulation_frequency
)
btr
=
np
.
array
([
p
for
(
_
,
p
)
in
energy_and_pva
])
detector
=
into_stonesoup_detector
(
self
.
detection_tracker
.
detector
,
self
.
detection_tracker
.
beamformer
.
tsamp
,
self
.
detection_tracker
.
measurement_model
)
detections
=
detector
(
np
.
flip
(
btr
,
axis
=
1
))
detections
=
[
(
k
*
self
.
beamformer
.
tsamp
,
[
np
.
array
(
vv
.
state_vector
).
flatten
()
for
vv
in
detections_at_time
],
)
for
(
detections_at_time
,
k
)
in
zip
(
detections
,
itertools
.
count
())
]
# time_axis = [k * self.beamformer.tsamp for (k, _) in enumerate(detections) ]
return
detections
def
track
(
self
,
input
)
->
list
[
ProposedTrack
]:
return
self
.
detection_tracker
.
track
(
input
)
def
collect_data_mult
(
self
,
track
:
list
[
ProposedTrack
]):
return
self
.
detection_tracker
.
collect_data_mult
(
track
)
@property
def
beamformer
(
self
):
return
self
.
whitening_tracker
.
beamformer
class
FiltersAndSamples
(
Protocol
):
class
FiltersAndSamples
(
Protocol
):
def
filters
(
self
,
setup
:
"
SetupData
"
)
->
list
[
FilterSolution
]:
...
def
filters
(
self
,
setup
:
"
SetupData
"
)
->
list
[
FilterSolution
]:
...
...
@@ -98,6 +154,12 @@ class TargetSigColBackgroundIsTDist(FiltersAndSamples):
...
@@ -98,6 +154,12 @@ class TargetSigColBackgroundIsTDist(FiltersAndSamples):
lam
=
0.0022
# 0.75* # 0.73 * 1.5 # 0.73 * 1.7 # 0.73 * 1.5 # 0.73 * 2.0*
lam
=
0.0022
# 0.75* # 0.73 * 1.5 # 0.73 * 1.7 # 0.73 * 1.5 # 0.73 * 2.0*
self
.
DBTK_P
=
DetectionPFTracker
.
from_lambda
(
lam
)
self
.
DBTK_P
=
DetectionPFTracker
.
from_lambda
(
lam
)
self
.
DBTK_P_whitened
=
WhiteningDetectionPFTracker
(
detection_tracker
=
DetectionPFTracker
.
from_lambda
(
lam
),
# TODO: retune,
whitening_tracker
=
self
.
GTkBD
# Only used for whitening.
)
# return [self.DBTK_P, self.DBTK_P_whitened]
return
[
self
.
GTkBD
,
self
.
DBTK_P
,
self
.
TkBDAr0
,
self
.
TkBDAr
]
return
[
self
.
GTkBD
,
self
.
DBTK_P
,
self
.
TkBDAr0
,
self
.
TkBDAr
]
def
samples
(
self
,
experiment
:
"
Experiment
"
):
def
samples
(
self
,
experiment
:
"
Experiment
"
):
...
@@ -924,6 +986,10 @@ def main(block: bool = False):
...
@@ -924,6 +986,10 @@ def main(block: bool = False):
p
=
Plot
(
exp
)
p
=
Plot
(
exp
)
exp
.
run
()
p
.
plot_results
()
exit
()
exp
.
run_mc
(
100
)
exp
.
run_mc
(
100
)
p
.
plot_mc_results
(
block
=
block
)
p
.
plot_mc_results
(
block
=
block
)
...
...
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