flystar.align

Attributes

motion_model_col_names

Classes

MosaicSelfRef

MosaicToRef

Functions

get_all_epochs(t)

Helper function to get times of all epochs from a ref table.

setup_ref_table_from_starlist(star_list)

Start with the reference list.... this will change and grow

copy_over_values(ref_table, star_list, star_list_T, ...)

Copy values from an individual starlist (both untransformed and transformed)

reset_ref_values(ref_table)

Reset all the 2D arrays in the reference table. This is the action

add_rows_for_new_stars(ref_table, star_list, idx_lis)

For each star that is in star_list and NOT in idx_list, make a

run_align_iter(catalog[, trans_order, poly_deg, ...])

calc_transform_ref_epoch(d, target_name, ee_ref, ...)

calc_transform_ref_poly(d, target_name, poly_deg, ...)

calc_polyfit_all_stars(d, poly_deg[, init_fig_idx])

calc_mag_avg_all_stars(d)

initial_align(table1, table2[, briteN, ...])

Calculates an initial (unweighted) transformation from table1 starlist into

transform_and_match(table1, table2, transform[, ...])

apply transformation to starlist1 and

find_transform(table1, table1_trans, table2[, ...])

Given a matched starlist, derive a new transform. This transformation is

find_transform_new(table1_mat, table2_mat[, ...])

Given a matched starlist, derive a new transform. This transformation is

write_transform(transform, starlist, reference, N_trans)

Given a transformation object, write out the coefficients in a java align

transform_from_file(starlist, transFile)

Apply transformation from transFile to starlist. Returns astropy table with

transform_from_object(starlist, transform)

Apply transformation to starlist. Returns astropy table with

position_transform_from_object(x, y, xe, ye, transform)

given the orginal position and position error, calculate the transformed

velocity_transform_from_object(x0, y0, x0e, y0e, vx, ...)

given the orginal position & position error & velocity & veolicty error,

transform_pos_from_file(Xcoeff, Ycoeff, order, x_orig, ...)

Given the read-in coefficients from transform_from_file, apply the

transform_poserr_from_file(Xcoeff, Ycoeff, order, ...)

Given the read-in coefficients from transform_from_file, apply the

transform_vel_from_file(Xcoeff, Ycoeff, order, ...)

Given the read-in coefficients from transform_from_file, apply the

transform_velerr_from_file(Xcoeff, Ycoeff, order, ...)

Given the read-in coefficients from transform_from_file, apply the

check_iter_tolerances(iters, dr_tol, dm_tol, outlier_tol)

check_trans_input(list_of_starlists, trans_input, ...)

trans_initial_guess(ref_list, star_list, trans_args[, ...])

Take two starlists and perform an initial matching and transformation.

update_old_and_new_names(ref_table, list_index, ...)

copy_and_rename_for_ref(star_list)

Make a deep copy of the starlist and rename the columns to include

outlier_rejection_indices(star_list, ref_list, outlier_tol)

Determine the outliers based on the residual positions between two different

setup_trans_info(trans_input, trans_args, N_lists, iters)

Setup transformation info into a usable format.

apply_mag_lim(star_list, mag_lim)

Apply a magnitude limit to the list. If no magnitude limit is

get_weighting_scheme(weights, ref_list, star_list)

get_pos_at_time(t, starlist[, use_vel])

Take a starlist, check to see if it has velocity columns.

logger(logfile, message[, verbose])

Module Contents

