import torch


def vectors_to_torch(vectors):
    """Convert numpy arrays in a vectors dictionary to torch double format.

    Args:
        vectors (:obj:`dict`): vectors dictionary as specified by s3dxrd.measurements.Id11.peaks_to_vectors()
    
    Returns:
        (:obj:`dict`): dictionary with same fields as ```vectors``` but with torch tensors replacing
            numby arrays.
    """
    vectors["Y"]      =  torch.from_numpy(vectors["Y"]).double()
    vectors["entry"]  =  torch.from_numpy(vectors["entry"]).double()
    vectors["exit"]   =  torch.from_numpy(vectors["exit"]).double()
    vectors["nhat"]   =  torch.from_numpy(vectors["nhat"]).double()
    vectors["kappa"]  =  torch.from_numpy(vectors["kappa"]).double()
    vectors["L"]      =  torch.from_numpy(vectors["L"]).double()
    vectors["nsegs"]  =  torch.from_numpy(vectors["nsegs"]).double()
    vectors["sig_m"]  =  torch.from_numpy(vectors["sig_m"]).double()
    return vectors