예제 #1
0
def main(input_str=None):
    args_commd = parse_command_line(input_str)
    if args_commd.path is None:
        curloc = Path(__file__).resolve()
        testpath = curloc.parent.parent/'Testdata'/'Barker'
    else:
        testpath = Path(args_commd.path)

    origparamsdir = testpath/'Origparams'
    testpath.mkdir(exist_ok=True,parents=True)
    print("Making a path for testdata at {}".format(testpath))

    origparamsdir.mkdir(exist_ok=True,parents=True)
    print("Making a path for testdata at {}".format(origparamsdir))
    makeconfigfilebarker(testpath)

    if args_commd.makeorigdata:
        Icont1 = MakeTestIonoclass(testv=True,testtemp=False,N_0=1e12,z_0=150.0,H_0=50.0)
        makeinputh5(Icont1,str(testpath))
        Icont1.saveh5(str(origparamsdir.joinpath('0 testiono.h5')))

    funcnamelist = args_commd.funclist

    failflag=runsim.main(funcnamelist,testpath,str(testpath.joinpath('barkertest.yml')),True)
    if not failflag:
        analysisdump(testpath,testpath.joinpath('barkertest.yml'))
예제 #2
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 = Path(__file__).resolve().parent
    testpath = curpath.parent/'Testdata'/'Long_Pulse'
    origparamsdir = testpath/'Origparams'
    
    if not testpath.is_dir():
        testpath.mkdir(parents=True)
    print("Making a path for testdata at {}".format(str(testpath)))
    
    if not origparamsdir.is_dir():
        origparamsdir.mkdir(parents=True)
    print("Making a path for testdata at {}".format(origparamsdir))

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

    Icont1 = MakeTestIonoclass(testv=True,testtemp=True)
    makeinputh5(MakeTestIonoclass(testv=True,testtemp=False),testpath)
    Icont1.saveh5(origparamsdir/'0 testiono.h5')
    funcnamelist=['spectrums','radardata','fitting']
    failflag = runsim.main(funcnamelist,testpath, testpath/'PFISRExample.ini',True)
    if not failflag:
        analysisdump(testpath,str(testpath/'PFISRExample.ini'))
예제 #3
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 = Path(__file__).resolve().parent
    testpath = curpath.parent / "Testdata" / "Long_Pulse"
    origparamsdir = testpath / "Origparams"

    if not testpath.is_dir():
        testpath.mkdir(parents=True)
    print("Making a path for testdata at {}".format(str(testpath)))

    if not origparamsdir.is_dir():
        origparamsdir.mkdir(parents=True)
    print("Making a path for testdata at {}".format(origparamsdir))

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

    Icont1 = MakeTestIonoclass(testv=True, testtemp=True)
    makeinputh5(MakeTestIonoclass(testv=True, testtemp=False), testpath)
    Icont1.saveh5(origparamsdir / "0 testiono.h5")
    funcnamelist = ["spectrums", "radardata", "fitting"]
    failflag = runsim.main(funcnamelist, testpath, testpath / "PFISRExample.ini", True)
    if not failflag:
        analysisdump(testpath, str(testpath / "PFISRExample.ini"))
예제 #4
0
def main(input_str=None):
    args_commd = parse_command_line(input_str)
    if args_commd.path is None:
        curloc = Path(__file__).resolve()
        testpath = curloc.parent.parent / 'Testdata' / 'Barker'
    else:
        testpath = Path(args_commd.path)

    origparamsdir = testpath / 'Origparams'
    testpath.mkdir(exist_ok=True, parents=True)
    print("Making a path for testdata at {}".format(testpath))

    origparamsdir.mkdir(exist_ok=True, parents=True)
    print("Making a path for testdata at {}".format(origparamsdir))
    makeconfigfilebarker(testpath)

    if args_commd.makeorigdata:
        Icont1 = MakeTestIonoclass(testv=True,
                                   testtemp=False,
                                   N_0=1e12,
                                   z_0=150.0,
                                   H_0=50.0)
        makeinputh5(Icont1, str(testpath))
        Icont1.saveh5(str(origparamsdir.joinpath('0 testiono.h5')))

    funcnamelist = args_commd.funclist

    failflag = runsim.main(funcnamelist, testpath,
                           str(testpath.joinpath('barkertest.yml')), True)
    if not failflag:
        analysisdump(testpath, testpath.joinpath('barkertest.yml'))