flystar.align.motion_model_col_names = ['x0', 'x0e', 'y0', 'y0e', 'vx', 'vxe', 'vy', 'vye', 'ax', 'axe', 'ay', 'aye', 't0', 'm0',...
class flystar.align.MosaicSelfRef(list_of_starlists, ref_index=0, iters=2, dr_tol=[1, 1], dm_tol=[2, 1], outlier_tol=[None, None], trans_args=[{'order': 2}, {'order': 2}], init_order=1, mag_trans=True, mag_lim=None, weights=None, trans_input=None, trans_class=transforms.PolyTransform, use_vel=False, calc_trans_inverse=False, init_guess_mode='miracle', iter_callback=None, verbose=True)

Bases: object

star_lists
ref_index = 0
iters = 2
dr_tol = [1, 1]
dm_tol = [2, 1]
outlier_tol = [None, None]
trans_args
init_order = 1
mag_trans = True
mag_lim = None
weights = None
trans_input = None
trans_class
calc_trans_inverse = False
use_vel = False
init_guess_mode = 'miracle'
iter_callback = None
verbose = True
N_lists
use_ref_new = True
update_ref_orig = True
fix_iterable_conditions()
fit()

Using the current parameter settings, match and transform all the lists to a reference position. Note in the first pass, the reference position is just the specified input reference starlist. In subsequent iterations, this is updated.

The ultimate outcome is the creation of self.ref_table. This reference table will contain “averaged” quantites as well as a big 2D array of all the matched original and transformed quantities.

Averaged columns on ref_table: x0 y0 m0 x0e y0e m0e vx (only if use_vel=True) vy (only if use_vel=True) vxe (only if use_vel=True) vye (only if use_vel=True)

match_and_transform(ref_mag_lim, dr_tol, dm_tol, outlier_tol, trans_args)

Given some reference list of positions, loop through all the starlists transform and match them.

setup_trans_info()

Setup transformation info into a usable format.

trans_input : list or None trans_args : dict or None N_lists : int iters : int

setup_ref_table_from_starlist(star_list)

Start with the reference list…. this will change and grow over time, so make a copy that we will keep updating. The reference table will contain one columne for every named array in the original reference star list.

apply_mag_lim_via_use_in_trans(ref_list, ref_mag_lim)

Set the use_in_trans flag to False for any star in the star list that falls beyond the magnitude limits.

This should really only be applied to reference star lists.

outlier_rejection_indices(star_list, ref_list, outlier_tol, verbose=True)

Determine the outliers based on the residual positions between two different starlists and some threshold (in sigma). Return the indices of the stars to keep (that shouldn’t be rejected as outliers).

Note that we assume that the star_list and ref_list are already transformed and matched.

Parameters

star_listStarList

starlist with ‘x’, ‘y’

ref_listStarList

starlist with ‘x0’, ‘y0’

outlier_tolfloat

Number of sigma inside which we keep stars and outside of which we reject stars as outliers.

Optional Parameters

verbose : boolean

Returns

keepersnd.array

The indicies of the stars to keep.

update_ref_table_from_list(star_list, star_list_T, ii, idx_ref, idx_lis, idx_ref_in_trans)

Inputs

star_listStarList

The original star list.

star_list_TStarList

The original star list now transformed into the reference coordinate system.

iiint

The index of this epoch/starlist in the final table.

idx_refnp.array dtype=int

The indices of the matched targets in the reference list/table.

idx_lisnp.array dtype=int

The indices of the matched targets in the origin starlist (epoch).

idx_ref_in_transnp.array dtype=int

The indices in the reference table (self.ref_table).

update_ref_table_aggregates(n_boot=0, weighting='var', use_scipy=True, absolute_sigma=False, show_progress=True)

Average positions or fit velocities. Average magnitudes. Calculate bootstrap errors if desired.

Update the use_in_trans values as needed.

Updates aggregate columns in self.ref_table in place.

get_weights_for_lists(ref_list, star_list)
match_lists(dr_tol, dm_tol)

Using the existing trans objects, match all the starlists to the reference starlist (self.ref_table), propogated to the appropriate epoch.

No trimming of stars. No new transformations derived.

The resulting matched values will be used to update self.ref_table

get_ref_list_from_table(epoch)

Convert the averaged quantites in self.ref_table into a StarList object appropriate for the specified epoch.

Columns in resulting reference list will include:

name x y m xe (optional) ye (optional) me (optional) use_in_trans (optional)

reset_ref_values(exclude=None)

Reset all the 2D arrays in the reference table. This is the action we take at the beginning of each new iteration. We don’t preserve matching results from the prior iterations.

calc_bootstrap_errors(n_boot=100, boot_epochs_min=-1, calc_vel_in_bootstrap=True, weighting='var', use_scipy=True, absolute_sigma=False, show_progress=True)

Function to calculate bootstrap errors for the transformations as well as the proper motions. For each iteration, this will:

1) Draw full-size bootstrap w/replacement sample from reference stars in ref_table and re-calculate the transformations for each epoch 2) Apply transformation to all stars in each epoch If calc_vel_in_bootstraps:

  1. For each star, draw full-size boostrap sample w/replacement from epochs

  2. Calculate proper motion for each star using resampled epochs

