diff --git a/docs/.buildinfo b/docs/.buildinfo index e02d83c..c17c206 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: a5e0270e42197ce57616db56a5c9e676 +config: a5704f500776dac1385d77f6ad5ed451 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_modules/gdas/epower.html b/docs/_modules/gdas/epower.html index debfce7..814d977 100644 --- a/docs/_modules/gdas/epower.html +++ b/docs/_modules/gdas/epower.html @@ -6,7 +6,7 @@ - gdas.epower — gdas 0.2.9 documentation + gdas.epower — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - - - - - - - - - - -
- - -

Source code for gdas.plots

-import matplotlib,numpy,mlpy
-matplotlib.use('Agg')
-from astropy.units        import Quantity
-from matplotlib           import pyplot
-from gwpy.plotter         import SegmentPlot,TimeSeriesPlot,SpectrumPlot,SpectrogramPlot
-from gwpy.segments        import SegmentList
-from gwpy.spectrum        import Spectrum
-from gwpy.spectrogram     import Spectrogram
-from gwpy.table.lsctables import SnglBurstTable
-from gwpy.timeseries      import TimeSeries
-from pylab                import *
-from scipy                import signal
-
-
[docs]def plot_activity(full_seglist): - """ - Plot full activity period for station. - - Parameters - ---------- - full_seglist : dictionary - Continuous list of available data in the selected time period - """ - # Import gwpy tools - plot = SegmentPlot() - # Initialize plotting figure - ax = plot.gca() - # Plot all segment in figure - ax.plot(full_seglist) - # Save figure - pyplot.savefig("activity.png",dpi=500)
- -
[docs]def plot_time_series(station,ts_list,seglist=None,hp=None): - """ - Generate a plot of the whole data time series - """ - plot = TimeSeriesPlot() - ax = plot.gca() - # Loop over all the time series - for ts in ts_list: - # Plot time series for each segment - ax.plot(ts, color='black') - # Display title - ax.set_title('$\mathrm{'+station+'}$') - # Plot fake signal - if hp!=None: - ax.plot(hp, color='red') - # Plot activity segments - if seglist!=None: - plot.add_state_segments(SegmentList(seglist[station].active),plotargs={'label':'data present','facecolor': 'g','edgecolor': 'k'}) - # Fix exceeded cell block limit error - matplotlib.pyplot.rcParams['agg.path.chunksize'] = 20000 - # Save figure - plot.savefig('time_series.png',dpi=500)
- -
[docs]def plot_asd(station,ts_list): - """ - Plot Amplitude Spectral Density. AGG complexity starts to complain - with large numbers of points. And we somehow invoke precision issues - that need to be ameliorated. - """ - if station!='fake': - for d in ts_list: - d.x0 = Quantity(int(d.x0.value * 500), d.xunit) - d.dx = Quantity(1, d.xunit) - ts_list.coalesce() - for d in ts_list: - d.x0 = Quantity(d.x0.value / 500, d.xunit) - d.dx = Quantity(0.002, d.xunit) - # Initialize plotting functionality - plot = SpectrumPlot() - # Loop over all the time series - for d in ts_list: - # Generate 8 seconds per FFT with 4 second (50%) overlap - spectrum = d.asd(8, 4) - # Create plotting axis - ax = plot.gca() - # Plot square root of the spectrum - ax.plot(numpy.sqrt(spectrum)) - # Set x axis to log scale - ax.set_xscale('log') - # Set y axis to log scale - ax.set_yscale('log') - # Set x axis limits - ax.set_xlim(1e-1, 500) - # Save figure - plot.savefig("asd.png",dpi=500)
- -
[docs]def plot_whitening(station,ts_list,seglist=None): - """ - Generate a spectrogram plot and normalized spectrogram - norm: \sqrt{S(f,t)} / \sqrt{\overbar{S(f)}} - """ - stride,fftlength,overlap = 20,6,3 - plot = SpectrogramPlot() - ax = plot.gca() - white_plot = SpectrogramPlot() - wax = white_plot.gca() - for ts in ts_list: - if (len(ts) * ts.dt).value < stride: - continue - spec = ts.spectrogram(stride, fftlength=fftlength, overlap=overlap) - ax.plot(spec) - wspec = spec.ratio('median') - wax.plot(wspec, vmin=0.1, vmax=100) - ax.set_title('$\mathrm{'+station+'}$') - ax.set_ylim(0.1, ts.sample_rate.value/2.) - ax.set_yscale('log') - wax.set_title('$\mathrm{'+station+'}$') - wax.set_ylim(0.1, ts.sample_rate.value/2.) - wax.set_yscale('log') - plot.add_colorbar(label='Amplitude') - white_plot.add_colorbar(label='Amplitude') - if seglist!=None: - plot.add_state_segments(SegmentList(seglist[station].active),plotargs={'label':'data present','facecolor':'g','edgecolor':'k'}) - white_plot.add_state_segments(SegmentList(seglist[station].active),plotargs={'label':'data present','facecolor':'g','edgecolor':'k'}) - plot.savefig("spectrogram.png",dpi=500) - white_plot.savefig("whitened.png",dpi=500)
- -def plot_bank(fdb): - pyplot.figure() - for i, fdt in enumerate(fdb[:5]): - pyplot.plot(fdt.frequencies, fdt, 'k-') - pyplot.grid() - pyplot.xlabel("frequency [Hz]") - pyplot.savefig('bank.png') - pyplot.close() - -def plot_filters(tdb,flow,band): - pyplot.figure() - pyplot.subplots_adjust(left=0.2,right=0.95,bottom=0.15,top=0.95,hspace=0,wspace=0) - for i, tdt in enumerate(tdb[:8:3]): - ax = pyplot.subplot(3, 1, i+1) - ax.plot(tdt.times.value - 2., numpy.real_if_close(tdt.value), 'k-') - c_f = flow+band/2 + 3 * (band*i) + 2. - ax.set_xlabel("Time (s)") - ax.set_ylabel("%d Hz" % c_f) - ax.set_xlim(25.0, 31.0) - ax.set_ylim([-max(tdt.value), max(tdt.value)]) - if i!=2: pyplot.setp(ax.get_xticklabels(), visible=False) - pyplot.savefig('filters.png') - pyplot.close() - -
[docs]def plot_ts(ts, fname="ts.png"): - plot = TimeSeriesPlot() - ax = plot.gca() - ax.plot(TimeSeries(ts, sample_rate=1.0/ts.delta_t, epoch=ts.start_time)) - ax.set_xlim(ts.start_time,ts.end_time) - pyplot.savefig(fname) - pyplot.close()
- -
[docs]def plot_spectrum(fd_psd): - plot = SpectrumPlot() - ax = plot.gca() - ax.plot(Spectrum(fd_psd, df=fd_psd.delta_f)) - #pyplot.ylim(1e-10, 1e-3) - pyplot.xlim(0.1, 500) - pyplot.loglog() - pyplot.savefig("psd.png") - pyplot.close()
- -
[docs]def plot_spectrogram(spec,dt,df,sample_rate,start_time,end_time,fname="specgram.png"): - plot = SpectrogramPlot() - ax = plot.gca() - ax.plot(Spectrogram(spec,dt=dt,df=df,epoch=start_time), cmap='viridis') - plot.add_colorbar(label='Amplitude') - pyplot.xlim(start_time,end_time) - pyplot.ylim(0,sample_rate/2.) - pyplot.savefig(fname) - pyplot.close()
- -
[docs]def plot_spectrogram_from_ts(ts): - plot = SpectrogramPlot() - ax = plot.gca() - ax.plot(Spectrogram(spec)) - #pyplot.ylim(1e-9, 1e-2) - #pyplot.xlim(0.1, 500) - #pyplot.loglog() - pyplot.savefig("specgram.png") - pyplot.close()
- -
[docs]def plot_triggers(): - events = SnglBurstTable.read('excesspower.xml.gz') - #plot = events.plot('time', 'central_freq', "duration", "bandwidth", color='snr') - plot = events.plot('time','central_freq',color='snr',edgecolor='none') - #plot.set_xlim(time_start,time_end) - #plot.set_ylim(band, sample_rate/2.) - plot.set_ylabel('Frequency [Hz]') - plot.set_yscale('log') - #plot.set_title('GNOME '+station+' station event triggers') - plot.add_colorbar(cmap='copper_r',label='Tile Energy') - pyplot.savefig("triggers.png",dpi=400)
- -def plot_tiles(): - bins = numpy.linspace(0, 40, 100) - cnt = numpy.zeros(bins.shape[0]-1) - for i, tdf in enumerate(tdb[:nchans]): - us_rate = int(1.0 / (2 * band*nc_sum * ts_data.dt.value)) - pyplot.figure(0, figsize=(10, 10)) - pyplot.subplot(nchans, 1, i+1) - white = tmp_ts_data.whiten(64, 32, asd=numpy.sqrt(cdata_psd_tmp), window='boxcar') * sample_rate/4 - snr_1dof = numpy.convolve(tdf, white, "valid") - # Undersample the data - snr_1dof = snr_1dof[::us_rate]**2 - # Sum semi-adjacent samples to get 2 DOF tiles - snr_2dof = numpy.convolve(snr_1dof, numpy.array([1, 0, 1, 0])) - t = TimeSeries(snr_2dof, epoch=white.epoch, sample_rate=int(1.0/(us_rate * tmp_ts_data.dt.value))) - pyplot.plot(t.times + len(tdf)/2 * tdf.dt, snr_2dof, 'k-') - pyplot.axvline(random_time) - tmp, _ = numpy.histogram(snr_2dof, bins=bins) - cnt += tmp - plot_spectrogram(dof_tiles.T,fname='%s/tf_%ichans_%02idof.png'%(segfolder,nc_sum+1,2*j)) - plot.savefig("%s/bands.png"%(segfolder)) - -def wavelet(ts_data): - z = numpy.array([float(i) for i in ts_data]) - t = numpy.array([float(i) for i in ts_data.sample_times]) - # Decimate magnetic field data to 1 sample/second - rate = [5,10,10] if ts_data.sample_rate==500 else [8,8,8] - for i in rate: - z = signal.decimate(z,i,zero_phase=True) - # Extract time every 500 sample - t = [t[n*ts_data.sample_rate] for n in range(len(t)/ts_data.sample_rate)] - # Convert every timing points to scale (hr,min,sec) units - s = 60. - t = [(t[i]-t[0])/s for i in range(len(t))] - # Do wavelet analysis - omega0 = 6 - fct = "morlet" - scales = mlpy.wavelet.autoscales(N=len(z),dt=1,dj=0.05,wf=fct,p=omega0) - spec = mlpy.wavelet.cwt(z,dt=1,scales=scales,wf=fct,p=omega0) - freq = (omega0 + numpy.sqrt(2.0 + omega0 ** 2)) / (4 * numpy.pi * scales[1:]) * 1000 - idxs = numpy.where(numpy.logical_or(freq<0.1,1000<freq))[0] - spec = numpy.delete(spec,idxs,0) - freq = numpy.delete(freq,idxs,0) - # Initialise axis - fig = figure(figsize=(12,8)) - plt.subplots_adjust(left=0.1, right=1, bottom=0.1, top=0.94, hspace=0, wspace=0) - ax1 = fig.add_axes([0.10,0.75,0.70,0.20]) - ax2 = fig.add_axes([0.10,0.10,0.70,0.60], sharex=ax1) - ax3 = fig.add_axes([0.83,0.10,0.03,0.60]) - # Plot time series - ax1.plot(t,abs(z)-numpy.average(abs(z)),'k') - ax1.set_ylabel('Magnetic Fields [uT]') - # Set up axis range for spectrogram - twin_ax = ax2.twinx() - twin_ax.set_yscale('log') - twin_ax.set_xlim(t[0], t[-1]) - twin_ax.set_ylim(freq[-1], freq[0]) - twin_ax.tick_params(which='both', labelleft=True, left=True, labelright=False) - # Plot spectrogram - img = ax2.imshow(numpy.abs(spec)**2,extent=[t[0],t[-1],freq[-1],freq[0]], - aspect='auto',interpolation='nearest',cmap=cm.jet,norm=mpl.colors.LogNorm()) # cm.cubehelix - ax2.tick_params(which='both', labelleft=False, left=False) - ax2.set_xlabel('Time [mins]') - ax2.set_ylabel('Frequency [mHz]',labelpad=50) - fig.colorbar(img, cax=ax3) - plt.savefig('wavelet.png') -
- -
- - - - - \ No newline at end of file diff --git a/docs/_modules/gdas/retrieve.html b/docs/_modules/gdas/retrieve.html deleted file mode 100644 index efd67a5..0000000 --- a/docs/_modules/gdas/retrieve.html +++ /dev/null @@ -1,268 +0,0 @@ - - - - - - - - gdas.retrieve — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -

Source code for gdas.retrieve

