UFO_add_bad_pixel_mask_to_base_mask.py This program inserts bad pixel mask from a file (e.g., 'bad_pixel_mask.bmp') into a UFO Capture mask file. The new mask file will be saved with an extension '+badpixmask.bmp' in the directory of the original mask file. If the original mask file was 'MyMask.bmp' the the new file will be 'MyMask+badpixmask.bmp'. All actions will be logged in the log file 'logfile_UFO_add_bad_pixel_mask_to_base_mask.txt' in the directory of the original mask file. Usage: If python is integrated in your system, you can run this module from a consol/command window or from a batch file simply by typing UFO_add_bad_pixel_mask_to_base_mask.py [C:\full\path\to\UFOCapture_mask_file.bmp C:\full\path\to\bad_pixel_mask.bmp] If optional command line arguments are omitted the code runs interactively. Just run the module and answer the questions. The program will ask first for the full path and name of the mask file to be converted. Then the program asks for the full path and name of the file which contains the bad pixel mask (usually named 'bad_pixel_mask.bmp') Note: This code has been written and tested under python 2.7.6 This code was built using the datetime and pillow (2.4.0) packages Runtime environment: This program was written using WinPython-32bit-2.7.6.4. This distribution runs under Windows XP and above. The latest Windows distribution it was tested on was Windows 7. WinPython-32bit-2.7.6.4 contains all necessary components to run this code. If you want to integrate python from this distribution in your system, run 'WinPython Control Panel.exe' after installation, and select the menu item 'Advanced'=> 'Register distribution...' Concept: A mask file can be set in UFO Capture to exclude areas from event detection. This code serves to add the mask of bad pixels to such mask files so that those pixels will be masked also in ...M.bmp files generated for each record. Bad pixel mask files are a black and white BMP images with unwanted (bad) pixels in white. The size of the image must match the size of the mask file to be converted. Information in UFO Capture mask files: Masked pixels have RGB values (255,0,0). Otherwise the pixel is not masked. Processing of the UFO Capture mask file: To mask a pixel, its RGB value is set to (255,0,0). Tested on UFO Capture versions 2.22, 2.24