Exemplo n.º 1
0
    def lal(self):
        """ Return lal data type detector instance """
        if hasattr(self, '_lal'):
            return self._lal
        else:
            import lal
            d = lal.FrDetector()
            d.vertexLongitudeRadians = self.longitude
            d.vertexLatitudeRadians = self.latitude
            d.vertexElevation = self.info['height']
            d.xArmAzimuthRadians = self.info['xangle']
            d.yArmAzimuthRadians = self.info['yangle']
            d.xArmAltitudeRadians = self.info['yaltitude']
            d.xArmAltitudeRadians = self.info['xaltitude']

            # This is somewhat abused by lalsimulation at the moment
            # to determine a filter kernel size. We set this only so that
            # value gets a similar number of samples as other detectors
            # it is used for nothing else
            d.yArmMidpoint = 4000.0

            x = lal.Detector()
            r = lal.CreateDetector(x, d, lal.LALDETECTORTYPE_IFODIFF)
            self._lal = r
            return r
Exemplo n.º 2
0
if hasattr(numpy, "ComplexWarning"):
    warnings.simplefilter("error", numpy.ComplexWarning)

# check module load
print("checking module load ...")
import lal
from lal import globalvar as lalglobalvar
lal_c_si = lal.C_SI
lal_180_pi = lal.LAL_180_PI
print("PASSED module load")

# check memory allocation
print("checking memory allocation ...")
if not lal.NoDebug:
    lal.CheckMemoryLeaks()
    mem1 = lal.Detector()
    mem2 = lal.CreateCOMPLEX8Vector(5)
    mem3 = lal.CreateREAL8Vector(3)
    mem4 = lal.CreateREAL4TimeSeries("test", lal.LIGOTimeGPS(0), 100, 0.1,
                                     lal.DimensionlessUnit, 10)
    print("*** below should be an error message from CheckMemoryLeaks() ***")
    try:
        lal.CheckMemoryLeaks()
        expected_exception = True
    except:
        pass
    assert (not expected_exception)
    print("*** above should be an error message from CheckMemoryLeaks() ***")
    del mem1
    del mem2
    del mem3
Exemplo n.º 3
0
  lal.GPSSetREAL8( gpsin, gpstime )

  # convert RA and dec to radians
  rarad = lalpulsar.hmsToRads( ra )
  decrad = lalpulsar.dmsToRads( dec )

  # setup a pulsar signal params structure
  params = lalpulsar.PulsarSignalParams()
  params.pulsar.position.latitude = decrad
  params.pulsar.position.longitude = rarad
  params.pulsar.position.system = lal.COORDINATESYSTEM_EQUATORIAL
  params.ephemerides = edat

  # set the site information
  if det.upper() in radscopenames:
    detector = lal.Detector()
    detector.location = radscopepos[det.upper()]
    params.site = detector
  else:
    params.site = lalpulsar.GetSiteInfo( det.upper() );

  # get time of arrival at detector
  toadet = lal.LIGOTimeGPS()
  lalpulsar.ConvertSSB2GPS( toadet, gpsin, params )

  # output the time
  #print >> sys.stdout, "%.9f" % (toadet.gpsSeconds + toadet.gpsNanoSeconds*1e-9)
  print("%d.%09d" % (toadet.gpsSeconds, toadet.gpsNanoSeconds))

  sys.exit(0)