diff --git a/doc/python/asrc_utils.py b/doc/python/asrc_utils.py index 388b5f14..5adcef85 100644 --- a/doc/python/asrc_utils.py +++ b/doc/python/asrc_utils.py @@ -39,16 +39,16 @@ def __init__(self, path, relative, fftPoints, ch0_bins, ch1_bins): # definitions of sample ratea self.allRates =["16", "32", "44", "48", "88", "96", "176", "192"] - self.srcRates =["44", "48", "88", "96", "176", "192"] # supported by the aasrc and ssrc + self.srcRates =["44", "48", "88", "96", "176", "192"] # supported by the asrc and ssrc self.factors = {"44":0, "48":1, "88":2, "96":3, "176":4, "192":5} # look up to convert rate to the filter bank id needed by the ASRC - self.sampleRates = {"16":16000, "32":32000, "44":44100, "48":48000, "88":88200, "96":96000, "176":176400, "192":192000} #convinience to save typing out sample rates in full + self.sampleRates = {"16":16000, "32":32000, "44":44100, "48":48000, "88":88200, "96":96000, "176":176400, "192":192000} #convenience to save typing out sample rates in full self.sigMax = {"16":7300, "32":14600, "44":20200, "48":21800, "88":40000, "96":47990, "176":80000, "192":85000} # upper limit on input freq for given sample rate - self.numSamples = {} #populated later based on oprate to ensure sufficient samples for fft + self.numSamples = {} #populated later based on op-rate to ensure sufficient samples for fft self.ignoreSamples = 2000 #worst case for high up-sampling self.fftPoints = fftPoints - self.sig = [ch0_bins, ch1_bins] # defines the test signals for each of 2 channels, each is a list so more than one tine can be genertaed and combined + self.sig = [ch0_bins, ch1_bins] # defines the test signals for each of 2 channels, each is a list so more than one tone can be generated and combined self.log=[] self.plots=[] mp.prec = 1024 @@ -77,7 +77,7 @@ def build_model_exe(self, target): # populates channel 1 with mutiple tones, spaced logrithmically, most dense at higher freq, and ch0 is always 10% in # set in 'sigMax' beyond which reflections degrade the SNR. def updateSig(self, ipRate, ch0_bins, ch1_bins, autoFill=False): - # this manipultaes the fft size to attempt to force any reflections around the ip sample rate nyquist also ending up + # this manipulates the fft size to attempt to force any reflections around the ip sample rate nyquist also ending up # in an integer fft bin self.fftPoints = int(10000 *(self.sampleRates[ipRate] * self.fDev) / self.sampleRates[self.opRate]) print(f"Over-wrote the fft size to {self.fftPoints} points. ipRate = {ipRate}") @@ -167,7 +167,7 @@ def listFactors(self, x): def makeSignal(self, fsamp, fsig, asig, l, ferr=1.0): # populates ipdata with sinewave - # fsamp: sample rate, as abbevaited string (e.g., "48", interpreted as 48,000Hz) + # fsamp: sample rate, as abbreviated string (e.g., "48", interpreted as 48,000Hz) # fsig: signal freq, in Hz # asig: amplitude, in range 0-1 # l: number of samples @@ -201,7 +201,7 @@ def makeInputFiles(self, test_rates, ferr=1.0): chan=[] chanSigData=[] i=0 - for ch in self.sig: #itterates over channels + for ch in self.sig: #iterates over channels sig=[] for s in ch: f = mp.fmul(realRate ,mp.fdiv(s, self.fftPoints)) @@ -226,7 +226,7 @@ def makeInputFiles(self, test_rates, ferr=1.0): def doFFT(self, data, window=False): - # convinient way to select between fft styles. Note that the periodic one will need a lot more samples, so + # convenient way to select between fft styles. Note that the periodic one will need a lot more samples, so # use window=True for debuging. if window: return self.winFFT(data) @@ -256,7 +256,7 @@ def rawFFT(self, data): def plotFFT(self, xydata, combine=False, title=None, subtitles=None, log=True, text=None): # Plot style setup for the FFT plots, labels x asis as KHz and y axis as dB. # xydata: an array of datasets, each dataset is a 3 element array containing the xdata array and ydata_dB array and ydata_lin array - # combine: (optional) forces all plots ontot the same chart, otherwise it will create a grid of plots + # combine: (optional) forces all plots onto the same chart, otherwise it will create a grid of plots # title: (optional) the chart title at the top, common to any subplots # subtitles: (optional) an array of subtitles, used for each subplot. # log: plots the dB data in the input @@ -299,12 +299,12 @@ def plotFFT(self, xydata, combine=False, title=None, subtitles=None, log=True, t def opFileName(self, fin, label, fDev, opRate): - #a simple utility to convert an input file pat+name to an output version, appending the frequency deviation + #a simple utility to convert an input file path+name to an output version, appending the frequency deviation newName = fin.replace(self.inputFolder, self.outputFolder).replace(".dat", "_fso{}_fdev{:f}_{}.dat".format(opRate, fDev, label)) return newName def exFileName(self, fin, label, fDev, opRate): - #a simple utility to convert an input file pat+name to an output version, appending the frequency deviation + #a simple utility to convert an input file path+name to an output version, appending the frequency deviation newName = fin.replace(self.inputFolder, self.expectedFolder).replace(".dat", "_fso{}_fdev{:f}_{}.dat".format(opRate, fDev, label)) return newName diff --git a/doc/python/doc_asrc.py b/doc/python/doc_asrc.py index 312b702d..bb6b564a 100644 --- a/doc/python/doc_asrc.py +++ b/doc/python/doc_asrc.py @@ -9,11 +9,11 @@ # OVERVIEW # # This script generates a set of test files for the supported input and output rates. -# It passes these through the golden reference "C" models and xsim, and -# Plots the FFTs, extracts the SNR, THD, and extracts MIPS estimate. -# All this info is annotated on the Plot which is saved to the otput folder. +# It passes these through the golden reference "C" models, and +# Plots the FFTs, and extracts the SNR and THD. +# All this info is annotated on the Plot which is saved to the output folder. # -# Note that both the C model is a dual-channel iplementations, so we pass them a pair of source files +# Note that both the C model is a dual-channel implementations, so we pass them a pair of source files # and since this is ASRC, we vary the frequency deviation parameter fDev. # But, OS3 and DS3 are single channel apps - which is dealt with! # @@ -42,7 +42,7 @@ no_results = True # the RST contains headings for all fDev, opRate and ipRate - so if this is an unsupported combination, add a warning to thr RST. for ipRate in U.allRates:# for each of the possible input sample rates # opportunity to choose different test freq, which also sets a safer fft size - U.updateSig(ipRate, [int(fftPoints/5)], [int(fftPoints/4),int(fftPoints/6)], True) # specified in temrs of FFT o/p bin, when flag set true it auto-fills a logrithmic range for ch1 and 5% in for ch0 + U.updateSig(ipRate, [int(fftPoints/5)], [int(fftPoints/4),int(fftPoints/6)], True) # specified in terms of FFT o/p bin, when flag set true it auto-fills a logarithmic range for ch1 and 5% in for ch0 # Make a set of input files based on range of sample rates supported ipFiles, sig = U.makeInputFiles([ipRate], FERR) # makes the signals, saves data as files and returns some info about them @@ -50,7 +50,7 @@ # Put the input data through the golden "C" emulators opFiles, simLog = U.run_c_model(ipFiles, opRate, 4, fDev) - # Itterate over all the input data files and channels + # Iterate over all the input data files and channels for channels in ipFiles: # For each input sata set there will be an output one for each channel for channel in channels[0:2]: print(channel) @@ -82,9 +82,9 @@ #Plot the results - plotFile = U.plotFFT(U.plot_data, combine=False, title=U.makePlotTitle(simLog, channel), subtitles=U.plot_label, log=True, text=U.plot_text) # plots a grid of charts, one per cimulation model + plotFile = U.plotFFT(U.plot_data, combine=False, title=U.makePlotTitle(simLog, channel), subtitles=U.plot_label, log=True, text=U.plot_text) # plots a grid of charts, one per simulation model U.makeRST(plotFile, ipRate, opRate, fDev, simLog[channel].keys()) # add this plot to a list to save as an RST file later - U.resetPlotInfo() # otherwise the next itteration of rates etc will add more plots to this instead of starting a new plot. + U.resetPlotInfo() # otherwise the next iteration of rates etc will add more plots to this instead of starting a new plot. if no_results: U.addRSTText("No SRC available for this scenario.")