Skip to content

Instantly share code, notes, and snippets.

View cwood1967's full-sized avatar

Chris Wood cwood1967

  • Stowers Institute
  • Kansas City, MO
View GitHub Profile
@cwood1967
cwood1967 / regex_stuff.ipynb
Created August 5, 2022 18:30
Searching with regex
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cwood1967
cwood1967 / mask_rcnn_train.py
Last active October 7, 2021 18:28
Training with mask_rcnn using cellfinder
import os
import warnings
import numpy as np
import torch
import tifffile
from cellfinder import train, infer
warnings.filterwarnings('ignore')
@cwood1967
cwood1967 / OpeningImages.ipynb
Created May 20, 2020 20:49
Opening microscopy images in python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import pandas as pd
from holoviews import opts
import holoviews as hv
from holoviews import streams
import datashader
import xarray as xr
import hvplot.xarray
hv.extension('bokeh','matplotlib')
@cwood1967
cwood1967 / display.py
Last active August 19, 2022 15:55
Use bokeh to hover over scatter plot and display thumbnail
import pandas as pd
import autoencoder.hover as hover
from bokeh.plotting import figure, ColumnDataSource
from bokeh.models import HoverTool, ZoomInTool, ZoomOutTool
from bokeh.io import output_notebook, show
from bokeh.palettes import Spectral6, inferno
## this uses the pandas dataframe df that is already full of data
df['agc'] =agc ## this put results from clustering into the dataframe
output_notebook()
## Using tensorflow freeze graph to read a graph saved with
## tf.train.write_graph
incheck=autoencoder-2048x-10000
ingraph=saved_10000.pb
outgraph=frozen_faces_10000.pb
outnodes=decoder/Sigmoid
python -m tensorflow.python.tools.freeze_graph \
--input_graph=$ingraph \
@cwood1967
cwood1967 / min-char-rnn.py
Created March 14, 2017 16:03 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
short[] image = new short[size];
int index = 0;
for (int i = 0; i < fileBytes.length; i += 5) {
int s = 2;
int t0 = (fileBytes[i] & 0x00FF) << s;
int t1 = (fileBytes[i + 1] & 0x00FF) << s;
int t2 = (fileBytes[i + 2] & 0x00FF) << s;
int t3 = (fileBytes[i + 3] & 0x00FF) << s;
@cwood1967
cwood1967 / pom.xml
Created January 10, 2017 20:27
pom configuration
<properties>
<main-class>org.stowers.microscopy.ij1plugins.Main</main-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@cwood1967
cwood1967 / fastexp.java
Created January 9, 2017 03:14 — forked from Alrecenk/fastexp.java
Very fast accurate approximation to Math.exp in java using floating point bit hacks.
/* fast floating point exp function
* must initialize table with buildexptable before using
Based on
A Fast, Compact Approximation of the Exponential Function
Nicol N. Schraudolph 1999
Adapted to single precision to improve speed and added adjustment table to improve accuracy.
Alrecenk 2014