Another useful routine is chi_junk, which will change the OBJECT keyword in the FITS header of a file to junk if that's what it is. This is useful so that if it's a crappy file, it won't be used for a wavelength solution, flat-fielding, median bias removal, or for actual science if there's something wrong with it. chi_junk has a couple handy keywords to remake other files, which will then also show the file as junk. An example of this routine is a file I junked on 130907. Observation 1000 was supposed to be a ThAr exposure, but the ThAr lamp wasn't actually in. I added some logic to the reduction code so that it'll stop if one of these sneaks by. To junk this bad exposure, you can use chi_junk as shown below:

IDL>chi_junk, date='130907', seqnum='1000', reason='No thar lamp in.', /logmaker, /chi_quality

This junks observation number 1000 from the date 130907. It adds a FITS keyword REASON that says the reason the exposure was junked for future reference, and then runs the logmaker program, which will regenerate the nightly logsheet with "junk" as the object name. This is important because the logsheet is used by the reduction code and barycode, so if the logsheet isn't regenerated, it will still try to process that observation as a ThAr and end up having the same problem as before junking it. Finally, it recreates a log data structure and the quality control page to reflect that this observation has been junked. The log structure is used by the reduction code, the Doppler code, and analysis code later on.