Classes subclassed from
SimulationComponent
now have ais_randomized
class attribute that informs theSimulator
of whether it should provide aBitGenerator
to the class when simulating the component. - Classes which use a random component should now have arng
attribute,which should be treated in the same manner as other model parameters. In other words, random states are now effectively treated as model parameters.
New simulator class
FFTVis
that uses thefftvis
package to simulate visibilities. This is a CPU-based visibility simulator that is faster thanMatVis
for large, compact arrays.
All random number generation now uses the new
numpy
API. - Rather than seed the global random state, a newBitGenerator
is madewith whatever random seed is desired.
- The Simulator API has remained virtually unchanged, but the internal logic that handles random state management has received a significant update.
- Support for Python 3.9 has been dropped.
- API calls for pyuvdata v2.4.0.
This release heavily focuses on performance of the visibility simulators, and in
particular the VisCPU
simulator.
- Passing
spline_interp_opts
now correctly pipes these options through to the visibility simulators.
- New
_blt_order_kws
class-attribute forVisibilitySimulator
subclasses, that can be used to create the mock metadata in an order corresponding to that required by the simulator (instead of re-ordering after data creation, which can take some time). - New optional
compress_data_model()
method onVisibilitySimulator
subclasses that allows unnecessary metadata in theUVData
object to be dropped before simulation (can be restored afterwards with the associatedrestore_data_model()
). This can reduce peak memory usage. - New
check_antenna_conjugation
parameter for theVisCPU
simulator, to allow turning off checks for antenna conjugation, which takes time and is unnecessary for mock datasets. - Dependency on
hera-cli-utils
which adds options like--log-level
and--profile
tohera-sim-vis.py
. - Option to use a taper in generating a bandpass.
utils.tanh_window
function for generating a two-sided tanh window.interpolators.Reflection
class for building a complex reflection coefficient interpolator from anpz
archive.- Reflection coefficient and beam integral
npz
archives for the phase 1 and phase 4 systems (i.e., dipole feed and Vivaldi feed).
run_check_acceptability
is nowFalse
by default when constructing simulations from obsparams configuration files, to improve performance.- For
VisCPU
simulator, we no longer copy the whole data array when simulating, but instead just fill the existing one, to save on peak RAM. - Made
VisCPU._reorder_vis()
much faster (like 99% time reduction). - The
--compress
option tohera-sim-vis.py
is no longer a boolean flag but takes a file argument. This file will be written as a cache of the baseline-time indices required to keep when compressing by redundancy.
- Removed the
HealVis
wrapper. Usepyuvsim
instead.
- Updated package to always use future array shapes for
pyuvdata
objects (this includes updates toPolyBeam
andSimulator
objects amongst others).
- Coupling matrix calculation in :class:`~.sigchain.MutualCoupling` has been updated to correctly calculate the coupling coefficients from the provided E-field beam.
- :class:`~.sigchain.MutualCoupling` class that simulates the systematic described in Josaitis et al. 2021.
- New class attributes for the :class:`~.SimulationComponent` class:
return_type
specifies what type of return value to expect;attrs_to_pull
specifies whichSimulator
attributes to use.
- Some helper functions for :class:`~.sigchain.MutualCoupling` matrix multiplications.
- More attributes from the underlying
UVData
object exposed to the :class:`~.Simulator`.
Simulator._update_args
logic has been improved.- :class:`~.Simulator` attributes
lsts
,times
, andfreqs
are no longer cached.
- Finally removed ability to set
use_pixel_beams
andbm_pix
on the VisCPU simulator. This was removed in v1.0.0 ofvis_cpu
. - Official support for py37.
- Added isort and pyupgrade pre-commit hooks for cleaner code.
NotImplementedError
raised when trying to simulate noise using an interpolated sky temperature and phase-wrapped LSTs.- More comparison tests of pyuvsim wrapper.
- Inferred integration time in
ThermalNoise
when phase-wrapped LSTs are used. - Added
**kwargs
toPolyBeam.interp
method to match UVBeam. - healvis wrapper properly sets cross-pol visibilities to zero.
- Temporarily forced all UVData objects in the code to use current array shapes.
adjustment.interpolate_to_reference
now supports interpolating in time when there is a phase wrap in LST.
- Some logical statements in
adjustment.interpolate_to_reference
were changed to use binary operators on logical arrays instead of e.g.np.logical_or
.
_extract_kwargs
attribute added to theSimulationComponent
class. This attribute is used by theSimulator
to determine which optional parameters should actually be extracted from the data.antpair
optional parameter added to theThermalNoise
class. This is used to determine whether to simulate noise via the radiometer equation (as is appropriate for a cross-correlation) or to just add a bias from the receiver temperature (which is our proxy for what should happen to an auto-correlation).
- The
Simulator
class now correctly uses the auto-correlations to simulate noise for the cross-correlations.
- Using the
normalize_beams
option is now possible with thefrom_config
class method.
normalize_beams
option inModelData
class. Setting this parameter toTrue
enforces peak-normalization on all of the beams used in the simulation. The default behavior is to not peak-normalize the beams.
OverAirCrossCoupling
now has a parameteramp_norm
. This lets the user decide at what distance from the receiverator the gain of the emitted signal is equal to the base amplitude.
OverAirCrossCoupling
now only simulates the systematic for cross-correlations.ReflectionSpectrum
class had itsis_multiplicative
attribute set to True.
- New
ReflectionSpectrum
class to generate multiple reflections over a specified range of delays/amplitudes.
- Corrected some parameter initializations in
sigchain
module.
- New
OverAirCrossCoupling
class to better model crosstalk in H1C data.
- Slightly modified
Simulator
logic for automatically choosing parameter values. This extends the number of cases the class can handle, but will be changed in a future update.
- New VisibilitySimulator interface. See the `<https://hera-sim.readthedocs.io/en/latest/tutorials/visibility_simulator.html> Visibility Simulator Tutorial`_
for details. This is a breaking change for usage of the visibility simulators, and
includes more robust handling of polarization, fixed ordering of data when put back
into the
UVData
objects, more native support for usingpyradiosky
to define the sky model, and improved support forvis_cpu
. - Interface directly to the
pyuvsim
simulation engine. - Ability to load tutorial data from the installed package.
- New and refactored tests for visibility simulations.
- default
feed_array
forPolyBeam
fixed.
- Updated tutorial for the visibility simulator interface (see above link).
vis_cpu
made an optional extra- removed the
conversions
module, which is now in thevis_cpu
package. - Can now properly use
pyuvdata>=2.2.0
.
- Add a Zernike polynomial beam model.
- Enable polarization support for
vis_cpu
(handles polarized primary beams, but only Stokes I sky model so far) - Add a polarized version of the analytic PolyBeam model.
- Bug in retrieval of unique LSTs by :class:`~.Simulator` when a blt-order other than time-baseline is used has been fixed. LSTs should now be correctly retrieved.
- :func:`~.io.empty_uvdata` now sets the
phase_type
attribute to "drift".
- Discrepancy in :class:`~.foregrounds.PointSourceForeground` documentation and actual implementation has been resolved. Simulated foregrounds now look reasonable.
- The time parameters used for generating an example
Simulator
instance in the tutorial have been updated to match their description. - :class:`~.Simulator` tutorial has been changed slightly to account for the foreground fix.
- :mod:`~.adjustment` module from HERA Phase 1 Validation work
- :func:`~.adjustment.adjust_to_reference`
- High-level interface for making one set of data comply with another set of data. This may involve rephasing or interpolating in time and/or interpolating in frequency. In the case of a mismatch between the two array layouts, this algorithm will select a subset of antennas to provide the greatest number of unique baselines that remain in the downselected array.
- All other functions in this module exist only to modularize the above function.
:mod:`~.cli_utils` module providing utility functions for the CLI simulation script.
- :mod:`~.components` module providing an abstract base class for simulation components.
Any new simulation components should be subclassed from the :class:`~.components.SimulationComponent` ABC. New simulation components subclassed appropriately are automatically discoverable by the :class:`~.Simulator` class. A MWE for subclassing new components is as follows:
@component class Component: pass class Model(Component): ...
The
Component
base class tracks any models subclassed from it and makes it discoverable to the :class:`~.Simulator`.
New "season" configuration (called
"debug"
), intended to be used for debugging the :class:`~.Simulator` when making changes that might not be easily tested.- :func:`~.io.chunk_sim_and_save` function from HERA Phase 1 Validation work
- This function allows the user to write a :class:`pyuvdata.UVData` object to disk in chunks of some set number of integrations per file (either specified directly, or specified implicitly by providing a list of reference files). This is very useful for taking a large simulation and writing it to disk in a way that mimics how the correlator writes files to disk.
Ability to generate noise visibilities based on autocorrelations from the data. This is achieved by providing a value for the
autovis
parameter in thethermal_noise
function (see :class:`~.noise.ThermalNoise`).The :func:`~.sigchain.vary_gains_in_time` provides an interface for taking a gain spectrum and applying time variation (linear, sinusoidal, or noiselike) to any of the reflection coefficient parameters (amplitude, phase, or delay).
The :class:`~.sigchain.CrossCouplingSpectrum` provides an interface for generating multiple realizations of the cross-coupling systematic spaced logarithmically in amplitude and linearly in delay. This is ported over from the Validation work.
- The reionization signal produced by
eor.noiselike_eor
is now guaranteed to be real-valued for autocorrelations (although the statistics of the EoR signal for the autocorrelations still need to be investigated for correctness).
- API BREAKING CHANGES
All functions that take frequencies and LSTs as arguments have had their signatures changed to
func(lsts, freqs, *args, **kwargs)
.Functions that employ :func:`~.utils.rough_fringe_filter` or :func:`~.utils.rough_delay_filter` as part of the visibility calculation now have parameters
delay_filter_kwargs
and/orfringe_filter_kwargs
, which are dictionaries that are ultimately passed to the filtering functions.foregrounds.diffuse_foreground
andeor.noiselike_eor
are both affected by this.Some parameters have been renamed to enable simpler handling of package-wide defaults. Parameters that have been changed are:
filter_type
->delay_filter_type
in :func:`~.utils.gen_delay_filter`filter_type
->fringe_filter_type
in :func:`~.utils.gen_fringe_filter`chance
->impulse_chance
inrfi_impulse
(see :class:`~.rfi.Impulse`)strength
->impulse_strength
inrfi_impulse
(see :class:`~.rfi.Impulse`)- Similar changes were made in
rfi_dtv
(:class:`~.rfi.DTV`) andrfi_scatter
(:class:`~.rfi.Scatter`).
Any occurrence of the parameter
fqs
has been replaced withfreqs
.The
noise.jy2T
function was moved to :mod:`~.utils` and renamed. See :func:`~.utils.jansky_to_kelvin`.The parameter
fq0
has been renamed tof0
in :class:`~.rfi.RfiStation`.The
_listify
function has been moved from :mod:`~.rfi` to :mod:`~.utils`.sigchain.HERA_NRAO_BANDPASS
no longer exists in the code, but may be loaded from the fileHERA_H1C_BANDPASS.npy
in thedata
directory.
- Other Changes
The :class:`~.Simulator` has undergone many changes that make the class much easier to use, while also providing a handful of extra features. The new :class:`~.Simulator` provides the following features:
- A universal :meth:`~.Simulator.add` method for applying any of the effects
implemented in
hera_sim
, as well as any custom effects defined by the user. - A :meth:`~.Simulator.get` method that retrieves any previously simulated effect.
- The option to apply a simulated effect to only a subset of antennas, baselines,
and/or polarizations, accessed through using the
vis_filter
parameter. - Multiple modes of seeding the random state to achieve a higher degree of realism than previously available.
- The :meth:`~.Simulator.calculate_filters` method pre-calculates the fringe-rate and delay filters for the entire array and caches the result. This provides a marginal-to-modest speedup for small arrays, but can provide a significant speedup for very large arrays. Benchmarking results TBD.
- An instance of the :class:`~.Simulator` may be generated with an empty call to the class if any of the season defaults are active (or if the user has provided some other sufficiently complete set of default settings).
- Some of the methods for interacting with the underlying :class:`pyuvdata.UVData`
object have been exposed to the :class:`~.Simulator` (e.g.
get_data
). - An easy reference to the :func:`~.io.chunk_sim_and_save` function.
- A universal :meth:`~.Simulator.add` method for applying any of the effects
implemented in
:mod:`~.foregrounds`, :mod:`~.eor`, :mod:`~.noise`, :mod:`~.rfi`, :mod:`~.antpos`, and :mod:`~.sigchain` have been modified to implement the features using callable classes. The old functions still exist for backwards-compatibility, but moving forward any additions to visibility or systematics simulators should be implemented using callable classes and be appropriately subclassed from :class:`~.components.SimulationComponent`.
:func:`~.io.empty_uvdata` has had almost all of its parameter values set to default as
None
. Additionally, then_freq
,n_times
,antennas
parameters are being deprecated and will be removed in a future release.:func:`~.noise.white_noise` is being deprecated. This function has been moved to the utility module and can be found at :func:`~.utils.gen_white_noise`.
- New features added to
vis_cpu
- Analytic beam interpolation
- Instead of gridding the beam and interpolating the grid using splines,
the beam can be interpolated directly by calling its
interp
method. - The user specifies this by passing
use_pixel_beams=False
tovis_cpu
.
- Instead of gridding the beam and interpolating the grid using splines,
the beam can be interpolated directly by calling its
- A simple MPI parallelization scheme
- Simulation scripts may be run using
mpirun/mpiexec
- The user imports
mpi4py
into their script and passesmpi_comm=MPI.COMM_WORLD
to vis_cpu
- Simulation scripts may be run using
- New
PolyBeam
andPerturbedPolyBeam
analytic beams (classes) - Derived from
pyuvsim.Analytic beam
- Based on axisymmetric Chebyshev polynomial fits to the Fagnoni beam.
- PerturbedPolyBeam is capable of expressing a range of non-redundancy effects, including per-beam stretch factors, perturbed sidelobes, and ellipticity/rotation.
- Derived from
- New
- New features added to
- New sub-package
simulators
VisibilitySimulators
class- Provides a common interface to interferometric visibility simulators. Users instantiate one of its subclasses and provide input antenna and sky scenarios.
HealVis
subclass- Provides an interface to the
healvis
visibility simulator.
VisCPU
subclass- Provides an interface to the
viscpu
visibility simulator.
- Provides an interface to the
conversions
module- Not intended to be interfaced with by the end user; it provides useful
coordinate transformations for
VisibilitySimulators
.
- Not intended to be interfaced with by the end user; it provides useful
coordinate transformations for
- New sub-package
- Command-line Interface
- Use anywhere with
hera_sim run [options] INPUT
- Tutorial available on readthedocs
- Use anywhere with
- Enhancement of
run_sim
method ofSimulator
class - Allows for each simulation component to be returned
- Components returned as a list of 2-tuples
(model_name, visibility)
- Components returned by specifying
ret_vis=True
in their kwargs
- Components returned as a list of 2-tuples
- Enhancement of
- Option to seed random number generators for various methods
- Available via the
Simulator.add_
methods by specifying the kwargseed_redundantly=True
- Seeds are stored in
Simulator
object, and may be saved as anpy
file when using theSimulator.write_data
method
- Available via the
- New YAML tag
!antpos
- Allows for antenna layouts to be constructed using
hera_sim.antpos
functions by specifying parameters in config file
- Allows for antenna layouts to be constructed using
- New YAML tag
- Changelog formatting for v0.1.0 entry
- Implementation of
defaults
module - Allows for semantic organization of config files
- Parameters that have the same name take on the same value
- e.g.
std
in variousrfi
functions only has one value, even if it's specified multiple times
- e.g.
- Implementation of
- New module
interpolators
- Classes intended to be interfaced with by end-users:
Tsky
- Provides an interface for generating a sky temperature interpolation object when provided with a
.npz
file and interpolation kwargs.
- Provides an interface for generating a sky temperature interpolation object when provided with a
Beam
,Bandpass
- Provides an interface for generating either a
poly1d
orinterp1d
interpolation object when provided with an appropriate datafile.
- Provides an interface for generating either a
- New module
- New module
defaults
- Provides an interface which allows the user to dynamically adjust default parameter settings for various
hera_sim
functions.
- Provides an interface which allows the user to dynamically adjust default parameter settings for various
- New module
- New module
__yaml_constructors
- Not intended to be interfaced with by the end user; this module just provides a location for defining new YAML tags to be used in conjunction with the
defaults
module features and theSimulator.run_sim
method.
- Not intended to be interfaced with by the end user; this module just provides a location for defining new YAML tags to be used in conjunction with the
- New module
- New directory
config
- Provides a location to store configuration files.
- New directory
- HERA-specific variables had their definitions removed from the codebase.
Objects storing these variables still exist in the codebase, but their
definitions now come from loading in data stored in various new files
added to the
data
directory.
- Initial released version