Skip to content

Instantly share code, notes, and snippets.

View ipashchenko's full-sized avatar

Ilya ipashchenko

  • LPI ASC
View GitHub Profile
# place this file in ~/.config/terminator/config
[global_config]
title_transmit_bg_color = "#d30102"
focus = system
[keybindings]
reset_clear = <Ctrl>R
new_tab = <Ctrl>T
split_horiz = <Ctrl><Shift>E
split_vert = <Ctrl>E
close_term = <Ctrl><Shift>W
"""
Functions for converting dates to/from JD and MJD. Assumes dates are historical
dates, including the transition from the Julian calendar to the Gregorian
calendar in 1582. No support for proleptic Gregorian/Julian calendars.
:Author: Matt Davis
:Website: http://github.com/jiffyclub
"""
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="Solarized Dark" version="1" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="14" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="ADDED_LINES_COLOR" value="" />
<option name="ANNOTATIONS_COLOR" value="2b36" />
<option name="ANNOTATIONS_MERGED_COLOR" value="" />
<option name="CARET_COLOR" value="dc322f" />
diff -r 96a023de3ddf make/sun/font/Makefile
--- a/make/sun/font/Makefile Wed Jun 06 18:39:46 2012 -0700
+++ b/make/sun/font/Makefile Fri Jun 08 12:52:01 2012 +0900
@@ -128,7 +128,7 @@
ifeq ($(USING_SYSTEM_FT_LIB), false)
FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX).6
endif
- OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype
+ OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype -lfontconfig
endif
from numpy.fft import fft, ifft, fft2, ifft2, fftshift
import numpy as np
def fft_convolve2d(x,y):
""" 2D convolution, using FFT"""
fr = fft2(x)
fr2 = fft2(np.flipud(np.fliplr(y)))
m,n = fr.shape
cc = np.real(ifft2(fr*fr2))
cc = np.roll(cc, -m/2+1,axis=0)
@ipashchenko
ipashchenko / geom_vs_poisson.py
Last active May 11, 2020 11:16
Model selection via Bayes factor estimation with ``emcee`` (see http://stronginference.com/bayes-factors-pymc.html for ``pymc`` version of model probabilities calculation)
import numpy as np
from scipy import stats
from emcee import PTSampler, EnsembleSampler
try:
import matplotlib.pyplot as plt
except:
plt = None
def lnlike_geom(p, y):
@ipashchenko
ipashchenko / infer_num_trials_binomial.py
Last active August 29, 2015 14:21
Bayesian estimation of number of trials in a Binomial distribution
import numpy as np
from scipy import stats
try:
import matplotlib.pyplot as plt
except:
plt = None
def posterior_trials(n_max, data, alpha, beta, delta=0.005):
"""
@ipashchenko
ipashchenko / discrete_emcee_hack.py
Last active August 29, 2015 14:21
discrete parameters sampling with ``emcee`` using @lfloeer's hack
import emcee
import numpy as np
from scipy import stats
try:
import matplotlib.pyplot as plt
except:
plt = None
vround = np.vectorize(round)
@ipashchenko
ipashchenko / grid_dm_search_info.py
Last active August 29, 2015 14:22
parameters of grid DM search for FRB
def delta_dm_max(nu_max, nu_min, dt):
"""
Return difference in DM that corresponds to arrival time shift between
highest and lowest frequency channels equals to time resolution.
:param nu_max:
Frequency of highest frequency channel [MHz].
:param nu_min:
Frequency of lowest frequency channel [MHz].
:param dt:
import numpy as np
import scipy.ndimage as ndimage
# The array you gave above
data = np.array(
[
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],