A weighted analysis to improve the X-ray polarization sensitivity of IXPE