def detxy2kxy(xdet, ydet, xstart, ystart, x0, y0, fx, fy, xstep, ystep):
    """
    Conversion from detector coordinates (xd, yd) to momentum coordinates (kx, ky).

    **Parameters**\n
    xdet, ydet: numeric, numeric
        Pixel coordinates in the detector coordinate system.
    xstart, ystart: numeric, numeric
        The starting pixel number in the detector coordinate system
        along the x and y axes used in the binning.
    x0, y0: numeric, numeric
        The center pixel position in binned image used in calibration.
    fx, fy: numeric, numeric
        Scaling factor along the x and y axes (in binned image).
    xstep, ystep: numeric, numeric
        Binning step size along x and y directions.
    """

    xdet0 = xstart + xstep * x0
    ydet0 = ystart + ystep * y0
    kx = fx * ((xdet - xdet0) / xstep)
    ky = fy * ((ydet - ydet0) / ystep)

    return (kx, ky)