Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 requests | |
import pandas as pd | |
from scipy.io import loadmat | |
mat_url = 'http://ifcb-data.whoi.edu/mvco/IFCB1_2015_117_202220_class_scores.mat' | |
from tempfile import TemporaryFile | |
with TemporaryFile() as f: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from StringIO import StringIO | |
from numpy.core.defchararray import rjust, replace | |
bin_lid = 'foobar' | |
prefix = bin_lid + '_' | |
cols = scores['class2useTB'][:-1] # exclude last class: 'unclassified' | |
df = pd.DataFrame(scores['TBscores'], columns=cols) | |
p = scores['roinum'].astype(str) | |
p = replace(rjust(p,6,'0'),'0',prefix,1) | |
pid = pd.Series(p) |
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
# machinery for a progress bar | |
import uuid | |
import time | |
from IPython.display import HTML, Javascript, display | |
PB_TEMPLATE = """ | |
<div style="border: 1px solid black; width:500px"> | |
<div id="%s" style="background-color:%s; width:0%%"> </div> | |
</div> | |
""" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 tempfile | |
from IPython.core import display | |
from matplotlib import pyplot as plt | |
from skimage.io import imread, imsave | |
from skimage import img_as_float, img_as_ubyte | |
def _show_arr(arr): | |
with tempfile.NamedTemporaryFile(suffix='.png') as tf: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.