Skip to content

Commit

Permalink
Added test script and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jswoboda committed Apr 23, 2015
1 parent 7ba387d commit cc648c5
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 17 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ To determine if everything has been properly istalled it is suggested that user


$ cd RadarDataSim/RadarDataSim
$ python makeConfigFiles.py
$ python IonoContainer.py
$ python radarData.py
$ python fitterMethodGen.py
$ python basictest.py

If h5 files for each stage have been created then it should be properly installed.

Expand Down
11 changes: 7 additions & 4 deletions RadarDataSim/IonoContainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,8 @@ def MakeTestIonoclass(testv=False,testtemp=False):
Icont1 = IonoContainer(coordlist=coords,paramlist=params,times = times,sensor_loc = sp.zeros(3),ver =0,coordvecs =
['x','y','z'],paramnames=None,species=species,velocity=vel)
return Icont1
#%% Main
if __name__== '__main__':


def main():
curpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
testpath = os.path.join(os.path.split(curpath)[0],'Test')

Expand All @@ -555,4 +553,9 @@ def MakeTestIonoclass(testv=False,testtemp=False):
if Icont1==Icont3:
print "h5 file saving and reading works"
else:
print "Something is wrong with the h5 file writing and reading"
print "Something is wrong with the h5 file writing and reading"
#%% Main
if __name__== '__main__':


main()
32 changes: 32 additions & 0 deletions RadarDataSim/basictest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python
"""
Created on Thu Apr 23 14:42:30 2015
This script will run the unit tests for each of the classes in one script as a test to
see if the module has been installed correctly.
@author: John Swoboda
"""
import time
import makeConfigFiles
import IonoContainer
import radarData
import fitterMethodGen

def main():
print('Making config files')
time.sleep(3.0)
makeConfigFiles.main()
print('Making example input data')
time.sleep(3.0)
IonoContainer.main()
print('Applying the radar platform to the data and creating lags')
time.sleep(3.0)
radarData.main()
print('Now fitting data orm the lags.')
time.sleep(3.0)
fitterMethodGen.main()

if __name__== '__main__':


main()
7 changes: 5 additions & 2 deletions RadarDataSim/fitterMethodGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ def simpstart(Ne_init, loc,time,exinputs):
xarray[:,:,4] = 0.0
return xarray
#%% Testing

if __name__== '__main__':
def main():
""" Test function for the RadarData class."""
t1 = time.time()
curpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
Expand All @@ -125,3 +124,7 @@ def simpstart(Ne_init, loc,time,exinputs):
coordvecs = Ionoin.Coord_Vecs, paramnames=paranamsf,species=species)

Ionoout.saveh5(os.path.join(testpath,'fittedtestdata.h5'))
t2 = time.time()
print(t2-t1)
if __name__== '__main__':
main()
5 changes: 4 additions & 1 deletion RadarDataSim/makeConfigFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def ConfigSectionMap(Config,section):
dict1[option] = None
return dict1

if __name__== '__main__':
def main():
curpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
testpath = os.path.join(os.path.split(curpath)[0],'Test')
beamlist = [64094,64091,64088,64085,64082,64238,64286,64070,64061,64058,64055,64052,
Expand Down Expand Up @@ -124,3 +124,6 @@ def ConfigSectionMap(Config,section):

makeconfigfile(fname+'.ini',beamlist,radarname,simparams)
makepicklefile(fname+'.pickle',beamlist,radarname,simparams)

if __name__== '__main__':
main()
12 changes: 7 additions & 5 deletions RadarDataSim/radarData.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,8 @@ def lagdict2ionocont(DataLags,NoiseLags,sensdict,simparams,time_vec):

return IonoContainer(coordlist,Paramdata,times = time_vec,ver =1, paramnames=sp.arange(Nlags)*sensdict['t_s'])
#%% Testing

if __name__== '__main__':
""" Test function for the RadarData class."""
def main():
"""Testing function"""
t1 = time.time()
curpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
testpath = os.path.join(os.path.split(curpath)[0],'Test')
Expand All @@ -365,10 +364,13 @@ def lagdict2ionocont(DataLags,NoiseLags,sensdict,simparams,time_vec):
ioncont = IonoContainer.readh5(testh5)
outfile = os.path.join(testpath,'testionospec.h5')

ioncont.makespectruminstanceopen(specfunctions.ISRSspecmake,sensdict,simparams['numpoints']).saveh5(outfile)
ioncont.makespectruminstanceopen(specfunctions.ISRSspecmake,sensdict,
simparams['numpoints']).saveh5(outfile)
radardata = RadarDataFile({0.0:outfile},inifile,testpath)

ionoout = radardata.processdataiono()
ionoout.saveh5(os.path.join(testpath,'lags.h5'))
t2 = time.time()
print(t2-t1)
print(t2-t1)
if __name__== '__main__':
main()
5 changes: 4 additions & 1 deletion beamtools/pickBeams.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env python
"""
Created on Wed Mar 25 19:53:46 2015
This GUI is based off of a GUI originally developed by Steven Chen at SRI.
The code was cleaned up so that the GUI is now encompassed in a class structure. Also
the ability to switch between PFISR and RISR-N has been added along with a finish button.
The code also outputs a picture of the selected beam pattern.
@author: John Swoboda
"""
Expand Down

0 comments on commit cc648c5

Please sign in to comment.