Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Jean-Eric Campagne
LagSHT
Commits
29ff5be3
Commit
29ff5be3
authored
Apr 20, 2015
by
Jean-Eric Campagne
Browse files
(JEC) 20/4/15 add pixelization aids
parent
76dafa3c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
20 deletions
+41
-20
lagSphericTransform.cc
lagSphericTransform.cc
+11
-12
lagSphericTransform.h
lagSphericTransform.h
+21
-4
laguerreTransform.cc
laguerreTransform.cc
+1
-2
laguerreTransform.h
laguerreTransform.h
+8
-2
No files found.
lagSphericTransform.cc
View file @
29ff5be3
...
...
@@ -67,9 +67,9 @@ void BaseLagSphTransform::SetThetaPhiMap(string choice, int nrings, int nphi){
Nalm_
=
get_nalms
(
sharpjob_
.
get_alm_info
());
//fill the ANN-kdTree to prepare the filling of the 2D spheres
geom_t
vecPix
;
vecPix
=
G
etPixelPositions
();
ann
.
SetkdTree
(
vecPix
);
//
geom_t vecPix;
S
etPixelPositions
();
ann
.
SetkdTree
(
vecPix
_
);
geomDone_
=
true
;
...
...
@@ -82,8 +82,7 @@ void BaseLagSphTransform::SetThetaPhiMap(string choice, int nrings, int nphi){
}
//SetThetaPhiMap
geom_t
BaseLagSphTransform
::
GetPixelPositions
()
{
geom_t
pixels
;
void
BaseLagSphTransform
::
SetPixelPositions
()
{
sharp_geom_info
*
ginfo
;
ginfo
=
sharpjob_
.
get_geom_info
();
for
(
int
i
=
0
;
i
<
ginfo
->
npairs
;
++
i
)
{
...
...
@@ -93,8 +92,8 @@ geom_t BaseLagSphTransform::GetPixelPositions() {
double
phi0
=
ginfo
->
pair
[
i
].
r1
.
phi0
;
for
(
int
j
=
0
;
j
<
nph1
;
j
++
)
{
double
phi1
=
phi0
+
j
*
(
2.0
*
M_PI
/
nph1
);
// cout << "
pixel
s ( "<< theta1 << ", " << phi1 << ")" << endl;
pixels
.
push_back
(
make_pair
(
theta1
,
phi1
));
// cout << "
vecPix_
s ( "<< theta1 << ", " << phi1 << ")" << endl;
vecPix_
.
push_back
(
make_pair
(
theta1
,
phi1
));
}
if
(
ginfo
->
pair
[
i
].
r2
.
nph
>
0
)
{
// the second ring in this pair exists
double
theta2
=
ginfo
->
pair
[
i
].
r2
.
theta
;
...
...
@@ -102,16 +101,16 @@ geom_t BaseLagSphTransform::GetPixelPositions() {
double
phi0
=
ginfo
->
pair
[
i
].
r2
.
phi0
;
for
(
int
j
=
0
;
j
<
nph2
;
j
++
)
{
double
phi2
=
phi0
+
j
*
(
2.0
*
M_PI
/
nph2
);
// cout << "
pixel
s ( "<< theta2 << ", " << phi2 << ")" << endl;
pixels
.
push_back
(
make_pair
(
theta2
,
phi2
));
// cout << "
vecPix_
s ( "<< theta2 << ", " << phi2 << ")" << endl;
vecPix_
.
push_back
(
make_pair
(
theta2
,
phi2
));
}
}
}
sort
(
pixels
.
begin
(),
pixels
.
end
());
sort
(
vecPix_
.
begin
(),
vecPix_
.
end
());
return
pixels
;
}
//GetPixelPositions
}
//SetPixelPositions
...
...
lagSphericTransform.h
View file @
29ff5be3
...
...
@@ -35,6 +35,8 @@ namespace LagSHT {
ANNServer
()
:
nNear_
(
1
),
dim_
(
2
),
eps_
(
0
),
npts_
(
0
),
dataPts_
(
NULL
),
kdTree_
(
NULL
),
nnIdx_
(
NULL
),
dists_
(
NULL
)
{
nnIdx_
=
new
ANNidx
[
nNear_
];
// allocate near neigh indices
dists_
=
new
ANNdist
[
nNear_
];
// allocate near neighbor dists
}
//! Constructor
...
...
@@ -78,9 +80,9 @@ namespace LagSHT {
queryPt
[
0
]
=
theta
;
queryPt
[
1
]
=
phi
;
if
(
kdTree_
==
NULL
)
throw
LagSHTError
(
"Get Failure kdTree alloc"
);
if
(
nnIdx_
==
NULL
)
throw
LagSHTError
(
"Get Failure nnIdx alloc"
);
if
(
dists_
==
NULL
)
throw
LagSHTError
(
"Get Failure dists alloc"
);
if
(
kdTree_
==
NULL
)
throw
LagSHTError
(
"Get Failure kdTree alloc"
);
if
(
nnIdx_
==
NULL
)
throw
LagSHTError
(
"Get Failure nnIdx alloc"
);
if
(
dists_
==
NULL
)
throw
LagSHTError
(
"Get Failure dists alloc"
);
kdTree_
->
annkSearch
(
queryPt
,
nNear_
,
nnIdx_
,
dists_
,
eps_
);
annDeallocPt
(
queryPt
);
...
...
@@ -128,8 +130,10 @@ class BaseLagSphTransform {
//! Total number of Alm coefficients
int
Nalm
()
{
return
Nalm_
;
}
//! Sorted List of pixel center (theta, phi) positions
geom_t
GetPixelPositions
();
geom_t
GetPixelPositions
()
{
return
vecPix_
;
}
/*! Choose the 2D map representation & initialization of libsharp
\input ECP/Fejer1, Gauss, and Healpix
...
...
@@ -143,10 +147,20 @@ class BaseLagSphTransform {
\input phi in [0, 2pi]
*/
int
PixIndexSph
(
r_8
theta
,
r_8
phi
){
return
ann
.
GetClosestId
(
theta
,
phi
);
}
/*! Get Theta Phi position of a given pixel index
\input k in [0, Npix-1] no boundchckeing done
*/
void
PixThetaPhi
(
int
k
,
r_8
&
theta
,
r_8
&
phi
)
{
pixpos_t
pix
=
vecPix_
[
k
];
theta
=
pix
.
first
;
phi
=
pix
.
second
;
}
protected:
void
SetPixelPositions
();
//from sharp test suite
static
ptrdiff_t
get_npix
(
const
sharp_geom_info
*
ginfo
)
{
ptrdiff_t
res
=
0
;
...
...
@@ -175,6 +189,9 @@ protected:
int
Nphi_
;
//!< Number of phi values (pixels) per colatitude rings
int
Npix_
;
//!< Total number of 2D pixels
int
Nalm_
;
//!< Total number of Alm coefficients
geom_t
vecPix_
;
//!< vector of pixel positions
bool
geomDone_
;
//!< Set to true once the geometry is properly set (See SetThetaPhiMap(string) )
sharp_cxxjob
<
r_8
>
sharpjob_
;
//!< libsharp job // voir si r_8 -> r_16 extend the validity of the computation
...
...
laguerreTransform.cc
View file @
29ff5be3
...
...
@@ -73,10 +73,9 @@ LaguerreTransform::LaguerreTransform(int N, r_8 R, int alpha) :
}
//Ctor
int
LaguerreTransform
::
R
ad
Index
(
r_8
r
)
const
{
int
LaguerreTransform
::
R
2
Index
(
r_8
r
)
const
{
using
namespace
std
;
r_8
rscaled
=
r
*
nodes_
[
N_
-
1
]
/
R_
;
vector
<
r_8
>
dist
(
N_
);
transform
(
nodes_
.
begin
(),
nodes_
.
end
(),
dist
.
begin
(),
distance
(
rscaled
));
return
min_element
(
dist
.
begin
(),
dist
.
end
())
-
dist
.
begin
();
...
...
laguerreTransform.h
View file @
29ff5be3
...
...
@@ -42,8 +42,14 @@ class LaguerreTransform : public BaseLaguerreTransform {
vector
<
r_8
>
GetWeights
()
const
{
return
weights_
;
}
//! Find the closest nodes
int
RadIndex
(
r_8
r
)
const
;
//! Find the closest nodes: no boundchecking
int
R2Index
(
r_8
r
)
const
;
//! return the nodes position: no boundchecking
r_8
Index2R
(
int
k
)
const
{
return
nodes_
[
k
];
}
//! Multi Analysis at once (Values -> Coefficients)
...
...
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