-""" Retrieving magnetic field data.""" 
-
-import os,glob,h5py,astropy,numpy,astropy,scipy
-from astropy.time    import Time
-from datetime        import datetime,timedelta
-from glue.segments   import segment,segmentlist
-from gwpy.segments   import DataQualityDict,DataQualityFlag
-from gwpy.timeseries import TimeSeries,TimeSeriesList
-from pycbc           import types
-
-
[docs]def magfield(station,starttime,endtime,activity=False,rep='/GNOMEDrive/gnome/serverdata/',resample=None): - """ - Glob all files withing user-defined period and extract data. - - Parameters - ---------- - station : str - Name of the station to be analysed - t0 : int - GPS timestamp of the first required magnetic field data - t1 : int - GPS timestamp of the last required magnetic field data - - Return - ------ - ts_data, ts_list, activity : TimeSeries, dictionary, list - Time series data for selected time period, list of time series - for each segment, sampling rate of the retrieved data - """ - setname = "MagneticFields" - dstr = ['%Y','%m','%d','%H','%M'] - dsplit = '-'.join(dstr[:starttime.count('-')+1]) - start = datetime.strptime(starttime,dsplit) - dsplit = '-'.join(dstr[:endtime.count('-')+1]) - end = datetime.strptime(endtime,dsplit) - dataset = [] - for date in numpy.arange(start,end,timedelta(minutes=1)): - date = date.astype(datetime) - path1 = rep+station+'/'+date.strftime("%Y/%m/%d/") - path2 = station+'_'+date.strftime("%Y%m%d_%H%M*.hdf5") - fullpath = os.path.join(path1,path2) - dataset += glob.glob(fullpath) - if len(dataset)==0: - print "ERROR: No data files were found..." - quit() - file_order,data_order = {},{} - for fname in dataset: - hfile = h5py.File(fname, "r") - segfile = file_to_segment(hfile,setname) - file_order[segfile] = fname - data_order[segfile] = hfile - # Extract sample rate from metadata of last read data file - sample_rate = hfile[setname].attrs["SamplingRate(Hz)"] - # Estimate full segment activity list - activity = create_activity_list(station,data_order) - # Generate an ASCII representation of the GPS timestamped segments of time covered by the input data - seglist = segmentlist(data_order.keys()) - # Sort the segment list - seglist.sort() - # Create list of time series from every segment - ts_list = generate_timeseries(file_order,setname) - # Retrieve channel data for all the segments - full_data = numpy.hstack([retrieve_channel_data(data_order[seg],setname) for seg in seglist]) - new_sample_rate = sample_rate if resample==None else resample - new_data_length = len(full_data)/float(sample_rate)*new_sample_rate - full_data = scipy.signal.resample(full_data,int(new_data_length)) - # Models a time series consisting of uniformly sampled scalar values - ts_data = types.TimeSeries(full_data,delta_t=1./new_sample_rate,epoch=seglist[0][0]) - for v in data_order.values(): - v.close() - return ts_data,ts_list,activity
- -
[docs]def file_to_segment(hfile,segname): - """ - Define length of data segment. The starting and ending UTC times - for a specific HDF5 file are determined by using the ``Date``, - ``t0`` and ``t1`` attributes from the metadata. The - :ref:`construct_utc_from_metadata <construct_utc_from_metadata>` - function is then used to calculate the UTC time. Finally, the - `segment <http://software.ligo.org/docs/glue/glue.__segments.segment-class.html>`_ - module from the ``glue.segments`` library is used to represent - the range of times in a semi-open interval. - - Parameters - ---------- - hfile : HDF5 file object - HDF5 data file preloaded with the h5py package - segname : str - Attribute name of the metadata to extract. - """ - # Extract all atributes from the data - attrs = hfile[segname].attrs - # Define each attribute - dstr, t0, t1 = attrs["Date"], attrs["t0"], attrs["t1"] - # Construct GPS starting time from data - start_utc = construct_utc_from_metadata(dstr, t0) - # Construct GPS ending time from data - end_utc = construct_utc_from_metadata(dstr, t1) - # Represent the range of times in the semi-open interval - return segment(start_utc,end_utc)
- -
[docs]def construct_utc_from_metadata(datestr, t0str): - """ - .. _construct_utc_from_metadata: - - Constructing UTC timestamp from metadata - - Parameters - ---------- - datestr : str - Date of the extracted data - t0str : str - GPS time - """ - instr = "%d-%d-%02dT" % tuple(map(int, datestr.split('/'))) - instr += t0str - t = astropy.time.Time(instr, format='isot', scale='utc') - return t.gps
- -
[docs]def generate_timeseries(data_list, setname="MagneticFields"): - """ - Generate time series using list of HDF5 data file paths - - Parameters - ---------- - data_list : dictionary - Dictionary that stored the path to the HDF5 data file - for each segment of data available. - - Returns - ------- - full_data : Array of segment's name - """ - full_data = TimeSeriesList() - for seg in sorted(data_list): - hfile = h5py.File(data_list[seg], "r") - full_data.append(retrieve_data_timeseries(hfile, "MagneticFields")) - hfile.close() - return full_data
- -
[docs]def create_activity_list(station,data_order): - """ - Create consecutive list of available data segment. - - Parameters - ---------- - station : string - Name of the station - data_order : dictionary - List of all the HDF5 data file for each segment - - Return - ------ - full_seglist : dictionary - Ordered list of segment - """ - # Generate an ASCII representation of the GPS timestamped segments of time covered by the input data - seglist = segmentlist(data_order.keys()) - # Sort the segment list - seglist.sort() - # Initialise dictionary for segment information - full_seglist = DataQualityDict() - # Save time span for each segment in ASCII file - with open("segments.txt", "w") as fout: - for seg in seglist: - print >>fout, "%10.9f %10.9f" % seg - # FIXME: Active should be masked from the sanity channel - full_seglist[station] = DataQualityFlag(station,active=seglist.coalesce(),known=seglist.coalesce()) - return full_seglist
- -
[docs]def retrieve_data_timeseries(hfile, setname): - """ - Retrieve data time series from HDF5 data file - - Parameters - ---------- - hfile : h5py file object - Metadata from the HDF5 data file - setname : string - Attribute of the channel to retrieve data from - """ - dset = hfile[setname] - sample_rate = dset.attrs["SamplingRate(Hz)"] - gps_epoch = construct_utc_from_metadata(dset.attrs["Date"], dset.attrs["t0"]) - data = retrieve_channel_data(hfile, setname) - ts_data = TimeSeries(data, sample_rate=sample_rate, epoch=gps_epoch) - return ts_data
- -
[docs]def retrieve_channel_data(hfile, setname): - """ - Retrieve the data from specific channel - - Parameters - ---------- - hfile : h5py file object - Metadata from the HDF5 data file - setname : string - Attribute of the channel to retrieve data from - - Return - ------ - data : array - Data from setname channel - """ - return hfile[setname][:]
-
- -
- - - - - \ No newline at end of file diff --git a/docs/_modules/gdas/utils.html b/docs/_modules/gdas/utils.html deleted file mode 100644 index bac1113..0000000 --- a/docs/_modules/gdas/utils.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - gdas.utils — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -

Source code for gdas.utils

-"""Other routines"""
-
-
[docs]def create_sound(ts): - """ - Create sound based on the data - - Parameters - ---------- - ts : TimeSeries - Time-series magnetic field data - """ - wout = wave.open("pure_tone.wav", "w") - wout.setnchannels(1) # mono - wout.setsampwidth(4) # 32 bit audio - wout.setframerate(1000) - wout.writeframes(ts[:]) - wout.close()
-
- -
- - - - - \ No newline at end of file diff --git a/docs/_modules/index.html b/docs/_modules/index.html index f9a8854..408a090 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -6,7 +6,7 @@ - Overview: module code — gdas 0.2.9 documentation + Overview: module code — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - - - + + + - - + + -
-
@@ -132,11 +125,11 @@

Multi-user Server -_images/jupyter1.png +backup/img/jupyter1.png

You can then use the terminal window to access files and create new Python scripts for your analysis.

-_images/jupyter2.png +backup/img/jupyter2.png
@@ -480,27 +473,27 @@

General overviewAnderson et al. (200) and has been extensively used in the detection of burst sources of gravitational radiation. A more technical documentation was written by Brady et al. (2007) describing how the algorithm used by the LIGO collaboration works and how the theory is translated into code.

We present below a step-by-step procedure followed during the Excess Power search analysis. For a better representation of what is happening, the figure at the end shows how the data is being split and analysed to search for multiple signals of different bandwidth and duration in the time-frequency plane.

@@ -969,25 +962,25 @@

Extract Magnetic Field Data -magfield(station, starttime, endtime[, ...]) +magfield(station, starttime, endtime[, ...]) Glob all files withing user-defined period and extract data. -file_to_segment(hfile, segname) +file_to_segment(hfile, segname) Define length of data segment. -construct_utc_from_metadata(datestr, t0str) +construct_utc_from_metadata(datestr, t0str) -generate_timeseries(data_list[, setname]) +generate_timeseries(data_list[, setname]) Generate time series using list of HDF5 data file paths -create_activity_list(station, data_order) +create_activity_list(station, data_order) Create consecutive list of available data segment. -retrieve_data_timeseries(hfile, setname) +retrieve_data_timeseries(hfile, setname) Retrieve data time series from HDF5 data file -retrieve_channel_data(hfile, setname) +retrieve_channel_data(hfile, setname) Retrieve the data from specific channel @@ -1002,31 +995,31 @@

Plotting routines -plot_activity(full_seglist) +plot_activity(full_seglist) Plot full activity period for station. -plot_time_series(station, ts_list[, seglist, hp]) +plot_time_series(station, ts_list[, seglist, hp]) Generate a plot of the whole data time series -plot_asd(station, ts_list) +plot_asd(station, ts_list) Plot Amplitude Spectral Density. -plot_whitening(station, ts_list[, seglist]) +plot_whitening(station, ts_list[, seglist]) Generate a spectrogram plot and normalized spectrogram -plot_ts(ts[, fname]) +plot_ts(ts[, fname]) -plot_spectrum(fd_psd) +plot_spectrum(fd_psd) -plot_spectrogram(spec, dt, df, sample_rate, ...) +plot_spectrogram(spec, dt, df, sample_rate, ...) -plot_spectrogram_from_ts(ts) +plot_spectrogram_from_ts(ts) -plot_triggers() +plot_triggers() @@ -1041,70 +1034,70 @@

Excess Power Search Analysis -excess_power(ts_data, psd_segment_length, ...) +excess_power(ts_data, psd_segment_length, ...) Perform excess-power search analysis on magnetic field data. -check_filtering_settings(sample_rate, ...) +check_filtering_settings(sample_rate, ...) Check filtering settings and define the total number of channels and bandwidth to use for filter bank. -calculate_psd(ts_data, sample_rate, ...) +calculate_psd(ts_data, sample_rate, ...) Estimate Power Spectral Density (PSD) -calculate_spectral_correlation(fft_window_len) +calculate_spectral_correlation(fft_window_len) Calculate the two point spectral correlation introduced by windowing the data before transforming to the frequency domain – valid choices are ‘hann’ and ‘tukey’. -create_filter_bank(delta_f, flow, band, ...) +create_filter_bank(delta_f, flow, band, ...) Create filter bank -convert_to_time_domain(fdb, sample_rate) +convert_to_time_domain(fdb, sample_rate) Convert filter bank from frequency to time domain -identify_block(ts_data, fd_psd, window, ...) +identify_block(ts_data, fd_psd, window, ...) Get frequency series of the current block -create_tf_plane(fd_psd, nchans, seg_len, ...) +create_tf_plane(fd_psd, nchans, seg_len, ...) Create time-frequency map -compute_filter_ips_self(lal_filters, spec_corr) +compute_filter_ips_self(lal_filters, spec_corr) Compute a set of inner products of input filters with themselves. -compute_filter_ips_adjacent(lal_filters, ...) +compute_filter_ips_adjacent(lal_filters, ...) Compute a set of filter inner products between input adjacent filters. -compute_channel_renormalization(filter_bank, ...) +compute_channel_renormalization(filter_bank, ...) Compute the renormalization for the base filters up to a given bandwidth. -measure_hrss(z_j_b, uw_ss_ii, uw_ss_ij, ...) +measure_hrss(z_j_b, uw_ss_ii, uw_ss_ij, ...) Approximation of unwhitened sum of squares signal energy in a given EP tile. -measure_hrss_slowly(z_j_b, lal_filters, ...) +measure_hrss_slowly(z_j_b, lal_filters, ...) Approximation of unwhitened sum of squares signal energy in a given EP tile. -measure_hrss_poorly(tile_energy, sub_psd) +measure_hrss_poorly(tile_energy, sub_psd) -trigger_list_from_map(tfmap, event_list, ...) +trigger_list_from_map(tfmap, event_list, ...) -determine_output_segment(inseg, dt_stride, ...) +determine_output_segment(inseg, dt_stride, ...) Given an input data stretch segment inseg, a data block stride dt_stride, the data sample rate, and an optional window_fraction, return the amount of data that can be processed without corruption effects from the window. -make_tiles(tf_map, nc_sum, mu_sq) +make_tiles(tf_map, nc_sum, mu_sq) -make_indp_tiles(tf_map, nc_sum, mu_sq) +make_indp_tiles(tf_map, nc_sum, mu_sq) Create a time frequency map with resolution of tf_map binning divided by nc_sum + 1. -make_filename(ifo, seg[, tag, ext]) +make_filename(ifo, seg[, tag, ext]) -construct_tiles(nc_sum, mu_sq, band, ...) +construct_tiles(nc_sum, mu_sq, band, ...) Constructing tile and calculate their energy -create_tile_duration(j, df, duration, tiles) +create_tile_duration(j, df, duration, tiles) -create_xml(ts_data, psd_segment_length, ...) +create_xml(ts_data, psd_segment_length, ...) @@ -1119,7 +1112,7 @@

Utilities -create_sound(ts) +create_sound(ts) Create sound based on the data @@ -1132,7 +1125,7 @@

Utilities

- Contents + Contents

diff --git a/docs/backup/excess_power.html b/docs/backup/excess_power.html new file mode 100644 index 0000000..e1c7447 --- /dev/null +++ b/docs/backup/excess_power.html @@ -0,0 +1,413 @@ + + + + + + + + Define analysing blocks — gdas 0.3.0 documentation + + + + + + + + + + + + + + + +
+ + +
+

Define analysing blocks¶

+

The first thing we do is to calculate the time series for the segment that is covered (tmp_ts_data) and redefined the metadata, especially the time of the first sample in seconds which is defined by the epoch argument and is different for every segment. After plotting the time series for that segment, the data are then converted into frequency series (fs_data) using the to_frequencyseries module from the pycbc.types.timeseries.TimeSeries library. Finally, the frequency data are then whitened.

+
# Loop over each data within the user requested time period
+while t_idx_max <= t_idx_max_off:
+    # Define starting and ending time of the segment in seconds
+    start_time = ts_data.start_time + t_idx_min/float(args.sample_rate)
+    end_time = ts_data.start_time + t_idx_max/float(args.sample_rate)
+    print tprint(t0,t1),"Analyzing block %i to %i (%.2f percent)"%(start_time,end_time,100*float(t_idx_max)/float(idx_max_off))
+    # Model a withen time series for the block
+    tmp_ts_data = types.TimeSeries(ts_data[t_idx_min:t_idx_max]*window, 1.0/args.sample_rate,epoch=start_time)
+    # Save time series in segment repository
+    segfolder = 'segments/%i-%i'%(start_time,end_time)
+    os.system('mkdir -p '+segfolder)
+    plot_ts(tmp_ts_data,fname='%s/ts.png'%(segfolder))
+    # Convert times series to frequency series
+    fs_data = tmp_ts_data.to_frequencyseries()
+    print tprint(t0,t1),"Frequency series data has variance: %s" % fs_data.data.std()**2
+    # Whitening (FIXME: Whiten the filters, not the data)
+    fs_data.data /= numpy.sqrt(fd_psd) / numpy.sqrt(2 * fd_psd.delta_f)
+    print tprint(t0,t1),"Whitened frequency series data has variance: %s" % fs_data.data.std()**2
+
+
+
+
+

Create time-frequency map for each block¶

+

We initialise a 2D zero array for a time-frequency map (tf_map) which will be computed for each frequency-domain filter associated to each PSD segment and where the filtered time-series for each frequency channels will be stored. The number of rows corresponds to the total number of frequency channels which is defined by the nchans variable. The number of columns corresponds to the segment length in samples (i.e. the number of samples covering one segment) which is defined by the seg_len variable.

+
# Initialise 2D zero array for time-frequency map
+tf_map = numpy.zeros((nchans, seg_len), dtype=numpy.complex128)
+
+
+

We also initialise a zero vector for a temporary filter bank (tmp_filter_bank) that will store, for a given channel, the filter’s values from the original filter bank (filter_bank) for that channel only. The length of the temporary filter bank is equal to the length of the PSD frequency series (fd_psd).

