This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from glue.config import menubar_plugin | |
from glue.utils.qt import pick_item | |
from glue.core.subset import MaskSubsetState | |
@menubar_plugin("Expand selection") | |
def my_plugin(session, data_collection): | |
if len(data_collection) == 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qtpy.QtWidgets import QApplication | |
from specutils import Spectrum1D | |
from specviz.app import MainWindow | |
spec = Spectrum1D.read('gbt_1d.fits') | |
app = QApplication(['']) | |
window = MainWindow() | |
# Load data into specviz | |
window.workspace.model.add_data(spec, name='banana') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
print(sys.argv) | |
THRESHOLD = 2 | |
TIMES = {} | |
def tracefunc(frame, event, arg, indent=[0]): | |
if event == "call": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import json | |
def fix_session_file(input_file, output_file): | |
# Most issues are due to inconsistencies in terms of which subsets are | |
# defined where. So this function simply removes all subsets from the | |
# session file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from qtpy.QtCore import Qt, QSignal | |
from qtpy.QtGui import QPainter, QTransform, QPen | |
from qtpy.QtWidgets import (QGraphicsView, QGraphicsScene, QApplication, | |
QGraphicsTextItem, QGraphicsEllipseItem, | |
QGraphicsLineItem) | |
from glue.utils.qt import mpl_to_qt4_color, qt4_to_mpl_color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
# Fetch commit message | |
message = sys.stdin.read() | |
# Check if it was a merge commit, and if so reword to include the original repo name | |
if message.startswith('Merge pull request #'): | |
message = message.replace('pull request #', 'pull request astropy/astropy-helpers#') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
headers = {} | |
headers['Accept'] = 'application/vnd.github.mockingbird-preview' | |
url = 'https://api.github.com/repos/astropy/astropy/issues/2590/timeline' | |
r = requests.get(url, headers=headers) | |
r.json() | |
r = requests.get(url, headers=headers) | |
r.json() | |
history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: debug | |
OBJS = healpix-utils.o healpix.o starutil.o permutedsort.o mathutil.o bl.o qsort_reentrant.o | |
HEADERS = healpix-utils.h healpix.h | |
$(OBJS): %.o: %.c $(HEADERS) | |
$(CC) -o $@ -c $< | |
%.o: %.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from astropy.io import fits | |
hdulist = fits.open('JWST-NIRSpec-IFU-GAL2136_CLEAR_PRISM.fits') | |
for ihdu in [1, 2, 3]: | |
hdulist[ihdu].header['CTYPE1'] = 'RA---TAN' | |
hdulist[ihdu].header['CTYPE2'] = 'DEC--TAN' | |
hdulist[ihdu].header['CTYPE3'] = 'WAVE' | |
hdulist[ihdu].header['CRVAL1'] = 10.2 | |
hdulist[ihdu].header['CRVAL2'] = 33.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from qtpy.QtWidgets import QApplication, QWidget, QGridLayout | |
from glue.core import Data, Session | |
from glue.viewers.scatter.qt import ScatterViewer | |
app = QApplication(sys.argv) | |
d = Data(x=[1, 2, 3], y=[4, 5, 6]) |