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
b3f32413
Commit
b3f32413
authored
15 years ago
by
kipp
Browse files
Options
Downloads
Patches
Plain Diff
Allow input stream to have arbitrary units (or none).
parent
1c25d034
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
src/plugins/gstlal_whiten.c
+27
-9
27 additions, 9 deletions
src/plugins/gstlal_whiten.c
with
27 additions
and
9 deletions
src/plugins/gstlal_whiten.c
+
27
−
9
View file @
b3f32413
...
...
@@ -252,10 +252,10 @@ static int make_window_and_fft_plans(GSTLALWhiten *element)
}
static
REAL8FrequencySeries
*
make_empty_psd
(
double
f0
,
double
deltaF
,
int
length
)
static
REAL8FrequencySeries
*
make_empty_psd
(
double
f0
,
double
deltaF
,
int
length
,
LALUnit
sample_units
)
{
LALUnit
strain_squared_per_hertz
=
gstlal_lal
Strain
SquaredPerHertz
();
REAL8FrequencySeries
*
psd
=
XLALCreateREAL8FrequencySeries
(
"PSD"
,
&
GPS_ZERO
,
f0
,
deltaF
,
&
strain_squared_per_hertz
,
length
);
LALUnit
unit
=
gstlal_lal
Unit
SquaredPerHertz
(
sample_units
);
REAL8FrequencySeries
*
psd
=
XLALCreateREAL8FrequencySeries
(
"PSD"
,
&
GPS_ZERO
,
f0
,
deltaF
,
&
unit
,
length
);
if
(
!
psd
)
{
GST_ERROR
(
"XLALCreateREAL8FrequencySeries() failed"
);
...
...
@@ -268,17 +268,29 @@ static REAL8FrequencySeries *make_empty_psd(double f0, double deltaF, int length
static
REAL8FrequencySeries
*
make_psd_from_fseries
(
const
COMPLEX16FrequencySeries
*
fseries
)
{
REAL8FrequencySeries
*
psd
=
make_empty_psd
(
fseries
->
f0
,
fseries
->
deltaF
,
fseries
->
data
->
length
);
LALUnit
unit
;
REAL8FrequencySeries
*
psd
;
unsigned
i
;
/*
* reconstruct the time-domain sample units from the sample units
* of the frequency series
*/
XLALUnitMultiply
(
&
unit
,
&
fseries
->
sampleUnits
,
&
lalHertzUnit
);
/*
* build the PSD
*/
psd
=
make_empty_psd
(
fseries
->
f0
,
fseries
->
deltaF
,
fseries
->
data
->
length
,
unit
);
if
(
!
psd
)
return
NULL
;
for
(
i
=
0
;
i
<
psd
->
data
->
length
;
i
++
)
psd
->
data
->
data
[
i
]
=
XLALCOMPLEX16Abs2
(
fseries
->
data
->
data
[
i
])
*
(
2
*
psd
->
deltaF
);
/*
*
Z
ero the DC and Nyquist components
*
z
ero the DC and Nyquist components
*/
if
(
psd
->
f0
==
0
)
...
...
@@ -407,10 +419,16 @@ static void set_property(GObject * object, enum property id, const GValue * valu
case
ARG_ZERO_PAD_SECONDS
:
element
->
zero_pad_seconds
=
g_value_get_double
(
value
);
/* FIXME: if the value has changed, set sink pad's caps to
* NULL to force renegotiation (== check that the rate is
* still OK) */
break
;
case
ARG_FFT_LENGTH
:
element
->
fft_length_seconds
=
g_value_get_double
(
value
);
/* FIXME: if the value has changed, set sink pad's caps to
* NULL to force renegotiation (== check that the rate is
* still OK) */
break
;
case
ARG_AVERAGE_SAMPLES
:
...
...
@@ -430,9 +448,9 @@ static void set_property(GObject * object, enum property id, const GValue * valu
/* FIXME: deltaF? */
REAL8FrequencySeries
*
psd
;
if
(
element
->
psd
)
psd
=
make_empty_psd
(
0
.
0
,
element
->
psd
->
deltaF
,
va
->
n_values
);
psd
=
make_empty_psd
(
0
.
0
,
element
->
psd
->
deltaF
,
va
->
n_values
,
element
->
sample_units
);
else
psd
=
make_empty_psd
(
0
.
0
,
1
.
0
,
va
->
n_values
);
psd
=
make_empty_psd
(
0
.
0
,
1
.
0
,
va
->
n_values
,
element
->
sample_units
);
doubles_from_g_value_array
(
va
,
psd
->
data
->
data
);
if
(
XLALPSDRegressorSetPSD
(
element
->
psd_regressor
,
psd
,
XLALPSDRegressorGetAverageSamples
(
element
->
psd_regressor
)))
{
GST_ERROR_OBJECT
(
element
,
"XLALPSDRegressorSetPSD() failed"
);
...
...
@@ -570,7 +588,7 @@ static gboolean setcaps(GstPad *pad, GstCaps *caps)
* FFT plans, and workspaces
*/
if
(
success
&&
rate
!=
element
->
sample_rate
)
{
if
(
success
&&
(
rate
!=
element
->
sample_rate
)
)
{
element
->
sample_rate
=
rate
;
if
(
make_window_and_fft_plans
(
element
))
success
=
FALSE
;
...
...
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