If you want to quote a value and a plus/minus uncertainty range in HTML, using the <sup>
and <sub>
tags leaves the values offset, e.g.:
2.3<sup>+1.2</sup><sub>-0.5</sub>
gives:
import numpy as np | |
from matplotlib import pyplot as pl | |
x = np.random.randn(5000) | |
y = 0.2*np.random.randn(5000) + 3 | |
xbins = 20 | |
ybins = 20 | |
H, xedges, yedges = np.histogram2d(x, y, bins=(xbins, ybins)) |
""" | |
Example of integration of a function f(x) (for which a set of samples and integral estimate exist | |
e.g. through use of the Nested Sampling algorithm) multiplied by some other function g(x). NOTE: one | |
could use the expectatation value for this, but in some cases where there is sparse sampling over | |
the full allowed range of the function can cause problems. | |
The samples are passed through a KDE and then the kde object is passed to the GSL CQUAD | |
integration function | |
This requires the Cython, numpy, scikit-learn (v0.18 or greater) and the GSL library. |
from __future__ import print_function, division | |
import numpy as np | |
from scipy.signal import fftconvolve | |
import subprocess as sp | |
import os | |
import sys | |
import gzip | |
import h5py | |
from time import time |
# script to try and get the phase residuals for B1913+16 using TEMPO2 | |
cd ${HOME} | |
mkdir PSRB1913+16 | |
cd PSRB1913+16 | |
# get B1913+16 TOAs and Tempo input file from https://zenodo.org/record/54764#.Wt-fQ3XwZ8d | |
wget --no-parent -r --accept "1913.*" https://zenodo.org/record/54764/ | |
# move downloaded files |
""" | |
Get solar system barycentring time delays using PINT and lalsuite. | |
(see the example at https://github.com/nanograv/PINT/blob/master/examples/TimingModel_composition.ipynb) | |
""" | |
import subprocess as sp | |
# create a fake pulsar (units must be TDB as PINT can't do TCB yet!) | |
parcontent = """PSRJ J0123+4501 | |
RAJ 01:23:00.0 |
import ads | |
query = 'pubdate:[2003-01 TO 9999-12] author:("Pitkin, M")' | |
maxpubs = 500 | |
papers = ads.SearchQuery(q=query, rows=maxpubs, property='article') | |
titleexclusions = ["Erratum", "ERRATUM", "Publisher's Note"] | |
to_retrieve = set() | |
for paper in papers: |
""" | |
GUI keypad that plays DTMF (Dual-tone multi-frequency) signals. | |
https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling | |
""" | |
import sys | |
from functools import partial | |
from string import ascii_uppercase | |
from threading import Thread, Event |
""" | |
Plot the sun rise, sunset and length of daylight hours over a year | |
(from a given location). This uses the astropy and astroplan packages. | |
""" | |
from matplotlib import pyplot as plt | |
import numpy as np | |
from astropy.time import Time, TimeDelta | |
from astropy import units as u |