An IR camera is used to image an IC to identify hot spots. The objective of the IR camera is removed and laser optics are inserted into the optical axis of the system. A laser is then used to ablate the encapsulation in a defined area around the optical axis. The IR camera operates in a lock-in mode to obtain phase information of the IR signal from the IC. The phase information is used to obtain a depth estimate of the defect. Predetermined etch rates are then used in conjunction with the depth estimate to generate a timed end-point for the laser ablation.