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 dask.distributed import Client | |
client = Client("tcp://127.0.0.1:8786") | |
print(client) | |
import dask | |
# generate random timeseries of data | |
df = dask.datasets.timeseries( |
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
### GET DASK CLIENT ### | |
import os | |
import coiled | |
cluster = coiled.Cluster(os.environ.get("COILED_CLUSTER_NAME")) | |
cluster.adapt() | |
client = cluster.get_client() | |
print("dask client:", client) | |
### USER CODE FOLLOWS ### |
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
print("Hello from Python!") |
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 coiled | |
cluster = coiled.Cluster(...) | |
# this will send long-lived Application Default Credentials, with the OAuth scope needed for GEE | |
coiled.credentials.google.send_application_default_credentials(cluster, scopes=["https://www.googleapis.com/auth/earthengine"]) | |
# plugin to init GEE on each worker | |
from distributed.diagnostics.plugin import WorkerPlugin |
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 pandas as pd | |
import requests | |
raw = requests.get("https://spot-bid-advisor.s3.amazonaws.com/spot-advisor-data.json").json() | |
ranges = {r["index"]: r["label"] for r in raw["ranges"]} | |
flat = [] | |
for region in raw["spot_advisor"].keys(): | |
for instance in raw["spot_advisor"][region]["Linux"].keys(): | |
savings = raw["spot_advisor"][region]["Linux"][instance]["s"] |
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
""" | |
Script to make a labels dataset from a "tracking" h5 file. | |
> python tracking_h5_to_sleap.py path/to/tracking.h5 path/to/video.mp4 | |
""" | |
import h5py | |
import numpy as np | |
from sleap import Labels, LabeledFrame, PredictedInstance, Skeleton, Video | |
from sleap.instance import Track |
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 sleap import Labels | |
SCORE_THRESHOLD = 10 | |
filename = "tests/data/json_format_v2/centered_pair_predictions.json" | |
out_filename = "tests/data/json_format_v2/centered_pair_predictions.high_scores.json" | |
labels = Labels.load_file(filename) | |
lf_inst_list = [] |
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
""" | |
Outputs diagnostic information to help with debugging SLEAP installation. | |
""" | |
print_to_screen = False | |
output_text = "" | |
def print_(text=""): | |
global output_text |
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 attr | |
import os | |
import curses | |
from math import pi, cos, sin | |
import time | |
import random | |
@attr.s(auto_attribs=True) | |
class Board(object): |