autowisp.astrometry.astrometry module — AutoWISP documentation

# autowisp.astrometry.astrometry module

## Class Inheritance Diagram

Fit for a transformation between sky and image coordinates.

class autowisp.astrometry.astrometry.TempAstrometryFiles(file_types=('sources', 'corr', 'axy', 'config'))

  Bases: `object`

  Context manager for the temporary files needed for astrometry.

  __enter__()

    Return the filenames of the temporary files.

  __exit__(*ignored_args, **ignored_kwargs)

    Close and delete the temporary files.

  __init__(file_types=('sources', 'corr', 'axy', 'config'))

    Create all required temporary files.

autowisp.astrometry.astrometry.create_config_file(config_fname, fov_range, anet_indices)

  Create configuration file set up to solve imaves FOV in given range.

autowisp.astrometry.astrometry.create_sources_file(xy_extracted, sources_fname)

  Create a FITS BinTable file with the given name containing the extracted sources.

  Returns: an array containing x-y extracted sources

autowisp.astrometry.astrometry.estimate_transformation(*, config, **initial_corr_kwarg)

  Attempt to estimate the sky-to-frame transformation for given DR file.

autowisp.astrometry.astrometry.estimate_transformation_from_corr(initial_corr, ra_cent, dec_cent, tweak_order, astrometry_order)

  Estimate the transformation from astrometry.net correspondence file.

  Parameters:

    - initial_corr (structured numpy array) – The correspondence file containing field_x, field_y, index_ra, and index_dec

    - ra_cent (float) – Estimate of the RA of the center of the frame

    - dec_cent (float) – Estimate of the Dec of the center of the frame

    - tweak_order (int) – The order of the astrometry.net transformation

    - astrometry_order (int) – The order of the transformation that will be fit. Fills terms of higher order than tweak_order with zeros.

  Returns:

    Estimate of the transformation x(xi, eta)

    matrix:

      Estimate of the transformation y(xi, eta)

  Return type:

    matrix

autowisp.astrometry.astrometry.find_ra_dec(xieta_guess, trans_x, trans_y, radec_cent, frame_x, frame_y)

  Find the (xi, eta) that map to given coordinates in the frame.

  Parameters:

    - xieta_guess (numpy array) – Starting point for the solver trying find (xi, eta) that map to the given coordinates.

    - trans_x (numpy array) – transformation matrix for x

    - trans_y (numpy array) – transformation matrix for y

    - radec_cent (dict) – The RA and Dec of the center of the gnomonic projection defining (xi, eta).

    - frame_x (float) – x coordinate for which to find RA, Dec.

    - frame_y (float) – y coordinate for which to find RA, Dec.

  Returns:

    the new center function for (xi, eta)

  Return type:

    new_xieta_cent(numpy array)

autowisp.astrometry.astrometry.get_initial_corr(*, dr_file, xy_extracted, config, header=None, web_lock=None)

  Attempt to estimate the sky-to-frame transformation for given DR file.

autowisp.astrometry.astrometry.get_initial_corr_local(header, xy_extracted, tweak_order_range, fov_range, anet_indices)

  Get inital extracted to catalog source match using `solve-field`.

autowisp.astrometry.astrometry.get_initial_corr_web(header, xy_extracted, tweak_order_range, fov_range, api_key)

  Get initial extracted to catalog source match using web astrometry.net.

autowisp.astrometry.astrometry.refine_transformation(*, astrometry_order, max_srcmatch_distance, max_iterations, trans_threshold, trans_x, trans_y, ra_cent, dec_cent, x_frame, y_frame, xy_extracted, catalog, min_source_safety_factor=5.0)

  Iterate the process until we get a transformation that its difference from the previous one is less than a threshold

  Parameters:

    - astrometry_order (int) – The order of the transformation to fit

    - max_srcmatch_distance (float) – The upper bound distance in the KD tree

    - trans_threshold (float) – The threshold for the difference of two consecutive transformations

    - trans_x (numpy array) – Initial estimate for the x transformation matrix

    - trans_y (numpy array) – Initial estimate for the x transformation matrix

    - ra_cent (float) – Initial estimate for the RA of the center of the frame

    - dec_cent (float) – Initial estimate for the Dec of the center of the frame

    - x_frame (float) – length of the frame in pixels

    - y_frame (float) – width of the frame in pixels

    - xy_extracted (structured numpy array) – x and y of the extracted sources of the frame

    - catalog (pandas.DataFrame) – The catalog of sources to match to

  Returns:

    the coefficients of the x(xi, eta) transformation

    trans_y(2D numpy array):

      the coefficients of the y(xi, eta) transformation

    cat_extracted_corr(structured numpy array):

      the catalogs extracted correspondence indexes

    res_rms(float): the residual

    ratio(float): the ratio of matched to unmatched

    ra_cent(float): the new RA center array

    dec_cent(float): the new Dec center array

  Return type:

    trans_x(2D numpy array)

autowisp.astrometry.astrometry.transformation_matrix(astrometry_order, xi, eta)

  Constructs the transformation matrix for a given astrometry order.

  Parameters:

    - astrometry_order (int) – The order of the transformation to fit

    - xi (numpy.ndarray) – from projected coordinates

    - eta (numpy.ndarray) – from projected coordinates

  Returns:

    transformation matrix

  Return type:

    trans_matrix(numpy.ndarray)

  Notes

  Ex: for astrometry_order 2: 1, xi, eta, xi^2, xi*eta, eta^2