コード例 #1
0
    def setUpClass(cls):
        temp = '/STER/mercator/hermes/%s/reduced/%s_HRF_OBJ_ext_CosmicsRemoved_log_merged_c.fits'
        objlist = [('20090619', '237033'), ('20090701', '240226'),
                   ('20090712', '241334'), ('20090712', '241335'),
                   ('20100107', '00268012'), ('20100120', '00272619'),
                   ('20100120', '00272620'), ('20100203', '00273577'),
                   ('20100203', '00273578'), ('20100303', '00275671'),
                   ('20100303', '00275672'), ('20100410', '00281505'),
                   ('20100519', '00284636'), ('20110222', '00334558'),
                   ('20110319', '00336547'), ('20110324', '00339848'),
                   ('20110401', '00342273'), ('20110402', '00342363'),
                   ('20110406', '00342699'), ('20110408', '00342896'),
                   ('20120107', '00391289'), ('20120110', '00391633'),
                   ('20120116', '00392217'), ('20120127', '00393151'),
                   ('20120209', '00394175'), ('20120330', '00399697'),
                   ('20120420', '00404769'), ('20120506', '00406531'),
                   ('20130106', '00445346'), ('20130215', '00452556'),
                   ('20130406', '00457718'), ('20130530', '00474128')]
        mergeList = [temp % o for o in objlist]

        waves, fluxes = [], []
        for ifile in mergeList:
            w, f = fits.read_spectrum(ifile)
            f = f[(w > 5000) & (w < 7000)]
            w = w[(w > 5000) & (w < 7000)]
            waves.append(w)
            fluxes.append(f)

        wave, flux, accepted, rejected = tools.merge_cosmic_clipping(
            waves,
            fluxes,
            sigma=5.0,
            base='average',
            offset='std',
            window=51,
            runs=2,
            full_output=True)

        cls.nspek = len(objlist)
        cls.wave = wave
        cls.flux = flux
        cls.accepted = accepted
        cls.rejected = rejected
コード例 #2
0
ファイル: tools.py プロジェクト: stpstp/IvSPythonRepository
def get_response(instrument='hermes'):
    """
    Returns the response curve of the given instrument. Up till now only a HERMES 
    response cruve is available. This response curve is based on 25 spectra of the 
    single sdB star Feige 66, and has a wavelenght range of 3800 to 8000 A.
    
    @param instrument: the instrument of which you want the response curve
    @type instrument: string
    """

    basedir = 'spectables/responses/'

    if instrument == 'hermes':
        basename = 'response_Feige66.fits'

    response = config.get_datafile(basedir, basename)

    wave, flux = fits.read_spectrum(response)

    return wave, flux
コード例 #3
0
def get_response(instrument='hermes'):
    """
    Returns the response curve of the given instrument. Up till now only a HERMES 
    response cruve is available. This response curve is based on 25 spectra of the 
    single sdB star Feige 66, and has a wavelenght range of 3800 to 8000 A.
    
    @param instrument: the instrument of which you want the response curve
    @type instrument: string
    """
        
    basedir = 'spectables/responses/'
    
    if instrument == 'hermes':
        basename = 'response_Feige66.fits'
        
    response = config.get_datafile(basedir,basename)
    
    wave, flux = fits.read_spectrum(response)
        
    return wave, flux
