Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MPIfR-BDG
psrdada_cpp
Commits
6118c967
Commit
6118c967
authored
Oct 09, 2020
by
Tobias Winchen
Browse files
Removed unnecessary variables
parent
5746500b
Changes
2
Hide whitespace changes
Inline
Side-by-side
psrdada_cpp/effelsberg/edd/SKRfiReplacementCuda.cuh
View file @
6118c967
...
...
@@ -43,14 +43,9 @@ public:
private:
thrust
::
device_vector
<
int
>
_rfi_status
;
std
::
size_t
_window_size
;
std
::
size_t
_nwindows
,
_nrfi_windows
,
_nclean_windows
;
std
::
size_t
_nclean_windows_stat
;
//number of clean windows used for computing DataStatistics
thrust
::
device_vector
<
int
>
_rfi_window_indices
;
thrust
::
device_vector
<
int
>
_clean_window_indices
;
thrust
::
device_vector
<
thrust
::
complex
<
float
>>
_clean_data
;
float
_ref_mean
,
_ref_sd
;
};
}
//edd
}
//effelsberg
...
...
psrdada_cpp/effelsberg/edd/src/SKRfiReplacementCuda.cu
View file @
6118c967
...
...
@@ -31,12 +31,12 @@ struct generate_replacement_data{
SKRfiReplacementCuda
::
SKRfiReplacementCuda
()
{
BOOST_LOG_TRIVIAL
(
info
)
<<
"Creating new SKRfiReplacementCuda instance..
\n
"
;
BOOST_LOG_TRIVIAL
(
debug
)
<<
"Creating new SKRfiReplacementCuda instance..
\n
"
;
}
SKRfiReplacementCuda
::~
SKRfiReplacementCuda
()
{
BOOST_LOG_TRIVIAL
(
info
)
<<
"Destroying SKRfiReplacementCuda instance..
\n
"
;
BOOST_LOG_TRIVIAL
(
debug
)
<<
"Destroying SKRfiReplacementCuda instance..
\n
"
;
}
...
...
@@ -45,40 +45,37 @@ void SKRfiReplacementCuda::replace_rfi_data(const thrust::device_vector<int> &rf
std
::
size_t
clean_windows
)
{
nvtxRangePushA
(
"replace_rfi_data"
);
_rfi_status
=
rfi_status
;
thrust
::
device_vector
<
thrust
::
complex
<
float
>>
replacement_data
;
//initialize data members of the class
_nclean_windows_stat
=
clean_windows
;
//no. of clean windows used for computing statistics
BOOST_LOG_TRIVIAL
(
info
)
<<
"initializing the states of SKRfiReplacementCuda"
<<
" class members for the data to be processed..
\n
"
;
_nwindows
=
_rfi_status
.
size
();
//get_rfi_window_indices();
BOOST_LOG_TRIVIAL
(
debug
)
<<
"getting RFI window indices..
\n
"
;
_
n
rfi_window
s
=
thrust
::
count
(
_
rfi_status
.
begin
(),
_
rfi_status
.
end
(),
1
);
_rfi_window_indices
.
resize
(
_nrfi_windows
);
_rfi_window
_indices
.
resize
(
thrust
::
count
(
rfi_status
.
begin
(),
rfi_status
.
end
(),
1
)
)
;
thrust
::
copy_if
(
thrust
::
make_counting_iterator
<
int
>
(
0
),
thrust
::
make_counting_iterator
<
int
>
(
_nwindows
),
_
rfi_status
.
begin
(),
thrust
::
make_counting_iterator
<
int
>
(
rfi_status
.
size
()
),
rfi_status
.
begin
(),
_rfi_window_indices
.
begin
(),
thrust
::
placeholders
::
_1
==
1
);
//get_clean_window_indices();
BOOST_LOG_TRIVIAL
(
debug
)
<<
"getting clean window indices..
\n
"
;
_nclean_windows
=
thrust
::
count
(
_
rfi_status
.
begin
(),
_
rfi_status
.
end
(),
0
);
size_t
_nclean_windows
=
thrust
::
count
(
rfi_status
.
begin
(),
rfi_status
.
end
(),
0
);
_clean_window_indices
.
resize
(
_nclean_windows
);
thrust
::
copy_if
(
thrust
::
make_counting_iterator
<
int
>
(
0
),
thrust
::
make_counting_iterator
<
int
>
(
_nwindows
),
_
rfi_status
.
begin
(),
thrust
::
make_counting_iterator
<
int
>
(
rfi_status
.
size
()
),
rfi_status
.
begin
(),
_clean_window_indices
.
begin
(),
thrust
::
placeholders
::
_1
==
0
);
if
(
_nclean_windows
<
_nwindows
){
//if RFI is present
//Getting clean data statistics of chosen number of clean windows
if
(
_nclean_windows
<
_nclean_windows_stat
)
_nclean_windows_stat
=
_nclean_windows
;
if
(
_nclean_windows
<
rfi_status
.
size
()){
//RFI present and not in all windows
if
(
_nclean_windows
<
clean_windows
)
{
clean_windows
=
_nclean_windows
;
}
BOOST_LOG_TRIVIAL
(
debug
)
<<
"collecting clean data from chosen number of clean windows..
\n
"
;
_window_size
=
data
.
size
()
/
_nwindows
;
_clean_data
.
resize
(
_n
clean_windows
_stat
*
_window_size
);
for
(
std
::
size_t
ii
=
0
;
ii
<
_n
clean_windows
_stat
;
ii
++
){
std
::
size_t
_window_size
=
data
.
size
()
/
rfi_status
.
size
()
;
_clean_data
.
resize
(
clean_windows
*
_window_size
);
for
(
std
::
size_t
ii
=
0
;
ii
<
clean_windows
;
ii
++
){
std
::
size_t
window_index
=
_clean_window_indices
[
ii
];
std
::
size_t
ibegin
=
window_index
*
_window_size
;
std
::
size_t
iend
=
ibegin
+
_window_size
-
1
;
...
...
@@ -87,24 +84,20 @@ void SKRfiReplacementCuda::replace_rfi_data(const thrust::device_vector<int> &rf
BOOST_LOG_TRIVIAL
(
debug
)
<<
"clean_win_index = "
<<
window_index
<<
" ibegin = "
<<
ibegin
<<
" iend = "
<<
iend
;
}
//computing clean data statistics
BOOST_LOG_TRIVIAL
(
debug
)
<<
"computing statistics of clean data..
\n
"
;
//The distribution of both real and imag
h
ave same mean and standard deviation.
//The distribution of both real and imag a
re expected to ah
ve
same mean and standard deviation.
//Therefore computing _ref_mean, _ref_sd for real distribution only.
std
::
size_t
length
=
_clean_data
.
size
();
_ref_mean
=
(
thrust
::
reduce
(
_clean_data
.
begin
(),
_clean_data
.
end
(),
thrust
::
complex
<
float
>
(
0.0
f
,
0.0
f
))).
real
()
/
length
;
_ref_sd
=
std
::
sqrt
(
thrust
::
transform_reduce
(
_clean_data
.
begin
(),
_clean_data
.
end
(),
mean_subtraction_square
(
_ref_mean
),
float
_ref_mean
=
(
thrust
::
reduce
(
_clean_data
.
begin
(),
_clean_data
.
end
(),
thrust
::
complex
<
float
>
(
0.0
f
,
0.0
f
))).
real
()
/
length
;
float
_ref_sd
=
std
::
sqrt
(
thrust
::
transform_reduce
(
_clean_data
.
begin
(),
_clean_data
.
end
(),
mean_subtraction_square
(
_ref_mean
),
0.0
f
,
thrust
::
plus
<
float
>
())
/
length
);
BOOST_LOG_TRIVIAL
(
debug
)
<<
"DataStatistics mean = "
<<
_ref_mean
<<
" sd = "
<<
_ref_sd
;
}
//RFI present and not in all windows
if
(
_nclean_windows
<
_nwindows
){
//Replacing RFI
thrust
::
counting_iterator
<
unsigned
int
>
sequence_index_begin
(
0
);
nvtxRangePushA
(
"replace_rfi_datai_loop"
);
for
(
std
::
size_t
ii
=
0
;
ii
<
_
n
rfi_window
s
;
ii
++
){
for
(
std
::
size_t
ii
=
0
;
ii
<
_rfi_window
_indices
.
size
()
;
ii
++
){
std
::
size_t
index
=
_rfi_window_indices
[
ii
]
*
_window_size
;
thrust
::
transform
(
sequence_index_begin
,
(
sequence_index_begin
+
_window_size
),
(
data
.
begin
()
+
index
),
generate_replacement_data
(
_ref_mean
,
_ref_sd
));
...
...
Write
Preview
Supports
Markdown
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