def create_objs(self, folder, filen_0, dim_1, dim_2, dim_3, doHist2d, doRaw, doCorrel=True): ''' Prepare Data files, where processed information will be stored ''' self.doHist2d = doHist2d self.doRaw = doRaw self.doCorrel = doCorrel nfolder = folder + filen_0 + self.name + '\\' # -> data\\subfolder\\ self.nfolder = nfolder if not os.path.exists(nfolder): os.makedirs(nfolder) self.DSP_PD1 = DataStoreSP(nfolder, filen_0, dim_1, dim_2, dim_3, 'D1Pow', cname='Watts') self.DSP_PD2 = DataStoreSP(nfolder, filen_0, dim_1, dim_2, dim_3, 'D2Pow', cname='Watts') self.DSP_LD1 = DataStoreSP(nfolder, filen_0, dim_1, dim_2, dim_3, 'D1LevCor', cname='LC') self.DSP_LD2 = DataStoreSP(nfolder, filen_0, dim_1, dim_2, dim_3, 'D2LevCor', cname='LC') self.DS2vD1 = DataStore2Vec(nfolder, filen_0, dim_1, dim_2, dim_3, 'D1vAvg') self.DS2vD2 = DataStore2Vec(nfolder, filen_0, dim_1, dim_2, dim_3, 'D2vAvg') self.DS2mD1 = DataStore2Vec(nfolder, filen_0, dim_1, dim_2, dim_3, 'D1mAvg') self.DS2mD2 = DataStore2Vec(nfolder, filen_0, dim_1, dim_2, dim_3, 'D2mAvg') if self.doCorrel: self.DS11 = DataStore11Vec(nfolder, filen_0, dim_1, dim_2, self.D1, 'CovMat') # Cov Matrix D1 has dim_3 info if self.doHist2d: '''If doHist2d is set to True, a hdf5 file will be created to save the histogram data.''' Hname = nfolder+'Hist2d'+self.name+'.hdf5' self.Hdata = storehdf5(Hname) self.Hdata.clev = 1 # Compression level to a minimum for speed self.Hdata.open_f(mode='w') # create a new empty file self.create_Htables(dim_3.pt, dim_2.pt, dim_1.pt) if self.doRaw: Rname = nfolder+'Raw'+self.name+'.hdf5' self.Rdata = storehdf5(Rname) self.Rdata.clev = 1 # Compression level to a minimum for speed self.Rdata.open_f(mode='w') # create a new empty file self.create_Rtables(dim_3.pt, dim_2.pt, dim_1.pt)
def load_dataset(dispData, dicData, ext='hdf5_on'): '''Reads from the dictionary which data set was selected''' dicData[ext] = storehdf5(str(dispData[ext])) dicData[ext].open_f(mode='r')
import numpy as np import matplotlib.pyplot as plt from parsers import storehdf5, loadmtx, savemtx from scipy.constants import h # , e, c , pi import scipy.signal as signal import threading from scipy.signal.signaltools import _next_regular from numpy.fft import rfftn, irfftn _rfft_lock = threading.Lock() plt.ion() fnum = '1150' file1 = 'RawON.hdf5' folder1 = 'data3//'+fnum+'_ON//' on = storehdf5(folder1 + file1) on.open_f(mode='r') file2 = 'RawOFF.hdf5' folder2 = 'data3//'+fnum+'_OFF//' off = storehdf5(folder2 + file2) off.open_f(mode='r') d1 = on.h5.root d2 = off.h5.root f1 = 4.8e9 f2 = 4.1e9 G1 = 602.0e7 G2 = 685.35e7 B = 1e5