EMBERS: HomeTable of ContentsAPI Reference

API Reference — MWA Utils

embers.mwa_utils is used to download and metadata of the MWA Telescope and compute FEE beam models.

It contains mwa_pointings, mwa_dipoles , mwa_fee

MWA Pointings

Tools to download metadata of the MWA telescope and extract its observational schedule

embers.mwa_utils.mwa_pointings.download_meta(start, stop, num_pages, out_dir, wait)

Download MWA metadata from mwatelescope.org

Parameters:
  • start – start date in isot format YYYY-MM-DDTHH:MM:SS str
  • stop – stop date in isot format YYYY-MM-DDTHH:MM:SS str
  • num_pages – Each page contains 200 observation. Visit ws.mwatelescope.org/metadata/find to find the total number of pages int
  • out_dir – Path to output directory where metadata will be saved str
  • wait – Time to sleep between downloads so as not to overload servers. Default=29
Returns:

MWA metadata json files saved to out_dir

embers.mwa_utils.mwa_pointings.clean_meta_json(out_dir)

Organize json files. Clean up quirks in metadata

Clear up confusion in Andrew Williams’ custom pointing names

Parameters:out_dir – Path to root of directory with json metadata files str
Returns:A tuple (start_gps, stop_gps, obs_length, pointings)
  • start_gps: list of observation start times in gps format
  • stop_gps: list of observation start times in gps format
  • obs_length: list of observation durations in seconds
  • pointings: list of observation pointings
embers.mwa_utils.mwa_pointings.combine_pointings(start_gps, stop_gps, obs_length, pointings, out_dir)

Combine successive observations with same pointing and save to file.

Parameters:
  • start_gpslist of observation start times in gps format
  • stop_gpslist of observation start times in gps format
  • obs_lengthlist of observation durations in seconds
  • pointingslist of observation pointings
  • out_dir – Path to output directory where cleaned data will be saved str
Returns:

mwa_pointing.json saved to out_dir

embers.mwa_utils.mwa_pointings.point_integration(out_dir)

Calculate total integration at each pointing

Parameters:out_dir – Path to directory where mwa_pointings.json is saved
Returns:A tuple
  • pointings : list of MWA pointings
  • int_hours: list of total integration, at each pointing, in hours
embers.mwa_utils.mwa_pointings.pointing_hist(pointings, int_hours, time_thresh, out_dir)

Plot a histogram of pointing integration

Many pointings can have very low total integration, use the time_thresh argument to exclude low integration pointings.

Parameters:
  • pointingslist of MWA pointings
  • int_hourslist of total integration, at each pointing, in hours
  • time_thresh – minimum integration time to be included in histogram, in hours int
  • out_dir – Path to directory where mwa_pointings.json is saved
Returns:

Pointing histogram plot saved to out_dir

embers.mwa_utils.mwa_pointings.rf_obs_times(start_date, stop_date, time_zone)

Generate start & end times of 30 minuts rf observations in local, unix, gps formats

Parameters:
  • start_date – in YYYY-MM-DD format str
  • stop_date – in YYYY-MM-DD format str
  • time_zone – A str representing a pytz timezones.
Returns:

A tuple (obs_time, obs_unix, obs_unix_end, obs_gps, obs_gps_end)

  • obs_time: list of start times of 30 min obs in YYYY-MM-DD-HH:MM format
  • obs_gps: list of start times of 30 min obs in gps format
  • obs_gps_end: list of end times of 30 min obs in gps format

embers.mwa_utils.mwa_pointings.obs_pointings(start, stop, time_zone, out_dir)

Classify the pointing of each rf_obs

Loop over all rf observations within a date interval and determine whether the 30 minute period had more that a 60% majority at a single pointing. If it does, the rf observation is saved to an appropriate list. Save the pointing data to obs_pointings.json in the out_dir.

Parameters:
  • start – in YYYY-MM-DD format str
  • stop – in YYYY-MM-DD format str
  • time_zone

    A str representing a pytz timezones.

  • out_dir – Path to directory where mwa_pointings.json is saved
Returns:

obs_pointings.json saved to out_dir

embers.mwa_utils.mwa_pointings.tile_integration(out_dir, rf_dir)

Calculate total integration at multiple pointings for all tiles

Parameters:
  • out_dir – Path to root of directory where mwa metadata is saved str
  • rf_dir – Path to root of directory with rf data files str
Returns:

