Exemplo n.º 1
0
def xpselect(file_path, **kwargs):
    """Application for data subselection.

    We want to (loosely) model this on
    http://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtselect.txt
    """
    assert(file_path.endswith('.fits'))
    event_select = xEventSelect(file_path, **kwargs)
    outfile = event_select.get('outfile')
    if os.path.exists(outfile) and not event_select.get('clobber'):
        logger.info('Output file %s already exists.' % outfile)
        logger.info('Remove the file or set "clobber = True" to overwite it.')
    else:
        event_select.select()
    return outfile
Exemplo n.º 2
0
file_map='casa_cmap.fits'
evt_file_path='casa.fits'
file_selected_path='casa_sel.fits'
file_selected_cube_path='casa_sel_mcube.fits'
outfile=None
for i,a in enumerate(sys.argv):
    if '-rad'   in a: rad     = float(sys.argv[i+1])
    elif '-dec' in a: dec     = float(sys.argv[i+1])
    elif '-ra'  in a: ra      = float(sys.argv[i+1])
    elif '-o'   in a: outfile = sys.argv[i+1]
    pass

fig=xBinnedMap(file_map).plot(show=False,subplot=(1,2,1))#,figure=fig)
fig.show_circles(ra,dec,rad,lw=1)
rad*=60
evtSelect=xEventSelect(evt_file_path, ra=ra, dec=dec, rad=rad, outfile=file_selected_path,
                       emax=None, emin=None, mc=False, mcsrcid=[], phasemax=None, phasemin=None, phimax=None, phimin=None, tmax=None, tmin=None)
evtSelect.select()

evtBin=xEventBinningMCUBE(file_selected_path, ebins=1, outfile=file_selected_cube_path, evfile=file_selected_path,
                          emax=10.0,nypix=256, ebinfile=None, phasebins=50,ebinalg='LIN',
                          xref=None,phibins=75,nxpix=256,tbins=100,proj='TAN',tstart=None,tbinalg='LIN',algorithm='MCUBE',mc=False,binsz=2.5,yref=None,tbinfile=None,emin=1.0,tstop=None)
evtBin.bin_()

binModulation = xBinnedModulationCube(file_selected_cube_path)
binModulation.plot(show=False,xsubplot=1)
for fit in binModulation.fit_results:
    print fit
    angle      = fit.phase
    angle_err  = fit.phase_error

    visibility = fit.visibility
Exemplo n.º 3
0
    elif '-dec' in a: dec = float(sys.argv[i + 1])
    elif '-ra' in a: ra = float(sys.argv[i + 1])
    elif '-o' in a: outfile = sys.argv[i + 1]
    pass

fig = xBinnedMap(file_map).plot(show=False, subplot=(1, 2, 1))  #,figure=fig)
fig.show_circles(ra, dec, rad, lw=1)
rad *= 60
evtSelect = xEventSelect(evt_file_path,
                         ra=ra,
                         dec=dec,
                         rad=rad,
                         outfile=file_selected_path,
                         emax=None,
                         emin=None,
                         mc=False,
                         mcsrcid=[],
                         phasemax=None,
                         phasemin=None,
                         phimax=None,
                         phimin=None,
                         tmax=None,
                         tmin=None)
evtSelect.select()

evtBin = xEventBinningMCUBE(file_selected_path,
                            ebins=1,
                            outfile=file_selected_cube_path,
                            evfile=file_selected_path,
                            emax=10.0,
                            nypix=256,