processing_components/calibration/pointing.py
def create_pointingtable_from_blockvisibility(vis: BlockVisibility, pointing_frame='azel', timeslice=None,
                                              frequencyslice: float = None, **kwargs) -> PointingTable:
    """ Create pointing table from visibility.
    
    This makes an empty pointing table consistent with the BlockVisibility.
    
    :param vis: BlockVisibilty
    :param timeslice: Time interval between solutions (s)
    :param frequency_width: Frequency solution width (Hz)
    :return: PointingTable
    
    """
    assert isinstance(vis, BlockVisibility), "vis is not a BlockVisibility: %r" % vis
    
    nants = vis.nants
    
    if timeslice is None or timeslice == 'auto':
        utimes = numpy.unique(vis.time)
        ntimes = len(utimes)
        pointing_interval = numpy.zeros([ntimes])
        if ntimes > 1:
            pointing_interval[:-1] = utimes[1:] - utimes[0:-1]
            pointing_interval[-1] = utimes[-1] - utimes[-2]
        else:
            pointing_interval[...] = 1.0
    
    else:
        ntimes = numpy.ceil((numpy.max(vis.time) - numpy.min(vis.time)) / timeslice).astype('int')
        utimes = numpy.linspace(numpy.min(vis.time), numpy.max(vis.time), ntimes)
        pointing_interval = timeslice * numpy.ones([ntimes])
    
    #    log.debug('create_pointingtable_from_blockvisibility: times are %s' % str(utimes))
    #    log.debug('create_pointingtable_from_blockvisibility: intervals are %s' % str(pointing_interval))
    
    ntimes = len(utimes)
    ufrequency = numpy.unique(vis.frequency)
    nfrequency = len(ufrequency)
    
    receptor_frame = ReceptorFrame(vis.polarisation_frame.type)
    nrec = receptor_frame.nrec
    
    pointingshape = [ntimes, nants, nfrequency, nrec, 2]
    pointing = numpy.zeros(pointingshape)
    if nrec > 1:
        pointing[..., 0, 0] = 0.0
        pointing[..., 1, 0] = 0.0
        pointing[..., 0, 1] = 0.0
        pointing[..., 1, 1] = 0.0

    ha = numpy.pi * vis.time / 43200.0
    dec = vis.phasecentre.dec.rad
    latitude = vis.configuration.location.lat.rad
    az, el = hadec_to_azel(ha, dec, latitude)

    pointing_nominal = numpy.zeros([ntimes, nants, nfrequency, nrec, 2])
    pointing_nominal[...,0] = az[:, numpy.newaxis, numpy.newaxis, numpy.newaxis]
    pointing_nominal[...,1] = el[:, numpy.newaxis, numpy.newaxis, numpy.newaxis]
    pointing_weight = numpy.ones(pointingshape)
    pointing_time = utimes
    pointing_frequency = ufrequency
    pointing_residual = numpy.zeros([ntimes, nfrequency, nrec, 2])
    pointing_frame = pointing_frame
    
    pt = PointingTable(pointing=pointing, nominal=pointing_nominal,
                       time=pointing_time, interval=pointing_interval, weight=pointing_weight,
                       residual=pointing_residual, frequency=pointing_frequency, receptor_frame=receptor_frame,
                       pointing_frame=pointing_frame, pointingcentre=vis.phasecentre, configuration=vis.configuration)
    
    assert isinstance(pt, PointingTable), "pt is not a PointingTable: %r" % pt
    
    return pt
 Create pointing table from visibility.
    
    This makes an empty pointing table consistent with the BlockVisibility.
    
    :param vis: BlockVisibilty
    :param timeslice: Time interval between solutions (s)
    :param frequency_width: Frequency solution width (Hz)
    :return: PointingTable
    
    
Create pointing table from visibility.
This makes an empty pointing table consistent with the BlockVisibility.
Create pointing table from visibility . This makes an empty pointing table consistent with the BlockVisibility .
def create_pointingtable_from_blockvisibility(vis: BlockVisibility, pointing_frame='azel', timeslice=None,
                                              frequencyslice: float = None, **kwargs) -> PointingTable:
    assert isinstance(vis, BlockVisibility), "vis is not a BlockVisibility: %r" % vis
    nants = vis.nants
    if timeslice is None or timeslice == 'auto':
        utimes = numpy.unique(vis.time)
        ntimes = len(utimes)
        pointing_interval = numpy.zeros([ntimes])
        if ntimes > 1:
            pointing_interval[:-1] = utimes[1:] - utimes[0:-1]
            pointing_interval[-1] = utimes[-1] - utimes[-2]
        else:
            pointing_interval[...] = 1.0
    else:
        ntimes = numpy.ceil((numpy.max(vis.time) - numpy.min(vis.time)) / timeslice).astype('int')
        utimes = numpy.linspace(numpy.min(vis.time), numpy.max(vis.time), ntimes)
        pointing_interval = timeslice * numpy.ones([ntimes])
    ntimes = len(utimes)
    ufrequency = numpy.unique(vis.frequency)
    nfrequency = len(ufrequency)
    receptor_frame = ReceptorFrame(vis.polarisation_frame.type)
    nrec = receptor_frame.nrec
    pointingshape = [ntimes, nants, nfrequency, nrec, 2]
    pointing = numpy.zeros(pointingshape)
    if nrec > 1:
        pointing[..., 0, 0] = 0.0
        pointing[..., 1, 0] = 0.0
        pointing[..., 0, 1] = 0.0
        pointing[..., 1, 1] = 0.0
    ha = numpy.pi * vis.time / 43200.0
    dec = vis.phasecentre.dec.rad
    latitude = vis.configuration.location.lat.rad
    az, el = hadec_to_azel(ha, dec, latitude)
    pointing_nominal = numpy.zeros([ntimes, nants, nfrequency, nrec, 2])
    pointing_nominal[...,0] = az[:, numpy.newaxis, numpy.newaxis, numpy.newaxis]
    pointing_nominal[...,1] = el[:, numpy.newaxis, numpy.newaxis, numpy.newaxis]
    pointing_weight = numpy.ones(pointingshape)
    pointing_time = utimes
    pointing_frequency = ufrequency
    pointing_residual = numpy.zeros([ntimes, nfrequency, nrec, 2])
    pointing_frame = pointing_frame
    pt = PointingTable(pointing=pointing, nominal=pointing_nominal,
                       time=pointing_time, interval=pointing_interval, weight=pointing_weight,
                       residual=pointing_residual, frequency=pointing_frequency, receptor_frame=receptor_frame,
                       pointing_frame=pointing_frame, pointingcentre=vis.phasecentre, configuration=vis.configuration)
    assert isinstance(pt, PointingTable), "pt is not a PointingTable: %r" % pt
    return pt
