pouet package¶
Subpackages¶
Submodules¶
pouet.clouds module¶
-
class
clouds.
Clouds
(name, fimage=None, debugmode=False)[source]¶ This class loads and analyses an all sky image of the Sky and returns an observability map that can be used by another method to advise the observer on the sky quality.
Note: This module can also be used to explore older images, see the example code in __main__(). Initialises the class
Parameters: - fimage – (default is None) filename of the all sky image to analyse
- name – (default is “LaSilla”) name of the location to load the right config file
- debugmode – whether or not POUET is in debugmode. If true, it ought to return some static and dummy data
Type: string
-
detect_stars
(sigma_blur=1.2, threshold=8, neighborhood_size=20, fwhm_threshold=5, meas_star=True, return_all=False)[source]¶ Analyses the images to find the stars.
Todo
describe algo in more details
Parameters: - sigma_blur – Sigma of the Gaussian kernel (in px)
- threshold – threshold of detection
- neighborhood_size – footprint of the maximum and minimum filters
- fwhm_threshold – select objects smaller than this fwhm
- meas_star – if not interested in computing fwhm for all objects bypass and return positions of objects
- return_all – if True, returns the positions of stars + detected objects otherwise only stars
-
get_observability_map
(x, y, threshold=50, filter_sigma=2)[source]¶ Returns an observability map (an image of the sky)
Parameters: - x – x coordinates of detected stars
- y – y coordinates of detected stars
- threshold – distance threshold in px of stars such that we have observations
- filter_sigma – sigma of the Gaussian kernel, default=2
Returns: an observability map with the same dimension as the input image.
-
retrieve_image
()[source]¶ Downloads the current all sky from the server and saves it to disk. The url of the image is retrived from the corresponding configuration file.
-
update
(donotdownloadtime=1.5)[source]¶ Downloads the image, detects the stars and returns the observability map
Parameters: donotdownloadtime – minimum elapsed time before re-downloading an image, default: 1.5 min. Returns: an observability map with the same dimension as the input image. Then, use all sky get image coordinate method to retrieve observability for a given target.
-
clouds.
fwhm
(data, xc, yc, stampsize, show=False, verbose=False)[source]¶ Fits a 2D Gaussian profile and returns the FWHM in px
Parameters: - data – the stamp containing the image
- xc – centroid x position
- yc – centroid y position
- stampsize – size of nominal square stampe
- show – shows a diagnostic plot of the fit
- verbose – should I speak?
Returns: fwhm in px
-
clouds.
gaussian
(params, stamp, stampsize)[source]¶ Returns a 2D gaussian profile
Parameters: - params – a list of the Gaussian profile: centroid (x and y), sigma (std), intensity (i0) and constant background (sky)
- stamp – the original imagette
- stampsize – the size of the stamp to draw the Gaussian in.
Returns: residues of the gaussian - stamp
pouet.main module¶
pouet.meteo module¶
Define the METEO class and related functions
Meteo is an object containing all the external weather condition (wind speed and direction, temperature, moon position, clouds pattern,…) It is the only object that interact outside POUET, i.e. communicate with website to get the meteo,…
Observables interact only with Meteo to get their constaints (position to the moon, angle to wind, …)
Warning
Do NOT call this site.py otherwise it clashes with some weird Python system package.
-
class
meteo.
Meteo
(name='uknsite', time=None, moonaltitude=None, moonazimuth=None, sunaltitude=None, sunazimuth=None, winddirection=-1, windspeed=-1, cloudscheck=True, fimage=None, debugmode=False)[source]¶ Class to hold the meteorological conditions of the current night and the location of the site
Typically, a Site object is created when POUET starts, and then update itself every XX minutes
-
get_AzAlt
(alpha, delta, obs_time=None, ref_dir=0)[source]¶ idea from http://aa.usno.navy.mil/faq/docs/Alt_Az.php
Compute the azimuth and altitude of a source at a given time (by default current time of execution), given its alpha and delta coordinates.
-
get_moon
(obs_time=<Time object: scale='utc' format='datetime' value=2018-02-28 13:39:37.706589>)[source]¶
-
get_nighthours
(obs_night, twilight='nautical')[source]¶ return a list of astropy Time objects, corresponding to the different hours of the obs_night
-
get_sun
(obs_time=<Time object: scale='utc' format='datetime' value=2018-02-28 13:39:37.706872>)[source]¶
-
get_twilights
(obs_night, twilight='nautical')[source]¶ return a list of astropy Time objects: twilight in, twilight out
Warning
The twilight times in PyEphem don’t take into account the altitude ! See https://github.com/brandon-rhodes/pyephem/issues/102
-
update
(obs_time=<Time object: scale='utc' format='datetime' value=2018-02-28 13:39:37.706045>, minimal=False)[source]¶ minimal=True update only the moon and sun position. Useful for predictions (as you can’t predict the clouds or winds, no need to refresh them)
-
updatemoonpos
(obs_time=<Time object: scale='utc' format='datetime' value=2018-02-28 13:39:37.705180>)[source]¶
-
pouet.obs module¶
Define the Observable class, the standard object of pouet, and related functions
-
class
obs.
Observable
(name='emptyobservable', obsprogram=None, attributes=None, alpha=None, delta=None, minangletomoon=None, maxairmass=None, exptime=None)[source]¶ Class to hold a specific target from any observational progamm
Unvariable parameters are defined at initialisation
Variable parameters (distance to moon, azimuth, observability,…) are undefined until associated methods are called
-
compute_airmass
(meteo)[source]¶ Computes altitude and azimuth of the observable.
Parameters: meteo – a Meteo object, whose time attribute has been actualized beforehand Returns: None
-
compute_altaz
(meteo)[source]¶ Computes altitude and azimuth of the observable.
Parameters: meteo – a Meteo object, whose time attribute has been actualized beforehand Returns: None
-
compute_angletomoon
(meteo)[source]¶ Computes the distance to the moon
Parameters: meteo – a Meteo object, whose time attribute has been actualized beforehand Returns: None
-
compute_angletosun
(meteo)[source]¶ Computes distance to the Sun
Parameters: meteo – a Meteo object, whose time attribute has been actualized beforehand Returns: None
-
compute_angletowind
(meteo)[source]¶ Computes the angle to wind
Parameters: meteo – a Meteo object, whose time attribute has been actualized beforehand Returns: None
-
compute_observability
(meteo, cwvalidity=30, displayall=True, cloudscheck=True, verbose=True, future=False)[source]¶ Update the status using
update()
. Compute the observability, a value between 0 and 1 that tells if the target can be observed at a given time. Also define flags for each parameter (moon, wind, etc…)The closer to 1 the better 0 is impossible to observe
Parameters: - meteo – a Meteo object, whose time attribute has been actualized beforehand
- displayall – boolean
-
is_cloudfree
(meteo)[source]¶ Computes whether the pointing direction is cloudy according to the altaz coordinates in memory
Parameters: meteo – a Meteo object, whose cloudmap attribute has been actualized beforehand todo: instead of taking altaz coordinates in memory, shouldn’t we use meteo.time to recompute altaz on the fly?
Returns: None Note: is_cloudfree is actualized with 0: cloudy or 1: no clouds. If unavailable, returns 2: connection error, if error during computation of observability from map: 3
-
-
obs.
rdbexport
(observables, filepath, namecol=1, alphacol=2, deltacol=3, obsprogramcol=4, verbose=False)[source]¶ Export a list of observables as an rdb catalogue, to be read again later
-
obs.
rdbimport
(filepath, namecol=1, alphacol=2, deltacol=3, obsprogramcol=4, startline=1, obsprogram=None, verbose=False)[source]¶ Import an rdb catalog into a list of observables
-
obs.
showstatus
(observables, meteo, obs_time=None, displayall=True, cloudscheck=True)[source]¶ Using a list of observables, print their observability at the given obs_time. The moon position and all observables are updated according to the given obs_time. The wind is always taken at the current time.
displayall = True allows all the targets to be displayed, even if they cannot be observed
pouet.run module¶
High-level functions around meteo and obs Running the script should provide a minimal text output
pouet.util module¶
Useful functions and definitions
-
util.
elev2airmass
(el, alt, threshold=10.0)[source]¶ Converts the elevation to airmass. :param elevation_deg: elevation [radians] :param alt: altitude of station [m] :return: air mass This is the code used for the Euler EDP at La Silla.
-
util.
readpickle
(filepath, verbose=True)[source]¶ I read a pickle file and return whatever object it contains. If the filepath ends with .gz, I’ll unzip the pickle file.
pouet.plots module¶
-
plots.
plot_airmass_on_sky
(target, meteo, ax=None)[source]¶ Plots the airmass evolution on the sky of a given target at a given time.
Parameters: - target – a pouet.obs.Observable class instance
- meteo – a pouet.meteo.Meteo class instance
- ax – the matplotlib axis to plot on. If None, then plot on a new figure