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
29615cf1
Commit
29615cf1
authored
18 years ago
by
Ger van Diepen
Browse files
Options
Downloads
Patches
Plain Diff
Bugid: 711
Had not been added
parent
69440b17
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/BB/BBS/test/tDFT.cc
+134
-0
134 additions, 0 deletions
CEP/BB/BBS/test/tDFT.cc
CEP/BB/BBSKernel/test/tDFT.cc
+134
-0
134 additions, 0 deletions
CEP/BB/BBSKernel/test/tDFT.cc
with
268 additions
and
0 deletions
CEP/BB/BBS/test/tDFT.cc
0 → 100644
+
134
−
0
View file @
29615cf1
//# tDFT.cc: Test program for performance of DFT imaging
//#
//# Copyright (C) 2006
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# This program is free software; you can redistribute it and/or modify
//# it under the terms of the GNU General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or
//# (at your option) any later version.
//#
//# This program is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details.
//#
//# You should have received a copy of the GNU General Public License
//# along with this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#include
<lofar_config.h>
#include
<Common/LofarLogger.h>
#include
<Common/Timer.h>
#include
<casa/BasicSL/Constants.h>
#include
<vector>
#include
<cmath>
#include
<stdexcept>
using
namespace
LOFAR
;
using
namespace
std
;
using
namespace
casa
;
// Do for each visibility the DFT to each l.m point.
// vis * exp(2*pi*(ul+vm+wn))
// The same DFT trick as in BBS can be used:
// - split baseline in stations
// - extend over frequency using scale factor
typedef
float
RType
;
// data type used for calculations
typedef
fcomplex
CType
;
// data type of the data.
const
int
ncorr
=
4
;
const
int
nstat
=
14
;
const
int
ntime
=
1440
;
const
int
nfreq
=
64
;
const
int
nmap
=
20
;
void
doDFT
()
{
RType
totc
=
0
;
RType
tots
=
0
;
int
nbl
=
nstat
*
(
nstat
-
1
)
/
2
;
RType
lval
=
0.01
;
for
(
int
il
=
0
;
il
<
nmap
;
++
il
,
lval
+=
0.001
)
{
RType
mval
=
0.02
;
for
(
int
im
=
0
;
im
<
nmap
;
++
im
,
mval
+=
0.001
)
{
RType
nval
=
sqrt
(
1
-
lval
*
lval
-
mval
*
mval
);
RType
uval
=
1
;
RType
vval
=
2
;
RType
wval
=
0.1
;
for
(
int
it
=
0
;
it
<
ntime
;
++
it
)
{
for
(
int
ib
=
0
;
ib
<
nbl
;
++
ib
)
{
RType
val
=
6.28
*
(
lval
*
uval
+
mval
*
vval
+
nval
*
wval
);
RType
sinv
=
sin
(
val
);
RType
cosv
=
sinv
;
// take care that compiler uses sincos
tots
+=
sinv
;
totc
+=
cosv
;
uval
+=
0.1
;
vval
+=
0.2
;
wval
+=
0.01
;
}
}
}
}
cout
<<
tots
<<
' '
<<
totc
<<
endl
;
}
void
doDFT2
()
{
RType
totc
=
0
;
RType
tots
=
0
;
int
nbl
=
nstat
*
(
nstat
-
1
)
/
2
;
RType
uval
=
1
;
RType
vval
=
2
;
RType
wval
=
0.1
;
for
(
int
it
=
0
;
it
<
ntime
;
++
it
)
{
for
(
int
ib
=
0
;
ib
<
nbl
;
++
ib
)
{
RType
lval
=
0.01
;
RType
ulval
=
uval
*
lval
;
RType
dulval
=
uval
*
0.001
;
RType
dvmval
=
vval
*
0.001
;
for
(
int
il
=
0
;
il
<
nmap
;
++
il
,
lval
+=
0.001
,
ulval
+=
dulval
)
{
RType
mval
=
0.02
;
RType
ulvmval
=
ulval
+
vval
*
mval
;
for
(
int
im
=
0
;
im
<
nmap
;
++
im
,
mval
+=
0.001
,
ulvmval
+=
dvmval
)
{
RType
nval
=
sqrt
(
1
-
lval
*
lval
-
mval
*
mval
);
RType
val
=
6.28
*
(
ulvmval
+
nval
*
wval
);
RType
sinv
=
sin
(
val
);
RType
cosv
=
sinv
;
// take care that compiler uses sincos
tots
+=
sinv
;
totc
+=
cosv
;
}
}
uval
+=
0.1
;
vval
+=
0.2
;
wval
+=
0.01
;
}
}
cout
<<
tots
<<
' '
<<
totc
<<
endl
;
}
int
main
(
int
argc
)
{
INIT_LOGGER
(
"tDFT"
);
try
{
{
if
(
argc
>
1
)
{
doDFT2
();
}
else
{
doDFT
();
}
}
}
catch
(
std
::
exception
&
x
)
{
cout
<<
"Unexpected exception: "
<<
x
.
what
()
<<
endl
;
return
1
;
}
cout
<<
"OK"
<<
endl
;
return
0
;
}
This diff is collapsed.
Click to expand it.
CEP/BB/BBSKernel/test/tDFT.cc
0 → 100644
+
134
−
0
View file @
29615cf1
//# tDFT.cc: Test program for performance of DFT imaging
//#
//# Copyright (C) 2006
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# This program is free software; you can redistribute it and/or modify
//# it under the terms of the GNU General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or
//# (at your option) any later version.
//#
//# This program is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details.
//#
//# You should have received a copy of the GNU General Public License
//# along with this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#include
<lofar_config.h>
#include
<Common/LofarLogger.h>
#include
<Common/Timer.h>
#include
<casa/BasicSL/Constants.h>
#include
<vector>
#include
<cmath>
#include
<stdexcept>
using
namespace
LOFAR
;
using
namespace
std
;
using
namespace
casa
;
// Do for each visibility the DFT to each l.m point.
// vis * exp(2*pi*(ul+vm+wn))
// The same DFT trick as in BBS can be used:
// - split baseline in stations
// - extend over frequency using scale factor
typedef
float
RType
;
// data type used for calculations
typedef
fcomplex
CType
;
// data type of the data.
const
int
ncorr
=
4
;
const
int
nstat
=
14
;
const
int
ntime
=
1440
;
const
int
nfreq
=
64
;
const
int
nmap
=
20
;
void
doDFT
()
{
RType
totc
=
0
;
RType
tots
=
0
;
int
nbl
=
nstat
*
(
nstat
-
1
)
/
2
;
RType
lval
=
0.01
;
for
(
int
il
=
0
;
il
<
nmap
;
++
il
,
lval
+=
0.001
)
{
RType
mval
=
0.02
;
for
(
int
im
=
0
;
im
<
nmap
;
++
im
,
mval
+=
0.001
)
{
RType
nval
=
sqrt
(
1
-
lval
*
lval
-
mval
*
mval
);
RType
uval
=
1
;
RType
vval
=
2
;
RType
wval
=
0.1
;
for
(
int
it
=
0
;
it
<
ntime
;
++
it
)
{
for
(
int
ib
=
0
;
ib
<
nbl
;
++
ib
)
{
RType
val
=
6.28
*
(
lval
*
uval
+
mval
*
vval
+
nval
*
wval
);
RType
sinv
=
sin
(
val
);
RType
cosv
=
sinv
;
// take care that compiler uses sincos
tots
+=
sinv
;
totc
+=
cosv
;
uval
+=
0.1
;
vval
+=
0.2
;
wval
+=
0.01
;
}
}
}
}
cout
<<
tots
<<
' '
<<
totc
<<
endl
;
}
void
doDFT2
()
{
RType
totc
=
0
;
RType
tots
=
0
;
int
nbl
=
nstat
*
(
nstat
-
1
)
/
2
;
RType
uval
=
1
;
RType
vval
=
2
;
RType
wval
=
0.1
;
for
(
int
it
=
0
;
it
<
ntime
;
++
it
)
{
for
(
int
ib
=
0
;
ib
<
nbl
;
++
ib
)
{
RType
lval
=
0.01
;
RType
ulval
=
uval
*
lval
;
RType
dulval
=
uval
*
0.001
;
RType
dvmval
=
vval
*
0.001
;
for
(
int
il
=
0
;
il
<
nmap
;
++
il
,
lval
+=
0.001
,
ulval
+=
dulval
)
{
RType
mval
=
0.02
;
RType
ulvmval
=
ulval
+
vval
*
mval
;
for
(
int
im
=
0
;
im
<
nmap
;
++
im
,
mval
+=
0.001
,
ulvmval
+=
dvmval
)
{
RType
nval
=
sqrt
(
1
-
lval
*
lval
-
mval
*
mval
);
RType
val
=
6.28
*
(
ulvmval
+
nval
*
wval
);
RType
sinv
=
sin
(
val
);
RType
cosv
=
sinv
;
// take care that compiler uses sincos
tots
+=
sinv
;
totc
+=
cosv
;
}
}
uval
+=
0.1
;
vval
+=
0.2
;
wval
+=
0.01
;
}
}
cout
<<
tots
<<
' '
<<
totc
<<
endl
;
}
int
main
(
int
argc
)
{
INIT_LOGGER
(
"tDFT"
);
try
{
{
if
(
argc
>
1
)
{
doDFT2
();
}
else
{
doDFT
();
}
}
}
catch
(
std
::
exception
&
x
)
{
cout
<<
"Unexpected exception: "
<<
x
.
what
()
<<
endl
;
return
1
;
}
cout
<<
"OK"
<<
endl
;
return
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