Ejemplo n.º 1
0
def main():

    curpath = Path(__file__).resolve().parents[1]
    print(curpath)
    testpath = curpath/'Testdata'/'MatrixTest'
    origparamsdir = testpath/'Origparams'
    
    testpath.mkdir(exist_ok=True,parents=True)

    origparamsdir.mkdir(exist_ok=True,parents=True)

    # clear everything out
    folderlist = ['Origparams','Spectrums','Radardata','ACF','Fitted']
    for ifl in folderlist:
        flist = (testpath/ifl).glob('*.h5')
        for ifile in flist:
            ifile.unlink()
    # Make Config file
    configname = testpath/'config.ini'
    
    if not configname.is_file():
        srcfile = curpath/'SimISR'/'default.ini'
        shutil.copy(str(srcfile),str(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(origparamsdir/'0 testiono.h5')
    Icont1.saveh5(testpath/'startdata.h5')
    funcnamelist=['spectrums','applymat','fittingmat']
    runsim.main(funcnamelist,testpath,configname,True)
    
    plotdir = testpath/'AnalysisPlots'
    
    plotdir.mkdir(exist_ok=True,parents=True)
    
    f_templ = str(plotdir/'params')
    
    plotbeamparametersv2([0.],str(configname),str(testpath),fitdir = 'FittedMat',params=['Ne','Ti','Te'],filetemplate=f_templ,
                         suptitle = 'With Mat',werrors=False,nelog=False)
Ejemplo n.º 2
0
def runradarsims(testpath,funcnamelist=['spectrums','radardata','fitting'],configfile = 'planeproc2.ini',remakealldata=False,fittimes=None,invtype=''):
    """ This will run the radar simulations for all the selected data sets"""
    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
        makeline(configfile,testpath)
    # clear everything out
#    folderlist =[]
#    if 'spectrums' in funcnamelist:
#        folderlist.append('Spectrums')
#    if 'radardata' in funcnamelist and remakealldata:
#        folderlist.append('Radardata')
#        folderlist.append('ACF')
#    if 'fitting' in funcnamelist:
#        folderlist.append('Fitted')
##    folderlist = ['Spectrums','Radardata','ACF','Fitted']
#    for ifl in folderlist:
#        flist = glob.glob(os.path.join(testpath,ifl,'*.h5'))
#        for ifile in flist:
#            os.remove(ifile)
    
    ismat = False
    for ifc in funcnamelist:
        if 'mat' in ifc:
            ismat=True
            break
    runsim.main(funcnamelist,testpath,configfile,remakealldata,fittimes,invtype=invtype)
    try:
        if ismat:
            plotdir = os.path.join(testpath,'AnalysisPlots')
            f_templ = os.path.join(plotdir,'paramsmat')
            plotbeamparametersv2([0.],configfile,testpath,fitdir = 'FittedMat',params=['Ne','Ti','Te'],filetemplate=f_templ,
                             suptitle = 'With Mat',werrors=False,nelog=False)
        else:
            analysisdump(testpath,configfile,'Plane Example')
    except:
        print "Analysis dump failed somewhere"
Ejemplo n.º 3
0
def main():

    curpath = Path(__file__).resolve().parents[1]
    print(curpath)
    testpath = curpath / 'Testdata' / 'MatrixTest'
    origparamsdir = testpath / 'Origparams'

    testpath.mkdir(exist_ok=True, parents=True)

    origparamsdir.mkdir(exist_ok=True, parents=True)

    # clear everything out
    folderlist = ['Origparams', 'Spectrums', 'Radardata', 'ACF', 'Fitted']
    for ifl in folderlist:
        flist = (testpath / ifl).glob('*.h5')
        for ifile in flist:
            ifile.unlink()
    # Make Config file
    configname = testpath / 'config.ini'

    if not configname.is_file():
        srcfile = curpath / 'SimISR' / 'default.ini'
        shutil.copy(str(srcfile), str(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(origparamsdir / '0 testiono.h5')
    Icont1.saveh5(testpath / 'startdata.h5')
    funcnamelist = ['spectrums', 'applymat', 'fittingmat']
    runsim.main(funcnamelist, testpath, configname, True)

    plotdir = testpath / 'AnalysisPlots'

    plotdir.mkdir(exist_ok=True, parents=True)

    f_templ = str(plotdir / 'params')

    plotbeamparametersv2([0.],
                         str(configname),
                         str(testpath),
                         fitdir='FittedMat',
                         params=['Ne', 'Ti', 'Te'],
                         filetemplate=f_templ,
                         suptitle='With Mat',
                         werrors=False,
                         nelog=False)