flystar.match ============= .. py:module:: flystar.match Functions --------- .. autoapisummary:: flystar.match.miracle_match_briteN flystar.match.order_by_brite flystar.match.match flystar.match.calc_triangles_vmax_angle flystar.match.add_votes flystar.match.generic_match Module Contents --------------- .. py:function:: miracle_match_briteN(xin1, yin1, min1, xin2, yin2, min2, Nbrite, Nbins_vmax=200, Nbins_angle=360, verbose=False) Take two input starlists and select the brightest stars from each. Then performa a triangle matching algorithm along the lines of Groth 1986. For every possible triangle (combination of 3 stars) in a starlist, compute the ratio of two sides and the angle between those sides. These quantities are invariant under scale and rotation transformations. Use a histogram of these quantities to vote for possible matching triangles between the two star lists. Then take the vote winners as actual matches. There may be some sensitivity to the bin sizes used in the histogram for vmax (ratio of two sides) and the angles. The larger the positional and brightness uncertainties, the more bigger the bin sizes should really be. But this isn't well tested. .. py:function:: order_by_brite(xi, yi, mi, Nout, verbose=True) .. py:function:: match(x1, y1, m1, x2, y2, m2, dr_tol, dm_tol=None, verbose=True) Finds matches between two different catalogs. No transformations are done and it is assumed that the two catalogs are already on the same coordinate system and magnitude system. For two stars to be matched, they must be within a specified radius (dr_tol) and delta-magnitude (dm_tol). For stars with more than 1 neighbor (within the tolerances), if one is found that is the best match in both brightness and positional offsets (closest in both), then the match is made. Otherwise, their is a conflict and no match is returned for the star. Parameters x1 : array-like X coordinate in the first catalog y1 : array-like Y coordinate in the first catalog (shape of array must match `x1`) m1 : array-like Magnitude in the first catalog. Must have the same shape as x1. x2 : array-like X coordinate in the second catalog y2 : array-like Y coordinate in the second catalog (shape of array must match `x2`) m2 : array-like Magnitude in the second catalog. Must have the same shape as x2. dr_tol : float How close (in units of the first catalog) a match has to be to count as a match. For stars with more than one nearest neighbor, the delta-magnitude is checked and the closest in delta-mag is chosen. dm_tol : float or None, optional How close in delta-magnitude a match has to be to count as a match. If None, then any delta-magnitude is allowed. verbose : bool or int, optional Prints on screen information on the matching. Higher verbose values (up to 9) provide more detail. Returns ------- idx1 : int array Indicies into the first catalog of the matches. Will never be larger than `x1`/`y1`. idx2 : int array Indicies into the second catalog of the matches. Will never be larger than `x1`/`y1`. dr : float array Distance between the matches. dm : float array Delta-mag between the matches. (m1 - m2) .. py:function:: calc_triangles_vmax_angle(x, y) .. py:function:: add_votes(votes, match1, match2) .. py:function:: generic_match(sl1, sl2, init_mode='triangle', model=transforms.PolyTransform, order_dr=(1, 1.0), dr_final=1.0, xy_match=(None, None, None, None, None, None, None, None), m_match=(None, None, None, None), sigma_match=None, n_bright=100, verbose=True, **kwargs) Finds the transformation between two starlists using the first one as reference frame. Different matching methods can be used. If no transformation is found, it returns an error message. Parameters sl1 : StarList starlist used for reference frame sl2 : StarList starlist transformed init_mode : str Initial matching method. If 'triangle', uses the blind triangle method. If 'match_name', uses match by name If 'load', uses the transformation from a loaded file model : str Transformation model to be used with the 'triangle' initial mode poly_order : int Order of the transformation model order_dr : int, float [n, 2] Combinations of polinomial order (first column) and search radius (second column) to refine the transformation. Rows are executed in orders dr_final: float Search radius used for the final matching n_bright : int Number of bright stars used in the initial blind triangles matching xy_match : array Area of the images to remove in the matching [reference catalog min x, reference catalog max x, reference catalog min y, reference catalog max y, transformed catalog min x, transformed catalog max x, transformed catalog min y, transformed catalog max y]. Use None for values not used. m_match : array Magnitude limits of matching stars used to find transformations [reference catalog min mag, reference catalog max mag, transformed catalog min mag, transformed catalog max mag]. Use None for values not used sigma_match : array Number of Deltap movement sigmas [0] used for sigma-cutting matched stars for a number of times [1]. Use None for no sigma-cut. The last polynomial order and search radius in 'order_dr' are used transf_file : str File name and path of the transformation file used with the 'load' init_mode verbose : bool, optional Prints on screen information on the matching Returns ------- transf : Transform2D Transformation of the second starlist respect to the first st : StarTable Startable of the two matched catalogs