Exemplo n.º 1
0
def parse_particles(data):
    """
    A function to retrieve particles ground truth points tensor
    Args:
        length 2 array of larcv::EventSparseTensor3D and larcv::EventParticle
    Return:
        a numpy array with the shape (N,3) where 3 represents (x,y,z)
        coordinate
        a numpy array with the shape (N, 1) where 1 represents class of
        the ground truth point (track vs shower).
    """
    particles_v = data[1].as_vector()
    part_info = get_ppn_info(particles_v, data[0].meta())
    if part_info.shape[0] > 0:
        return part_info[:, :-1], part_info[:, -1][:, None]
    else:
        return np.empty(shape=(0, 3),
                        dtype=np.int32), np.empty(shape=(0, 1),
                                                  dtype=np.float32)
Exemplo n.º 2
0
def parse_particle_infos(data):
    """
    A function to retrieve particles ground truth points tensor, includes
    spatial coordinates, point type and other infos (creation energy, pdg, etc)
    Args:
        length 2 array of larcv::EventSparseTensor3D and larcv::EventParticle
    Return:
        a numpy array with the shape (N,3) where 3 represents (x,y,z)
        coordinate
        a numpy array with the shape (N, C) where C represents class of
        the ground truth point + other infos.
    """
    particles_v = data[1].as_vector()
    part_info = get_ppn_info(particles_v, data[0].meta())
    if part_info.shape[0] > 0:
        return part_info[:, :3], part_info[:, 3:]
    else:
        return np.empty(shape=(0, 3),
                        dtype=np.int32), np.empty(shape=(0, 6),
                                                  dtype=np.float32)