panoptes.pocs.utils package¶
Subpackages¶
- panoptes.pocs.utils.cli package
- Submodules
- panoptes.pocs.utils.cli.camera module
- panoptes.pocs.utils.cli.config module
- panoptes.pocs.utils.cli.main module
- panoptes.pocs.utils.cli.mount module
- panoptes.pocs.utils.cli.network module
- panoptes.pocs.utils.cli.notebook module
- panoptes.pocs.utils.cli.power module
- panoptes.pocs.utils.cli.run module
- panoptes.pocs.utils.cli.sensor module
- panoptes.pocs.utils.cli.weather module
- Module contents
- panoptes.pocs.utils.service package
Submodules¶
panoptes.pocs.utils.cloud module¶
panoptes.pocs.utils.error module¶
- exception panoptes.pocs.utils.error.AboveMaxExptime(msg='Exposure time is too high for camera.', **kwargs)[source]¶
Bases:
PocsError
An invalid exptime for a camera, too high.
- exception panoptes.pocs.utils.error.BelowMinExptime(msg='Exposure time is too low for camera.', **kwargs)[source]¶
Bases:
PocsError
An invalid exptime for a camera, too low.
- exception panoptes.pocs.utils.error.CameraBusy(msg='Camera busy.', **kwargs)[source]¶
Bases:
PocsError
A camera is already busy.
- exception panoptes.pocs.utils.error.ImageSaturated(msg='Image is saturated', **kwargs)[source]¶
Bases:
PocsError
An image is saturated.
- exception panoptes.pocs.utils.error.NotSafeError(msg='Not safe', **kwargs)[source]¶
Bases:
PanError
Error for when safety fails.
panoptes.pocs.utils.location module¶
- class panoptes.pocs.utils.location.SiteDetails(observer: astroplan.observer.Observer, earth_location: astropy.coordinates.earth.EarthLocation, location: dict)[source]¶
Bases:
object
- earth_location: EarthLocation¶
- observer: Observer¶
- panoptes.pocs.utils.location.create_location_from_config() SiteDetails [source]¶
Sets up the site and location details.
- These items are read from the ‘site’ config directive and include:
name
latitude
longitude
timezone
pressure
elevation
horizon
panoptes.pocs.utils.logger module¶
- class panoptes.pocs.utils.logger.PanLogger[source]¶
Bases:
object
Custom formatter to have dynamic widths for logging.
Also provides a handlers dictionary to track attached handlers by id.
See https://loguru.readthedocs.io/en/stable/resources/recipes.html#dynamically-formatting -messages-to-properly-align-values-with-padding
- panoptes.pocs.utils.logger.get_logger(console_log_file='panoptes.log', full_log_file='panoptes_{time:YYYYMMDD!UTC}.log', serialize_full_log=False, log_dir=None, console_log_level='DEBUG', stderr_log_level='INFO', cloud_logging_level=None)[source]¶
Creates a root logger for PANOPTES used by the PanBase object.
Two log files are created, one suitable for viewing on the console (via tail) and a full log file suitable for archive and later inspection. The full log file is serialized into JSON.
Note: This clobbers all existing loggers and forces the two files.
- Parameters:
console_log_file (str|None, optional) – Filename for the file that is suitable for tailing in a shell (i.e., read by humans). This file is rotated daily however the files are not retained.
full_log_file (str|None, optional) – Filename for log file that includes all levels and is serialized and rotated automatically. Useful for uploading to log service website. Defaults to panoptes_{time:YYYYMMDD!UTC}.log.gz with a daily rotation at 11:30am and a 7 day retention policy. If None then no file will be generated.
serialize_full_log (bool, optional) – If the full log should be written as json for log analysis, default False.
log_dir (str|None, optional) – The directory to place the log file, default local logs.
stderr_log_level (str, optional) – The log level to show on stderr, default INFO.
console_log_level (str, optional) – Log level for console file output, defaults to ‘SUCCESS’. Note that it should be a string that matches standard logging levels and also includes TRACE (below DEBUG) and SUCCESS (above INFO). Also note this is not the stderr output, but the output to the file to be tailed.
cloud_logging_level (bool|None, optional) – If a valid log level is specified, send logs to cloud at that level. If None (the default) don’t send logs to the cloud.
- Returns:
A configured instance of the logger.
- Return type:
loguru.logger
panoptes.pocs.utils.plotting module¶
- panoptes.pocs.utils.plotting.make_autofocus_plot(output_path, initial_thumbnail, final_thumbnail, initial_focus, final_focus, focus_positions, metrics, merit_function, line_fit=None, plot_title='Autofocus Plot', plot_width=9, plot_height=18)[source]¶
Make autofocus plots.
This will make three plots, the top and bottom plots showing the initial and final thumbnail, respectively. The middle plot will contain the scatter plot for the metrics for the given focus_positions.
- Parameters:
output_path (str) – Path for saving plot.
initial_thumbnail (np.array) – The data for the initial thumbnail.
final_thumbnail (np.array) – The data for the final thumbnail.
initial_focus (int) – The initial focus position.
final_focus (int) – The final focus position.
focus_positions (np.array) – An array of int corresponding the focus positions.
metrics (np.array) – An array of float corresponding to the measured metrics.
merit_function (str) – The name of the merit function used to produce the metrics.
line_fit (tuple(np.array, np.array)) – A tuple for the fitted line. The first entry should be an array of int used to calculate fit, the second entry should be an array of the fitted values.
plot_title (str) – Title to use for plot
plot_width (int) – The plot width in inches.
plot_height (int) – The plot height in inches.
- Returns:
Full path the saved plot.
- Return type: