galsci / pysm

PySM 3: Sky emission simulations for Cosmic Microwave Background experiments
https://pysm3.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
36 stars 23 forks source link

Bandpass integration and MPI debugging #24

Closed zonca closed 5 years ago

zonca commented 5 years ago

@bthorne93 I've implemented bandpass integration at numba level, so now we are looping and accumulating into 1 single map instead of creating first 1 map per frequency and then integrate.

then I've debugged and tested all the standard models with MPI.

I haven't implemented Instrument yet, I think it is nice to have a standalone smoothing without the need of defining an instrument.

In order to group-up the metadata relative to MPI, I've created a new MapDistribution object, good news is that user not using MPI don't need to use it at all. Here an example of the current API with MPI:


import numpy as np
import pysm
import pysm.units as u

from mpi4py import MPI

nside = 32

map_dist = pysm.MapDistribution(
    pixel_indices=None, nside=nside, mpi_comm=MPI.COMM_WORLD
)

sky = pysm.Sky(nside=nside, preset_strings=["d1", "s1", "f1", "a1"], map_dist=map_dist)

m = sky.get_emission(
    freq=np.arange(50, 55) * u.GHz, weights=np.array([0.1, 0.3, 0.5, 0.3, 0.1])
)[0]

print(map_dist.mpi_comm.rank, m.shape, m.min(), m.max())

m_smoothed = pysm.apply_smoothing_and_coord_transform(
    m, fwhm=1 * u.deg, map_dist=map_dist
)

print(map_dist.mpi_comm.rank, m_smoothed.shape, m_smoothed.min(), m_smoothed.max())

Please let me know if you have any suggestions on the interface!