<jupyter_start><jupyter_text>Getting startedThe main interface to PySM is the `pysm3.Sky` class, the simplest way is to specify the required resolution as $N_{side}$ *HEALPix* parameter and the requested models as a list of strings, for example the simplest models for galactic dust and synchrotron `["d1", "s1"]`<jupyter_code>import pysm3
import pysm3.units as u
import healpy as hp
import numpy as np
import warnings
warnings.filterwarnings("ignore")
sky = pysm3.Sky(nside=128, preset_strings=["d1", "s1"])<jupyter_output><empty_output><jupyter_text>PySM initializes the requested component objects (generally load the input templates maps with `astropy.utils.data` and cache them locally in `~/.astropy`) and stores them in the `components` attribute (a list):<jupyter_code>sky.components<jupyter_output><empty_output><jupyter_text>PySM 3 uses `astropy.units`: http://docs.astropy.org/en/stable/units/ each input needs to have a unit attached to it, the unit just needs to be compatible, e.g. you can use either `u.GHz` or `u.MHz`.<jupyter_code>map_100GHz = sky.get_emission(100 * u.GHz)<jupyter_output><empty_output><jupyter_text>The output of the `get_emission` method is a 2D `numpy` array in the usual `healpy` convention, `[I,Q,U]`, by default in $\mu K_{RJ}$:<jupyter_code>map_100GHz[0, :3]<jupyter_output><empty_output><jupyter_text>Optionally convert to another unit using `astropy.units`<jupyter_code>map_100GHz = map_100GHz.to(u.uK_CMB, equivalencies=u.cmb_equivalencies(100*u.GHz))
import matplotlib.pyplot as plt
%matplotlib inline
hp.mollview(map_100GHz[0], min=0, max=1e2, title="I map", unit=map_100GHz.unit)
hp.mollview(np.sqrt(map_100GHz[1]**2 + map_100GHz[2]**2), title="P map", min=0, max=1e1, unit=map_100GHz.unit)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11997736276174306, 'fraction_numerical': 0.03338992642897567, 'mean_word_length': 7.261682242990654, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '492122', 'license': 'MIT', 'n_tokens_mistral': 686, 'n_tokens_neox': 630, 'n_words': 172, 'path': 'docs/basic_use.ipynb', 'repo_name': 'giuspugl/pysm', 'size': '1767'}