The saved outputs will be: x_trans, y_trans, m_trans (transformed postions/mags), as well as the proper motion fit parameters.

Final calculated errors: std(x_trans) —> x-direction transformation error (and likewise for y_trans, m_trans) std(x0) –> x0e (and same with all proper motion fit parameters)

mosaic_object: MosaicToRef object

MosaicToRef object after the complete match_and_transform process

n_boot: int, must be greater than 0

Number of bootstrap iterations when calculating transformations and the proper motion. PM bootstrap is only done for final proper motion calculation (e.g., not for each iteration of the starlist for matching)

boot_epochs_min: int or -1

In order to be included in bootstrap analysis, non-reference stars must be detected in at least boot_epochs_min epochs. If boot_epochs_min = -1, then all stars will be included in the analysis, regardless of the number of epochs detected. For stars that fail boot_epochs_min criteria, np.nan is used

calc_vel_in_bootstrap: boolean

If true, do bootstrap sample w/ replacement over the epochs and calculate stellar proper motions, as well as the bootstrap over reference stars to calculate positional alignment errors. If false, only calculate position alignment errors.

weighting: str

‘var’ or ‘std’ weighting for velocity fitting, by default ‘var’. If ‘var’, use the variance of the residuals to weight the fit. If ‘std’, use the standard deviation of the residuals to weight the fit.

use_scipy: boolean

If True, use scipy.optimize.curve_fit to fit the velocity. If False, use flystar.fit_velocity.linear_fit, by default True.

absolute_sigma: boolean

If True, use the absolute sigma in the velocity fitting. If False, use the relative sigma, by default False.

Seven new columns will be added to self.ref_table: ‘xe_boot’, 2D column: bootstrap x pos uncertainties due to transformation for each epoch ‘ye_boot’, 2D column: bootstrap y pos uncertainties due to transformation for each epoch ‘me_boot’, 2D column: bootstrap mag uncertainties due to transformation for each epoch

If calc_vel_in_bootstrap: ‘x0e_boot’, 1D column: bootstrap uncertainties in x0 for PM fit ‘y0e_boot’, 1D column: bootstrap uncertainties in y0 for PM fit ‘vxe_boot’, 1D column: bootstrap uncertainties in vx for PM fit ‘vye_boot’, 1D column: bootstrap uncertainties in vy for PM fit

For stars that fail boot_epochs_min criteria, np.nan is used

class flystar.align.MosaicToRef(ref_list, list_of_starlists, iters=2, dr_tol=[1, 1], dm_tol=[2, 1], outlier_tol=[None, None], trans_args=[{'order': 2}, {'order': 2}], init_order=1, mag_trans=True, mag_lim=None, ref_mag_lim=None, weights=None, trans_input=None, trans_class=transforms.PolyTransform, calc_trans_inverse=False, use_ref_new=False, use_vel=False, update_ref_orig=False, init_guess_mode='miracle', iter_callback=None, verbose=True)

Bases: MosaicSelfRef

ref_list
ref_mag_lim = None
update_ref_orig = False
use_ref_new = False
fit()

Using the current parameter settings, match and transform all the lists to a reference position. Note in the first pass, the reference position is just the specified input reference starlist. In subsequent iterations, this is (optionally) updated.

The ultimate outcome is the creation of self.ref_table. This reference table will contain “averaged” quantites as well as a big 2D array of all the matched original and transformed quantities.

Averaged columns on ref_table: x0 y0 m0 x0e y0e m0e vx (only if use_vel=True) vy (only if use_vel=True) vxe (only if use_vel=True) vye (only if use_vel=True)