+
# Initialise 1D zero array
+tmp_filter_bank = numpy.zeros(len(fd_psd), dtype=numpy.complex128)
+
+
+

We then loop over all the frequency channels. While in the loop, we first re-initialise the temporary filter bank with zero values everywhere along the frequency series. We then determine the first and last frequency of each channel and re-define the values of the filter in that frequency range based on the values from the original channel’s filter from the original filter bank.

+
# Loop over all the channels
+print tprint(t0,t1),"Filtering all %d channels..." % nchans
+for i in range(nchans):
+    # Reset filter bank series
+    tmp_filter_bank *= 0.0
+    # Index of starting frequency
+    f1 = int(filter_bank[i].f0/fd_psd.delta_f)
+    # Index of ending frequency
+    f2 = int((filter_bank[i].f0 + 2*band)/fd_psd.delta_f)+1
+    # (FIXME: Why is there a factor of 2 here?)
+    tmp_filter_bank[f1:f2] = filter_bank[i].data.data * 2
+
+
+

We then extract the frequency series from the filter bank for that channel, which will be used as a template waveform to filter the actual data from the channel.

+
# Define the template to filter the frequency series with
+template = types.FrequencySeries(tmp_filter_bank, delta_f=fd_psd.delta_f, copy=False)
+
+
+

Finally, we use the matched_filter_core module from the pycbc.filter.matchedfilter library to filter the frequency series from the channel. This will return both a time series containing the complex signal-to-noise matched filtered against the data, and a frequency series containing the correlation vector.

+
# Create filtered series
+filtered_series = filter.matched_filter_core(template,fs_data,h_norm=None,psd=None,
+                                             low_frequency_cutoff=filter_bank[i].f0,
+                                             high_frequency_cutoff=filter_bank[i].f0+2*band)
+
+
+

The matched filter is the optimal linear filter for maximizing the signal to noise ratio (SNR) in the presence of additive stochastic noise. The filtered time series is stored in the time-frequency map and can be used to produce a spectrogram of the segment of data being analysed.

+
# Include filtered series in the map
+tf_map[i,:] = filtered_series[0].numpy()
+
+
+

The time-frequency map is a 2D array with a length that corresponds to the number of channels and a width equal to the number of sample present in one segment of data, i.e. segment’s length in seconds times the the sampling rate. The map can finally be plotted with a \(\Delta t\) corresponding to the sampling period of the original dataset (i.e. inverse of the original sampling rate), and \(\Delta f\) is equal to the bandwidth of one channel.

+
plot_spectrogram(numpy.abs(tf_map).T,tmp_ts_data.delta_t,fd_psd.delta_f,ts_data.sample_rate,start_time,end_time,fname='%s/tf.png'%(segfolder))
+
+
+
+
+

Constructing tiles of different bandwidth¶

+

First and foremost, we define a clipping region in the data to be used to remove window corruption, this is non-zero if the window_fraction variable is set to a non-zero value.

+
print tprint(t0,t1),"Beginning tile construction..."
+# Clip the boundaries to remove window corruption
+clip_samples = int(args.psd_segment_length * window_fraction * args.sample_rate / 2)
+
+
+

In order to perform a multi-resolution search, tiles of many different bandwidths and durations will be scanned. We first need to setup a loop such that the maximum number of additional channel is equal to the base 2 logarithm of the total number of channels. The number of narrow band channels to be summed (nc_sum) would therefore be equal to 2 to the power of the current quantity of additional channels.

+
for nc_sum in range(0, int(math.log(nchans, 2)))[::-1]: # nc_sum additional channel adds
+    nc_sum = 2**nc_sum - 1
+    print tprint(t0,t1,t2),"Summing %d narrow band channels..." % (nc_sum+1)
+
+
+

The undersampling rate for this tile can be calculated using the channel frequency band and the number of narrow band channels to be summed such that the bandwidth of the tile is equal to band * (nc_sum + 1).

+
us_rate = int(round(1.0 / (2 * band*(nc_sum+1) * ts_data.delta_t)))
+print >>sys.stderr, "Undersampling rate for this level: %f" % (args.sample_rate/us_rate)
+
+
+

“Virtual” wide bandwidth channels are constructed by summing the samples from multiple channels, and correcting for the overlap between adjacent channel filters. We then define the normalised channel at the current level and create a time frequency map for this tile using the make_indp_tiles internal function. In other word, we are constructing multiple sub-tiles for which we can determined the respective energy in the given frequency band.

+
mu_sq = mu_sq_dict[nc_sum]
+sys.stderr.write("\t...calculating tiles...")
+if clip_samples > 0:
+    tiles = make_indp_tiles(tf_map[:,clip_samples:-clip_samples:us_rate], nc_sum, mu_sq)
+else:
+    tiles = make_indp_tiles(tf_map[:,::us_rate], nc_sum, mu_sq)
+sys.stderr.write(" TF-plane is %dx%s samples... " % tiles.shape)
+print >>sys.stderr, " done"
+print "Tile energy mean: %f, var %f" % (numpy.mean(tiles), numpy.var(tiles))
+
+
+
+
+

Explore multiple tile durations¶

+

Now that we create a tile with a specific bandwidth, we can start exploring different durations for the tile. We will start checking if the user manually defined a value for the longest duration tile to compute, which can be done using the --max-duration argument. If not, the value will be set to 32.

+
if args.max_duration is not None:
+    max_dof = 2 * args.max_duration * (band * (nc_sum+1))
+else:
+    max_dof = 32
+assert max_dof >= 2
+
+
+

Since we produce (initially) tiles with 1 degree of freedom, the duration goes as one over twice the bandwidth.

+
print "\t\t...getting longer durations..."
+#for j in [2**l for l in xrange(1, int(math.log(max_dof, 2))+1)]:
+for j in [2**l for l in xrange(0, int(math.log(max_dof, 2)))]:
+    sys.stderr.write("\t\tSumming DOF = %d ..." % (2*j))
+    #tlen = tiles.shape[1] - j + 1
+    tlen = tiles.shape[1] - 2*j + 1 + 1
+    if tlen <= 0:
+        print >>sys.stderr, " ...not enough samples."
+        continue
+    dof_tiles = numpy.zeros((tiles.shape[0], tlen))
+    #:sum_filter = numpy.ones(j)
+    # FIXME: This is the correct filter for 50% overlap
+    sum_filter = numpy.array([1,0] * (j-1) + [1])
+    #sum_filter = numpy.array([1,0] * int(math.log(j, 2)-1) + [1])
+    for f in range(tiles.shape[0]):
+        # Sum and drop correlate tiles
+        # FIXME: don't drop correlated tiles
+        #output = numpy.convolve(tiles[f,:], sum_filter, 'valid')
+        dof_tiles[f] = fftconvolve(tiles[f], sum_filter, 'valid')
+    print >>sys.stderr, " done"
+    print "Summed tile energy mean: %f, var %f" % (numpy.mean(dof_tiles), numpy.var(dof_tiles))
+    level_tdiff = time.time() - tdiff
+    print >>sys.stderr, "Done with this resolution, total %f" % level_tdiff
+
+
+

Finally, the bandwidth and duration of the tile can be defined as followed:

+
# Current bandwidth of the time-frequency map tiles
+current_band = band * (nc_sum + 1)
+# How much each "step" is in the frequency domain -- almost
+# assuredly the fundamental bandwidth
+df = current_band
+# How much each "step" is in the time domain -- under sampling rate
+# FIXME: THis won't work if the sample rate isn't a power of 2
+dt = 1.0 / 2 / (2 * current_band) * 2
+full_band = 250
+dt = current_band / full_band * ts_data.sample_rate
+dt = 1.0/dt
+# Duration is fixed by the NDOF and bandwidth
+duration = j / 2.0 / current_band
+
+
+
+
+

Trigger finding¶

+

In order to find any trigger in the data, we first need to set a false alarm probability threshold in Gaussian noise above which signal will be distinguished from the noise. Such threshold can be determined by using the /inverse survival function/ method from the scipy.stats.chi2 package.

+
threshold = scipy.stats.chi2.isf(args.tile_fap, j)
+print "Threshold for this level: %f" % threshold
+#if numpy.any(dof_tiles > threshold):
+    #plot_spectrogram(dof_tiles.T)
+    #import pdb; pdb.set_trace()
+
+
+

Once the threshold is set, one can then run the trigger_list_from_map function to quickly find the trigger signal from the dof_tiles array that

+
# Since we clip the data, the start time needs to be adjusted accordingly
+window_offset_epoch = fs_data.epoch + args.psd_segment_length * window_fraction / 2
+trigger_list_from_map(dof_tiles, event_list, threshold, window_offset_epoch, filter_bank[0].f0 + band/2, duration, current_band, df, dt, None)
+for event in event_list[::-1]:
+    if event.amplitude != None:
+        continue
+    etime_min_idx = float(event.get_start()) - float(fs_data.epoch)
+    etime_min_idx = int(etime_min_idx / tmp_ts_data.delta_t)
+    etime_max_idx = float(event.get_start()) - float(fs_data.epoch) + event.duration
+    etime_max_idx = int(etime_max_idx / tmp_ts_data.delta_t)
+    # (band / 2) to account for sin^2 wings from finest filters
+    flow_idx = int((event.central_freq - event.bandwidth / 2 - (band / 2) - flow) / band)
+    fhigh_idx = int((event.central_freq + event.bandwidth / 2 + (band / 2) - flow) / band)
+    # TODO: Check that the undersampling rate is always commensurate
+    # with the indexing: that is to say that
+    # mod(etime_min_idx, us_rate) == 0 always
+    z_j_b = tf_map[flow_idx:fhigh_idx,etime_min_idx:etime_max_idx:us_rate]
+    # FIXME: Deal with negative hrss^2 -- e.g. remove the event
+    try:
+        event.amplitude = measure_hrss(z_j_b, unwhite_filter_ip[flow_idx:fhigh_idx], unwhite_ss_ip[flow_idx:fhigh_idx-1], white_ss_ip[flow_idx:fhigh_idx-1], fd_psd.delta_f, tmp_ts_data.delta_t, len(filter_bank[0].data.data), event.chisq_dof)
+    except ValueError:
+        event.amplitude = 0
+
+print "Total number of events: %d" % len(event_list)
+
+
+
+
+

Switch to new block¶

+

The following will move the frequency band to the next segment:

+
tdiff = time.time() - tdiff
+print "Done with this block: total %f" % tdiff
+
+t_idx_min += int(seg_len * (1 - window_fraction))
+t_idx_max += int(seg_len * (1 - window_fraction))
+
+
+
+
+

Extracting GPS time range¶

+

We use the LIGOTimeGPS structure from the =glue.lal= package to /store the starting and ending time in the dataset to nanosecond precision and synchronized to the Global Positioning System time reference/. Once both times are defined, the range of value is stored in a semi-open interval using the segment module from the =glue.segments= package.

+
# Starting epoch relative to GPS starting epoch
+start_time = LIGOTimeGPS(args.analysis_start_time or args.gps_start_time)
+# Ending epoch relative to GPS ending epoch
+end_time = LIGOTimeGPS(args.analysis_end_time or args.gps_end_time)
+# Represent the range of values in the semi-open interval
+inseg = segment(start_time,end_time)
+
+
+
+
+

Prepare output file for given time range¶

+
xmldoc = ligolw.Document()
+xmldoc.appendChild(ligolw.LIGO_LW())
+
+ifo = args.channel_name.split(":")[0]
+proc_row = register_to_xmldoc(xmldoc, __program__, args.__dict__, ifos=[ifo],version=glue.git_version.id, cvs_repository=glue.git_version.branch, cvs_entry_time=glue.git_version.date)
+
+# Figure out the data we actually analyzed
+outseg = determine_output_segment(inseg, args.psd_segment_length, args.sample_rate, window_fraction)
+
+ss = append_search_summary(xmldoc, proc_row, ifos=(station,), inseg=inseg, outseg=outseg)
+
+for sb in event_list:
+    sb.process_id = proc_row.process_id
+    sb.search = proc_row.program
+    #sb.ifo, sb.channel = args.channel_name.split(":")
+    sb.ifo, sb.channel = station, setname
+
+xmldoc.childNodes[0].appendChild(event_list)
+fname = make_filename(station, inseg)
+
+utils.write_filename(xmldoc, fname, gz=fname.endswith("gz"), verbose=True)
+
+
+
+
+

Plot trigger results¶

+
events = SnglBurstTable.read(fname+'.gz')
+#del events[10000:]
+plot = events.plot('time', 'central_freq', "duration", "bandwidth", color="snr")
+#plot = events.plot('time', 'central_freq', color='snr')
+#plot.set_yscale("log")
+plot.set_ylim(1e-0, 250)
+t0 = 1153742417
+plot.set_xlim(t0 + 0*60, t0 + 1*60)
+#plot.set_xlim(t0 + 28, t0 + 32)
+pyplot.axvline(t0 + 30, color='r')
+cb = plot.add_colorbar(cmap='viridis')
+plot.savefig("triggers.png")
+
+
+
+

Module Access¶

+
+
+
+

Extract Magnetic Field Data¶

+

Extract magnetic field data from HDF5 files.

+ ++++ + + + + + + + + + + + + + + + + + + + + + + + +
magfield(station, starttime, endtime[, ...])Glob all files withing user-defined period and extract data.
file_to_segment(hfile, segname)Define length of data segment.
construct_utc_from_metadata(datestr, t0str)
generate_timeseries(data_list[, setname])Generate time series using list of HDF5 data file paths
create_activity_list(station, data_order)Create consecutive list of available data segment.
retrieve_data_timeseries(hfile, setname)Retrieve data time series from HDF5 data file
retrieve_channel_data(hfile, setname)Retrieve the data from specific channel
+
+
+

Plotting routines¶

+

Methods to produce time-frequency plots and others

+ ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
plot_activity(full_seglist)Plot full activity period for station.
plot_time_series(station, ts_list[, seglist, hp])Generate a plot of the whole data time series
plot_asd(station, ts_list)Plot Amplitude Spectral Density.
plot_whitening(station, ts_list[, seglist])Generate a spectrogram plot and normalized spectrogram
plot_ts(ts[, fname])
plot_spectrum(fd_psd)
plot_spectrogram(spec, dt, df, sample_rate, ...)
plot_spectrogram_from_ts(ts)
plot_triggers()
+
+
+

Utilities¶

+

Independent routines to do various other things

+ ++++ + + + + + +
create_sound(ts)Create sound based on the data
+
+ + +
+ + + + + \ No newline at end of file diff --git a/docs/epower_step2_psd.html b/docs/calculate_psd.html similarity index 94% rename from docs/epower_step2_psd.html rename to docs/calculate_psd.html index 7cfa792..bb69d0d 100644 --- a/docs/epower_step2_psd.html +++ b/docs/calculate_psd.html @@ -6,7 +6,7 @@ - Excess Power - Step 2: Estimate Power Spectral Density (PSD) — gdas 0.2.9 documentation + Calculate Power Spectral Density (PSD) — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ + + + + + + + + + + + + +
+ + +
+

