## Name

msrcor

## Purpose (one Line Only)

Spatial correlation souce positions found in multiple lists

## Description

This routine is a conceptual extension of the Astronomy Users Library

routine, srcor.pro. This extension of this routine is that you

can correlate more than two lists of positions.

Each call of this routine will serve to add one list to the description

of the union of all the prior lists. The lists are copied into the

information collected about the set of lists so you don't need to

maintain a copy of the original lists.

## Category

Photometry

## Calling Sequence

msrcor,set,x,y,dcr

## Inputs

set - This is the description of the set of all lists seen thus far.

There are three ways to signal the first call to this routine.

1) set is undefined

2) set is not a structure

3) set is a valid structure but set.nlists is equal to zero.

Note that there is absolutely no performance advantage to maintaining

a previous structure and then setting set.nlists=0. If you want

to restart it is just as effective to simply say set=0 prior to

an initilizing call.

If the structure exists already and set.nlists!=0 then the information

will be added to and the anonymous structure will be modified

before returning.

x,y - Array of x and y coordinates for a new list to add to the set.

The order in which these array are successively presented to msrcor

will determine the ordinal number of the list within the set.

dcr - Critical radious outside which correlations are rejected.

x,y,dcr can be in any units that make sense to your problem but

they must all be the same units.

## Optional Input Parameters

## Keyword Input Parameters

## Outputs

set - Information structure, the following tags are defined:

x - X position of source (all lists are concatenated here)

y - Y position of source (all lists are concatenated here)

objid - vector that matches the length of x and y. These values

are unique object id numbers, starting at 0.

objcnt - vector that indicates how many times each object

appears in the lists (<= nlists)

lidx - vector (same length as x,y) that indicates which list

the position appears in.

nobj - scalar, number of unique objects found.

nlists - scalar, total number of lists included.

There may be other related information you might like to keep along with

this information, such as magnitude or FWHM. If you concatentate

everything in list order you will have a vector whose structure matches

set.x and set.y and the indexing for all will be the same.

## Keyword Output Parameters

## Common Blocks

## Side Effects

## Restrictions

## Procedure

## Modification History

2008/06/18, Written by Marc W. Buie with algorithmic input from Leslie Young,

Southwest Research Institute.

2011/08/02, MWB, promoted all counters and pointers to long, this caused

some odd problems when linking a lot of lists.