Module: source_cluster

Overview

This modules provides the implementation of the SourceCluster2Dim, an high level class to handle source clusters objects.

Summary

SourceCluster2Dim(ID, geom_repr_cartesian[, ...]) SourceCluster2Dim implements an high level class to handle source clusters objects.

Module API

class SourceCluster2Dim(ID, geom_repr_cartesian, geom_repr_polar=None, pts_weigth=None, metric='euclidean', parent_ID=None)[source]

Bases: object

SourceCluster2Dim implements an high level class to handle source clusters objects.

Attributes

cartesian public getter for the private member _geom_repr_cartesian, instance of the Representation2D
flux public getter for private member _pts_weight
n_points getter for the number of points/pixels in the cluster
polar public getter for the private member _geom_repr_polar, instance of the Representation2D
pts_weight public getter for private member _pts_weight

Methods

add_contour_points() Method ot add contour points to the source clusters.
build_from_cartesian_position_array(ID, ...) Class method to build a source cluster from an 2dim numpy array, storing the coordinates of the cluster points
build_from_evt_talbe(ID, event_table, evt_list) Class method to build a source cluster from an asterism.core.tables.events_table.EventTable object
check_is_in_cluster(x_test, y_test) Method to check if a position given by coords (x_test,y_test) is within the source cluster boundary.
check_is_within_r_from_center(R, x_test, y_test) Method to check if a position given by coords (x_test,y_test) is within a circle with radius R and centered on the cluster centroid.
filter(image_filter) This method is used to apply an image filter asterism.core.image_processing.filters.ImageFilter to the cluster.
get_closest_cluster(clusters_list)
get_cluster_Image([border, bkg]) Method to get a :class:’asterism.core.image_manager.image.Image’ object from the cluster.
get_cluster_image_array([border, bkg]) Method to get the image array from the cluster.
get_clusters_within_centroid(clusters_list)
merge_with(cl) Method to merge the current cluster with another
set_cluster_bary(geom_repr[, wehight])
set_cluster_peak()
add_contour_points()[source]

Method ot add contour points to the source clusters. This method is using the algorithm in the function cluster_border()

classmethod build_from_cartesian_position_array(ID, position_array, weight_array=None, parent_ID=None)[source]

Class method to build a source cluster from an 2dim numpy array, storing the coordinates of the cluster points

Parameters:

ID : int

ID of the object

position_array : 2dim numpy array

coordinates of the cluster points

weight_array : 1dim numpy array

weight or fluxes of each cluster point

Returns:

source cluster : SourceCluster2Dim

classmethod build_from_evt_talbe(ID, event_table, evt_list, parent_ID=None)[source]

Class method to build a source cluster from an asterism.core.tables.events_table.EventTable object

Parameters:

ID : int

ID of the object

event_table : asterism.core.tables.events_table.EventTable

evt_list : list of int

list of the IDs of the events selected from event_table

Returns:

source cluster : SourceCluster2Dim

cartesian

public getter for the private member _geom_repr_cartesian, instance of the Representation2D

check_is_in_cluster(x_test, y_test)[source]

Method to check if a position given by coords (x_test,y_test) is within the source cluster boundary. This methods uses the check_is_in_cluster()

Parameters:

x_test : float

y_test : float

Returns:

Boolean True or False

check_is_within_r_from_center(R, x_test, y_test)[source]

Method to check if a position given by coords (x_test,y_test) is within a circle with radius R and centered on the cluster centroid. This methods uses the check_is_within_r_from_center()

Parameters:

R

x_test

y_test

filter(image_filter)[source]

This method is used to apply an image filter asterism.core.image_processing.filters.ImageFilter to the cluster. The method first builds an intermediate image array using the get_cluster_image_array(). Then, it applies the image filter to this intermediate image array. Finally, it reassigns the cluster _pts_weight from the filtered image, by getting the filtered image values at the same coordinate of the cluster points

Parameters:

image_filter : asterism.core.image_processing.filters.ImageFilter

filter to apply to the cluster image

flux

public getter for private member _pts_weight

get_closest_cluster(clusters_list)[source]
get_cluster_Image(border=1, bkg=None)[source]

Method to get a :class:’asterism.core.image_manager.image.Image’ object from the cluster. This method is using the function asterism.core.clustering.cluster_tools.get_cluster_Image()

Parameters:

border : int

number of pixels to add to the box enclosing the cluster, and used to build the image

bkg : Optional[float]

value to give to the background

Returns:

image : :class:’asterism.core.image_manager.image.Image’

the output Image

off_set_x : float

the offset between the cluster x cartesian coordinates and the x pixel image coordinate

off_set_y : float

the offset between the cluster y cartesian coordinates and the y pixel image coordinate

masked_pixels : 2dim boolean numpy array

the masked pixels

get_cluster_image_array(border=1, bkg=None)[source]

Method to get the image array from the cluster. This method is using the function get_cluster_image_array()

Parameters:

border : int

number of pixels to add to the box enclosing the cluster, and used to build the image

bkg : Optional[float]

value to give to the background

Returns:

image : 2dim numpy array

off_set_x : float

the offset between the cluster x cartesian coordinates and the x pixel image coordinate

off_set_y : float

the offset between the cluster y cartesian coordinates and the y pixel image coordinate

masked_pixels : 2dim boolean numpy array

the masked pixels

get_clusters_within_centroid(clusters_list, centre=None, R=None)[source]
merge_with(cl)[source]

Method to merge the current cluster with another

Parameters:cl
n_points

getter for the number of points/pixels in the cluster

polar

public getter for the private member _geom_repr_polar, instance of the Representation2D

pts_weight

public getter for private member _pts_weight

set_cluster_bary(geom_repr, wehight=None)[source]
set_cluster_peak()[source]