Constructing tiles of different bandwidth¶

+

First and foremost, we define a clipping region in the data to be used to remove window corruption, this is non-zero if the window_fraction variable is set to a non-zero value.

+
print tprint(t0,t1),"Beginning tile construction..."
+# Clip the boundaries to remove window corruption
+clip_samples = int(args.psd_segment_length * window_fraction * args.sample_rate / 2)
+
+
+

In order to perform a multi-resolution search, tiles of many different bandwidths and durations will be scanned. We first need to setup a loop such that the maximum number of additional channel is equal to the base 2 logarithm of the total number of channels. The number of narrow band channels to be summed (nc_sum) would therefore be equal to 2 to the power of the current quantity of additional channels.

+
for nc_sum in range(0, int(math.log(nchans, 2)))[::-1]: # nc_sum additional channel adds
+    nc_sum = 2**nc_sum - 1
+    print tprint(t0,t1,t2),"Summing %d narrow band channels..." % (nc_sum+1)
+
+
+

The undersampling rate for this tile can be calculated using the channel frequency band and the number of narrow band channels to be summed such that the bandwidth of the tile is equal to band * (nc_sum + 1).

+
us_rate = int(round(1.0 / (2 * band*(nc_sum+1) * ts_data.delta_t)))
+print >>sys.stderr, "Undersampling rate for this level: %f" % (args.sample_rate/us_rate)
+
+
+

“Virtual” wide bandwidth channels are constructed by summing the samples from multiple channels, and correcting for the overlap between adjacent channel filters. We then define the normalised channel at the current level and create a time frequency map for this tile using the make_indp_tiles internal function. In other word, we are constructing multiple sub-tiles for which we can determined the respective energy in the given frequency band.

+
mu_sq = mu_sq_dict[nc_sum]
+sys.stderr.write("\t...calculating tiles...")
+if clip_samples > 0:
+    tiles = make_indp_tiles(tf_map[:,clip_samples:-clip_samples:us_rate], nc_sum, mu_sq)
+else:
+    tiles = make_indp_tiles(tf_map[:,::us_rate], nc_sum, mu_sq)
+sys.stderr.write(" TF-plane is %dx%s samples... " % tiles.shape)
+print >>sys.stderr, " done"
+print "Tile energy mean: %f, var %f" % (numpy.mean(tiles), numpy.var(tiles))
+
+
+
+ + +
+ + + + + \ No newline at end of file diff --git a/docs/epower_step4_filterbank.html b/docs/create_filter_bank.html similarity index 89% rename from docs/epower_step4_filterbank.html rename to docs/create_filter_bank.html index 0dc6c86..86b6c44 100644 --- a/docs/epower_step4_filterbank.html +++ b/docs/create_filter_bank.html @@ -6,7 +6,7 @@ - Excess Power - Step 4: Computing the filter bank — gdas 0.2.9 documentation + Computing the filter bank — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ + + + + + + + + + + + + +
+ + +
+

Create time-frequency map¶

+

We initialise a 2D zero array for a time-frequency map (tf_map) which will be computed for each frequency-domain filter associated to each PSD segment and where the filtered time-series for each frequency channels will be stored. The number of rows corresponds to the total number of frequency channels which is defined by the nchans variable. The number of columns corresponds to the segment length in samples (i.e. the number of samples covering one segment) which is defined by the seg_len variable.

+
# Initialise 2D zero array for time-frequency map
+tf_map = numpy.zeros((nchans, seg_len), dtype=numpy.complex128)
+
+
+

We also initialise a zero vector for a temporary filter bank (tmp_filter_bank) that will store, for a given channel, the filter’s values from the original filter bank (filter_bank) for that channel only. The length of the temporary filter bank is equal to the length of the PSD frequency series (fd_psd).

+
# Initialise 1D zero array
+tmp_filter_bank = numpy.zeros(len(fd_psd), dtype=numpy.complex128)
+
+
+

We then loop over all the frequency channels. While in the loop, we first re-initialise the temporary filter bank with zero values everywhere along the frequency series. We then determine the first and last frequency of each channel and re-define the values of the filter in that frequency range based on the values from the original channel’s filter from the original filter bank.

+
# Loop over all the channels
+print tprint(t0,t1),"Filtering all %d channels..." % nchans
+for i in range(nchans):
+    # Reset filter bank series
+    tmp_filter_bank *= 0.0
+    # Index of starting frequency
+    f1 = int(filter_bank[i].f0/fd_psd.delta_f)
+    # Index of ending frequency
+    f2 = int((filter_bank[i].f0 + 2*band)/fd_psd.delta_f)+1
+    # (FIXME: Why is there a factor of 2 here?)
+    tmp_filter_bank[f1:f2] = filter_bank[i].data.data * 2
+
+
+

We then extract the frequency series from the filter bank for that channel, which will be used as a template waveform to filter the actual data from the channel.

+
# Define the template to filter the frequency series with
+template = types.FrequencySeries(tmp_filter_bank, delta_f=fd_psd.delta_f, copy=False)
+
+
+

Finally, we use the matched_filter_core module from the pycbc.filter.matchedfilter library to filter the frequency series from the channel. This will return both a time series containing the complex signal-to-noise matched filtered against the data, and a frequency series containing the correlation vector.

+
# Create filtered series
+filtered_series = filter.matched_filter_core(template,fs_data,h_norm=None,psd=None,
+                                             low_frequency_cutoff=filter_bank[i].f0,
+                                             high_frequency_cutoff=filter_bank[i].f0+2*band)
+
+
+

The matched filter is the optimal linear filter for maximizing the signal to noise ratio (SNR) in the presence of additive stochastic noise. The filtered time series is stored in the time-frequency map and can be used to produce a spectrogram of the segment of data being analysed.

+
# Include filtered series in the map
+tf_map[i,:] = filtered_series[0].numpy()
+
+
+

The time-frequency map is a 2D array with a length that corresponds to the number of channels and a width equal to the number of sample present in one segment of data, i.e. segment’s length in seconds times the the sampling rate. The map can finally be plotted with a \(\Delta t\) corresponding to the sampling period of the original dataset (i.e. inverse of the original sampling rate), and \(\Delta f\) is equal to the bandwidth of one channel.

+
plot_spectrogram(numpy.abs(tf_map).T,tmp_ts_data.delta_t,fd_psd.delta_f,ts_data.sample_rate,start_time,end_time,fname='%s/tf.png'%(segfolder))
+
+
+
+ + +
+ + + + + \ No newline at end of file diff --git a/docs/create_xml.html b/docs/create_xml.html new file mode 100644 index 0000000..f2cff98 --- /dev/null +++ b/docs/create_xml.html @@ -0,0 +1,122 @@ + + + + + + + + Extracting GPS time range — gdas 0.3.0 documentation + + + + + + + + + + + + + + + + +
+ + +
+

Extracting GPS time range¶

+

We use the LIGOTimeGPS structure from the =glue.lal= package to /store the starting and ending time in the dataset to nanosecond precision and synchronized to the Global Positioning System time reference/. Once both times are defined, the range of value is stored in a semi-open interval using the segment module from the =glue.segments= package.

+
# Starting epoch relative to GPS starting epoch
+start_time = LIGOTimeGPS(args.analysis_start_time or args.gps_start_time)
+# Ending epoch relative to GPS ending epoch
+end_time = LIGOTimeGPS(args.analysis_end_time or args.gps_end_time)
+# Represent the range of values in the semi-open interval
+inseg = segment(start_time,end_time)
+
+
+
+
+

Prepare output file for given time range¶

+
xmldoc = ligolw.Document()
+xmldoc.appendChild(ligolw.LIGO_LW())
+
+ifo = args.channel_name.split(":")[0]
+proc_row = register_to_xmldoc(xmldoc, __program__, args.__dict__, ifos=[ifo],version=glue.git_version.id, cvs_repository=glue.git_version.branch, cvs_entry_time=glue.git_version.date)
+
+# Figure out the data we actually analyzed
+outseg = determine_output_segment(inseg, args.psd_segment_length, args.sample_rate, window_fraction)
+
+ss = append_search_summary(xmldoc, proc_row, ifos=(station,), inseg=inseg, outseg=outseg)
+
+for sb in event_list:
+    sb.process_id = proc_row.process_id
+    sb.search = proc_row.program
+    #sb.ifo, sb.channel = args.channel_name.split(":")
+    sb.ifo, sb.channel = station, setname
+
+xmldoc.childNodes[0].appendChild(event_list)
+fname = make_filename(station, inseg)
+
+utils.write_filename(xmldoc, fname, gz=fname.endswith("gz"), verbose=True)
+
+
+
+
+

Plot trigger results¶

+
events = SnglBurstTable.read(fname+'.gz')
+#del events[10000:]
+plot = events.plot('time', 'central_freq', "duration", "bandwidth", color="snr")
+#plot = events.plot('time', 'central_freq', color='snr')
+#plot.set_yscale("log")
+plot.set_ylim(1e-0, 250)
+t0 = 1153742417
+plot.set_xlim(t0 + 0*60, t0 + 1*60)
+#plot.set_xlim(t0 + 28, t0 + 32)
+pyplot.axvline(t0 + 30, color='r')
+cb = plot.add_colorbar(cmap='viridis')
+plot.savefig("triggers.png")
+
+
+
+ + +
+ + + + + \ No newline at end of file diff --git a/docs/epower_overview.html b/docs/epower_overview.html deleted file mode 100644 index c81fdd9..0000000 --- a/docs/epower_overview.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - Excess Power - Overview — gdas 0.2.9 documentation - - - - - - - - - - - - - - - - - -
- - -
-

Excess Power - Overview¶

-

The Excess Power method is known as the optimal detection strategy to search for burst signals for which only the duration and frequency band are known, which is basically the case for GNOME and its search of Axion-Like Particles (ALP). This method was developed and introduced by Anderson et al. (200) and has been extensively used in the detection of burst sources of gravitational radiation. A more technical documentation was written by Brady et al. (2007) describing how the algorithm used by the LIGO collaboration works and how the theory is translated into code.

-

We present below a step-by-step procedure followed during the Excess Power search analysis. For a better representation of what is happening, the figure at the end shows how the data is being split and analysed to search for multiple signals of different bandwidth and duration in the time-frequency plane.

-
    -
  • Time domain segmentation and PSD estimate

    -
    -

    We first estimate the instrument’s noise Power Spectral Density (PSD) by splitting the time-series data into multiple overlapping segments. A periodogram for each segment is calculated separately and then averaged, which will reduce the variance of the individual power measurements. The result is a frequency series where samples are separated in frequency space by \(\Delta f\) equal to the inverse of a segment’s length and with a high end frequency limit equal to the Nyquist limit. The final power spectrum will help reveal the existence, or the absence, of repetitive patterns and correlation structures in a signal process.

    -
    -
  • -
  • Comb of frequency channels

    -
    -

    We then split the PSD frequency series into multiple channels. For each channel, a frequency domain filter is created with a \(\Delta f\) determined by the PSD and a total extent in Fourier space that is twice the stated bandwidth of a channel. The result is a list of each channel filter’s frequency series.

    -
    -
  • -
  • Creating analysing blocks

    -
    -

    The Excess Power method can lead to moderately-large computational requirements, and it has been found that the computational efficiency of this implementation can be improved upon by considering blocks of data that are much longer than the longest signal time duration. The entire time series is therefore split into separate blocks. We use the length of the segments used for PSD estimate to define the duration of each block. For each block, the time series is c0Aonverted into frequency series which is then filtered by the filter bank throughout all the channels. A time-frequency map is finally created which stores all the filtered frequency series from each channel.

    -
    -
  • -
  • Creating tiles with different bandwidth

    -
    -

    We can now construct tiles with different bandwidth by summing multiple channels together.

    -
    -
  • -
  • Exploring tiles with different duration

    -
    -

    For each given tile’s bandwidth, one can investigate different tile’s duration. This can be done by exploring different number of degrees of freedom, \(d\), which can be calculated as follows: \(d=2BT\) where \(B\) and \(T\) are respectively the bandwidth and duration of the tile. Section 2.2.5 of Brady et al. gives a great description of how to interpret the number of degrees of freedom. Therefore, by changing the \(d\), one can explore multiple tile’s duration for different bandwidth.

    -
    -
  • -
  • Define triggering signal

    -
    -

    The energy of each tile in the time-frequency space is calculated and compare to a user-defined threshold value. After defining a tile false alarm probability threshold in Gaussian noise and using the number of degrees of freedom for each tile, one can define a energy threshold value above which a burst trigger can be identified by comparing the energy threshold with the tile’s energy in the time-frequency map. A tile energy time frequency map plot similar to Figure 5 in Pustelny et al. (2013) can then be made which plots the outlying tile energies present in the data.

    -
    -
  • -
-
-_images/overview.png -

Overview of the Excess Power method and difference between segments, channels, tiles and blocks.

-
-
-

Code access¶

- ---- - - - - - -
excess_power(ts_data, psd_segment_length, ...)Perform excess-power search analysis on magnetic field data.
-
-
- - -
- - - - - \ No newline at end of file diff --git a/docs/example.html b/docs/example.html index 32dfc17..93a72f4 100644 --- a/docs/example.html +++ b/docs/example.html @@ -6,7 +6,7 @@ - Working Example — gdas 0.2.9 documentation + Working Example — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - +

Working Example

@@ -100,7 +100,7 @@

Working ExampleContents   ::   - Excess Power - Overview  Â» + Excess Power Overview  Â»

diff --git a/docs/excess_power.html b/docs/excess_power.html index bb46aa0..9568fa0 100644 --- a/docs/excess_power.html +++ b/docs/excess_power.html @@ -6,7 +6,7 @@ - Excess-Power algorithm — gdas 0.2.9 documentation + Excess Power Overview — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - + + +

+

Excess Power Overview

-
-

Excess-Power algorithm¶

-
-

General overview¶

+
+

Excess Power Overview¶

The Excess Power method is known as the optimal detection strategy to search for burst signals for which only the duration and frequency band are known, which is basically the case for GNOME and its search of Axion-Like Particles (ALP). This method was developed and introduced by Anderson et al. (200) and has been extensively used in the detection of burst sources of gravitational radiation. A more technical documentation was written by Brady et al. (2007) describing how the algorithm used by the LIGO collaboration works and how the theory is translated into code.

