asi_core.calibration.celestial_bodies ===================================== .. py:module:: asi_core.calibration.celestial_bodies .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: asi_core.calibration.celestial_bodies.THRESHOLDS_MOON_WDR asi_core.calibration.celestial_bodies.THRESHOLDS_MOON asi_core.calibration.celestial_bodies.THRESHOLDS_SUN Classes ------- .. autoapisummary:: asi_core.calibration.celestial_bodies.CelestialBodyDetector asi_core.calibration.celestial_bodies.Moon asi_core.calibration.celestial_bodies.Sun asi_core.calibration.celestial_bodies.Venus asi_core.calibration.celestial_bodies.Sirius asi_core.calibration.celestial_bodies.Canopus asi_core.calibration.celestial_bodies.AlphaCentauri asi_core.calibration.celestial_bodies.Arcturus asi_core.calibration.celestial_bodies.Vega Module Contents --------------- .. py:data:: THRESHOLDS_MOON_WDR Thresholds to be used when detecting Moon in 8-bit HDR JPGs .. py:data:: THRESHOLDS_MOON Thresholds to be used when detecting Moon in regular (LDR) JPGs .. py:data:: THRESHOLDS_SUN Thresholds to be used when detecting Sun .. py:class:: CelestialBodyDetector(name, lat, lon, alt, center, diameter, exp_time, thresholds=None) Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy. :param name: Name of the celestial body :param lat: Latitude of the observer/ ASI in decimal degrees north :param lon: Longitude of the observer/ ASI in decimal degrees east :param alt: Altitude above sea level :param center: Center of the fisheye lens in the ASI image :param diameter: Diameter of the exposed area in the ASI image :param exp_time: Required exposure time of used images :param thresholds: Thresholds of criteria to classify a valid contour .. py:attribute:: name .. py:attribute:: lat .. py:attribute:: lon .. py:attribute:: alt .. py:attribute:: center .. py:attribute:: diameter .. py:attribute:: exp_time .. py:attribute:: observer .. py:attribute:: body .. py:attribute:: timestamps .. py:method:: _set_thresholds(thresholds) Sets thresholds for orb detection specific to a celestial body. :param thresholds: Dict of threshold values .. py:method:: _create_observer() Creates and configures an ephem Observer instance. return: Observer instance .. py:method:: _create_body() :abstractmethod: Creates a celestial body from ephem .. py:method:: calculate_azimuth_elevation(timestamp) Calculates the celestial body's spherical coordinates for the current timestamp :param timestamp: timezone-aware datetime to calculate orb coordinates for :return: azimuth and elevation angle of the orb in degree .. py:method:: detect_celestial_body(img) Detects the position of a celestial body in an image using thresholding and contour detection. :param img: (numpy.ndarray) image to analyze. :return: x and y pixel coordinates of the celestial body's center if detected or None if not detected. .. py:class:: 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: :py:obj:`CelestialBodyDetector` Detects the Moon in ASI images and calculates its spherical coordinates from astronomy. :param lat: Latitude of the observer/ ASI in decimal degrees north :param lon: Longitude of the observer/ ASI in decimal degrees east :param alt: Altitude above sea level :param center: Center of the fisheye lens in the ASI image :param diameter: Diameter of the exposed area in the ASI image :param exp_time: Required exposure time of used images :param min_moon_phase: Minimum moon illumination in ]0, 1[ from which timestamps are evaluated :param min_moon_ele: Minimum moon elevation in degree from which timestamps are evaluated :param max_sun_ele_night: Maximum sun elevation in degree up to which timestamps are evaluated (should be negative) :param thresholds: Thresholds of criteria to classify a valid contour .. py:attribute:: min_moon_phase :value: 0.8 .. py:attribute:: min_orb_ele :value: 10 .. py:attribute:: max_sun_ele_night :value: -6 .. py:method:: _create_body() Creates the celestial body Moon .. py:method:: _set_thresholds(thresholds=None) Set thresholds for orb detection specific to the Moon :param thresholds: dict of thresholds or None or 'wdr'. The latter two apply predefined parameter sets .. py:method:: timestamps_from_moon_period(timestamp_period, sampling_time=timedelta(minutes=1)) Get the most recent full moon period before the requested timestamp :param timestamp_period: Requested date, moon period closest to that date will be determined :param sampling_time: Time difference between images of the moon period evaluated .. py:class:: Sun(lat, lon, alt, center, diameter, exp_time=160, min_sun_ele_day=10, thresholds=None) Bases: :py:obj:`CelestialBodyDetector` Detects the Sun in ASI images and calculates its spherical coordinates from astronomy. :param lat: Latitude of the observer/ ASI in decimal degrees north :param lon: Longitude of the observer/ ASI in decimal degrees east :param alt: Altitude above sea level :param center: Center of the fisheye lens in the ASI image :param diameter: Diameter of the exposed area in the ASI image :param exp_time: Required exposure time of used images :param min_sun_ele_day: Minimum sun elevation in degree from which timestamps are evaluated :param thresholds: Thresholds of criteria to classify a valid contour .. py:attribute:: min_orb_ele :value: 10 .. py:method:: _create_body() Creates the celestial body Sun .. py:method:: _set_thresholds(thresholds) Set thresholds for orb detection specific to the Sun .. py:method:: timestamps_from_daytime(timestamp_start, timestamp_end, sampling_time) Gets a range of timestamps excluding any times with too low sun elevation :param timestamp_start: First timestamp of the period :param timestamp_end: Last timestamp of the period :param sampling_time: Time difference between images of the sun period evaluated .. py:class:: Venus(*args, **kwargs) Bases: :py:obj:`CelestialBodyDetector` Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy. :param name: Name of the celestial body :param lat: Latitude of the observer/ ASI in decimal degrees north :param lon: Longitude of the observer/ ASI in decimal degrees east :param alt: Altitude above sea level :param center: Center of the fisheye lens in the ASI image :param diameter: Diameter of the exposed area in the ASI image :param exp_time: Required exposure time of used images :param thresholds: Thresholds of criteria to classify a valid contour .. py:method:: _create_body() Creates the celestial body Venus .. py:method:: _set_thresholds() Set thresholds for orb detection specific to Venus .. py:class:: Sirius(*args, **kwargs) Bases: :py:obj:`CelestialBodyDetector` Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy. :param name: Name of the celestial body :param lat: Latitude of the observer/ ASI in decimal degrees north :param lon: Longitude of the observer/ ASI in decimal degrees east :param alt: Altitude above sea level :param center: Center of the fisheye lens in the ASI image :param diameter: Diameter of the exposed area in the ASI image :param exp_time: Required exposure time of used images :param thresholds: Thresholds of criteria to classify a valid contour .. py:method:: _create_body() Creates the celestial body Sirius .. py:method:: _set_thresholds() Set thresholds for orb detection specific to Sirius .. py:class:: Canopus(*args, **kwargs) Bases: :py:obj:`CelestialBodyDetector` Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy. :param name: Name of the celestial body :param lat: Latitude of the observer/ ASI in decimal degrees north :param lon: Longitude of the observer/ ASI in decimal degrees east :param alt: Altitude above sea level :param center: Center of the fisheye lens in the ASI image :param diameter: Diameter of the exposed area in the ASI image :param exp_time: Required exposure time of used images :param thresholds: Thresholds of criteria to classify a valid contour .. py:method:: _create_body() Creates the celestial body Canopus .. py:method:: _set_thresholds() Set thresholds for orb detection specific to the Canopus .. py:class:: AlphaCentauri(*args, **kwargs) Bases: :py:obj:`CelestialBodyDetector` Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy. :param name: Name of the celestial body :param lat: Latitude of the observer/ ASI in decimal degrees north :param lon: Longitude of the observer/ ASI in decimal degrees east :param alt: Altitude above sea level :param center: Center of the fisheye lens in the ASI image :param diameter: Diameter of the exposed area in the ASI image :param exp_time: Required exposure time of used images :param thresholds: Thresholds of criteria to classify a valid contour .. py:method:: _create_body() Creates the celestial body Alpha Centauri .. py:method:: _set_thresholds() Set thresholds for orb detection specific to the AlphaCentauri .. py:class:: Arcturus(*args, **kwargs) Bases: :py:obj:`CelestialBodyDetector` Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy. :param name: Name of the celestial body :param lat: Latitude of the observer/ ASI in decimal degrees north :param lon: Longitude of the observer/ ASI in decimal degrees east :param alt: Altitude above sea level :param center: Center of the fisheye lens in the ASI image :param diameter: Diameter of the exposed area in the ASI image :param exp_time: Required exposure time of used images :param thresholds: Thresholds of criteria to classify a valid contour .. py:method:: _create_body() Creates the celestial body Arcturus .. py:method:: _set_thresholds() Set thresholds for orb detection specific to the Arcturus .. py:class:: Vega(*args, **kwargs) Bases: :py:obj:`CelestialBodyDetector` Detects celestial bodies in ASI images and calculates their spherical coordinates from astronomy. :param name: Name of the celestial body :param lat: Latitude of the observer/ ASI in decimal degrees north :param lon: Longitude of the observer/ ASI in decimal degrees east :param alt: Altitude above sea level :param center: Center of the fisheye lens in the ASI image :param diameter: Diameter of the exposed area in the ASI image :param exp_time: Required exposure time of used images :param thresholds: Thresholds of criteria to classify a valid contour .. py:method:: _create_body() Creates the celestial body Vega .. py:method:: _set_thresholds() Set thresholds for orb detection specific to the Vega