예제 #5
0
def main():
    curloc = Path(__file__).resolve()
    testpath = curloc.parent.parent / 'Testdata' / 'Barker'
    origparamsdir = testpath / 'Origparams'
    pdb.set_trace()
    testpath.mkdir(exist_ok=True, parents=True)
    print("Making a path for testdata at {}".format(testpath))

    origparamsdir.mkdir(exist_ok=True, parents=True)
    print("Making a path for testdata at {}".format(origparamsdir))
    makeconfigfilebarker(testpath)

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

    failflag = runsim.main(funcnamelist, testpath,
                           str(testpath.joinpath('barkertest.ini')), True)
    if not failflag:
        analysisdump(testpath, testpath.joinpath('barkertest.ini'))
예제 #6
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)
예제 #7
0
def main(funcnamelist):
    """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 = Path(__file__).resolve().parent
    testpath = curpath / 'Testdata' / 'DishMode'
    origparamsdir = testpath / 'Origparams'

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

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

    if 'configupdate' in funcnamelist:
        configsetup(testpath)
        funcnamelist.remove('configupdate')
    # clear everything out
    folddict = {
        'origdata': ['Origparams'],
        'spectrums': ['Spectrums'],
        'radardata': ['ACF', 'Radardata'],
        'fitting': ['Fitted']
    }
    folderlist = []
    for i in funcnamelist:
        folderlist = folderlist + folddict[i]
#    folderlist = ['Origparams','Spectrums','Radardata','ACF','Fitted']
    for ifl in folderlist:
        flist = (testpath / ifl).glob('*.h5')
        for ifile in flist:
            ifile.unlink()
    # Now make stuff again

    if 'origdata' in funcnamelist:

        Icont1 = MakeTestIonoclass(testv=True, testtemp=True)
        makeinputh5(MakeTestIonoclass(testv=True, testtemp=False), testpath)
        Icont1.saveh5(origparamsdir / '0 testiono.h5')
        funcnamelist.remove('origdata')


#    funcnamelist=['spectrums','radardata','fitting']
    failflag = runsim.main(funcnamelist, testpath,
                           testpath / 'DishExample.ini', True)
    if not failflag:
        analysisdump(testpath, testpath / 'DishExample.ini')
예제 #8
0
def main():
    curloc = Path(__file__).resolve()
    testpath = curloc.parent.parent/'Testdata'/'Barker'
    origparamsdir = testpath/'Origparams'
    pdb.set_trace()
    testpath.mkdir(exist_ok=True,parents=True)
    print("Making a path for testdata at {}".format(testpath))
        
    origparamsdir.mkdir(exist_ok=True,parents=True)
    print("Making a path for testdata at {}".format(origparamsdir))
    makeconfigfilebarker(testpath)


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

    failflag=runsim.main(funcnamelist,testpath,str(testpath.joinpath('barkertest.ini')),True)
    if not failflag:
        analysisdump(testpath,testpath.joinpath('barkertest.ini'))
예제 #9
0
def main(funcnamelist):
    """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 = Path(__file__).resolve().parent
    testpath = curpath/'Testdata'/'DishMode'
    origparamsdir = testpath/'Origparams'

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

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

    if 'configupdate' in funcnamelist:
        configsetup(testpath)
        funcnamelist.remove('configupdate')
    # clear everything out
    folddict = {'origdata':['Origparams'], 'spectrums':['Spectrums'], 'radardata':['ACF','Radardata'], 'fitting':['Fitted']}
    folderlist = []
    for i in funcnamelist:
        folderlist=folderlist+folddict[i]
#    folderlist = ['Origparams','Spectrums','Radardata','ACF','Fitted']
    for ifl in folderlist:
        flist = (testpath/ifl).glob('*.h5')
        for ifile in flist:
            ifile.unlink()
    # Now make stuff again


    if 'origdata' in funcnamelist:

        Icont1 = MakeTestIonoclass(testv=True,testtemp=True)
        makeinputh5(MakeTestIonoclass(testv=True,testtemp=False),testpath)
        Icont1.saveh5(origparamsdir/'0 testiono.h5')
        funcnamelist.remove('origdata')

