Exemplo n.º 1
0
def main():
    """This function will run the test simulation buy first making a simple set of
    ionospheric parameters based off of a Chapman function. Then it will create configuration
    and start files followed by running the simulation."""
    curpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    testpath = os.path.join(os.path.split(curpath)[0],'Testdata','Long_Pulse')
    origparamsdir = os.path.join(testpath,'Origparams')
    if not os.path.exists(testpath):
        os.mkdir(testpath)
        print "Making a path for testdata at "+testpath
    if not os.path.exists(origparamsdir):
        os.mkdir(origparamsdir)
        print "Making a path for testdata at "+origparamsdir

    # clear everything out
    folderlist = ['Origparams','Spectrums','Radardata','ACF','Fitted']
    for ifl in folderlist:
        flist = glob.glob(os.path.join(testpath,ifl,'*.h5'))
        for ifile in flist:
            os.remove(ifile)
    # Now make stuff again
    configsetup(testpath)

    Icont1 = MakeTestIonoclass(testv=True,testtemp=True)
    makeinputh5(MakeTestIonoclass(testv=True,testtemp=False),testpath)
    Icont1.saveh5(os.path.join(origparamsdir,'0 testiono.h5'))
    funcnamelist=['spectrums','radardata','fitting']
    runsim.main(funcnamelist,testpath,os.path.join(testpath,'PFISRExample.ini'),True)
    analysisdump(testpath,os.path.join(testpath,'PFISRExample.ini'))
Exemplo n.º 2
0
def main():

    curpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    testpath = os.path.join(os.path.split(curpath)[0],'Testdata','MatrixTest')
    origparamsdir = os.path.join(testpath,'Origparams')
    if not os.path.exists(testpath):
        os.mkdir(testpath)
        print "Making a path for matrix test at "+testpath
    if not os.path.exists(origparamsdir):
        os.mkdir(origparamsdir)
        print "Making a path for testdata at "+origparamsdir

    # clear everything out
    folderlist = ['Origparams','Spectrums','Radardata','ACF','Fitted']
    for ifl in folderlist:
        flist = glob.glob(os.path.join(testpath,ifl,'*.h5'))
        for ifile in flist:
            os.remove(ifile)
    # Make Config file
    configname = os.path.join(testpath,'config.ini')
    if ~os.path.isfile(configname):
        makedefaultfile(configname)

    # make the coordinates
    xvec = sp.zeros((1))
    yvec = sp.zeros((1))
    zvec = sp.arange(50.0,900.0,2.0)
    # Mesh grid is set up in this way to allow for use in MATLAB with a simple reshape command
    xx,zz,yy = sp.meshgrid(xvec,zvec,yvec)
    coords = sp.zeros((xx.size,3))
    coords[:,0] = xx.flatten()
    coords[:,1] = yy.flatten()
    coords[:,2] = zz.flatten()

    Icont1 = MakeTestIonoclass(testv=True,testtemp=True,coords=coords)
    Icont1.saveh5(os.path.join(origparamsdir,'0 testiono.h5'))
    Icont1.saveh5(os.path.join(testpath,'startdata.h5'))
    funcnamelist=['spectrums']
    runsim.main(funcnamelist,testpath,configname,True)
    Ispec = IonoContainer.readh5(os.path.join(testpath,'Spectrums','0 testiono spectrum.h5'))
    Spec = Ispec.Param_List.real
    acflen = 14

    # get matrix
    outmat = makematPA(Ispec.Sphere_Coords,Ispec.Time_Vector,configname)
    (outn,inn) = outmat.shape
    acfs = sp.ifft(scfft.ifftshift(Spec,axes=-1),axis=-1)[:,:,:acflen]
    acfout = sp.zeros((outn,acflen)).astype(acfs.dtype)

    acfs = sp.reshape(acfs,(inn,acflen),order='F')

    for i in range(acflen):
        acfout[:,i] = sp.dot(outmat,acfs[:,i])
