def savefile(self): """Saves the parameters out""" fn = tkFileDialog.asksaveasfilename(title="Save File", filetypes=[('INI', '.ini'), ('PICKLE', '.pickle')]) blist = self.pickbeams.output self.pickbeams.buttonClick(fn) radarname = self.pickbeams.var.get() posspec = ['N2+', 'N+', 'O+', 'NO+', 'H+', 'O2+', 'e-'] specieslist = self.species.get().lower().split() newlist = [x for x in posspec if x.lower() in specieslist] if 'e-' not in newlist: newlist.append('e-') simparams = { 'IPP': float(self.ipp.get()), 'TimeLim': float(self.timelim.get()), 'RangeLims': [ int(float(self.rangelimlow.get())), int(float(self.rangelimhigh.get())) ], 'Pulselength': 1e-6 * float(self.pulselength.get()), 't_s': 1e-6 * float(self.t_s.get()), 'Pulsetype': self.pulsetype.get(), 'Tint': float(self.tint.get()), 'Fitinter': float(self.fitinter.get()), 'NNs': int(float(self.nns.get())), 'NNp': int(float(self.nnp.get())), 'dtype': { 'complex128': sp.complex128, 'complex64': sp.complex64 }[self.dtype.get()], 'ambupsamp': int(float(self.ambupsamp.get())), 'species': newlist, 'numpoints': int(float(self.numpoints.get())), 'startfile': self.startfile.get(), 'FitType': self.fittype.get() } if len(self.outangles.get()) > 0: outlist1 = self.outangles.get().split(',') simparams['outangles'] = [[ float(j) for j in i.lstrip().rstrip().split(' ') ] for i in outlist1] makeconfigfile(fn, blist, radarname, simparams)
def savefile(self): """Saves the parameters out""" fn = tkFileDialog.asksaveasfilename(title="Save File",filetypes=[('INI','.ini'),('PICKLE','.pickle')]) blist = self.pickbeams.output self.pickbeams.buttonClick(fn) radarname = self.pickbeams.var.get() posspec = ['N2+', 'N+', 'O+', 'NO+', 'H+', 'O2+','e-' ] specieslist = self.species.get().lower().split() newlist =[x for x in posspec if x.lower() in specieslist] if 'e-' not in newlist:newlist.append('e-') simparams ={'IPP':float(self.ipp.get()), 'TimeLim':float(self.timelim.get()), 'RangeLims':[int(float(self.rangelimlow.get())),int(float(self.rangelimhigh.get()))], 'Pulselength':1e-6*float(self.pulselength.get()), 't_s': 1e-6*float(self.t_s.get()), 'Pulsetype':self.pulsetype.get(), 'Tint':float(self.tint.get()), 'Fitinter':float(self.fitinter.get()), 'NNs': int(float(self.nns.get())), 'NNp':int(float(self.nnp.get())), 'dtype':{'complex128':sp.complex128,'complex64':sp.complex64}[self.dtype.get()], 'ambupsamp':int(float(self.ambupsamp.get())), 'species':newlist, 'numpoints':int(float(self.numpoints.get())), 'startfile':self.startfile.get(), 'FitType': self.fittype.get()} makeconfigfile(fn,blist,radarname,simparams)
def configsetup(testpath): """This function will make a pickle file used to configure the simulation. Inputs testpath - A string for the path that this file will be saved.""" beamlist = [64094,64091,64088,64085,64082,64238,64286,64070,64061,64058,64055,64052, 64049,64046,64043,64067,64040,64037,64034] # list of beams in radarname = 'pfisr'# name of radar for parameters can either be pfisr or risr Tint=60.0 # integration time in seconds time_lim = 4.0*Tint # simulation length in seconds fitter_int = 60.0 # time interval between fitted params # pulse = sp.ones(14)# pulse rng_lims = [150,500]# limits of the range gates IPP = .0087 #interpulse period in seconds NNs = 28 # number of noise samples per pulse NNp = 100 # number of noise pulses simparams = {'IPP':IPP, #interpulse period 'TimeLim':time_lim, # length of simulation 'RangeLims':rng_lims, # range swath limit # 'Pulse':pulse, # pulse shape 'Pulselength':280e-6, 'FitType' :'acf', 't_s': 20e-6, 'Pulsetype':'long', # type of pulse can be long or barker, 'Tint':Tint, #Integration time for each fitting 'Fitinter':fitter_int, # time interval between fitted params 'NNs': NNs,# number of noise samples per pulse 'NNp':NNp, # number of noise pulses 'dtype':sp.complex128, #type of numbers used for simulation 'ambupsamp':1, # up sampling factor for ambiguity function 'species':['O+','e-'], # type of ion species used in simulation 'numpoints':128, # number of points for each spectrum 'startfile':os.path.join(testpath,'startdata.h5')}# file used for starting points # 'SUMRULE': sp.array([[-2,-3,-3,-4,-4,-5,-5,-6,-6,-7,-7,-8,-8,-9] # ,[1,1,2,2,3,3,4,4,5,5,6,6,7,7]])} fname = os.path.join(testpath,'PFISRExample') makeconfigfile(fname+'.ini',beamlist,radarname,simparams)
def configfilesetup(testpath, npulses): """ This will create the configureation file given the number of pulses for the test. This will make it so that there will be 12 integration periods for a given number of pulses. Input testpath - The location of the data. npulses - The number of pulses. """ curloc = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) defcon = os.path.join(curloc, 'statsbase.ini') (sensdict, simparams) = readconfigfile(defcon) tint = simparams['IPP'] * npulses ratio1 = tint / simparams['Tint'] simparams['Tint'] = ratio1 * simparams['Tint'] simparams['Fitinter'] = ratio1 * simparams['Fitinter'] simparams['TimeLim'] = ratio1 * simparams['TimeLim'] simparams['startfile'] = 'startfile.h5' makeconfigfile(os.path.join(testpath, 'stats.ini'), simparams['Beamlist'], sensdict['Name'], simparams)