Skip to content

Commit

Permalink
Merge branch 'release-v0.2.37'
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgee committed Aug 9, 2022
2 parents 756ae41 + 04b3b26 commit bc7f756
Show file tree
Hide file tree
Showing 40 changed files with 972 additions and 1,956 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/pythontest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.10" ]
python-version: [ "3.7" ]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -34,10 +34,19 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install and test panoptes-utils on ${{ matrix.python-version }}
- name: Install dependencies
run: |
# TODO don't get all the indexes.
sudo apt-get install -y exiftool fonts-freefont-ttf libcfitsio-bin astrometry.net astrometry-data-tycho2-10-19
- name: Download CR2 file
run: |
curl https://storage.googleapis.com/panoptes-resources/test-data/canon.cr2 --output ./tests/data/canon.cr2
- name: Install panoptes-utils on ${{ matrix.python-version }}
run: |
pip install -e ".[config,images,testing,social]"
pytest
- name: Test panoptes-utils on ${{ matrix.python-version }}
run: |
pytest --test-solve --test-databases=all
- name: Upload coverage report to codecov.io
uses: codecov/codecov-action@v1
if: success()
Expand Down
13 changes: 10 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@ version: 2
sphinx:
configuration: docs/conf.py

formats: htmlzip
formats:
- htmlzip

build:
os: ubuntu-22.04
tools:
python: "3.9"

python:
version: 3.7
install:
- requirements: docs/requirements.txt
- method: pip
path: .
extras_requirements:
extra_requirements:
- config
- docs
- images
- social
- testing
system_packages: true
26 changes: 26 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@
Changelog
=========

0.2.37 - 2022-08-09
-------------------

Added
^^^^^

* The ``panoptes-utils image watch <PATH>`` command with default processing that will convert ``CR2`` files to ``JPG`` and ``FITS`` and then plate-solve the ``FITS`` files.
* GHA downloads a ``CR2`` file for testing.
* Plot directives for documentation.

Changed
^^^^^^^

* Testing now includes ``--test-solve`` for plate-solving in GHA.
* Local tests only uses ``memory`` database.
* Rearranged some functions in the ``panoptes.utils.images`` namespace.

Removed
^^^^^^^

* Unused stamp plotting functions.
* Testing of config servers on GHA.
* `CountdownTimer.is_non_blocking` predicate that wasn't being used.
* Extra serial protocol handlers.



0.2.36
------
Expand Down
40 changes: 27 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,19 @@ pip install panoptes-utils
Full options for install:

```bash
pip install -e ".[config,docs,images,testing,social]"
pip install "panoptes-utils[config,docs,images,testing,social]"
```

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

Config Server
-------------

There is a simple key-value configuration server available as part of the module.

After installing with the `config` option as above, type:

```bash
panoptes-config-server run --config-file <path-to-file.yaml>
```

Dependencies
------------

There are a few system dependencies depending on what functionality you will be using.

In particular, the plate solving requires `astrometry.net` and the appropriate index files.

Use the following on a debian-based system (e.g. Ubuntu) to install all dependencies:
Use the following on a debian-based system (e.g. Ubuntu) to easily install all dependencies:

```bash
apt-get update && apt-get install --no-install-recommends --yes \
Expand All @@ -58,6 +47,31 @@ apt-get update && apt-get install --no-install-recommends --yes \
libfreetype6-dev libpng-dev libjpeg-dev libffi-dev
```

Command Line
------------

The `panoptes-utils` command line tool is available for use with subcommands
corresponding to the modules in this library. Currently, the only implemented
subcommand is `image`, which includes commands for converting `cr2` files into
`jpg` and/or `fits` files as well as for plate-solving `fits` images.

The `panoptes-utils image watch <path>` command will watch the given path for
new files and convert them to `jpg` and/or `fits` files as they are added.

See `panoptes-utils --help` and `panoptes-utils image --help` for details.


Config Server
-------------

There is a simple key-value configuration server available as part of the module.

After installing with the `config` option as above, type:

```bash
panoptes-config-server run --config-file <path-to-file.yaml>
```

Developing
----------

Expand Down
74 changes: 0 additions & 74 deletions bin/cr2-to-jpg

This file was deleted.

4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ def add_doctest_dependencies(doctest_namespace):

@pytest.fixture
def caplog(_caplog):
class PropogateHandler(logging.Handler):
class PropagateHandler(logging.Handler):
def emit(self, record):
logging.getLogger(record.name).handle(record)

logger.enable('panoptes')
handler_id = logger.add(PropogateHandler(), format="{message}")
handler_id = logger.add(PropagateHandler(), format="{message}")
yield _caplog
with suppress(ValueError):
logger.remove(handler_id)
111 changes: 111 additions & 0 deletions docs/cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
.. _cli:

==================
Command Line Utils
==================

``panoptes-utils`` provides a command line interface for some of the common functions
in the module.

Commands
--------

The main command is called ``panoptes-utils`` and includes subcommands for specific
tasks. The subcommands are available via the help menu:

.. code-block:: bash
$ panoptes-utils --help
Usage: panoptes-utils [options] <command> [<args>]
Options:
--help Show this message and exit.
Commands:
image Process an image.
image
=====

The ``image`` subcommand provides access to image conversion and plate-solving as
well as a generic tool for watching a directory and performing any of the other
image subcommands.

.. code-block:: bash
$ panoptes-utils image --help
Usage: panoptes-utils image [OPTIONS] COMMAND [ARGS]...
Process an image.
Options:
--help Show this message and exit.
Commands:
cr2
fits
watch Watch a directory for changes and process any new files.
image watch
~~~~~~~~~~~

A tool for watching a directory and performing subcommands on all incoming files.
This command will block until cancelled by the user via ``Ctrl-c``.

.. code-block:: bash
Usage: panoptes-utils image watch [OPTIONS] PATH
Watch a directory for changes and process any new files.
The files will be processed according to the boolean flags, with the flag
names corresponding to other image commands.
By default, all the flags are enabled, which will:
* Extract JPG files from a CR2.
* Convert CR2 files to FITS.
* Plate-solve FITS files.
Arguments:
PATH [required]
Options:
--to-jpg / --no-to-jpg [default: to-jpg]
--to-fits / --no-to-fits [default: to-fits]
--solve / --no-solve [default: solve]
--overwrite / --no-overwrite [default: no-overwrite]
--remove-cr2 / --no-remove-cr2 [default: no-remove-cr2]
--help Show this message and exit.
image cr2
~~~~~~~~~

Canon ``CR2`` can have a JPG extracted and be converted to FITS files. See the ``--help``
command for each of the specific subcommands for more details.

.. code-block:: bash
Usage: panoptes-utils image cr2 [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
to-fits Convert a CR2 image to a FITS, return the new path name.
to-jpg Extract a JPG image from a CR2, return the new path name.
image fits
~~~~~~~~~~

FITS files can be easily plate-solved.

.. code-block:: bash
Usage: panoptes-utils image fits [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
solve Plate-solve a FITS file.
Loading

0 comments on commit bc7f756

Please sign in to comment.