Deriving source-time functions using principal component analysis