flystar.starlists

Classes

StarList

A StarList is an astropy.Table with star catalog from a single image.

Functions

restrict_by_name(table1, table2)

find stars with same name in two table.

restrict_by_area(table1, area[, exclude])

Restrict starlist to those within a specific area. Returns the

restrict_by_use(label_mat, starlist_mat, idx_label, ...)

Restrict matching starlist to only those where the label_mat['use'] > 2.

read_label(labelFile[, prop_to_time, flipX])

Read in a label.dat file, rename columns with standard

read_label_accel(labelFile[, prop_to_time, flipX])

Read in a label.dat file, rename columns with standard

read_starlist(starlistFile[, error])

Read in a starlist file, rename columns with standard names.

write_starlist(list, outfile)

Module Contents

flystar.starlists.restrict_by_name(table1, table2)

find stars with same name in two table.

Input

table1: astropy.table

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

table2: astropy.table

ontains name,m,x,y,xe,ye

Output

-Array with indicies of named stars in table1 -Array with indicies of named stars from table2 -Number of named stars

flystar.starlists.restrict_by_area(table1, area, exclude=False)

Restrict starlist to those within a specific area. Returns the indicies of the stars in table1 that fulfill this criteria. Area and table1 positions must be in consistent units in order for this to work.

Parameters:

table1: astropy table

Starlist to be restricted. Must have standard column headers (i.e. x, y)

area: 2x2 array [[x1, x2], [y1, y2]]

X and Y coordinate range to restric the stars too. Only stars with coordinates with x1 < X < x2 and y1 < Y < y2 will be allowed. We assume the area is given in same units as the table1 positions. i.e., x1 = xmin, x2 = xmax; y1 = ymin, y2 = ymax

exclude: boolean (default=False)

If true, exclude the stars that fall within the given area. If false, then only return stars that fall within the given area

Output:

array of indicies corresponding to stars which are within the designated area.

flystar.starlists.restrict_by_use(label_mat, starlist_mat, idx_label, idx_starlist)

Restrict matching starlist to only those where the label_mat[‘use’] > 2. This behaves the same way as the -restrict flag in java align.

Return the indicies corresponding to the stars that fulfill this condition.

Parameters:

label_mat: astropy table

Label.dat table containing the matched stars. Must have standard column headers. Rows are assumed to match the starlist.

starlist_mat: astropy table

Reference table containing the matched stars. Must have standard column headers. Rows are assumed to match the label.dat file

idx_label: array of indicies

Indicies of the matched stars in the label catalog

idx_starlist: array of indicies

Indicies of the matched stars in the starlist.

Output:

idx_label_f: array of indicies in the label catalog that fulfill the restrict condition

idx_starlist_f: array of indicies in the starlist that fulfill the restrict condition

label_trim: astropy table

label table with only use > 2 stars

starlist_trim: astropy table

reference table with only stars that correspond to use > 2 stars in the label_mat table.

flystar.starlists.read_label(labelFile, prop_to_time=None, flipX=True)

Read in a label.dat file, rename columns with standard names. Use velocities to convert positions into epoch t0, and then flip x positions and velocities such that +x is to the west.

Update values in columns of position and velocity

Parameters:

labelFile: text file. containing

col1: name col2: mag col3: x0 (arcsec) col4: y0 (arcsec) col5: x0err col6: y0err col7: vx (mas/yr) col8: vy (mas/yr) col9: vxerr col10: vyerr col11: t0 col12: use col13: r0 (arcsec)

prop_to_time: None or float (default = None)

If float, use velocities to propogate positions to defined time.

flipX: boolean (default = True)

If true, multiply the x positions and velocities by -1.0. This is useful when label.dat has +x to the east, while reference starlist has +x to the west.

#OLD# tref: reference epoch that label.dat is converted to.

Output:

labelFile: astropy.table. containing name, m, x0, y0, x0e, y0e, vx, vy, vxe, vye, t0, use, r0, (if prop_to_time: x, y, xe, ye, t)

x and y is in arcsec, converted to tref epoch, *(-1) so it increases to west

vx, vy, vxe, vye is converted to arcsec/yr

flystar.starlists.read_label_accel(labelFile, prop_to_time=None, flipX=True)

Read in a label.dat file, rename columns with standard names. Use velocities to convert positions into epoch t0, and then flip x positions and velocities such that +x is to the west.

Update values in columns of position and velocity

Parameters:

labelFile: text file. containing

