Sometimes there are very few or hardly any stars in some images, and so the images are not very amenable to the use of the stellar daofind-based software for the built-in tweakreg source detection and measurement. In cases where there are many galaxies, however, software such as SExtractor, a package which is widely-used in the extragalactic community, may be used to generate external catalogs which can then be fed to tweakreg to improve alignments. Major differences in this method include the fact that the DQ arrays are not used in SExtractor, so you need to make CR-cleaned images first rather than relying on the ability to exclude objects based on the DQ flag values as you can do with the built-in task imagefindpars.
Making cr-clean.fits images involves an iterative process whereby you first combine images that are most likely to be nearly aligned already based on their wcs info and the fact that they were taken both in the same visit (on the same guide star acquisition) and in the same filter. Once you align images taken in the same visit + same filter combination, you will have cr-clean.fits images of the sort necessary for running SExtractor and getting better results, since SExtractor does not do well with images still containing lots of cosmic rays, whether they are in otherwise empty areas of the images or they are superimposed on the objects in the image. Other factors within SExtractor itself which can help determine and improve the accuracy of the results are minimum object sizes, the size of typical objects in the images relative to the size of the blocks in the "mesh" used to measure the sky background, the sigma level of thresholds for the object detection and measurement, the use of perhaps a smaller number of the brightest objects, the use of objects with the most consistent and simplest, more nuclear-concentrated morphology across all the bandpasses, and the use of weight images to give preference in the measurement sample of objects to those which have higher S/N by virtue of being in areas where more images overlap or where fewer pixels have been hit by cosmic rays or contain bad pixels which have been thrown out of the stack, so that the signal level is the highest. This latter factor is not included in these most simple of examples, but is discussed more in Frontier Fields documentation and scripts, for example.
In this simplest of examples, we employ mostly default parameters in both SExtractor and tweakreg to achieve a rough accuracy of about ~0.15 pixels rms. Better results may be possible with more involved and refined techniques and parameter values.
UNIX > sex -catalog_name j8xi0xs0q_crclean_ext1.cat -checkimage_name j8xi0xs0q_crclean_ext1_check.fits j8xi0xs0q_crclean.fits'' UNIX > sex -catalog_name j8xi0xs0q_crclean_ext4.cat -checkimage_name j8xi0xs0q_crclean_ext4_check.fits j8xi0xs0q_crclean.fits''
UNIX> awk '($1 !~ /#/ && $1>100 && $1<3996 && $2>100 && $2<1948)' j8xi0xs0q_crclean_ext1.cat > j8xi0xs0q_crclean_trimv1_ext1.cat