calculate_axis_extent¶
-
mcalf.utils.plot.
calculate_axis_extent
(resolution, px, offset=0, unit='Mm')[source]¶ Calculate the extent from a resolution value along a particular axis.
- Parameters
resolution (float or astropy.units.quantity.Quantity) – Length of each pixel. Unit defaults to unit is not an astropy quantity.
px (int) – Number of pixels extent is being calculated for.
offset (int or float, default=0) – Number of pixels from the 0 pixel to the first pixel. Defaults to the first pixel being at 0 length units. For example, in a 1000 pixel wide dataset, setting offset to -500 would place the 0 Mm location at the centre.
unit (str, default="Mm") – Default unit string to use if resolution is not an astropy quantity.
- Returns
first (float) – First extent value.
last (float) – Last extent value.
unit (str) – Unit of extent values.