flystar.examples ================ .. py:module:: flystar.examples Functions --------- .. autoapisummary:: flystar.examples.align_example flystar.examples.align_Arches flystar.examples.align_gc flystar.examples.align_starlists flystar.examples.apply_trans Module Contents --------------- .. py:function:: align_example(labelFile, reference, transModel=transforms.four_paramNW, order=1, N_loop=2, dr_tol=1.0, dm_tol=None, briteN=100, weights=False, outFile='outTrans.txt') Base example of how to use the flystar code. Assumes we are transforming a label.dat into a reference starlist. Parameters: ----------- labelFile: ascii file Starlist we would like to transform into the reference frame. For this code, we expect a label.dat file reference: ascii file Starlist that defines the reference frame transModel: transformation class (default: transform.four_paramNW) Defines which transformation model to use. Only the four-parameter and 1st/2nd order polynomial transformations are supported order: int (default=1) Order of the polynomial transformation. Only used for polynomial transform N_loop: int (default=2) How many times to iterate on the transformation calculation. Ideally, each iteration adds more stars and thus a better transform, to some limit. dr_tol: float (default = 1.0) The search radius for the matching algorithm, in the same units as the starlist file positions. dm_tol: float or None If float, sets the maximum magnitude difference allowed in matching between label.dat and starlist. Note that this should be set to None if the label.dat and refStarlist are in different filters. briteN: int (default = 100) Number of bright stars in both starlists to run the blind matching algorithm on. britN must be less than the length of either starlist weights: boolean (default = False) If true, use weights to calculate transformation. These weights are based on position and velocity errors outFile: string (default = 'outTrans.txt') Name of output ascii file which contains the transform parameters. Output: ------ .. py:function:: align_Arches(labelFile, reference, transModel=transforms.four_paramNW, order=1, N_loop=2, dr_tol=1.0, dm_tol=None, briteN=100, weights=None, restrict=False, outFile='outTrans.txt') Application of flystar code to align Arches label.dat and reference starlist. Transforming the label file into the frame of the reference starlist. Parameters: ----------- labelFile: ascii file Starlist we would like to transform into the reference frame. For this code, we expect a label.dat file. reference: ascii file Starlist that defines the reference frame transModel: transformation class (default: transform.four_paramNW) Defines which transformation model to use. Only the four-parameter and 1st/2nd order polynomial transformations are supported order: int (default=1) Order of the polynomial transformation. Only used for polynomial transform N_loop: int (default=2) How many times to iterate on the transformation calculation. Ideally, each iteration adds more stars and thus a better transform, to some limit. dr_tol: float (default = 1.0) The search radius for the matching algorithm, in the same units as the starlist file positions. dm_tol: float or None (default = None) If float, sets the maximum magnitude difference allowed in matching between label.dat and starlist. Note that this should be set to None if the label.dat and refStarlist are in different filters. briteN: int (default = 100) Number of bright stars in both starlists to run the blind matching algorithm on. britN must be less than the length of either starlist weights: string (default=None) if weights=='both', we use both position error and velocity error in transformed starlist and reference starlist as uncertanties. And weights is the reciprocal of this uncertanty. if weights=='starlist', we only use postion error and velocity error in transformed starlist as uncertainty. if weights=='reference', we only use position error in reference starlist as uncertainty. if weights==None, we don't use weights. restrict: boolean (default = False) If true, restrict to only stars with use > 2 in the label.dat file. This behaves same way as java align -restrict flag. outFile: string (default = 'outTrans.txt') Name of output ascii file which contains the transform parameters. Output: ------ outFile is written containing the tranformation coefficients Diagnostic plots included from plots.py -Transformed_positons.png: Shows positions of matched stars (both reference starlist and label.dat) in reference starlist coordinates. The label.dat coordinates are the ones after the derived transformation has been applied. -Positions_hist.png: Histogram of the difference between the reference list positions and the label.dat positions after transformation. -Positions_quiver.png: Quiver plot showing the difference between reference positions and transformed label.dat positions as a function of location. -Magnitude_hist.png: Histogram of the difference between the reference list magnitude and label.dat magnitude for matched stars. .. py:function:: align_gc(starFile, refFile, transModel=transforms.PolyTransform, order=1, N_loop=2, dr_tol=1.0, briteN=100, weights='both', restrict=False, outFile='outTrans.txt') Transforming a starlist(label.dat) into a reference frame. Parameters: ----------- starFile: string Starlist we would like to transform into the reference frame, eg:label.dat refFile: string Starlist that defines the reference frame. transModel: transformation class (default: transforms.polyTransform) Defines which transformation model to use. Both the four-parameter and polynomial transformations are supported order: int (default=1) Order of the polynomial transformation. Only used for polynomial transform N_loop: int (default=2) How many times to iterate on the transformation calculation. Ideally, each iteration adds more stars and thus a better transform, to some limit. dr_tol: float(default=1.0) the distance tolerance for matching two stars in align.transform_and_match briteN: int (default=100) the number of stars used in blind matching weights: string (default='both') if weights=='both', we use both position error in transformed starlist and reference starlist as uncertanty. And weights is the reciprocal of this uncertanty. if weights=='starlist', we only use postion error in transformed starlist. if weights=='reference', we only use position error in reference starlist. if weights==None, we don't use weights. restrict: boolean (default=False) Set to True if transformation restricted to stars with use > 2. outFile: string('outTrans.txt') the name of the output transformation file .. py:function:: align_starlists(starlist, ref, transModel=transforms.PolyTransform, order=2, N_loop=2, dr_tol=1.0, briteN=None, weights='both', outFile='outTrans.txt') Transforming a starlist(label.dat) into a reference frame. Parameters: ----------- starlist: Table Starlist we would like to transform into the reference frame, eg:label.dat ref: Table Starlist that defines the reference frame. transModel: transformation class (default: transforms.polyTransform) Defines which transformation model to use. Both the four-parameter and polynomial transformations are supported order: int (default=1) Order of the polynomial transformation. Only used for polynomial transform N_loop: int (default=2) How many times to iterate on the transformation calculation. Ideally, each iteration adds more stars and thus a better transform, to some limit. dr_tol: float(default=1.0) the distance tolerance for matching two stars in align.transform_and_match briteN: int (default=100) the number of stars used in blind matching weights: string (default='both') if weights=='both', we use both position error in transformed starlist and reference starlist as uncertanty. And weights is the reciprocal of this uncertanty. if weights=='starlist', we only use postion error in transformed starlist. if weights=='reference', we only use position error in reference starlist. if weights==None, we don't use weights. outFile: string('outTrans.txt') the name of the output transformation file .. py:function:: apply_trans(starlist, ref, trans_file, dr_tol=1.0, dm_tol=None) apply transformation to starlist with trans_file match transformed starslist with ref return