Commit 07cc70ef authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update

parent 60009e75
Loading
Loading
Loading
Loading
Loading
+48 −187
Original line number Diff line number Diff line
@@ -2335,57 +2335,22 @@ class IFSsimulator():
        """

        self.log.info('Added dark current to bule and red channel')

        if self.information['dark1_b'] < 0.0001 or self.information['dark1_b'] > 0.001:
            self.log.error(
                'dark1_b value error, it shoub be in [0.0001, 0.001]!')
            raise ValueError(
                'dark1_b value error, it shoub be in [0.0001, 0.001]!')

        if self.information['dark2_b'] < 0.0001 or self.information['dark2_b'] > 0.001:
            self.log.error(
                'dark2_b value error, it shoub be in [0.0001, 0.001]!')
            raise ValueError(
                'dark2_b value error, it shoub be in [0.0001, 0.001]!')

        if self.information['dark3_b'] < 0.0001 or self.information['dark3_b'] > 0.001:
            self.log.error(
                'dark3_b value error, it shoub be in [0.0001, 0.001]!')
            raise ValueError(
                'dark3_b value error, it shoub be in [0.0001, 0.001]!')

        if self.information['dark4_b'] < 0.0001 or self.information['dark4_b'] > 0.001:
            self.log.error(
                'dark4_b value error, it shoub be in [0.0001, 0.001]!')
            raise ValueError(
                'dark4_b value error, it shoub be in [0.0001, 0.001]!')

        ####################################################################
        if self.information['dark1_r'] < 0.0001 or self.information['dark1_r'] > 0.001:
            self.log.error(
                'dark1_r value error, it shoub be in [0.0001, 0.001]!')
            raise ValueError(
                'dark1_r value error, it shoub be in [0.0001, 0.001]!')

        if self.information['dark2_r'] < 0.0001 or self.information['dark2_r'] > 0.001:
        checkV = (self.information['dark1_b'] < 0.0001 or self.information['dark1_b'] > 0.001
                  or self.information['dark2_b'] < 0.0001 or self.information['dark2_b'] > 0.001
                  or self.information['dark3_b'] < 0.0001 or self.information['dark3_b'] > 0.001
                  or self.information['dark4_b'] < 0.0001 or self.information['dark4_b'] > 0.001
                  or self.information['dark1_r'] < 0.0001 or self.information['dark1_r'] > 0.001
                  or self.information['dark2_r'] < 0.0001 or self.information['dark2_r'] > 0.001
                  or self.information['dark3_r'] < 0.0001 or self.information['dark3_r'] > 0.001
                  or self.information['dark4_r'] < 0.0001 or self.information['dark4_r'] > 0.001)

        if checkV:
            self.log.error(
                'dark2_r value error, it shoub be in [0.0001, 0.001]!')
                'dark value error, it shoub be in [0.0001, 0.001]!')
            raise ValueError(
                'dark2_r value error, it shoub be in [0.0001, 0.001]!')
                'dark value error, it shoub be in [0.0001, 0.001]!')

        if self.information['dark3_r'] < 0.0001 or self.information['dark3_r'] > 0.001:
            self.log.error(
                'dark3_r value error, it shoub be in [0.0001, 0.001]!')
            raise ValueError(
                'dark3_r value error, it shoub be in [0.0001, 0.001]!')

        if self.information['dark4_r'] < 0.0001 or self.information['dark4_r'] > 0.001:
            self.log.error(
                'dark4_r value error, it shoub be in [0.0001, 0.001]!')
            raise ValueError(
                'dark4_r value error, it shoub be in [0.0001, 0.001]!')
        # #################################################################

        # blue zone 4
        self.image_b[0:1024, 0:2048] += self.information['exptime'] * \
            self.information['dark2_b']
@@ -2616,56 +2581,20 @@ class IFSsimulator():
        average=0.0 and std=readout noise.
        """
        self.log.info('readnoise added in blue channel')

        if self.information['rn1_b'] > 10 or self.information['rn1_b'] < 3:
            self.log.error(
                'rn1_b value error, it shoub be in [3, 10]!')
            raise ValueError(
                'rn1_b value error, it shoub be in [3, 10]!')

        if self.information['rn2_b'] > 10 or self.information['rn2_b'] < 3:
            self.log.error(
                'rn2_b value error, it shoub be in [3, 10]!')
            raise ValueError(
                'rn2_b value error, it shoub be in [3, 10]!')

        if self.information['rn3_b'] > 10 or self.information['rn3_b'] < 3:
            self.log.error(
                'rn3_b value error, it shoub be in [3, 10]!')
            raise ValueError(
                'rn3_b value error, it shoub be in [3, 10]!')

        if self.information['rn4_b'] > 10 or self.information['rn4_b'] < 3:
            self.log.error(
                'rn4_b value error, it shoub be in [3, 10]!')
            raise ValueError(
                'rn4_b value error, it shoub be in [3, 10]!')

        ####################################################################
        if self.information['rn1_r'] > 10 or self.information['rn1_r'] < 3:
            self.log.error(
                'rn1_r value error, it shoub be in [3, 10]!')
            raise ValueError(
                'rn1_r value error, it shoub be in [3, 10]!')

        if self.information['rn2_r'] > 10 or self.information['rn2_r'] < 3:
            self.log.error(
                'rn2_r value error, it shoub be in [3, 10]!')
            raise ValueError(
                'rn2_r value error, it shoub be in [3, 10]!')

        if self.information['rn3_r'] > 10 or self.information['rn3_r'] < 3:
            self.log.error(
                'rn3_r value error, it shoub be in [3, 10]!')
            raise ValueError(
                'rn3_r value error, it shoub be in [3, 10]!')

        if self.information['rn4_r'] > 10 or self.information['rn4_r'] < 3:
        checkV = (self.information['rn1_b'] > 10 or self.information['rn1_b'] < 3
                  or self.information['rn2_b'] > 10 or self.information['rn2_b'] < 3
                  or self.information['rn3_b'] > 10 or self.information['rn3_b'] < 3
                  or self.information['rn4_b'] > 10 or self.information['rn4_b'] < 3
                  or self.information['rn1_r'] > 10 or self.information['rn1_r'] < 3
                  or self.information['rn2_r'] > 10 or self.information['rn2_r'] < 3
                  or self.information['rn3_r'] > 10 or self.information['rn3_r'] < 3
                  or self.information['rn4_r'] > 10 or self.information['rn4_r'] < 3)

        if checkV:
            self.log.error(
                'rn4_r value error, it shoub be in [3, 10]!')
                'rn value error, it shoub be in [3, 10]!')
            raise ValueError(
                'rn4_r value error, it shoub be in [3, 10]!')
        # 33
                'rn value error, it shoub be in [3, 10]!')

        # blue zone 1
        np.random.seed()