def create_pointingtable_from_blockvisibility ( vis : BlockVisibility , pointing_frame = 'azel' , timeslice = None , frequencyslice : float = None , ** kwargs ) -> PointingTable : assert isinstance ( vis , BlockVisibility ) , "vis is not a BlockVisibility: %r" % vis nants = vis . nants if timeslice is None or timeslice == 'auto' : utimes = numpy . unique ( vis . time ) ntimes = len ( utimes ) pointing_interval = numpy . zeros ( [ ntimes ] ) if ntimes > 1 : pointing_interval [ : - 1 ] = utimes [ 1 : ] - utimes [ 0 : - 1 ] pointing_interval [ - 1 ] = utimes [ - 1 ] - utimes [ - 2 ] else : pointing_interval [ ... ] = 1.0 else : ntimes = numpy . ceil ( ( numpy . max ( vis . time ) - numpy . min ( vis . time ) ) / timeslice ) . astype ( 'int' ) utimes = numpy . linspace ( numpy . min ( vis . time ) , numpy . max ( vis . time ) , ntimes ) pointing_interval = timeslice * numpy . ones ( [ ntimes ] ) ntimes = len ( utimes ) ufrequency = numpy . unique ( vis . frequency ) nfrequency = len ( ufrequency ) receptor_frame = ReceptorFrame ( vis . polarisation_frame . type ) nrec = receptor_frame . nrec pointingshape = [ ntimes , nants , nfrequency , nrec , 2 ] pointing = numpy . zeros ( pointingshape ) if nrec > 1 : pointing [ ... , 0 , 0 ] = 0.0 pointing [ ... , 1 , 0 ] = 0.0 pointing [ ... , 0 , 1 ] = 0.0 pointing [ ... , 1 , 1 ] = 0.0 ha = numpy . pi * vis . time / 43200.0 dec = vis . phasecentre . dec . rad latitude = vis . configuration . location . lat . rad az , el = hadec_to_azel ( ha , dec , latitude ) pointing_nominal = numpy . zeros ( [ ntimes , nants , nfrequency , nrec , 2 ] ) pointing_nominal [ ... , 0 ] = az [ : , numpy . newaxis , numpy . newaxis , numpy . newaxis ] pointing_nominal [ ... , 1 ] = el [ : , numpy . newaxis , numpy . newaxis , numpy . newaxis ] pointing_weight = numpy . ones ( pointingshape ) pointing_time = utimes pointing_frequency = ufrequency pointing_residual = numpy . zeros ( [ ntimes , nfrequency , nrec , 2 ] ) pointing_frame = pointing_frame pt = PointingTable ( pointing = pointing , nominal = pointing_nominal , time = pointing_time , interval = pointing_interval , weight = pointing_weight , residual = pointing_residual , frequency = pointing_frequency , receptor_frame = receptor_frame , pointing_frame = pointing_frame , pointingcentre = vis . phasecentre , configuration = vis . configuration ) assert isinstance ( pt , PointingTable ) , "pt is not a PointingTable: %r" % pt return pt
Create pointing table from visibility.
Create pointing table from visibility .
""" Create pointing table from visibility.
    
    This makes an empty pointing table consistent with the BlockVisibility.
    
    :param vis: BlockVisibilty
    :param timeslice: Time interval between solutions (s)
    :param frequency_width: Frequency solution width (Hz)
    :return: PointingTable
    
    """ #    log.debug('create_pointingtable_from_blockvisibility: times are %s' % str(utimes)) #    log.debug('create_pointingtable_from_blockvisibility: intervals are %s' % str(pointing_interval))
None
vis
BlockVisibility
None
pointing_frame
timeslice
Time interval between solutions (s)
Time interval between solutions ( s )
frequencyslice
float
frequency_width
Frequency solution width (Hz)
Frequency solution width ( Hz )