scopesim.optics.fov_volume_list.FovVolumeList#

class scopesim.optics.fov_volume_list.FovVolumeList(initial_volume=None)#

Bases: MutableSequence

List of FOV volumes for FOVManager.

Units#

x, y[arcsec]

On-sky coordintates relative to centre of FieldOfView

wave[um]

On-sky wavelengths

xd, yd[mm]

Detector plane coordinates relative to centre of ImagePlane

__init__(initial_volume=None)#

Methods

__init__([initial_volume])

append(value)

S.append(value) -- append value to the end of the sequence

clear()

S.clear() -> None -- remove all items from S

count(value)

S.count(value) -> integer -- return number of occurrences of value

extend(values)

S.extend(iterable) -- extend sequence by appending elements from the iterable

extract(axes, edges[, aperture_id])

Return new volumes from within all existing volumes.

index(value[, start, stop])

S.index(value, [start, [stop]]) -> integer -- return first index of value.

insert(index, value)

S.insert(index, value) -- insert value before index

pop([index])

S.pop([index]) -> item -- remove and return item at index (default last).

remove(value)

S.remove(value) -- remove first occurrence of value.

reverse()

S.reverse() -- reverse IN PLACE

shrink(axis, values[, aperture_id])

Trim axes to new min/max value(s).

split(axis, value[, aperture_id])

Split the all volumes that include axis=value into two.

write_string(stream)

Write formatted string representation to I/O stream.

append(value)#

S.append(value) – append value to the end of the sequence

clear()#

S.clear() -> None – remove all items from S

count(value)#

S.count(value) -> integer – return number of occurrences of value

extend(values)#

S.extend(iterable) – extend sequence by appending elements from the iterable

extract(axes, edges, aperture_id=None)#

Return new volumes from within all existing volumes.

This method DOES NOT alter the existing self.volumes list To include the returned volumes, add them to the self.volumes list

Parameters:
  • axes (list of either {"wave", "x", "y"}) – Which axis (list of single str) or axes (list[str]) to use. Must be list in either case.

  • edges (list, tuple of lists) – Edge points for each axes listed

  • aperture_id (int, optional) – Default None. If None, extract from all volumes. If int, only extract from volumes with this aperture_id in the meta dict

Examples

::
>>> fvl = FovVolumeList()
>>> fvl.split("x", 0)
>>> new_vols = fvl.extract(axes=["wave"], edges=([0.5, 0.6], ))
>>> new_vols = fvl.extract(axes=["x", "y"], edges=([-1, 1], [0, 5]))
>>> new_vols = fvl.extract(axes=["x", "y", "wave"],
>>>                        edges=([-1, 1], [0, 5], [0.5, 0.6]))
>>> new_vols = fvl.extract(axes=["x", "y"], edges=([-1, 1], [0, 5]),
>>>                        aperture_id=1)
>>>
>>> fvl += [new_vols]
Returns:

new_vols – A list of all new volumes extracted from existing volumes

Return type:

list of dicts

index(value, start=0, stop=None)#

S.index(value, [start, [stop]]) -> integer – return first index of value. Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(index, value)#

S.insert(index, value) – insert value before index

pop(index=-1)#

S.pop([index]) -> item – remove and return item at index (default last). Raise IndexError if list is empty or index is out of range.

remove(value)#

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()#

S.reverse() – reverse IN PLACE

shrink(axis, values, aperture_id=None) None#

Trim axes to new min/max value(s).

  • Loop through all volume dict

  • Replace any entries where min < values.min

  • Replace any entries where max > values.max

Parameters:
  • axis ({"wave", "x", "y"} or list thereof) – Which axis (str) or axes (list[str]) to use.

  • values (list of 2 floats) – [min, max], [min, None], [None, max]

  • aperture_id (int, optional) – Default None. If None, shrink all volumes. If int, only shrink volumes with this aperture_id in the meta dict

Examples

::
>>> fvl = FovVolumeList()
>>> fvl.shrink(axis="wave", values=[3.0, 3.1])
>>> fvl.shrink(axis="wave", values=[2.9, 3.1], aperture_id=1)
>>> fvl.shrink(axis=["x", "y"], values=([-1, 1], [0, 5]))
split(axis, value, aperture_id=None) None#

Split the all volumes that include axis=value into two.

  • Loop through all volume dict

  • Find any entries where min < value < max

  • Add two new entries with [min, value], [value, max]

Parameters:
  • axis ({"wave", "x", "y"}, or list thereof) – Which axis (str) or axes (list[str]) to use.

  • value (float, list of floats)

  • aperture_id (int, optional) – Default None. If None, split all volumes. If int, only split volumes with this aperture_id in the meta dict

Examples

::
>>> fvl = FovVolumeList()
>>> fvl.split(axis="wave", value=1.5)
>>> fvl.split(axis="wave", value=[3.0, 3.1])
>>> fvl.split(axis=["x", "y"], value=[0, 0])
>>> fvl.split(axis=["x", "y"], value=([-1, 1], 0))
>>> fvl.split(axis=["x", "y"], value=([-1, 1], [0, 5]))
>>> fvl.split(axis="wave", value=3.0, aperture_id=1)
>>> fvl.split(axis="wave", value=3.0, aperture_id=None)
write_string(stream: TextIO) None#

Write formatted string representation to I/O stream.