Skip to content

Instantly share code, notes, and snippets.

@clairemcwhite
clairemcwhite / simplified_dendrogram_to_circlepack.R
Last active March 18, 2023 16:53
Demo of going from an igraph dendrogram to a simplified view as a ggraph circlepack as in https://twitter.com/clairemcwhite/status/1079895521446293505
library(tidygraph)
library(tidyverse)
library(ggraph)
library(dendextend)
library(igraph)
palette_OkabeIto <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#999999")
cut_df <- function(dendrogram, height, c){
@naught101
naught101 / mutual_info.py
Last active December 3, 2024 11:17 — forked from GaelVaroquaux/mutual_info.py
Estimating entropy and mutual information with scikit-learn
'''
Non-parametric computation of entropy and mutual-information
Adapted by G Varoquaux for code created by R Brette, itself
from several papers (see in the code).
These computations rely on nearest-neighbor statistics
'''
import numpy as np
@insertinterestingnamehere
insertinterestingnamehere / call_dgemm.py
Last active October 7, 2020 09:36
This shows how to use SciPy's Cython-exposure of the BLAS and LAPACK libraries from within ctypes.
import numpy as np
import ctypes as ct
from scipy.linalg import cython_blas
#ct.cdll.LoadLibrary("libopenblas.dll")
#openblas = ct.CDLL("libopenblas.dll")
#dgemm = openblas.dgemm
ct.pythonapi.PyCapsule_GetPointer.restype = ct.c_void_p
ct.pythonapi.PyCapsule_GetPointer.argtypes = [ct.py_object, ct.c_char_p]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jqtrde
jqtrde / modern-geospatial-python.md
Last active August 1, 2023 14:50
Modern remote sensing image processing with Python
@GaelVaroquaux
GaelVaroquaux / mutual_info.py
Last active June 18, 2023 12:25
Estimating entropy and mutual information with scikit-learn: visit https://github.com/mutualinfo/mutual_info
'''
Non-parametric computation of entropy and mutual-information
Adapted by G Varoquaux for code created by R Brette, itself
from several papers (see in the code).
This code is maintained at https://github.com/mutualinfo/mutual_info
Please download the latest code there, to have improvements and
bug fixes.
@jseabold
jseabold / zip_model.py
Last active June 6, 2022 12:45
Zero-Inflated Poisson Estimation
import numpy as np
from scipy import special, stats
from statsmodels.base.model import GenericLikelihoodModel
def vuong_test(p1, p2):
r"""
Vuong-test for non-nested models.
Parameters
----------
@martijnvermaat
martijnvermaat / README.md
Last active November 11, 2020 13:09
Download SRA run files for given sample names

Download SRA run files for given sample names

Have all sample names in samples, one per line and run:

for sample in $(cat samples); do
    IFS=$'\n'
    for line in $(./sra-runs.py $sample); do
        echo $sample $line >> runs

done