@@ -2785,53 +2714,20 @@ class IFSsimulator():
        """
        Convert from electrons to ADUs using the value read from the configuration file.
        """
        if self.information['gain1_b'] > 2 or self.information['gain1_b'] < 1:
            self.log.error(
                'gain1_b value error, it shoub be in [1, 2]!')
            raise ValueError(
                'gain1_b value error, it shoub be in [1, 2]!')

        if self.information['gain2_b'] > 2 or self.information['gain2_b'] < 1:
            self.log.error(
                'gain2_b value error, it shoub be in [1, 2]!')
            raise ValueError(
                'gain2_b value error, it shoub be in [1, 2]!')

        if self.information['gain3_b'] > 2 or self.information['gain3_b'] < 1:
            self.log.error(
                'gain3_b value error, it shoub be in [1, 2]!')
            raise ValueError(
                'gain3_b value error, it shoub be in [1, 2]!')

        if self.information['gain4_b'] > 2 or self.information['gain4_b'] < 1:
            self.log.error(
                'gain4_b value error, it shoub be in [1, 2]!')
            raise ValueError(
                'gain4_b value error, it shoub be in [1, 2]!')

        ####################################################################
        if self.information['gain1_r'] > 2 or self.information['gain1_r'] < 1:
            self.log.error(
                'gain1_r value error, it shoub be in [1, 2]!')
            raise ValueError(
                'gain1_r value error, it shoub be in [1, 2]!')
        checkV = (self.information['gain1_b'] > 2 or self.information['gain1_b'] < 1
                  or self.information['gain2_b'] > 2 or self.information['gain2_b'] < 1
                  or self.information['gain3_b'] > 2 or self.information['gain3_b'] < 1
                  or self.information['gain4_b'] > 2 or self.information['gain4_b'] < 1
                  or self.information['gain1_r'] > 2 or self.information['gain1_r'] < 1
                  or self.information['gain2_r'] > 2 or self.information['gain2_r'] < 1
                  or self.information['gain3_r'] > 2 or self.information['gain3_r'] < 1
                  or self.information['gain4_r'] > 2 or self.information['gain4_r'] < 1)

        if self.information['gain2_r'] > 2 or self.information['gain2_r'] < 1:
        if checkV:
            self.log.error(
                'gain2_r value error, it shoub be in [1, 2]!')
                'gain value error, it shoub be in [1, 2]!')
            raise ValueError(
                'gain2_r value error, it shoub be in [1, 2]!')

        if self.information['gain3_r'] > 2 or self.information['gain3_r'] < 1:
            self.log.error(
                'gain3_r value error, it shoub be in [1, 2]!')
            raise ValueError(
                'gain3_r value error, it shoub be in [1, 2]!')

        if self.information['gain4_r'] > 2 or self.information['gain4_r'] < 1:
            self.log.error(
                'gain4_r value error, it shoub be in [1, 2]!')
            raise ValueError('gain4_r value error, it shoub be in [1, 2]!')
                'gain value error, it shoub be in [1, 2]!')
        ####################################################################

        self.log.info(
@@ -2896,55 +2792,20 @@ class IFSsimulator():
        in the information dictionary (key bias).
#
        """
        checkV = (self.information['bias1_b'] > 2000 or self.information['bias1_b'] < 100
                  or self.information['bias2_b'] > 2000 or self.information['bias2_b'] < 100
                  or self.information['bias3_b'] > 2000 or self.information['bias3_b'] < 100
                  or self.information['bias4_b'] > 2000 or self.information['bias4_b'] < 100
                  or self.information['bias1_r'] > 2000 or self.information['bias1_r'] < 100
                  or self.information['bias2_r'] > 2000 or self.information['bias2_r'] < 100
                  or self.information['bias3_r'] > 2000 or self.information['bias3_r'] < 100
                  or self.information['bias4_r'] > 2000 or self.information['bias4_r'] < 100
                  
        if self.information['bias1_b'] > 2000 or self.information['bias1_b'] < 100:
            self.log.error(
                'bias1_b value error, it shoub be in [100, 2000]!')
            raise ValueError(
                'bias1_b value error, it shoub be in [100, 2000]!')

        if self.information['bias2_b'] > 2000 or self.information['bias2_b'] < 100:
            self.log.error(
                'bias2_b value error, it shoub be in [100, 2000]!')
            raise ValueError(
                'bias2_b value error, it shoub be in [100, 2000]!')

        if self.information['bias3_b'] > 2000 or self.information['bias3_b'] < 100:
            self.log.error(
                'bias3_b value error, it shoub be in [100, 2000]!')
            raise ValueError(
                'bias3_b value error, it shoub be in [100, 2000]!')

        if self.information['bias4_b'] > 2000 or self.information['bias4_b'] < 100:
            self.log.error(
                'bias4_b value error, it shoub be in [100, 2000]!')
            raise ValueError(
                'bias4_b value error, it shoub be in [100, 2000]!')

        ####################################################################
        if self.information['bias1_r'] > 2000 or self.information['bias1_r'] < 100:
            self.log.error(
                'bias1_r value error, it shoub be in [100, 2000]!')
            raise ValueError(
                'bias1_r value error, it shoub be in [100, 2000]!')

        if self.information['bias2_r'] > 2000 or self.information['bias2_r'] < 100:
            self.log.error(
                'bias2_r value error, it shoub be in [100, 2000]!')
            raise ValueError(
                'bias2_r value error, it shoub be in [100, 2000]!')

        if self.information['bias3_r'] > 2000 or self.information['bias3_r'] < 100:
            self.log.error(
                'bias3_r value error, it shoub be in [100, 2000]!')
            raise ValueError(
                'bias3_r value error, it shoub be in [100, 2000]!')

        if self.information['bias4_r'] > 2000 or self.information['bias4_r'] < 100:
        if checkV:
            self.log.error(
                'bias4_r value error, it shoub be in [100, 2000]!')
                'bias value error, it shoub be in [100, 2000]!')
            raise ValueError(
                'bias4_r value error, it shoub be in [100, 2000]!')
                'bias value error, it shoub be in [100, 2000]!')

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