Utility

rascil.processing_components.util.array_functions Module

Useful array functions.

Functions

average_chunks(arr, wts, chunksize)

Average the array arr with weights by chunks

average_chunks2(arr, wts, chunksize)

Average the two dimensional array arr with weights by chunks

tukey_filter(x, r)

Calculate the Tukey (tapered cosine) filter

insert_array(im, x, y, flux[, bandwidth, ...])

Insert point into image using specified function

insert_function_L(x[, a])

Insertion with Lanczos function

insert_function_pswf(x[, a])

Insertion with PSWF

insert_function_sinc(x)

Insertion with Sinc function

rascil.processing_components.util.compass_bearing Module

Functions

calculate_initial_compass_bearing(pointA, pointB)

Calculates the bearing between two points.

rascil.processing_components.util.coordinate_support Module

Coordinate support

We follow the casa definition of coordinate systems http://casa.nrao.edu/Memos/CoordConvention.pdf :

UVW is a right-handed coordinate system, with W pointing towards the source, and a baseline convention of \(ant2 - ant1\) where \(index(ant1) < index(ant2)\). Consider an XYZ Celestial coordinate system centered at the location of the interferometer, with \(X\) towards the East, \(Z\) towards the NCP and \(Y\) to complete a right-handed system. The UVW coordinate system is then defined by the hour-angle and declination of the phase-reference direction such that

  1. when the direction of observation is the NCP (ha=0,dec=90), the UVW coordinates are aligned with XYZ,

  2. V, W and the NCP are always on a Great circle,

  3. when W is on the local meridian, U points East

  4. when the direction of observation is at zero declination, an hour-angle of -6 hours makes W point due East.

The \((l,m,n)\) coordinates are parallel to \((u,v,w)\) such that \(l\) increases with Right-Ascension (or increasing longitude coordinate), \(m\) increases with Declination, and \(n\) is towards the source. With this convention, images will have Right Ascension increasing from Right to Left, and Declination increasing from Bottom to Top.

Functions

xyz_at_latitude(local_xyz, lat)

Rotate local XYZ coordinates into celestial XYZ coordinates.

xyz_to_baselines(ants_xyz, ha_range, dec)

Calculate baselines in \((u,v,w)\) co-ordinate system for a range of hour angles (i.e.

xyz_to_uvw(xyz, ha, dec)

Rotate \((x,y,z)\) positions in earth coordinates to \((u,v,w)\) coordinates relative to astronomical source position \((ha, dec)\).

uvw_to_xyz(uvw, ha, dec)

Rotate \((x,y,z)\) positions relative to a sky position at \((ha, dec)\) to earth coordinates.

uvw_transform(uvw, transform_matrix)

Transforms UVW baseline coordinates such that the image is transformed with the given matrix.

simulate_point(dist_uvw, l, m)

Simulate visibilities for unit amplitude point source at direction cosines (l,m) relative to the phase centre.

skycoord_to_lmn(pos, phasecentre)

Convert astropy sky coordinates into the l,m,n coordinate system relative to a phase centre.

lmn_to_skycoord(lmn, phasecentre)

Convert l,m,n coordinate system + phascentre to astropy sky coordinate relative to a phase centre.

visibility_shift(uvw, vis, dl, dm)

Shift visibilities by the given image-space distance.

azel_to_hadec(az, el, latitude)

Converting Az El to HA Dec

hadec_to_azel(ha, dec, latitude)

Convert HA Dec to Az El

baselines(ants_uvw)

Compute baselines in uvw co-ordinate system from uvw co-ordinate system station positions

pa_z(ha, dec, lat)

Calculate parallactic angle and zenith angle of source at ha, dec observed from site at latitude dec

parallactic_angle(ha, dec, lat)

Calculate parallactic angle of source at ha, dec observed from site at latitude dec

enu_to_xyz(e, n, u, lat)

Convert ENU to XYZ coordinates.

lla_to_ecef(lat, lon, alt)

Convert WGS84 spherical coordinates to ECEF cartesian coordinates.

ecef_to_lla(x, y, z)

Convert earth-centered, earth-fixed coordinates to (rad), longitude (rad), elevation (m) using Bowring's method.

enu_to_ecef(location, enu)

Convert ENU coordinates relative to reference location to ECEF coordinates.

ecef_to_enu(location, xyz)

Convert ECEF coordinates to ENU coordinates relative to reference location.

eci_to_uvw(xyz, ha, dec)

Rotate \((x,y,z)\) positions in earth coordinates to \((u,v,w)\) coordinates relative to astronomical source position \((ha, dec)\).

uvw_to_eci(uvw, ha, dec)

Rotate \((x,y,z)\) positions relative to a sky position at \((ha, dec)\) to earth coordinates.

eci_to_enu(eci, lat)

Converts a baseline in earth-centered inertial coordinates [x, y, z] to [east, north, elevation] for that baseline.

enu_to_eci(enu, lat)

Converts a baseline in [east, north, elevation] to earth-centered inertial coordinates for that baseline [x, y, z].

rascil.processing_components.util.geometry Module

geometry

Functions

calculate_transit_time(location, utc_time, ...)

Find the UTC time of the nearest transit

calculate_hourangles(location, utc_time, ...)

Return hour angles for location, utc_time, and direction

calculate_parallactic_angles(location, ...)

Return hour angles for location, utc_time, and direction

calculate_azel(location, utc_time, direction)

Return az el for a location, utc_time, and direction

utc_to_ms_epoch(ts)

Convert an timestamp to seconds (epoch values)

rascil.processing_components.util.installation_checks Module

Function to check the installation

Functions

check_data_directory([verbose, fatal])

Check the RASCIL data directory to see if it has been installed correctly

rascil.processing_components.util.sizeof Module

From https://goshippo.com/blog/measure-real-size-any-python-object/

Functions

get_size(obj)

Return size of object in bytes

rascil.processing_components.util.performance Module

Functions for monitoring performance

These functions can be used to write various configuration and performance information to JSON files for subsequent analysis. These are intended to be used by apps such as rascil-imager:

parser = cli_parser()
args = parser.parse_args()
performance_environment(args.performance_file, mode="w")
performance_store_dict(args.performance_file, "cli_args", vars(args), mode="a")
performance_store_dict(args.performance_file, "dask_profile", dask_info, mode="a")
performance_dask_configuration(args.performance_file, mode='a')

Functions

git_hash()

Get the hash for this git repository.

performance_store_dict(performance_file, key, s)

Store dictionary in a file using json

performance_qa_image(performance_file, key, im)

Store image qa in a performance file

performance_dask_configuration(...[, ...])

Get selected Dask configuration info and write to performance file

performance_read(performance_file)

Read the performance file

performance_visibility(bvis)

Get info about the visibility

performance_environment(performance_file[, ...])

Write the current processing environment to JSON file

performance_read_memory_data(memory_file)

Get the memusage data.

performance_merge_memory(performance, mem)

Merge memory data per function into performance data