Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
nifty_gridder
Commits
6db3283a
Commit
6db3283a
authored
Aug 28, 2019
by
Martin Reinecke
Browse files
add RowChan type
parent
7faf4d5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
gridder_cxx.h
View file @
6db3283a
...
...
@@ -245,6 +245,11 @@ size_t get_supp(double epsilon)
throw
runtime_error
(
"requested epsilon too small - minimum is 2e-13"
);
}
struct
RowChan
{
size_t
row
,
chan
;
};
template
<
typename
T
>
class
EC_Kernel
{
protected:
...
...
@@ -332,14 +337,17 @@ template<typename T> class Baselines
coord
[
i
]
=
UVW
<
T
>
(
coord_
(
i
,
0
),
coord_
(
i
,
1
),
coord_
(
i
,
2
));
}
UVW
<
T
>
effectiveCoord
(
uint32_t
index
)
const
RowChan
getRowChan
(
uint32_t
index
)
const
{
size_t
irow
=
index
/
nchan
;
size_t
ichan
=
index
-
nchan
*
irow
;
return
coord
[
irow
]
*
f_over_c
[
ichan
]
;
return
RowChan
{
irow
,
ichan
}
;
}
UVW
<
T
>
effectiveCoord
(
size_t
irow
,
size_t
ichan
)
const
{
return
coord
[
irow
]
*
f_over_c
[
ichan
];
}
UVW
<
T
>
effectiveCoord
(
const
RowChan
&
rc
)
const
{
return
coord
[
rc
.
row
]
*
f_over_c
[
rc
.
chan
];
}
UVW
<
T
>
effectiveCoord
(
uint32_t
index
)
const
{
return
effectiveCoord
(
getRowChan
(
index
));
}
size_t
Nrows
()
const
{
return
nrows
;
}
size_t
Nchannels
()
const
{
return
nchan
;
}
...
...
@@ -367,10 +375,8 @@ template<typename T> class Baselines
#pragma omp parallel for num_threads(nthreads)
for
(
size_t
i
=
0
;
i
<
nvis
;
++
i
)
{
auto
t
=
idx
(
i
);
auto
row
=
t
/
nchan
;
auto
chan
=
t
-
row
*
nchan
;
vis
[
i
]
=
ms
(
row
,
chan
);
auto
rc
=
getRowChan
(
idx
(
i
));
vis
[
i
]
=
ms
(
rc
.
row
,
rc
.
chan
);
}
}
...
...
@@ -384,10 +390,8 @@ template<typename T> class Baselines
#pragma omp parallel for num_threads(nthreads)
for
(
size_t
i
=
0
;
i
<
nvis
;
++
i
)
{
auto
t
=
idx
(
i
);
auto
row
=
t
/
nchan
;
auto
chan
=
t
-
row
*
nchan
;
ms
(
row
,
chan
)
+=
vis
(
i
);
auto
rc
=
getRowChan
(
idx
(
i
));
ms
(
rc
.
row
,
rc
.
chan
)
+=
vis
(
i
);
}
}
};
...
...
@@ -724,15 +728,13 @@ template<typename T> void ms2grid_c
#pragma omp for schedule(guided,100)
for
(
size_t
ipart
=
0
;
ipart
<
nvis
;
++
ipart
)
{
auto
tidx
=
idx
(
ipart
);
auto
row
=
tidx
/
nchan
;
auto
chan
=
tidx
-
row
*
nchan
;
UVW
<
T
>
coord
=
baselines
.
effectiveCoord
(
tidx
);
auto
rc
=
baselines
.
getRowChan
(
idx
(
ipart
));
UVW
<
T
>
coord
=
baselines
.
effectiveCoord
(
rc
);
hlp
.
prep
(
coord
.
u
,
coord
.
v
);
auto
*
ptr
=
hlp
.
p0w
;
auto
v
(
ms
(
r
ow
,
chan
)
*
emb
);
auto
v
(
ms
(
r
c
.
row
,
rc
.
chan
)
*
emb
);
if
(
have_wgt
)
v
*=
wgt
(
r
ow
,
chan
);
v
*=
wgt
(
r
c
.
row
,
rc
.
chan
);
for
(
size_t
cu
=
0
;
cu
<
supp
;
++
cu
)
{
complex
<
T
>
tmp
(
v
*
ku
[
cu
]);
...
...
@@ -820,10 +822,8 @@ template<typename T> void grid2ms_c
#pragma omp for schedule(guided,100)
for
(
size_t
ipart
=
0
;
ipart
<
nvis
;
++
ipart
)
{
auto
tidx
=
idx
(
ipart
);
auto
row
=
tidx
/
nchan
;
auto
chan
=
tidx
-
row
*
nchan
;
UVW
<
T
>
coord
=
baselines
.
effectiveCoord
(
tidx
);
auto
rc
=
baselines
.
getRowChan
(
idx
(
ipart
));
UVW
<
T
>
coord
=
baselines
.
effectiveCoord
(
rc
);
hlp
.
prep
(
coord
.
u
,
coord
.
v
);
complex
<
T
>
r
=
0
;
const
auto
*
ptr
=
hlp
.
p0r
;
...
...
@@ -835,8 +835,8 @@ template<typename T> void grid2ms_c
r
+=
tmp
*
ku
[
cu
];
ptr
+=
jump
;
}
if
(
have_wgt
)
r
*=
wgt
(
r
ow
,
chan
);
ms
(
r
ow
,
chan
)
=
r
*
emb
;
if
(
have_wgt
)
r
*=
wgt
(
r
c
.
row
,
rc
.
chan
);
ms
(
r
c
.
row
,
rc
.
chan
)
=
r
*
emb
;
}
}
}
...
...
nifty_gridder.cc
View file @
6db3283a
...
...
@@ -649,7 +649,7 @@ template<typename T> pyarr<uint32_t> getIndices(const PyBaselines<T> &baselines,
for
(
int
ichan
=
chbegin
;
ichan
<
chend
;
++
ichan
)
if
(
!
flags
[
irow
*
nchan
+
ichan
])
{
auto
uvw
=
baselines
.
effectiveCoord
(
irow
,
ichan
);
auto
uvw
=
baselines
.
effectiveCoord
(
RowChan
{
irow
,
size_t
(
ichan
)
})
;
if
((
uvw
.
w
>=
wmin
)
&&
(
uvw
.
w
<
wmax
))
{
T
u
,
v
;
...
...
@@ -673,7 +673,7 @@ template<typename T> pyarr<uint32_t> getIndices(const PyBaselines<T> &baselines,
for
(
int
ichan
=
chbegin
;
ichan
<
chend
;
++
ichan
)
if
(
!
flags
[
irow
*
nchan
+
ichan
])
{
auto
uvw
=
baselines
.
effectiveCoord
(
irow
,
ichan
);
auto
uvw
=
baselines
.
effectiveCoord
(
RowChan
{
irow
,
size_t
(
ichan
)
})
;
if
((
uvw
.
w
>=
wmin
)
&&
(
uvw
.
w
<
wmax
))
iout
[
acc
[
tmp
[
idx
++
]]
++
]
=
irow
*
nchan
+
ichan
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment