Least squares estimation of nonhomogeneous poisson processes