## ./

# skymap__define.pro

This class creates a smoothed sky map from an irregularly spaced set of measurements. The default smoothing kernel is a gaussian. The class also implements sigma clipping.

The smoothed map is evaluated according to m(x,y) = sum( w_i v_i) / sum(w_i)

where v_i is the ith sampled data point and w_i is a smoothing function. In this class, w_i is a gaussian centered on v_i, with a fwhm specified by the user.

The variance map is given by v(x,y) = sum(w_i^2 dv_i^2) / sum(w_i)^2

where dv_i^2 is the variance on measurement i

METHODS: weight: Implementation of the weighting kernel. getMap: return the smoothed map getIncluded: return a 1/0 bit vectors, listing which data points were included/clipped. writeFits: output the map to a fits file makeMap: calculate the smoothed map makeMapClip: Iteratively calculate map with sigma clipping init: Create the object cleanup: Destroy the object

SUPERCLASSES: none

SUBCLASSES: nicest: Overloads the weight method to implement Marco Lombardi's NICEST algorithm.

## Class description for skymap

Subclasses: nicest

## Routines

`result = skymap::weight(id, x, y)`

This function evaluates the gaussian smoothing kernel applied on source "id" at location (x,y)

`result = skymap::getMap( [variance=variance])`

This function returns the map structure associated with the object.

`result = skymap::getIncluded()`

This function returns a 1/0 bit vector, listing whether each data point was included/clipped when calculating the smoothed map.

`skymap::writeFits, name, varname=varname`

Output the map data to a fits image

`skymap::makeMapClip, clip [, lo=lo] [, hi=hi] [, tol=tol] [, max_reject=max_reject] [, maxiter=maxiter] [, miniter=miniter]`

This procedure iteratively computes the smooth map with sigma clipping.

`skymap::makeMap`

This main procedure to create the smoothed map

`result = skymap::init(map, x, y, val, dval [, fwhm=fwhm] [, truncate=truncate] [, verbose=verbose])`

Initializes the object

`skymap__cleanup`

`skymap__define`

## Routine details

## topskymap::weight

`result = skymap::weight(id, x, y)`

This function evaluates the gaussian smoothing kernel applied on source "id" at location (x,y)

### Return value

w_id(x,y)

### Parameters

- id in required
The index of the source to consider. scalar

- x in required
The x location in sky coordinates, scalar or array

- y in required
The y location in sky coordinates, scalar or array

### Author information

- History:
December 2010: Written by Chris Beaumont Aug 2011: Added support for euclidian (non-sky) maps. cnb.

## topskymap::getMap

`result = skymap::getMap( [variance=variance])`

This function returns the map structure associated with the object.

### Keywords

- variance in optional
Set to hold the variance map

## topskymap::getIncluded

`result = skymap::getIncluded()`

This function returns a 1/0 bit vector, listing whether each data point was included/clipped when calculating the smoothed map.

## topskymap::writeFits

`skymap::writeFits, name, varname=varname`

Output the map data to a fits image

### Parameters

- name in required
The file name to write to

### Keywords

- varname

## topskymap::makeMapClip

`skymap::makeMapClip, clip [, lo=lo] [, hi=hi] [, tol=tol] [, max_reject=max_reject] [, maxiter=maxiter] [, miniter=miniter]`

This procedure iteratively computes the smooth map with sigma clipping.

DESCRIPTION: makeMap is iteratively called and, at each iteration, each data point v_i is compared to the map value map(x_i, y_i). If the two values disagree by more than CLIP * sigma_map(x_i, y_i), the point is rejected. The map is recalculated with valid points until convergence.

### Parameters

- clip in required
The outlier threshhold (see above). 3 is typical

### Keywords

- lo in optional
set to flag only the lo-valued outliers.

- hi in optional
set to flag only the hi-valued outliers.

- tol in optional
Specifiy a convergence tolerance. The clipping has converged when fewer than TOL * n_object objects change their inlier/outlier classification. Defaults to .01

- max_reject in optional
Set to the max fraction of objects that can be flagged as outliers before failure. Defaults to .2

- maxiter in optional
The maximum number of clipping iterations before failure. Defaults to 5.

- miniter in optional
The minimum number of clipping iterations. Default is 2.

## topskymap::makeMap

`skymap::makeMap`

This main procedure to create the smoothed map

This function uses weighted mean smoothing with a Gaussian smoothing kernel.

V(x,y) = sum(w_i * val_i) / sum(w_i) where w_i = 1/dval_i^2 * exp[-((x-x_i)^2 + (y-y_i)^2) / 2 sigma^2] w_i truncated to 0 at (x - x_i)^2 + (y - y_i)^2 > truncate^2

The variance map is given by dV(x,y) = sum(w_i * dval_i^2) / sum(w_i)^2 In other words, it is the interpolated value of the variance, divided by the "effective" number of points which contribute to each pixel.

The procedure only calculates weights out to the truncation radius to speed things up. The procedure takes O(stamp_size * n_data) operations, instead of O(map_size * n_data). ;-

## topskymap::init

`result = skymap::init(map, x, y, val, dval [, fwhm=fwhm] [, truncate=truncate] [, verbose=verbose])`

Initializes the object

### Parameters

- map in required
A map structure created by map_init.pro

- x in required
The x coordinates of the data

- y in required
The y coordinates of the data

- val in required
Value of the data

- dval in required
1-sigma errors on the data

### Keywords

- fwhm in optional
The fwhm of the smoothing kernel, in degrees. Defaults to 1/100 of the map size

- truncate in optional
The radius at which to truncate the smoothing. This can considerably speed up execution time. See makeMap for details.

- verbose in optional
Set to request extra textual output

## topskymap__cleanup

`skymap__cleanup`

## topskymap__define

`skymap__define`

## File attributes

Modifcation date: | Fri Jun 15 10:31:02 2012 |

Lines: | 429 |