Exemplo n.º 3
0
def main():

    curpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    testpath = os.path.join(os.path.split(curpath)[0],'Testdata','MatrixTest')
    origparamsdir = os.path.join(testpath,'Origparams')
    if not os.path.exists(testpath):
        os.mkdir(testpath)
        print "Making a path for matrix test at "+testpath
    if not os.path.exists(origparamsdir):
        os.mkdir(origparamsdir)
        print "Making a path for testdata at "+origparamsdir

    # clear everything out
    folderlist = ['Origparams','Spectrums','Radardata','ACF','Fitted']
    for ifl in folderlist:
        flist = glob.glob(os.path.join(testpath,ifl,'*.h5'))
        for ifile in flist:
            os.remove(ifile)
    # Make Config file
    configname = os.path.join(testpath,'config.ini')
    
    if not os.path.isfile(configname):
        srcfile =os.path.join( os.path.split(curpath)[0],'RadarDataSim','default.ini')
        shutil.copy(srcfile,configname)

    # make the coordinates
    xvec = sp.zeros((1))
    yvec = sp.zeros((1))
    zvec = sp.arange(50.0,900.0,2.0)
    # Mesh grid is set up in this way to allow for use in MATLAB with a simple reshape command
    xx,zz,yy = sp.meshgrid(xvec,zvec,yvec)
    coords = sp.zeros((xx.size,3))
    coords[:,0] = xx.flatten()
    coords[:,1] = yy.flatten()
    coords[:,2] = zz.flatten()
    Z_0 = 250.
    H_0=30.
    N_0=6.5e11
    Icont1 = MakeTestIonoclass(testv=True,testtemp=True,N_0=N_0,z_0=Z_0,H_0=H_0,coords=coords)
    Icont1.saveh5(os.path.join(origparamsdir,'0 testiono.h5'))
    Icont1.saveh5(os.path.join(testpath,'startdata.h5'))
    funcnamelist=['spectrums','applymat','fittingmat']
    runsim.main(funcnamelist,testpath,configname,True)
    
    plotdir = os.path.join(testpath,'AnalysisPlots')
    if not os.path.isdir(plotdir):
        os.mkdir(plotdir)
    f_templ = os.path.join(plotdir,'params')
    plotbeamparametersv2([0.],configname,testpath,fitdir = 'FittedMat',params=['Ne','Ti','Te'],filetemplate=f_templ,
                         suptitle = 'With Mat',werrors=False,nelog=False)
Exemplo n.º 4
0
def main():
    """This function will run the test simulation buy first making a simple set of
    ionospheric parameters based off of a Chapman function. Then it will create configuration
    and start files followed by running the simulation."""
    curpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    testpath = os.path.join(os.path.split(curpath)[0],'Testdata','Long_Pulse')
    origparamsdir = os.path.join(testpath,'Origparams')
    if not os.path.exists(testpath):
        os.mkdir(testpath)
        print "Making a path for testdata at "+testpath
    if not os.path.exists(origparamsdir):
        os.mkdir(origparamsdir)
        print "Making a path for testdata at "+origparamsdir

    # clear everything out
    folderlist = ['Origparams','Spectrums','Radardata','ACF','Fitted']
    for ifl in folderlist:
        flist = glob.glob(os.path.join(testpath,ifl,'*.h5'))
        for ifile in flist:
            os.remove(ifile)
    # Now make stuff again
    configsetup(testpath)

    Icont1 = MakeTestIonoclass(testv=True,testtemp=True)
    makeinputh5(MakeTestIonoclass(testv=True,testtemp=False),testpath)
    Icont1.saveh5(os.path.join(origparamsdir,'0 testiono.h5'))
    funcnamelist=['spectrums','radardata','fitting']
    failflag = runsim.main(funcnamelist,testpath,os.path.join(testpath,'PFISRExample.ini'),True)
    if not failflag:
        analysisdump(testpath,os.path.join(testpath,'PFISRExample.ini'))
Exemplo n.º 5
0
def main():
    curpath = os.path.dirname(
        os.path.abspath(inspect.getfile(inspect.currentframe())))
    testpath = os.path.join(os.path.split(curpath)[0], 'Testdata', 'Barker')
    origparamsdir = os.path.join(testpath, 'Origparams')
    if not os.path.exists(testpath):
        os.mkdir(testpath)
        print "Making a path for testdata at " + testpath
    if not os.path.exists(origparamsdir):
        os.mkdir(origparamsdir)
        print "Making a path for testdata at " + origparamsdir


#    makeconfigfile(testpath)

    Icont1 = MakeTestIonoclass(testv=True,
                               testtemp=False,
                               N_0=1e12,
                               z_0=150.0,
                               H_0=50.0)
    makeinputh5(Icont1, testpath)
    Icont1.saveh5(os.path.join(origparamsdir, '0 testiono.h5'))
    funcnamelist = ['spectrums', 'radardata', 'fitting']

    failflag = runsim.main(funcnamelist, testpath,
                           os.path.join(testpath, 'PFISRExample.pickle'), True)
    if not failflag:
        analysisdump(testpath, os.path.join(testpath, 'PFISRExample.pickle'))
Exemplo n.º 6
0
def main():
    curpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    testpath = os.path.join(os.path.split(curpath)[0],'Testdata','Barker')
    origparamsdir = os.path.join(testpath,'Origparams')
    if not os.path.exists(testpath):
        os.mkdir(testpath)
        print "Making a path for testdata at "+testpath
    if not os.path.exists(origparamsdir):
        os.mkdir(origparamsdir)
        print "Making a path for testdata at "+origparamsdir
#    makeconfigfile(testpath)


    Icont1 = MakeTestIonoclass(testv=True,testtemp=False,N_0=1e12,z_0=150.0,H_0=50.0)
    makeinputh5(Icont1,testpath)
    Icont1.saveh5(os.path.join(origparamsdir,'0 testiono.h5'))
    funcnamelist=['spectrums','radardata','fitting']
    runsim.main(funcnamelist,testpath,os.path.join(testpath,'PFISRExample.pickle'),True)
    analysisdump(testpath,os.path.join(testpath,'PFISRExample.pickle'))