Example #1
0
def analyse236_HD202730(reduceData=False, bootstrap=False):
    """
    astrometric fit
    """
    files = files_236
    if reduceData:
        for f in files:
            print '#'*5, f, '#'*12
            a = prima.drs(data_directory+f)
            a.astrometryFtk(max_err_um=5, max_GD_um=3.0, sigma_clipping=3.0,
                            writeOut=True, overwrite=True, max_length_s=1.0)
            del a
            if f == '2011-08-23/PACMAN_OBJ_ASTRO_236_0007.fits':
                tmp=pyfits.open(data_directory+\
                               '/2011-08-23/PACMAN_OBJ_ASTRO_236_0007_RED.fits',
                               mode='update')
                tmp[0].header.update('HIERARCH ESO INS MODE', 'SWAPPED')
                tmp.flush()
                tmp.close()

    selection = range(len(files))
    #selection = [0,1,4,5,8,9]
    if bootstrap:
        files = [files[k] for k in selection]
        astrom.bootstrapListOfFiles(files, data_directory, N=500,
                                    fit_param  =[1,    1,    1], plot=True,
                                    first_guess=[6.0, 200.0,-3.92104],
                                    maxResidualsMas=20, multi=True)
    else:
        astrom.interpListOfFiles(files, data_directory,
                                 plot=True,
                                 fit_param  =[1,    1,    1],
                                 first_guess=[6.0, 200.0,1.0],
                                 fit_only_files=selection, maxResiduals=20 )
    return
Example #2
0
def analyse241_HD10268(reduceData=False, bootstrap=False):
    """
    astrometric fit
    """
    files = files_241_HD10268
    if reduceData:
        for f in files:
            print '#'*5, f, '#'*12
            a = prima.drs(data_directory+f)
            a.astrometryFtk(max_err_um=5, max_GD_um=3.0, sigma_clipping=4.0,
                            writeOut=True, overwrite=True, max_length_s=1.0)
            del a
    selection = range(len(files))
    selection=[0,1,2,4,5,6]
    if bootstrap:
        files = [files[k] for k in selection]
        res = astrom.bootstrapListOfFiles(files, data_directory, N=500,
                                          fit_param  =[1,    1,    1],
                                          plot=True,
                                          first_guess=[6.0, 200.0,-3.92104],
                                          maxResidualsMas=30, multi=True)
    else:
        astrom.interpListOfFiles(files, data_directory,
                                 plot=True,
                                 fit_param  =[1,    1,    1],
                                 first_guess=[6.0, 200.0,1.0],
                                 fit_only_files=selection,maxResiduals=20)
        res = []
    return res
Example #3
0
def analyse200_HD156274(reduction=False):
    """
    astrometric fit
    """

    files = files_200_HD156274
    print len(files)

    if reduction:
        for f in files:
            a = prima.drs(os.path.join(data_directory,f))
            a.astrometryFtk(writeOut=True, max_err_um=4.0, max_GD_um=3.0, 
                            correctA_B=True, overwrite=True, sigma_clipping=6.0)
            del a

    selection = [0,1,4,5,6,7,8,9,10,11,17,18,19] # normal
    
    selection = range(len(files)) # ALL files
    #selection = filter(lambda x: x!=6, selection) # merged
    #selection = filter(lambda x: x!=9, selection) # merged
    #selection = filter(lambda x: x!=20, selection) # merged

    print len(selection)
    astrom.interpListOfFiles(files, data_directory,
                             plot=True,
                             fit_param  =[1, 1, 1,      0,0,0],
                             first_guess=[8,256,5.15523,0,0,0],
                             fit_only_files=selection,
                             maxResiduals=10)
    return
