Skip to content

Instantly share code, notes, and snippets.

View aragilar's full-sized avatar

James Tocknell aragilar

View GitHub Profile
@aragilar
aragilar / Non-working vega
Created June 10, 2020 03:01
vega examples
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json",
"config": {"view": {"continuousHeight": 300, "continuousWidth": 400}},
"datasets": {
"data-204e8e43ab905f6e2739fa18c28c265a": [
{"flux": 0.17485922245069668, "label": "example", "wavelength": 200},
{
"flux": 2.0306186286940084,
"label": "example",
"wavelength": 201.40280561122245
hdus = [] # will be list of all the images as PrimaryHDUs needed for reproject
for filename in filelist:
hdus.append(fits.open(filename)[0])
reprojected_data = [] # will be list of all the new reprojected images
base_header = hdus[0].header
for hdu in hdus[1:]
reprojected_data.append(reproject_interp(hdu, base_header)[0])
\setbeamertemplate{background}
{%
\begin{tikzpicture}
\ifnum\thepage=1\relax%
\useasboundingbox (0,0) rectangle(\the\paperwidth, \the\paperheight);
\fill[color=usydred] (0,0) rectangle (0.5*\the\paperwidth, \the\paperheight);
\fill[color=\USYD@titlegraphicbackground] (0.5*\the\paperwidth,0) rectangle (\the\paperwidth, \the\paperheight);
\node[inner sep=0pt] (titlegraphic) at (0.75*\paperwidth, 0.5*\paperheight) {\includegraphics[width=0.5\paperwidth]{\USYD@titlegraphic}};
\hskip-10pt
\node[inner sep=0pt] (logo) at (2.2, 1.2) {\usebeamertemplate*{logo titlepage}};
def poly_diff(coef, times=1):
if times == 0:
return coef
new_coef = [i * co for i, co in enumerate(coef)][1:]
return np.array(poly_diff(new_coef, times=times-1))
@aragilar
aragilar / gist:80f4b7e17385b282231b4b15114ea465
Created October 28, 2016 02:52
Vim macro for latex frac to python frac
/\\frac
wwl"ndi{2l"ddi{Nd2f}i()h"np2li / ()h"dp
@aragilar
aragilar / Add-pkgconfig-files.patch
Created August 18, 2016 01:36
pkg-config support for sundials
From: James Tocknell <aragilar@gmail.com>
Date: Thu, 22 Oct 2015 16:27:30 +1100
Subject: Add pkgconfig files
---
CMakeLists.txt | 3 +++
config/MakePkgConfig.cmake | 53 ++++++++++++++++++++++++++++++++++++++++++++++
config/pkgconfig.pc.in | 13 ++++++++++++
src/arkode/CMakeLists.txt | 10 +++++++++
src/cvode/CMakeLists.txt | 10 +++++++++
from functools import reduce
import pyparsing as pp
JOIN_OP = {
'and': lambda x,y: x+y,
'or': lambda x,y: x|y,
}
class Namespace:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def add_attrs(*names):
def wrapper(cls):
def getattr_func(self, name):
for map_name in names:
if name in self.__dict__[map_name]:
return self.__dict__[map_name][name]
raise AttributeError("No such attribute {}".format(name))
def setattr_func(self, name, item):
if name in names:
self.__dict__[name] = item
@aragilar
aragilar / get_all_dsc_orig.py
Created May 28, 2016 13:36
Old script to get old dscs from snapshot.d.o
"""
download dsc + other files from snapshot.d.o
NEEDS TO BE REWRITTEN TO USE THEIR API
"""
import argparse
import re
from os import makedirs
from os.path import basename, join as pjoin
from sys import exit
from urllib.parse import urljoin