We present below a step-by-step procedure followed during the Excess Power search analysis. For a better representation of what is happening, the figure at the end shows how the data is being split and analysed to search for multiple signals of different bandwidth and duration in the time-frequency plane.

    -
  • Time domain segmentation and PSD estimate

    +
  • Time domain segmentation and PSD estimate

    We first estimate the instrument’s noise Power Spectral Density (PSD) by splitting the time-series data into multiple overlapping segments. A periodogram for each segment is calculated separately and then averaged, which will reduce the variance of the individual power measurements. The result is a frequency series where samples are separated in frequency space by \(\Delta f\) equal to the inverse of a segment’s length and with a high end frequency limit equal to the Nyquist limit. The final power spectrum will help reveal the existence, or the absence, of repetitive patterns and correlation structures in a signal process.

  • -
  • Comb of frequency channels

    +
  • Comb of frequency channels

    We then split the PSD frequency series into multiple channels. For each channel, a frequency domain filter is created with a \(\Delta f\) determined by the PSD and a total extent in Fourier space that is twice the stated bandwidth of a channel. The result is a list of each channel filter’s frequency series.

  • -
  • Creating analysing blocks

    +
  • Creating analysing blocks

    The Excess Power method can lead to moderately-large computational requirements, and it has been found that the computational efficiency of this implementation can be improved upon by considering blocks of data that are much longer than the longest signal time duration. The entire time series is therefore split into separate blocks. We use the length of the segments used for PSD estimate to define the duration of each block. For each block, the time series is c0Aonverted into frequency series which is then filtered by the filter bank throughout all the channels. A time-frequency map is finally created which stores all the filtered frequency series from each channel.

  • -
  • Creating tiles with different bandwidth

    +
  • Creating tiles with different bandwidth

    We can now construct tiles with different bandwidth by summing multiple channels together.

  • -
  • Exploring tiles with different duration

    +
  • Exploring tiles with different duration

    For each given tile’s bandwidth, one can investigate different tile’s duration. This can be done by exploring different number of degrees of freedom, \(d\), which can be calculated as follows: \(d=2BT\) where \(B\) and \(T\) are respectively the bandwidth and duration of the tile. Section 2.2.5 of Brady et al. gives a great description of how to interpret the number of degrees of freedom. Therefore, by changing the \(d\), one can explore multiple tile’s duration for different bandwidth.

  • -
  • Define triggering signal

    +
  • Define triggering signal

    The energy of each tile in the time-frequency space is calculated and compare to a user-defined threshold value. After defining a tile false alarm probability threshold in Gaussian noise and using the number of degrees of freedom for each tile, one can define a energy threshold value above which a burst trigger can be identified by comparing the energy threshold with the tile’s energy in the time-frequency map. A tile energy time frequency map plot similar to Figure 5 in Pustelny et al. (2013) can then be made which plots the outlying tile energies present in the data.

    @@ -85,538 +89,20 @@

    General overview

    Overview of the Excess Power method and difference between segments, channels, tiles and blocks.

-
-
-

Estimate Power Spectral Density (PSD)¶

-

The instrument’s noise Power Spectral Density (PSD) will be used to whiten the data and help reveal the existence, or the absence, of repetitive patterns and correlation structures in the signal process. It will also determine the total bandwidth spanned by each of the filters that will subsequently be created. The first thing to do before calculating the PSD is to ensure that the time series data is converted into an array of floating values.

-
# Convert time series as array of float
-data = ts_data.astype(numpy.float64)
-
-
-

The PSD is calculated by splitting up the signal into overlapping segments and scan through each segment to calculate individual periodogram. The periodograms from each segment are then averaged, reducing the variance of the individual power measurements. In order to proceed, we need to define the average method, avg_method, that will be used to measure the PSD from the data. This can be specified with the --psd-estimation option.

-
# Average method to measure PSD from the data
-avg_method = args.psd_estimation
-
-
-

One also needs to specify the length of each segment, seg_len, as well as the separation between 2 consecutive segments, seg_stride. Both parameters can be defined in second units with the --psd-segment-length and --psd-segment-stride arguments respectively and can then be converted into sample unit.

-
# The segment length for PSD estimation in samples
-seg_len = int(args.psd_segment_length * args.sample_rate)
-# The separation between consecutive segments in samples
-seg_stride = int(args.psd_segment_stride * args.sample_rate)
-
-
-

We then use the Welch’s method to perform the power spectral density estimate using the welch module from the pycbc.psd library. What this will do is to compute the discrete Fourier transform for each PSD segment to produce invidual periodograms, and then compute the squared magnitude of the result. The individual periodograms are then averaged using the user-defined average method, avg_method, and return the frequency series, fd_psd, which will store the power measurement for each frequency bin.

-
# Lifted from the psd.from_cli module
-fd_psd = psd.welch(data,avg_method=avg_method,seg_len=seg_len,seg_stride=seg_stride)
-# Plot the power spectral density
-plot_spectrum(fd_psd)
-# We need this for the SWIG functions
-lal_psd = fd_psd.lal()
-
-
-

One can display the power measurements, frequency array and frequency between consecutive samples, \(\Delta f\) in Hertz, by printing the following variables:

-
print 'Display power measurements of the first 10 frequency bins'
-print fd_psd[:10]
-print 'Display central frequency of the first 10 bins'
-print fd_psd.sample_frequencies[:10]
-print 'Display the frequency separation between bins'
-print fd_psd.delta_f
-
-
-

\(\Delta f\) corresponds to the inverse of a segment’s length which is the smallest frequency (i.e. highest period) of detectable signals in each segment. The frequency range spans from 0 to the Nyquist frequency, i.e. half de the sampling rate.

-
-
-

Checking filtering settings¶

-

The first thing to check is that the frequency of the high-pass filter (if defined) is below the minimum frequency of the filter bank. Indeed, a high-pass filter will only let pass frequency that are higher than the cutoff frequency (here defined by the strain_high_pass argument). If the high pass frequency is greater from the minimum frequency in the filter bank, the signal with frequencies lower than the cutoff frequency will get attenuated.

-
if args.min_frequency < args.strain_high_pass:
-    print >>sys.stderr, "Warning: strain high pass frequency %f is greater than the tile minimum frequency %f --- this is likely to cause strange output below the bandpass frequency" % (args.strain_high_pass, args.min_frequency)
-
-
-

In case the maximum frequency in the filter bank is not defined, we set it to be equal to the Nyquist frequency, i.e. half the sampling rate, which makes sense as a larger signal will not be able to get easily identifiable.

-
if args.max_frequency is None:
-    args.max_frequency = args.sample_rate / 2.0
-
-
-

