# Simutil.py

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The python utility is called simutil.py, and is located in a scripts directory of your installation.

```CASA <> execfile(".../simutil.py")
CASA <> util=simutil()
CASA <> util<TAB>
```

Methods:

simutil.average_direction(directions)
Returns the average of directions as a string, and relative offsets
simutil.calc_pointings(spacing, imsize, cell, direction=None, relmargin=0.5)
If direction is a list, simply returns direction and the number of pointings in it. Otherwise, returns a hexagonally packed list of pointings separated by spacing and fitting inside an image specified by direction, imsize and cell, and the number of pointings. The hexagonal packing starts with a horizontal row centered on direction, and the other rows alternate being horizontally offset by a half spacing. All of the pointings will be within a rectangle relmargin * spacing smaller than the image on all sides.
simutil.ephemeris(date, direction=None, telescope=None)
calculate the elevation of a source on a date, in a direction, seen from a telescope
simutil.irtf2loc(x, y, z, cx, cy, cz)
convert ITRF earth-centered xyz coordinates to offsets in the local tangent plane offsets from the center of the array cx,cy,cx
simutil.locxyz2itrf(latitude, longitude, locx=0.0, locy=0.0, locz=0.0)
Returns the nominal ITRF (X, Y, Z) coordinates (m) for a point at "local" (x, y, z) (m) measured at geodetic latitude lat and longitude longitude (degrees). The ITRF frame used is not the official ITRF, just a right handed Cartesian system with X going through 0 latitude and 0 longitude, and Z going through the north pole. The "local" (x, y, z) are measured relative to the closest point to (lat, longitude) on the WGS84 reference ellipsoid, with z normal to the ellipsoid and y pointing north.
simutil.long2xyz(long, lat, elevation, datum)
convert geodetic longitude latitude, and elevation (relative to the geoid of specified datum) to earth-centered x,y,z
simutil.xyz2long(x, y, z, datum)
convert earth-centered x,y,z to geodetic latitude and longitude
simutil.utm2xyz(easting, northing, elevation, zone, datum, nors)
convert UTM coordinates to x,y,z earth-centered
simutil.utm2long(east, north, zone, datum, nors)
convert universal transverse meractor coordinates to geodetic longitude/latitude (see help simutil.utm2long for more details
read an antenna configuration file (and perform necessary geodetic conversions)
simutil.noisetemp(telescope=None, freq=None, diam=None, epsilon=None)
look up receiver temperature, antenna efficiencies, etc for known telescopes
simutil.plotants(x, y, z, d, name)
a prettier plotants than CASA native, including antenna diameter and pad name (e.g. for compact arrays, the antennas will be plotted with actual sizes to scale)
simutil.statim(image, plot=True, incell=None)
plot image and return and overplot statistics

For more detailed examples, find the python script for the simdata task, which is a file called task_simdata.py in your distribution.