Skip to content
GitLab
Explore
Sign in
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
86618693
Commit
86618693
authored
7 years ago
by
Tammo Jan Dijkema
Browse files
Options
Downloads
Patches
Plain Diff
Task #10805: Make DPPP_DDECal work with new H5Parm
parent
dab218a0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CEP/DP3/DPPP/include/DPPP/H5Parm.h
+3
-3
3 additions, 3 deletions
CEP/DP3/DPPP/include/DPPP/H5Parm.h
CEP/DP3/DPPP/src/SolTab.cc
+3
-3
3 additions, 3 deletions
CEP/DP3/DPPP/src/SolTab.cc
CEP/DP3/DPPP_DDECal/src/DDECal.cc
+30
-26
30 additions, 26 deletions
CEP/DP3/DPPP_DDECal/src/DDECal.cc
with
36 additions
and
32 deletions
CEP/DP3/DPPP/include/DPPP/H5Parm.h
+
3
−
3
View file @
86618693
...
@@ -109,9 +109,9 @@ namespace LOFAR {
...
@@ -109,9 +109,9 @@ namespace LOFAR {
const
std
::
vector
<
double
>&
weights
);
const
std
::
vector
<
double
>&
weights
);
// Add a complex solution, taking either amplitude or phase
// Add a complex solution, taking either amplitude or phase
void
setValues
(
const
std
::
vector
<
std
::
complex
<
double
>
>&
vals
,
void
set
Complex
Values
(
const
std
::
vector
<
std
::
complex
<
double
>
>&
vals
,
const
std
::
vector
<
double
>&
weights
,
const
std
::
vector
<
double
>&
weights
,
bool
toAmplitudes
);
bool
toAmplitudes
);
// Get the values of this SolTab for a given antenna.
// Get the values of this SolTab for a given antenna.
std
::
vector
<
double
>
getValues
(
const
std
::
string
&
antName
,
std
::
vector
<
double
>
getValues
(
const
std
::
string
&
antName
,
...
...
This diff is collapsed.
Click to expand it.
CEP/DP3/DPPP/src/SolTab.cc
+
3
−
3
View file @
86618693
...
@@ -115,9 +115,9 @@ namespace LOFAR {
...
@@ -115,9 +115,9 @@ namespace LOFAR {
attr
.
write
(
H5
::
StrType
(
H5
::
PredType
::
C_S1
,
axesstr
.
size
()),
axesstr
);
attr
.
write
(
H5
::
StrType
(
H5
::
PredType
::
C_S1
,
axesstr
.
size
()),
axesstr
);
}
}
void
H5Parm
::
SolTab
::
setValues
(
const
std
::
vector
<
std
::
complex
<
double
>
>&
vals
,
void
H5Parm
::
SolTab
::
set
Complex
Values
(
const
std
::
vector
<
std
::
complex
<
double
>
>&
vals
,
const
std
::
vector
<
double
>&
weights
,
const
std
::
vector
<
double
>&
weights
,
bool
toAmplitudes
)
{
bool
toAmplitudes
)
{
// Convert values to real numbers by taking amplitude or argument
// Convert values to real numbers by taking amplitude or argument
vector
<
double
>
realvals
(
vals
.
size
());
vector
<
double
>
realvals
(
vals
.
size
());
...
...
This diff is collapsed.
Click to expand it.
CEP/DP3/DPPP_DDECal/src/DDECal.cc
+
30
−
26
View file @
86618693
...
@@ -444,8 +444,6 @@ namespace LOFAR {
...
@@ -444,8 +444,6 @@ namespace LOFAR {
uint
nDir
=
itsDirections
.
size
();
uint
nDir
=
itsDirections
.
size
();
vector
<
double
>
weights
(
info
().
nchan
()
*
info
().
nantenna
()
*
info
().
ntime
()
*
itsDirections
.
size
(),
1.
);
if
(
itsConstraintSols
[
0
].
empty
())
{
if
(
itsConstraintSols
[
0
].
empty
())
{
// Record the actual iterands of the solver
// Record the actual iterands of the solver
vector
<
DComplex
>
sols
(
info
().
nchan
()
*
info
().
nantenna
()
*
info
().
ntime
()
*
nDir
);
vector
<
DComplex
>
sols
(
info
().
nchan
()
*
info
().
nantenna
()
*
info
().
ntime
()
*
nDir
);
...
@@ -463,29 +461,29 @@ namespace LOFAR {
...
@@ -463,29 +461,29 @@ namespace LOFAR {
}
}
}
}
}
}
string
axesnames
=
"dir,ant,freq,time"
;
vector
<
H5Parm
::
AxisInfo
>
axes
;
vector
<
hsize_t
>
dims
(
4
);
axes
.
push_back
(
H5Parm
::
AxisInfo
(
"dir"
,
nDir
));
dims
[
0
]
=
nDir
;
axes
.
push_back
(
H5Parm
::
AxisInfo
(
"ant"
,
info
().
nantenna
()));
dims
[
1
]
=
info
().
nantenna
();
axes
.
push_back
(
H5Parm
::
AxisInfo
(
"freq"
,
info
().
nchan
()));
dims
[
2
]
=
info
().
nchan
();
axes
.
push_back
(
H5Parm
::
AxisInfo
(
"time"
,
itsSols
.
size
()));
dims
[
3
]
=
itsSols
.
size
();
uint
numsols
=
(
itsMode
==
GainCal
::
COMPLEXGAIN
?
2
:
1
);
uint
numsols
=
(
itsMode
==
GainCal
::
COMPLEXGAIN
?
2
:
1
);
for
(
uint
solnum
=
0
;
solnum
<
numsols
;
++
solnum
)
{
for
(
uint
solnum
=
0
;
solnum
<
numsols
;
++
solnum
)
{
string
solTabName
;
string
solTabName
;
H5Parm
::
SolTab
soltab
;
if
(
itsMode
==
GainCal
::
PHASEONLY
)
{
if
(
itsMode
==
GainCal
::
PHASEONLY
)
{
solTabName
=
"phaseonly000"
;
solTabName
=
"phaseonly000"
;
itsH5Parm
.
addSolution
(
solTabName
,
"scalarphase"
,
axes
names
,
soltab
=
itsH5Parm
.
createSolTab
(
solTabName
,
"scalarphase"
,
axes
);
dims
,
sols
,
weights
,
false
);
soltab
.
setComplexValues
(
sols
,
vector
<
double
>
()
,
false
);
}
else
if
(
itsMode
==
GainCal
::
COMPLEXGAIN
)
{
}
else
if
(
itsMode
==
GainCal
::
COMPLEXGAIN
)
{
if
(
solnum
==
0
)
{
if
(
solnum
==
0
)
{
solTabName
=
"scalarphase000"
;
solTabName
=
"scalarphase000"
;
itsH5Parm
.
addSolution
(
solTabName
,
"scalarphase"
,
axes
names
,
soltab
=
itsH5Parm
.
createSolTab
(
solTabName
,
"scalarphase"
,
axes
);
dims
,
sols
,
weights
,
false
);
soltab
.
setComplexValues
(
sols
,
vector
<
double
>
()
,
false
);
}
else
{
}
else
{
solTabName
=
"scalaramplitude000"
;
solTabName
=
"scalaramplitude000"
;
itsH5Parm
.
addSolution
(
solTabName
,
"scalaramplitude"
,
axes
names
,
soltab
=
itsH5Parm
.
createSolTab
(
solTabName
,
"scalaramplitude"
,
axes
);
dims
,
sols
,
weights
,
true
);
soltab
.
setComplexValues
(
sols
,
vector
<
double
>
()
,
true
);
}
}
}
else
{
}
else
{
THROW
(
Exception
,
"Constraint should have produced output"
);
THROW
(
Exception
,
"Constraint should have produced output"
);
...
@@ -496,20 +494,20 @@ namespace LOFAR {
...
@@ -496,20 +494,20 @@ namespace LOFAR {
for
(
uint
i
=
0
;
i
<
info
().
antennaNames
().
size
();
++
i
)
{
for
(
uint
i
=
0
;
i
<
info
().
antennaNames
().
size
();
++
i
)
{
antennaNames
[
i
]
=
info
().
antennaNames
()[
i
];
antennaNames
[
i
]
=
info
().
antennaNames
()[
i
];
}
}
itsH5Parm
.
set
Sol
Antennas
(
solTabName
,
antennaNames
);
soltab
.
setAntennas
(
antennaNames
);
std
::
vector
<
std
::
string
>
sourceNames
(
itsDirections
.
size
());
std
::
vector
<
std
::
string
>
sourceNames
(
itsDirections
.
size
());
for
(
uint
i
=
0
;
i
<
itsDirections
.
size
();
++
i
)
{
for
(
uint
i
=
0
;
i
<
itsDirections
.
size
();
++
i
)
{
sourceNames
[
i
]
=
itsDirections
[
i
][
0
];
// This only gives the name of the first patch
sourceNames
[
i
]
=
itsDirections
[
i
][
0
];
// This only gives the name of the first patch
}
}
itsH5Parm
.
setSo
lSo
urces
(
solTabName
,
sourceNames
);
soltab
.
setSources
(
sourceNames
);
// Set channel to frequency of middle channel
// Set channel to frequency of middle channel
vector
<
double
>
chanFreqs
(
info
().
nchan
());
vector
<
double
>
chanFreqs
(
info
().
nchan
());
for
(
uint
chan
=
0
;
chan
<
info
().
nchan
();
++
chan
)
{
for
(
uint
chan
=
0
;
chan
<
info
().
nchan
();
++
chan
)
{
chanFreqs
[
chan
]
=
info
().
chanFreqs
()[
chan
];
chanFreqs
[
chan
]
=
info
().
chanFreqs
()[
chan
];
}
}
itsH5Parm
.
setFreqs
(
solTabName
,
chanFreqs
);
soltab
.
setFreqs
(
chanFreqs
);
uint
nSolTimes
=
(
info
().
ntime
()
+
itsSolInt
-
1
)
/
itsSolInt
;
uint
nSolTimes
=
(
info
().
ntime
()
+
itsSolInt
-
1
)
/
itsSolInt
;
vector
<
double
>
solTimes
(
nSolTimes
);
vector
<
double
>
solTimes
(
nSolTimes
);
...
@@ -518,7 +516,7 @@ namespace LOFAR {
...
@@ -518,7 +516,7 @@ namespace LOFAR {
solTimes
[
t
]
=
starttime
+
t
*
info
().
timeInterval
()
*
itsSolInt
+
0.5
*
info
().
timeInterval
();
solTimes
[
t
]
=
starttime
+
t
*
info
().
timeInterval
()
*
itsSolInt
+
0.5
*
info
().
timeInterval
();
}
}
// End TODO
// End TODO
itsH5Parm
.
setTimes
(
solTabName
,
solTimes
);
soltab
.
setTimes
(
solTimes
);
}
// solnums loop
}
// solnums loop
}
else
{
}
else
{
// Record the Constraint::Result in the H5Parm
// Record the Constraint::Result in the H5Parm
...
@@ -532,7 +530,7 @@ namespace LOFAR {
...
@@ -532,7 +530,7 @@ namespace LOFAR {
// Get the result of the constraint solution at first time to get metadata
// Get the result of the constraint solution at first time to get metadata
Constraint
::
Result
firstResult
=
itsConstraintSols
[
0
][
constraintNum
][
solNameNum
];
Constraint
::
Result
firstResult
=
itsConstraintSols
[
0
][
constraintNum
][
solNameNum
];
vector
<
hsize_t
>
dims
(
firstResult
.
dims
.
size
()
+
1
);
// Add time dimension
vector
<
hsize_t
>
dims
(
firstResult
.
dims
.
size
()
+
1
);
// Add time dimension
at end
dims
[
dims
.
size
()
-
1
]
=
itsConstraintSols
.
size
();
dims
[
dims
.
size
()
-
1
]
=
itsConstraintSols
.
size
();
size_t
numSols
=
dims
[
dims
.
size
()
-
1
];
size_t
numSols
=
dims
[
dims
.
size
()
-
1
];
for
(
uint
i
=
0
;
i
<
dims
.
size
()
-
1
;
++
i
)
{
for
(
uint
i
=
0
;
i
<
dims
.
size
()
-
1
;
++
i
)
{
...
@@ -540,7 +538,13 @@ namespace LOFAR {
...
@@ -540,7 +538,13 @@ namespace LOFAR {
numSols
*=
dims
[
i
];
numSols
*=
dims
[
i
];
}
}
string
axesnames
=
firstResult
.
axes
+
",time"
;
vector
<
string
>
firstaxesnames
=
StringUtil
::
tokenize
(
firstResult
.
axes
,
","
);
vector
<
H5Parm
::
AxisInfo
>
axes
;
for
(
size_t
axisNum
=
0
;
axisNum
<
axes
.
size
()
-
1
;
++
axisNum
)
{
axes
.
push_back
(
H5Parm
::
AxisInfo
(
firstaxesnames
[
axisNum
],
firstResult
.
dims
[
axisNum
]));
}
axes
.
push_back
(
H5Parm
::
AxisInfo
(
"time"
,
itsConstraintSols
.
size
()));
// Put solutions in a contiguous piece of memory
// Put solutions in a contiguous piece of memory
vector
<
double
>
sols
(
numSols
);
vector
<
double
>
sols
(
numSols
);
...
@@ -553,8 +557,8 @@ namespace LOFAR {
...
@@ -553,8 +557,8 @@ namespace LOFAR {
}
}
string
solTabName
=
firstResult
.
name
+
"000"
;
string
solTabName
=
firstResult
.
name
+
"000"
;
itsH5Parm
.
addSolution
(
solTabName
,
firstResult
.
name
,
H5Parm
::
SolTab
soltab
=
itsH5Parm
.
createSolTab
(
solTabName
,
firstResult
.
name
,
axes
);
axesnames
,
dims
,
sols
,
weights
);
soltab
.
setValues
(
sols
,
vector
<
double
>
()
);
// Tell H5Parm that all antennas and directions were used
// Tell H5Parm that all antennas and directions were used
// TODO: do this more cleanly
// TODO: do this more cleanly
...
@@ -562,18 +566,18 @@ namespace LOFAR {
...
@@ -562,18 +566,18 @@ namespace LOFAR {
for
(
uint
i
=
0
;
i
<
info
().
antennaNames
().
size
();
++
i
)
{
for
(
uint
i
=
0
;
i
<
info
().
antennaNames
().
size
();
++
i
)
{
antennaNames
[
i
]
=
info
().
antennaNames
()[
i
];
antennaNames
[
i
]
=
info
().
antennaNames
()[
i
];
}
}
itsH5Parm
.
set
Sol
Antennas
(
solTabName
,
antennaNames
);
soltab
.
setAntennas
(
antennaNames
);
std
::
vector
<
std
::
string
>
sourceNames
(
itsDirections
.
size
());
std
::
vector
<
std
::
string
>
sourceNames
(
itsDirections
.
size
());
for
(
uint
i
=
0
;
i
<
itsDirections
.
size
();
++
i
)
{
for
(
uint
i
=
0
;
i
<
itsDirections
.
size
();
++
i
)
{
sourceNames
[
i
]
=
itsDirections
[
i
][
0
];
// This only gives the name of the first patch
sourceNames
[
i
]
=
itsDirections
[
i
][
0
];
// This only gives the name of the first patch
}
}
itsH5Parm
.
setSo
lSo
urces
(
solTabName
,
sourceNames
);
soltab
.
setSources
(
sourceNames
);
// Set channel to frequency of middle channel
// Set channel to frequency of middle channel
vector
<
double
>
oneFreq
(
1
);
vector
<
double
>
oneFreq
(
1
);
oneFreq
[
0
]
=
info
().
chanFreqs
()[
info
().
nchan
()
/
2
];
oneFreq
[
0
]
=
info
().
chanFreqs
()[
info
().
nchan
()
/
2
];
itsH5Parm
.
setFreqs
(
solTabName
,
oneFreq
);
soltab
.
setFreqs
(
oneFreq
);
uint
nSolTimes
=
(
info
().
ntime
()
+
itsSolInt
-
1
)
/
itsSolInt
;
uint
nSolTimes
=
(
info
().
ntime
()
+
itsSolInt
-
1
)
/
itsSolInt
;
vector
<
double
>
solTimes
(
nSolTimes
);
vector
<
double
>
solTimes
(
nSolTimes
);
...
@@ -581,7 +585,7 @@ namespace LOFAR {
...
@@ -581,7 +585,7 @@ namespace LOFAR {
for
(
uint
t
=
0
;
t
<
nSolTimes
;
++
t
)
{
for
(
uint
t
=
0
;
t
<
nSolTimes
;
++
t
)
{
solTimes
[
t
]
=
starttime
+
t
*
info
().
timeInterval
()
*
itsSolInt
+
0.5
*
info
().
timeInterval
();
solTimes
[
t
]
=
starttime
+
t
*
info
().
timeInterval
()
*
itsSolInt
+
0.5
*
info
().
timeInterval
();
}
}
itsH5Parm
.
setTimes
(
solTabName
,
solTimes
);
soltab
.
setTimes
(
solTimes
);
// End TODO
// End TODO
}
}
}
}
...
...
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