Esempio n. 1
0
    def getCalibratorNamesSorted(self):
        """
        Returns a list of names of known calibrators, sorted by distance from small to large.
        """
        myRA, myDec                                    = self.getPhaseCentre()
        calibratorRAs, calibratorDecs, calibratorNames = lib_util.getCalibratorProperties()
        calibratorDistances                            = lib_util.distanceOnSphere(myRA, myDec, calibratorRAs, calibratorDecs)

        calibratorNamesSorted                          = calibratorNames[np.argsort(calibratorDistances)]
        return calibratorNamesSorted
Esempio n. 2
0
                            atrous_do=False,
                            maskname=mask_ddcal,
                            write_srl=True,
                            write_ds9=True)
        cal = astrotab.read(mask_ddcal.replace('fits', 'cat.fits'),
                            format='fits')
        cal = cal[np.where(cal['Total_flux'] > 3)]
        cal.sort('Total_flux')
        cal.reverse()

        # cycle on sources to peel
        phasecentre = MSs.getListObj()[0].getPhaseCentre()
        for peelsou in cal:
            name = str(peelsou['Source_id'])
            # Skip if source is close to phase centre
            dist = lib_util.distanceOnSphere(phasecentre[0], phasecentre[1],
                                             peelsou['RA'], peelsou['DEC'])
            if dist < 0.5:
                continue

            logger.info('Peeling %s (%.1f Jy)' % (name, peelsou['Total_flux']))

            with w.if_todo('peel-%s' % name):
                lib_util.check_rm('peel-%s' % name)
                os.system('mkdir peel-%s' % name)

                # make a region
                from pyregion.parser_helper import Shape
                import pyregion
                peel_region_file = 'peel-' + name + '/' + name + '.reg'
                sh = Shape('circle', None)
                sh.coord_format = 'fk5'
Esempio n. 3
0
            'deg\] corrbeam.direction=\[' + str(center[0]) + 'deg,' +
            str(str(center[1])) + 'deg\]',
            log='$nameMS_beam-.log',
            commandType='DPPP')
    ### DONE

# apply init - closest DDE sol
# TODO: this assumes phase000 and optionally, amplitude000
with w.if_todo('apply_init'):
    h5init = h5parm(dde_h5parm)
    solset_dde = h5init.getSolset('sol000')
    # get closest dir to target reg center
    dirs = np.array(
        [solset_dde.getSou()[k] for k in solset_dde.getSoltab('phase000').dir])
    dir_dist = lib_util.distanceOnSphere(dirs[:, 0],
                                         dirs[:, 1],
                                         *np.deg2rad(center),
                                         rad=True)
    closest = solset_dde.getSoltab('phase000').dir[np.argmin(dir_dist)]
    logger.info(
        'Init apply: correct closest DDE solutions ({})'.format(closest))
    logger.info('Correct init ph...')
    MSs.run('DPPP ' + parset_dir +
            '/DPPP-correct.parset msin=$pathMS msin.datacolumn=DATA '
            'msout.datacolumn=CORRECTED_DATA cor.parmdb=' + dde_h5parm +
            ' cor.correction=phase000 cor.direction=' + closest,
            log='$nameMS_init-correct.log',
            commandType='DPPP')
    if 'amplitude000' in solset_dde.getSoltabNames():
        logger.info('Correct init amp...')
        MSs.run(
            'DPPP ' + parset_dir +