find_image_center_by_arc_segmentation

This module’s scope are the procedures necessary to find the center in a spectrograph using the arc segmentation method.

class tuna.tools.phase_map.find_image_center_by_arc_segmentation.arc_segmentation_center_finder(wrapped, noise)[source]

This class’ responsibility is to find the center of an image by finding the intersection of rays computed from arc segments.

If a cube is received, it will use the first plane as its input.

It inherits from the threading.Thread class, and it auto-starts its thread execution. Clients are expected to use its .join ( ) method before using its results.

Its constructor expects the following parameters:

  • noise : can

    Containing the noise related to the data at hand.

  • wrapped : can

    Containing a wrapped phase map, such as one generated by one of the barycenter’s tools in Tuna.

Example:

>>> import tuna
>>> barycenter = tuna.io.read ( "tuna/test/unit/unit_io/G094_03_wrapped_phase_map.fits" )
>>> noise = tuna.io.read ( "tuna/test/unit/unit_io/G094_04_noise.fits" )
>>> center = tuna.tools.phase_map.arc_segmentation_center_finder ( noise = noise, wrapped = barycenter ); center.join ( )
>>> center.get_center ( )
(218, 254)
detect_ring_borders()[source]

This method’s goal is to detect borders, and select only the first connected set of pixels in this border.

find_center()[source]

This method’s goal is to to find the center by segmenting arcs and searching for the intersection of rays perpendicular to these segments.

get_center()[source]

This method’s goal is to access the calculated center coordinates. Will trigger a find if the center is yet unknown.

Returns:

  • unnamed variable : tuple of 2 integers

    Containing the column and row of the found center.

get_most_distant_points(tl_points=[])[source]

This method’s goal is to find the pair of points that are most distant in a list of points, by calculating the distance between each possible pair.

Parameters:

  • tl_points : list

    Containing tuples of 2 integers each.

Returns:

  • unnamed variable : list

    Containing the first two points that are separated by the largest distance.

get_random_chord_bisector()[source]

This method’s goal is to find a perpendicular bisector for line segments determined from two random points from the current border.

Returns:

  • unnamed variable : sympy.Line

    Will be None if no line bisects the chord.

get_random_point_in_border()[source]

This method’s goal is to access a random point from the current border.

Returns:

  • unnamed variable : tuple of 2 integers

    Corresponding to the column and row of a random position in the border.

run()[source]

This method’s goal is to execute the main algorithm once its thread .start ( ) method is called.