Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
1d74c51a
Commit
1d74c51a
authored
15 years ago
by
Joris van Zwieten
Browse files
Options
Downloads
Patches
Plain Diff
Bug 1453: Code clean-up.
parent
447e762d
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
CEP/Calibration/BBSKernel/src/Expr/ArrayFactor.cc
+9
-10
9 additions, 10 deletions
CEP/Calibration/BBSKernel/src/Expr/ArrayFactor.cc
CEP/Calibration/BBSKernel/src/Expr/TileArrayFactor.cc
+7
-16
7 additions, 16 deletions
CEP/Calibration/BBSKernel/src/Expr/TileArrayFactor.cc
with
16 additions
and
26 deletions
CEP/Calibration/BBSKernel/src/Expr/ArrayFactor.cc
+
9
−
10
View file @
1d74c51a
...
@@ -107,33 +107,32 @@ const JonesMatrix::View ArrayFactor::evaluateImpl(const Grid &grid,
...
@@ -107,33 +107,32 @@ const JonesMatrix::View ArrayFactor::evaluateImpl(const Grid &grid,
DBGASSERT
(
delay0
.
nx
()
==
1
DBGASSERT
(
delay0
.
nx
()
==
1
&&
static_cast
<
size_t
>
(
delay0
.
ny
())
==
nTime
);
&&
static_cast
<
size_t
>
(
delay0
.
ny
())
==
nTime
);
double
*
p_delay
=
delay
.
doubleStorage
();
double
*
p_delay0
=
delay0
.
doubleStorage
();
double
*
p_re
,
*
p_im
;
double
*
p_re
,
*
p_im
;
arrayFactor
.
dcomplexStorage
(
p_re
,
p_im
);
arrayFactor
.
dcomplexStorage
(
p_re
,
p_im
);
const
double
*
p_delay
=
delay
.
doubleStorage
();
const
double
*
p_delay0
=
delay0
.
doubleStorage
();
for
(
size_t
t
=
0
;
t
<
nTime
;
++
t
)
for
(
size_t
t
=
0
;
t
<
nTime
;
++
t
)
{
{
const
double
delay_t
=
*
p_delay
;
const
double
delay_t
=
*
p_delay
++
;
const
double
shift0
=
omega0
*
(
*
p_delay0
);
const
double
shift0
=
omega0
*
(
*
p_delay0
++
);
for
(
size_t
f
=
0
;
f
<
nFreq
;
++
f
)
for
(
size_t
f
=
0
;
f
<
nFreq
;
++
f
)
{
{
const
double
shift
=
shift0
-
C
::
_2pi
*
grid
[
FREQ
]
->
center
(
f
)
const
double
shift
=
shift0
-
C
::
_2pi
*
grid
[
FREQ
]
->
center
(
f
)
*
delay_t
;
*
delay_t
;
(
*
p_re
)
+=
std
::
cos
(
shift
)
/
nElement
;
(
*
p_re
)
+=
std
::
cos
(
shift
);
(
*
p_im
)
+=
std
::
sin
(
shift
)
/
nElement
;
(
*
p_im
)
+=
std
::
sin
(
shift
);
++
p_re
;
++
p_re
;
++
p_im
;
++
p_im
;
}
}
++
p_delay
;
++
p_delay0
;
}
}
}
}
// Normalize.
arrayFactor
/=
nElement
;
JonesMatrix
::
View
result
;
JonesMatrix
::
View
result
;
result
.
assign
(
0
,
0
,
arrayFactor
);
result
.
assign
(
0
,
0
,
arrayFactor
);
result
.
assign
(
0
,
1
,
Matrix
(
makedcomplex
(
0.0
,
0.0
)));
result
.
assign
(
0
,
1
,
Matrix
(
makedcomplex
(
0.0
,
0.0
)));
...
...
This diff is collapsed.
Click to expand it.
CEP/Calibration/BBSKernel/src/Expr/TileArrayFactor.cc
+
7
−
16
View file @
1d74c51a
...
@@ -65,29 +65,24 @@ const JonesMatrix::View TileArrayFactor::evaluateImpl(const Grid &grid,
...
@@ -65,29 +65,24 @@ const JonesMatrix::View TileArrayFactor::evaluateImpl(const Grid &grid,
// Convert from elevation to zenith angle.
// Convert from elevation to zenith angle.
Matrix
theta
=
Matrix
(
C
::
pi_2
)
-
direction
(
1
);
Matrix
theta
=
Matrix
(
C
::
pi_2
)
-
direction
(
1
);
Matrix
sin_theta
=
sin
(
theta
);
Matrix
sin_theta
=
sin
(
theta
);
// Matrix cos_theta = cos(theta);
Matrix
k
[
2
];
Matrix
k
[
2
];
k
[
0
]
=
-
sin_theta
*
cos_phi
;
k
[
0
]
=
-
sin_theta
*
cos_phi
;
k
[
1
]
=
-
sin_theta
*
sin_phi
;
k
[
1
]
=
-
sin_theta
*
sin_phi
;
// k[2] = -cos_theta;
Matrix
sin_phi0
=
sin
(
reference
(
0
));
Matrix
sin_phi0
=
sin
(
reference
(
0
));
Matrix
cos_phi0
=
cos
(
reference
(
0
));
Matrix
cos_phi0
=
cos
(
reference
(
0
));
// Convert from elevation to zenith angle.
// Convert from elevation to zenith angle.
Matrix
theta0
=
Matrix
(
C
::
pi_2
)
-
reference
(
1
);
Matrix
theta0
=
Matrix
(
C
::
pi_2
)
-
reference
(
1
);
Matrix
sin_theta0
=
sin
(
theta0
);
Matrix
sin_theta0
=
sin
(
theta0
);
// Matrix cos_theta0 = cos(theta0);
Matrix
k0
[
2
];
Matrix
k0
[
2
];
k0
[
0
]
=
-
sin_theta0
*
cos_phi0
;
k0
[
0
]
=
-
sin_theta0
*
cos_phi0
;
k0
[
1
]
=
-
sin_theta0
*
sin_phi0
;
k0
[
1
]
=
-
sin_theta0
*
sin_phi0
;
// k0[2] = -cos_theta0;
// Compute difference vector.
// Compute difference vector.
k
[
0
]
=
k0
[
0
]
-
k
[
0
];
k
[
0
]
=
k0
[
0
]
-
k
[
0
];
k
[
1
]
=
k0
[
1
]
-
k
[
1
];
k
[
1
]
=
k0
[
1
]
-
k
[
1
];
// k[2] = k0[2] - k[2];
// Allocate result (initialized at 0+0i).
// Allocate result (initialized at 0+0i).
Matrix
arrayFactor
(
makedcomplex
(
0.0
,
0.0
),
nFreq
,
nTime
);
Matrix
arrayFactor
(
makedcomplex
(
0.0
,
0.0
),
nFreq
,
nTime
);
...
@@ -97,34 +92,30 @@ const JonesMatrix::View TileArrayFactor::evaluateImpl(const Grid &grid,
...
@@ -97,34 +92,30 @@ const JonesMatrix::View TileArrayFactor::evaluateImpl(const Grid &grid,
// direction of interest with respect to the phase center of element i
// direction of interest with respect to the phase center of element i
// when beamforming in the reference direction using time delays.
// when beamforming in the reference direction using time delays.
Matrix
delay
=
(
k
[
0
]
*
itsLayout
(
i
,
0
)
+
k
[
1
]
*
itsLayout
(
i
,
1
))
/
C
::
c
;
Matrix
delay
=
(
k
[
0
]
*
itsLayout
(
i
,
0
)
+
k
[
1
]
*
itsLayout
(
i
,
1
))
/
C
::
c
;
// LOG_DEBUG_STR("el: " << i << " x: " << itsLayout(i, 0) << " y: "
// << itsLayout(i, 1));
DBGASSERT
(
delay
.
nx
()
==
1
&&
static_cast
<
size_t
>
(
delay
.
ny
())
==
nTime
);
DBGASSERT
(
delay
.
nx
()
==
1
&&
static_cast
<
size_t
>
(
delay
.
ny
())
==
nTime
);
double
*
p_re
,
*
p_im
;
double
*
p_re
,
*
p_im
;
arrayFactor
.
dcomplexStorage
(
p_re
,
p_im
);
arrayFactor
.
dcomplexStorage
(
p_re
,
p_im
);
double
*
p_delay
=
delay
.
doubleStorage
();
const
double
*
p_delay
=
delay
.
doubleStorage
();
for
(
size_t
t
=
0
;
t
<
nTime
;
++
t
)
for
(
size_t
t
=
0
;
t
<
nTime
;
++
t
)
{
{
const
double
delay_t
=
*
p_delay
;
const
double
delay_t
=
*
p_delay
++
;
for
(
size_t
f
=
0
;
f
<
nFreq
;
++
f
)
for
(
size_t
f
=
0
;
f
<
nFreq
;
++
f
)
{
{
const
double
shift
=
C
::
_2pi
*
grid
[
FREQ
]
->
center
(
f
)
*
delay_t
;
const
double
shift
=
C
::
_2pi
*
grid
[
FREQ
]
->
center
(
f
)
*
delay_t
;
*
p_re
+=
std
::
cos
(
shift
);
(
*
p_re
)
+=
std
::
cos
(
shift
)
/
nElement
;
*
p_im
+=
std
::
sin
(
shift
);
(
*
p_im
)
+=
std
::
sin
(
shift
)
/
nElement
;
++
p_re
;
++
p_re
;
++
p_im
;
++
p_im
;
}
}
++
p_delay
;
}
}
}
}
// Normalize.
arrayFactor
/=
nElement
;
JonesMatrix
::
View
result
;
JonesMatrix
::
View
result
;
result
.
assign
(
0
,
0
,
arrayFactor
);
result
.
assign
(
0
,
0
,
arrayFactor
);
result
.
assign
(
0
,
1
,
Matrix
(
makedcomplex
(
0.0
,
0.0
)));
result
.
assign
(
0
,
1
,
Matrix
(
makedcomplex
(
0.0
,
0.0
)));
...
...
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