def setUp(self): self.d = [det.Detector(ifo) for ifo, name in det.get_available_detectors()] # not distributed sanely, but should provide some good coverage N = 1000 self.ra = uniform(0, numpy.pi * 2, size=N) self.dec = uniform(-numpy.pi, numpy.pi, size=N) self.pol = uniform(0, numpy.pi * 2, size=N) self.time = uniform(1126000000.0, 1336096017.0, size=N)
def setUp(self): available_detectors = get_available_detectors() available_detectors = [a[0] for a in available_detectors] self.assertTrue('H1' in available_detectors) self.assertTrue('L1' in available_detectors) self.assertTrue('V1' in available_detectors) self.detectors = [Detector(d) for d in ['H1', 'L1', 'V1']] self.sample_rate = 4096. self.earth_time = lal.REARTH_SI / lal.C_SI # create a few random injections self.injections = [] start_time = float(lal.GPSTimeNow()) taper_choices = ('TAPER_NONE', 'TAPER_START', 'TAPER_END', 'TAPER_STARTEND') for i, taper in zip(xrange(20), itertools.cycle(taper_choices)): inj = MyInjection() inj.end_time = start_time + 40000 * i + \ numpy.random.normal(scale=3600) random = numpy.random.uniform inj.mass1 = random(low=1., high=20.) inj.mass2 = random(low=1., high=20.) inj.distance = random(low=0.9, high=1.1) * 1e6 * lal.PC_SI inj.latitude = numpy.arccos(random(low=-1, high=1)) inj.longitude = random(low=0, high=2 * lal.PI) inj.inclination = numpy.arccos(random(low=-1, high=1)) inj.polarization = random(low=0, high=2 * lal.PI) inj.taper = taper self.injections.append(inj) # create LIGOLW document xmldoc = ligolw.Document() xmldoc.appendChild(ligolw.LIGO_LW()) # create sim inspiral table, link it to document and fill it sim_table = lsctables.New(lsctables.SimInspiralTable) xmldoc.childNodes[-1].appendChild(sim_table) for i in xrange(len(self.injections)): row = sim_table.RowType() self.injections[i].fill_sim_inspiral_row(row) row.process_id = 'process:process_id:0' row.simulation_id = 'sim_inspiral:simulation_id:%d' % i sim_table.append(row) # write document to temp file self.inj_file = tempfile.NamedTemporaryFile(suffix='.xml') ligolw_utils.write_fileobj(xmldoc, self.inj_file)
from pycbc.detector import Detector, get_available_detectors # We can list the available detectors. This gives their detector abbreviation # along with a longer name. Note that some of these are not physical detectors # but may be useful for testing or study purposes for abv, long_name in get_available_detectors(): d = Detector(abv) # Note that units are all in radians print("{} {} Latitude {} Longitude {}".format(long_name, abv, d.latitude, d.longitude))