col1: name col2: mag col3: x0 (arcsec) col4: y0 (arcsec) col5: x0err col6: y0err col7: vx (mas/yr) col8: vy (mas/yr) col9: vxerr col10: vyerr col7: ax (mas/yr) col8: ay (mas/yr) col9: axerr col10: ayerr col11: t0 col12: use col13: r0 (arcsec)

prop_to_time: None or float (default = None)

If float, use velocities to propogate positions to defined time.

flipX: boolean (default = True)

If true, multiply the x positions and velocities by -1.0. This is useful when label.dat has +x to the east, while reference starlist has +x to the west.

#OLD# tref: reference epoch that label.dat is converted to.

Output:

labelFile: astropy.table. containing name, m, x0, y0, x0e, y0e, vx, vy, vxe, vye, t0, use, r0, (if prop_to_time: x, y, xe, ye, t)

x and y is in arcsec, converted to tref epoch, *(-1) so it increases to west

vx, vy, vxe, vye is converted to arcsec/yr

flystar.starlists.read_starlist(starlistFile, error=True)

Read in a starlist file, rename columns with standard names. Assumes the starlist is the reference, so we have time as t and don’t try to propogate positions to a different time.

Parameter:

starlistFile: text file, containing:

col1: name col2: mag col3: t col4: x (pix) col5: y (pix) if error==True:

col6: xerr col7: yerr col8: SNR col9: corr col10: N_frames col11: flux

else:

col6: ? (left as default) col7: corr col8: N_frames col9: ? (left as default)

error: boolean (default=True)

If true, assumes starlist has error columns. This significantly changes the order of the columns.

Output:

starlist astropy table. containing: name, m, x, y, xe, ye, t

class flystar.starlists.StarList(*args, **kwargs)

Bases: astropy.table.Table

A StarList is an astropy.Table with star catalog from a single image.

Required table columns (input as keywords):

name1D numpy.array with shape = N_stars

List of names of the stars in the table.

x1D numpy.array with shape = N_stars

Positions of N_stars in the x dimension.

y1D numpy.array with shape = N_stars

Positions of N_stars in the y dimension.

m1D numpy.array with shape = N_stars

Magnitudes of N_stars.

Optional table columns (input as keywords):

xe1D numpy.array with shape = N_stars

Position uncertainties of N_stars in the x dimension.

ye1D numpy.array with shape = N_stars

Position uncertainties of N_stars in the y dimension.

me1D numpy.array with shape = N_stars

Magnitude uncertainties of N_stars.

corr1D numpy.array with shape = N_stars

Fitting correlation of N_stars.

Optional table meta data

list_namestr

Name of the starlist.

list_timeint or float

Time/date of the starlist.

classmethod from_lis_file(filename, error=True, fvu_file=None)

Read in a starlist file, rename columns with standard names. Assumes the starlist is the reference, so we have time as t and don’t try to propogate positions to a different time.

Parameter:

starlistFile: text file, containing:

col1: name col2: mag (name=m) col3: t col4: x (pix) col5: y (pix) if error==True:

col6: xerr (name=xe) col7: yerr (name=ye) col8: SNR (name=snr) col9: corr col10: N_frames col11: flux

else:

col6: ? (left as default) col7: corr col8: N_frames col9: ? (left as default)

Note that an ‘me’ column will be added if error=True set to 1.0 / snr.

error: boolean (default=True)

If true, assumes starlist has error columns. This significantly changes the order of the columns.

Output:

starlists.StarList() object (subclass of Astropy Table).

to_lis_file(filename)
classmethod from_table(table)

Make a StarList from an astropy.table.Table object. Note that the input table must have the columns [‘name’, ‘x’, ‘y’, ‘m’]. All other columns and meta data will be added to the new StarList object that is returned.

fubar()
restrict_by_value(**kwargs)

Restrict a table to any min/max range of column values. For instance, to restrict to only stars between 10 <= m <= 15, use:

starlist.restrict_by_value(m_min=10, m_max=15)

where ‘m’ was the column name.

This function acts on self, so the rows are removed forever.

transform_xym(trans)

Apply a transformation (instance of flystar.transforms.Transform2D) to the x, y, m, xe, ye, me columns.

Note that this case will handle trans == None (nothing is done).

transform_xy(trans)

Apply a transformation (instance of flystar.transforms.Transform2D) to the x, y, xe, ye columns.

Note that this case will handle trans == None (nothing is done).

transform_m(trans)

Apply a transformation (instance of flystar.transforms.Transform2D) to the m and me column.

Note that this case will handle trans == None (nothing is done).

flystar.starlists.write_starlist(list, outfile)