text stringlengths 3.07k 22.1k |
|---|
"""Model evaluation tools."""
import os
import sklearn
import itertools
import numpy as np
import pandas as pd
import sklearn.metrics as skmetrics
from matplotlib import pyplot as plt
from healthcareai.common.healthcareai_error import HealthcareAIError
DIAGONAL_LINE_COLOR = '#bbbbbb'
DIAGONAL_LINE_S... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2022 Scipp contributors (https://github.com/scipp)
import numpy as np
import scipp as sc
import scipy.interpolate as theirs
from scipp.interpolate import interp1d
import pytest
def make_array():
x = sc.geomspace(dim='xx', start=0.1, stop=0.4, num=10, unit='... |
# -*- coding: utf-8 -*-
# %% Imports
import numpy as np
import sympy as sp
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from aux_EcoPG import R, T
from aux_EcoPG import N, Nd, b, f, c, mi, qc, qr
from aux_EcoPG import bc_reward_subs, fc_reward_subs, q_subs
from con_Game import obtain_con_sols_G... |
import functools
import operator
import os
import os.path
import sys
import numpy as np
import scipy.special
import pytest
# Bamboo utilities
current_file = os.path.realpath(__file__)
current_dir = os.path.dirname(current_file)
sys.path.insert(0, os.path.join(os.path.dirname(current_dir), 'common_python'))
import tool... |
import copy
import numpy as np
from matplotlib import colors
from matplotlib import pyplot as plt
from yet_another_wizz.utils import load_json
from Nz_Fitting import RedshiftData
def get_region_number(*frames):
try:
# count the unique region indices in the data
regions_per_frame = [np.unique(fram... |
from mtgnlp import config
from helpers.upsert_df import upsert_df
import logging
import os
from typing import List
import pandas as pd
from sqlalchemy import create_engine, engine
import prefect
from prefect import Flow, Parameter, Task, task
from prefect.tasks.control_flow.filter import FilterTask
from prefect.engi... |
# -*- coding: utf-8 -*-
import os
import unittest
from testfixtures import TempDirectory
from .. import fs
from .. import localfs
from .. import h5fs
from .. import nxfs
from ..utils import TemporaryFilename
class test_fs(unittest.TestCase):
def setUp(self):
self.dir = TempDirectory()
def tearDown(... |
#!/usr/bin/env python
# Copyright (c) 2018-2019 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module contains a statistics manager for the CARLA AD leaderboard
"""
from __future__ import print_function
from dictor im... |
# Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... |
# importing modules to be used
import random
# Course class to save the details of course
class Course:
def __init__(self, ID, Name, Type, LecturePerWeek, LectureLength):
self.ID = ID
self.Name = Name
self.Type = Type
self.LecPerWeek = LecturePerWeek
self.LecDuration = Lect... |
# MIT License
#
# Copyright (c) 2020-2022 CNRS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... |
#! /usr/bin/env python3
"""
separate videos in a folder based on their dimensions
"""
# cSpell: word jolitp pytest miliseconds avidemux isdigit
import os
import csv
from pathlib import Path
from rich.console import Console
import snoop
# TODO move to utils module
# region debug_context ==============================... |
import copy
from datetime import datetime
import pandas as pd
import numpy as np
import warnings
import json
# noinspection PyProtectedMember
from pydoc import locate
from .events import *
from .models import EV
from .events import UnplugEvent
from .interface import Interface
from .interface import InvalidScheduleErro... |
import pdb
import math
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from unn.models.functions.embedding import ArrayEmbedding
logger = logging.getLogger('global')
class RelationAttention(nn.Module):
def __init__(self, first_app_dim, second_app_dim, app_dim, pos_dim, first_typ... |
import scipy.io as sio
import time
# import tensorflow as tf
import numpy as np
import scipy.sparse as sp
from sklearn.cluster import KMeans, SpectralClustering
from metrics import clustering_metrics
from sklearn.metrics.pairwise import euclidean_distances
from sklearn.feature_extraction.text import TfidfTransformer
fr... |
import numpy as np
import math
import matplotlib.pyplot as plt
import mplhep as hep
# Benstein polynomial calculation
def bern_elem(x, v, n):
# Bernstein element calculation
normalization = 1. * math.factorial(n) / (math.factorial(v) * math.factorial(n - v))
Bvn = normalization * (x**v) * (1 - x)**(n - v... |
import os
import json
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import random
from pathlib import Path
from conformer import ConformerBlock
from tqdm import tqdm
from torch.optim import Optimizer
from torch.optim import AdamW
from torch.optim.lr_scheduler import LambdaLR
from torch.... |
# -*- coding: utf-8 -*-
"""
Execution utilities.
"""
import multiprocessing
import concurrent.futures as cf
import subprocess
import logging
import gc
from math import floor
import os
import psutil
import shlex
from warnings import warn
from rex.utilities.loggers import LOGGERS, log_mem
from rex.utilities.exceptions i... |
from contextlib import contextmanager
from cv2 import resize
import numpy as np
import tensorflow as tf
from tensorflow import RegisterGradient
import tensorflow.keras.backend as K
from tensorflow.keras.models import load_model
# from memory_profiler import profile
import sys
from pympler import asizeof
def mem(obj,... |
from __future__ import division
from dask.distributed import Client, get_client
from sciope.utilities.priors import uniform_prior
from sciope.designs.latin_hypercube_sampling import LatinHypercube
from sciope.utilities.summarystats import burstiness as bs
import numpy as np
import sys
from sciope.utilities.dista... |
# Copyright (C) 2020 <NAME>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the ... |
#!/bin/env python
'''
Copyright (c) 2017 Quark Security, Inc. All rights reserved.
Author: <NAME> <<EMAIL>>
'''
import sys
import os
import tempfile
import shutil
import argparse
from pykickstart.parser import *
from pykickstart.version import makeVersion
import yum
class KickstartPackageResolver(object):
def _... |
import numpy as np
from PIL import Image
import cv2
import os
import math
import copy
np.set_printoptions(threshold=np.inf)
# get image
def openimage(path):
files = os.listdir(path)
img_list = {}
i = 1
for pic in files:
if pic[-3:] == 'png':
image = cv2.imread(path+pic)
... |
#!/usr/bin/env python3
import subprocess
import re, math, os, time
from pathlib import Path
from astropy.time import Time
from astropy.coordinates import SkyCoord, EarthLocation, AltAz, Angle
from astropy import units as u
from astropy.wcs import WCS
from autopa_modules import LX200
import contextlib
def adjustAltAz(... |
# Python script that processes 2N perf profiles and shows the diffs
# The first half of the profiles must belong to one configuration
# and the second hald to another configuration.
# The script cummulates the profiling samples for the two configurations
# in order to avoid fluctuations in the sampling mechanism.
# The... |
import torch
import os
from torchaudio import transforms
from torch.utils.data import TensorDataset, DataLoader
from .utils import get_fixed_train_val_test
class CLSpeechWords():
def __init__(self, root, train_batch_size, test_batch_size, n_mels=40, perc_test=0.2,
len_task_vector=0, task_vector_at... |
'''
Design metal + ligand bindin protein.
For wynton submit. Please put all protein backbone in one folder and the folder cannot contain other .pdb files.
'''
from metalprot.search import search_selfcenter
from metalprot.basic import filter
import metalprot.basic.constant as constant
from metalprot.combs import positi... |
# Copyright (c) 2010-2011 Lazy 8 Studios, LLC.
# All rights reserved.
from mako import lookup
from front import Constants, models, species_types
from front.lib import db, utils, urls
from front.data import load_json, schemas, assets
from front.models import chips
from front.models import subspecies as subspecies_modul... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Poller and support classes for git repositories with a gerrit interface.
This module can poll git repositories for commit activity without requiring a
lo... |
"""Tests the TapeHead class implementation."""
import tensorflow as tf
import unittest
from numpy.testing import assert_array_almost_equal, assert_array_equal
from .. dnc import tape_head
def suite():
"""Create testing suite for all tests in this module."""
suite = unittest.TestSuite()
suite.addTest(un... |
#!/usr/bin/env python3
from ...toolbox.technical import *
from ...main.basic.read import RawDataImport, RetrospectDataImport, GetFiles
from ...posthoc.visual.viewer import Projection
from ...troubleshoot.err.error import *
import statsmodels.api as sm
import pandas
import numpy
import math
"""
Support emmer.bake Bif... |
# Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
import re
import subprocess
import pytest
from pynput.mouse import Controller
from systa.backend.access import close_window, set_hidden
from systa.backend.monitors import SystaMonitor, enumerate_monitors
from systa.types import Point, Rect
from systa.utils import wait_for_it
from systa.windows import (
Window,
... |
import json
import logging
import threading
import time
import uuid
from functools import partial
from typing import Callable, Dict
import redis
from .com import Message, decrement_msg_id, increment_msg_id, MessageError
# An important concept to understand here is the consumer group which give us the following consu... |
#import libraries
import asyncio
import aiohttp
from itertools import islice
import json
import re
import datetime
import time
from random import sample
import pandas as pd
import async_timeout
import sys
#define proxy key
PROXY = ''
#define input index
input_index = int(sys.argv[1])
#define helper functions
def fin... |
import tkinter as tk
from tkinter import *
import os
from PIL import ImageTk, Image
import sounddevice as sd
from scipy.io.wavfile import write
def txt_Editor():
import Notepad
def Delete_screen():
screen.destroy()
def Listening_Test():
from tkinter import filedialog
fr... |
from utils import tprint, plt
import numpy as np
from scipy.stats import rankdata
import sys
from gaussian_process import SparseGPRegressor
from hybrid import HybridMLPEnsembleGP
from process_davis2011kinase import process, visualize_heatmap
from train_davis2011kinase import train
def acquisition_rank(y_pred, var_pr... |
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2020
import os
import streamsx.topology.context as context
from streamsx.topology.topology import Topology
from streamsx.topology.context import submit, ContextTypes,ConfigParams
from streamsx.topology.schema import StreamSchema
import streamsx.spl.op as op
i... |
# ========================================================================================
#
# Description:
#
# Compiles Hack ASM (assembly) code to Hack BIN (binary) code
#
# Attribution:
#
# Code by www.jk-quantized.com
#
# Redistribution and use of this code in source and binary forms must retain
# ... |
"""
parser.http.bsoupxpath module (imdb.parser.http package).
This module provides XPath support for BeautifulSoup.
Copyright 2008 <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; e... |
from tensorflow import keras as tf
import cv2
import numpy as np
from collections import Counter
from sklearn.preprocessing import LabelEncoder
import os
class Dataset:
def __init__(self, arch, path_of_dataset=None):
self.n_classes = 0
self.bad_data = []
self.X = []
self.Y = []
... |
import re
import json
import time
# This code was inspired by Jay2K1's Hangouts parser. You can see the
# blogpost for the original at:
# http://blog.jay2k1.com/2014/11/10/how-to-export-and-backup-your-google-hangouts-chat-history/
# He also runs a webservice for parsing Google Hangouts JSON files at:
# http://hango... |
"""
Home Assistant component to feed the Upcoming Media Lovelace card with
Plex recently added media.
https://github.com/custom-components/sensor.plex_recently_added
https://github.com/custom-cards/upcoming-media-card
"""
import os.path
import logging
import json
import aiohttp
import asyncio
import async_timeout
im... |
# -*- coding: utf-8 -*-
"""
Deploy a cluster. Also performs some basic checks on the
cluster pre-deployment (i.e. on the individual equipment) and post-deployment.
Example usage:
$ python deploy_cluster.py --init my_cluster_initfile.json --cluster my_cluster_description.json
"""
__copyright__ = "Copyright 2020, Datera... |
import logging
import os
import re
from typing import Dict
import pandas as pandas
import pandas as pd
import dende.platereader.analysis.fluorescence_spectrum as fs
import dende.platereader.analysis.fluorescence_spectrum.settings as fss
import dende.platereader.analysis.multichromatic_fluorescence as mf
import dende.... |
import h5py
from glob import glob
from tqdm import tqdm
import numpy as np
import pandas as pd
import dask.array as da
import os
import ipdb
import sys
import threading
from keras.utils import to_categorical
from keras.utils import Sequence
from sklearn.model_selection import StratifiedKFold
def load(img_path, inpu... |
# -*- coding: utf-8 -*-
"""
Created on Saturday September 1 1:50:00 2012
###############################################################################
#
# autoPACK Authors: <NAME>, <NAME>, <NAME>, <NAME>
# Based on COFFEE Script developed by <NAME> between 2005 and 2010
# with assistance from <NAME> in 2009 and p... |
from types import SimpleNamespace
import lxmlx.event as ev
from lxmlx.event import ENTER, EXIT, TEXT, PI, COMMENT
SPOT = 'spot' # internal event type to mark various zero-length markup
def fuse(xml1, xml2, auto_segment=True, prefer_slave_inner=True, strip_slave_top_tag=True):
nsmap = xml2.nsmap or {}
nsmap.... |
import bpy
from collections import deque, namedtuple
import os
def get_bounding_box_positions_from_blender_objects(blender_objects):
bounding_box = namedtuple('bounding_box', ('max_x', 'max_y', 'max_z', 'max_w',
'min_x', 'min_y', 'min_z', 'min_w',))
meshes = [ob.... |
"""Directives which can be used by both docutils and sphinx.
We intentionally do no import sphinx in this module,
in order to allow docutils-only use without sphinx installed.
"""
from typing import TYPE_CHECKING, Any, Dict, List
from docutils import nodes
from docutils.parsers.rst import directives as spec
from mys... |
from onegov.ballot import Candidate
from onegov.ballot import CandidateResult
from onegov.ballot import ElectionResult
from onegov.ballot import List
from onegov.ballot import ListConnection
from onegov.ballot import ListResult
from onegov.ballot import PanachageResult
from onegov.election_day import _
from onegov.elec... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 <NAME> <<EMAIL>>
#
# Distributed under terms of the BSD 3-Clause license.
"""A collection of some misc stuff.
"""
import logging as _logging
import collections as _collections
from scipy.interpolate import RectBivariateSpline as _Re... |
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import json
import logging
import numpy as np
import os
from scipy.special import logsumexp
from time import time
from __init__ import project_root
from data_handlers.data_providers import load_data_providers, DataProvider
from utils.plot_utils import disp_imdata
from utils.project_constants import IMG_DATASETS
def... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
from pathlib import Path
from pymisp import PyMISP, MISPOrganisation, MISPUser, MISPSharingGroup, MISPTag, MISPServer
import random
import string
import csv
from typing import List
from .generic_config import central_node_name, prefix_client_node, secure_conn... |
from concurrent.futures import ProcessPoolExecutor
from datetime import datetime, timedelta
from enum import Enum, EnumMeta
import json
import logging
import os
from os import PathLike
from pathlib import Path
import shutil
import sys
import tarfile
import traceback
from typing import Any, Collection, Iterable, Mapping... |
import os
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.lines import Line2D
# Set some plt and sns properties: Latex font and custom colors.
plt.rcParams["mathtext.fontset"] = "cm"
plt.rcParams["font.family"] = "STIXGeneral"
d... |
"""
Scrape https://tedsummaries.com and the relevant ted talks
All relevant information are in the static website
"""
import re
from typing import Union
from warnings import warn
import json
import requests
from time import sleep
from bs4 import BeautifulSoup
from icecream import ic
from util import *
def get_soup... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
from epics import PV
import time
NO_PARAMETERS = "__EMPTY__"
class MethodPV(PV):
def execute(self,*args):
if len(args)==0:
pars = [NO_PARAMETERS,]
else:
pars=[]
for arg in args:
pars.append(str(arg))
... |
from cogitare.data.dataholder import AbsDataHolder
from six import add_metaclass
from six.moves import zip_longest
from abc import ABCMeta
import torch
import numpy
@add_metaclass(ABCMeta)
class SequentialAbsDataHolder(AbsDataHolder):
"""
This class is an extension of :class:`~cogitare.data.AbsDataHolder` to ... |
import pickle
import socket
import numpy as np
from _thread import *
from collections import defaultdict
import coordinates as coordinate
radioMap=defaultdict(list)
radioMidMap=defaultdict(list)
fingerDistance=defaultdict()
apLength=314 #variable length: rss1,rss2,rss3,rss4,rss5,rss6
rssLength=7 #variable length: rss... |
#!/usr/bin/env python
import os
import sys
import argparse
import yaml
import subprocess
import random
import string
from pathlib import Path
def randomStringDigits(stringLength = 6):
lettersAndDigits = string.ascii_letters + string.digits
return ''.join(random.choice(lettersAndDigits) for i in range(stringLen... |
import asyncio
from contextvars import ContextVar
import logging
import os
import pickle
import re
import sqlite3
import sys
import threading
import time
from typing import Any, Callable, List, Mapping, Optional, Union
from urllib.parse import quote
import aiohttp.web
import aiosqlite
import asyncpg
import morcilla.co... |
"""Main
Author: <NAME> (<EMAIL>)
Date: 07/09/2020
"""
import sys
import random
import pygame
from paddle import Paddle
from ball import Ball
from constants import (
SCREEN_WIDTH, SCREEN_HEIGHT, VIRTUAL_WIDTH, VIRTUAL_HEIGHT,
PADDLE_SPEED, STATE_SERVE, STATE_START, STATE_PLAY, STATE_DONE, MAX_SCORE
)
from pa... |
import re
import struct
from typing import Any, BinaryIO, Dict, NamedTuple, Optional, Sequence, Tuple
from .util import music, tilesets, load_tileset, spritesets, load_spriteset, PokeImportError
from .sound import MinLibSound
from .encoders import encode_tiles
def to3b(x: int):
return x.to_bytes(3, "little")
def ... |
#!/bin/python
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import itertools
from math import log
import numpy as np
import sys
def get_item(dic, key):
try:
return dic[key]
except KeyError:
return 0
class defaultdict(dict)... |
# MIT License
#
# Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import os
import sys
import... |
import os
import torch
import numpy as np
from torch.distributions.normal import Normal
from torch.nn.functional import mse_loss
from copy import deepcopy
from rlil.environments import State, action_decorator, Action
from rlil.initializer import get_writer, get_device, get_replay_buffer
from rlil import nn
from .base i... |
#!/usr/bin/python
#
# ljdump.py - livejournal archiver
# <NAME> <<EMAIL>> https://hewgill.com/
# Version 1.5.1
#
# LICENSE
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the author be held liable for any damages
# arising from the use of this software.
#
# Permission... |
from __future__ import print_function
try:
import urllib.request as urllib_request # for Python 3
except ImportError:
import urllib2 as urllib_request # for Python 2 and Jython
try:
from urllib.parse import urlparse # for Python 3
except ImportError:
from urlparse import urlparse # for Python 2 and Jyt... |
import tkinter as tk
from tkinter import ttk
import os
import re
import sys
import time
# init
maingui = tk.Tk()
maingui.title('界面')
maingui.geometry("800x500")
maingui.resizable(False, False)
# save function
def save_func(container):
container.config(state = tk.DISABLED, background = 'LightGrey')
txt = cont... |
from data import graph
import config
import networkx as nx
import re
import pickle
import numpy as np
import scipy.io as sio
map_type = {
'author': 'a',
'paper': 'p',
'conference': 'c',
'conf': 'c',
'term': 't',
'ref': 'r',
'reference': 'r',
'business': 'b',
'location': 'l',
'u... |
#!/usr/bin/env python
import sys
if sys.version_info[0] >= 3:
import PySimpleGUI as sg
else:
import PySimpleGUI27 as sg
from time import sleep
"""
Demonstration of simple and multiple OneLineProgressMeter's as well as the Progress Meter Element
There are 4 demos
1. Manually updated progress b... |
"""
A custom Redis client for naoTimes.
Using aioredis as it's main connector
The main class wraps multiple command with some stuff that I use.
---
MIT License
Copyright (c) 2019-2021 naoTimesdev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentati... |
import os
import re
from itertools import chain
from typing import List, Set
import pytest
import requests
from pytest_bdd import given, parsers, then, when
from churchtools import ChurchToolsApi
GROUP_ID_ALLE_MITARBEITER = 172
# Fixtures for scenarios tests
@pytest.fixture
def group_context():
return []
@py... |
import torch
import nestedtensor
import utils
import torch.nn.functional as F
import sys
import random
import argparse
import itertools
import re
import csv
Benchmarks = {}
def register_benchmark(fn):
Benchmarks[fn.__name__] = fn
#
# relu
#
@register_benchmark
def relu__tensor_iter(self):
def _relu_tensor_i... |
import os
import functools
import imageio
import numpy as np
import math
from PIL import Image
import torch
from torch.utils.data import Dataset, TensorDataset
from torch import Tensor
from torch.autograd import Variable
import logging
import nltk
import sys
import matplotlib.pyplot as plt
import pickle
import datetime... |
#!/usr/bin/env python3
# https://github.com/MikeWent/webm2mp4
# https://t.me/webm2mp4bot
import os
import random
import re
import string
import subprocess
import threading
import time
import requests
import telebot
from hurry.filesize import size, alternative
# SETTINGS
TEMP_FOLDER = "/tmp/"
HEADERS = {
"User-... |
"""Train a model on SQuAD.
Author:
<NAME> (<EMAIL>)
"""
import random
from collections import OrderedDict
from json import dumps
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as data
from tensorboardX import SummaryWriter
from tqdm import tqdm
from ... |
"""Functions for querying ASF archive.
This module has utilities for querying the NASA Alaska Satellite Facility
Distributed Active Archive Center (`ASF DAAC`_). Designed to easily search for
Sentinel-1 SAR scenes load associated JSON metadata into a Geopandas Dataframe.
Notes
-----
This file contains library functio... |
# coding=utf-8
import math
import os
from ctypes import byref
import cv2
import numpy as np
import pyglet
import pyglet.image
from PIL import Image
from pyglet import gl
from pyglet.gl import GLubyte
from . import logger
from .utils import get_file_path
class Texture:
"""
Manage the caching of textures, and... |
import json
import requests
# converts json query to query string
# query = json query
# returns query string
def build_query(query):
'''Builds springer api ready string from json query
Parameters
----------
query : json
Json with the query
Returns
-------
str
String whi... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... |
import json
import os
from django.conf import settings
from django.core.files.storage import default_storage as storage
from mock import patch
from nose.tools import eq_
from pyquery import PyQuery as pq
import amo
import amo.tests
from amo.tests import assert_required, formset, initial
from amo.urlresolvers import ... |
# -*- coding: utf-8 -*-
# Copyright © 2018 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
# coding: utf-8
"""
DAQI UK
Source: https://uk-air.defra.gov.uk/air-pollution/daqi
https://uk-air.defra.gov.uk/assets/documents/reports/cat14/1304251155_Update_on_Implementation_of_the_DAQI_April_2013_Final.pdf
"""
from aqipy.utils import AQI_NOT_AVAILABLE, __round_down, __get_aqi_general_formula,... |
import argparse
from common import run, topics
from collections import defaultdict
import os
import csv
import pprint
from common import CommitDataCache
import re
"""
Example Usages
Create a new commitlist for consumption by categorize.py.
Said commitlist contains commits between v1.5.0 and f5bc91f851.
python c... |
import torch
import deepspeed
from deepspeed.runtime.utils import partition_uniform as partition
def split_tensor_along_last_dim(tensor, partitions, contiguous_split_chunks=False):
"""Split a tensor along its last dimension. Adapted from Megatron-LM.
Arguments:
tensor: input tensor.
partition... |
# -*- coding: utf-8 -*-
import vim
import itertools as it
from orgmode._vim import echom, ORGMODE, apply_count, repeat, realign_tags
from orgmode import settings
from orgmode.liborgmode.base import Direction
from orgmode.menu import Submenu, ActionEntry
from orgmode.keybinding import Keybinding, Plug
from orgmode.exc... |
import cv2
import numpy as np
from IPython.core.debugger import Tracer; keyboard = Tracer()
from scipy.interpolate import UnivariateSpline
def create_LUT_8UC1(x, y):
spl = UnivariateSpline(x, y,k=2)
return spl(xrange(256))
def _get_images_from_batches(batch):
batch_size = batch.shape[0]
img_width = b... |
#!/usr/bin/env python3
"""
Autograder tests for Part 2.
Run this script (python3 run_part2_tests.py) from the same directory as
your client.py file.
"""
import random
import traceback
import inspect
import math
from servers import StorageServer, PublicKeyServer
from crypto import Crypto
from base_client import Integ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import logging
import threading
import tellcore.constants as const
import tellcore.telldus as td
import yaml
from dotmap import DotMap
from pyaml_env import parse_config
with open('./logging.yaml', 'r', encoding='utf-8') as stream:
logging_config = yaml.... |
# encoding=utf8
import json
import re
import sys
from lxml import html
from lxml.html.clean import Cleaner
if sys.version_info[0] == 2:
from urllib import quote_plus
from urlparse import urlparse
else:
from urllib.parse import urlparse, quote_plus
allowed_tags = ('a', 'aside', 'b', 'blockquote', 'br', 'co... |
import tkinter as tk
import PIL
import cv2, os
import csv
import numpy as np
import pandas as pd
import datetime
import time
from playsound import playsound
from PIL import ImageTk, Image
from tkinter import scrolledtext
from tkinter import *
import os
window = tk.Tk()
window.title("Attendence System")
dialog_title ... |
import asyncio
import socket
import weakref
from urllib.parse import urlparse
from traitlets import Integer, TraitError, Type as _Type
from .compat import get_running_loop
class TaskPool(object):
def __init__(self):
self.pending_tasks = weakref.WeakSet()
self.background_tasks = weakref.WeakSet()... |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import torch
from torch.distributions import constraints
from torch.distributions.utils import broadcast_all
from pyro.distributions.torch_distribution import TorchDistribution
def _unsafe_standard_stable(alpha, bet... |
import collections
import numpy as np
from glob import glob
from collections import defaultdict
def _split_tags(tag):
res = []
# t1|t2|t3-t4|t5|t6
# to t1-t4, t1-t5, t1-t6, t2-t4, t2-t5, t2-t6, t3-t4, t3-t5, t3-t6
tags = tag.split('-')
assert(len(tags) <= 2), tag + ' has more than 2 parts'
if ... |
from mip import *
import numpy as np
import boto3
import requests
from datetime import datetime
from celery import shared_task
from celery.result import AsyncResult
from django.core.files.temp import NamedTemporaryFile
from django.core.files import File
from asgiref.sync import async_to_sync
from channels... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.