Commit da9116fc authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update

parent 5070c190
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -133,8 +133,8 @@ class CDM03bidir():
                  array will be laid out in memory in C-style (row-major order).

        :return: image that has been run through the CDM03 model
        :rtype: ndarray   
        """""
        :rtype: ndarray"""""
        #
        # return data

        iflip = iquadrant / 2
+48 −51
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ Note:: This class is Python 3 compatible.
2024.5.10  ---updata and correct the bug of frame transfer effect simulation

"""
######################## functions definition ################################
# ####################### functions definition #############################


class CDM03bidir():
@@ -211,8 +211,8 @@ class CDM03bidir():
                  array will be laid out in memory in C-style (row-major order).

        :return: image that has been run through the CDM03 model
        :rtype: ndarray   
        """""
        :rtype: ndarray"""""
        #
        # return data

        iflip = iquadrant / 2
@@ -333,7 +333,6 @@ def IFSinformation():

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
@@ -344,7 +343,8 @@ def CCDnonLinearityModel(data, beta=6e-7):
    out = data-beta*data**2

    return out

#
#
#############################################################################


@@ -404,14 +404,14 @@ class cosmicrays():
            self._readCosmicrayInformation()
##############################################################################

    def _cosmicRayIntercepts(self, lum, x0, y0, l, phi):
    def _cosmicRayIntercepts(self, lum, x0, y0, dl, phi):
        """
        Derive cosmic ray streak intercept points.

        :param lum: luminosities of the cosmic ray tracks
        :param x0: central positions of the cosmic ray tracks in x-direction
        :param y0: central positions of the cosmic ray tracks in y-direction
        :param l: lengths of the cosmic ray tracks
        :param dl: lengths of the cosmic ray tracks
        :param phi: orientation angles of the cosmic ray tracks

        :return: cosmic ray map (image)
@@ -421,8 +421,8 @@ class cosmicrays():
        crImage = np.zeros((self.ysize, self.xsize), dtype=np.float64)

        # x and y shifts
        dx = l * np.cos(phi) / 2.
        dy = l * np.sin(phi) / 2.
        dx = dl * np.cos(phi) / 2.
        dy = dl * np.sin(phi) / 2.
        mskdx = np.abs(dx) < 1e-8
        mskdy = np.abs(dy) < 1e-8
        dx[mskdx] = 0.
@@ -659,7 +659,7 @@ def ill2flux(path, E):

    # use template from sky_bkg (background_spec_hst.dat)
    filename = path+'IFS_inputdata/refs/background_spec_hst.dat'
    cat_spec = pd.read_csv(filename, sep='\s+', header=None, comment='#')
    cat_spec = pd.read_csv(filename, sep='\\s+', header=None, comment='#')
    wave0 = cat_spec[0].values       # A
    spec0 = cat_spec[2].values      # erg/s/cm^2/A/arcsec^2

@@ -692,7 +692,6 @@ def ill2flux(path, E):
def earth_angle(time_jd, x_sat, y_sat, z_sat, ra_obj, dec_obj):
    """
    #

    Parameters
    ----------
    time_jd : TYPE
@@ -829,7 +828,7 @@ class StrayLight(object):
    def caculateEarthShineFilter(self, filter='i'):
        """
        # 

        #
        Parameters
        ----------
        filter : TYPE, optional
@@ -1017,6 +1016,7 @@ def dt2hmd(dt):
        DESCRIPTION.

    """
    #
    # # dt is datetime
    hour = dt.hour
    minute = dt.minute
@@ -1211,17 +1211,17 @@ def LSR_velocity(ra, dec, velocity, Obstime):
    # convert ra and dec to
    source = SkyCoord(ra*u.deg, dec*u.deg, frame='icrs',
                      unit=(u.hourangle, u.deg))
    l = source.galactic.l.deg
    ll = source.galactic.l.deg
    b  = source.galactic.b.deg
    c = SkyCoord(l=l*u.degree, b=b*u.degree, frame='galactic')
    c = SkyCoord(ll=ll*u.degree, b=b*u.degree, frame='galactic')
    c_icrs = c.transform_to('icrs')
    barycorr = c_icrs.radial_velocity_correction(
        obstime=Time(Obstime), location=local)
    velocity = velocity + barycorr.value/1000
    # print(barycorr.value/1000)
    l = l * np.pi / 180
    ll = ll * np.pi / 180
    b = b * np.pi / 180
    return velocity + 9 * np.cos(l) * np.cos(b) + 12 * np.sin(l) * np.cos(b) + 7 * np.sin(b)
    return velocity + 9 * np.cos(ll) * np.cos(b) + 12 * np.sin(ll) * np.cos(b) + 7 * np.sin(b)

###############################################################################

@@ -1512,8 +1512,8 @@ def anySampledPSFnew(wavefront, pupil, Q, sizeout):
    % f is focal length;
    % pixelsize is the actural size of the detector;
    % make sure all the varia have the same unit;
    % the returned PSF has sum value of 1 
    '''
    % the returned PSF has sum value of 1 '''
    # ##

    m, n = np.shape(wavefront)

@@ -1819,22 +1819,19 @@ class IFSsimulator():
        add g r i channel images;

        Creates lensing parameters;


        """

#
#
        self.imgtemp = dict()

        self.pixel = 0.1  # arcsec, pixel scale size;


##############################################################################
##############################################################################


    def zodiacal(self, ra, dec, time):
        """


        Parameters
        ----------
        ra : TYPE
@@ -1869,6 +1866,9 @@ class IFSsimulator():
        # get solar position
        dt = datetime.fromisoformat(time)
        jd = time2jd(dt)
#
#
#
        # # jd = julian.to_jd(dt, fmt='jd')

        t = Time(jd, format='jd', scale='utc')
@@ -1889,7 +1889,7 @@ class IFSsimulator():

        # interpolated zodical surface brightness at 0.5 um
        zodi = pd.read_csv(
            self.information['dir_path']+'IFS_inputdata/refs/zodi_map.dat', sep='\s+', header=None, comment='#')
            self.information['dir_path']+'IFS_inputdata/refs/zodi_map.dat', sep='\\s+', header=None, comment='#')
        beta_angle = np.array([0, 5, 10, 15, 20, 25, 30, 45, 60, 75])
        lamda_angle = np.array([0, 5, 10, 15, 20, 25, 30, 35, 40, 45,
                                60, 75, 90, 105, 120, 135, 150, 165, 180])
@@ -1903,7 +1903,7 @@ class IFSsimulator():

        # read the zodical spectrum in the ecliptic
        cat_spec = pd.read_csv(
            self.information['dir_path']+'IFS_inputdata/refs/solar_spec.dat', sep='\s+', header=None, comment='#')
            self.information['dir_path']+'IFS_inputdata/refs/solar_spec.dat', sep='\\s+', header=None, comment='#')
        wave = cat_spec[0].values       # A
        spec0 = cat_spec[1].values      #
        zodi_norm = 252                 #
@@ -2056,7 +2056,7 @@ class IFSsimulator():
            '/'+self.source+ss+result_day
        print(self.information['result_path'])

        if os.path.isdir(self.result_path) == False:
        if os.path.isdir(self.result_path) is False:
            os.mkdir(self.result_path)
            os.mkdir(self.result_path+'/calibration_Data')
            os.mkdir(self.result_path+'/log_file')
@@ -2410,12 +2410,9 @@ class IFSsimulator():
#########################################################################


##############################################################################

    def applyDarkCurrent(self):
        """

        
        """
        Returns
        -------
        None.