Running hera-sim-vis from the command line¶
As of v2.4.0 of hera_sim, we have included a command-line interface for performing
visibility simulations using any compatible visiblity simulator. The interface for the
script is (this can be run from anywhere if hera_sim is installed):
$ hera-sim-vis.py --help
/home/docs/checkouts/readthedocs.org/user_builds/hera-sim/envs/latest/lib/python3.14/site-packages/pyuvdata/analytic_beam.py:174: UserWarning: basis_vector_type was not defined, defaulting to azimuth and zenith_angle.
warnings.warn(
Two main configuration files are required. The first is an “obsparam” file, which should
follow the formatting defined by pyuvsim.
As described in the visibility simulator tutorial, the hera_sim.visibilities
module provides a universal interface between this particular configuration setup and a number of
particular simulators.
To specify the simulator to be used, the second configuration file must be provided.
An example of this configuration file, defined for the VisCPU simulator, can be
found in the repo’s config_examples
directory. Here are its contents:
$ cat -n ../config_examples/simulator.yaml
1 simulator: MatVis
2 precision: 2
Notice that the file contains a simulator: entry. This must be the name of a simulator
derived from the base VisibilitySimulator class provided in hera_sim.
Usually, this will be one of the built-in simulators listed in the
API reference under “Built-In Simulators”.
However, it may also be a custom simulator, defined outside of hera_sim, so long as
it inherits from VisibilitySimulator. To use one of these via command line, you
need to provide the dot-path to the class, so for example: my_library.module.MySimulator.
The remaining parameters are passed to the constructor for the given simulator. So, for
example, for the VisCPU simulator, all available parameters are listed under the
Parameters section
of its class API. In general, the class may do some transformation of the YAML inputs
before constructing its instance, using the from_yaml_dict() method. Check out the
documentation for that method for your particular simulator to check if it requires any
transformations (eg. if it required data loaded from a file, it might take the filename
from the YAML, and read the file in its from_yaml_dict() method before constructing
the object with the full data).