def _get_p_y_z_halfspace(particles):
    """
    This function calcualtes the probabilities of y and z half space
    for a given set of particles

    Parameters
    ----------
    particles : list
        List of SourceParticle

    Returns
    -------
    p_y_halfspace : float
        The probability of y half space
    p_z_halfspace : float
        The probability of z half space
    """
    y_count, z_count = 0, 0
    for s in particles:
        if s.y < 0.5:
            y_count = y_count + 1
        if s.z < 0.5:
            z_count = z_count + 1
    p_y_halfspace = float(y_count) / len(particles)
    p_z_halfspace = float(z_count) / len(particles)
    return p_y_halfspace, p_z_halfspace