import copy


def injected_cube_position(example_dataset_ifs_crop):
    """
    Inject a fake companion into an example cube.

    Parameters
    ----------
    example_dataset_ifs_crop : fixture
        Taken automatically from ``conftest.py``.

    Returns
    -------
    dsi : VIP Dataset
    injected_position_yx : tuple(y, x)

    """
    dsi = copy.copy(example_dataset_ifs_crop)
    # we chose a shallow copy, as we will not use any in-place operations
    # (like +=). Using `deepcopy` would be safer, but consume more memory.

    gt = (30, 0, 50)  # flux of 50 in all channels
    dsi.inject_companions(gt[2], rad_dists=gt[0], theta=gt[1])

    return dsi, dsi.injections_yx[0], gt