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"))
def main(testpath,npulse = 1400 ,functlist = ['spectrums','radardata','fitting','analysis']): """ This function will call other functions to create the input data, config file and run the radar data sim. The path for the simulation will be created in the Testdata directory in the SimISR module. The new folder will be called BasicTest. The simulation is a long pulse simulation will the desired number of pulses from the user. Inputs npulse - Number of pulses for the integration period, default==100. functlist - The list of functions for the SimISR to do. """ curloc = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) if not os.path.isdir(testpath): os.mkdir(testpath) functlist_default = ['spectrums','radardata','fitting'] check_list = sp.array([i in functlist for i in functlist_default]) check_run =sp.any( check_list) functlist_red = sp.array(functlist_default)[check_list].tolist() configfilesetup(testpath,npulse) config = os.path.join(testpath,'stats.ini') (sensdict,simparams) = readconfigfile(config) makedata(testpath,simparams['Tint']) if check_run : runsim(functlist_red,testpath,config,True) if 'analysis' in functlist: analysisdump(testpath,config)
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'))
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'))
def main(npulse=100, functlist=['spectrums', 'radardata', 'fitting', 'analysis'],radar='pfisr'): """ This function will call other functions to create the input data, config file and run the radar data sim. The path for the simulation will be created in the Testdata directory in the SimISR module. The new folder will be called BasicTest. The simulation is a long pulse simulation will the desired number of pulses from the user. Inputs npulse - Number of pulses for the integration period, default==100. functlist - The list of functions for the SimISR to do. """ curloc = Path(__file__).resolve() testpath = curloc.parent.parent/'Testdata'/'BasicTest' if not testpath.is_dir(): testpath.mkdir(parents=True) functlist_default = ['spectrums', 'radardata', 'fitting'] check_list = sp.array([i in functlist for i in functlist_default]) check_run = sp.any(check_list) functlist_red = sp.array(functlist_default)[check_list].tolist() config = testpath.joinpath('stats.yml') if not config.exists(): configfilesetup(str(testpath), npulse, radar) (_, simparams) = readconfigfile(str(config)) makedata(testpath, simparams['Tint']) if check_run: runsim(functlist_red, str(testpath), config, True) if 'analysis' in functlist: analysisdump(str(testpath), config)
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'))
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'))
def main(npulse=100, functlist=['spectrums', 'radardata', 'fitting', 'analysis']): """ This function will call other functions to create the input data, config file and run the radar data sim. The path for the simulation will be created in the Testdata directory in the SimISR module. The new folder will be called BasicTest. The simulation is a long pulse simulation will the desired number of pulses from the user. Inputs npulse - Number of pulses for the integration period, default==100. functlist - The list of functions for the SimISR to do. """ curloc = Path(__file__).resolve() testpath = curloc.parent.parent / 'Testdata' / 'BasicTest' if not testpath.is_dir(): testpath.mkdir(parents=True) functlist_default = ['spectrums', 'radardata', 'fitting'] check_list = sp.array([i in functlist for i in functlist_default]) check_run = sp.any(check_list) functlist_red = sp.array(functlist_default)[check_list].tolist() configfilesetup(str(testpath), npulse) config = testpath.joinpath('stats.ini') (sensdict, simparams) = readconfigfile(str(config)) makedata(testpath, simparams['Tint']) if check_run: runsim(functlist_red, str(testpath), config, True) if 'analysis' in functlist: analysisdump(str(testpath), config)
def runstuff(datapath,picklefilename): makestartfile(datapath) funcnamelist=['radardata','fitting'] runsim.main(funcnamelist,datapath,os.path.join(datapath,picklefilename),True) fit2geodata(os.path.join(datapath,'Fitted','fitteddata.h5')) analysisdump(datapath,os.path.join(datapath,picklefilename),'Non Maxwellian')
def main(plist=None, functlist=['spectrums', 'radardata', 'fitting', 'analysis', 'stats'], datadir=None): """ This function will call other functions to create the input data, config file and run the radar data sim. The path for the simulation will be created in the Testdata directory in the SimISR module. The new folder will be called BasicTest. The simulation is a long pulse simulation will the desired number of pulses from the user. Inputs npulse - Number of pulses for the integration period, default==100. functlist - The list of functions for the SimISR to do. """ if plist is None: plist = sp.array([50, 100, 200, 500, 1000, 2000, 5000]) if isinstance(plist, list): plist = sp.array(plist) if datadir is None: curloc = Path(__file__).resolve().parent testpath = curloc.parent.joinpath('Testdata', 'StatsTest') else: datadir = Path(datadir) testpath = datadir testpath.mkdir(exist_ok=True, parents=True) functlist_default = ['spectrums', 'radardata', 'fitting'] check_list = sp.array([i in functlist for i in functlist_default]) check_run = sp.any(check_list) functlist_red = sp.array(functlist_default)[check_list].tolist() allfolds = [] # rsystools = [] for ip in plist: foldname = 'Pulses_{:04d}'.format(ip) curfold = testpath.joinpath(foldname) allfolds.append(curfold) curfold.mkdir(exist_ok=True, parents=True) configfilesetup(curfold, ip) makedata(curfold) config = curfold / 'stats.ini' # rtemp = RadarSys(sensdict,simparams['Rangegatesfinal'],ip) # rsystools.append(rtemp.rms(sp.array([1e12]),sp.array([2.5e3]),sp.array([2.5e3]))) if check_run: runsim(functlist_red, curfold, str(curfold.joinpath('stats.ini')), True) if 'analysis' in functlist: analysisdump(curfold, config, params=['Ne', 'Te', 'Ti', 'Vi']) if 'stats' in functlist: makehist(curfold, ip)
def main(plist = None, functlist = ['spectrums','radardata','fitting','analysis','stats'], datadir=None): """ This function will call other functions to create the input data, config file and run the radar data sim. The path for the simulation will be created in the Testdata directory in the SimISR module. The new folder will be called BasicTest. The simulation is a long pulse simulation will the desired number of pulses from the user. Inputs npulse - Number of pulses for the integration period, default==100. functlist - The list of functions for the SimISR to do. """ if plist is None: plist = sp.array([50, 100, 200, 500, 1000, 2000, 5000]) if isinstance(plist, list): plist = sp.array(plist) if datadir is None: curloc = Path(__file__).resolve().parent testpath = curloc.parent.joinpath('Testdata', 'StatsTest') else: datadir = Path(datadir) testpath = datadir testpath.mkdir(exist_ok=True, parents=True) functlist_default = ['spectrums', 'radardata', 'fitting'] check_list = sp.array([i in functlist for i in functlist_default]) check_run = sp.any(check_list) functlist_red = sp.array(functlist_default)[check_list].tolist() allfolds = [] # rsystools = [] for ip in plist: foldname = 'Pulses_{:04d}'.format(ip) curfold = testpath.joinpath(foldname) allfolds.append(curfold) curfold.mkdir(exist_ok=True, parents=True) configfilesetup(curfold, ip) makedata(curfold) config = curfold/'stats.ini' # rtemp = RadarSys(sensdict,simparams['Rangegatesfinal'],ip) # rsystools.append(rtemp.rms(sp.array([1e12]),sp.array([2.5e3]),sp.array([2.5e3]))) if check_run: runsim(functlist_red, curfold, str(curfold.joinpath('stats.ini')), True) if 'analysis' in functlist: analysisdump(curfold, config, params = ['Ne', 'Te', 'Ti', 'Vi']) if 'stats' in functlist: makehist(curfold, ip)
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')
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"
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'))
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')
axmat[0].set_ylabel('Alt in km') axmat[0].legend() axmat[1].set_title('Temperture') axmat[1].set_xlim([100., 2500.]) axmat[1].set_xlabel(r'Temp in $^{\circ}$ K') axmat[1].set_ylabel('Alt in km') axmat[1].legend() plt.tight_layout() return figmplf,axmat if __name__ == '__main__': exppath = Path('~/DATA/Ion_Comp_Exp').expanduser() drpath = Path('~/Dropbox (MIT)/').expanduser() funclist = ['spectrums', 'radardata','fitting'] list1 = [i for i in exppath.glob('NO*')] configlist = [i.joinpath('chem_test.yml') for i in exppath.glob('NO*')] for idata,icon in zip(list1,configlist): runsimisr(funclist,str(idata),str(icon),True) for idata,icon in zip(list1,configlist): analysisdump(str(idata),str(icon),params = ['Ne','Nepow','Te','Ti']) for ipath in list1: idir=ipath.joinpath('AnalysisPlots') idest = drpath.joinpath(*ipath.parts[-2:]) shutil.copytree(str(idir),str(idest)) # main()
axmat[0].set_ylabel('Alt in km') axmat[0].legend() axmat[1].set_title('Temperture') axmat[1].set_xlim([100., 2500.]) axmat[1].set_xlabel(r'Temp in $^{\circ}$ K') axmat[1].set_ylabel('Alt in km') axmat[1].legend() plt.tight_layout() return figmplf, axmat if __name__ == '__main__': exppath = Path('~/DATA/Ion_Comp_Exp').expanduser() drpath = Path('~/Dropbox (MIT)/').expanduser() funclist = ['spectrums', 'radardata', 'fitting'] list1 = [i for i in exppath.glob('NO*')] configlist = [i.joinpath('chem_test.yml') for i in exppath.glob('NO*')] for idata, icon in zip(list1, configlist): runsimisr(funclist, str(idata), str(icon), True) for idata, icon in zip(list1, configlist): analysisdump(str(idata), str(icon), params=['Ne', 'Nepow', 'Te', 'Ti']) for ipath in list1: idir = ipath.joinpath('AnalysisPlots') idest = drpath.joinpath(*ipath.parts[-2:]) shutil.copytree(str(idir), str(idest)) # main()