Skip to main content

Astronomical utilities for PANOPTES

Project description

PyPI version Build Status codecov Documentation Status

PANOPTES Utils

Utility functions for use within the PANOPTES ecosystem and for general astronomical processing.

This library defines a number of modules that contain useful functions as well as a few services.

See the full documentation at: https://panoptes-utils.readthedocs.io

Getting

See Docker for ways to run panoptes-utils services without installing to your host computer.

pip

To install type:

pip install panoptes-utils

Docker

Docker containers are available for running the panoptes-utils module and associated services, which also serve as the base container for all other PANOPTES related containers.

See our Docker documentation for details.

Using

Modules

The modules can be used as helper utilities anywhere you would like. See the complete documentation for details: https://panoptes-utils.readthedocs.io/en/latest/.

Services

The services can be run either from a docker image or from the installed script, as described below.

Config Server

A simple config param server. Runs as a Flask microservice that delivers JSON documents in response to requests for config key items.

Can be run from the installed script (defaults to http://localhost:6563/get-config):

$ bin/panoptes-config-server
 * Serving Flask app "panoptes.utils.config.server" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off

Or inside a python process:

>>> from panoptes.utils.config.server import config_server
>>> from panoptes.utils.config import client

>>> server_process=config_server()

>>> client.get_config('location.horizon')
30.0

>>> server_process.terminate()  # Or just exit notebook/console

For more details and usage examples, see the config server README.

Development

Environment

There is a docker development environment that has a number of support modules installed. This also defaults to running a jupyter-lab instance with the $PANDIR folder as the root.

You should have all panoptes repositories for development (maybe POCS, panoptes-utils, panoptes-tutorials) inside the $PANDIR folder (default /var/panoptes). Ideally you have just run the install script at TODO: reference install script here..

You can then start the development environment by:

bin/panoptes-develop up

You can then connect to the provided url in your browser. The default password is panotpes, which is not supplied for security purposes but just to allow access.

The environment can be stopped with:

bin/panoptes-develop down

Logging

The panoptes-utils module uses loguru for logging, which also serves as the basis for the POCS logger (see Logger).

To access the logs for the module, you can import directly from the logger module, i.e., from panoptes.utils.logger import logger. This is a simple wrapper around luguru with no extra configuration:

>>> from panoptes.utils import CountdownTimer
>>> # No logs by default
>>> t0 = CountdownTimer(5)
>>> t0.sleep()
False

>>> # Enable the logs
>>> from panoptes.utils.logger import logger
>>> logger.enable('panoptes')

>>> t1 = CountdownTimer(5)
2020-03-04 06:42:50 | DEBUG | panoptes.utils.time:restart:162 - Restarting Timer (blocking) 5.00/5.00
>>> t1.sleep()
2020-03-04 06:42:53 | DEBUG | panoptes.utils.time:sleep:183 - Sleeping for 2.43 seconds
False

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

panoptes-utils-0.2.15.tar.gz (3.9 MB view details)

Uploaded Source

Built Distribution

panoptes_utils-0.2.15-py2.py3-none-any.whl (108.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file panoptes-utils-0.2.15.tar.gz.

File metadata

  • Download URL: panoptes-utils-0.2.15.tar.gz
  • Upload date:
  • Size: 3.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for panoptes-utils-0.2.15.tar.gz
Algorithm Hash digest
SHA256 c115056ec1337b38cc0c2854d1ab91c79d1f4d55865f4366d2506b85807ade96
MD5 e4ba2f7934369f5ee8370cc04976b00c
BLAKE2b-256 7faa89f2a07a777efe98eaf94f04742d46c4600f5fdf9f3b9cf16ec431e680ec

See more details on using hashes here.

File details

Details for the file panoptes_utils-0.2.15-py2.py3-none-any.whl.

File metadata

  • Download URL: panoptes_utils-0.2.15-py2.py3-none-any.whl
  • Upload date:
  • Size: 108.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for panoptes_utils-0.2.15-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6ec029f5e37534cf484fc0b2b769d94f3320e56d25078a33774631d0a0fc1af4
MD5 c796a30bf29899f787f5c4267fa298ce
BLAKE2b-256 08e5d52b8152d738081284a169a59a8e010335d3c8c6f89f9537ecc487750a61

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page