Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into main #31

Merged
merged 17 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#Ignoring git and cache folders
.git
.cache

# Ignore personal folders
.private
.vscode

# Ignore python cache
__pycache__/
*.py[cod]
*$py.class

# project specific
config.txt
14 changes: 14 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
push:
branches: [ main, develop ]

jobs:
deploy_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
62 changes: 62 additions & 0 deletions .github/workflows/test-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
push:
branches:
- main
- develop
pull_request:

jobs:
build_and_tests:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Cache Raw_data
id: cache-test-images
uses: actions/cache@v2
with:
path: ~/Raw_data
key: NGC0628-test-raw-data-${{ hashFiles('tests/download_test_data.bash') }}

- name: Download Data
if: steps.cache-test-images.outputs.cache-hit != 'true'
run: |
mkdir ~/Raw_data
bash tests/download_test_data.bash ~/Raw_data

- name: Build the dependency Docker image
if: github.ref == 'refs/heads/main'
run: docker build --tag dresscodeswift/heasoft-caldb-wcstools:latest -f Docker/heasoft-caldb-wcstools.dockerfile .

- name: Build the DRESSCode Docker image
run: docker build --tag dresscodeswift/dresscode:latest -f Docker/dockerfile .

- name: Run the pipeline
run: |
mkdir -p ~/dresscode-data/NGC0628
cp -r ~/Raw_data ~/dresscode-data/NGC0628/Raw_data
chmod -R a=rwx ~/dresscode-data
docker run --user root --rm -t -v ~/dresscode-data:/data dresscodeswift/dresscode /bin/bash /opt/dresscode/tests/test_pipeline.bash /opt/dresscode /data

