  A likelihood-based method for measuring weak gravitational lensing shear in
deep galaxy surveys is described and applied to the Canada-France-Hawaii
Telescope (CFHT) Lensing Survey (CFHTLenS). CFHTLenS comprises 154 sq deg of
multicolour optical data from the CFHT Legacy Survey, with lensing measurements
being made in the i' band to a depth i'(AB)<24.7, for galaxies with
signal-to-noise ratio greater than about 10. The method is based on the lensfit
algorithm described in earlier papers, but here we describe a full analysis
pipeline that takes into account the properties of real surveys. The method
creates pixel-based models of the varying point spread function (PSF) in
individual image exposures. It fits PSF-convolved two-component (disk plus
bulge) models, to measure the ellipticity of each galaxy, with bayesian
marginalisation over model nuisance parameters of galaxy position, size,
brightness and bulge fraction. The method allows optimal joint measurement of
multiple, dithered image exposures, taking into account imaging distortion and
the alignment of the multiple measurements. We discuss the effects of noise
bias on the likelihood distribution of galaxy ellipticity. Two sets of image
simulations that mirror the observed properties of CFHTLenS have been created,
to establish the method's accuracy and to derive an empirical correction for
the effects of noise bias.
