wodenpy.wodenpy_setup

Methods to write visibilities to uvfits files.

git_helper

Functions to help with git information retrieval

git_helper.get_commandline_output(command_list)[source]

Takes a command line entry separated into list entries, and returns the output from the command line as a string

Parameters:

command_list (list of strings) – list of strings that when combined form a coherent command to input into the command line

Returns:

output – the output result of running the command

Return type:

string

git_helper.make_gitdict()[source]

Makes a dictionary containing key git information about the repo by running specific commands on the command line

Returns:

git_dict – A dictionary containing git information with keywords: describe, date, branch

Return type:

dictionary

git_helper.retrieve_gitdict()[source]

Attempt to recover the git information that was created during pip install. If found, return the git dictionary. If not, return False

Returns:

git_dict – A dictionary containing git information with keywords: describe, date, branch

Return type:

dictionary

run_setup

Functions to parse arguments from the command line, check validity of arguments, and read relevant information from linked files, all for run_woden.py

run_setup.check_args(args: Namespace) Namespace[source]

Check that the combination of arguments parsed will work with the WODEN executable. Attempts to grab information from a metafits file if possible. Should error with helpful messages if a combination that won’t work is attempted by the user

Parameters:

args (argparse.Namespace) – The populated arguments args = parser.parse_args() as returned from the parser given by get_parser()

Returns:

args – The populated arguments which will now have been checked and had information from metafits incorporated if requested

Return type:

argparse.Namespace

run_setup.get_antenna_order(tilenames: ndarray) ndarray[source]

Reorder the antennas to be consistent with hyperdrive. This is done by reordering off the tiles names tilenames from the metafits, rather than the index in the metafits. As there are two polarisations per tile, be careful to reorder both pols correctly.

Parameters:

tilenames (np.ndarray) – As read in from the hdus[1].data[‘Tile’] from the metafits

Returns:

Indexes to reorder the antennas

Return type:

np.ndarray

run_setup.get_code_version()[source]

Returns either the git hash if installed via a git repo, or the __version__ if installed from a release

Returns:

version – Either the git commit or release version

Return type:

string

run_setup.get_enh_from_measurement_set(args: Namespace) Tuple[ndarray, ndarray, ndarray, ndarray][source]

Get the antenna positions and names in ENH coordinates from a measurement set.

Runs worker_get_enh_from_measurement_set() in a separate process to avoid python-casacore clashing with WODEN-built libuse_everybeam.so. See worker_get_enh_from_measurement_set() for more details.

Parameters:

args (argparse.Namespace) – The populated arguments args = parser.parse_args() as returned from the parser given by get_parser()

Returns:

  • east (np.ndarray) – The east coordinates of the antennas in ENH coordinates

  • north (np.ndarray) – The north coordinates of the antennas in ENH coordinates

  • height (np.ndarray) – The height coordinates of the antennas in ENH coordinates

  • ant_names (np.ndarray) – The names of the antennas in the measurement set

run_setup.get_observation_info_from_measurement_set(args: Namespace) Tuple[str, float, int, float, float, float, float, float, float][source]

Get the observation information from a measurement set.

Runs worker_get_observation_info_from_measurement_set() in a separate process to avoid python-casacore clashing with WODEN-built libuse_everybeam.so. See worker_get_observation_info_from_measurement_set() for more details.

Parameters:

args (argparse.Namespace) – The populated arguments args = parser.parse_args() as returned from the parser given by get_parser()

Returns:

  • date (str) – The date of the observation in YYYY-MM-DDThh:mm:ss format

  • time_res (float) – The time resolution of the observation in seconds

  • num_time_steps (int) – The number of time steps in the observation

  • freq_res (float) – The frequency resolution of the observation in Hz

  • lowest_channel_freq (float) – The frequency of the lowest channel in Hz

  • highest_channel_freq (float) – The frequency of the highest channel in Hz

  • b_width (float) – The bandwidth of the observation in Hz

  • ra0 (float) – The RA of the phase centre in degrees

  • dec0 (float) – The Dec of the phase centre in degrees