flystar.align.get_all_epochs(t)

Helper function to get times of all epochs from a ref table. This is required because our previous approach of simply taking the time array of the star with the most detections fails for mosaicked catalogs, because it is then possible that no star is detected in all fields.

flystar.align.setup_ref_table_from_starlist(star_list)

Start with the reference list…. this will change and grow over time, so make a copy that we will keep updating. The reference table will contain one columne for every named array in the original reference star list.

flystar.align.copy_over_values(ref_table, star_list, star_list_T, idx_epoch, idx_ref, idx_lis)

Copy values from an individual starlist (both untransformed and transformed) into the reference table we carry around and that is the final output product. Copy only those values for stars that match.

Copy all columns that are in both ref_table and star_list_T. Copy all columns that are also in star_list but copy them into <col>_orig.

Parameters

ref_tableStarTable

The table we will be copying values into. Note the columns with the appropriate names and dimensions must already exist.

star_listStarList

The astropy table to copy values from. These should be untransformed (orig) values.

star_list_TStarList

The astropy table to copy values from. These should be transformed values.

idx_reflist or array

The indices into the ref_table where values are copied to.

idx_lislist or array

The indices into the star_list or star_lsit_T where values are copied from.

flystar.align.reset_ref_values(ref_table)

Reset all the 2D arrays in the reference table. This is the action we take at the beginning of each new iteration. We don’t preserve matching results from the prior iterations.

flystar.align.add_rows_for_new_stars(ref_table, star_list, idx_lis)

For each star that is in star_list and NOT in idx_list, make a new row in the reference table. The values will be empty (None, NAN, etc.).

Parameters

ref_tableStarTable

The reference table that the rows will be added to.

star_listStarList

The starlist that will be used to estimate how many new stars there are.

idx_lisarray or list

The indices of the non-new stars (those that matched already). The complement of this array will be used as the new stars.

Returns

ref_tableStarTable

The reference table with rows added into.

idx_lis_newlist

The list of indices into the star_list object for the “new” stars.

idx_ref_newlist

The list of indices into the ref_table object for the “new” stars.

flystar.align.run_align_iter(catalog, trans_order=1, poly_deg=1, ref_mag_lim=19, ref_radius_lim=300)
flystar.align.calc_transform_ref_epoch(d, target_name, ee_ref, ref_mag_lim, ref_radius_lim)
flystar.align.calc_transform_ref_poly(d, target_name, poly_deg, ref_mag_lim, ref_radius_lim)
flystar.align.calc_polyfit_all_stars(d, poly_deg, init_fig_idx=0)
flystar.align.calc_mag_avg_all_stars(d)
flystar.align.initial_align(table1, table2, briteN=100, transformModel=transforms.PolyTransform, order=1, req_match=5)

Calculates an initial (unweighted) transformation from table1 starlist into table2 starlist (i.e., table2 is the reference starlist). Matching is done using a blind triangle-matching algorithm of the brightest briteN stars in both starlists. Transformation is done using the transformModel in the input parameter.

Starlists must be astropy tables with standard column headers. All positions must be at the same epoch, and +x must be in the same direction.

Standard column headers: name: name x: x position y: y position xe: error in x position ye: error in y position

vx: proper motion in x direction vy proper motion in y direction vxe: error in x proper motion vye: error in y proper motion

m: magnitude me: magnitude error

t0: linear motion time zero point

use: specify use in transformation

Parameters:

-table1: astropy.table

contains name,m,x,y,xe,ye,vx,vy,vxe,vye,t0.

-table2: astropy.table

contains name,m,x,y,xe,ye. this is the reference template

-briteN: int

The number of brightest stars used to match two starlists.

-transformModel: transformation model object (class)

The transformation model class that will be instantiated to find the best-fit transformation parameters between matched table1 and table2. eg: transforms.four_paramNW, transforms.PolyTransform

-order: int

Order of the transformation. Not relevant for 4 parameter or spline fit

-req_match: int

Number of required matches of the input catalog to the total reference

Output:

Transformation object

flystar.align.transform_and_match(table1, table2, transform, dr_tol=1.0, dm_tol=None, verbose=True)

apply transformation to starlist1 and match stars to given radius and magnitude tolerance.

Starlists must be astropy tables with standard columns names as specified in initial_align.

Parameters:

-table2: astropy.table

contains name,m,x,y,xe,ye. this is the reference template

-dr_tol: float (default=1.0)

The search radius for the matching algorithm, in the same units as the starlist file positions.

-transform: transformation object

-verbose: bool, optional

Prints on screen information on the matching

-idx1: indicies of matched stars from table1 -idx2: indicies of matched stars from tabel2

flystar.align.find_transform(table1, table1_trans, table2, transModel=transforms.PolyTransform, order=1, weights=None, verbose=True)

Given a matched starlist, derive a new transform. This transformation is calculated for starlist 1 into starlist 2

Parameters:

table1: astropy table

Table which we have calculated the transformation for, trimmed to only stars which match with table2. Original coords, not transformed into reference frame.

table1_trans: astropy table

Table which we calculated the transformation fo, trimmed to only stars which match with table2. Contains transformed coords. Only used when calculating weights.

table2: astropy table

Table with the reference starlist. Trimmed to only stars which match table1.

trans: transformation object

Transformation used to transform table1 coords in transform_and_match in order to do the star matching.

transModel: transformation class (default: transform.four_paramNW)

Desired transform to apply to matched stars, e.g. four_paramNW or PolyTransform. If PolyTransform is selected, order defines the order of polynomial used

order: int (default=1)

Order of polynomial to use in the transformation. Only active if PolyTransform is selected

weights: string (default=None)

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.

verbose: bool (default=True)

Prints on screen information on the matching

Output:

-transformation object -number of stars used in transform

flystar.align.find_transform_new(table1_mat, table2_mat, transModel=transforms.four_paramNW, order=1, weights=None, transInit=None, verbose=True)

Given a matched starlist, derive a new transform. This transformation is calculated for starlist 1 into starlist 2

Parameters:

table1_mat: astropy table

Table with matched stars from starlist 1, with original positions (not transformed into starlist 2 frame)

table2_mat: astropy table

Table with matched stars from starlist 2, in starlist 2 frame.

transModel: transformation class (default: transform.four_paramNW)

Specify desired transform, e.g. four_paramNW or PolyTransform. If PolyTransform is selected, order defines the order of polynomial used

order: int (default=1)

Order of polynomial to use in the transformation. Only active if PolyTransform is selected

weights: string (default=None)

if weights==’both’, we use position 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.

transInit: Transform Object (default=None)

if weights = ‘both’ or ‘starlist’ then the positions in table 1 are first transformed using the transInit object. This is necessary if the plate scales are very different between the table 1 and the reference list.

verbose: bool (default=True)

Prints on screen information on the matching

Output:

-transformation object -number of stars used in transform

flystar.align.write_transform(transform, starlist, reference, N_trans, deltaMag=0, restrict=False, weights=None, outFile='outTrans.txt')

Given a transformation object, write out the coefficients in a java align readable format. Outfile name is specified by user.

Coefficients are output in file in the following way: x’ = a0 + a1*x + a2*y + a3*x**2. + a4*x*y + a5*y**2. + … y’ = b0 + b1*x + b2*y + b3*x**2. + b4*x*y + b5*y**2. + …

Parameters:

transform: transformation object

Transformation object we want to feed into java align

starlist: string

File name of starlist; this is the starlist the transformation should be applied to. For output purposes only

reference: string

File name of reference; this is what the starlist is transformed to. For output purposes only

N_trans: int

Number of stars used in the transformation

deltaMag: float (default = 0)

Average magnitude difference between reference and starlist (reference - starlist)

restrict: boolean (default=False)

Set to True if transformation restricted to stars with use > 2. Purely for output purposes

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.

outFile: string (default: ‘outTrans.txt’)

Name of output text file

Output:

txt file with the file name outFile

flystar.align.transform_from_file(starlist, transFile)

Apply transformation from transFile to starlist. Returns astropy table with added columns with the transformed coordinates. NOTE: Transforms positions/position errors, plus velocities and velocity errors if they are present in starlist.

WARNING: THIS CODE WILL NOT WORK FOR LEGENDRE POLYNOMIAL TRANSFORMS

Parameters:

starlist: astropy table

Starlist we want to apply the transformation too. Must already have standard column headers

transFile: ascii file

File with the transformation coefficients. Assumed to be output of write_transform, with coefficients specified as code documents

Output:

Copy of starlist astropy table with transformed coordinates.

flystar.align.transform_from_object(starlist, transform)

Apply transformation to starlist. Returns astropy table with transformed positions/position errors, velocities and velocity errors if they are present in starlits

Parameters:

starlist: astropy table

Starlist we want to apply the transformation too. Must already have standard column headers x0, y0, x0e, y0e, vx, vy, vxe, vye, x, y, xe, ye

transform: transformation object

Output:

Copy of starlist astropy table with transformed x0, y0, x0e, y0e, vx, vy, vxe, vye, x, y, xe, ye

flystar.align.position_transform_from_object(x, y, xe, ye, transform)

given the orginal position and position error, calculate the transformed position and position error based on transformation object from astropy.modeling.models.polynomial2D. Input:

  • x, y: original position

  • xe, ye: original position error

  • transform: transformation object from astropy.modeling.models.polynomial2D

Outpus:
  • x_new, y_new: transformed position

  • xe_new, ye_new: transformed position error

flystar.align.velocity_transform_from_object(x0, y0, x0e, y0e, vx, vy, vxe, vye, transform)

given the orginal position & position error & velocity & veolicty error, calculat the transformed velocity and velocity error based on transformation from astropy.modling.models.polynomial2D. Input:

  • x0, y0, x0e, y0e: original position and position error

  • vx, vy, vxe, vye: original velocity and velocity error

  • transform: transformation object from astropy.modeling.models.polynomial2D

Outpus:
  • vx_new, vy_new, vxe_new, vye_new: transformed velocity and velocity error

flystar.align.transform_pos_from_file(Xcoeff, Ycoeff, order, x_orig, y_orig)

Given the read-in coefficients from transform_from_file, apply the transformation to the observed positions. This is generalized to work with any order polynomial transform.

WARNING: THIS CODE WILL NOT WORK FOR LEGENDRE POLYNOMIAL TRANSFORMS

Parameters:

Xcoeff: Array

Array with the coefficients of the X pos transformation

Ycoeff: Array

Array with the coefficients of the Y pos transformation

order: int

Order of transformation

x_orig: array

Array with the original X positions

y_orig: array

Array with the original Y positions

Output:

x_new: array

Transformed X positions

y_new: array

Transformed Y positions

flystar.align.transform_poserr_from_file(Xcoeff, Ycoeff, order, xe_orig, ye_orig, x_orig, y_orig)

Given the read-in coefficients from transform_from_file, apply the transformation to the observed position errors. This is generalized to work with any order transform.

WARNING: THIS CODE WILL NOT WORK FOR LEGENDRE POLYNOMIAL TRANSFORMS

Parameters:

Xcoeff: Array

Array with the coefficients of the X pos transformation

Ycoeff: Array

Array with the coefficients of the Y pos transformation

order: int

Order of transformation

xe_orig: array

Array with the original X position errs

ye_orig: array

Array with the original Y position errs

x_orig: array

Array with the original X positions

y_orig: array

Array with the original Y positions

Output:

xe_new: array

Transformed X position errs

ye_new: array

Transformed Y position errs

flystar.align.transform_vel_from_file(Xcoeff, Ycoeff, order, vx_orig, vy_orig, x_orig, y_orig)

Given the read-in coefficients from transform_from_file, apply the transformation to the observed proper motions. This is generalized to work with any order transform.

WARNING: THIS CODE WILL NOT WORK FOR LEGENDRE POLYNOMIAL TRANSFORMS

Parameters:

Xcoeff: Array

Array with the coefficients of the X pos transformation

Ycoeff: Array

Array with the coefficients of the Y pos transformation

order: int

