"""
VIS Instrument Model
====================

The file provides a function that returns VIS related information such as pixel
size, dark current, gain, zeropoint, and sky background.

:requires: NumPy
:requires: numexpr

:version: 0.7
"""
# import matplotlib
# import matplotlib.pyplot as plt
# import datetime, math
# import numpy as np
# import numexpr as ne


def MCIinformation():
    """
    Returns a dictionary describing MCI CCD. The following information is provided (id: value - reference)::

        
         dob: 0 - CDM03 (Short et al. 2010)
         fwc: 90000 - CCD spec EUCL-EST-RS-6-002 (for CDM03)      
         rdose: 30000000000.0 - derived (above the PLM requirement)
         sfwc: 730000.0 - CDM03 (Short et al. 2010), see also the CCD spec EUCL-EST-RS-6-002       
         st: 5e-06 - CDM03 (Short et al. 2010)        
         svg: 1e-10 - CDM03 (Short et al. 2010)
         t: 0.01024 - CDM03 (Short et al. 2010)
         trapfile: cdm_euclid.dat - CDM03 (derived, refitted to CCD204 data)
         vg: 6e-11 - CDM03 (Short et al. 2010)
         vth: 11680000.0 - CDM03 (Short et al. 2010)



    :return: instrument model parameters
    :rtype: dict
    """

    #########################################################################################################
    out=dict()
    out.update({'dob' : 0, 'rdose' : 8.0e9,
                'parallelTrapfile' : 'cdm_euclid_parallel.dat', 'serialTrapfile' : 'cdm_euclid_serial.dat',
                'beta_s' : 0.6, 'beta_p': 0.6, 'fwc' : 90000, 'vth' : 1.168e7, 't' : 20.48e-3, 'vg' : 6.e-11,
                'st' : 5.0e-6, 'sfwc' : 730000., 'svg' : 1.0e-10})

    return out


def CCDnonLinearityModel(data, beta=6e-7):
    """   

    The non-linearity is modelled based on the results presented. 
    :param data: data to which the non-linearity model is being applied to
    :type data: ndarray

    :return: input data after conversion with the non-linearity model
    :rtype: float or ndarray
    """
    out = data-beta*data**2
    
    return out
###################################################################

if __name__ == '__main__':
    print()
