This file contains hidden or 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
#!/bin/bash | |
# Fernando's nuke and reinstall conda script | |
# https://twitter.com/fperez_org/status/1447996737063317512 | |
# Download and install miniconda | |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/Downloads/miniconda.sh | |
bash ~/Downloads/miniconda.sh -b -p $HOME/local/conda | |
conda config --add channels conda-forge |
This file contains hidden or 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
def match_key(key, keylist): | |
# key to match | |
key = list(key) | |
key[0] = key[0].rsplit('-', 1)[0] # remove token | |
# search for matches | |
for k in keylist: | |
temp = list(k) | |
temp[0] = temp[0].rsplit('-', 1)[0] # remove token | |
if temp == key: | |
return tuple(k) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 dask | |
import dask.array as da | |
import numpy as np | |
def _inner_axes(a_ndim, b_ndim, axes): | |
"""Given tensordot axes argument, return list of axes to sum over.""" | |
if isinstance(axes, (int, float)): | |
if axes == 0: | |
inner_axes_a = [] |
This file contains hidden or 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
def _tensordot_shape_output(a, b, axes): | |
if isinstance(axes, (int, float)): | |
if axes == 0: | |
shape_out = a.shape + b.shape | |
chunks_out = a.chunks + b.chunks | |
elif axes > 0: | |
shape_out = a.shape[:axes-1] + b.shape[axes-1:] | |
chunks_out = a.chunks[:axes-1] + b.chunks[axes-1:] | |
else: | |
axes_a, axes_b = axes |
This file contains hidden or 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 | |
import pandas as pd | |
def _find_slices(x): | |
"""An alternative to scipy.ndi.find_objects""" | |
unique_vals = np.unique(x) | |
unique_vals = unique_vals[unique_vals != 0] | |
result = {} | |
for val in unique_vals: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 math | |
import numpy as np | |
import pytest | |
def combine_slices(slices): | |
starts = [s.start for s in slices if s.start is not None] | |
stops = [s.stop for s in slices if s.stop is not None] | |
steps = [s.step for s in slices if s.step is not None] |
This file contains hidden or 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 matplotlib.pyplot as plt | |
%matplotlib inline | |
plt.errorbar( | |
[1,2,3], | |
[1,2,3], | |
yerr=[.1, .2, .3], | |
color='blue', marker='o', linestyle='dashed', | |
) | |
plt.title("Example") |
This file contains hidden or 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 html import escape | |
class HighLevelGraphHTML(): | |
def __init__(self, highlevelgraph): | |
self.highlevelgraph = highlevelgraph | |
pass | |
def _repr_html_(self): | |
highlevelgraph = self.highlevelgraph |