asi_core.calibration.celestial_bodies

Tools to detect the position of celestial bodies in images and to calculate their position in the sky astronomically

This functionality itself was introduced and described by Niklas Blum, Paul Matteschk, Yann Fabel, Bijan Nouri, Roberto Roman, Luis F. Zarzalejo, Juan Carlos Antuna-Sanchez, Stefan Wilbert “Geometric Calibration of All-Sky Cameras Using Sun and Moon Positions: A Comprehensive Analysis”, Solar Energy (in review).

When using the tools of this module in any publication or other work, make sure to reference this publication.

Attributes

THRESHOLDS_MOON_WDR

Thresholds to be used when detecting Moon in 8-bit HDR JPGs

THRESHOLDS_MOON

Thresholds to be used when detecting Moon in regular (LDR) JPGs

THRESHOLDS_SUN

Thresholds to be used when detecting Sun

Classes

CelestialBodyDetector

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Moon

Detects the Moon in ASI images and calculates its spherical coordinates from astronomy.

Sun

Detects the Sun in ASI images and calculates its spherical coordinates from astronomy.

Venus

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Sirius

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Canopus

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

AlphaCentauri

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Arcturus

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Vega

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Module Contents

asi_core.calibration.celestial_bodies.THRESHOLDS_MOON_WDR

Thresholds to be used when detecting Moon in 8-bit HDR JPGs

asi_core.calibration.celestial_bodies.THRESHOLDS_MOON

Thresholds to be used when detecting Moon in regular (LDR) JPGs

asi_core.calibration.celestial_bodies.THRESHOLDS_SUN

Thresholds to be used when detecting Sun

class asi_core.calibration.celestial_bodies.CelestialBodyDetector(name, lat, lon, alt, center, diameter, exp_time, thresholds=None)

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Parameters:
  • name – Name of the celestial body

  • lat – Latitude of the observer/ ASI in decimal degrees north

  • lon – Longitude of the observer/ ASI in decimal degrees east

  • alt – Altitude above sea level

  • center – Center of the fisheye lens in the ASI image

  • diameter – Diameter of the exposed area in the ASI image

  • exp_time – Required exposure time of used images

  • thresholds – Thresholds of criteria to classify a valid contour

name
lat
lon
alt
center
diameter
exp_time
observer
body
timestamps
_set_thresholds(thresholds)

Sets thresholds for orb detection specific to a celestial body.

Parameters:

thresholds – Dict of threshold values

_create_observer()

Creates and configures an ephem Observer instance.

return: Observer instance

abstractmethod _create_body()

Creates a celestial body from ephem

calculate_azimuth_elevation(timestamp)

Calculates the celestial body’s spherical coordinates for the current timestamp

Parameters:

timestamp – timezone-aware datetime to calculate orb coordinates for

Returns:

azimuth and elevation angle of the orb in degree

detect_celestial_body(img)

Detects the position of a celestial body in an image using thresholding and contour detection.

Parameters:

img – (numpy.ndarray) image to analyze.

Returns:

x and y pixel coordinates of the celestial body’s center if detected or None if not detected.

class asi_core.calibration.celestial_bodies.Moon(lat, lon, alt, center, diameter, exp_time=80000, min_moon_phase=0.8, min_moon_ele=10, max_sun_ele_night=-6, thresholds=None)

Bases: CelestialBodyDetector

Detects the Moon in ASI images and calculates its spherical coordinates from astronomy.

