Sky flats (pyobs.utils.skyflats)

TODO: write docs


class FlatFielder(functions: str | Dict[str, str | Dict[str, str]], target_count: float = 30000, min_exptime: float = 0.5, max_exptime: float = 5, test_frame: Tuple[float, float, float, float] | None = None, counts_frame: Tuple[float, float, float, float] | None = None, allowed_offset_frac: float = 0.2, min_counts: int = 100, pointing: Dict[str, Any] | SkyFlatsBasePointing | None = None, callback: Callable[[...], Coroutine[Any, Any, None]] | None = None, **kwargs: Any)

Automatized flat-fielding.

Initialize a new flat fielder.

  • functions – Function f(h) for each filter to describe ideal exposure time as a function of solar elevation h, i.e. something like exp(-0.9*(h+3.9)). See ExpTimeEval for details.

  • target_count – Count rate to aim for.

  • min_exptime – Minimum exposure time.

  • max_exptime – Maximum exposure time.

  • test_frame – Tupel (left, top, width, height) in percent that describe the frame for on-sky testing.

  • counts_frame – Tupel (left, top, width, height) in percent that describe the frame for calculating mean count rate.

  • allowed_offset_frac – Offset from target_count (given in fraction of it) that’s still allowed for good flat-field

  • min_counts – Minimum counts in frames.

  • observer – Observer to use.

  • vfs – VFS to use.

  • callback – Callback function for statistics.


class Scheduler(functions: str | Dict[str, str | Dict[str, str]], priorities: SkyflatPriorities, observer: Observer, min_exptime: float = 0.5, max_exptime: float = 5, timespan: float = 7200, filter_change: float = 30, count: int = 20, readout: Dict[str, float] | None = None)

Scheduler for taking flat fields

Initializes a new scheduler for taking flat fields

  • functions – Flat field functions

  • priorities – Class handling priorities

  • observer – Observer to use

  • min_exptime – Minimum exposure time for flats

  • max_exptime – Maximum exposure time for flats

  • timespan – Timespan from now that should be scheduled [s]

  • filter_change – Time required for filter change [s]

  • count – Number of flats to schedule

  • readout – Dictionary with readout times (in sec) per binning (as BxB).

Sky flat pointings (pyobs.utils.skyflats.pointing)

TODO: write docs


class SkyFlatsBasePointing(vfs: 'VirtualFileSystem' | Dict[str, Any] | None = None, comm: Comm | Dict[str, Any] | None = None, timezone: str | datetime.tzinfo = 'utc', location: str | Dict[str, Any] | EarthLocation | None = None, observer: Observer | None = None, **kwargs: Any)

Base class for flat poinings.


Objects must always be opened and closed using open() and close(), respectively.

This class provides a VirtualFileSystem, a timezone and a location. From the latter two, an observer object is automatically created.

Object also adds support for easily adding threads using the add_background_task() method as well as a watchdog thread that automatically restarts threads, if requested.

Using add_child_object(), other objects can be (created an) attached to this object, which then automatically handles calls to open() and close() on those objects.

  • vfs – VFS to use (either object or config)

  • comm – Comm object to use

  • timezone – Timezone at observatory.

  • location – Location of observatory, either a name or a dict containing latitude, longitude, and elevation.


class SkyFlatsStaticPointing(initialized: bool = False, *args: Any, **kwargs: Any)

Static flat pointing.

Inits new static pointing for sky flats.


initialized – If False, telescope does not move at all.

Sky flat priorities (pyobs.utils.skyflats.priorities)

TODO: write docs


class ArchiveSkyflatPriorities(archive: Dict[str, Any] | Archive, site: str, instrument: str, filter_names: List[str], binnings: List[int], *args, **kwargs)

Calculate flat priorities from an archive.


class ConstSkyflatPriorities(priorities: Dict[Tuple[str, Tuple[int, int]], float], *args: Any, **kwargs: Any)

Constant flat priorities.


class SkyflatPriorities

Base class for sky flat priorities.