def grid_spacing(density_file_name):
    """
    This function extracts the spacing of points in each axis of the grid
    from a .dx file type.
    Parameters
    ------------------
    density_file_name : string
        This input is the full path of the .dx file from which to get data.
    Returns
    ------------------
    dx : float
        This output is the grid spacing in the x-direction.

    dy : float
        This output is the grid spacing in the y-direction.

    dz : float
        This output is the grid spacing in the z-direction.
    """

    file_handle = open(density_file_name, mode='r')
    xline = file_handle.readlines()[2]
    dx = float(xline.split()[1])

    file_handle = open(density_file_name, mode='r')
    yline = file_handle.readlines()[3]
    dy = float(yline.split()[2])

    file_handle = open(density_file_name, mode='r')
    zline = file_handle.readlines()[4]
    dz = float(zline.split()[3])

    return dx, dy, dz