- name: Save pipeline output
uses: actions/upload-artifact@v2
with:
name: final-fits
path: |
~/dresscode-data/NGC0628/working_dir/*final*.fits
falkben marked this conversation as resolved.
Show resolved Hide resolved

- name: Login to DockerHub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push the dependency Docker image
if: github.ref == 'refs/heads/main'
run: docker push dresscodeswift/heasoft-caldb-wcstools:latest

- name: Push the DRESSCode Docker image
if: github.ref == 'refs/heads/main'
run: docker push dresscodeswift/dresscode:latest
falkben marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# For more info, see
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners

# These owners will be the default owners for everything in the repo.
* @falkben
* @mdecleir
24 changes: 24 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Spacetelescope Open Source Code of Conduct

We expect all "spacetelescope" organization projects to adopt a code of conduct that ensures a productive, respectful environment for all open source contributors and participants. We are committed to providing a strong and enforced code of conduct and expect everyone in our community to follow these guidelines when interacting with others in all forums. Our goal is to keep ours a positive, inclusive, successful, and growing community. The community of participants in open source Astronomy projects is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences success and continued growth.

As members of the community,

- We pledge to treat all people with respect and provide a harassment- and bullying-free environment, regardless of sex, sexual orientation and/or gender identity, disability, physical appearance, body size, race, nationality, ethnicity, and religion. In particular, sexual language and imagery, sexist, racist, or otherwise exclusionary jokes are not appropriate.

- We pledge to respect the work of others by recognizing acknowledgment/citation requests of original authors. As authors, we pledge to be explicit about how we want our own work to be cited or acknowledged.
falkben marked this conversation as resolved.
Show resolved Hide resolved

- We pledge to welcome those interested in joining the community, and realize that including people with a variety of opinions and backgrounds will only serve to enrich our community. In particular, discussions relating to pros/cons of various technologies, programming languages, and so on are welcome, but these should be done with respect, taking proactive measure to ensure that all participants are heard and feel confident that they can freely express their opinions.

- We pledge to welcome questions and answer them respectfully, paying particular attention to those new to the community. We pledge to provide respectful criticisms and feedback in forums, especially in discussion threads resulting from code contributions.

- We pledge to be conscientious of the perceptions of the wider community and to respond to criticism respectfully. We will strive to model behaviors that encourage productive debate and disagreement, both within our community and where we are criticized. We will treat those outside our community with the same respect as people within our community.

- We pledge to help the entire community follow the code of conduct, and to not remain silent when we see violations of the code of conduct. We will take action when members of our community violate this code such as such as contacting conduct@stsci.edu (all emails sent to this address will be treated with the strictest confidence) or talking privately with the person.
falkben marked this conversation as resolved.
Show resolved Hide resolved

This code of conduct applies to all community situations online and offline, including mailing lists, forums, social media, conferences, meetings, associated social events, and one-to-one interactions.

Parts of this code of conduct have been adapted from the Astropy and Numfocus codes of conduct:

- <http://www.astropy.org/code_of_conduct.html>
- <https://www.numfocus.org/about/code-of-conduct/>
Binary file removed DRESSCode_UserManual.pdf
Binary file not shown.
47 changes: 47 additions & 0 deletions Docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Docker

---

*DockerHub*: [hub.docker.com/dresscodeswift](https://hub.docker.com/u/dresscodeswift)

---

## Images

| Name | File path | DockerHub | Comment |
|------------|-----------|-----------|---------|
|heasoft|[Heasoft website](https://heasarc.gsfc.nasa.gov/lheasoft/docker.html)|[heasoft ![Docker Pulls](https://img.shields.io/docker/pulls/dresscodeswift/heasoft) ![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/dresscodeswift/heasoft)](https://hub.docker.com/repository/docker/dresscodeswift/heasoft)|heasoft image from [instructions](https://heasarc.gsfc.nasa.gov/lheasoft/docker.html), with SWIFT tools|
|heasoft w/ caldb & wcstools|[Docker/heasoft-caldb-wcstools.dockerfile](/Docker/heasoft-caldb-wcstools.dockerfile)|[heasoft-caldb-wcstools ![Docker Pulls](https://img.shields.io/docker/pulls/dresscodeswift/heasoft-caldb-wcstools) ![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/dresscodeswift/heasoft-caldb-wcstools)](https://hub.docker.com/repository/docker/dresscodeswift/heasoft-caldb-wcstools)|adds caldb files and wcstools|
|dresscode|[Docker/dockerfile](/Docker/dockerfile)|[dresscode ![Docker Pulls](https://img.shields.io/docker/pulls/dresscodeswift/dresscode) ![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/dresscodeswift/dresscode)](https://hub.docker.com/repository/docker/dresscodeswift/dresscode)|adds DRESSCode pipeline|
falkben marked this conversation as resolved.
Show resolved Hide resolved

## GitHub Actions

- [push docker image on merge to `main` branch](/.github/workflows/main.yml)
- [testing (WIP)](/.github/workflows/test-pipeline.yml)

## Testing

The following mounts a local volume into the docker image and runs the `test_pipeline.bash` script

```sh
docker run --rm -it -v ~/dresscode-data/:/data \
dresscodeswift/dresscode \
/bin/bash /opt/dresscode/tests/test_pipeline.bash /opt/dresscode /data
```

## Build and push dependency docker image

```sh
docker build --tag dresscodeswift/heasoft-caldb-wcstools:latest -f Docker/heasoft-caldb-wcstools.dockerfile .
docker push dresscodeswift/heasoft-caldb-wcstools:latest
```

To build the base heasoft image, follow the Heasoft Docker [instructions](https://heasarc.gsfc.nasa.gov/docs/software/lheasoft/docker.html).

## DRESSCode Image

To build the DRESSCode image locally:

```sh
docker build --tag dresscodeswift/dresscode:latest -f Docker/dockerfile .
```
18 changes: 18 additions & 0 deletions Docker/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM dresscodeswift/heasoft-caldb-wcstools:latest

COPY requirements.txt .

SHELL ["/bin/bash", "-c"]

RUN \
python3 -m venv venv \
&& source venv/bin/activate \
&& /bin/echo 'source /home/heasoft/venv/bin/activate' >> /home/heasoft/.profile \
&& /bin/echo 'source /home/heasoft/venv/bin/activate' >> /home/heasoft/.bashrc \
&& /bin/echo 'source /home/heasoft/venv/bin/activate' >> /home/heasoft/.cshrc \
&& pip install --no-cache-dir wheel numpy \
&& pip install --no-cache-dir -r requirements.txt

COPY --chown=heasoft . /opt/dresscode

# add /opt/dresscode to PATH ?
34 changes: 34 additions & 0 deletions Docker/heasoft-caldb-wcstools.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM dresscodeswift/heasoft:v6.28.swift

USER root

RUN \
apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install \
python3-pip \
python3-venv \
python3-dev \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

USER heasoft

ENV CALDB=/opt/heasoft/caldb \
PATH=/opt/heasoft/wcstools-3.9.6/bin:$PATH

RUN \
# get wcstools
wget tdc-www.harvard.edu/software/wcstools/wcstools-3.9.6.tar.gz \
&& tar -xf wcstools-3.9.6.tar.gz -C /opt/heasoft \
&& rm wcstools-3.9.6.tar.gz \
&& cd /opt/heasoft/wcstools-3.9.6 \
&& make all \
&& cd $CALDB \
falkben marked this conversation as resolved.
Show resolved Hide resolved
&& wget https://heasarc.gsfc.nasa.gov/FTP/caldb/data/swift/uvota/goodfiles_swift_uvota.tar.Z \
&& tar -zxf goodfiles_swift_uvota.tar.Z \
&& rm goodfiles_swift_uvota.tar.Z \
&& /bin/echo 'export CALDB='$CALDB >> /home/heasoft/.profile \
&& /bin/echo 'export CALDB='$CALDB >> /home/heasoft/.bashrc \
&& /bin/echo 'setenv CALDB '$CALDB >> /home/heasoft/.cshrc
4 changes: 2 additions & 2 deletions LICENSE.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2021, Marjorie Decleir
Copyright (c) 2021, Association of Universities for Research in Astronomy.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# DRESSCode

![DRESSCode](/docs/img/logo.svg)

<p align="right" style="font-size: .7rem">
<em>DRESSCode logo designed by J. De Wree</em>
</p>

DRESSCode, short for Data Reduction of Extended Swift Sources Code, is a fully automated pipeline to reduce Swift UVOT images of extended sources. It consists of a series of python scripts that perform the different steps of the data reduction pipeline to all images. The different steps include preparation, creation of sky images, aspect correction, creation of auxiliary maps, combination of separate frames, several corrections to the flux, combination of different observing periods, calibration, and aperture correction. DRESSCode is a two-phase pipeline, which means that some steps are repeated a second time, in order to improve the accuracy of the astrometry of the images.

For the original version of this software, see <a href="/~https://github.com/mdecleir/DRESSCode" target="_blank">mdecleir/DRESSCode</a>.

---

**Documentation**: <a href="https://spacetelescope.github.io/DRESSCode/" target="_blank">https://spacetelescope.github.io/DRESSCode/</a>

**Source Code**: <a href="/~https://github.com/spacetelescope/DRESSCode/">/~https://github.com/spacetelescope/DRESSCode/</a>

---

## Requirements

DRESSCode has been written and tested on Linux and Mac, and relies on several tasks from the specialized <a href="https://heasarc.gsfc.nasa.gov/docs/software/heasoft/" target="_blank">HEASoft</a> software, provided by NASA.

See the <a href="https://spacetelescope.github.io/DRESSCode/user_manual/install/" target="_blank">documentation</a> for specific installation instructions.

The minimum requirements are:

- Python 3.6 or later
- Current version of HEASoft (tested with 6.28)
- <a href="https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/install.html" target="_blank">caldb: calibration tree</a>
- <a href="http://tdc-www.harvard.edu/wcstools/" target="_blank">wcstools</a>: World Coordinate System utilities

### Docker

Docker can be used to run the software without having to complete the heasoft/caldb/wcstools installation procedure yourself (or to run on windows). The image can be found on <a href="https://hub.docker.com/r/dresscodeswift/dresscode" target="_blank">docker hub</a>.

To download and open an interactive shell:

```sh
docker pull dresscodeswift/dresscode:latest
docker run --rm -it dresscodeswift/dresscode /bin/bash
```

From there run the pipeline, which is located in `/opt/dresscode`

For more, see our <a href="https://spacetelescope.github.io/DRESSCode/user_manual/install/#docker-installation" target="_blank">docker instructions</a>.

## Help

Please see the <a href="https://spacetelescope.github.io/DRESSCode/" target="_blank">documentation</a>. If you encounter a bug or have questions, please report through GitHub <a href="/~https://github.com/spacetelescope/DRESSCode/issues">issues</a>.

## License

This project is Copyright Association of Universities for Research in Astronomy and licensed under the terms of the BSD 3-Clause “New” or “Revised” License (see the [LICENSE](LICENSE) file for more information).

## Use cases and publications

- <a href="https://ui.adsabs.harvard.edu/abs/2019MNRAS.486..743D/abstract" target="_blank">Decleir et al. (2019)</a> used a slightly older version of the DRESSCode (with only one phase) to reduce the Swift UVOT images of NGC628. These images were used to measure dust attenuation curves on resolved scales in NGC628. The paper also describes the details of the older version of the pipeline.
- The current version of the DRESSCode was used in the DustKING project, to reduce the Swift UVOT images of all KINGFISH galaxies. The goal of this project is to measure the global dust attenuation curves of all KINGFISH galaxies. This work will be published soon (Decleir et al., in prep.). The preliminary results of this work can be found in Chapter 4 of <a href="https://biblio.ugent.be/publication/8638711" target="_blank">Marjorie Decleir's PhD thesis</a>.
47 changes: 0 additions & 47 deletions README.rst

This file was deleted.

29 changes: 29 additions & 0 deletions docs/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2021, Association of Universities for Research in Astronomy.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file added docs/img/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading