The heat flux is one of the key parameter used to quantify and understand transport in fusion devices. In this paper, a new method is introduced to calculate the heat flux including its confidence with high accuracy based on perturbed measurements such as the electron temperature. The new method is based on ideal filtering to optimally reduce the noise contributions on the measurements and piece-wise polynomial approximations to calculate the time derivative. Both methods are necessary to arrive at a heat flux and effective diffusion coefficient with high accuracy. The new methodology is applied to a measurement example using electron cyclotron resonance heating block-wave modulation at the Large Helical Device showing the merit of the newly developed methodology.