Skip to content

Instantly share code, notes, and snippets.

View akochepasov's full-sized avatar
💭
Paper! Paper!

Anton K2 akochepasov

💭
Paper! Paper!
View GitHub Profile
%%time
from itertools import combinations as _combu
import numpy as np
from scipy.optimize import linprog
def inversions(X):
# build inequalities
A = [v2 - v1 for v2, v1 in _combu(X, 2)]
/******** Header Files ********/
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <queue>
@akochepasov
akochepasov / freq_heatmap.py
Created April 11, 2020 01:09
Frequency heatmap creation
# Creating heatmap (slower)
dbins = np.linspace(0.0, 1.0, 51)
m = np.zeros((len(dbins), len(x_axis)))
m2 = np.zeros((len(dbins), len(x_axis)))
for r in res:
rd = np.digitize(r, dbins)
for i, d in enumerate(rd):
m[d, i] += 1
@akochepasov
akochepasov / analytic_wfm.py
Created September 23, 2019 01:17 — forked from sixtenbe/analytic_wfm.py
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@akochepasov
akochepasov / peakdet.m
Created September 23, 2019 01:17 — forked from endolith/peakdet.m
Peak detection in Python [Eli Billauer]
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and column 2 the found values.
%
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices
% in MAXTAB and MINTAB are replaced with the corresponding
% X-values.
@akochepasov
akochepasov / about.md
Created August 11, 2011 10:36 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer