elif options.whichtdi == 'optimal':
    IIs = ['AE', 'AT', 'ET']

if csddir not in glob.glob(csddir):
    os.system('mkdir %s' % csddir)

for day in options.days:

    print "~~~~~~~ Day %d ~~~~~~~" % day
    orfids = [(options.tditype, options.tdigen, II[0], options.tditype,
               options.tdigen, II[1], options.f0, options.df, options.Nf, day)
              for II in IIs]
    orfpaths = [(
        orfdir +
        'tdiI_%s_%s_%s_tdiJ_%s_%s_%s_lmax_20_f0_%f_df_%f_Nf_%d/data_nlon_120_nlat_61/orf_d%03d.pkl'
        % orfid) for orfid in orfids]
    orfs = [AS.OrfMultipleMoments(orfpath) for orfpath in orfpaths]

    PIJs = [AS.Convolve(orf, skymap, options.GWslope) for orf in orfs]

    P12, P13, P23 = PIJs

    fdata = P12.Offset1 + P12.Cadence1 * np.arange(P12.data.shape[0])
    f = AS.Coarsable(fdata, Offset1=P12.Offset1, Cadence1=P12.Cadence1)

    csddict = {'f': f, 'AE': P12, 'AT': P13, 'ET': P23}

    file = open(csddir + 'd%03d.pkl' % day, 'wb')
    cpkl.dump(csddict, file, -1)
    file.close()




t0s = [ 100 ]
m , l = 3 , 5
tdiORF_SpH_dir = 'data_nlon_220_nlat_111/'
fig_dir = 'figures_f_vs_tdiORF_SpHs_nlon_220_nlat_111/' 


indxpn = AS.getMLvec( l , 'pn' ) ; k = indxpn.index( (m,l) )

for t0 in t0s :

    orf = AS.OrfMultipleMoments( tdiORF_SpH_dir + 'orf_t0_%.1f.pkl' % t0 )
    glm = orf.getMultipleMoments( 'pn' , l )
    f = glm.Offset1 + glm.Cadence1 * np.arange( glm.data.shape[1] )
    glmdata = glm.data[ k , : ]

    fig_dir = fig_dir + 't0_%.1f/' % t0
    if fig_dir not in glob.glob( fig_dir ) :
        os.system( 'mkdir -p %s' % fig_dir )

    fig = plt.figure()
    fig.suptitle( 'tdiORF SpH: l = %d , m = %d , t0 = %.1f' % ( l , m , t0 ) )
    ax = fig.add_subplot( 311 )
    ax.plot( f , np.real( glmdata ) , f , np.imag( glmdata ) )
    ax.legend( ( 'real' , 'imag' ) )
    ax.set_ylabel( 'glm' ) ; ax.set_xlabel( 'frequency [Hz]' )
    fig.savefig( fig_dir + 'l_%03d_m_%+04d.png' % ( l , m ) )
Exemple #3
0
    csdpath = csddir + '/d%03d.pkl' % day
    orfpath = orfdir + '/d%03d.pkl' % day
    psdpath = psddir + '/d%03d.pkl' % day

    if csdpath not in glob.glob(csdpath):
        print 'CSD not found at %s' % csdpath
        continue
    if orfpath not in glob.glob(orfpath):
        print 'Orf not found at %s' % orfpath
        continue
    if psdpath not in glob.glob(psdpath):
        print 'PSD not found at %s' % psdpath
        continue

    orf = AS.OrfMultipleMoments(orfpath)
    file = open(csdpath, 'rb')
    csddict = cpkl.load(file)
    file.close()
    file = open(psdpath, 'rb')
    psddict = cpkl.load(file)
    file.close()

    SSdata = AS.get_covariance_bias_matrix_for_the_day(
        orf, psddict, csddict, options.H0, options.GWslope, day, options.flow,
        options.fhigh, options.lmax)

    if firstavailable:
        Sdata = np.zeros(SSdata.shape, dtype=SSdata.dtype)
        print 'Calculating normalisation factor due to coarsegraining and windowing'
        tspath = tsdir + '/d%03d.pkl' % day
Exemple #4
0
import numpy as np
import cPickle as cpkl
import synthlisa
import myLISAmodule as mlisar
import AnisotropySearch as AS

days = range(1, 365 + 1)
csddir = 'csd_ana'
Ppath = ''
norm_factor = ''  #If
orfdir = ''
GWSpectralSlope, H0 = 0, 1.0
IJs = ['AE', 'AT', 'ET']

file = open(Ppath, 'rb')
skymap = cpkl.load(file)
file.close()

for day in days:
    csddict = {}
    for IJ in IJs:
        orf = AS.OrfMultipleMoments(orfdir + '/' + IJ + '/d%03d.pkl' % day)
        csddict[IJ] = AS.Convolve(orf, skymap, GWSpectralslope, H0)
        csddict['f'] = orf.f

    if csddir not in glob.glob(csddir):
        os.system('mkdir %s' % csddir)
    file = open(csddir + '/d%03d.pkl' % day, 'wb')
    cpkl.dump(csddict, file, -1)
    file.close()