arfgen spectrumset=spectrum.ds badpixlocation=myevents.ds
The bad pixel information is, at least initially, stored in the event files.
By default the code looks for pixels which fall outside the CCD collecting area and outside the field-of-view with a resolution of 2 arcseconds if the extendedsource parameter is set and 0.5 arcseconds for a point source. In some cases, for example if the majority of the source region lies outside the field of view, or a significant fraction of the counts from a point source fall within a chip gap, then this resolution is too coarse. It may be changed by:
arfgen spectrumset=spectrum.ds badpixlocation=myevents.ds badpixelresolution=1.0
which improves the accuracy of the bad pixel calculation for an extended source. The downside is that an increased resolution will cause the execution time of the code to increase substantially.