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
33e4f36a
Commit
33e4f36a
authored
6 years ago
by
Aaron Viets
Committed by
Kipp Cannon
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
lal_property: A few bug fixes to get it working right.
parent
fbd7f177
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gstlal-calibration/gst/lal/gstlal_property.c
+14
-11
14 additions, 11 deletions
gstlal-calibration/gst/lal/gstlal_property.c
gstlal-calibration/tests/lal_property_test.py
+87
-0
87 additions, 0 deletions
gstlal-calibration/tests/lal_property_test.py
with
101 additions
and
11 deletions
gstlal-calibration/gst/lal/gstlal_property.c
+
14
−
11
View file @
33e4f36a
...
...
@@ -223,11 +223,11 @@ static gboolean set_caps(GstBaseSink *sink, GstCaps *caps) {
/* Record the data type */
if
(
success
)
{
if
(
!
strchr
(
name
,
'S'
))
if
(
strchr
(
name
,
'S'
))
element
->
data_type
=
GSTLAL_PROPERTY_SIGNED
;
else
if
(
!
strchr
(
name
,
'U'
))
else
if
(
strchr
(
name
,
'U'
))
element
->
data_type
=
GSTLAL_PROPERTY_UNSIGNED
;
else
if
(
!
strchr
(
name
,
'F'
))
else
if
(
strchr
(
name
,
'F'
))
element
->
data_type
=
GSTLAL_PROPERTY_FLOAT
;
else
g_assert_not_reached
();
...
...
@@ -270,46 +270,49 @@ static GstFlowReturn render(GstBaseSink *sink, GstBuffer *buffer) {
switch
(
element
->
data_type
)
{
case
GSTLAL_PROPERTY_SIGNED
:
switch
(
element
->
unit_size
)
{
case
8
:
case
1
:
average_input_data_gint8
(
element
,
(
gint8
*
)
mapinfo
.
data
,
mapinfo
.
size
/
element
->
unit_size
,
GST_BUFFER_PTS
(
buffer
));
break
;
case
16
:
case
2
:
average_input_data_gint16
(
element
,
(
gint16
*
)
mapinfo
.
data
,
mapinfo
.
size
/
element
->
unit_size
,
GST_BUFFER_PTS
(
buffer
));
break
;
case
32
:
case
4
:
average_input_data_gint32
(
element
,
(
gint32
*
)
mapinfo
.
data
,
mapinfo
.
size
/
element
->
unit_size
,
GST_BUFFER_PTS
(
buffer
));
break
;
default:
g_assert_not_reached
();
break
;
}
break
;
case
GSTLAL_PROPERTY_UNSIGNED
:
switch
(
element
->
unit_size
)
{
case
8
:
case
1
:
average_input_data_guint8
(
element
,
(
guint8
*
)
mapinfo
.
data
,
mapinfo
.
size
/
element
->
unit_size
,
GST_BUFFER_PTS
(
buffer
));
break
;
case
16
:
case
2
:
average_input_data_guint16
(
element
,
(
guint16
*
)
mapinfo
.
data
,
mapinfo
.
size
/
element
->
unit_size
,
GST_BUFFER_PTS
(
buffer
));
break
;
case
32
:
case
4
:
average_input_data_guint32
(
element
,
(
guint32
*
)
mapinfo
.
data
,
mapinfo
.
size
/
element
->
unit_size
,
GST_BUFFER_PTS
(
buffer
));
break
;
default:
g_assert_not_reached
();
break
;
}
break
;
case
GSTLAL_PROPERTY_FLOAT
:
switch
(
element
->
unit_size
)
{
case
32
:
case
4
:
average_input_data_float
(
element
,
(
float
*
)
mapinfo
.
data
,
mapinfo
.
size
/
element
->
unit_size
,
GST_BUFFER_PTS
(
buffer
));
break
;
case
64
:
case
8
:
average_input_data_double
(
element
,
(
double
*
)
mapinfo
.
data
,
mapinfo
.
size
/
element
->
unit_size
,
GST_BUFFER_PTS
(
buffer
));
break
;
default:
g_assert_not_reached
();
break
;
}
break
;
default:
g_assert_not_reached
();
break
;
...
...
This diff is collapsed.
Click to expand it.
gstlal-calibration/tests/lal_property_test.py
0 → 100755
+
87
−
0
View file @
33e4f36a
#!/usr/bin/env python
# Copyright (C) 2018 Aaron Viets
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# =============================================================================
#
# Preamble
#
# =============================================================================
#
import
numpy
import
sys
from
gstlal
import
pipeparts
from
gstlal
import
calibration_parts
import
test_common
#
# =============================================================================
#
# Pipelines
#
# =============================================================================
#
def
lal_property_test_01
(
pipeline
,
name
):
#
# This test makes a stream changing between 2's and 8's.
# It should square the 2's and take the 8's to the 8th power.
#
rate
=
512
# Hz
width
=
64
buffer_length
=
1.0
# seconds
test_duration
=
100.0
# seconds
gap_frequency
=
0.1
# Hz
gap_threshold
=
0.0
control_dump_filename
=
"
control_property_test_01.dump
"
bad_data_intervals2
=
[
0.0
,
1e35
]
bad_data_intervals
=
[
-
1e35
,
1e-35
]
head
=
test_common
.
test_src
(
pipeline
,
buffer_length
=
buffer_length
,
rate
=
rate
,
width
=
width
,
channels
=
1
,
test_duration
=
test_duration
,
wave
=
0
,
freq
=
0.1
,
volume
=
1
)
head
=
pipeparts
.
mkgeneric
(
pipeline
,
head
,
"
lal_insertgap
"
,
bad_data_intervals
=
bad_data_intervals
,
insert_gap
=
False
,
fill_discont
=
True
,
replace_value
=
2.0
)
head
=
pipeparts
.
mkgeneric
(
pipeline
,
head
,
"
lal_insertgap
"
,
bad_data_intervals
=
bad_data_intervals2
,
insert_gap
=
False
,
fill_discont
=
True
,
replace_value
=
8.0
)
head
=
pipeparts
.
mktee
(
pipeline
,
head
)
pipeparts
.
mknxydumpsink
(
pipeline
,
head
,
"
%s_in.dump
"
%
name
)
lal_prop_exponent
=
pipeparts
.
mkgeneric
(
pipeline
,
head
,
"
lal_property
"
,
update_when_change
=
True
)
head
=
calibration_parts
.
mkpow
(
pipeline
,
head
,
exponent
=
0.0
)
lal_prop_exponent
.
connect
(
"
notify::current-average
"
,
calibration_parts
.
update_property_simple
,
head
,
"
current_average
"
,
"
exponent
"
)
pipeparts
.
mknxydumpsink
(
pipeline
,
head
,
"
%s_out.dump
"
%
name
)
#
# done
#
return
pipeline
#
# =============================================================================
#
# Main
#
# =============================================================================
#
test_common
.
build_and_run
(
lal_property_test_01
,
"
lal_property_test_01
"
)
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