Skip to content

Instantly share code, notes, and snippets.

Thomas Robitaille astrofrog

Block or report user

Report or block astrofrog

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View plot_mona_lisa.py
import cmap_kittens
from astropy.io import fits
import matplotlib.pyplot as plt
data = fits.getdata('monalisa.fits')[0]
plt.imshow(data, cmap='kittens', origin='lower')
plt.colorbar()
plt.show()
@astrofrog
astrofrog / config.py
Created Jul 16, 2019
Example of creating 2d viewers from a single 3d viewer in glue and keeping properties in sync
View config.py
from glue.core import Data
from glue.config import viewer_tool
from glue.external.echo import keep_in_sync
from glue.viewers.common.tool import Tool
from glue.viewers.scatter.qt.data_viewer import ScatterViewer
from glue_vispy_viewers.scatter.scatter_viewer import VispyScatterViewer
@viewer_tool
class XYZViewersTool(Tool):
View voila-voila.py
import os
import click
import shutil
@click.command()
@click.option('--notebook', required=True)
@click.option('--template', required=True)
@click.option('--app', required=True)
def make_app(notebook, template, app):
View get_wheels_from_azure.py
import os
import tarfile
import tempfile
import requests
BUILDS_URL = 'https://dev.azure.com/{pipeline_id}/_apis/build/builds'
ARTIFACTS_URL = BUILDS_URL + '/{build_id}/artifacts'
View gl-issue.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View weird_arrays.log
In [1]: import numpy as np
In [2]: x = np.arange(1000000)
In [3]: y = x[::2]
In [4]: y.__array_interface__
Out[4]:
{'data': (4658720768, False),
'strides': (16,),
View indexed_data.py
from glue.core.data import BaseCartesianData
from glue.core.message import NumericalDataChangedMessage
class IndexedData(BaseCartesianData):
"""
A dataset where some dimensions have been removed via indexing.
"""
def __init__(self, original_data, indices):
View infrastructure.md

astropy-helpers

The main aim of the astropy-helpers is to make it easier to build, test, and produce documentation in packages. For example, it defines a python setup.py test command that can be used to run all the tests, and a python setup.py build_docs command that will automatically build the documentation using Sphinx. For more informaiton, see the README.rst file for astropy-helpers.

@astrofrog
astrofrog / v3.0.5_vs_v3.1.x.log
Created Oct 29, 2018
Astropy performance changes from v3.0.5 to v3.1.x
View v3.0.5_vs_v3.1.x.log
Benchmarks that have improved:
before after ratio
[df4c75aa] [66ff20b9]
- 28.4±0.03ms 4.85±0.01ms 0.17 coordinates.FrameBenchmarks.time_concatenate_array
- 24.3±0.03ms 3.36±0.03ms 0.14 coordinates.FrameBenchmarks.time_concatenate_scalar
- 1.08±0.01ms 744±2μs 0.69 coordinates.FrameBenchmarks.time_init_array
- 390±0.4μs 82.6±0.6μs 0.21 coordinates.FrameBenchmarks.time_init_nodata
- 905±2μs 556±1μs 0.61 coordinates.FrameBenchmarks.time_init_scalar
- 18.4±0.01ms 1.79±0ms 0.10 coordinates.FrameBenchmarks.time_init_scalar_diff
View 2mass.tbl
\fixlen = T
\primary = 0
\RowsRetrieved = 23938
\QueryTime = 00:00:38.68672
\ORIGIN = 'IPAC Infrared Science Archive (IRSA), Caltech/JPL'
\DATETIME= '2009-04-15 18:46:00'
\DataTag = 'ADS/IRSA.Gator#2009/0415/184600_12519'
\DATABASE= '2MASS All-Sky Point Source Catalog (PSC) (fp_psc)'
\EQUINOX = 'J2000'
\SKYAREA = 'within 1000 arcsec of ra=274.70073 dec=-13.80723 Eq J2000 '
You can’t perform that action at this time.