Example #4
0
def analyse030(onlyAstro = True, T0=290, P0=734):
    """
    astrometric fit of the data of day 030 of 2011.

    run 'reduce030' first
    """
    global all_files030, red_directory030, env_file030, astro_files030

    if onlyAstro:
        files = astro_files030
        selection = range(len(files)) # all files
        #selection=[0,1,3,5,7,9] # ALL SWAPPED
        #selection=[2,4,6,8]     # ALL NORMAL    
    else:
        files = all_files030
        #selection = range(len(files))              # ALL FILES
        #selection = [0,1,2,3,4,5,6,7,8]            # SCAN
        #selection = [9,10,11,12,13,14,15,16,17,18] # ASTRO
        selection = [1,3,5,7,9,10,11,12,13,14,15,16,17,18] # HIGH SNR
        # --- SWAPPED ---------------------------------------
        #selection=[0,2,4,6,8,9,10,12,14,16,18] # ALL SWAPPED
        #selection=[9,10,12,14,16,18]           # ASTRO SWAPPED
        #selection=[0,2,4,6,8]                  # SCAN SWAPPED
        # --- NORMAL ----------------------------------------
        #selection=[1,3,5,7,11,13,15,17]        # ALL NORMAL
        #selection=[11,13,15,17]                # ASTRO NORMAL
        #selection=[1,3,5,7]                    # SCAN NORMAL
        
    astrom.interpListOfFiles(files, data_directory030,
                             plot=True,
                             fit_param  =[1, 1,   1,    0,1,1],
                             first_guess=[35,40.0,14.0, 0,0,0],
                             fit_only_files=selection
                             )
    return
Example #5
0
def analyse201_HD156274(reReduce=False):
    """
    astrometric fit
    STS-AT4 rotation test
    """

    files = files_201_HD156274
    print len(files)

    if reReduce:
        for f in files:
            a = prima.drs(os.path.join(data_directory,f))
            a.astrometryFtk(writeOut=True, max_GD_um = 2.0,
                            overwrite=True, max_err_um=10, sigma_clipping=5.0)
            del a
    
    selection = range(len(files)) # ALL files
    selection = filter(lambda x: x!=17, selection) # 17 has A-B overflow
    selection = filter(lambda x: x!=1, selection) # 17 has A-B overflow
    selection = filter(lambda x: x!=21, selection) # 17 has A-B overflow
    #selection = [0,1,2,3,4,5,6,7,8,9,19,20,21] # normal
    #selection = [0,1,5,9,19,20,21] # normal, no rotation
    #selection = [10,11,12,13,14,15,16,18, 22, 23] # swapped, 17 has A-B overflow
    #selection = [10,18,22,23] # swapped, no rotation
    #selection = [0,1,5,9,19,20,21,10,18,22,23]
    astrom.interpListOfFiles(files, data_directory,
                             plot=True,
                             fit_param  =[1, 1, 1,      0,0,0],
                             first_guess=[10.08,258.02,5.15523,0,0,0],
                             fit_only_files=selection,
                             maxResiduals=35)
    return
    at4 = prima.pssRecorder('/Volumes/DATA/PRIMA/COMM15/pssRecorder/pssguiRecorder_lat4fsm_2011-07-19_23-49-45.dat')
    at3 = prima.pssRecorder('/Volumes/DATA/PRIMA/COMM15/pssRecorder/pssguiRecorder_lat3fsm_2011-07-19_23-49-45.dat')
    pyplot.figure(1)
    pyplot.clf()
    pyplot.plot(at4.mjd[::10], at4.data['Dermec.[deg]'][::10],
                color='orange', linewidth=5, label='AT4 derot', alpha=0.9)
    pyplot.plot(at3.mjd[::10], at3.data['Dermec.[deg]'][::10],
                linestyle='dashed',
                color='green', linewidth=2, label='AT3 derot')
    pyplot.legend()
    pyplot.xlim(5.5762e4+0.01, 5.5762e4+0.17)
    pyplot.annotate('modulation\ncommand', xy=(5.5762e4+0.025, 108),
                    xycoords='data', size=12,
                    xytext=(5.5762e4+0.04, 120), textcoords='data',
                    arrowprops=dict(arrowstyle="->"))
    pyplot.annotate('tracking\nwrapping', xy=(5.5762e4+0.1, 160),
                    xycoords='data', size=12,
                    xytext=(5.5762e4+0.06, 150), textcoords='data',
                    arrowprops=dict(arrowstyle="->"))
    pyplot.annotate('swapping', xy=(5.5762e4+0.067, 60),
                    xycoords='data', size=12,
                    xytext=(5.5762e4+0.03, 50), textcoords='data',
                    arrowprops=dict(arrowstyle="->"))
    pyplot.xlabel('MJD')
    pyplot.ylabel('mechanical position (degrees)')
                  
    return
