domainxy#
- class arte.types.domainxy.DomainXY(xcoord_vector, ycoord_vector)#
Bases:
objectHolds information about a 2d domain
For users of the old IDL make_xy, this is the same in class form. Several initializers are provided to build a domain from different data.
Domains support astropy units and try to play nicely with them. For example, the
shift()method will shift a domain using the correct unit if both the domain and the shift parameter has one. If not, everything is converted to unitless, shifted, and then the unit is applied again. Shapes and indexes in Python are strictly integer data type and cannot use a unit.Domains can be compared with == and !=, but no ordering is defined between them.
In addition to the access methods, domain data can be Since the domain sampling is regular, the class internally only stores two linear vectors for the X and Y sampling. Everything else is dynamically calculated on the fly from these vectors.
- Attributes:
extent[xmin, xmax, ymin, ymax] = minimum and maximum coordinates
origin(x,y) = indexes of 0,0 coordinate, interpolated
origin_in_px(x,y) = indexes of 0,0 coordinate, interpolated
radial_map(r, angle [radians]) 2d map
shape(y,x) domain shape
step(dx,dy) = pixel size
unit(x,y) = units used on X and Y, or 1 otherwise
xcoordX coordinates vector
xmapX coordinates 2d map
ycoordY coordinates vector
ymapY coordinates 2d map
Methods
boundingbox(x, y[, span])Returns a new domain around the specified point
contains(x, y)Returns True if the coordinates are inside the domain
cropped(xmin, xmax, ymin, ymax)Returns a new cropped DomainXY object
from_extent(xmin, xmax, ymin, ymax, npoints)Build a domain from a bounding box
from_linspace(*args, **kwargs)Cartesian product of two identical np.linspace().
from_makexy(*args, **kwargs)Same arguments as make_xy
from_shape(shape[, pixel_size])Build a domain from a shape and a pixel size
from_xy_maps(xmap, ymap)Build a domain from two 2d maps (like the ones from make_xy)
from_xy_vectors(x_vector, y_vector)Build a domain as a cartesian product of two coordinate vectors
get_boundingbox_slice(x, y[, span])Slice that includes (x,y) with "span" pixels around
get_crop_slice(xmin, xmax, ymin, ymax)Slice to crop the domain
help([search, prefix])Interactive help
restrict(x, y)(x,y) = new coordinates restricted to be inside this domain
shift(dx, dy)Shift the domain in place
shifted(dx, dy)Returns a new shifted domain
- boundingbox(x, y, span=1)#
Returns a new domain around the specified point
- contains(x, y)#
Returns True if the coordinates are inside the domain
- cropped(xmin, xmax, ymin, ymax)#
Returns a new cropped DomainXY object
- property extent#
[xmin, xmax, ymin, ymax] = minimum and maximum coordinates
- classmethod from_extent(xmin, xmax, ymin, ymax, npoints)#
Build a domain from a bounding box
- classmethod from_linspace(*args, **kwargs)#
Cartesian product of two identical np.linspace(). Same arguments
- classmethod from_makexy(*args, **kwargs)#
Same arguments as make_xy
- classmethod from_shape(shape, pixel_size=1)#
Build a domain from a shape and a pixel size
- classmethod from_xy_maps(xmap, ymap)#
Build a domain from two 2d maps (like the ones from make_xy)
- classmethod from_xy_vectors(x_vector, y_vector)#
Build a domain as a cartesian product of two coordinate vectors
- get_boundingbox_slice(x, y, span=1)#
Slice that includes (x,y) with “span” pixels around
- get_crop_slice(xmin, xmax, ymin, ymax)#
Slice to crop the domain
- help(search='', prefix='')#
Interactive help
Prints on stdout a list of methods that match the search substring or all of them if search is left to the default value of an empty string, together with a one-line help taken from the first line of their docstring, if any.
The prefix argument is prepended to the method name and is used for recursive help of every class member.
- property origin#
(x,y) = indexes of 0,0 coordinate, interpolated
- property origin_in_px#
(x,y) = indexes of 0,0 coordinate, interpolated
- property radial_map#
(r, angle [radians]) 2d map
- restrict(x, y)#
(x,y) = new coordinates restricted to be inside this domain
- property shape#
(y,x) domain shape
- shift(dx, dy)#
Shift the domain in place
- shifted(dx, dy)#
Returns a new shifted domain
- property step#
(dx,dy) = pixel size
- property unit#
(x,y) = units used on X and Y, or 1 otherwise
- property xcoord#
X coordinates vector
- property xmap#
X coordinates 2d map
- property ycoord#
Y coordinates vector
- property ymap#
Y coordinates 2d map