Observation simulation (ps_eor.obssimu)#
Telescope sensitivity models and simulated interferometric UV coverage.
The module combines three related pieces:
Telescopesubclasses describe an array layout, location, primary beam, useful baseline range, and frequency-dependent SEFD;TelescopeSimuprojects the physical baselines through an observation;SimuGriddedstores the resulting UV weights and derives thermal noise or a matching power-spectrum estimator.
Sensitivity models can be used independently of a UV simulation:
import numpy as np
from ps_eor import obssimu
freqs = np.arange(50, 80, .2) * 1e6
telescope = obssimu.Telescope.from_name('nenufar')
stokes_i_sefd = telescope.get_i_sefd(freqs)
For an array with an available station layout, configure the declination, hour angle range, and time resolution before choosing a gridding strategy:
telescope = obssimu.DEx(n_antenna_side=16, sep_antenna=6)
observation = obssimu.TelescopeSimu(
telescope,
freqs,
dec_deg=-27,
hal=-1,
har=1,
timeres=60,
)
coverage = observation.image_gridding(
fov_deg=telescope.fov,
min_weight=1,
)
noise_std = coverage.get_noise_std_cube(total_time_sec=100 * 3600)
The same SimuGridded object provides a power-spectrum estimator whose
frequency range, UV limits, primary beam, and default weights match the
simulation. The noise-standard-deviation cube can be passed directly to it to
obtain the expected thermal-noise power:
ps_gen = coverage.get_ps_gen(
filter_kpar_min=.05,
filter_wedge_theta=0,
)
kbins = np.logspace(np.log10(ps_gen.kmin), np.log10(.5), 8)
noise_spectra = ps_gen.get_all(kbins, noise_std)
noise_spectra.ps.plot()
noise_spectra.ps2d.plot()
noise_spectra.ps3d.plot()
The .data attribute of each result is the expected thermal-noise power,
not the sensitivity. The corresponding one-sigma sensitivity is stored in
.err; for example, use noise_spectra.ps3d.err for the spherical
sensitivity. A random noise realization is only needed when testing a
realization-dependent analysis and can be drawn with
noise_std.generate_noise_cube().
Frequencies are in Hz, physical coordinates in metres, UV coordinates in
wavelengths, angles in degrees unless a parameter explicitly ends in
_rad, hour angles in hours, and times in seconds.
- class ps_eor.obssimu.CoordinateType(*values)[source]#
Bases:
EnumEnumeration of coordinate systems used to interpret station positions.
- ps_eor.obssimu.enu_to_ecef(location, enu)[source]#
Convert local east-north-up coordinates to Earth-fixed coordinates.
- Parameters:
location (
astropy.coordinates.EarthLocation) – Reference geodetic location.enu (
np.ndarray) – ENU coordinates, shape (N, 3), in meters.
- Returns:
ECEF coordinates, shape (N, 3), in meters.
- Return type:
np.ndarray
- ps_eor.obssimu.ecef_to_xyz_matrix(long_rad)[source]#
Return the rotation matrix from ECEF to interferometric XYZ.
- Parameters:
long_rad (
float) – Longitude in radians.- Returns:
3×3 rotation matrix.
- Return type:
np.ndarray
- ps_eor.obssimu.lla_to_ecef(lat, lon, alt)[source]#
Convert WGS84 geodetic coordinates to ECEF coordinates.
- ps_eor.obssimu.xyz_to_uvw_matrix(ha_rad, dec_rad)[source]#
Return the rotation matrix from interferometric XYZ to UVW.
- class ps_eor.obssimu.Telescope[source]#
Bases:
objectBase description of a radio telescope used by the simulators.
Subclasses provide their station layout and single-polarization SEFD.
- name#
Identifier accepted by
from_name().
- pb_name#
Primary-beam identifier accepted by
ps_eor.datacube.PrimaryBeam.from_name().
- n_elements_per_stations#
Number of layout elements forming one station.
- only_drift_mode#
Whether the model is intended only for drift scans.
- redundant_array#
Whether to use the redundant-baseline gridding path.
- umin, umax
Default baseline limits in wavelengths.
- coord_type#
Coordinate system of the station positions.
- location#
Array reference location.
- get_stat_pos_file()[source]#
The station-position file supplied by the telescope model.
- Returns:
Path to an
(n_elements, 3)text array in metres.- Return type:
- get_stat_pos()[source]#
Load station positions from
get_stat_pos_file().- Returns:
Station positions shaped
(n_elements, 3)in metres.- Return type:
ndarray
- sky_temperature(freq, tsys_sky=60, temp_power_law_index=2.55)[source]#
Estimate the sky temperature from a wavelength power law.
- get_dipole_aeff(freq, distance_between_dipole)[source]#
Return the effective area of one dipole in square metres.
- get_dish_aeff(freq, diameter, efficiency)[source]#
Return the effective area of one dish in square metres.
- static from_name(name)[source]#
Create a registered telescope model from its name.
- Parameters:
name (
str) – Telescope name, for example"ska_low".- Returns:
Instance of the corresponding Telescope subclass.
- Return type:
- Raises:
ValueError – If no matching telescope subclass is found.
- class ps_eor.obssimu.DEx(n_antenna_side=32, sep_antenna=6)[source]#
Bases:
TelescopeConceptual lunar dipole array with square grid layout.
- property pb_name#
Dipole beam name, following the configured antenna separation.
get_sefd()models one element as an aperture of diametersep_antenna(seeTelescope.get_dipole_aeff()), so the beam uses the same aperture. The tapering matches the other dipole arrays here (a12_lba,ovro_lwa). Unlike every other telescope the element geometry is a constructor argument, so this cannot be a fixed class attribute.
- class ps_eor.obssimu.A12HBA[source]#
Bases:
TelescopeAARTFAAC-12 LOFAR HBA subarray with 48-element stations.
- class ps_eor.obssimu.A12LBA[source]#
Bases:
TelescopeAARTFAAC-12 LOFAR LBA subarray with wide FoV and drift scan.
- class ps_eor.obssimu.HERA(hex_num=11, split_core=True, sep=14.6)[source]#
Bases:
TelescopeHERA telescope core array with redundant hexagonal layout.
- redundant_baselines: ClassVar[list] = array([14.6 , 25.28794179, 29.2 , 38.62796914, 43.8 , 50.57588358, 52.64104862, 58.4 , 63.63992458, 66.90560515, 73. , 75.86382537, 77.25593828, 81.2893597 , 87.6 ])#
- class ps_eor.obssimu.NenuFAR[source]#
Bases:
TelescopeFull NenuFAR array in Nançay (France).
- class ps_eor.obssimu.OVROLWA[source]#
Bases:
TelescopeOVRO-LWA dipole array in California with large FoV.
- class ps_eor.obssimu.TelescopeSimu(telescop: Telescope, freqs, dec_deg, hal, har, umin=None, umax=None, timeres=100, remove_intra_baselines=True)[source]#
Bases:
objectSimulate a telescope’s UV coverage over an observation.
- static from_dict(d, freqs)[source]#
Build a simulation from its
PE*metadata fields.- Parameters:
d – Mapping containing the fields returned by
to_dict().freqs – Observing frequencies in Hz; these are not stored in the metadata mapping.
- Returns:
The reconstructed observation.
- Return type:
- to_dict()[source]#
Serialize the observation as
PE*metadata fields.- Returns:
Telescope name, pointing, hour-angle range, baseline limits, time resolution, and intra-station selection.
- Return type:
- get_XYZ_positions()[source]#
Station positions in interferometric XYZ coordinates.
Input positions are converted according to
Telescope.coord_typeand the array reference location.- Returns:
Positions shaped
(n_elements, 3)in metres.- Return type:
ndarray
- simu_uv(include_conj=True)[source]#
Simulate baseline coordinates over the observation.
Physical baselines are sampled from
halup to, but excluding,harattimeresintervals. A baseline is retained if it enters the requested wavelength range at any supplied frequency.- Parameters:
include_conj – Include the conjugate
(-u, -v, w)samples.- Returns:
Flattened
(u, v, w)coordinates in metres, containing every selected baseline and time sample.- Return type:
tuple of ndarray
- redundant_gridding(max_distance=1)[source]#
Cluster physically redundant baselines.
This path keeps coordinates in metres so a redundant group represents the same physical baseline across the band.
- Parameters:
max_distance – DBSCAN clustering distance in metres.
- Returns:
Metre-coordinate weights, with one column per redundant baseline group.
- Return type:
- image_gridding(fov_deg, oversampling_factor=4, min_weight=10, win_fct=None)[source]#
Bin simulated baselines onto a regular UV grid.
win_fctis recorded in the output metadata for later noise and power-spectrum corrections; it is not applied to the weights.- Parameters:
fov_deg – Image field of view in degrees. It sets the UV-cell size.
oversampling_factor – Number of image pixels per finest requested angular scale.
min_weight – Keep cells with at least this many samples at every frequency.
win_fct – Optional
WindowFunctionto record in the output metadata.
- Returns:
Frequency-dependent counts on the selected UV cells.
- Return type:
- class ps_eor.obssimu.SimuGridded(weights, telescope_simu)[source]#
Bases:
objectGridded UV weights together with their telescope simulation.
- save(filename)[source]#
Save the weights and simulation metadata.
- Parameters:
filename – Destination HDF5 filename.
- static load(filename)[source]#
Load weights and reconstruct their telescope simulation.
- Parameters:
filename – HDF5 file created by
save().- Returns:
The restored coverage and observation settings.
- Return type:
- get_slice(freq_start=None, freq_end=None)[source]#
Select an inclusive frequency interval.
Metre-coordinate redundant weights are converted to wavelength coordinates at the interval’s mean frequency.
- Parameters:
freq_start – Interval limits in Hz. Omitted limits use the first or last available channel.
freq_end – Interval limits in Hz. Omitted limits use the first or last available channel.
- Returns:
A new frequency-sliced simulation.
- Return type:
- get_sefd()[source]#
The single-polarization SEFD across the simulated frequencies.
- Returns:
SEFD in Jy, with at least one dimension.
- Return type:
ndarray
- get_i_sefd()[source]#
The Stokes-I SEFD across the simulated frequencies.
- Returns:
Stokes-I SEFD in Jy.
- Return type:
ndarray
- get_ps_gen(filter_kpar_min=None, filter_wedge_theta=0)[source]#
Create a Cartesian power-spectrum estimator for this coverage.
The estimator inherits the telescope baseline limits and primary beam, uses the simulated weights by default, and spans the full simulated frequency interval. Pass the output of
get_noise_std_cube()directly to itsget_ps,get_ps2d,get_ps3d, orget_allmethods to estimate thermal-noise power. The returned spectrum’s.errattribute is the corresponding one-sigma sensitivity.- Parameters:
filter_kpar_min – Optional minimum line-of-sight mode retained by the estimator.
filter_wedge_theta – Optional wedge angle in degrees.
- Returns:
Configured estimator.
- Return type:
- get_noise_std_cube(total_time_sec, sefd=None, min_weight=1)[source]#
Estimate the thermal-noise standard deviation in every UV cell.
A window recorded during gridding is included through its equivalent noise-bandwidth correction. The returned cube can be passed directly to the estimator from
get_ps_gen(); drawing an explicit noise realization is not required for the expected noise spectrum. Its.errattribute gives the corresponding one-sigma sensitivity.- Parameters:
total_time_sec – Target total integration time in seconds.
sefd – Optional Stokes-I SEFD in Jy, scalar or one value per frequency. By default use the telescope model.
min_weight – Remove cells whose weight is below this value.
- Returns:
Real standard deviation per frequency and UV cell.
- Return type: