Commit 6326829d authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update setup.py

parent 97ee4bb5
Loading
Loading
Loading
Loading
Loading
+56 −60
Original line number Original line Diff line number Diff line
@@ -18,24 +18,26 @@ The approximate sequence of events in the simulator is as follows:
   detector characteristics (bias, dark and readout noise, gain,
   detector characteristics (bias, dark and readout noise, gain,
   plate scale and pixel scale, oversampling factor, exposure time etc.).
   plate scale and pixel scale, oversampling factor, exposure time etc.).
#. Read in another file containing charge trap definitions (for CTI modelling).
#. Read in another file containing charge trap definitions (for CTI modelling).
      #. Read in a file defining the cosmic rays (trail lengths and cumulative distributions).
#. Read in a file defining the cosmic rays (trail lengths and
cumulative distributions).
#. Read in CCD offset information, displace the image, and modify
#. Read in CCD offset information, displace the image, and modify
   the output file name to contain the CCD and quadrant information
   the output file name to contain the CCD and quadrant information
#. Load the wavefront aberration data used to calculate PSF with defined
 wavelength and field of view.


#. Loop over the number of exposures to co-add and for each object in the
object catalog:


      #. Load the wavefront aberration data used to calculate PSF with defined wavelength and field of view.
  * determine the number of electrons an object should have by scaling the
      
object's magnitude
      #. Loop over the number of exposures to co-add and for each object in the object catalog:

            * determine the number of electrons an object should have by scaling the object's magnitude
with the given zeropoint and exposure time.
with the given zeropoint and exposure time.
  * determine whether the object lands on to the detector or not and if it is
  * determine whether the object lands on to the detector or not and if it is
a star or an extended source (i.e. a galaxy).
a star or an extended source (i.e. a galaxy).
            * if object is extended determine the size (using a size-magnitude relation) and scale counts,
  * if object is extended determine the size (using a size-magnitude relation)
              convolve with the PSF, and finally overlay onto the detector according to its position.
  and scale counts, convolve with the PSF, and finally overlay onto the
            * if object is a star, scale counts according to the derived
  detector according to its position.
              scaling (first step), and finally overlay onto the detector according to its position.
  * if object is a star, scale counts according to the derived scaling
            * add a ghost of image of the object (scaled to the peak pixel of the object) [optional].
 (first step), and finally overlay onto the detector according to its position.


#. Apply calibration unit flux to mimic flat field exposures [optional].
#. Apply calibration unit flux to mimic flat field exposures [optional].
#. Apply a multiplicative flat-field map to emulate pixel-to-pixel non-uniformity [optional].
#. Apply a multiplicative flat-field map to emulate pixel-to-pixel non-uniformity [optional].
@@ -1389,14 +1391,20 @@ class IFSsimulator():
        else:
        else:
            ss = '_'
            ss = '_'


        # if currentpath =='/home/yan/IFS':
        if self.information['dir_path']=='/nfsdata/share/simulation-unittest/ifs_sim/':                        
            self.result_path = self.information['dir_path']+'ifs_sim_result/'+self.source+ss+result_day
        else:

            home_path = os.environ['HOME']

            if home_path == '/home/yan':

                self.result_path = '../IFS_simData_'+self.source+ss+result_day
            else:
                self.result_path = '/data/ifspip/CCD_ima/IFS_simData_'+self.source+ss+result_day
                
                
        #     self.result_path='../IFS_simData_'+self.source+ss+result_day


        # else:
        #     self.result_path='/data/ifspip/CCD_ima/IFS_simData_'+self.source+ss+result_day
        
        
        self.result_path = self.information['dir_path']+'ifs_sim_result/'+self.source+ss+result_day


        if os.path.isdir(self.result_path) == False:
        if os.path.isdir(self.result_path) == False:
            os.mkdir(self.result_path)
            os.mkdir(self.result_path)
@@ -5020,16 +5028,10 @@ class IFSsimulator():
        self.log.info('Finished the ith_Exposure = %i' % (simnumber))
        self.log.info('Finished the ith_Exposure = %i' % (simnumber))
# print('The iLoop= % d simlaiton finished. ' %simnumber)
# print('The iLoop= % d simlaiton finished. ' %simnumber)


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


def runIFSsim(sourcein, configfile, iLoop, applyhole='no'):
def runIFSsim(sourcein, configfile, iLoop, applyhole='no'):


    # opts, args = processArgs()

    # opts.configfile = configfile

    simulate = dict()
    simulate = dict()
    simulate[iLoop] = IFSsimulator(configfile)
    simulate[iLoop] = IFSsimulator(configfile)


@@ -5040,12 +5042,6 @@ def runIFSsim(sourcein, configfile, iLoop, applyhole='no'):


    dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/')
    dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/')
    simulate[iLoop].information['dir_path'] = dir_path
    simulate[iLoop].information['dir_path'] = dir_path

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



    ##############
    simulate[iLoop].simulate(sourcein, iLoop)
    simulate[iLoop].simulate(sourcein, iLoop)


    return 1
    return 1