Skip to content

Instantly share code, notes, and snippets.

View jni's full-sized avatar

Juan Nunez-Iglesias jni

View GitHub Profile
@jni
jni / save_dataframe.py
Created September 21, 2018 08:52
Minimal example attempting to save dataframe from Bokeh selection
import pandas as pd
import numpy as np
from bokeh.server.server import Server
from bokeh.application import Application
from bokeh.application.handlers.function import FunctionHandler
from bokeh.plotting import figure
from bokeh.layouts import widgetbox, layout
from bokeh.models import ColumnDataSource
from bokeh.models.widgets import Button
@jni
jni / Chap 1 dub 2.ipynb
Created March 31, 2018 23:09 — forked from capissimo/Chap 1 dub 2
Chpater 1 from Elegant SciPy (rev 2)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jni
jni / save_selection.py
Created September 25, 2018 07:17
attempt to save csv of selection from bokeh plot (not working)
"""Run this example as: python save_selection.py
Then navigate to localhost:5000
Use python save_selection.py -h for more options.
"""
import base64
import pandas as pd
import numpy as np
@jni
jni / programming-languages-in-ADS.ipynb
Last active July 6, 2018 04:35
Counting programming language mentions in astronomy papers
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jni
jni / karabiner.json
Last active November 13, 2017 02:26
Karabiner configuration file
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@jni
jni / tksyncplot.py
Created February 23, 2017 01:29
Tkinter asyncio matplotlib crash: long-running async tasks using matplotlib and launched by a tkinter GUI
import asyncio
import matplotlib
matplotlib.use('TkAgg')
import tkinter as tk
from tkinter import ttk
from skimage._shared._tempfile import temporary_file
import numpy as np
@asyncio.coroutine
@jni
jni / gist:5083fa78229ab0278a2e
Created October 29, 2014 03:15
Fiji Crash Yosemite
Process: ImageJ-macosx [1330]
Path: /Applications/Fiji.app/Contents/MacOS/ImageJ-macosx
Identifier: org.fiji
Version: 1.0
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: ImageJ-macosx [1330]
User ID: 501
Date/Time: 2014-10-29 14:12:22.191 +1100
@jni
jni / parking map.ipynb
Created February 23, 2016 22:14 — forked from manugarri/parking map.ipynb
Where the f*** can I park?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jni
jni / example-run.py
Created October 29, 2013 13:54
Example gala run
# run this from $GALADIR/tests
# This script was used to generate the matched random forest and training data for regression testing.
# However, the training data do not get reproduced between this run and a test run, presumably because
# of some problem setting the random state.
import numpy as np
from gala import imio, classify, features, agglo, evaluate as ev
gt_train, pr_train, p4_train, ws_train = map(imio.read_h5_stack, ['example-data/train-gt.lzf.h5', 'example-data/train-p1.lzf.h5', 'example-data/train-p4.lzf.h5', 'example-data/train-ws.lzf.h5'])
gt_test, pr_test, p4_test, ws_test = map(imio.read_h5_stack, ['example-data/test-gt.lzf.h5', 'example-data/test-p1.lzf.h5', 'example-data/test-p4.lzf.h5', 'example-data/test-ws.lzf.h5'])
fm = features.moments.Manager()
@jni
jni / tosi.py
Last active December 24, 2015 23:19
print numbers in engineering notation
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# copied with modifications from http://stackoverflow.com/a/15734251/224254 by @scls
import math
def to_si(d):
incPrefixes = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
decPrefixes = ['m', 'µ', 'n', 'p', 'f', 'a', 'z', 'y']