Commit 3c8691f8 authored by Zhang Xin's avatar Zhang Xin
Browse files

add led flat file; fix a bug for led normalize

parent 446862eb
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -15,6 +15,13 @@ from scipy import interpolate
from ObservationSim.MockObject.MockObject import MockObject
# from ObservationSim.Straylight import calculateSkyMap_split_g

try:
    import importlib.resources as pkg_resources
except ImportError:
    # Try backported to PY<37 'importlib_resources'
    import importlib_resources as pkg_resources


# flatDir = '/Volumes/EAGET/LED_FLAT/'
LED_name = ['LED1', 'LED2', 'LED3', 'LED4', 'LED5', 'LED6', 'LED7', 'LED8', 'LED9', 'LED10', 'LED11', 'LED12', 'LED13',
            'LED14']
@@ -36,19 +43,27 @@ fluxLED = {'LED1': 0.16478729, 'LED2': 0.084220931, 'LED3': 2.263360617, 'LED4':
mirro_eff = {'GU':0.61, 'GV':0.8, 'GI':0.8}

class FlatLED(object):
    def __init__(self, chip,filt, flatDir = '/Users/zhangxin/Work/SlitlessSim/csst_sls_calibration/flat_field_cube/models/', logger=None):
    def __init__(self, chip,filt, flatDir = None, logger=None):
        # self.led_type_list = led_type_list
        self.flatDir = flatDir
        self.filt = filt
        self.chip = chip
        self.logger = logger
        if flatDir is not None:
            self.flatDir = flatDir
        else:
            try:
                with pkg_resources.files('ObservationSim.MockObject.data.led').joinpath("") as ledDir:
                    self.flatDir = ledDir.as_posix()
            except AttributeError:
                with pkg_resources.path('ObservationSim.MockObject.data.led', "") as ledDir:
                    self.flatDir = ledDir.as_posix()

    ###
    ### return LED flat, e/s
    ###
    def getLEDImage(self, led_type='LED1'):
        # cwave = cwaves[led_type]
        flat = fits.open(self.flatDir + 'model_' + cwaves_name[led_type] + 'nm.fits')
        flat = fits.open(os.path.join(self.flatDir, 'model_' + cwaves_name[led_type] + 'nm.fits'))
        xlen = flat[0].header['NAXIS1']
        ylen = 601
        x = np.linspace(0, self.chip.npix_x * 6, xlen)
+0 −0

Empty file added.

+185 B

File added.

No diff preview for this file type.

+5.79 MiB

File added.

No diff preview for this file type.

+5.79 MiB

File added.

No diff preview for this file type.

Loading