A dict with keys being tile_names and values being list of integration hours at pointings 0, 2, 4 & 41

embers.mwa_utils.mwa_pointings.plt_hist_array(tile_ints, out_dir)

A massive grid of histograms with a subplot for pointing integration of each tile.

Parameters:
Returns:

tiles_pointing_integration.png saved to out_dir

embers.mwa_utils.mwa_pointings.mwa_point_meta(start, stop, num_pages, time_thresh, time_zone, rf_dir, out_dir, wait=29)

Download mwa pointing metadata, sort and parse it, and create diagonistic plots,

Parameters:
  • start – start date in isot format YYYY-MM-DDTHH:MM:SS str
  • stop – stop date in isot format YYYY-MM-DDTHH:MM:SS str
  • num_pages

    Each page contains 200 observation. Visit ws.mwatelescope.org/metadata/find to find the total number of pages int

  • time_thresh – minimum integration time to be included in histogram, in hours int
  • time_zone

    A str representing pytz timezones.

  • rf_dir – Path to root of directory with rf data files str
  • out_dir – Path to output directory where metadata will be saved str
  • wait – Time to sleep between downloads so as not to overload servers. Default=29
Returns:

Data products saved to out_dir

MWA Dipoles

Tools to download MWA metafits files and finding dead dipoles

embers.mwa_utils.mwa_dipoles.download_metafits(num_files, wait, out_dir)

Download metafits files from mwatelescope.org

This function requires a list of obsids which it reads from out_dir. Before running functions in this module, run mwa_pointings to created the required obsid files.

Parameters:
  • num_files – The number of metafits files to download. Usually, 20 is sufficent int
  • wait – Time to sleep between downloads so as not to overload servers. Default=29
  • out_dir – Path to output directory where the metafits files will be saved str
Returns:

Metafits files are saved to the out_dir

embers.mwa_utils.mwa_dipoles.find_flags(out_dir)

Read metafits files and determine which dipoles are flagged

Parameters:out_dir – Path to root of output directory where the metafits files are saved str
Returns:A plot of flagged dipoles in each tile
embers.mwa_utils.mwa_dipoles.mwa_flagged_dipoles(num_files, out_dir, wait=29)

Download metafits and find flagged dipoles

Parameters:
  • num_files – The number of metafits files to download. Usually, 20 is sufficent int
  • out_dir – Path to output directory where the metafits files will be saved str
  • wait – Time to sleep between downloads so as not to overload servers. Default=29
Returns:

Metafits files and dipole flagging plot saved to out_dir

MWA FEE

Tool to create XX & YY FEE (Fully Embedded Element) simulated beam maps.

embers.mwa_utils.mwa_fee.local_beam(za, az, freq, delays=None, zenithnorm=True, power=True, jones=False, interp=True, pixels_per_deg=5, amps=None)

Code pulled from mwapy that generates the MWA beam response.

Parameters:
  • za – Zenith angle list of ndarray
  • az – Azimuth angle list of ndarray
  • freq – Frequency in Hertz at which to make the beam model
  • delays – 2x16 array, with the first 16 for XX and second 16 for YY pol. Values match those found in metafits files (1-32) with 1 being normal and 32 being flagged / dead
  • zenithnorm – Normalise zenith power, True by default
  • power – If True, make power beam model
  • jones – If True, make jones beam model
  • interp – If True, interpolate beam to pixels_per_deg
  • pixels_per_deg – Interpolate the beam to this scale, int
  • amps – Amplitudes of individual dipoles, again in a 2x16, with XX first then YY
Returns:

XX and YY beam models. By default Power beams are returned, but Jones matrices are also possible.

embers.mwa_utils.mwa_fee.mwa_fee_model(out_dir, nside, pointings=[0, 2, 4, 41], flags=[])

Create MWA FEE beam models at multiple pointings, with dipoles flagged.

Parameters:
  • out_dir – Path to output directory where beam maps and sample plots will be saved
  • nside – The NSIDE of healpix output map int
  • pointingslist of pointings at which to make beam maps
  • flagslist of dipoles which are to be flagged with values from 1 to 32. 1-16 are dipoles of XX pol while 17-32 are for YY. Ex: flags=[1,17] represents the first dipole of the XX & YY tiles as being flagged and having a amplitude of 0
Returns:

  • A set of images of the beam maps, save to out_dir
  • A savez_compressed() .npz file containing all the fee beam maps