This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from colorsys import rgb_to_hls, hls_to_rgb | |
def _rgb2hls(im): | |
return np.stack(np.vectorize(rgb_to_hls)(*im.transpose(2,0,1)/256), axis=-1) | |
def _hls2rgb(im): | |
return (255*np.stack(np.vectorize(hls_to_rgb)(*im.transpose(2,0,1)), axis=-1)).astype(np.uint8) | |
def invert(img): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ImageJ macro making a tilted movie out of stack | |
//uses shear transform + rotation | |
//Eugene Katrukha katpyxa at gmail.com | |
requires("1.48h"); | |
sTitle=getTitle(); | |
sMovieTitle=sTitle+"_tilt_movie"; | |
setBatchMode(true); | |
//Dialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the aim is to use the 'drc' package to fit models to data and then extract the data and use for plotting in ggplot | |
# the data could be growth curves, dose-response, Michaelis-Menten etc. | |
# here, the S.alba data from drc is used for dose-response | |
library(tidyverse) | |
library(broom) | |
library(drc) | |
library(modelr) | |
attach(S.alba) # the data used in this gist | |
library(egg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Read windows/mac clipboard into lines | |
#' | |
#' If windows, call \code{utils::readClipboard()}. If mac os, use | |
#' \code{pipe("pbpaste")}. | |
#' | |
#' @return character vector | |
#' @export | |
#' @examples | |
#' clip_read_lines() | |
clip_read_lines <- function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# somewhat hackish solution to: | |
# https://twitter.com/EamonCaddigan/status/646759751242620928 | |
# based mostly on copy/pasting from ggplot2 geom_violin source: | |
# https://github.com/hadley/ggplot2/blob/master/R/geom-violin.r | |
library(ggplot2) | |
library(dplyr) | |
"%||%" <- function(a, b) { |