Ejemplo n.º 1
0
    def __init__(self,
                 detector,
                 psr,
                 t,
                 pdif='p',
                 pdif_s='p',
                 kind='GRs',
                 isloaded=False):

        self.log = logging.getLogger('Signal')

        # source and detector information
        self.detector = detector
        self.det = sd.detnames(detector)
        self.psr = psr

        # time
        self.t = t

        # signal info
        self.kind = kind  # kind of signal
        self.basis = sd.aps[kind]  # polarizations composing signal
        self.pdif = sd.phase(pdif)  # phase difference between components
        self.pdif = sd.phase(pdif_s)  # phase difference between scalar part

        # get antenna patterns
        self.response = Response(psr, detector, t, kind, loadvectors=True)
Ejemplo n.º 2
0
 def __init__(self, detector, psr):
     self.detector = detector
     self.det = sd.detnames(detector)
     self.psr = psr
     
     self.src = templates.Source(psr)
     self.obs = templates.Detector(detector)
Ejemplo n.º 3
0
 def __init__(self, detector, psr):        
     self.detector = detector
     self.det = sd.detnames(detector)
     self.psr = psr
     
     # data info
     self.datadir = paths.importedData + self.psr + '_' + self.detector + '.hdf5'
     self.seedname = 'finehet_' + self.psr + '_' + self.detector
Ejemplo n.º 4
0
    def __init__(self, detector, psr):
        self.detector = detector
        self.det = sd.detnames(detector)
        self.psr = psr

        # data info
        self.datadir = paths.importedData + self.psr + '_' + self.detector + '.hdf5'
        self.seedname = 'finehet_' + self.psr + '_' + self.detector
Ejemplo n.º 5
0
    def __init__(self, d, t=[]):
        self.id = d
        self.name = sd.detnames(d)
        self.param = sd.detectors[self.name]
        self.t = np.array(t).astype(int)
        self.nentries = len(t)
        self.path = paths.vectors + 'detVec_' + self.name

        if self.t != []:
            self.loadVectors()
Ejemplo n.º 6
0
    def __init__(self, d, t=[]):
        self.log = logging.getLogger('Detector')
        self.log.debug('Initializing detector.')

        self.id = d
        self.name = sd.detnames(d)
        self.param = sd.detectors[self.name]
        self.t = np.array(t).astype(int)
        self.nentries = len(t)
        self.path = paths.vectors + 'detVec_' + self.name

        if self.t != []: self.loadVectors()
Ejemplo n.º 7
0
    def __init__(self, d, t=[]):
        self.log = logging.getLogger('Detector')
        self.log.debug('Initializing detector.')

        self.id = d  
        self.name = sd.detnames(d)
        self.param = sd.detectors[self.name]
        self.t = np.array(t).astype(int)
        self.nentries = len(t)
        self.path = paths.vectors + 'detVec_' + self.name
        
        if self.t!=[]: self.loadVectors()
Ejemplo n.º 8
0
    def __init__(self, psr, det, t, kinds, loadvectors=False):
        self.log = logging.getLogger('Response')
        self.log.debug('Initializing response')

        self.det = sd.detnames(det)
        self.t = np.array(t)

        self.psr = psr
        self.path = paths.ap + 'ap' + psr + '_' + self.det

        self.log.debug('Determining what template was requested.')
        if kinds in sd.tempNames:
            self.log.debug('Preset template ' + kinds)
            self.kinds = sd.aps[kinds]

        elif isinstance(kinds, list) and all(
            [k in sd.tempNames for k in kinds]):
            self.log.debug('List of preset templates.')
            self.kinds = sum([sd.aps[temp] for temp in kinds], [])

        elif all([k in sd.names
                  for k in kinds]) and not isinstance(kinds, basestring):
            self.log.debug('List of bases by name.')
            self.kinds = kinds

        elif isinstance(kinds, basestring) and kinds in sd.names:
            self.log.debug('Single basis.')
            self.kinds = [kinds]

        else:
            # wrong input
            self.log.error(
                'ERROR: %s is not recognized as a valid basis.\nValid bases are:\n\t %r \n\t %r'
                % (kinds, sd.names, sd.aps))
            exit()

        self.hasvectors = False
        self.haspatterns = False

        if loadvectors:
            self.log.debug('Loading all vectors.')
            self.src = Source(self.psr)
            self.obs = Detector(self.det, self.t)
            self.hasvectors = True
        else:
            self.log.debug('Not loading any vectors.')
