Skip to content

Commit

Permalink
Update output image and add PDF output
Browse files Browse the repository at this point in the history
  • Loading branch information
adl1995 committed Jul 8, 2018
1 parent 11310a6 commit 902a1cc
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 0 deletions.
52 changes: 52 additions & 0 deletions docs/joss_paper/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# =============================================================================
# @file Makefile
# @brief Makefile for generating previews of the paper
# @author Michael Hucka <[email protected]>
# @license Please see the file named LICENSE in the project directory
# @website https://github.com/casics/dassie
# =============================================================================

# Change the following values to match your configuration.
# .............................................................................

input := paper.md
output := paper.pdf
bib := paper.bib

# Main code -- no more customization variables after this point
# .............................................................................

title := $(shell grep title: $(input) | sed 's/title: *//' | tr -d "'")
authors := $(shell sed -n '/authors:/,/affiliations:/p' $(input) | grep name: | sed 's/- name: *//' | paste -d, -s - | sed 's/,/, /g')
repo := $(shell git config --get remote.origin.url | sed 's|[email protected]:|https://github.com/|' | sed 's/\.git//')
#repo := https://github.com/hipspy/hips

$(output): $(input) $(bib) Makefile
pandoc \
-V paper_title="$(title)" \
-V citation_author="$(authors)" \
-V repository="$(repo)" \
-V archive_doi="http://dx.doi.org/00.00000/zenodo.0000000" \
-V formatted_doi="00.00000/joss.00000" \
-V paper_url="http://joss.theoj.org/papers/" \
-V review_issue_url="http://joss.theoj.org/papers/" \
-V issue="0" \
-V volume="00" \
-V year="2018" \
-V submitted="00 January 0000" \
-V published="00 January 0000" \
-V page="00" \
-V graphics="true" \
-V joss_logo_path="whedon/resources/joss-logo.png" \
-V logo_path="whedon/resources/joss-logo.png" \
-V footnote_paper_title="..." \
-V geometry:margin=1in \
-V journal_name="JOSS" \
-o $(output) \
--pdf-engine=xelatex \
--filter pandoc-citeproc $(input) \
--from markdown+autolink_bare_uris \
--template "whedon/resources/latex.template"

autorefresh:;
((ls $(input) $(bib) | entr make $(output)) &)
Binary file added docs/joss_paper/plot_jpg.hires.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions docs/joss_paper/plot_jpg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Basic example how to plot a sky image with the hips package"""
from astropy.coordinates import SkyCoord
from hips import WCSGeometry, HipsPainter

# Compute the sky image
geometry = WCSGeometry.create(
skydir=SkyCoord(0, 0, unit='deg', frame='galactic'),
width=2000, height=1000, fov="3 deg",
coordsys='galactic', projection='AIT',
)
hips_survey = 'IPAC/P/GLIMPSE360'

fetch_opts = dict(fetch_package='urllib', timeout=30, n_parallel=10)
painter = HipsPainter(geometry, hips_survey, 'jpg', fetch_opts=fetch_opts)
painter.run()
painter.plot_mpl_hips_tile_number_grid()
24 changes: 24 additions & 0 deletions hips/draw/paint.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,30 @@ def plot_mpl_hips_tile_grid(self) -> None:
transform=ax.get_transform('world'), **opts)
ax.imshow(self.image, origin='lower')

def plot_mpl_hips_tile_number_grid(self) -> None:
"""Plot output image and HiPS grid with matplotlib.
This is mainly useful for debugging the drawing algorithm,
not something end-users will call or need to know about.
"""
import matplotlib.pyplot as plt
self.make_tile_list()
i = 0
for tile in self.draw_tiles:
corners = tile.meta.skycoord_corners.transform_to(self.geometry.celestial_frame)
ax = plt.subplot(projection=self.geometry.wcs)
opts = dict(color='red', lw=1, )
ax.plot(corners.data.lon.deg, corners.data.lat.deg,
transform=ax.get_transform('world'), **opts)
# ax.text(corners.data.lon.deg, corners.data.lat.deg,
# '2', bbox=dict(facecolor='red', alpha=0.5),
# transform=ax.get_transform('world'))
ax.text(0.5, 0.5,
'{:d}'.format(i), color='w', ha='center', va='center')
i += 1

ax.imshow(self.image, origin='lower')


def measure_tile_lengths(corners: Tuple[np.ndarray, np.ndarray]) -> Tuple[np.ndarray, np.ndarray]:
"""Compute length of tile edges and diagonals.
Expand Down
Binary file added paper.pdf
Binary file not shown.

0 comments on commit 902a1cc

Please sign in to comment.