run_setup.get_parser()[source]

Runs the argument parser to get command line inputs - used by sphinx and argparse extension to unpack the help below into the online readthedocs documentation.

Returns:

parser – The populated argument parser used by run_woden.py

Return type:

argparse.ArgumentParser

run_setup.select_argument_and_check(parser_arg: bool, parser_value: bool, metafits_arg: bool, parser_string: str, do_exit: bool = True)[source]

Some arguments taken from the argparse.parser should override settings from the metafits if present. If the parser argument parser_arg is defined (i.e. not False), update it to equal parser_value. If not defined, update parser_arg to metafits_arg, which is the value read in from the metafits file. If both parser_arg and metafits_arg are False, WODEN will fail, so exit with a message. Use parser_string to define which parser arguement has failed; this will be included in the error message.

Parameters:
  • parser_arg (attribute of argparse.Namespace) – The option in args to update

  • parser_value (Expected type for parser_arg) – The value to set parser_arg to (e.g. float(parser_arg))

  • metafits_arg (Expected type for parser_arg) – The value read in from the metafits if using metafits; False if not

  • parser_string (string) – The parser option under test to be written out in the error message, e.g. “–MWA_FEE_delays”

  • do_exit (Boolean) – Whether to call sys.exit upon both parser_arg and metafits_arg being False. Defaults to True

Returns:

parser_arg – The update option in args

Return type:

attribute of argparse.Namespace

run_setup.select_correct_enh(args)[source]

Depending on whether we are reading the array layout from the metafits file or a text file, read in the correct amount of east,north,height coords. Sets args.east, args.north, args.height, args.num_antennas, and args.array_layout_name.

Parameters:

args (argparse.Namespace) – The populated arguments args = parser.parse_args() as returned from the parser given by get_parser()

run_setup.worker_get_enh_from_measurement_set(args: Namespace, q: Queue)[source]

Worker function to get the antenna positions in ENH coordinates from a measurement set. This is done in a separate process because it uses python-casacore. Running import casacore creates a c++ state with a number of library paths and casacore global variables. If libuse_everybeam.so has been built with against a different casacore library, this causes epic intermittent errors and segfaults. To void this, run the import in this separate thread process, which isolates the state of the c++ library.

TODO: All calls to python-casacore should be done via direct calls to casacore in c++ in libuse_everybeam.so. This removes all conflicts; however, this is a large task and will take time to implement. For now, this is a workaround to avoid the segfaults and errors.

Parameters:
  • args (argparse.Namespace) – The populated arguments args = parser.parse_args() as returned from the parser given by get_parser()

  • q (multiprocessing.Queue) – The queue to put the results in. Places arrays of east, north, height and ant_names in the queue.

run_setup.worker_get_observation_info_from_measurement_set(args: Namespace, q: Queue)[source]

Worker function to get the observation information from a measurement set.

This is done in a separate process because it uses python-casacore. Running import casacore creates a c++ state with a number of library paths and casacore global variables. If libuse_everybeam.so has been built with against a different casacore library, this causes epic intermittent errors and segfaults. To void this, run the import in this separate thread process, which isolates the state of the c++ library.

TODO: All calls to python-casacore should be done via direct calls to casacore in c++ in libuse_everybeam.so. This removes all conflicts; however, this is a large task and will take time to implement. For now, this is a workaround to avoid the segfaults and errors.

Parameters:
  • args (argparse.Namespace) – The populated arguments args = parser.parse_args() as returned from the parser given by get_parser()

  • q (multiprocessing.Queue) – The queue to put the results in. Places arrays of date, time_res, num_time_steps, freq_res, lowest_channel_freq, highest_channel_freq, b_width, ra0, and dec0 in the queue.