1. A method for detecting defects in a semiconductor sample having a plurality of identically designed areas, the method comprising: using an inspection tool to construct an initial focus trajectory for a first swath of the sample; using the inspection tool to scan the first swath by following the initial focus trajectory for the first swath while collecting autofocus data; generating a z offset measurement vector for each identically designed area in the first swath based on the autofocus data; and constructing a corrected z offset vector for inspection of the first swath with the inspection tool, wherein constructing the corrected z offset vector is based on combining the z offset measurement vectors for two or more of the identically designed areas in the first swath so that the corrected z offset vector specifies a same z offset for each set of same positions in the two or more identically designed areas.