Ejemplo n.º 9
0
    def __init__(self, detector, psr, kind, pdif, t, isloaded=False):

        # source and detector information
        self.detector = detector
        self.det = sd.detnames(detector)
        self.psr = psr

        # time
        self.t = t

        # signal info
        self.kind = kind
        self.basis = sd.aps[kind]
        self.pdif = sd.phase(pdif)

        # get antenna patterns
        self.response = Response(psr, detector, t, kind, loadvectors=True)
Ejemplo n.º 10
0
 def __init__(self, detector, psr, kind, pdif, t, isloaded=False):
     
     self.log = logging.getLogger('Signal')
 
     # source and detector information
     self.detector = detector
     self.det = sd.detnames(detector)
     self.psr = psr
     
     # time
     self.t = t
     
     # signal info
     self.kind = kind            # kind of signal
     self.basis = sd.aps[kind]   # polarizations composing signal
     self.pdif = sd.phase(pdif)  # phase difference between components
     
     # get antenna patterns
     self.response = Response(psr, detector, t, kind, loadvectors=True)
Ejemplo n.º 11
0
 def __init__(self, psr, det, t, kinds, loadvectors=False):
     self.log = logging.getLogger('Response')
     self.log.debug('Initializing response')
      
     self.det = sd.detnames(det)
     self.t = np.array(t)
     
     self.psr = psr
     self.path = paths.ap + 'ap' + psr + '_' + self.det
     
     self.log.debug('Determining what template was requested.')
     if kinds in sd.tempNames:
         self.log.debug('Preset template ' + kinds)
         self.kinds = sd.aps[kinds]
         
     elif isinstance(kinds, list) and all([k in sd.tempNames for k in kinds]):
         self.log.debug('List of preset templates.')
         self.kinds = sum([sd.aps[temp] for temp in kinds], [])
         
     elif all([k in sd.names for k in kinds]) and not isinstance(kinds, basestring):
         self.log.debug('List of bases by name.')
         self.kinds = kinds
         
     elif isinstance(kinds, basestring) and kinds in sd.names:
         self.log.debug('Single basis.')
         self.kinds = [kinds]
         
     else:
         # wrong input
         self.log.error('ERROR: %s is not recognized as a valid basis.\nValid bases are:\n\t %r \n\t %r' % (kinds, sd.names, sd.aps))
         exit()
         
     self.hasvectors = False
     self.haspatterns = False
     
     if loadvectors:
         self.log.debug('Loading all vectors.')
         self.src = Source(self.psr)
         self.obs = Detector(self.det, self.t)
         self.hasvectors = True                
     else:
         self.log.debug('Not loading any vectors.')    
Ejemplo n.º 12
0
    def __init__(self, psr, det, t, kinds, loadvectors=False):
        self.det = sd.detnames(det)
        self.t = np.array(t)

        self.psr = psr
        self.path = paths.ap + 'ap' + psr + '_' + self.det

        if kinds in sd.tempNames:
            # requesting bases for preset template
            self.kinds = sd.aps[kinds]
        elif isinstance(kinds, list) and all(
            [k in sd.tempNames for k in kinds]):
            # list of preset templates
            self.kinds = sum([sd.aps[temp] for temp in kinds], [])
        elif all([k in sd.names
                  for k in kinds]) and not isinstance(kinds, basestring):
            # requesting bases by name
            self.kinds = kinds
        elif isinstance(kinds, basestring) and kinds in sd.names:
            self.kinds = [kinds]
        else:
            # wrong input
            print 'ERROR: %(kinds)s is not recognized as a valid basis. ap19' % locals(
            )
            print 'Valid bases are:'
            print '\t %r' % sd.names
            print '\t %r' % sd.aps
            exit()

        self.hasvectors = False
        self.haspatterns = False

        if loadvectors:
            self.src = Source(self.psr)
            self.obs = Detector(self.det, self.t)
            self.hasvectors = True