autowisp.split_sources module

Class Inheritance Diagram

Inheritance diagram of SplitSources

Define a class for splitting sources in groups for PRF fitting.

class autowisp.split_sources.SplitSources(magnitude_column, *, radius_splits=(), manual_mag_splits=(), mag_split_by_source_count=None)[source]

Bases: object

Inheritance diagram of autowisp.split_sources.SplitSources

Split sources in groups based on user-defined conditions.

Currently splitting by distance from the center of the frame and by magnitude are supported.

__call__(sources, image_resolution)[source]

Return an array of integers grouping PRF fitting sources as specified.

Parameters:
  • sources (structured array or pandas.DataFrame) – The sources to split. Must define at least ‘ID’, 'x', ‘y’`, 'phqual', 'objtype', and 'doublestar' fields as well as any magnitudes on which splitting is to be done.

  • image_resolution – The resolution of the image in pixels (y, x).

Returns:

A numpy integer array indicating for each

source the PRF fitting group it is in. The grouping of sources is controlled by the splitting arguments specified at construction time with each group of sources getting a unique positive integer. Sources which should not be used for PRF fitting are assigned a group ID of -1.

in_frame: A numpy boolean array indicating for each source

whether it’s center lies inside the frame or not.

Return type:

grouping

__init__(magnitude_column, *, radius_splits=(), manual_mag_splits=(), mag_split_by_source_count=None)[source]

Set-up the splitting.

Parameters:
  • magnitude_column – The filter in which to do the splitting by magnitude. Should be one of the columns available in the the input sources.

  • radius_splits – The boundaries in radius (measured in pixels) at which to split fit groups.

  • manual_mag_splits – The boundaries in magnitude at which to split fit groups. It is an error to specify both manual_mag_splits and mag_split_by_source_count.

  • mag_split_by_source_count – If specied, magnitude splitting is done to ensure at least this many sources in each group. It is an error to specify both manual_mag_splits and mag_split_by_source_count.

Returns:

None

_find_mag_splits(sorted_magnitudes)[source]

Find the magnitude boundaries that satisfy the source count limits.

Parameters:

sorted_magnitudes – The sorted magnitudes of the sources which pass the current radius selection.

Returns:

The values ofthe magnitudes where to split the input

list of sources in order to ensure that groups have exactly the minimum number of sources specified at construction, except the group containing the faintest sources which could be up to two time larger in order to ensure no sources are left without a group.

Return type:

boundaries