コード例 #4
0
 def setUpClass(cls):
     temp = '/STER/mercator/hermes/%s/reduced/%s_HRF_OBJ_ext_CosmicsRemoved_log_merged_c.fits'
     objlist = [('20090619','237033'), ('20090701','240226'),
                 ('20090712','241334'), ('20090712','241335'),
                 ('20100107','00268012'), ('20100120','00272619'),
                 ('20100120','00272620'), ('20100203','00273577'),
                 ('20100203','00273578'), ('20100303','00275671'),
                 ('20100303','00275672'), ('20100410','00281505'),
                 ('20100519','00284636'), ('20110222','00334558'),
                 ('20110319','00336547'), ('20110324','00339848'),
                 ('20110401','00342273'), ('20110402','00342363'),
                 ('20110406','00342699'), ('20110408','00342896'),
                 ('20120107','00391289'), ('20120110','00391633'),
                 ('20120116','00392217'), ('20120127','00393151'),
                 ('20120209','00394175'), ('20120330','00399697'),
                 ('20120420','00404769'), ('20120506','00406531'),
                 ('20130106','00445346'), ('20130215','00452556'),
                 ('20130406','00457718'), ('20130530','00474128')]
     mergeList = [temp%o for o in objlist]
     
     waves, fluxes = [], []
     for ifile in mergeList:
         w, f = fits.read_spectrum(ifile)
         f = f[(w>5000) & (w<7000)]
         w = w[(w>5000) & (w<7000)]
         waves.append(w)
         fluxes.append(f)
      
     wave, flux, accepted, rejected = tools.merge_cosmic_clipping(waves, fluxes, sigma=5.0,
                         base='average', offset='std', window=51, runs=2, full_output=True)
     
     cls.nspek = len(objlist)
     cls.wave = wave
     cls.flux = flux
     cls.accepted = accepted
     cls.rejected = rejected
コード例 #5
0
ファイル: tools.py プロジェクト: stpstp/IvSPythonRepository
               ('20100303', '00275672'), ('20100410', '00281505'),
               ('20100519', '00284636'), ('20110222', '00334558'),
               ('20110319', '00336547'), ('20110324', '00339848'),
               ('20110401', '00342273'), ('20110402', '00342363'),
               ('20110406', '00342699'), ('20110408', '00342896'),
               ('20120107', '00391289'), ('20120110', '00391633'),
               ('20120116', '00392217'), ('20120127', '00393151'),
               ('20120209', '00394175'), ('20120330', '00399697'),
               ('20120420', '00404769'), ('20120506', '00406531'),
               ('20130106', '00445346'), ('20130215', '00452556'),
               ('20130406', '00457718'), ('20130530', '00474128')]
    mergeList = [temp % o for o in objlist]

    t1 = time.time()
    waves, fluxes = [], []
    wtotal, ftotal = fits.read_spectrum(mergeList[0])
    wtotal = wtotal[(wtotal > 5000) & (wtotal < 7000)]
    ftotal = np.zeros_like(wtotal)
    for ifile in mergeList:
        w, f = fits.read_spectrum(ifile)
        f = f[(w > 5000) & (w < 7000)]
        w = w[(w > 5000) & (w < 7000)]
        waves.append(w)
        fluxes.append(f)
        ftotal += np.interp(wtotal, w, f)
    t1 = time.time() - t1

    t2 = time.time()
    wave, flux, accepted, rejected = merge_cosmic_clipping(waves,
                                                           fluxes,
                                                           sigma=5.0,
コード例 #6
0
             ('20100303','00275672'), ('20100410','00281505'),
             ('20100519','00284636'), ('20110222','00334558'),
             ('20110319','00336547'), ('20110324','00339848'),
             ('20110401','00342273'), ('20110402','00342363'),
             ('20110406','00342699'), ('20110408','00342896'),
             ('20120107','00391289'), ('20120110','00391633'),
             ('20120116','00392217'), ('20120127','00393151'),
             ('20120209','00394175'), ('20120330','00399697'),
             ('20120420','00404769'), ('20120506','00406531'),
             ('20130106','00445346'), ('20130215','00452556'),
             ('20130406','00457718'), ('20130530','00474128')]
 mergeList = [temp%o for o in objlist]
 
 t1 = time.time()
 waves, fluxes = [], []
 wtotal, ftotal = fits.read_spectrum(mergeList[0])
 wtotal = wtotal[(wtotal>5000) & (wtotal<7000)] 
 ftotal = np.zeros_like(wtotal)
 for ifile in mergeList:
     w, f = fits.read_spectrum(ifile)
     f = f[(w>5000) & (w<7000)]
     w = w[(w>5000) & (w<7000)]
     waves.append(w)
     fluxes.append(f)
     ftotal += np.interp(wtotal,w,f)
 t1 = time.time() - t1
     
 t2 = time.time()
 wave, flux, accepted, rejected = merge_cosmic_clipping(waves, fluxes, sigma=5.0,
                       window=21, offset='std', base='average', full_output=True)
 t2 = time.time() - t2