Data normalization

Uses
- White-light images of the sun
- Data files
- Functions
- Python code

Step
dataNormalization : file(whiteLightImage) whiteLightImage
is implemented by the following Python code:

fits_image_file_name = input

import fitsio

fits_image_file = fitsio.FITS(fits_image_file_name)
fits_image_file.update_hdu_list()
images = [hdu for hdu in fits_image_file.hdu_list
          if hdu.has_data() and hdu.get_info()['hdutype'] == fitsio.IMAGE_HDU]
assert(len(images) == 1)
raw_image = images[0].read()

bits_used = np.bitwise_or.reduce(raw_image.flat)
if np.bitwise_and(bits_used, 0x1000) != 0:
    raw_image = np.right_shift(raw_image, 3)
    bits_used = np.bitwise_or.reduce(raw_image.flat)
if np.bitwise_and(bits_used, 0x1000) != 0:
    print("Image ", input_file_name, " uses more than 12 bits/pixel")
    raise ValueError()

if raw_image.shape == (2048, 2048):
    raw_image.shape = (1024, 2, 1024, 2)
    raw_image = np.right_shift(raw_image.sum(1).sum(2), 2)
if raw_image.shape != (1024, 1024):
    print("Image size for ", fits_image_file_name, ": ", raw_image.shape)
    raise ValueError()

output = raw_image