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 Graphics.Element exposing (show) | |
import List | |
import Regex | |
import Dict exposing (Dict) | |
import String | |
import Random | |
import Array | |
import Set | |
-- Return list with no duplicate elements |
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 Html exposing (Html, Attribute, text, toElement, fromElement, div, input, textarea) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (on, targetValue, onClick, onDoubleClick) | |
import Signal exposing (Address) | |
import StartApp as StartApp | |
import String | |
import Graphics.Element exposing (spacer, color, show) | |
import Color exposing (..) | |
import Dict exposing (Dict) | |
import Maybe exposing (withDefault) |
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 matplotlib.colors import ListedColormap | |
import matplotlib.pyplot as plt | |
import numpy as np | |
%matplotlib inline | |
# Manuall add Viridis colormap | |
viridis = ListedColormap(_viridis_data, name='viridis') | |
viridis_r = ListedColormap(viridis.colors[::-1]) #reversed | |
def updatePosition(position, direction): |
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
execfile('viridis.py') | |
from matplotlib.colors import ListedColormap | |
import matplotlib.pyplot as plt | |
import numpy as np | |
%matplotlib inline | |
from PIL import Image | |
def image2array(filename): | |
im = Image.open('logo.jpg') |
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
execfile('/home/bioage/utils/utils.py') | |
import xmltodict #https://github.com/martinblech/xmltodict | |
drugbank_xml_file = "path/to/xml/file" | |
drugbank_json_file = "path/to/json/file" # save json here | |
drugbank_csv_file = "path/to/csv/file" # save csv here | |
# Convert XML to JSON and save | |
drugbank_dict = xmltodict.parse(read_file(drugbank_xml_file)) # takes around 6 minutes | |
write_file(drugbank_json_file, json.dumps(drugbank_dict)) |
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 Html exposing (Html, Attribute, text, toElement, fromElement, div, span, input, textarea) | |
import Html.Attributes exposing (placeholder, value, style) | |
import Html.Events exposing (on, targetValue, onClick, onDoubleClick, onMouseDown) | |
import Signal exposing (Address) | |
import String | |
import Array exposing (Array) | |
import Json.Decode as Json | |
import StartApp as StartApp | |
import Dict exposing (Dict) |
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 hashlib | |
def create_block(parent_block, value, hashfunc): | |
""" ------------------------------------------------ | |
String -> Block -> (Block -> String) -> Block | |
------------------------------------------------ | |
Produce a new block from a string value and a hash | |
of its parent block. In this case, a block is also a string. | |
""" |
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 Time exposing (Time) | |
import Graphics.Element exposing (show, image) | |
import Graphics.Collage exposing (collage, path, solid, traced, defaultLine, toForm, move) | |
import Signal | |
import Window | |
import Color exposing (..) | |
import String | |
duration = 60 * 5 | |
multiplier = 0.95 |
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 | |
import numpy as np | |
%matplotlib inline | |
x = np.arange(256).astype(np.uint8) | |
y = np.array(map(lambda x: np.unpackbits([x]).sum(), x)) | |
figsize(10,5) | |
plt.step(x,y,'k', linewidth = 1) | |
plt.axis([-2,257,0,8.2]) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.