Auto-guiding (pyobs.modules.pointing)

Modules for performing auto-guiding. TODO: write doc

BasePointing

class BasePointing(camera: str | ICamera, telescope: str | ITelescope, pipeline: list[dict[str, Any] | ImageProcessor], apply: dict[str, Any] | ApplyOffsets, **kwargs: Any)

Bases: Module, PipelineMixin

Base class for guiding and acquisition modules.

Initializes a new base pointing.

Parameters:
  • telescope – Telescope to use.

  • pipeline – Pipeline steps to run on new image. MUST include a step calculating offsets!

  • apply – Object that handles applying offsets to telescope.

Acquisition

class Acquisition(exposure_time: float, target_pixel: tuple[float, float] | None = None, attempts: int = 5, tolerance: float = 1, max_offset: float = 120, log_file: str | None = None, oneshot: bool = False, broadcast: bool = False, **kwargs: Any)

Bases: BasePointing, CameraSettingsMixin, IAcquisition

Class for telescope acquisition.

Create a new acquisition.

Parameters:
  • exposure_time – Default exposure time.

  • target_pixel – (x, y) tuple of pixel that the star should be positioned on. If None, center of image is used.

  • attempts – Number of attempts before giving up.

  • tolerance – Tolerance in position to reach in arcsec.

  • max_offset – Maximum offset to move in arcsec.

  • log_file – Name of file to write log to.

  • oneshot – For a oneshot the number of attempts is automatically set to 1 and the method finishes whether successful or not.

  • broadcast – Whether to broadcast acquisition images.

async abort(**kwargs: Any) → None[source]

Abort current actions.

async acquire_target(**kwargs: Any) → AcquisitionResult[source]

Acquire target at given coordinates.

If no RA/Dec are given, start from current position. Might not work for some implementations that require coordinates.

Returns:

Result with time, ra, dec, alt, az, and an offset in whichever frame the mount supports.

Raises:

ValueError – If target could not be acquired.

async open() → None[source]

Open module

BaseGuiding

class BaseGuiding(max_exposure_time: float | None = None, min_interval: float = 0, max_interval: float = 600, separation_reset: float | None = None, pid: bool = False, reset_at_focus: bool = True, reset_at_filter: bool = True, guiding_statistic: dict[str, Any] | GuidingStatistics[Any, Any] | None = None, **kwargs: Any)

Bases: BasePointing, IAutoGuiding, IFitsHeaderBefore, IFitsHeaderAfter

Base class for guiding modules.

Initializes a new science frame auto guiding system.

Parameters:
  • max_exposure_time – Maximum exposure time in sec for images to analyse.

  • min_interval – Minimum interval in sec between two images.

  • max_interval – Maximum interval in sec between to consecutive images to guide.

  • separation_reset – Min separation in arcsec between two consecutive images that triggers a reset.

  • pid – Whether to use a PID for guiding.

  • reset_at_focus – Reset guiding, if focus changes.

  • reset_at_filter – Reset guiding, if filter changes.

async get_fits_header_after(namespaces: list[str] | None = None, **kwargs: Any) → dict[str, FitsHeaderEntry][source]

Returns FITS header for the current status of this module.

Parameters:

namespaces – If given, only return FITS headers for the given namespaces.

Returns:

Dictionary containing FITS headers.

async get_fits_header_before(namespaces: list[str] | None = None, **kwargs: Any) → dict[str, FitsHeaderEntry][source]

Returns FITS header for the current status of this module.

Parameters:

namespaces – If given, only return FITS headers for the given namespaces.

Returns:

Dictionary containing FITS headers.

async open() → None[source]

Open module.

async start(**kwargs: Any) → None[source]

Starts/resets auto-guiding.

async stop(**kwargs: Any) → None[source]

Stops auto-guiding.

GuidingStatistics

BaseGuiding’s guiding_statistic parameter takes a GuidingStatistics subclass (e.g. GuidingStatisticsSkyOffset, GuidingStatisticsPixelOffset, GuidingStatisticsUptime).

class GuidingStatistics[source]

Calculates statistics for guiding.

add_data(input_data: IN) → None[source]

Adds data to all client measurement sessions. :Parameters: input_data – Image witch metadata

add_to_header(client: str, header: dict[str, FitsHeaderEntry]) → dict[str, FitsHeaderEntry][source]

Add statistics to given header.

Parameters:
  • client – id/name of the client

  • header – Header dict to add statistics to.

init_stats(client: str, default: Any = None) → None[source]

Inits a stat measurement session for a client.

Parameters:
  • client – name/id of the client

  • default – first entry in session

AutoGuiding

class AutoGuiding(exposure_time: float = 1.0, broadcast: bool = False, **kwargs: Any)

Bases: BaseGuiding, CameraSettingsMixin

An auto-guiding system.

Initializes a new auto guiding system.

Parameters:
  • exposure_time – Initial exposure time in seconds.

  • broadcast – Whether to broadcast new images.

async open() → None[source]

Open module.

async set_exposure_time(exposure_time: float, **kwargs: Any) → None[source]

Set the exposure time in seconds.

Parameters:

exposure_time – Exposure time in seconds.

Raises:

ValueError – If exposure time could not be set.

async start(**kwargs: Any) → None[source]

Starts/resets auto-guiding.

async stop(**kwargs: Any) → None[source]

Stops auto-guiding.

ScienceFrameAutoGuiding

class ScienceFrameAutoGuiding(**kwargs: Any)

Bases: BaseGuiding

An auto-guiding system based on comparing collapsed images along the x&y axes with a reference image.

Initializes a new science frame auto guiding system.

async add_image(event: Event, sender: str, **kwargs: Any) → bool[source]

Processes an image asynchronously, returns immediately.

Parameters:
  • event – Event for new image.

  • sender – Name of sender.

async open() → None[source]

Open module.

async set_exposure_time(exposure_time: float, **kwargs: Any) → None[source]

Set the exposure time for the auto-guider.

Parameters:

exposure_time – Exposure time in secs.

Raises:

NotSupportedError – Exposure time is dictated by incoming science frames, not settable.

DummyAutoGuiding

class DummyAutoGuiding(exposure_time: float = 1.0, interval: float = 2.0, **kwargs: Any)

Bases: Module, IAutoGuiding

An auto-guiding system.

Create a new dummy auto-guiding system.

Parameters:
  • exposure_time – Initial exposure time, in seconds.

  • interval – Time between simulated guide corrections, in seconds.

async open() → None[source]

Open module.

async set_exposure_time(exposure_time: float, **kwargs: Any) → None[source]

Set the exposure time in seconds.

Parameters:

exposure_time – Exposure time in seconds.

Raises:
  • ValueError – If exposure time could not be set.

  • NotSupportedError – If this module doesn’t support setting exposure time directly (e.g. it’s dictated by something else, like incoming science frames).

async start(**kwargs: Any) → None[source]

Starts a service.

async stop(**kwargs: Any) → None[source]

Stops a service.