get_solid_angle - Compute basic beam parameters

This script lives in analysis.beam_ana. Its purpose is to analyze planet maps and produce some basic beam statistics, such as FWHM and solid angle. This code should give fairly high fidelity results, suitable for precision calibration work but somewhat less sophisticated than a full beam analysis.

Analyzing a set of maps

An example configuration file can be found below. To use it as is, create an ascii file called map_list.txt with the path to each map you want to analyze. If the band code (e.g. f150) and TOD name are not obvious from the filename, then you might need to use a 2-column format that gives the basename and frequency separately. See detailed configuration options below.

To run the script:

moby2 get_solid_angle get_solid_angle.in

This produces a few plots for each beam map, and an output file table.fits with the analysis results for each map. The FITS file can be loaded through StructDB and reduced further, e.g. to get an average solid angle and associated error estimate.

Some basic summarization can be triggered through the output.summaries configuration settings; see below.

Configuration options

For a starting point, see this example: get_solid_angle.in.

The main groups in the configuration file are:

  • moby_options

  • source_maps

  • analysis

  • output

The configuration file is parsed by the solid_angle driver() method.

source_maps block

'source': <map_list_args>

This is a tuple that is used as the params for get_map_list(). An example is ('file', 'map_list.txt').

'basename_extractor': <extractor>

Specify the extractor to use for creating a map name from the map filenames. If you’re globbing for files, and the path/filename contain both the map basename and the frequency, then use 'standard_freq'. If you’re working with combined files where the path/filename doesn’t contain a TOD name, you might just want to use ‘filename’.

analysis block

'mask_radii_arcmin': <tuple>

This is a tuple of 3 radii, in arcminutes, which are used to rough out the data. The first number is the radius within which the rough solid angle is computed, after subtracting the baseline estimate from data between the first and second radius. The third radius number is used to limit the data considered in all subsequent analyses and plotting.

'wing_fit_radii_arcmin': <2-tuple>

The 1/theta^3 wing is fit to all data between the two radii specified here. This is one you might want to specify by frequency range, e.g.: {'f090': (2.0, 4.0), 'f150': (1.5, 3.0), 'f220': (3., 5.)}.

'wing_fit_ellipticity': <boolean>

When the wing is fit, you can do it with all the data points and a model that includes ellipticity, or you can bin up the points and disregard ellipticity. For low signal-to-noise situations you probably want to set this to False.

'force_frequency': <freq_string>

In the case that the frequency code (e.g. f090) cannot be determined from the filename, you can set it here.

'recenter': <boolean>

If True, map coords are adjusted to remove the beam centroid. Defaults to True.

output block

'prefix'': <path-like>

Sets the prefix for output (note you need a trailing / if it’s a directory). A bunch of plots, a log of the fit output, and table.fits will be written there.

'summaries': <list of dicts>

A list of instructions for summary computations. Each dict is used as parameters for the summary_op() function. Probably the only think you need to worry about is the key 'select', the value of which will be passed to get_obs_mask() to restrict the set of maps included in each average.

Reference

moby2.analysis.beam_ana.solid_angle.driver(args)[source]
moby2.analysis.beam_ana.solid_angle.summary_op(params, data, cat, mask=None, verbose=False)[source]

Process the solid angle fit info in data, according to the parameters in params, using the matched obs_catalog in cat. Optionally apply mask to the data, too.

The params should be a simple dictionary with entry ‘select’:

{'select': [...]}

The list is passed to util.get_obs_mask. Results are automatically grouped by band and array (pa).

moby2.analysis.beam_ana.util.get_map_list(params, args=[], data={})[source]

Get a list of maps and their associated names, somehow. This is intended for aid in scripting. The argument “params” is a dict describing where to get the maps.

Returns a tuple of two lists, (basenames, filenames).

The most important entry in the dict is ‘source’, which should look like one of:

‘source’: (‘file’, ‘map_list.txt’)
  • to read filenames from column 0 of map_list.txt

‘source’: (‘file’, ‘map_list.txt’, 5)
  • to read filenames from column 5 of map_list.txt

‘source’: (‘file’, ‘map_list.txt’, (0, 1))
  • to read filenames from column 1 and basenames from column 0 of map_list.txt

‘source’: (‘glob’, ‘pattern*.fits’)

‘source’: (‘list’, [‘file1.fits’, ‘file2.fits’])

‘source’: (‘list’, [(‘map1’, ‘path/to/file1.fits’),

(‘map2’, ‘path/to/file2.fits’)])

‘source’: (‘command_line’, )

If the source you specify does not provide basenames somehow, the basenames will default to be the same as the filenames. If you want to extract some standard basename from the filenames automatically, set params[‘basename_extractor’]:

‘basename_extractor’: ‘standard’ – to pull out ctime.ctime.array basename.

‘basename_extractor’: ‘splits’ – to pull out ctime.ctime.array_split00 sub-map name.

‘basename_extractor’: ‘filename’ – to simply remove the leading/path/elements/.

‘basename_extractor’: ‘standard_freq’ – find a basename and frequency code and connect them with _.

Finally, you can sort the whole thing by basename on its way out. Just set

‘sort’: True

moby2.analysis.beam_ana.util.get_obs_mask(obs_db, rules)[source]

Refine obs_db, which is a StructDB (or really any structured numpy array).

rules is a list of simple selection rules to apply to the vectors in obs_db. The results of the rule applications are and-ed together to get a mask. Rules must be of one of the following forms:

(key, 'in', [item1,item2])
(key, 'range', (lo, hi))
(key, 'range_mod', (lo, hi, modulus))