#    funcnamelist=['spectrums','radardata','fitting']
    failflag=runsim.main(funcnamelist,testpath,testpath/'DishExample.ini',True)
    if not failflag:
        analysisdump(testpath,testpath/'DishExample.ini')
예제 #10
0
def makeline(testdir,meanaz,linewidth=1,multval = 5.,start = 450.,rng_vel = -0.5):
    """This will create one of the plane datasets given the desired azmuth location
    and line width in samples. The line will be an enhancement in electron density
    Inputs:
    testdir - directory that will house the simulation data.
    meanaz - the Azimuth angle the data will lie on in degrees.
    linewidth - The width of the enhancement in samples
    multval - The enhancement's multiplicaive value compared to the background.
    start - The start location of the enhancement. In km from radar.
    rng_vel - The velocity of the enhancement - is toward the radar in km/s
    """
    if not os.path.isdir(testdir):
        os.mkdir(testdir)
    datadir = os.path.join(testdir,'Origparams')
    if not os.path.isdir(datadir):
        os.mkdir(datadir)
#    (sensdict,simparams) = readconfigfile(configfile)
#    azangles = [iang[0] for iang in simparams['angles']]
#    meanaz = sp.mean(azangles)

    rngart = 10
    rngend = 700
    nr = sp.floor((rngend-rngart)/2)
    nz = 350
    nt = 31
    d2r = sp.pi/180.
    rvec = sp.linspace(rngart,rngend,nr+1)
    zvec = sp.linspace(0,2.*nz,nz+1)
    Rmat,Zmat = sp.meshgrid(rvec,zvec)
    Xmat = Rmat*sp.sin(d2r*meanaz)
    Ymat = Rmat*sp.cos(d2r*meanaz)
    coords = sp.column_stack((Xmat.flatten(),Ymat.flatten(),Zmat.flatten()))
    if rng_vel==0.:
        timevec = sp.array([0.])
    else:
        timevec = sp.linspace(0.,900.,nt)

    xvel = rng_vel*sp.sin(d2r*meanaz)*1e3
    yvel = rng_vel*sp.cos(d2r*meanaz)*1e3

    parammult = sp.ones_like(Rmat).astype('float64')
    paramadd =sp.zeros_like(Rmat).astype('float64')


    # start file
    it=0.
    Icont1 = MakeTestIonoclass(testv=False,testtemp=False,N_0=1e11,z_0=250.0,H_0=50.0,
                               coords=coords,times=sp.array([[it,it+30.]]))
    strtstr = 'startdata{0}.h5'.format(str(meanaz).replace('.','_',1))
    strtfile = os.path.join(os.path.split(testdir)[0],strtstr)
    if not os.path.isfile(strtfile):
        Icont1.saveh5(strtfile)
    if sp.mod(linewidth,2):
        linewidth+=1
    fwhm = sp.floor(linewidth/2.)
    for itn,it in enumerate(timevec):
        Icont1 = MakeTestIonoclass(testv=False,testtemp=False,N_0=1e11,z_0=250.0,H_0=50.0,
                                   coords=coords,times=sp.array([[it,it+30.]]))
        midloc = sp.argmin(sp.absolute(rvec-(start+rng_vel*it)))

        iloc = sp.arange(midloc-fwhm,midloc+1+fwhm).astype(sp.int64)
        parammult[:,iloc] = multval
        Paramflt = parammult.flatten()
        Icont1.Param_List[:,0,0,0] = Icont1.Param_List[:,0,0,0]*Paramflt#ion density enhancement
        Icont1.Param_List[:,0,1,0] = Icont1.Param_List[:,0,1,0]*Paramflt# electron density enhancement
        paramadd[:,iloc] = xvel
        Icont1.Velocity[:,0,0] = paramadd.flatten()
        paramadd[:,iloc] = yvel
        Icont1.Velocity[:,0,1] = paramadd.flatten()
        paramadd[:,iloc]=0.
        parammult[:,iloc] = 1.
        Icont1.saveh5(os.path.join(datadir,'{0} planeiono.h5'.format(int(it)) ))
예제 #11
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)