Order of transformation

vx_orig: array

Array with the original X proper motions

vy_orig: array

Array with the original Y proper motions

x_orig: array

Array with the original X positions

y_orig: array

Array with the original Y positions

Output:

vx_new: array

Transformed X proper motions

vy_new: array

Transformed Y proper motions

flystar.align.transform_velerr_from_file(Xcoeff, Ycoeff, order, vxe_orig, vye_orig, vx_orig, vy_orig, xe_orig, ye_orig, x_orig, y_orig)

Given the read-in coefficients from transform_from_file, apply the transformation to the observed proper motion errors. This is generalized to work with any order transform.

WARNING: THIS CODE WILL NOT WORK FOR LEGENDRE POLYNOMIAL TRANSFORMS

Parameters:

Xcoeff: Array

Array with the coefficients of the X pos transformation

Ycoeff: Array

Array with the coefficients of the Y pos transformation

order: int

Order of transformation

vxe_orig: array

Array with the original X proper motion errs

vye_orig: array

Array with the original Y proper motion errs

vx_orig: array

Array with the original X proper motions

vy_orig: array

Array with the original Y proper motions

xe_orig: array

Array with the original X position errs

ye_orig: array

Array with the original Y position errs

x_orig: array

Array with the original X positions

y_orig: array

Array with the original Y positions

Output:

vxe_new: array

Transformed X proper motion errs

vye_new: array

Transformed Y proper motion errs

flystar.align.check_iter_tolerances(iters, dr_tol, dm_tol, outlier_tol)
flystar.align.check_trans_input(list_of_starlists, trans_input, mag_trans)
flystar.align.trans_initial_guess(ref_list, star_list, trans_args, mode='miracle', ignore_contains='star', verbose=True, n_req_match=3, mag_trans=True, order=1)

Take two starlists and perform an initial matching and transformation.

This function will grow with time to handle difference types of initial guess transformations (triangle matching, match by name, etc.). For now it is just blind triangle matching on the brightest 50 stars.

flystar.align.update_old_and_new_names(ref_table, list_index, idx_ref_new)
flystar.align.copy_and_rename_for_ref(star_list)

Make a deep copy of the starlist and rename the columns to include “0”. This only applies to x, y, m and xe, ye, me (if they exist) columns.

Input

star_listStarList

The starlist to copy.

flystar.align.outlier_rejection_indices(star_list, ref_list, outlier_tol, verbose=True)

Determine the outliers based on the residual positions between two different starlists and some threshold (in sigma). Return the indices of the stars to keep (that shouldn’t be rejected as outliers).

Note that we assume that the star_list and ref_list are already transformed and matched.

Parameters

star_listStarList

starlist with ‘x’, ‘y’

ref_listStarList

starlist with ‘x0’, ‘y0’

outlier_tolfloat

Number of sigma inside which we keep stars and outside of which we reject stars as outliers.

Optional Parameters

verbose : boolean

Returns

keepersnd.array

The indicies of the stars to keep.

flystar.align.setup_trans_info(trans_input, trans_args, N_lists, iters)

Setup transformation info into a usable format.

trans_input : list or None trans_args : dict or None N_lists : int iters : int

flystar.align.apply_mag_lim(star_list, mag_lim)

Apply a magnitude limit to the list. If no magnitude limit is specified, then return a copy of the list. This works on a reference list (with ‘m0’) or a star_list (‘m’) with ‘m0’ taking priority.

mag_lim2 element array

Contains the minimum and maximum magnitude cut to apply. If none, no magnitude cut is applied.

flystar.align.get_weighting_scheme(weights, ref_list, star_list)
flystar.align.get_pos_at_time(t, starlist, use_vel=True)

Take a starlist, check to see if it has velocity columns. If it does, then propogate the positions forward in time to the desired epoch. If no velocities exist, then just use [‘x0’, ‘y0’] or [‘x’, ‘y’]

Inputs

t_arrayfloat

The time to propogate to. Usually in decimal years; but it should be in the same units as the ‘t0’ column in starlist.

flystar.align.logger(logfile, message, verbose=9)