If the bandwidth of the finest filter (--tile-bandwidth argument, see section construct_args or the number of frequency channels (=–channels= argument) is not defined but the total spectral band is (data_band), one can then determined all the filter settings as follows:

-
if args.tile_bandwidth is None and args.channels is None:
-    # Exit program with error message
-    exit("Either --tile-bandwidth or --channels must be specified to set up time-frequency plane")
-else:
-    # Define as assert statement that tile maximum frequency larger than its minimum frequency
-    assert args.max_frequency >= args.min_frequency
-    # Define spectral band of data
-    data_band = args.max_frequency - args.min_frequency
-    # Check if tile bandwidth or channel is defined
-    if args.tile_bandwidth is not None:
-        # Define number of possible filter bands
-        nchans = args.channels = int(data_band / args.tile_bandwidth)  - 1
-    elif args.channels is not None:
-        # Define filter bandwidth
-        band = args.tile_bandwidth = data_band / (args.channels + 1)
-    assert args.channels > 1
-
-
-

The minimum frequency to be explored can be user-defined by using the --min-frequency option.

-
# Lowest frequency of the first filter
-flow = args.min_frequency
-
-
-
-
-

Whitening window and spectral correlation¶

-

This part determines how much data on either side of the tukey window is to be discarded. Nominally, this means that one will lose window_fraction * args.psd_segment_length to corruption from the window, i.e. this is simply discarded. This is tuned to give an integer offset when used with args.psd_segment_length equal to 8, smaller windows will have fractions of integers, but larger powers of two will still preseve this (probably not a big deal in the end).

-
window_fraction = 0
-
-
-

The two point spectral correlation is then done with the calculate_spectral_correlation function which will return both the Tukey window applied to the original time series data and the actual two-point spectral correlation function for the whitened frequency series from the applied whitening window.

-
# Do two point spectral correlation
-window, spec_corr = calculate_spectral_correlation(seg_len,'tukey',window_fraction=window_fraction)
-window = window.data.data
-window_sigma_sq = numpy.mean(window**2)
-# Pre scale the window by its root mean squared -- see eqn 11 of EP document
-#window /= numpy.sqrt(window_sigma_sq)
-
-
-
-
-

Computing the filter bank¶

-

The filter bank will create band-pass filters for each channel in the PSD frequency domain. The create_filter_bank function will san the bandwidth from the central frequency of the first channel (i.e. flow+band/2) to final frequency of the last channel (i.e. band*nchans) in a increment equal to the frequency band. The filter’s total extent in Fourier space is actually twice the stated bandwidth (FWHM).

-
# Define filters
-filter_bank, fdb = create_filter_bank(fd_psd.delta_f, flow+band/2, band, nchans, fd_psd, spec_corr)
-
-
-

This function will returns 2 arrays: the filter_bank array which is a list of COMPLEX16FrequencySeries arrays corresponding to each channel’s filter, and the =fdb= array which provides the time-series from each filter. The length of each array is equal to the total number of channel (i.e. =nchans=). The filter’s data, \(\Delta f\) value, and first and last frequencies of any channel’s filter can be displayed as followed:

-
# Print data of first channel's filter
-print filter_bank[0].data.data
-# Print frequency separation between 2 values in the first channel's filter
-print filter_bank[0].deltaF
-# Print first frequency of the first channel's filter
-print filter_bank[0].f0
-# Print last frequency of the first channel's filter (equal to twice the channel's bandwidth)
-print filter_bank[0].f0+(len(filter_bank[0].data.data)-1)*filter_bank[0].deltaF
-
-
-

Further in the analysis, the following filters will used: -1. white_filter_ip: Whitened filter inner products computed with themselves. -2. unwhite_filter_ip: Unwhitened filter inner products computed with themselves. -3. white_ss_ip: Whitened filter inner products computed between input adjacent filters. -4. unwhite_ss_ip: Unwhitened filter inner products computed between input adjacent filters.

-
# This is necessary to compute the mu^2 normalizations
-white_filter_ip = compute_filter_ips_self(filter_bank, spec_corr, None)
-unwhite_filter_ip = compute_filter_ips_self(filter_bank, spec_corr, lal_psd)
-# These two are needed for the unwhitened mean square sum (hrss)
-white_ss_ip = compute_filter_ips_adjacent(filter_bank, spec_corr, None)
-unwhite_ss_ip = compute_filter_ips_adjacent(filter_bank, spec_corr, lal_psd)
-
-
-
-
-

Normalization of virtual channel¶

-

The virtual channels will be used during the excesspower analysis to explore different frequency ranges around each PSD segments and look for possible triggers. Each channel is renormalized using the compute_channel_renomalization internal function.

-
# Initialise dictionary
-mu_sq_dict = {}
-# nc_sum additional channel adds
-for nc_sum in range(0, int(math.log(nchans, 2))):
-    min_band = (len(filter_bank[0].data.data)-1) * filter_bank[0].deltaF / 2
-    print tprint(t0,t1),"Calculation for %d %d Hz channels" % (nc_sum+1, min_band)
-    nc_sum = 2**nc_sum - 1
-    mu_sq_dict[nc_sum] = compute_channel_renomalization(nc_sum, filter_bank, spec_corr, nchans)
-
-
-
-
-

Initialise event list and determine stride boundaries¶

-

First of all, we create a table similar than the one made by the LIGO Scientific Collaboration (LSC) where all the information will be stored. Such table is commonly know as lsctables. A pre-defined LSC table can be constructed using New function from the glue.ligolw.lsctables module. We use the SnglBurstTable function for the type of data to be stored and define all the columns we wish to record.

-
# Create event list for single burst table
-event_list = lsctables.New(lsctables.SnglBurstTable,
-                           ['start_time','start_time_ns','peak_time','peak_time_ns',
-                            'duration','bandwidth','central_freq','chisq_dof',
-                            'confidence','snr','amplitude','channel','ifo',
-                            'process_id','event_id','search','stop_time','stop_time_ns'])
-
-
-

We also need to determine the indexes of both starting and ending times for the first segment to analyse, respectively t_idx_min and t_idx_max. The default values are considered to be 0 for the starting index and the segment length in sample unit for the ending time index. Also, if the user defines a different starting time than the one from the loaded data, the offset index in sample unit is determined and added the both starting and ending time indexes.

-
# Determine boundaries of stride in time domain
-t_idx_min, t_idx_max = 0, seg_len
-# Check if user requested starting time is defined
-if args.analysis_start_time is not None:
-    # Define the time difference in seconds between data and user requested starting times
-    t_idx_off = args.analysis_start_time - ts_data.start_time
-    # Calculate the index of the user requested starting point in the data
-    t_idx_off = int(t_idx_off * args.sample_rate)
-else:
-    # Define index of the starting point as first value in data
-    t_idx_off = 0
-# Initialise minimum index values as offset starting index
-t_idx_min += t_idx_off
-# Initialise maximum index values as offset starting index
-t_idx_max += t_idx_off
-
-
-

Finally, the index for the ending time after all the segments have been analysed can be estimated for the user-defined parameter or is defined as the length of the time series data ts_data.

-
# Check if user requested end time is defined
-if args.analysis_end_time is not None:
-    # Define the time difference between data and user requested ending times
-    t_idx_max_off = args.analysis_end_time - ts_data.start_time
-    # Calculate the index of the user requested starting point in the data
-    t_idx_max_off = int(t_idx_max_off * args.sample_rate)
-else:
-    # Define index of the ending point as the length of data array
-    t_idx_max_off = len(ts_data)
-
-
-
-
-

Define analysing blocks¶

-

The first thing we do is to calculate the time series for the segment that is covered (tmp_ts_data) and redefined the metadata, especially the time of the first sample in seconds which is defined by the epoch argument and is different for every segment. After plotting the time series for that segment, the data are then converted into frequency series (fs_data) using the to_frequencyseries module from the pycbc.types.timeseries.TimeSeries library. Finally, the frequency data are then whitened.

-
# Loop over each data within the user requested time period
-while t_idx_max <= t_idx_max_off:
-    # Define starting and ending time of the segment in seconds
-    start_time = ts_data.start_time + t_idx_min/float(args.sample_rate)
-    end_time = ts_data.start_time + t_idx_max/float(args.sample_rate)
-    print tprint(t0,t1),"Analyzing block %i to %i (%.2f percent)"%(start_time,end_time,100*float(t_idx_max)/float(idx_max_off))
-    # Model a withen time series for the block
-    tmp_ts_data = types.TimeSeries(ts_data[t_idx_min:t_idx_max]*window, 1.0/args.sample_rate,epoch=start_time)
-    # Save time series in segment repository
-    segfolder = 'segments/%i-%i'%(start_time,end_time)
-    os.system('mkdir -p '+segfolder)
-    plot_ts(tmp_ts_data,fname='%s/ts.png'%(segfolder))
-    # Convert times series to frequency series
-    fs_data = tmp_ts_data.to_frequencyseries()
-    print tprint(t0,t1),"Frequency series data has variance: %s" % fs_data.data.std()**2
-    # Whitening (FIXME: Whiten the filters, not the data)
-    fs_data.data /= numpy.sqrt(fd_psd) / numpy.sqrt(2 * fd_psd.delta_f)
-    print tprint(t0,t1),"Whitened frequency series data has variance: %s" % fs_data.data.std()**2
-
-
-
-
-

Create time-frequency map for each block¶

-

We initialise a 2D zero array for a time-frequency map (tf_map) which will be computed for each frequency-domain filter associated to each PSD segment and where the filtered time-series for each frequency channels will be stored. The number of rows corresponds to the total number of frequency channels which is defined by the nchans variable. The number of columns corresponds to the segment length in samples (i.e. the number of samples covering one segment) which is defined by the seg_len variable.

-
# Initialise 2D zero array for time-frequency map
-tf_map = numpy.zeros((nchans, seg_len), dtype=numpy.complex128)
-
-
-

We also initialise a zero vector for a temporary filter bank (tmp_filter_bank) that will store, for a given channel, the filter’s values from the original filter bank (filter_bank) for that channel only. The length of the temporary filter bank is equal to the length of the PSD frequency series (fd_psd).

-
# Initialise 1D zero array
-tmp_filter_bank = numpy.zeros(len(fd_psd), dtype=numpy.complex128)
-
-
-

We then loop over all the frequency channels. While in the loop, we first re-initialise the temporary filter bank with zero values everywhere along the frequency series. We then determine the first and last frequency of each channel and re-define the values of the filter in that frequency range based on the values from the original channel’s filter from the original filter bank.

-
# Loop over all the channels
-print tprint(t0,t1),"Filtering all %d channels..." % nchans
-for i in range(nchans):
-    # Reset filter bank series
-    tmp_filter_bank *= 0.0
-    # Index of starting frequency
-    f1 = int(filter_bank[i].f0/fd_psd.delta_f)
-    # Index of ending frequency
-    f2 = int((filter_bank[i].f0 + 2*band)/fd_psd.delta_f)+1
-    # (FIXME: Why is there a factor of 2 here?)
-    tmp_filter_bank[f1:f2] = filter_bank[i].data.data * 2
-
-
-

We then extract the frequency series from the filter bank for that channel, which will be used as a template waveform to filter the actual data from the channel.

-
# Define the template to filter the frequency series with
-template = types.FrequencySeries(tmp_filter_bank, delta_f=fd_psd.delta_f, copy=False)
-
-
-

Finally, we use the matched_filter_core module from the pycbc.filter.matchedfilter library to filter the frequency series from the channel. This will return both a time series containing the complex signal-to-noise matched filtered against the data, and a frequency series containing the correlation vector.

-
# Create filtered series
-filtered_series = filter.matched_filter_core(template,fs_data,h_norm=None,psd=None,
-                                             low_frequency_cutoff=filter_bank[i].f0,
-                                             high_frequency_cutoff=filter_bank[i].f0+2*band)
-
-
-

The matched filter is the optimal linear filter for maximizing the signal to noise ratio (SNR) in the presence of additive stochastic noise. The filtered time series is stored in the time-frequency map and can be used to produce a spectrogram of the segment of data being analysed.

-
# Include filtered series in the map
-tf_map[i,:] = filtered_series[0].numpy()
-
-
-

The time-frequency map is a 2D array with a length that corresponds to the number of channels and a width equal to the number of sample present in one segment of data, i.e. segment’s length in seconds times the the sampling rate. The map can finally be plotted with a \(\Delta t\) corresponding to the sampling period of the original dataset (i.e. inverse of the original sampling rate), and \(\Delta f\) is equal to the bandwidth of one channel.

-
plot_spectrogram(numpy.abs(tf_map).T,tmp_ts_data.delta_t,fd_psd.delta_f,ts_data.sample_rate,start_time,end_time,fname='%s/tf.png'%(segfolder))
-
-
-
-
-

Constructing tiles of different bandwidth¶

-

First and foremost, we define a clipping region in the data to be used to remove window corruption, this is non-zero if the window_fraction variable is set to a non-zero value.

-
print tprint(t0,t1),"Beginning tile construction..."
-# Clip the boundaries to remove window corruption
-clip_samples = int(args.psd_segment_length * window_fraction * args.sample_rate / 2)
-
-
-

In order to perform a multi-resolution search, tiles of many different bandwidths and durations will be scanned. We first need to setup a loop such that the maximum number of additional channel is equal to the base 2 logarithm of the total number of channels. The number of narrow band channels to be summed (nc_sum) would therefore be equal to 2 to the power of the current quantity of additional channels.

-
for nc_sum in range(0, int(math.log(nchans, 2)))[::-1]: # nc_sum additional channel adds
-    nc_sum = 2**nc_sum - 1
-    print tprint(t0,t1,t2),"Summing %d narrow band channels..." % (nc_sum+1)
-
-
-

The undersampling rate for this tile can be calculated using the channel frequency band and the number of narrow band channels to be summed such that the bandwidth of the tile is equal to band * (nc_sum + 1).

-
us_rate = int(round(1.0 / (2 * band*(nc_sum+1) * ts_data.delta_t)))
-print >>sys.stderr, "Undersampling rate for this level: %f" % (args.sample_rate/us_rate)
-
-
-

“Virtual” wide bandwidth channels are constructed by summing the samples from multiple channels, and correcting for the overlap between adjacent channel filters. We then define the normalised channel at the current level and create a time frequency map for this tile using the make_indp_tiles internal function. In other word, we are constructing multiple sub-tiles for which we can determined the respective energy in the given frequency band.

-
mu_sq = mu_sq_dict[nc_sum]
-sys.stderr.write("\t...calculating tiles...")
-if clip_samples > 0:
-    tiles = make_indp_tiles(tf_map[:,clip_samples:-clip_samples:us_rate], nc_sum, mu_sq)
-else:
-    tiles = make_indp_tiles(tf_map[:,::us_rate], nc_sum, mu_sq)
-sys.stderr.write(" TF-plane is %dx%s samples... " % tiles.shape)
-print >>sys.stderr, " done"
-print "Tile energy mean: %f, var %f" % (numpy.mean(tiles), numpy.var(tiles))
-
-
-
-
-

Explore multiple tile durations¶

-

Now that we create a tile with a specific bandwidth, we can start exploring different durations for the tile. We will start checking if the user manually defined a value for the longest duration tile to compute, which can be done using the --max-duration argument. If not, the value will be set to 32.

-
if args.max_duration is not None:
-    max_dof = 2 * args.max_duration * (band * (nc_sum+1))
-else:
-    max_dof = 32
-assert max_dof >= 2
-
-
-

Since we produce (initially) tiles with 1 degree of freedom, the duration goes as one over twice the bandwidth.

-
print "\t\t...getting longer durations..."
-#for j in [2**l for l in xrange(1, int(math.log(max_dof, 2))+1)]:
-for j in [2**l for l in xrange(0, int(math.log(max_dof, 2)))]:
-    sys.stderr.write("\t\tSumming DOF = %d ..." % (2*j))
-    #tlen = tiles.shape[1] - j + 1
-    tlen = tiles.shape[1] - 2*j + 1 + 1
-    if tlen <= 0:
-        print >>sys.stderr, " ...not enough samples."
-        continue
-    dof_tiles = numpy.zeros((tiles.shape[0], tlen))
-    #:sum_filter = numpy.ones(j)
-    # FIXME: This is the correct filter for 50% overlap
-    sum_filter = numpy.array([1,0] * (j-1) + [1])
-    #sum_filter = numpy.array([1,0] * int(math.log(j, 2)-1) + [1])
-    for f in range(tiles.shape[0]):
-        # Sum and drop correlate tiles
-        # FIXME: don't drop correlated tiles
-        #output = numpy.convolve(tiles[f,:], sum_filter, 'valid')
-        dof_tiles[f] = fftconvolve(tiles[f], sum_filter, 'valid')
-    print >>sys.stderr, " done"
-    print "Summed tile energy mean: %f, var %f" % (numpy.mean(dof_tiles), numpy.var(dof_tiles))
-    level_tdiff = time.time() - tdiff
-    print >>sys.stderr, "Done with this resolution, total %f" % level_tdiff
-
-
-

Finally, the bandwidth and duration of the tile can be defined as followed:

-
# Current bandwidth of the time-frequency map tiles
-current_band = band * (nc_sum + 1)
-# How much each "step" is in the frequency domain -- almost
-# assuredly the fundamental bandwidth
-df = current_band
-# How much each "step" is in the time domain -- under sampling rate
-# FIXME: THis won't work if the sample rate isn't a power of 2
-dt = 1.0 / 2 / (2 * current_band) * 2
-full_band = 250
-dt = current_band / full_band * ts_data.sample_rate
-dt = 1.0/dt
-# Duration is fixed by the NDOF and bandwidth
-duration = j / 2.0 / current_band
-
-
-
-
-

Trigger finding¶

-

In order to find any trigger in the data, we first need to set a false alarm probability threshold in Gaussian noise above which signal will be distinguished from the noise. Such threshold can be determined by using the /inverse survival function/ method from the scipy.stats.chi2 package.

-
threshold = scipy.stats.chi2.isf(args.tile_fap, j)
-print "Threshold for this level: %f" % threshold
-#if numpy.any(dof_tiles > threshold):
-    #plot_spectrogram(dof_tiles.T)
-    #import pdb; pdb.set_trace()
-
-
-

Once the threshold is set, one can then run the trigger_list_from_map function to quickly find the trigger signal from the dof_tiles array that

-
# Since we clip the data, the start time needs to be adjusted accordingly
-window_offset_epoch = fs_data.epoch + args.psd_segment_length * window_fraction / 2
-trigger_list_from_map(dof_tiles, event_list, threshold, window_offset_epoch, filter_bank[0].f0 + band/2, duration, current_band, df, dt, None)
-for event in event_list[::-1]:
-    if event.amplitude != None:
-        continue
-    etime_min_idx = float(event.get_start()) - float(fs_data.epoch)
-    etime_min_idx = int(etime_min_idx / tmp_ts_data.delta_t)
-    etime_max_idx = float(event.get_start()) - float(fs_data.epoch) + event.duration
-    etime_max_idx = int(etime_max_idx / tmp_ts_data.delta_t)
-    # (band / 2) to account for sin^2 wings from finest filters
-    flow_idx = int((event.central_freq - event.bandwidth / 2 - (band / 2) - flow) / band)
-    fhigh_idx = int((event.central_freq + event.bandwidth / 2 + (band / 2) - flow) / band)
-    # TODO: Check that the undersampling rate is always commensurate
-    # with the indexing: that is to say that
-    # mod(etime_min_idx, us_rate) == 0 always
-    z_j_b = tf_map[flow_idx:fhigh_idx,etime_min_idx:etime_max_idx:us_rate]
-    # FIXME: Deal with negative hrss^2 -- e.g. remove the event
-    try:
-        event.amplitude = measure_hrss(z_j_b, unwhite_filter_ip[flow_idx:fhigh_idx], unwhite_ss_ip[flow_idx:fhigh_idx-1], white_ss_ip[flow_idx:fhigh_idx-1], fd_psd.delta_f, tmp_ts_data.delta_t, len(filter_bank[0].data.data), event.chisq_dof)
-    except ValueError:
-        event.amplitude = 0
-
-print "Total number of events: %d" % len(event_list)
-
-
-
-
-

Switch to new block¶

-

The following will move the frequency band to the next segment:

-
tdiff = time.time() - tdiff
-print "Done with this block: total %f" % tdiff
-
-t_idx_min += int(seg_len * (1 - window_fraction))
-t_idx_max += int(seg_len * (1 - window_fraction))
-
-
-
-
-

Extracting GPS time range¶

-

We use the LIGOTimeGPS structure from the =glue.lal= package to /store the starting and ending time in the dataset to nanosecond precision and synchronized to the Global Positioning System time reference/. Once both times are defined, the range of value is stored in a semi-open interval using the segment module from the =glue.segments= package.

-
# Starting epoch relative to GPS starting epoch
-start_time = LIGOTimeGPS(args.analysis_start_time or args.gps_start_time)
-# Ending epoch relative to GPS ending epoch
-end_time = LIGOTimeGPS(args.analysis_end_time or args.gps_end_time)
-# Represent the range of values in the semi-open interval
-inseg = segment(start_time,end_time)
-
-
-
-
-

Prepare output file for given time range¶

-
xmldoc = ligolw.Document()
-xmldoc.appendChild(ligolw.LIGO_LW())
-
-ifo = args.channel_name.split(":")[0]
-proc_row = register_to_xmldoc(xmldoc, __program__, args.__dict__, ifos=[ifo],version=glue.git_version.id, cvs_repository=glue.git_version.branch, cvs_entry_time=glue.git_version.date)
-
-# Figure out the data we actually analyzed
-outseg = determine_output_segment(inseg, args.psd_segment_length, args.sample_rate, window_fraction)
-
-ss = append_search_summary(xmldoc, proc_row, ifos=(station,), inseg=inseg, outseg=outseg)
-
-for sb in event_list:
-    sb.process_id = proc_row.process_id
-    sb.search = proc_row.program
-    #sb.ifo, sb.channel = args.channel_name.split(":")
-    sb.ifo, sb.channel = station, setname
-
-xmldoc.childNodes[0].appendChild(event_list)
-fname = make_filename(station, inseg)
-
-utils.write_filename(xmldoc, fname, gz=fname.endswith("gz"), verbose=True)
-
-
-
-
-

Plot trigger results¶

-
events = SnglBurstTable.read(fname+'.gz')
-#del events[10000:]
-plot = events.plot('time', 'central_freq', "duration", "bandwidth", color="snr")
-#plot = events.plot('time', 'central_freq', color='snr')
-#plot.set_yscale("log")
-plot.set_ylim(1e-0, 250)
-t0 = 1153742417
-plot.set_xlim(t0 + 0*60, t0 + 1*60)
-#plot.set_xlim(t0 + 28, t0 + 32)
-pyplot.axvline(t0 + 30, color='r')
-cb = plot.add_colorbar(cmap='viridis')
-plot.savefig("triggers.png")
-
-
-
-
-
-

Module Access¶

-
-

Extract Magnetic Field Data¶

-

Extract magnetic field data from HDF5 files.

- ---- - - - - - - - - - - - - - - - - - - - - - - - -
magfield(station, starttime, endtime[, ...])Glob all files withing user-defined period and extract data.
file_to_segment(hfile, segname)Define length of data segment.
construct_utc_from_metadata(datestr, t0str)
generate_timeseries(data_list[, setname])Generate time series using list of HDF5 data file paths
create_activity_list(station, data_order)Create consecutive list of available data segment.
retrieve_data_timeseries(hfile, setname)Retrieve data time series from HDF5 data file
retrieve_channel_data(hfile, setname)Retrieve the data from specific channel
-
-
-

Plotting routines¶

-

Methods to produce time-frequency plots and others

+
+

Code access¶

- - - - - - - - - - - - - - - - - - - - - - - - - - + +
plot_activity(full_seglist)Plot full activity period for station.
plot_time_series(station, ts_list[, seglist, hp])Generate a plot of the whole data time series
plot_asd(station, ts_list)Plot Amplitude Spectral Density.
plot_whitening(station, ts_list[, seglist])Generate a spectrogram plot and normalized spectrogram
plot_ts(ts[, fname])
plot_spectrum(fd_psd)
plot_spectrogram(spec, dt, df, sample_rate, ...)
plot_spectrogram_from_ts(ts)
plot_triggers()
excess_power(ts_data, psd_segment_length, ...)Perform excess-power search analysis on magnetic field data.
-
-

Utilities¶

-

Independent routines to do various other things

- ---- - - - - - -
create_sound(ts)Create sound based on the data
-
@@ -624,7 +110,11 @@

Utilities

+ «  Working Example +   ::   Contents +   ::   + gdas.epower.excess_power  Â»

diff --git a/docs/explore_duration.html b/docs/explore_duration.html new file mode 100644 index 0000000..58adc15 --- /dev/null +++ b/docs/explore_duration.html @@ -0,0 +1,125 @@ + + + + + + + + Explore multiple tile durations — gdas 0.3.0 documentation + + + + + + + + + + + + + + + + + +
+ + +
+

Explore multiple tile durations¶

+

Now that we create a tile with a specific bandwidth, we can start exploring different durations for the tile. We will start checking if the user manually defined a value for the longest duration tile to compute, which can be done using the --max-duration argument. If not, the value will be set to 32.

+
if args.max_duration is not None:
+    max_dof = 2 * args.max_duration * (band * (nc_sum+1))
+else:
+    max_dof = 32
+assert max_dof >= 2
+
+
+

Since we produce (initially) tiles with 1 degree of freedom, the duration goes as one over twice the bandwidth.

+
print "\t\t...getting longer durations..."
+#for j in [2**l for l in xrange(1, int(math.log(max_dof, 2))+1)]:
+for j in [2**l for l in xrange(0, int(math.log(max_dof, 2)))]:
+    sys.stderr.write("\t\tSumming DOF = %d ..." % (2*j))
+    #tlen = tiles.shape[1] - j + 1
+    tlen = tiles.shape[1] - 2*j + 1 + 1
+    if tlen <= 0:
+        print >>sys.stderr, " ...not enough samples."
+        continue
+    dof_tiles = numpy.zeros((tiles.shape[0], tlen))
+    #:sum_filter = numpy.ones(j)
+    # FIXME: This is the correct filter for 50% overlap
+    sum_filter = numpy.array([1,0] * (j-1) + [1])
+    #sum_filter = numpy.array([1,0] * int(math.log(j, 2)-1) + [1])
+    for f in range(tiles.shape[0]):
+        # Sum and drop correlate tiles
+        # FIXME: don't drop correlated tiles
+        #output = numpy.convolve(tiles[f,:], sum_filter, 'valid')
+        dof_tiles[f] = fftconvolve(tiles[f], sum_filter, 'valid')
+    print >>sys.stderr, " done"
+    print "Summed tile energy mean: %f, var %f" % (numpy.mean(dof_tiles), numpy.var(dof_tiles))
+    level_tdiff = time.time() - tdiff
+    print >>sys.stderr, "Done with this resolution, total %f" % level_tdiff
+
+
+

Finally, the bandwidth and duration of the tile can be defined as followed:

+
# Current bandwidth of the time-frequency map tiles
+current_band = band * (nc_sum + 1)
+# How much each "step" is in the frequency domain -- almost
+# assuredly the fundamental bandwidth
+df = current_band
+# How much each "step" is in the time domain -- under sampling rate
+# FIXME: THis won't work if the sample rate isn't a power of 2
+dt = 1.0 / 2 / (2 * current_band) * 2
+full_band = 250
+dt = current_band / full_band * ts_data.sample_rate
+dt = 1.0/dt
+# Duration is fixed by the NDOF and bandwidth
+duration = j / 2.0 / current_band
+
+
+
+ + +
+ + + + + \ No newline at end of file diff --git a/docs/generated/gdas.epower.calculate_psd.html b/docs/generated/gdas.epower.calculate_psd.html index 63d1828..fc86181 100644 --- a/docs/generated/gdas.epower.calculate_psd.html +++ b/docs/generated/gdas.epower.calculate_psd.html @@ -6,7 +6,7 @@ - gdas.epower.calculate_psd — gdas 0.2.9 documentation + gdas.epower.calculate_psd — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - - + + @@ -94,11 +94,11 @@

gdas.epower.calculate_psd

- «  Excess Power - Step 2: Estimate Power Spectral Density (PSD) + «  Calculate Power Spectral Density (PSD)   ::   Contents   ::   - Excess Power - Step 3: Two point spectral correlation  Â» + Two point spectral correlation  Â»

diff --git a/docs/generated/gdas.epower.calculate_spectral_correlation.html b/docs/generated/gdas.epower.calculate_spectral_correlation.html index 7e7f4a6..f517cf2 100644 --- a/docs/generated/gdas.epower.calculate_spectral_correlation.html +++ b/docs/generated/gdas.epower.calculate_spectral_correlation.html @@ -6,7 +6,7 @@ - gdas.epower.calculate_spectral_correlation — gdas 0.2.9 documentation + gdas.epower.calculate_spectral_correlation — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - - + + @@ -67,11 +67,11 @@

gdas.epower.calculate_spectral_correlation

- «  Excess Power - Step 3: Two point spectral correlation + «  Two point spectral correlation   ::   Contents   ::   - Excess Power - Step 4: Computing the filter bank  Â» + Computing the filter bank  Â»

diff --git a/docs/generated/gdas.epower.check_filtering_settings.html b/docs/generated/gdas.epower.check_filtering_settings.html index 055a738..c787ae4 100644 --- a/docs/generated/gdas.epower.check_filtering_settings.html +++ b/docs/generated/gdas.epower.check_filtering_settings.html @@ -6,7 +6,7 @@ - gdas.epower.check_filtering_settings — gdas 0.2.9 documentation + gdas.epower.check_filtering_settings — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - - + +

gdas.epower.check_filtering_settings

@@ -93,11 +93,11 @@

gdas.epower.check_filtering_settings

- «  Excess Power - Step 1: Checking filtering settings + «  Checking filtering settings   ::   Contents   ::   - Excess Power - Step 2: Estimate Power Spectral Density (PSD)  Â» + Calculate Power Spectral Density (PSD)  Â»

diff --git a/docs/generated/gdas.epower.compute_channel_renormalization.html b/docs/generated/gdas.epower.compute_channel_renormalization.html index eecf200..afa0c53 100644 --- a/docs/generated/gdas.epower.compute_channel_renormalization.html +++ b/docs/generated/gdas.epower.compute_channel_renormalization.html @@ -6,7 +6,7 @@ - gdas.epower.compute_channel_renormalization — gdas 0.2.9 documentation + gdas.epower.compute_channel_renormalization — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - + +

gdas.epower.compute_channel_renormalization

@@ -61,9 +64,11 @@

gdas.epower.compute_channel_renormalization

- «  Excess Power - Step 5: Normalization of virtual channel + «  Normalization of virtual channel   ::   Contents +   ::   + Initialise event list and determine stride boundaries  Â»

diff --git a/docs/generated/gdas.epower.compute_filter_ips_adjacent.html b/docs/generated/gdas.epower.compute_filter_ips_adjacent.html deleted file mode 100644 index 3c1f5bd..0000000 --- a/docs/generated/gdas.epower.compute_filter_ips_adjacent.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - gdas.epower.compute_filter_ips_adjacent — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.compute_filter_ips_adjacent¶

-
-
-gdas.epower.compute_filter_ips_adjacent(lal_filters, spec_corr, psd=None)[source]¶
-

Compute a set of filter inner products between input adjacent filters. -If psd argument is given, the unwhitened filter inner products will be -returned. The returned array index is the inner product between the -lal_filter of the same index, and its (array) adjacent filter — assumed -to be the frequency adjacent filter.

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.compute_filter_ips_self.html b/docs/generated/gdas.epower.compute_filter_ips_self.html deleted file mode 100644 index 512e9de..0000000 --- a/docs/generated/gdas.epower.compute_filter_ips_self.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - gdas.epower.compute_filter_ips_self — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.compute_filter_ips_self¶

-
-
-gdas.epower.compute_filter_ips_self(lal_filters, spec_corr, psd=None)[source]¶
-

Compute a set of inner products of input filters with themselves. If psd -argument is given, the unwhitened filter inner products will be returned.

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.construct_tiles.html b/docs/generated/gdas.epower.construct_tiles.html deleted file mode 100644 index 9af333b..0000000 --- a/docs/generated/gdas.epower.construct_tiles.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - gdas.epower.construct_tiles — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.construct_tiles¶

-
-
-gdas.epower.construct_tiles(nc_sum, mu_sq, band, ts_data, tf_map, psd_segment_length, window_fraction, max_duration)[source]¶
-

Constructing tile and calculate their energy

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.convert_to_time_domain.html b/docs/generated/gdas.epower.convert_to_time_domain.html deleted file mode 100644 index 6f7aab7..0000000 --- a/docs/generated/gdas.epower.convert_to_time_domain.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - gdas.epower.convert_to_time_domain — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.convert_to_time_domain¶

-
-
-gdas.epower.convert_to_time_domain(fdb, sample_rate)[source]¶
-

Convert filter bank from frequency to time domain

- --- - - - -
Parameters:

fdb : list

-
-

List of filters from the filter bank in frequency domain

-
-

sample_rate : float

-
-

Sampling rate of magnetic field data

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.create_filter_bank.html b/docs/generated/gdas.epower.create_filter_bank.html index 930d46e..cd51c6b 100644 --- a/docs/generated/gdas.epower.create_filter_bank.html +++ b/docs/generated/gdas.epower.create_filter_bank.html @@ -6,7 +6,7 @@ - gdas.epower.create_filter_bank — gdas 0.2.9 documentation + gdas.epower.create_filter_bank — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - - + +

gdas.epower.create_filter_bank

@@ -81,11 +81,11 @@

gdas.epower.create_filter_bank

- «  Excess Power - Step 4: Computing the filter bank + «  Computing the filter bank   ::   Contents   ::   - Excess Power - Step 5: Normalization of virtual channel  Â» + Normalization of virtual channel  Â»

diff --git a/docs/generated/gdas.epower.create_tf_plane.html b/docs/generated/gdas.epower.create_tf_plane.html deleted file mode 100644 index 34ac521..0000000 --- a/docs/generated/gdas.epower.create_tf_plane.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - gdas.epower.create_tf_plane — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.create_tf_plane¶

-
-
-gdas.epower.create_tf_plane(fd_psd, nchans, seg_len, filter_bank, band, fs_data)[source]¶
-

Create time-frequency map

- --- - - - -
Parameters:

fd_psd : array

-
-

Power Spectrum Density

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.create_tile_duration.html b/docs/generated/gdas.epower.create_tile_duration.html deleted file mode 100644 index b38be43..0000000 --- a/docs/generated/gdas.epower.create_tile_duration.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.epower.create_tile_duration — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.create_tile_duration¶

-
-
-gdas.epower.create_tile_duration(j, df, duration, tiles)[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.create_xml.html b/docs/generated/gdas.epower.create_xml.html deleted file mode 100644 index 931ad91..0000000 --- a/docs/generated/gdas.epower.create_xml.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.epower.create_xml — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.create_xml¶

-
-
-gdas.epower.create_xml(ts_data, psd_segment_length, window_fraction, event_list, station, setname='MagneticFields')[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.determine_output_segment.html b/docs/generated/gdas.epower.determine_output_segment.html deleted file mode 100644 index 64a15e6..0000000 --- a/docs/generated/gdas.epower.determine_output_segment.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - gdas.epower.determine_output_segment — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.determine_output_segment¶

-
-
-gdas.epower.determine_output_segment(inseg, dt_stride, sample_rate, window_fraction=0.0)[source]¶
-

Given an input data stretch segment inseg, a data block stride dt_stride, the data sample rate, and an optional window_fraction, return the amount of data that can be processed without corruption effects from the window. -If window_fration is set to 0 (default), assume no windowing.

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.excess_power.html b/docs/generated/gdas.epower.excess_power.html index 3e62857..2c6c0b6 100644 --- a/docs/generated/gdas.epower.excess_power.html +++ b/docs/generated/gdas.epower.excess_power.html @@ -6,7 +6,7 @@ - gdas.epower.excess_power — gdas 0.2.9 documentation + gdas.epower.excess_power — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - - + +

gdas.epower.excess_power

@@ -116,11 +116,11 @@

gdas.epower.excess_power

- «  Excess Power - Overview + «  Excess Power Overview   ::   Contents   ::   - Excess Power - Step 1: Checking filtering settings  Â» + Checking filtering settings  Â»

diff --git a/docs/generated/gdas.epower.identify_block.html b/docs/generated/gdas.epower.identify_block.html deleted file mode 100644 index 583785f..0000000 --- a/docs/generated/gdas.epower.identify_block.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - gdas.epower.identify_block — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.identify_block¶

-
-
-gdas.epower.identify_block(ts_data, fd_psd, window, t_idx_min, t_idx_max)[source]¶
-

Get frequency series of the current block

- --- - - - -
Parameters:

ts_data : TimeSeries

-
-

Time series of magnetic field data

-
-

fd_psd :

-
-

Power Spectrum Density

-
-

window :

-

t_idx_min : float

-
-

Index in time series of first data point

-
-

t_idx_max : float

-
-

Index in time series of last data point

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.make_filename.html b/docs/generated/gdas.epower.make_filename.html deleted file mode 100644 index 51e44b7..0000000 --- a/docs/generated/gdas.epower.make_filename.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.epower.make_filename — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.make_filename¶

-
-
-gdas.epower.make_filename(ifo, seg, tag='excesspower', ext='xml.gz')[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.make_indp_tiles.html b/docs/generated/gdas.epower.make_indp_tiles.html deleted file mode 100644 index 306346b..0000000 --- a/docs/generated/gdas.epower.make_indp_tiles.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - gdas.epower.make_indp_tiles — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.make_indp_tiles¶

-
-
-gdas.epower.make_indp_tiles(tf_map, nc_sum, mu_sq)[source]¶
-

Create a time frequency map with resolution of tf_map binning -divided by nc_sum + 1. All tiles will be independent up to -overlap from the original tiling. The mu_sq is applied to the -resulting addition to normalize the outputs to be zero-mean -unit-variance Gaussian variables (if the input is Gaussian).

-

Notes

-

Optimization plan: If we keep the summed complex TF plane in known -indices, we can save ourselves individual sums at wider frequency -resolutions. -Caveats: -1. We have to keep track of where we’re storing things -2. We have to do it from the finest resolution (for all t0s) -and work our way up -In the end, I think this is a Haar wavelet transform. Look into it.

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.make_tiles.html b/docs/generated/gdas.epower.make_tiles.html deleted file mode 100644 index cbc4e30..0000000 --- a/docs/generated/gdas.epower.make_tiles.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.epower.make_tiles — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.make_tiles¶

-
-
-gdas.epower.make_tiles(tf_map, nc_sum, mu_sq)[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.measure_hrss.html b/docs/generated/gdas.epower.measure_hrss.html deleted file mode 100644 index fea67ad..0000000 --- a/docs/generated/gdas.epower.measure_hrss.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - gdas.epower.measure_hrss — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.measure_hrss¶

-
-
-gdas.epower.measure_hrss(z_j_b, uw_ss_ii, uw_ss_ij, w_ss_ij, delta_f, delta_t, filter_len, dof)[source]¶
-

Approximation of unwhitened sum of squares signal energy in a given EP tile. -See T1200125 for equation number reference.

- --- - - - -
Parameters:

z_j_b : time frequency map block which the constructed tile covers

-

uw_ss_ii : unwhitened filter inner products

-

uw_ss_ij : unwhitened adjacent filter inner products

-

w_ss_ij : whitened adjacent filter inner products

-

delta_f : frequency binning of EP filters

-

delta_t : native time resolution of the time frequency map

-

filter_len : number of samples in a fitler

-

dof : degrees of freedom in the tile (twice the time-frequency area)

-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.measure_hrss_poorly.html b/docs/generated/gdas.epower.measure_hrss_poorly.html deleted file mode 100644 index de41184..0000000 --- a/docs/generated/gdas.epower.measure_hrss_poorly.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.epower.measure_hrss_poorly — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.measure_hrss_poorly¶

-
-
-gdas.epower.measure_hrss_poorly(tile_energy, sub_psd)[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.measure_hrss_slowly.html b/docs/generated/gdas.epower.measure_hrss_slowly.html deleted file mode 100644 index 40fa3ea..0000000 --- a/docs/generated/gdas.epower.measure_hrss_slowly.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - gdas.epower.measure_hrss_slowly — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.measure_hrss_slowly¶

-
-
-gdas.epower.measure_hrss_slowly(z_j_b, lal_filters, spec_corr, psd, delta_t, dof)[source]¶
-

Approximation of unwhitened sum of squares signal energy in a given EP tile. -See T1200125 for equation number reference. NOTE: This function is deprecated -in favor of measure_hrss, since it requires recomputation of many inner products, -making it particularly slow.

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.epower.trigger_list_from_map.html b/docs/generated/gdas.epower.trigger_list_from_map.html deleted file mode 100644 index 213dbb7..0000000 --- a/docs/generated/gdas.epower.trigger_list_from_map.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.epower.trigger_list_from_map — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.epower.trigger_list_from_map¶

-
-
-gdas.epower.trigger_list_from_map(tfmap, event_list, threshold, start_time, start_freq, duration, band, df, dt, psd=None)[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.plots.plot_activity.html b/docs/generated/gdas.plots.plot_activity.html deleted file mode 100644 index 612b678..0000000 --- a/docs/generated/gdas.plots.plot_activity.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - gdas.plots.plot_activity — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.plots.plot_activity¶

-
-
-gdas.plots.plot_activity(full_seglist)[source]¶
-

Plot full activity period for station.

- --- - - - -
Parameters:

full_seglist : dictionary

-
-

Continuous list of available data in the selected time period

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.plots.plot_asd.html b/docs/generated/gdas.plots.plot_asd.html deleted file mode 100644 index d5eef35..0000000 --- a/docs/generated/gdas.plots.plot_asd.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - gdas.plots.plot_asd — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.plots.plot_asd¶

-
-
-gdas.plots.plot_asd(station, ts_list)[source]¶
-

Plot Amplitude Spectral Density. AGG complexity starts to complain -with large numbers of points. And we somehow invoke precision issues -that need to be ameliorated.

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.plots.plot_spectrogram.html b/docs/generated/gdas.plots.plot_spectrogram.html deleted file mode 100644 index 680d8c0..0000000 --- a/docs/generated/gdas.plots.plot_spectrogram.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.plots.plot_spectrogram — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.plots.plot_spectrogram¶

-
-
-gdas.plots.plot_spectrogram(spec, dt, df, sample_rate, start_time, end_time, fname='specgram.png')[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.plots.plot_spectrogram_from_ts.html b/docs/generated/gdas.plots.plot_spectrogram_from_ts.html deleted file mode 100644 index 88857cf..0000000 --- a/docs/generated/gdas.plots.plot_spectrogram_from_ts.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.plots.plot_spectrogram_from_ts — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.plots.plot_spectrogram_from_ts¶

-
-
-gdas.plots.plot_spectrogram_from_ts(ts)[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.plots.plot_spectrum.html b/docs/generated/gdas.plots.plot_spectrum.html deleted file mode 100644 index 4ac607f..0000000 --- a/docs/generated/gdas.plots.plot_spectrum.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.plots.plot_spectrum — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.plots.plot_spectrum¶

-
-
-gdas.plots.plot_spectrum(fd_psd)[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.plots.plot_time_series.html b/docs/generated/gdas.plots.plot_time_series.html deleted file mode 100644 index 96be31f..0000000 --- a/docs/generated/gdas.plots.plot_time_series.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - gdas.plots.plot_time_series — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.plots.plot_time_series¶

-
-
-gdas.plots.plot_time_series(station, ts_list, seglist=None, hp=None)[source]¶
-

Generate a plot of the whole data time series

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.plots.plot_triggers.html b/docs/generated/gdas.plots.plot_triggers.html deleted file mode 100644 index 1e4092f..0000000 --- a/docs/generated/gdas.plots.plot_triggers.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.plots.plot_triggers — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.plots.plot_triggers¶

-
-
-gdas.plots.plot_triggers()[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.plots.plot_ts.html b/docs/generated/gdas.plots.plot_ts.html deleted file mode 100644 index 896a2c8..0000000 --- a/docs/generated/gdas.plots.plot_ts.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - gdas.plots.plot_ts — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.plots.plot_ts¶

-
-
-gdas.plots.plot_ts(ts, fname='ts.png')[source]¶
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.plots.plot_whitening.html b/docs/generated/gdas.plots.plot_whitening.html deleted file mode 100644 index 054ff24..0000000 --- a/docs/generated/gdas.plots.plot_whitening.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - gdas.plots.plot_whitening — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.plots.plot_whitening¶

-
-
-gdas.plots.plot_whitening(station, ts_list, seglist=None)[source]¶
-

Generate a spectrogram plot and normalized spectrogram -norm: sqrt{S(f,t)} / sqrt{overbar{S(f)}}

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.retrieve.construct_utc_from_metadata.html b/docs/generated/gdas.retrieve.construct_utc_from_metadata.html deleted file mode 100644 index b286c00..0000000 --- a/docs/generated/gdas.retrieve.construct_utc_from_metadata.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - gdas.retrieve.construct_utc_from_metadata — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.retrieve.construct_utc_from_metadata¶

-
-
-gdas.retrieve.construct_utc_from_metadata(datestr, t0str)[source]¶
-

Constructing UTC timestamp from metadata

- --- - - - -
Parameters:

datestr : str

-
-

Date of the extracted data

-
-

t0str : str

-
-

GPS time

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.retrieve.create_activity_list.html b/docs/generated/gdas.retrieve.create_activity_list.html deleted file mode 100644 index 7e09d8e..0000000 --- a/docs/generated/gdas.retrieve.create_activity_list.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - gdas.retrieve.create_activity_list — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.retrieve.create_activity_list¶

-
-
-gdas.retrieve.create_activity_list(station, data_order)[source]¶
-

Create consecutive list of available data segment.

- --- - - - -
Parameters:

station : string

-
-

Name of the station

-
-

data_order : dictionary

-
-

List of all the HDF5 data file for each segment

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.retrieve.file_to_segment.html b/docs/generated/gdas.retrieve.file_to_segment.html deleted file mode 100644 index 51838ec..0000000 --- a/docs/generated/gdas.retrieve.file_to_segment.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - gdas.retrieve.file_to_segment — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.retrieve.file_to_segment¶

-
-
-gdas.retrieve.file_to_segment(hfile, segname)[source]¶
-

Define length of data segment. The starting and ending UTC times -for a specific HDF5 file are determined by using the Date, -t0 and t1 attributes from the metadata. The -construct_utc_from_metadata -function is then used to calculate the UTC time. Finally, the -segment -module from the glue.segments library is used to represent -the range of times in a semi-open interval.

- --- - - - -
Parameters:

hfile : HDF5 file object

-
-

HDF5 data file preloaded with the h5py package

-
-

segname : str

-
-

Attribute name of the metadata to extract.

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.retrieve.generate_timeseries.html b/docs/generated/gdas.retrieve.generate_timeseries.html deleted file mode 100644 index d0fff85..0000000 --- a/docs/generated/gdas.retrieve.generate_timeseries.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - gdas.retrieve.generate_timeseries — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.retrieve.generate_timeseries¶

-
-
-gdas.retrieve.generate_timeseries(data_list, setname='MagneticFields')[source]¶
-

Generate time series using list of HDF5 data file paths

- --- - - - - - -
Parameters:

data_list : dictionary

-
-

Dictionary that stored the path to the HDF5 data file -for each segment of data available.

-
-
Returns:

full_data : Array of segment’s name

-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.retrieve.magfield.html b/docs/generated/gdas.retrieve.magfield.html deleted file mode 100644 index 3d91b93..0000000 --- a/docs/generated/gdas.retrieve.magfield.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - gdas.retrieve.magfield — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.retrieve.magfield¶

-
-
-gdas.retrieve.magfield(station, starttime, endtime, activity=False, rep='/GNOMEDrive/gnome/serverdata/', resample=None)[source]¶
-

Glob all files withing user-defined period and extract data.

- --- - - - -
Parameters:

station : str

-
-

Name of the station to be analysed

-
-

t0 : int

-
-

GPS timestamp of the first required magnetic field data

-
-

t1 : int

-
-

GPS timestamp of the last required magnetic field data

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.retrieve.retrieve_channel_data.html b/docs/generated/gdas.retrieve.retrieve_channel_data.html deleted file mode 100644 index cde61f3..0000000 --- a/docs/generated/gdas.retrieve.retrieve_channel_data.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - gdas.retrieve.retrieve_channel_data — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.retrieve.retrieve_channel_data¶

-
-
-gdas.retrieve.retrieve_channel_data(hfile, setname)[source]¶
-

Retrieve the data from specific channel

- --- - - - -
Parameters:

hfile : h5py file object

-
-

Metadata from the HDF5 data file

-
-

setname : string

-
-

Attribute of the channel to retrieve data from

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.retrieve.retrieve_data_timeseries.html b/docs/generated/gdas.retrieve.retrieve_data_timeseries.html deleted file mode 100644 index 052418d..0000000 --- a/docs/generated/gdas.retrieve.retrieve_data_timeseries.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - gdas.retrieve.retrieve_data_timeseries — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.retrieve.retrieve_data_timeseries¶

-
-
-gdas.retrieve.retrieve_data_timeseries(hfile, setname)[source]¶
-

Retrieve data time series from HDF5 data file

- --- - - - -
Parameters:

hfile : h5py file object

-
-

Metadata from the HDF5 data file

-
-

setname : string

-
-

Attribute of the channel to retrieve data from

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/generated/gdas.utils.create_sound.html b/docs/generated/gdas.utils.create_sound.html deleted file mode 100644 index f4b2418..0000000 --- a/docs/generated/gdas.utils.create_sound.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - gdas.utils.create_sound — gdas 0.2.9 documentation - - - - - - - - - - - - - - - -
- - -
-

gdas.utils.create_sound¶

-
-
-gdas.utils.create_sound(ts)[source]¶
-

Create sound based on the data

- --- - - - -
Parameters:

ts : TimeSeries

-
-

Time-series magnetic field data

-
-
-
- -
- - -
- - - - - \ No newline at end of file diff --git a/docs/genindex.html b/docs/genindex.html index 6352450..6861858 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -7,7 +7,7 @@ - Index — gdas 0.2.9 documentation + Index — gdas 0.3.0 documentation @@ -15,7 +15,7 @@ + + + + + + + + + + + + +
+ + +
+

Define analysing blocks¶

+

The first thing we do is to calculate the time series for the segment that is covered (tmp_ts_data) and redefined the metadata, especially the time of the first sample in seconds which is defined by the epoch argument and is different for every segment. After plotting the time series for that segment, the data are then converted into frequency series (fs_data) using the to_frequencyseries module from the pycbc.types.timeseries.TimeSeries library. Finally, the frequency data are then whitened.

+
# Loop over each data within the user requested time period
+while t_idx_max <= t_idx_max_off:
+    # Define starting and ending time of the segment in seconds
+    start_time = ts_data.start_time + t_idx_min/float(args.sample_rate)
+    end_time = ts_data.start_time + t_idx_max/float(args.sample_rate)
+    print tprint(t0,t1),"Analyzing block %i to %i (%.2f percent)"%(start_time,end_time,100*float(t_idx_max)/float(idx_max_off))
+    # Model a withen time series for the block
+    tmp_ts_data = types.TimeSeries(ts_data[t_idx_min:t_idx_max]*window, 1.0/args.sample_rate,epoch=start_time)
+    # Save time series in segment repository
+    segfolder = 'segments/%i-%i'%(start_time,end_time)
+    os.system('mkdir -p '+segfolder)
+    plot_ts(tmp_ts_data,fname='%s/ts.png'%(segfolder))
+    # Convert times series to frequency series
+    fs_data = tmp_ts_data.to_frequencyseries()
+    print tprint(t0,t1),"Frequency series data has variance: %s" % fs_data.data.std()**2
+    # Whitening (FIXME: Whiten the filters, not the data)
+    fs_data.data /= numpy.sqrt(fd_psd) / numpy.sqrt(2 * fd_psd.delta_f)
+    print tprint(t0,t1),"Whitened frequency series data has variance: %s" % fs_data.data.std()**2
+
+
+
+ + +
+ + + + + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 18f9d55..fbecebd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,7 +6,7 @@ - Welcome! — gdas 0.2.9 documentation + Welcome! — gdas 0.3.0 documentation @@ -14,7 +14,7 @@ - + + +

Initialise event list and determine stride boundaries

@@ -91,7 +97,11 @@

Initialise event list and determine stride boundaries

+ «  gdas.epower.compute_channel_renormalization +   ::   Contents +   ::   + Define analysing blocks  Â»

diff --git a/docs/installation.html b/docs/installation.html index d3380fe..81cfaba 100644 --- a/docs/installation.html +++ b/docs/installation.html @@ -6,7 +6,7 @@ - Installation — gdas 0.2.9 documentation + Installation — gdas 0.3.0 documentation @@ -14,7 +14,7 @@