Layout#
- class radiotools.layouts.Layout[source]#
Bases:
objectA tool to convert radio telescope array layout config files between different types.
Methods Summary
Returns a copy of the current layout in absolute coordinates.
as_relative(rel_to_site)Returns a copy of the current layout in relative coordinates.
display()Prints all information contained in the layout
from_casa(cfg_path[, el_low, el_high, sefd, ...])Import a layout from a NRAO CASA layout config.
from_dataframe(df[, rel_to_site])Import a layout from a given pandas DataFrame.
from_measurement_set(root_path, sefd[, ...])from_pyvisgen(cfg_path[, rel_to_site])Import a layout from a radionets pyvisgen layout config.
from_url(url[, rel_to_site])Import a layout from a given URL.
from_uv_fits(path, sefd[, el_low, el_high, ...])get_baseline_vecs([include_conjugates])Returns an array containing the vectors of the baselines.
Returns an array containing the lengths of unique baselines in meters.
Returns the layout data as a
pandas.DataFrame.get_max_resolution(frequency)Returns the maximal resolution of the layout at a given frequency in arcsec / px.
get_station(name)Returns all information about the station with the given name as a pandas.Series.
get_station_combinations([geodetic])Returns a list of combinations of antenna positions in geodetic coordinates.
Whether the current positions are relative to a specific site.
plot([save_to_file, annotate, limits, ...])Generates a plot of the arrangement of the layout.
plot_uv([save_to_file, ref_frequency, ...])Plots the uv-sampling (uv-plane) of the array.
save(path[, fmt, overwrite, rel_to_site])Saves the layout to a layout file.
Methods Documentation
- as_absolute()[source]#
Returns a copy of the current layout in absolute coordinates. Requires the layout to be in relative coordinates.
- as_relative(rel_to_site) Layout[source]#
Returns a copy of the current layout in relative coordinates.
- Parameters:
- rel_to_sitestr
The name of the site the coordinates are supposed to be relative to. Has to be an existing site for
astropy.coordinates.EarthLocation.of_site().
- classmethod from_casa(cfg_path, el_low=15, el_high=85, sefd=0, altitude=0, rel_to_site=None)[source]#
Import a layout from a NRAO CASA layout config.
- Parameters:
- cfg_pathstr
The path of the config file to import.
- el_lowfloat or array_like, optional
The minimal elevation in degrees the telescope can be adjusted to. If provided as singular number all telescopes in the array will be assigned the same value.
- el_highfloat or array_like, optional
The maximal elevation in degrees the telescope can be adjusted to. If provided as singular number all telescopes in the array will be assigned the same value.
- sefdfloat or array_like, optional
The system equivalent flux density of the telescope. If provided as singular number all telescopes in the array will be assigned the same value.
- altitudefloat or array_like, optional
The altitude of the telescope. If provided as singular number all telescopes in the array will be assigned the same value.
- rel_to_sitestr, optional
The name of the site the coordinates are relative to. Is ignored if None or empty. Has to be an existing site for
astropy.coordinates.EarthLocation.of_site().
- classmethod from_dataframe(df: DataFrame, rel_to_site: str | None = None)[source]#
Import a layout from a given pandas DataFrame.
- Parameters:
- dfpandas.DataFrame
DateFrame containing the layout.
- rel_to_sitestr, optional
The name of the site the coordinates are relative to. Is ignored is None or empty or fmt. Has to be an existing site for astropy.coordinates.EarthLocation.of_site(). Default: None
- classmethod from_measurement_set(root_path: str | PathLike, sefd: float | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], el_low: float | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = 0.0, el_high: float | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = 90.0, rel_to_site: str | None = None)[source]#
- classmethod from_pyvisgen(cfg_path, rel_to_site=None)[source]#
Import a layout from a radionets pyvisgen layout config.
- Parameters:
- cfg_pathstr
The path of the config file to import.
- rel_to_sitestr, optional
The name of the site the coordinates are relative to. Is ignored if None or empty. Has to be an existing site for
astropy.coordinates.EarthLocation.of_site().
- classmethod from_url(url: str, rel_to_site: str | None = None) Layout[source]#
Import a layout from a given URL.
- Parameters:
- urlstr
URL of the layout file.
- rel_to_sitestr, optional
The name of the site the coordinates are relative to. Is ignored if None or empty. Has to be an existing site for
astropy.coordinates.EarthLocation.of_site()Default: None
- classmethod from_uv_fits(path: str | PathLike, sefd: float | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], el_low: float | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = 0.0, el_high: float | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = 90.0, dish_dia: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, rel_to_site: str | None = None)[source]#
- get_antenna_positions() EarthLocation[source]#
- get_baseline_vecs(include_conjugates: bool = True) ndarray[source]#
Returns an array containing the vectors of the baselines.
- Parameters:
- include_conjugatesbool, optional
Whether to include the conjugate baselines. Default is
True.
- Returns:
- numpy.ndarrayThe baseline vectors.
- get_baselines() ndarray[source]#
Returns an array containing the lengths of unique baselines in meters.
- Returns:
- numpy.ndarrayThe lengths of the baselines.
- get_dataframe()[source]#
Returns the layout data as a
pandas.DataFrame.
- get_max_resolution(frequency)[source]#
Returns the maximal resolution of the layout at a given frequency in arcsec / px.
- Parameters:
- frequencyfloat or array_like
The frequency at which the array is observing
- get_station(name)[source]#
Returns all information about the station with the given name as a pandas.Series.
- Parameters:
- namestr
The name of the station (antenna). This is case sensitive!
- Returns:
- pd.Series
Pandas series containing all information about the given station.
- get_station_combinations(geodetic: bool = True) GeodeticLocation | EarthLocation[source]#
Returns a list of combinations of antenna positions in geodetic coordinates. This can be used to construct and plot the baseline connection vectors.
- Parameters:
- geodeticbool, optional
Whether to return the values as geodetic coordinates. If set to
False, geocentric coordinates will be returned. Default isTrue.
- Returns:
- astropy.coordinates.earth.GeodeticLocation |
- astropy.coordinates.earth.EarthLocation
A list combinations of the geodetic or geocentric coordinates of the antennas.
- is_relative() bool[source]#
Whether the current positions are relative to a specific site.
- Returns:
- bool
Whether the layout is relative.
- plot(save_to_file='', annotate=False, limits=None, plot_args=None, save_args=None)[source]#
Generates a plot of the arrangement of the layout.
- Parameters:
- save_to_filestr, optional
The name of the file the plot should be saved to.
- annotatebool, optional
Whether to mark the stations with their respective names.
- limitstuple of tuples, optional
The x and y bounds (e.g. ((0,1), (0,1))). Set tuple of one axis (x or y) to None to only limit the other axis.
- plot_argsdict, optional
Arguments to pass to the axis.scatter function
- save_argsdict, optional
Arguments to pass to the figure.savefig function
- plot_uv(save_to_file='', ref_frequency=None, plot_args=None, save_args=None)[source]#
Plots the uv-sampling (uv-plane) of the array.
- Parameters:
- save_to_filestr, optional
The name of the file the plot should be saved to.
- plot_argsdict, optional
Arguments to pass to the axis.scatter function
- save_argsdict, optional
Arguments to pass to the figure.savefig function
- save(path, fmt='pyvisgen', overwrite=False, rel_to_site=None)[source]#
Saves the layout to a layout file.
- Parameters:
- pathstr
The path of the file to save the array layout to.
- fmtstr, optional
The layout format the output file is supposed to have (available: casa, pyvisgen) (default is pyvisgen).
- overwritebool, optional
Whether to overwrite the file if it already exists (default is False).
- rel_to_sitestr, optional
The name of the site the coordinates are supposed to be saved relative to. Is ignored if None or empty or fmt is not set to ‘pyvisgen’. Has to be an existing site for
astropy.coordinates.EarthLocation.of_site().