Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
schaapcommon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
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
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
ResearchAndDevelopment
schaapcommon
Commits
794ab501
Commit
794ab501
authored
10 months ago
by
Bas van der Tol
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
88a89abc
Branches
ast-1491-extend-h5parmaterm-rebased1
No related tags found
No related merge requests found
Pipeline
#102803
failed
2 months ago
Stage: versioning
Stage: prepare
Stage: linting
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/schaapcommon/h5parm/soltab.h
+8
-0
8 additions, 0 deletions
include/schaapcommon/h5parm/soltab.h
src/h5parm/soltab.cc
+98
-0
98 additions, 0 deletions
src/h5parm/soltab.cc
with
106 additions
and
0 deletions
include/schaapcommon/h5parm/soltab.h
+
8
−
0
View file @
794ab501
...
...
@@ -196,6 +196,14 @@ class SolTab : private H5::Group {
const
std
::
vector
<
double
>&
freqs
,
size_t
pol
,
size_t
dir
,
bool
nearest
)
const
;
std
::
tuple
<
int
,
int
,
int
,
int
,
int
>
GetValuesOrWeights
(
const
std
::
string
&
val_or_weight
,
unsigned
int
startantenna
,
unsigned
int
nantenna
,
unsigned
int
antennastep
,
unsigned
int
starttimeslot
,
unsigned
int
ntime
,
unsigned
int
timestep
,
unsigned
int
startfreq
,
unsigned
int
nfreq
,
unsigned
int
freqstep
,
unsigned
int
startpol
,
unsigned
int
npol
,
unsigned
int
polstep
,
unsigned
int
startdir
,
unsigned
int
ndir
,
unsigned
int
dirstep
,
std
::
vector
<
double
>
&
buffer
)
const
;
/// Get the values or weights of this SolTab for a given antenna given an
/// antenna name, a direction index, and a (range of) times and frequencies.
...
...
This diff is collapsed.
Click to expand it.
src/h5parm/soltab.cc
+
98
−
0
View file @
794ab501
...
...
@@ -362,6 +362,104 @@ std::vector<double> SolTab::GetValuesOrWeights(
frequencies
,
sub_array
,
mem_layout
,
nearest
);
}
std
::
tuple
<
int
,
int
,
int
,
int
,
int
>
SolTab
::
GetValuesOrWeights
(
const
std
::
string
&
val_or_weight
,
unsigned
int
startantenna
,
unsigned
int
nantenna
,
unsigned
int
antennastep
,
unsigned
int
starttimeslot
,
unsigned
int
ntime
,
unsigned
int
timestep
,
unsigned
int
startfreq
,
unsigned
int
nfreq
,
unsigned
int
freqstep
,
unsigned
int
startpol
,
unsigned
int
npol
,
unsigned
int
polstep
,
unsigned
int
startdir
,
unsigned
int
ndir
,
unsigned
int
dirstep
,
std
::
vector
<
double
>
&
buffer
)
const
{
H5
::
DataSet
val
=
openDataSet
(
val_or_weight
);
// Set offsets and strides
std
::
vector
<
hsize_t
>
memdims
;
std
::
vector
<
hsize_t
>
offsets
;
std
::
vector
<
hsize_t
>
counts
;
std
::
vector
<
hsize_t
>
strides
;
memdims
.
reserve
(
axes_
.
size
());
offsets
.
reserve
(
axes_
.
size
());
counts
.
reserve
(
axes_
.
size
());
strides
.
reserve
(
axes_
.
size
());
for
(
const
AxisInfo
&
axis_info
:
axes_
)
{
hsize_t
stride
=
1
;
hsize_t
count
=
1
;
hsize_t
offset
=
0
;
if
(
axis_info
.
name
==
"time"
)
{
offset
=
starttimeslot
;
stride
=
timestep
;
count
=
ntime
;
}
else
if
(
axis_info
.
name
==
"freq"
)
{
offset
=
startfreq
;
stride
=
freqstep
;
count
=
nfreq
;
}
else
if
(
axis_info
.
name
==
"ant"
)
{
offset
=
startantenna
;
stride
=
antennastep
;
count
=
nantenna
;
}
else
if
(
axis_info
.
name
==
"dir"
)
{
offset
=
startdir
;
stride
=
dirstep
;
count
=
ndir
;
}
else
if
(
axis_info
.
name
==
"pol"
)
{
offset
=
startpol
;
stride
=
polstep
;
count
=
npol
;
}
else
if
(
axis_info
.
size
!=
1
)
{
throw
std
::
runtime_error
(
"Axis
\"
"
+
axis_info
.
name
+
"
\"
in H5Parm is not understood"
);
}
memdims
.
push_back
(
count
);
offsets
.
push_back
(
offset
);
counts
.
push_back
(
count
);
strides
.
push_back
(
stride
);
}
int
ant_stride
=
0
;
int
time_stride
=
0
;
int
freq_stride
=
0
;
int
pol_stride
=
0
;
int
dir_stride
=
0
;
int
stride
=
1
;
for
(
auto
axis_info
=
axes_
.
rbegin
();
axis_info
!=
axes_
.
rend
();
++
axis_info
)
{
if
(
axis_info
->
name
==
"time"
)
{
time_stride
=
stride
;
stride
*=
ntime
;
}
else
if
(
axis_info
->
name
==
"freq"
)
{
freq_stride
=
stride
;
stride
*=
nfreq
;
}
else
if
(
axis_info
->
name
==
"ant"
)
{
ant_stride
=
stride
;
stride
*=
nantenna
;
}
else
if
(
axis_info
->
name
==
"dir"
)
{
dir_stride
=
stride
;
stride
*=
ndir
;
}
else
if
(
axis_info
->
name
==
"pol"
)
{
pol_stride
=
stride
;
stride
*=
npol
;
}
}
buffer
.
resize
(
stride
);
H5
::
DataSpace
dataspace
=
val
.
getSpace
();
dataspace
.
selectHyperslab
(
H5S_SELECT_SET
,
counts
.
data
(),
offsets
.
data
(),
strides
.
data
());
// Setup memory dataspace
H5
::
DataSpace
memspace
(
axes_
.
size
(),
memdims
.
data
());
try
{
val
.
read
(
buffer
.
data
(),
H5
::
PredType
::
NATIVE_DOUBLE
,
memspace
,
dataspace
);
}
catch
(
H5
::
DataSetIException
&
e
)
{
e
.
printErrorStack
();
throw
std
::
runtime_error
(
"Could not read data"
);
}
return
{
ant_stride
,
time_stride
,
freq_stride
,
pol_stride
,
dir_stride
};
}
void
SolTab
::
ApplyFlags
(
std
::
vector
<
double
>&
values
,
const
std
::
vector
<
double
>&
weights
)
{
assert
(
values
.
size
()
==
weights
.
size
());
...
...
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