Skip to content

Commit

Permalink
Merge pull request #54 from desihub/pip-installable-package
Browse files Browse the repository at this point in the history
pip installable package
  • Loading branch information
weaverba137 committed Dec 22, 2020
2 parents e6f8177 + 12e69fb commit 3791b9a
Show file tree
Hide file tree
Showing 61 changed files with 1,797 additions and 1,501 deletions.
28 changes: 28 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[run]
source = py/prospect
omit =
py/prospect/_version.py
py/prospect/conftest*
py/prospect/cython_version*
py/prospect/setup_package*
py/prospect/*/setup_package*
py/prospect/*/*/setup_package*
py/prospect/sphinx/*
py/prospect/test/*
py/prospect/*/test/*
py/prospect/*/*/test/*

[report]
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about packages we have installed
except ImportError

# Don't complain if tests don't hit assertions
raise AssertionError
raise NotImplementedError

# Don't complain about script hooks
def main\(.*\):
115 changes: 115 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Workflow is based on the Astropy GitHub actions workflow, ci_workflows.yml
name: CI

on:
push:
branches:
- '*'
tags:
- '*'
pull_request:

jobs:
tests:
name: Unit tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: [3.6, 3.7, 3.8]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run the test
run: pytest

coverage:
name: Test coverage
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: [3.8]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install pytest pytest-cov coveralls
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run the test with coverage
run: pytest --cov
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls

docs:
name: Doc test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.8]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: python -m pip install --upgrade pip wheel Sphinx
- name: Test the documentation
run: sphinx-build -W --keep-going -b html doc doc/_build/html

style:
name: Style check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.8]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: python -m pip install --upgrade pip wheel pycodestyle
- name: Test the style; failures are allowed
# This is equivalent to an allowed falure.
continue-on-error: true
run: pycodestyle --count py/prospect
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Compiled files
*.py[cod]
__pycache__
*.py[co]

# Other generated files
htmlcov
.coverage
py/prospect/.cache
.pytest_cache

# Sphinx
doc/api
doc/_build

# iPython
docs/nb/.ipynb_checkpoints
doc/nb/.ipynb_checkpoints
.ipynb_checkpoints

# Packages/installer info
Expand All @@ -20,12 +22,14 @@ docs/nb/.ipynb_checkpoints
dist
build
eggs
.eggs
parts
var
sdist
develop-eggs
.installed.cfg
distribute-*.tar.gz
MANIFEST

# Other
.*.swp
Expand Down
18 changes: 18 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the doc/ directory with Sphinx
sphinx:
configuration: doc/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3
# system_packages: true
2 changes: 1 addition & 1 deletion LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2017, DESI Collaboration <desi-data@desi.lbl.gov>
Copyright (c) 2018-2020, DESI Collaboration <desi-data@desi.lbl.gov>
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
12 changes: 12 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include LICENSE.rst
include README.rst
include requirements.txt

graft bin
graft doc
graft etc

prune build
prune dist
prune htmlcov
prune doc/_build
49 changes: 0 additions & 49 deletions README.md

This file was deleted.

75 changes: 75 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
========
prospect
========
Digging into DESI spectra, looking for stuff.
---------------------------------------------

|Actions Status| |Coveralls Status| |Documentation Status|

This repository is a rewrite of inspector_, which itself is very much a work
in progress. This repository is intended to provide similar functionality
as inspector, but do so without using ipywidgets so that it can be used as
standalone code outside of Jupyter notebooks, while still also working within
Jupyter notebooks.

.. image:: screenshot.png
:alt: Prospect Screenshot

.. _inspector: https://github.com/desihub/inspector

.. |Actions Status| image:: https://github.com/desihub/prospect/workflows/CI/badge.svg
:target: https://github.com/desihub/prospect/actions
:alt: GitHub Actions CI Status

.. |Coveralls Status| image:: https://coveralls.io/repos/desihub/prospect/badge.svg?branch=pip-installable-package
:target: https://coveralls.io/github/desihub/prospect?branch=pip-installable-package
:alt: Test Coverage Status

.. |Documentation Status| image:: https://readthedocs.org/projects/desi-prospect/badge/?version=latest
:target: http://desi-prospect.readthedocs.org/en/latest/
:alt: Documentation Status

What it does
~~~~~~~~~~~~

* Provides an interactive spectral viewer for DESI data at NERSC without
needing to download or install anything locally.
* Interative zoom and pan
* Shows noise estimated for each spectrum.
* Shows redrock results including the redshift, ZWARN flags, and the
best fit model.
* Mouse over a region of the spectrum to get a real-time zoom in a sub-window;
this is handy for inspecting narrow emission lines without zooming in and out
on each one.
* Shows TARGETID and targeting bits from DESI_TARGET, MWS_TARGET,
and BGS_TARGET.
* Highlight common emission / absorption lines.
* Display imaging of target.
* Buttons for saving visual inspection results before moving to next target.

Added here but not in the original inspector
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Restframe wavelengths
* User-defined smoothing
* User-defined redshift
* Viewing spectra that don't yet have redshift fits

What it doesn't do (yet)
~~~~~~~~~~~~~~~~~~~~~~~~

Any of these could be added later but don't yet exist.
If you really want a feature, please consider contributing it.

* Show individual exposures (multiple exposures are coadded prior to display)
* Show masks
* Show the Nth best fit instead of just the best fit
* More target info like mags and shapes
* Displaying model of 2D sky-subtracted raw data
* Filtering to individual exposures or tiles

-----

:Eric Armengaud: Saclay - CEA
:Stephen Bailey: Lawrence Berkeley National Lab
:Benjamin Weaver: NSF's National Optical-Infrared Astronomy Research Laboratory
19 changes: 5 additions & 14 deletions bin/run_cmx_htmlfiles
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#!/usr/bin/env python
#
# See top-level LICENSE.rst file for Copyright information
#

"""
Write html index pages from existing static pages/images produced by other scripts
"""

import prospect.scripts.prepare_cmx_htmlfiles as prepare_cmx_htmlfiles

if __name__ == '__main__':
args = prepare_cmx_htmlfiles.parse()
prepare_cmx_htmlfiles.main(args)

# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from sys import exit
from prospect.scripts.prepare_cmx_htmlfiles import main
exit(main())
19 changes: 5 additions & 14 deletions bin/run_htmlfiles
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#!/usr/bin/env python
#
# See top-level LICENSE.rst file for Copyright information
#

"""
Write html index pages from existing static pages/images produced by other scripts
"""

import prospect.scripts.prepare_htmlfiles as prepare_htmlfiles

if __name__ == '__main__':
args = prepare_htmlfiles.parse()
prepare_htmlfiles.main(args)

# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from sys import exit
from prospect.scripts.prepare_htmlfiles import main
exit(main())

0 comments on commit 3791b9a

Please sign in to comment.