Example #6
0
def analyse195():
    """
    astrometric fit
    """
    files = files_195
    selection = [0,1]
    astrom.interpListOfFiles(files, data_directory,
                             plot=True,
                             fit_param  =[1,    1,    1],
                             first_guess=[8.0, -90.0,-1],
                             fit_only_files=selection)
    return
Example #7
0
def analyse238_HD10360(reduceData=False, bootstrap=False):
    """
    astrometric fit
    """
    files = files_238_10360
    if reduceData:
        for f in files:
            a = prima.drs(data_directory+f)
            print '#'*5, f, '#'*12
            a.astrometryFtk(max_err_um=2.0, max_GD_um=3.0, sigma_clipping=4.0,
                            writeOut=True, overwrite=True, max_length_s=1.0)
            del a
            a=[]

    selection = range(len(files))
    #selection = [0,1,2,3,5]
    #selection = [1,3,5]
    if bootstrap:
        files = [files[k] for k in selection]
        astrom.bootstrapListOfFiles(files, data_directory, N=500,
                                    fit_param  =[1,    1,    1], plot=True,
                                    first_guess=[6.0, 200.0,-3.92104])
    else:
        res = astrom.interpListOfFiles(files, data_directory,
                                       plot=True,quiet=False,
                                       fit_param  =[1,    1,    1],
                                       first_guess=[6.0, 200.0,-3.92104],
                                       fit_only_files=selection,
                                       maxResiduals=5)
    return
Example #8
0
def doAll(files, directory=data_directory, reduceData=False, bootstrap=False,
          selection=None, maxResiduals=None, firstGuess=[10.,90., 0.0],
          fittedParam=[1,1,1], res2fits=False):
    """
    astrometric fit
    """
    # -- data reduction
    if reduceData:
        for f in files:
            print '#'*5, f, '#'*12
            a = prima.drs(data_directory+f)
            a.astrometryFtk(max_err_um=3, max_GD_um=5.0, sigma_clipping=4.0,
                            writeOut=True, overwrite=True, max_length_s=1.0)
            a.raw.close()
            del a
            # correct a bug in this particular file
            if f == '2011-08-23/PACMAN_OBJ_ASTRO_236_0007.fits':
                tmp=pyfits.open(data_directory+\
                               '/2011-08-23/PACMAN_OBJ_ASTRO_236_0007_RED.fits',
                                mode='update')
                tmp[0].header.update('HIERARCH ESO INS MODE', 'SWAPPED')
                tmp.flush()
                tmp.close()

    # -- data fitting
    if selection is None:
        selection = range(len(files))
    if bootstrap:
        files = [files[k] for k in selection]
        t0 = time.time()
        res = astrom.bootstrapListOfFiles(files, data_directory, N=500,
                                          fit_param  =fittedParam, plot=True,
                                          first_guess=firstGuess,
                                          maxResidualsMas=maxResiduals,
                                          multi=True)
        print 'bootstraping performed in', round(time.time()-t0, 1), 's'
    else:
        astrom.interpListOfFiles(files, data_directory,
                                 plot=True, quiet=False,
                                 fit_param  = fittedParam,
                                 first_guess= firstGuess,
                                 fit_only_files=selection,
                                 maxResiduals=maxResiduals, res2fits=res2fits)
        res = []
    return