While calibrating the image, we decompand it first. During this operation, input data is of 8 bits which is then changed to 12 bits. So, our storage dtype changes to uint16 from uint8.
Now, Line 139 saves data with the dtype of the input data, there we need to check dtype for the data which is to be written.