Skip to content

Instantly share code, notes, and snippets.

View jeffbaumes's full-sized avatar

Jeff Baumes jeffbaumes

View GitHub Profile
from pymongo import MongoClient
client = MongoClient()
aggregation = [
{
"$set": {
"collection_date.has_date_value": {
"$dateFromString": {
"dateString": "$collection_date.has_raw_value",
},
@jeffbaumes
jeffbaumes / test.md
Last active February 23, 2023 14:16
  graph TD;
      A(A);
      A-->B;
      A-->C;
      B-->D;
      C-->D;
      D-->A;
      D-->C;
 D-->B;
source,target
1,2
2,3
3,4
4,5
4,6
4,7
7,2
7,3
7,4
@jeffbaumes
jeffbaumes / superpixels-to-annotation.py
Created November 16, 2021 21:05
superpixels-to-annotation.py
import sys
def superpixels_to_annotation(chunk_size, input_filename):
output_file_prefix = '.'.join(input_filename.split('.')[:-1])
with open(input_filename) as input_file:
elements = []
chunk = 0
for line in input_file:
output_line = ','.join(
[f'[{val},0]' for val in line.strip().split(' ')[3:]])
@jeffbaumes
jeffbaumes / config.json
Last active February 4, 2020 18:05
Janelia demo
{
"markdown": {
"visible": true,
"value": "# Hemibrain connectome\n\nThis is a 2D representation of the traced neurons in the <a href=\"https://www.janelia.org/project-team/flyem/hemibrain\">fly hemibrain connectome</a> (<a href=\"https://creativecommons.org/licenses/by/4.0/\">CC-BY</a>). Each dot represents a neuron, and each neuron is connected to other neurons through synapses. The links between neurons were used to position the neurons using a network layout algorithm. The size of each dot corresponds to the number of connections to other neurons. Hover over a neuron to see its well-connected neighbors (with 20 or more joint connections), which will be highlighted in yellow.\n\nThe color represents a value for each neuron. The default value is the brain region where the highest number of the neuron's connections reside. You may change the coloring with one of these options:\n\n* None: No coloring.\n* connections: The number of connections in the full unfiltered network.\n* degree: The number of
export default {
name: 'Farming',
items: [
{
name: 'Wheat',
color: 'goldenrod',
icon: 'barley',
cost: [],
},
{
@jeffbaumes
jeffbaumes / main.styl
Last active November 14, 2018 11:02
Updating Vuetify font
@import '~vuetify/src/stylus/settings/_variables'
$body-font-family = 'Barlow Condensed', sans-serif
$heading-font-family = 'Barlow Condensed', sans-serif
$headings = {
h1: { size: 112px, weight: 300, line-height: 1, letter-spacing: -.04em, font-family: $heading-font-family },
h2: { size: 56px, weight: 400, line-height: 1.35, letter-spacing: -.02em, font-family: $heading-font-family },
h3: { size: 45px, weight: 400, line-height: 48px, letter-spacing: normal, font-family: $heading-font-family },
h4: { size: 34px, weight: 400, line-height: 40px, letter-spacing: normal, font-family: $heading-font-family },
h5: { size: 24px, weight: 400, line-height: 32px, letter-spacing: normal, font-family: $heading-font-family },
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeffbaumes
jeffbaumes / seaborn_regression_functions.py
Created June 18, 2018 12:49
Pulling out seaborn regression plotter methods into utility functions
def fit_regression(x, y, n_boot=1000, units=None, ci=95, order=1, logistic=False, lowess=False, robust=False, logx=False):
"""Fit the regression model."""
# Create the grid for the regression
x_min, x_max = [x.min(), x.max()]
grid = np.linspace(x_min, x_max, 100)
# Fit the regression
if order > 1:
yhat, yhat_boots = fit_poly(x, y, ci, grid, order, n_boot, units)
elif logistic:
@jeffbaumes
jeffbaumes / nb_open.ipynb
Created June 8, 2018 12:00
nb_open function for reading and writing files using Jupyter contents manager
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.