pouet package

Submodules

pouet.clouds module

pouet.main module

pouet.meteo module

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]

Bases: object

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

Constructor

An observable is the basic building bloc of POUET. It stores all the values of a target that are needed to compute its observability at a given time from a given position

Parameters:
  • name – string, name of the observable
  • obsprogram – string, related to one of the existing programs defined in :any:’obsprogram’
  • attributes – any type of extra information about the target you want to store
  • alpha – Right Ascension angle, in hours HH:MM:ss
  • delta – Declination angle, in degree DD:MM:ss
  • minangletomoon – float, minimum angle in the sky plane to the moon below which the target is not to be observed
  • maxairmass – float, maximum airmass below which the target is not to be observed
  • exptime – float, expected exposure time of the target
compute_airmass(meteo)[source]

Computes the airmass of the observable.

Parameters:meteo – a Meteo object, whose time attribute has been actualized beforehand
compute_altaz(meteo)[source]

Computes the altitude and azimuth of the observable.

Parameters:meteo – a Meteo object, whose time attribute has been actualized beforehand
compute_angletomoon(meteo)[source]

Computes the distance to the moon

Parameters:meteo – a Meteo object, whose time attribute has been actualized beforehand
compute_angletosun(meteo)[source]

Computes the distance to the Sun

Parameters:meteo – a Meteo object, whose time attribute has been actualized beforehand
compute_angletowind(meteo)[source]

Computes the angle to wind

Parameters:meteo – a Meteo object, whose time attribute has been actualized beforehand
compute_observability(meteo, cwvalidity=30, cloudscheck=True, verbose=True, displayall=True, future=False)[source]

Update the status using update(). Compute the observability param, 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
  • cwvalidity – float, current weather validity: time (in minutes) after/before which the allsky cloud coverage and wind are not taken into account in the observability, effectively setting the future variable to True
  • verbose – boolean, displaying the status of the observable according to the present function
  • displayall – boolean, if verbose is True, then print also the targets that are not observable.
  • future – boolean, if set to True then cloud coverage and wind are note taken into account in the observability.
copy()[source]
Returns:an, observable, python deep copy of the current observable
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?

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

update(meteo)[source]

Update the observable parameters according to the meteo object passed: altitude, azimuth, angle to wind, airmass, angle to moon and angle to sun.

Parameters:meteo – a Meteo object, whose time attribute has been actualized beforehand
obs.rdbexport(filepath, observables, append=False)[source]

Save a list of observables at a given filepath, respecting the formatting used when default importing with :meth:’obs.rdbimport’.

Parameters:
  • filepath – string. Path of where the .pouet file is written
  • observables – list of Observables to save
  • append – boolean. If True, then the current observables are added to the existing list

Note

append=True only works if the file you want to append to has the correct formatting. See headerline and headersubline in the source code.

obs.rdbimport(filepath, namecol=1, alphacol=2, deltacol=3, obsprogramcol=4, obsprogram=None)[source]

Import an rdb catalog into a list of observables

Must be compatible with astropy Table reader (i.e. a header line, then an empty/blank/comment line, then each obs in a dedicated line, attributes separater by a tab or a space)

Parameters:
  • filepath – path to the file you want to import. Must be a text file, format is not important.
  • namecol – integer, index of the column containing the names
  • alphacol – integer, index of the column containing the right ascension
  • deltacol – integer, index of the column containing the declination
  • obsprogramcol – integer, index of the column containing the obs program. If not provided, use the provided obsprogram instead.
  • obsprogram – which :any:’obsprogram.__init__’ is to be used as a default if nothing is provided from the imported file.

Note

providing an obsprogramcol overloads the given obsprogram, as long as there is a valid field in the rdb obsprogramcol. You can use both to load a catalogue that has only part of its programcol defined.

obs.showstatus(observables, meteo, displayall=True, cloudscheck=True)[source]

print the observability of a list of observables according to a given meteo.

Parameters:
  • observables – list of observables, :meth:’~obs.Observable’
  • displayall – boolean, if set to True then display the status of all the targets, even those which are not visible.
  • cloudscheck – boolean, if set to True then use the cloud coverage in the observability computation.

pouet.run module

pouet.util module

Useful functions and definitions

util.check_value(var, flag)[source]

Check that a value is NaN, replace it with a given flag if True

Parameters:
  • var – value to check against NaN
  • flag – replacement value
Returns:

processed value

util.elev2airmass(el, alt, threshold=10.0)[source]

Converts the elevation to airmass.

Parameters:
  • el – float, elevation in radians
  • alt – float, altitude of the observer in meters
  • threshold – maximum allowed airmass, will be returned if actual airmass exceeds the threshold
Returns:

airmass

Note

This is the code used for the Euler EDP at La Silla.

util.grid_points(res_x=400, res_y=200)[source]

Maps the whole sky in right ascension and declination

Parameters:
  • res_x – integer, number of points in right ascension
  • res_y – integer, number of points in declination

Note

the points are equally spaced.

Returns:numpy tuples containing right ascension points and declination points
util.hilite(string, status, bold)[source]

Helper to add colors and bold in the terminal

Parameters:
  • string – string you want to color or bold
  • status – boolean, if True then the text is colored in green, otherwise in red.
  • bold – boolean, if True then the text is bolded
Returns:

util.load_station(name)[source]

Load the parameters corresponding to an observation station

Parameters:name – string, name of the station. The corresponding file must be located in config()
Returns:station parameters
util.readconfig(configpath)[source]

Reads in a config file

Parameters:configpath – path of the configfile
Returns:configuration dictionary
util.readpickle(filepath)[source]

I read a pickle file and return whatever object it contains. If the filepath ends with .gz, I’ll unzip the pickle file.

Parameters:filepath – string, path of the pickle to load
Returns:object contained in the pickle
util.takeclosest(dico, key, value)[source]

Warning

I assume that dict[key] is sorted.

Returns the dict value which dict[key] is closest to value. If two dict[key] are equally close to value, return the highest (i.e. latest).

Parameters:
  • dico – python dictionary you want to sort
  • key – dictionary key used for sorting
  • value – target value,
Returns:

index of the element in dico that is the closest to the target value

Note

This is much faster than a simple min loop, although a bit more tedious to use.

util.time2hhmm(obstime)[source]

Concatenate a string HH MM SS or HH.MM.SS into an HHMM string

Parameters:obstime – string, HH MM SS or HH.MM.SS
Returns:HHMM string
util.writepickle(obj, filepath, protocol=-1)[source]

I write your python object obj into a pickle file at filepath. If filepath ends with .gz, I’ll use gzip to compress the pickle.

Parameters:
  • obj – python container you want to compress
  • filepath – string, path where the pickle will be written
  • protocol – Leave protocol = -1 : I’ll use the latest binary protocol of pickle.

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
plots.plot_target_on_sky(target, figure=None, northisup=True, eastisright=False, boxsize=None, survey='DSS', cmap='Greys')[source]

Uses astroquery (hopefully soon accessible from astropy.vo) to plot an image of the target

plots.shownightobs(observable, meteo, obs_night=None, savefig=False, dirpath=None, verbose=False)[source]

Plot the observability of one observable along the night #todo: add the option to be returned in an Axes object instead of plotting