예제 #1
0
def write(parms, verbose=True):

    if 'infile' not in parms:
        raise KeyError(
            'PRISim input file not specified. See example in {0}examples/ioparms/uvfitsparms.yaml'
            .format(prisim_path))
    if parms['infile'] is None:
        raise ValueError(
            'PRISim input file not specified. See example in {0}examples/ioparms/uvfitsparms.yaml'
            .format(prisim_path))
    infile_parsed = parms['infile'].rsplit('.', 1)
    if len(infile_parsed) > 1:
        extn = infile_parsed[-1]
        if extn.lower() in ['hdf5', 'fits']:
            parms['infile'] = '.'.join(infile_parsed[:-1])
    if 'outfile' not in parms:
        parms['outfile'] = parms['infile']
    if parms['outfile'] is None:
        parms['outfile'] = parms['infile']
    if 'phase_center' not in parms:
        raise KeyError(
            'Phase center [ra, dec] (deg) as a numpy array must be specified. See example in {0}examples/ioparms/uvfitsparms.yaml'
            .format(prisim_path))
    if 'method' not in parms:
        raise KeyError(
            'Key specifying UVFITS method is missing. See example in {0}examples/ioparms/uvfitsparms.yaml'
            .format(prisim_path))

    if 'overwrite' not in parms:
        parms['overwrite'] = True
    elif not isinstance(parms['overwrite'], bool):
        raise TypeError('Overwrite parameter must be boolean')

    ref_point = {
        'location': NP.asarray(parms['phase_center']).reshape(1, -1),
        'coords': 'radec'
    }
    uvfits_parms = {'ref_point': ref_point, 'method': parms['method']}

    prisimobj = RI.InterferometerArray(None,
                                       None,
                                       None,
                                       init_file=parms['infile'])
    prisimobj.write_uvfits(parms['outfile'],
                           uvfits_parms=uvfits_parms,
                           overwrite=parms['overwrite'],
                           verbose=verbose)
예제 #2
0
    def interferometer(self):
        """
        An instance of `prisim.interferometry.InterferometerArray`
        """

        antpos, ants = self.uvdata.get_ENU_antpos()
        labels=np.asarray(self.uvdata.get_antpairs(), dtype=[("A2", int), ("A1", int)])
        antpairs = self.uvdata.get_antpairs()
        baseline_vectors = np.array([antpos[ant[0]] - antpos[ant[1]] for ant in antpairs])

        return intf.InterferometerArray(
            labels = [("A"+str(i), str(baseline_vectors[i])) for i in range(len(antpairs))],
            baselines=baseline_vectors,   
            channels=self.uvdata.freq_array[0],
            telescope=None,  # TODO: new class
            latitude=np.degrees(self.uvdata.telescope_lat_lon_alt[0]),
            longitude=np.degrees(self.uvdata.telescope_lat_lon_alt[1]),
            altitude=self.uvdata.telescope_lat_lon_alt[2],
            pointing_coords="altaz"
        )
예제 #3
0
    misc_group = parser.add_argument_group('Misc parameters',
                                           'Misc specifications')
    misc_group.add_argument('-w',
                            '--wait',
                            dest='wait',
                            action='store_true',
                            help='Wait after run')

    args = vars(parser.parse_args())
    outfile = args['outfile']
    outformats = args['outfmt']
    parmsfile = args['parmsfile']

    simobj = RI.InterferometerArray(None,
                                    None,
                                    None,
                                    init_file=args['simfile'])
    if parmsfile is None:
        parmsfile = simobj.simparms_file

    with open(parmsfile, 'r') as pfile:
        parms = yaml.safe_load(pfile)

    # The following "if" statement is to allow previous buggy saved versions
    # of HDF5 files that did not save the projected_baselines attribute in the
    # right shape when n_acc=1

    update_projected_baselines = False
    if simobj.projected_baselines.ndim != 3:
        update_projected_baselines = True
    else: