producer.targets module

Allocate apertures to targets.

Contains code originally written by 2021 Akamai intern, Brittany Ann Ramos.

producer.targets.parse_targets(ifile, ra_c=1, dec_c=2, ap_c=None, default_ap=0)[source]

Parse target coordinates and aperture types from an input file.

Parameters
  • ifile (str) – Columnated ascii file with the target coordinates.

  • ra_c (int, optional) – 1-indexed column with the RA coordinates. Assumed to be in decimal degrees.

  • dec_c (int, optional) – 1-indexed column with the declination coordinates. Assumed to be in decimal degrees.

  • ap_c (int, optional) – 1-indexed column with the aperture type to assign to each target. If None, the type is not available in the input file and the default_types is used for all targets. Apertures must be 0 for a single fiber or 1 for an IFU.

  • default_ap (int, optional) – If the aperture types are not provided in the file, this sets the type to assign to all apertures. Apertures must be 0 for a single fiber or 1 for an IFU.

Returns

Three numpy vectors with the coordinates and aperture type for each target.

Return type

tuple

producer.targets.random_targets(r, n=None, density=5.0, rng=None)[source]

Draw a set of random x and y coordinates within a circle.

Parameters
  • r (float) – Radius of the circle.

  • n (int, optional) – The total number of points to draw. If None, number drawn based on the density requested.

  • density (float, optional) – The average density of targets within the circle. This is used to calculate the number of points to generate within the circle: n = int(numpy.ceil(density*numpy.pi*r**2)). Units must be appropriate match radius units.

  • rng (numpy.random.Generator, optional) – Random number generator to use. If None, a new one is instantiated using numpy.random.default_rng.

Returns

Two vectors of length \(N_{\rm targ}\) (the number of targets). Cartesian x coordinates are in the first vector, y coordinates in the second.

Return type

tuple