Loading minke/mdctools.py +23 −10 Original line number Diff line number Diff line Loading @@ -13,8 +13,8 @@ from pylal import Fr import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import matplotlib.pyplot as plt def mkdir(path): Loading @@ -38,7 +38,8 @@ class MDCSet(): inj_families_names = {'ga' : 'Gaussian', 'sg' : 'SineGaussian', 'wnb': 'BTLWNB' 'wnb': 'BTLWNB', 'd08' : 'Dimmelmeier+08' } inj_families_abb = dict((v,k) for k,v in inj_families_names.iteritems()) Loading @@ -46,11 +47,12 @@ class MDCSet(): hist_parameters = { "SineGaussian": ["hrss", "psi", "ra", "dec"], "Gaussian": ["hrss", "psi", "ra", "dec"], "BTLWNB": ["hrss", "ra", "dec"] "BTLWNB": ["hrss", "ra", "dec"], "Dimmelmeier+08": ['hrss', 'ra', 'dec'] } def __init__(self, detectors, simtable, name=None): def __init__(self, detectors, simtable, name=None, full=True): """ Represents an MDC set, stored in an XML SimBurstTable file. Loading @@ -68,7 +70,13 @@ class MDCSet(): self.egw = [] self.times = [] while True: # This is an ugly kludge to get around the poor choice of wavform name in the xmls, and if sim_burst_table.waveform[:3]=="s15": self.numrel_file = str(sim_burst_table.waveform) sim_burst_table.waveform = "Dimmelmeier+08" self.waveforms.append(sim_burst_table) if full: self._generate_burst(sim_burst_table) self._measure_hrss() self._measure_egw_rsq() Loading Loading @@ -114,6 +122,8 @@ class MDCSet(): except TypeError: print a, getattr(row,a) continue # the structure is different than the TableRow #print row.numrel_data self.swig_row.numrel_data = row.numrel_data hp, hx = lalburst.GenerateSimBurst(self.swig_row, 1.0/rate) # FIXME: Totally inefficent --- but can we deep copy a SWIG SimBurst? # DW: I tried that, and it doesn't seem to work :/ Loading Loading @@ -181,7 +191,8 @@ class MDCSet(): the folder structure """ name = self._simID(0) return "{}/{}".format(name[:2], name) abb = self.inj_families_abb[self.waveforms[0].waveform].lower() return "{}/{}".format(abb, name) def _simID(self, row): Loading @@ -200,6 +211,9 @@ class MDCSet(): """ row = self.waveforms[row] name = '' numberspart = '' if row.waveform == "Dimmelmeier+08": numberspart = self.numrel_file if row.waveform == "Gaussian": numberspart = "{:.3f}".format(row.duration * 1e3) Loading @@ -211,7 +225,6 @@ class MDCSet(): numberspart = "f{:.0f}_q{:.0f}_{}".format(row.frequency, row.q, pol) elif row.waveform == "BTLWNB": numberspart = "{}b{}tau{}".format(row.frequency, row.bandwidth, row.duration) name += '{}_{}'.format(self.inj_families_abb[row.waveform].lower(), numberspart).replace('.','d') return name Loading setup.py +7 −7 Original line number Diff line number Diff line Loading @@ -23,23 +23,23 @@ test_requirements = [ ] setup( name='minki', name='minke', version='0.1.0', description="Minki is a Python package to produce Mock Data Challenge data sets for LIGO interferometers.", description="Minke is a Python package to produce Mock Data Challenge data sets for LIGO interferometers.", long_description=readme + '\n\n' + history, author="Daniel Williams", author_email='d.williams.2@research.gla.ac.uk', url='https://github.com/transientlunatic/minki', url='https://github.com/transientlunatic/minke', packages=[ 'minki', 'minke', ], package_dir={'minki': 'minki'}, package_dir={'minke': 'minke'}, include_package_data=True, install_requires=requirements, license="ISCL", zip_safe=False, keywords='minki', keywords='minke', classifiers=[ 'Development Status :: 2 - Pre-Alpha', 'Intended Audience :: Developers', Loading Loading
minke/mdctools.py +23 −10 Original line number Diff line number Diff line Loading @@ -13,8 +13,8 @@ from pylal import Fr import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import matplotlib.pyplot as plt def mkdir(path): Loading @@ -38,7 +38,8 @@ class MDCSet(): inj_families_names = {'ga' : 'Gaussian', 'sg' : 'SineGaussian', 'wnb': 'BTLWNB' 'wnb': 'BTLWNB', 'd08' : 'Dimmelmeier+08' } inj_families_abb = dict((v,k) for k,v in inj_families_names.iteritems()) Loading @@ -46,11 +47,12 @@ class MDCSet(): hist_parameters = { "SineGaussian": ["hrss", "psi", "ra", "dec"], "Gaussian": ["hrss", "psi", "ra", "dec"], "BTLWNB": ["hrss", "ra", "dec"] "BTLWNB": ["hrss", "ra", "dec"], "Dimmelmeier+08": ['hrss', 'ra', 'dec'] } def __init__(self, detectors, simtable, name=None): def __init__(self, detectors, simtable, name=None, full=True): """ Represents an MDC set, stored in an XML SimBurstTable file. Loading @@ -68,7 +70,13 @@ class MDCSet(): self.egw = [] self.times = [] while True: # This is an ugly kludge to get around the poor choice of wavform name in the xmls, and if sim_burst_table.waveform[:3]=="s15": self.numrel_file = str(sim_burst_table.waveform) sim_burst_table.waveform = "Dimmelmeier+08" self.waveforms.append(sim_burst_table) if full: self._generate_burst(sim_burst_table) self._measure_hrss() self._measure_egw_rsq() Loading Loading @@ -114,6 +122,8 @@ class MDCSet(): except TypeError: print a, getattr(row,a) continue # the structure is different than the TableRow #print row.numrel_data self.swig_row.numrel_data = row.numrel_data hp, hx = lalburst.GenerateSimBurst(self.swig_row, 1.0/rate) # FIXME: Totally inefficent --- but can we deep copy a SWIG SimBurst? # DW: I tried that, and it doesn't seem to work :/ Loading Loading @@ -181,7 +191,8 @@ class MDCSet(): the folder structure """ name = self._simID(0) return "{}/{}".format(name[:2], name) abb = self.inj_families_abb[self.waveforms[0].waveform].lower() return "{}/{}".format(abb, name) def _simID(self, row): Loading @@ -200,6 +211,9 @@ class MDCSet(): """ row = self.waveforms[row] name = '' numberspart = '' if row.waveform == "Dimmelmeier+08": numberspart = self.numrel_file if row.waveform == "Gaussian": numberspart = "{:.3f}".format(row.duration * 1e3) Loading @@ -211,7 +225,6 @@ class MDCSet(): numberspart = "f{:.0f}_q{:.0f}_{}".format(row.frequency, row.q, pol) elif row.waveform == "BTLWNB": numberspart = "{}b{}tau{}".format(row.frequency, row.bandwidth, row.duration) name += '{}_{}'.format(self.inj_families_abb[row.waveform].lower(), numberspart).replace('.','d') return name Loading
setup.py +7 −7 Original line number Diff line number Diff line Loading @@ -23,23 +23,23 @@ test_requirements = [ ] setup( name='minki', name='minke', version='0.1.0', description="Minki is a Python package to produce Mock Data Challenge data sets for LIGO interferometers.", description="Minke is a Python package to produce Mock Data Challenge data sets for LIGO interferometers.", long_description=readme + '\n\n' + history, author="Daniel Williams", author_email='d.williams.2@research.gla.ac.uk', url='https://github.com/transientlunatic/minki', url='https://github.com/transientlunatic/minke', packages=[ 'minki', 'minke', ], package_dir={'minki': 'minki'}, package_dir={'minke': 'minke'}, include_package_data=True, install_requires=requirements, license="ISCL", zip_safe=False, keywords='minki', keywords='minke', classifiers=[ 'Development Status :: 2 - Pre-Alpha', 'Intended Audience :: Developers', Loading