def make_vis_data(name, sky0, ra_deg, dec_deg, max_radius_deg, length_sec,
                  num_time_steps, num_channels):
    """Generates visibility data."""
    settings_dict = {
        'simulator': {
            'max_sources_per_chunk': '2000'
        },
        'observation': {
            'length': str(length_sec),
            'num_time_steps': str(num_time_steps),
            'start_frequency_hz': '140e6',
            'frequency_inc_hz': '1e6',
            'num_channels': str(num_channels),
            'phase_centre_ra_deg': str(ra_deg),
            'phase_centre_dec_deg': str(dec_deg)
        },
        'telescope': {
            'input_directory': 'SKA1-LOW_SKO-0000422_Rev3_38m.tm',
            'pol_mode': 'Scalar'
        },
        'interferometer': {
            'channel_bandwidth_hz': '100e3',
            'time_average_sec': '1.0',
            'max_time_samples_per_block': '4',
            'ms_filename': 'sim_' + name + '.ms',
            'oskar_vis_filename': 'sim_' + name + '.vis'
        }
    }
    settings = oskar.SettingsTree('oskar_sim_interferometer')
    settings.from_dict(settings_dict)
    settings['observation/start_time_utc'] = get_start_time(ra_deg, length_sec)
    sky = make_sky_model(sky0, settings, max_radius_deg)
    sky.save('sky_' + name + '.txt')
    sim = oskar.Interferometer(settings=settings)
    sim.set_sky_model(sky)
    sim.run()
コード例 #2
0
                                  16,
                                  5,
                                  precision=precision)
    sky.append_sources(phase_centre_ra_deg, phase_centre_dec_deg, 1.0)

    # Set up the telescope model.
    tel = oskar.Telescope(precision)
    tel.set_channel_bandwidth(100e3)
    tel.set_time_average(10.0)
    tel.set_pol_mode('Scalar')
    tel.load('SKA1-LOW_v5_single_random.tm')
    # Set station properties after stations have been defined.
    tel.set_phase_centre(phase_centre_ra_deg, phase_centre_dec_deg)
    tel.set_station_type('Isotropic')

    # Set up the basic simulator and run simulation.
    simulator = oskar.Interferometer(precision)
    simulator.set_settings_path(os.path.abspath(__file__))
    simulator.set_max_sources_per_chunk(sky.num_sources + 1)
    simulator.set_sky_model(sky)
    simulator.set_telescope_model(tel)
    simulator.set_observation_frequency(frequency_hz)
    simulator.set_observation_time(start_time_mjd_utc=51544.375,
                                   length_sec=10800.0,
                                   num_time_steps=180)
    simulator.set_output_measurement_set(filename)
    start = time.time()
    simulator.run()
    print('Simulation for %05.1f MHz completed after %.3f seconds.' %
          (frequency_hz / 1e6, time.time() - start))
コード例 #3
0
ファイル: hello-world.py プロジェクト: liguicheng/OSKAR
settings.from_dict(params)

# Set the numerical precision to use.
precision = 'single'
if precision == 'single':
    settings['simulator/double_precision'] = 'false'

# Create a sky model containing three sources from a numpy array.
sky_data = numpy.array(
    [[20.0, -30.0, 1, 0, 0, 0, 100.0e6, -0.7, 0.0, 0, 0, 0],
     [20.0, -30.5, 3, 2, 2, 0, 100.0e6, -0.7, 0.0, 600, 50, 45],
     [20.5, -30.5, 3, 0, 0, 2, 100.0e6, -0.7, 0.0, 700, 10, -10]])
sky = oskar.Sky.from_array(sky_data, precision)  # Pass precision here.

# Set the sky model and run the simulation.
sim = oskar.Interferometer(settings=settings)
sim.set_sky_model(sky)
sim.run()

# Make an image 4 degrees across and return it to Python.
# (It will also be saved with the filename 'example_I.fits'.)
imager = oskar.Imager(precision)
imager.set(fov_deg=4, image_size=512)
imager.set(input_file='example.vis', output_root='example')
output = imager.run(return_images=1)
image = output['images'][0]

# Render the image using matplotlib and save it as a PNG file.
im = plt.imshow(image, cmap='jet')
plt.gca().invert_yaxis()
plt.colorbar(im)