polymv Test Example
This example demonstrates the usage and performance of the polymv package on a DELL XPS 8900 with a 6th Generation Intel® Core™ i5-6400 Processor (2.7 GHz up to 3.3 GHz, 6MB Cache).
Setup
Import the necessary libraries:
Explore the polymv Module
Check the available functions and their docstrings:
Output:
Help on module polymv.polymv in polymv:
NAME
polymv.polymv
FUNCTIONS
fvs(input1, input2, LMAX)
Get Fréchet mean vectors in spherical coordinates for a multipole given a map based on lmax.
Parameters:
input1 (float): Multipole vector theta coordinate.
input2 (float): Multipole vector phi coordinate.
LMAX (int): Maximum l value to compute the Fréchet mean.
Returns:
array: An array for all Fréchet mean based on all multipole vectors in spherical coordinates (theta, phi) from l=2 to lmax.
mvs(input1, input2, LMAX)
Get multipole vectors in spherical coordinates for a multipole given a map based on lmax.
Parameters:
input1 (float): Real part of multipole moments from a map (Healpy indexing).
input2 (float): Imaginary part of multipole moments from a map (Healpy indexing).
LMAX (int): Maximum l value to compute the multipole vectors.
Returns:
array: An array for all multipole vectors in spherical coordinates (theta, phi in radians) from l=2 to lmax.
DATA
__test__ = {}
FILE
/home/renan/polymv-project/polymv/polymv/polymv.cpython-312-x86_64-linux-gnu.so
Set Maximum Multipole
Generate Random Multipole Data
%%time
np.random.seed(1)
alm = hp.synalm(np.ones(2000), lmax=lmax)
alm = np.column_stack([alm.real, alm.imag])
alm.shape
Output:
Compute Multipole Vectors
Output:
CPU times: user 5min 50s, sys: 3.91 s, total: 5min 53s
Wall time: 1min 37s
<class 'tuple'> [(1000998,), (1000998,)]
Show a sample of the multipole vectors:
Output:
theta: [1.44757865 1.13235582 1.694014 1.07304038 0.03596525]
phi: [-0.23422314 1.99653803 2.90736952 -0.67228949 0.58064643]
Compute Fréchet Mean Vectors
Output:
CPU times: user 2min 46s, sys: 296 ms, total: 2min 47s
Wall time: 1min 10s
<class 'tuple'> [(999,), (999,)]
Show a sample of the Fréchet mean vectors:
Output: