def load_data(data_path,pars_path,n_samples): """ Loads txt files into a numpy array called data. """ # load xml file containing all waveform parameters for _,xml_filename in enumerate(glob.iglob('%s/*.xml' % pars_path)): print("Loading xml file: {}".format(xml_filename)) data_pars = np.array([]) mdcset = mdctools.MDCSet(['H1']) mdcset.load_xml(xml_filename) # load each waveform txt time series file for counter,filename in enumerate(glob.iglob('%s/*.txt' % data_path)): print("Loading waveform #{}".format(counter)) offset = int(np.random.uniform(-100,100)) # vary position of waveform if counter == 0: data = np.loadtxt(filename) data = resample(data, 512) data /= np.max(data) data = np.roll(data,offset) # store parameters in array data_pars = np.array([(512/2)+offset,mdcset.waveforms[counter].frequency]) # plot first waveform in training set plt.close() #plt.plot(data) #plt.savefig('/home/hunter.gabbard/public_html/Burst/sine-gaussian_runs/resampled_waveform.png') #plt.close() elif counter == n_samples: break else: data_new = np.loadtxt(filename) data_new = resample(data_new, 512) data_new /= np.max(data_new) data_new = np.roll(data_new,offset) # plot next waveform in training set #plt.plot(data_new) #plt.savefig('/home/hunter.gabbard/public_html/Burst/sine-gaussian_runs/resampled_waveform.png') data = np.vstack((data,data_new)) # store waveforms parameters in array data_pars = np.vstack((data_pars, [(512/2)+offset,mdcset.waveforms[counter].frequency])) return data, data_pars
from minke import mdctools, distribution, sources mdcset = mdctools.MDCSet(['L1', 'H1']) times = distribution.uniform_time(1126620016, 1136995216, number=1000) hrss_values = distribution.log_uniform(5e-23, 1e-20, len(times)) wnb = sources.WhiteNoiseBurst(duration=0.1, bandwidth=10, frequency=1000, hrss=1e-23, time=1126630000, seed=3) mdcset + wnb for hrss, time in zip(hrss_values, times): wnb = sources.WhiteNoiseBurst(duration=0.1, bandwidth=10, frequency=1000, hrss=hrss, time=time, seed=3) mdcset + wnb mdcset.save_xml('wnb1000b10tau0d1.xml.gz')
from minke import mdctools, distribution, sources from random import randint mdcset = mdctools.MDCSet(['H1']) times = distribution.uniform_time(1126620016, 1136995216, number=1000) hrss_values = distribution.log_uniform(1e-23, 1e-23, len(times)) sineGauss = sources.SineGaussian(q=15, frequency=100, polarisation='linear', hrss=1e-23, time=1126630000, seed=3) mdcset + sineGauss for hrss, time in zip(hrss_values, times): sineGauss = sources.SineGaussian(q=15, frequency=randint(100, 200), polarisation='linear', hrss=hrss, time=time, seed=3) mdcset + sineGauss mdcset.save_xml('sineGauss100b10tau0d1.xml.gz')