Pipelines

Before delving into the structure of the toast package, it is sometimes useful to look at (and use!) an example. One such program is the simple script below which simulates a fake satellite scanning strategy with a focalplane of detectors and then makes a map.

Simple Satellite Simulation

The current version of this tool simulates parameterized boresight pointing and then uses the given focalplane (loaded from a pickle file) to compute the detector pointing. Noise properties of each detector are used to simulate noise timestreams.

In order to create a focalplane file, you can do for example:

import pickle
import numpy as np

fake = {}
fake['quat'] = np.array([0.0, 0.0, 1.0, 0.0])
fake['fwhm'] = 30.0
fake['fknee'] = 0.05
fake['alpha'] = 1.0
fake['NET'] = 0.000060
fake['color'] = 'r'
fp = {}
fp['bore'] = fake

with open('fp_lb.pkl', 'wb') as p:
    pickle.dump(fp, p)

Note that until the older TOAST mapmaking tools are ported, this script requires the use of libmadam (the –madam option).

usage: toast_satellite_sim.py [-h] [--samplerate SAMPLERATE]
                              [--spinperiod SPINPERIOD]
                              [--spinangle SPINANGLE]
                              [--precperiod PRECPERIOD]
                              [--precangle PRECANGLE] [--hwprpm HWPRPM]
                              [--hwpstep HWPSTEP] [--hwpsteptime HWPSTEPTIME]
                              [--obs OBS] [--gap GAP] [--numobs NUMOBS]
                              [--obschunks OBSCHUNKS] [--outdir OUTDIR]
                              [--debug] [--nside NSIDE] [--baseline BASELINE]
                              [--noisefilter] [--madam] [--fp FP]

Simulate satellite boresight pointing and make a noise map.

optional arguments:
  -h, --help            show this help message and exit
  --samplerate SAMPLERATE
                        Detector sample rate (Hz)
  --spinperiod SPINPERIOD
                        The period (in minutes) of the rotation about the spin
                        axis
  --spinangle SPINANGLE
                        The opening angle (in degrees) of the boresight from
                        the spin axis
  --precperiod PRECPERIOD
                        The period (in minutes) of the rotation about the
                        precession axis
  --precangle PRECANGLE
                        The opening angle (in degrees) of the spin axis from
                        the precession axis
  --hwprpm HWPRPM       The rate (in RPM) of the HWP rotation
  --hwpstep HWPSTEP     For stepped HWP, the angle in degrees of each step
  --hwpsteptime HWPSTEPTIME
                        For stepped HWP, the the time in seconds between steps
  --obs OBS             Number of hours in one science observation
  --gap GAP             Cooler cycle time in hours between science obs
  --numobs NUMOBS       Number of complete observations
  --obschunks OBSCHUNKS
                        Number of chunks to subdivide each observation into
                        for data distribution
  --outdir OUTDIR       Output directory
  --debug               Write diagnostics
  --nside NSIDE         Healpix NSIDE
  --baseline BASELINE   Destriping baseline length (seconds)
  --noisefilter         Destripe with the noise filter enabled
  --madam               If specified, use libmadam for map-making
  --fp FP               Pickle file containing a dictionary of detector
                        properties. The keys of this dict are the detector
                        names, and each value is also a dictionary with keys
                        "quat" (4 element ndarray), "fwhm" (float, arcmin),
                        "fknee" (float, Hz), "alpha" (float), and "NET"
                        (float). For optional plotting, the key "color" can
                        specify a valid matplotlib color string.

Example: Proposed CoRE Satellite Boresight

Here is one example using this script to generate one day of scanning with a single boresight detector, and using one proposed scan strategy for a LiteCoRE satellite:

toast_satellite_sim.py --samplerate 175.86 --spinperiod 1.0 --spinangle 45.0
--precperiod 5760.0 --precangle 50.0 --hwprpm 0.0 --obs 23.0 --gap 1.0
--obschunks 24 --numobs 1 --nside 1024 --baseline 5.0 --madam --noisefilter
--fp fp_core.pkl --outdir out_core_nohwp_fast

Example: Proposed LiteBIRD Satellite Boresight

Here is how you could do a similar thing with a boresight detector and one proposed lightbird scanning strategy for a day:

toast_satellite_sim.py --samplerate 23.0 --spinperiod 10.0 --spinangle 30.0
--precperiod 93.0 --precangle 65.0 --hwprpm 88.0 --obs 23.0 --gap 1.0
--obschunks 24 --numobs 1 --nside 1024 --baseline 60.0 --madam --fp fp_lb.pkl
--debug --outdir out_lb_hwp

Creating Your Own Pipeline

TOAST is designed to give you tools to piece together your own data processing workflow. Here is a slightly modified version of the pipeline script above. This takes a boresight detector with 1/f noise properties, simulates a sort-of Planck scanning strategy, generates a noise timestream, and then generates a fake signal timestream and adds it to the noise. Then it uses madam to make a map.