producer.allocate module¶
Allocate apertures to targets.
Contains code originally written by 2021 Akamai intern, Brittany Ann Ramos.
- producer.allocate.assign_apertures(objx, objy, apx, apy, collision=0.16666666666666666, patrol=2.3, ignore_obj=None, ignore_ap=None, allocated_obj=None, allocated_ap=None)[source]¶
Assign free apertures to objects.
Coordinate units must be the same for all arguments. I.e., if the object and aperture coordinates are in arcmin, the collision and patrol radii must be also.
To avoid collisions with previously allocated objects, use
allocated_obj. Providingallocated_apjust removes these apertures from consideration; i.e., the information of where the apertures are located in the field is associated withallocated_obj, notallocated_ap. Providing one does not mean you have to provide the other.Objects and apertures can also be ignored using
ignore_objandignore_fib. Ignored objects/apertures are not considered during assignment. These arguments are largely provided as book-keeping convenience; i.e., the returned indices are based on the full input arrays instead of a preselected subset passed to this function.- Parameters
objx (numpy.ndarray) – Cartesian x coordinate in tangent plane projection of object coordinates relative to the pointing center. Shape must be 1D and match
objy.objy (numpy.ndarray) – Cartesian y coordinate in tangent plane projection of object coordinates relative to the pointing center. Shape must be 1D and match
objx.apx (numpy.ndarray) – Cartesian x coordinate in tangent plane projection of the “home” aperture coordinates relative to the pointing center. Shape must be 1D and match
apy.apy (numpy.ndarray) – Cartesian y coordinate in tangent plane projection of the “home” aperture coordinates relative to the pointing center. Shape must be 1D and match
apx.collision (
float, optional) – Aperture-to-aperture collision radius.patrol (
float, optional) – Aperture patrol radius.ignore_obj (numpy.ndarray, optional) – An integer array with the indices of objects to ignore during assignment. If None, all objects are included in assignment attempt.
ignore_ap (numpy.ndarray, optional) – An integer array with the indices of apertures to ignore during assignment. If None, all apertures are included in assignment attempt.
allocated_obj (numpy.ndarray, optional) – An integer array with the indices of objects that have already been allocated to targets in the field, as needed to avoid collisions.
allocated_ap (numpy.ndarray, optional) – An integer array with the indices of apertures that have already been allocated to targets in the field. This is only used in book-keeping; i.e., allocated apertures cannot be reassigned and the returned assignment indices will match the indices of the provided
apxandapyvectors.
- Returns
Two numpy.ndarray objects with the indices of the objects that have been assigned apertures, and the indices of the associated apertures.
- Return type
tuple
- producer.allocate.assign_apertures_plot(objx, objy, apx, apy, assigned_obj, assigned_ap, collision=0.16666666666666666, ignore_obj=None, ignore_ap=None, zoom=0.75)[source]¶
Show a plot of the aperture assignments. I.e.:
assigned_obj, assigned_ap = assign_apertures(objx, objy, apx, apy) assign_apertures_plot(objx, objy, apx, apy, assigned_obj, assigned_ap)
- Parameters
objx (numpy.ndarray) – Cartesian x coordinate in tangent plane projection of object coordinates relative to the pointing center. Shape must be 1D and match
objy.objy (numpy.ndarray) – Cartesian y coordinate in tangent plane projection of object coordinates relative to the pointing center. Shape must be 1D and match
objx.apx (numpy.ndarray) – Cartesian x coordinate in tangent plane projection of the “home” aperture coordinates relative to the pointing center. Shape must be 1D and match
apy.apy (numpy.ndarray) – Cartesian y coordinate in tangent plane projection of the “home” aperture coordinates relative to the pointing center. Shape must be 1D and match
apx.assigned_obj (numpy.ndarray) – Indices of the objects with assigned apertures. This is the first object returned by
assign_apertures().assigned_ap (numpy.ndarray) – Indices of the apertures assigned to objects. This is the second object returned by
assign_apertures().collision (
float, optional) – Aperture-to-aperture collision radius.ignore_obj (numpy.ndarray, optional) – An integer array with the indices of objects that were ignored during assignment. If None, all objects were included in the assignment attempt.
ignore_ap (numpy.ndarray, optional) – An integer array with the indices of apertures that were ignored during assignment. If None, all apertures were included in the assignment attempt.
zoom (
float, optional) – Factor to zoom in default limits of the plot relative to the nominal set by the extent of the allocated targets. For example,zoom=2means to decrease the plot range by a factor of two; to zoom out, use a zoom value that is less than 1.