imProc.match - EranOfek/AstroPack GitHub Wiki

Description

The imProc.match package contain functions for matching sources in catalogs, where the catalog resides in AstroImage or AstroCatalog objects. Some of the functions can work with catsHM catalogs.

Functions

Match two catalogs:

  • imProc.match.match - Match the content of two AstroCatalog objects.
  • imProc.match.matchReturnIndices - Match two catalogs in AstroCatalog objects and return the matched indices.
  • imProc.match.matchedReturnCat - (OBSOLETE) Match AsstroCatalogs and return an array of matched catalogs.

Search sources in catalogs:

  • imProc.match.coneSearch - cone search(s) on AstroCatalog/AstroImage object
  • imProc.match.flagSrcWithNeighbors - Flag sources in AstroCatalog which have neighbors within a radius
  • imProc.match.inPolygon - Return sources inside a polygon.

Merging and unification:

  • imProc.match.matched2matrix - A matched AstroCatalog object into a matrix of epochs by index
  • imProc.match.mergeCatalogs - Merge catalogs of the same field into a single unified merged catalog
  • imProc.match.unifiedSourcesCatalog - Match multiple catalogs and create a catalog of all unique (by position) sources.

Match with solar system objects:

  • imProc.match.match2solarSystem - Match sources in AstroCatalog object to Solar System objects.

Functions related to catsHTM:

  • imProc.match.returnMatched_catsHTM - Return a catsHTM catalog matched to an AstroCatalog object.
  • imProc.match.match_catsHTM - Match an AstroCatalog object with catsHTM catalog, and add columns from catsHTM to input catalog.
  • imProc.match.match_catsHTMmerged - Match an AstroCatalog with the catsHTM MergedCat (the catalogs of catalogs)
  • imProc.match.match_catsHTM_multiInsertFlag - TBD.

General functions:

  • imProc.match.insertColFromMatched_matchIndices - Given two catalogs, matched them and insert some matched columns to the first catalog
  • imProc.match.insertCol_matchIndices - Insert Dist/Nmatch columns to a single element AstroCatalog based on ResInd.
  • imProc.match.allFunList - Functions and Classes list for the imProc.match package
  • imProc.match.unitTest - unitTest for +imProc.match

Selected functions

imProc.match.matchReturnIndices

This is a basic utility function that returns the two-directional indices of the matched sources. This function is used by the more advanced matching programs.

% Create an AstroCatalog objecs in which some of the objects are at roughly the same position:
AC = AstroCatalog;
AC.Catalog  = [1 0; 1 2; 1 1; 2 -1; 2 0; 2.01 0];
AC.ColNames = {'RA','Dec'};
AC.ColUnits = {'rad','rad'};
AC2 = AstroCatalog;
AC2.Catalog  = [1 2; 1 1; 2.001 0; 3 -1; 3 0]
AC2.ColNames = {'RA','Dec'};
AC2.ColUnits = {'rad','rad'};

% Match the two catalogs:
Result = imProc.match.matchReturnIndices(AC,AC2,'Radius',0.01,'CooType','sphere','RadiusUnits','rad');

The output is a structure array (element per Obj1/Obj2 matching) with the following fields:

  • 'Obj2_IndInObj1' - A vector, for each source in Obj2, of its matched indices in Obj1. NaN if no match.
  • 'Obj2_Dist' - A vector, for each source in Obj2, of the angular distance ['rad' if 'sphere'] between the matched sources.
  • 'Obj2_NmatchObj1' - A vector, for each source in Obj2, of the number of matches within the search radius.
  • 'Obj1_IndInObj2' - A vector, for each source in Obj1, of its matched indices in Obj2. NaN if no match.
  • 'Obj1_FlagNearest' - A vector, for each source in Obj1, of logicals indicating if this source is the nearest match to a source is Obj2.
  • 'Obj1_FlagAll' - A vector, for each source in Obj1, of logicals indicating if this source is a match (within search radius) to a source is Obj2.
  • 'Obj1_Fist' - A vector, for each source in Obj1, of the angular distance ['rad' if 'sphere'] between the matched sources.

imProc.match.mergeCatalogs

Merge catalogs of the same field into a single unified merged catalog. The program may work AstroImage array in which different columns correspond to different fields, and rows correspond to epochs. The catalogs of each field are merged into an AstroTable using MatchedSources/unifiedCatalogsIntoMatched. Next, for each relative photometry is calculated, and for each source, proper motion is fitted and variability information is calculated. The output catalog may contain columns that provide measurements for all epochs (see 'ColNamesAll' argument), and columns for which some statistics over all epochs are calculated (see 'ColNamesStat', 'FunIndStat' arguments). Also, generate a MatchedSources object for each field.

[MergedCat, MatchedS] = imProc.match.mergeCatalogs(AllSI)
I = 1;
AA=MergedCat(I).toTable; Flag = (AA.PM_TdistProb>0.999 & AA.Nobs>5) | (AA.PM_TdistProb>0.9999 & AA.Nobs>3); remove near edge..., check that motion is consistent with Nobs sum(Flag)
% display sources in ds9:
ds9(AllSI(1,I), 1); 
ds9(AllSI(end,I), 2); 
ds9.plot(MergedCat(I).Catalog(Flag,1:2),'o','Coo','fk5')

imProc.match.match_catsHTM

To match between sources in an AstroImage or AstroCatalog and catsHTM catalog you can use the following:

% load a FITS table into a AstroCatalog object:
AC=AstroCatalog({'asu.fit'},'HDU',2); % where coordinates are in deg
% match with 5" radius:
[Result, SelObj, ResInd, CatH] = match_catsHTM(AC, 'GAIADR3','CooUnits','deg', Radius',5); 

The Result output contain the input catalog with added columns for the nearest match in the catsHTM catalog.

imProc.match.match_catsHTMmerged

Match an AstroCatalog with the catsHTM MergedCat. MergedCat is a special catsHTM catalog of several merged catalogs. It contains 4 columns [RA, Dec, BitFlag, AngRadius].

AC = AstroCatalog({[1 1]},{'RA','Dec'});
Result = imProc.match.match_catsHTMmerged(AC)
⚠️ **GitHub.com Fallback** ⚠️