Parameters:
  • lat – Latitude of the observer/ ASI in decimal degrees north

  • lon – Longitude of the observer/ ASI in decimal degrees east

  • alt – Altitude above sea level

  • center – Center of the fisheye lens in the ASI image

  • diameter – Diameter of the exposed area in the ASI image

  • exp_time – Required exposure time of used images

  • min_moon_phase – Minimum moon illumination in ]0, 1[ from which timestamps are evaluated

  • min_moon_ele – Minimum moon elevation in degree from which timestamps are evaluated

  • max_sun_ele_night – Maximum sun elevation in degree up to which timestamps are evaluated (should be negative)

  • thresholds – Thresholds of criteria to classify a valid contour

min_moon_phase = 0.8
min_orb_ele = 10
max_sun_ele_night = -6
_create_body()

Creates the celestial body Moon

_set_thresholds(thresholds=None)

Set thresholds for orb detection specific to the Moon

Parameters:

thresholds – dict of thresholds or None or ‘wdr’. The latter two apply predefined parameter sets

timestamps_from_moon_period(timestamp_period, sampling_time=timedelta(minutes=1))

Get the most recent full moon period before the requested timestamp

Parameters:
  • timestamp_period – Requested date, moon period closest to that date will be determined

  • sampling_time – Time difference between images of the moon period evaluated

class asi_core.calibration.celestial_bodies.Sun(lat, lon, alt, center, diameter, exp_time=160, min_sun_ele_day=10, thresholds=None)

Bases: CelestialBodyDetector

Detects the Sun in ASI images and calculates its spherical coordinates from astronomy.

Parameters:
  • lat – Latitude of the observer/ ASI in decimal degrees north

  • lon – Longitude of the observer/ ASI in decimal degrees east

  • alt – Altitude above sea level

  • center – Center of the fisheye lens in the ASI image

  • diameter – Diameter of the exposed area in the ASI image

  • exp_time – Required exposure time of used images

  • min_sun_ele_day – Minimum sun elevation in degree from which timestamps are evaluated

  • thresholds – Thresholds of criteria to classify a valid contour

min_orb_ele = 10
_create_body()

Creates the celestial body Sun

_set_thresholds(thresholds)

Set thresholds for orb detection specific to the Sun

timestamps_from_daytime(timestamp_start, timestamp_end, sampling_time)

Gets a range of timestamps excluding any times with too low sun elevation

Parameters:
  • timestamp_start – First timestamp of the period

  • timestamp_end – Last timestamp of the period

  • sampling_time – Time difference between images of the sun period evaluated

class asi_core.calibration.celestial_bodies.Venus(*args, **kwargs)

Bases: CelestialBodyDetector

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Parameters:
  • name – Name of the celestial body

  • lat – Latitude of the observer/ ASI in decimal degrees north

  • lon – Longitude of the observer/ ASI in decimal degrees east

  • alt – Altitude above sea level

  • center – Center of the fisheye lens in the ASI image

  • diameter – Diameter of the exposed area in the ASI image

  • exp_time – Required exposure time of used images

  • thresholds – Thresholds of criteria to classify a valid contour

_create_body()

Creates the celestial body Venus

_set_thresholds()

Set thresholds for orb detection specific to Venus

class asi_core.calibration.celestial_bodies.Sirius(*args, **kwargs)

Bases: CelestialBodyDetector

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Parameters:
  • name – Name of the celestial body

  • lat – Latitude of the observer/ ASI in decimal degrees north

  • lon – Longitude of the observer/ ASI in decimal degrees east

  • alt – Altitude above sea level

  • center – Center of the fisheye lens in the ASI image

  • diameter – Diameter of the exposed area in the ASI image

  • exp_time – Required exposure time of used images

  • thresholds – Thresholds of criteria to classify a valid contour

_create_body()

Creates the celestial body Sirius

_set_thresholds()

Set thresholds for orb detection specific to Sirius

class asi_core.calibration.celestial_bodies.Canopus(*args, **kwargs)

Bases: CelestialBodyDetector

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Parameters:
  • name – Name of the celestial body

  • lat – Latitude of the observer/ ASI in decimal degrees north

  • lon – Longitude of the observer/ ASI in decimal degrees east

  • alt – Altitude above sea level

  • center – Center of the fisheye lens in the ASI image

  • diameter – Diameter of the exposed area in the ASI image

  • exp_time – Required exposure time of used images

  • thresholds – Thresholds of criteria to classify a valid contour

_create_body()

Creates the celestial body Canopus

_set_thresholds()

Set thresholds for orb detection specific to the Canopus

class asi_core.calibration.celestial_bodies.AlphaCentauri(*args, **kwargs)

Bases: CelestialBodyDetector

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Parameters:
  • name – Name of the celestial body

  • lat – Latitude of the observer/ ASI in decimal degrees north

  • lon – Longitude of the observer/ ASI in decimal degrees east

  • alt – Altitude above sea level

  • center – Center of the fisheye lens in the ASI image

  • diameter – Diameter of the exposed area in the ASI image

  • exp_time – Required exposure time of used images

  • thresholds – Thresholds of criteria to classify a valid contour

_create_body()

Creates the celestial body Alpha Centauri

_set_thresholds()

Set thresholds for orb detection specific to the AlphaCentauri

class asi_core.calibration.celestial_bodies.Arcturus(*args, **kwargs)

Bases: CelestialBodyDetector

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Parameters:
  • name – Name of the celestial body

  • lat – Latitude of the observer/ ASI in decimal degrees north

  • lon – Longitude of the observer/ ASI in decimal degrees east

  • alt – Altitude above sea level

  • center – Center of the fisheye lens in the ASI image

  • diameter – Diameter of the exposed area in the ASI image

  • exp_time – Required exposure time of used images

  • thresholds – Thresholds of criteria to classify a valid contour

_create_body()

Creates the celestial body Arcturus

_set_thresholds()

Set thresholds for orb detection specific to the Arcturus

class asi_core.calibration.celestial_bodies.Vega(*args, **kwargs)

Bases: CelestialBodyDetector

Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy.

Parameters:
  • name – Name of the celestial body

  • lat – Latitude of the observer/ ASI in decimal degrees north

  • lon – Longitude of the observer/ ASI in decimal degrees east

  • alt – Altitude above sea level

  • center – Center of the fisheye lens in the ASI image

  • diameter – Diameter of the exposed area in the ASI image

  • exp_time – Required exposure time of used images

  • thresholds – Thresholds of criteria to classify a valid contour

_create_body()

Creates the celestial body Vega

_set_thresholds()

Set thresholds for orb detection specific to the Vega