text stringlengths 957 885k |
|---|
# -*- coding: utf-8 -*-
"""Functional tests using WebTest.
See: http://webtest.readthedocs.org/
"""
import pytest
import responses
import json
from datetime import datetime
from comport.department.models import Department, Extractor
from comport.data.models import OfficerInvolvedShootingIMPD, UseOfForceIncidentIMPD, C... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
/***************************************************************************
iso4app
A QGIS plugin
iso4app nuovo path
-------------------
begin : 2018-02-07
git sha : $... |
<filename>util/MatrixLDPC.py
#
# This file is used to construct the sparse matrices needed for the MatrixLDPC
# implementation, from the specifications in the 802.11n-2009 standard.
#
import numpy
def outputCpp(rowPtrs, cols, vals, n, rateNumerator, rateDenominator):
print "#define CODE%d_RATE_%d_%d_NUM_ROWS %... |
import sys
import time
import threading
import re
import requests
import traceback
from typing import List
from datetime import (date, datetime)
from .model.finacial_history import (FinancialHistory, History, Row, Period)
from .parser import Parser
from bs4 import (BeautifulSoup, Tag)
from random import randint
# FIE... |
<reponame>helyx-rterry/solutions-geoprocessing-toolbox
# Patrol Report (from XML) to Table
#-------------------------------------------------------------------------------
# Copyright 2010-2013 Esri
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with t... |
<reponame>sourabh-bhide/tissue2cells
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import matplotlib.pyplot as plt
import tissue2cells as tc
import os
import os.path
import ipywidgets as widgets
w = widgets.Select(
options=['Area','concentration_myo','DV_asymmetry', 'Ventral_fraction', 'offset',
'sum_myo... |
<reponame>Erwanp-python-game/Evolve
import pygame
from pygame.locals import *
import pickle
from OpenGL.GL import *
from OpenGL.GLU import *
verticies = (
( 1, -1, -1), # 0
( 1, 1, -1), # 1
(-1, 1, -1), # 2
(-1, -1, -1), # 3
( 1, -1, 1), # 4
( 1, 1, 1), # 5
(-1, -1, 1), # 6
(-1, ... |
#!/usr/bin/env python
'''make-rt-struct-assessor.py
Read in an RT-STRUCT DICOM file. Write out an icr:roiCollectionData assessor.
Usage:
make-rt-struct-assessor.py PROJECT SUBJECT_ID SESSION_LABEL NEW_LABELS
Options:
PROJECT Project of parent session
SUBJECT_ID ID of... |
'''
Base tasks for generic point-to-point reaching
'''
import numpy as np
from collections import OrderedDict
import time
import os
import math
import traceback
from riglib.stereo_opengl.primitives import Sphere, Cube
####### CONSTANTS
sec_per_min = 60.0
RED = (1,0,0,.5)
GREEN = (0,1,0,0.5)
GOLD = (1., 0.843, 0., 0.... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function
import os
import warnings
import json
import copy
import re
from astropy.extern import six
from astropy.extern.six import BytesIO
import astropy.units as u
import astropy.coordinates as coord
import astropy.table as ... |
'''
Source codes for Python Machine Learning By Example 2nd Edition (Packt Publishing)
Chapter 5: Classifying Newsgroup Topic with Support Vector Machine
Author: Yuxi (<NAME>
'''
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.datasets import fetch_20newsgroups
from nltk.corpus import names
fr... |
<reponame>danvergara/pyblock
import pickle
import os
import sys
import base64, codecs, json, requests
import time as t
from pblogo import *
from cfonts import render, say
def clear(): # clear the screen
os.system('cls' if os.name=='nt' else 'clear')
def rectangle(n):
x = n - 3
y = n - x
[
pr... |
#!/usr/bin/env python3
#
# tcl_env.py
# TCL environment for RL algorithms
#
# Author: <NAME>
import random
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import gym
# Trying out if this works for others. from gym import spaces had some issues
import gym.spaces as spaces
imp... |
import requests
import time
import datetime
# seconds split into days, hours, minutes and seconds.
def split_seconds(seconds):
# Dict for storing days, hours, minutes and seconds.
split_time = {
'days': 0,
'hours': 0,
'minutes': 0,
'seconds': 0
}
# Convert seconds to d... |
from django.core.management.base import BaseCommand, CommandError
from directory.models import CipherSuite, Rfc
from os import linesep
from requests import get
import re
class FailedDownloadException(Exception):
pass
class Command(BaseCommand):
help = 'Scrapes TLS cipher suites from iana.org'
# definitio... |
<filename>python/jupyter_notebooks/pwcal_hsa.py
import numpy as np
import pandas as pd
import pyarrow
from multiprocessing import Pool
from collections import Counter
from itertools import repeat
import scipy.stats as st
def __get_ptws(ids, pathways_db, go_terms_db):
'''Get list of patways/terms based on gene IDs'... |
<gh_stars>1-10
#/*
#Python and Tkinter Programming
#<NAME>
#ISBN: 1884777813
#Publisher: Manning
#*/
from tkinter import *
SQUARE = 1
ROUND = 2
ARROW = 3
POINT_DOWN = 0
POINT_UP = 1
POINT_RIGHT = 2
POINT_LEFT = 3
STATUS_OFF = 1
STATUS_ON = 2
STATUS_WARN = 3
STATUS_ALARM = 4
STATUS_SET ... |
import json
import uuid
from django.urls import reverse
from django.test import TestCase, override_settings
from django.utils.crypto import get_random_string
from zentral.contrib.inventory.models import EnrollmentSecret, MachineSnapshot, MetaBusinessUnit, Tag, MachineTag
from zentral.contrib.munki.models import Configu... |
<filename>webca/webca/crypto/test_extensions.py
"""
Test the extensions functions.
"""
from cryptography import x509
from django.test import TestCase
from OpenSSL import crypto
from . import certs, extensions
class KeyUsage(TestCase):
"""Test the extensions functions."""
def test_empty(self):
"""Key... |
#!/usr/bin/env python
import sys
import numpy as np
import time
from optparse import OptionParser
import logging
def normalize(A):
column_sums = A.sum(axis=0)
new_matrix = A / column_sums[np.newaxis, :]
return new_matrix
def inflate(A, inflate_factor):
return normalize(np.power(A, inflate_factor))
d... |
"""
code adapted from:
https://github.com/upura/featureTweakPy
"""
import copy
from typing import Dict, List, Union
import numpy as np
import pandas as pd
import sklearn
import xgboost
import xgboost.core
from carla.recourse_methods.api import RecourseMethod
from carla.recourse_methods.catalog.focus.parse_xgboost im... |
from typing import Tuple
import numpy as np
from scipy.fftpack import dct, idct
from PIL import Image
class SpreadSpectrumWatermarking:
"""
<NAME>., <NAME>., <NAME>., & <NAME>. (1997).
Secure spread spectrum watermarking for multimedia. IEEE Transactions on Image
Processing, 6(12), 1673–1687. doi:10.... |
import argparse
import sys
import glob
import math
import numpy as np
import os
import shutil
import subprocess
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import re
import time
import timeit
from datetime import datetime
import logging
#Set up command line parser
parser = argparse.Argument... |
<gh_stars>1-10
"""Ensemble methods that create consensus calls from multiple approaches.
This handles merging calls produced by multiple calling methods or
technologies into a single consolidated callset. Uses the bcbio.variation
toolkit: https://github.com/chapmanb/bcbio.variation and bcbio.variation.recall:
https://... |
<filename>Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/cms/djangoapps/course_creators/tests/test_views.py
"""
Tests course_creators.views.py.
"""
from unittest import mock
from django.core.exceptions import PermissionDenied
from django.test import TestCase
from django.urls import revers... |
"""
Kypher queries over KGTK graphs.
"""
import sys
import os.path
import io
import re
import time
import pprint
import sh
from odictliteral import odict
import kgtk.kypher.parser as parser
import kgtk.kypher.sqlstore as ss
from kgtk.value.kgtkvalue import KgtkValue
pp = pprint.PrettyPrinter(indent=4)
### TO ... |
<filename>lib/postgap/MeSH.py
#! /usr/bin/env python
"""
Copyright [1999-2018] EMBL-European Bioinformatics Institute
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/licen... |
<filename>taw_rlg_rest/TawRlgRest.py
from __future__ import print_function
import requests
import time
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
from xlsxwriter.utility import xl_rowcol_to_cell
from xm... |
#!/usr/bin/env python
import os
import time
import traceback
from argparse import ArgumentParser
import numpy as np
from tqdm import tqdm
import tensorflow as tf
from utils import (configure_logging, load_checkpoint, load_image_names,
load_images, load_model)
def parse_arguments():
parser = Ar... |
#!/usr/bin/env python3 -u
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the 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 c... |
import gym
from gp_gym import gen_init_pop, select, run_ep_while_not_done, IFLTE
class CartPole:
"""
This class implements a GP agent for the CartPole-v0 gym environment.
"""
def __init__(self, info):
self.env_name = info["env_name"]
# Program structure
self.p_type = info["pr... |
import warnings
from sklearn.exceptions import ConvergenceWarning
warnings.filterwarnings("ignore", category=ConvergenceWarning)
import numpy as np
from scipy.sparse import csr_matrix
import array as ar
from multiprocessing import Process
import time
from datetime import datetime
from sklearn.model_selection import... |
import shutil
import unittest
from mock import MagicMock
import bilby
class TestUltranest(unittest.TestCase):
def setUp(self):
self.maxDiff = None
self.likelihood = MagicMock()
self.priors = bilby.core.prior.PriorDict(
dict(a=bilby.core.prior.Uniform(0, 1),
... |
import numpy as np
import math
# (numpy array格式)稠密矩阵 转 稀疏矩阵
def sparse(data):
if type(data) == list:
data = np.array(data,ndmin=2)
elif data.ndim == 1:
data = np.array(data,ndmin=2)
data = data.transpose()
sparse_matrix = []
for i in range(data.shape[0]):
for j in ... |
def incorrect_login_data():
print("Combination of login and password is incorrect")
def print_error(message):
print("Error: " + message)
def print_no_permission(permission_name):
print_error("you have no " + permission_name + " permission for this file")
def print_usage(command, synoptics, description... |
import heapq
import random
import time
import multiprocessing
import pygame
import math
import Queue
class PriorityQueue:
def __init__(self):
self.elements = []
def empty(self):
return len(self.elements) == 0
def put(self, item, priority):
heapq.heappush(self.elements, (priority,... |
import urllib2, re, getpass
##DETERMINE WHICH DB
db_name = "2014_comp10120_x2"
user_name = "mbax4hw2"
passW = "<PASSWORD>"
print "Scraping Manchester"
domain = "https://secure.manchester.gov.uk"
cgiAddr ="/site/custom_scripts/events_search.php"
searchURL = "?searchresults=yes&dateType=anydate"
searchURL += "&date=&star... |
from __future__ import division
from past.utils import old_div
import math
import astropy.units as astropy_units
import numpy as np
from scipy.special import erfcinv, erf
from astromodels.functions.function import Function1D, FunctionMeta, ModelAssertionViolation
deg2rad = old_div(np.pi,180.)
rad2deg = old_div(18... |
__author__ = '<NAME>'
__email__ = '<EMAIL>'
# Import modules
import checkvalue as cv
class Clock(object):
def __init__(self, start_time=0.0, end_time=3.0, dt_outer=1.e-1, dt_inner=1.e-2):
self._positions = ['START', 'PREVIOUS_OUT', 'PREVIOUS_IN', 'CURRENT', 'FORWARD_IN_OLD', 'FORWARD_OUT',
... |
# Copyright (c) 2021 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: <NAME> <<EMAIL>>
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Callable, AbstractSet, Any
import dataclasses
import math
import numpy as np
from numpy.typing import NDArray
impo... |
<reponame>bit-bcilab/SiamDCA
import numpy as np
import tensorflow as tf
import keras.backend as K
from tracker.BaseTracker import BaseSiamTracker, change, sz
from training.Augmentation import random_crop
from tracker.BoxDecoder import ltrb_decoder
from utils.grid import generate_grid
from utils.image impor... |
# Template project parameter file VLBAContPipe
# Generate parameter file using VLBACal.VLBAMakeParmFile
#
# Substitutions surrounded by 'at' characters
# PROJECT Project name (up to 12 char)
# SESSION Session code
# BAND Band code
# UVFITS Name of uvfits file in $FITS
# IDIFITS List of IDIFITS f... |
<filename>angr-management/angrmanagement/logic/threads.py
import thread
import threading
from PySide.QtCore import QEvent, QCoreApplication
from . import GlobalInfo
class ExecuteCodeEvent(QEvent):
def __init__(self, callable, args=None):
super(ExecuteCodeEvent, self).__init__(QEvent.User)
self.... |
"""
raven.handlers.logging
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import datetime
import logging
import sys
import traceback
from raven.base import Client
from raven.utils.e... |
"""
Adapted from https://github.com/kuangliu/pytorch-cifar/blob/master/models/preact_resnet.py
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
import pandas as pd
from numbers import Number
from .layers import Conv2d
from .base import RegressionModel, ClassificationMode... |
# Copyright (c) Facebook, Inc. and its affiliates.
# 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.
import argparse
import logging
import os
import sys
import threading
from dataclasses import asdict
from pprint i... |
import pytest
import pandas as pd
from primrose.transformers.combine import left_merge_dataframe_on_validated_join_keys
from testfixtures import LogCapture
from primrose.transformers.combine import LeftJoinDataCombiner
def test_left_merge_dataframe_on_validated_join_keys():
corpus = pd.read_csv("test/minimal.csv"... |
import re
from terra_sdk.client.lcd import LCDClient
from terra_sdk.client.lcd.params import PaginationOptions
from terra_sdk.key.mnemonic import MnemonicKey
terra = LCDClient(
url="https://pisco-lcd.terra.dev/",
chain_id="pisco-1",
)
pagOpt = PaginationOptions(limit=1, count_total=True)
mk1 = MnemonicKey(
... |
<gh_stars>0
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple
from ax.core.observation import Observatio... |
<reponame>RizaXudayi/VarNet
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 31 17:04:47 2018
-------------------------------------------------------------------------------
=============================== VarNet Library ================================
-------------------------------------------------------------... |
<gh_stars>0
"""
Copyright 2018 <NAME>
The University of California, Berkeley
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions ... |
<gh_stars>1-10
import json
import math
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
import numpy
from pyproj import Proj
from shapely.geometry.point import Point
from ncdjango.exceptions import ConfigurationError
from ncdjango.utils import projec... |
<filename>py/moma/effectors/cartesian_6d_velocity_effector.py
# Copyright 2020 DeepMind Technologies Limited.
#
# 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/li... |
# 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" file accompa... |
<reponame>emilhe/dash
import json
import operator
import pytest
from dash import Dash, Input, Output, html, dcc, callback_context
from dash.exceptions import PreventUpdate, MissingCallbackContextException
import dash.testing.wait as wait
from selenium.webdriver.common.action_chains import ActionChains
def test_cbc... |
<reponame>Tharun24/IRLI<gh_stars>0
from config import train_config as config
import tensorflow as tf
import glob
import argparse
import time
import numpy as np
import logging
from utils import _parse_function, _parse_function_dense
try:
from util import topK
except:
print('**********************CAN... |
<reponame>walsidalw/opencast-stats-app<filename>influxclient.py
"""
The Apereo Foundation licenses this file to you under the Educational
Community 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://opensource.org/lic... |
import cairo
import colorsys
TITLE_HEIGHT = 25
EVENT_LABEL_HEIGHT = 20
SAMPLE_HEIGHT = 40
COLOUR_BLACK = (0.1,0.1,0.1)
COLOUR_WHITE = (1,1,1)
LABEL_X_OFFSET = 4
LABEL_OFFSET_Y = 4
TEXT_SIZE_LABEL = 13
TEXT_SIZE_TITLE = 17
TEXT_SIZE_DURATION = 10
TEXT_LABEL_DURATION_OFFSET_Y = 20
TEXT_SIZE_EVENT_LABEL = 10
EVENT_LA... |
<gh_stars>1-10
from selectolax.parser import Node as sNode
from selectolax.parser import HTMLParser
__version__ = '0.0.3'
html_tags = [
"figcaption",
"blockquote",
"textarea",
"progress",
"optgroup",
"noscript",
"fieldset",
"datalist",
"colgroup",
"summary",
"section",
... |
<gh_stars>1-10
from __future__ import print_function
from sympy import symbols, sin, cos, sinh, cosh, trigsimp, S
from galgebra.printer import Format, xpdf, Get_Program, Print_Function
from galgebra.ga import Ga
def Product_of_Rotors():
Print_Function()
(na,nb,nm,alpha,th,th_a,th_b) = symbols('n_a n_b n_m alph... |
<gh_stars>1-10
'''
Custom tags. Make sure you register new custom tags at the bottom.
'''
import bs4
from inline_markdown import inline_markdown_parser, soup
src_options = ["url", "href", "src", ""]
def _get_src(tagline):
opts = tagline["options"]
link = ""
for key in src_options:
if key in opts... |
<filename>src/AB3DMOT/evaluation/evaluate_kitti3dmot.py
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
import matplotlib; matplotlib.use('Agg')
import sys, os, copy, math, numpy as np, matplotlib.pyplot as plt
from munkres import Munkres
from collections import defaultdict
try:
... |
<filename>codenerix_pos/urls.py
# -*- coding: utf-8 -*-
#
# django-codenerix-pos
#
# Codenerix GNU
#
# Project URL : http://www.codenerix.com
#
# 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
#... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 3 17:44:51 2017
@author: <NAME>
"""
#from math import sqrt
#from mpl_toolkits.mplot3d import Axes3D
from pose_sim import *
if __name__ == '__main__':
#camera position in world coordinates
x = 0.
y = -0.8
z = 2.
# Create a camera
cam = Cam... |
# -*- coding: utf-8 -*-
"""
Holds the code for cleaning out unwanted tags from the lxml
dom xpath.
"""
import copy
from .utils import ReplaceSequence
class DocumentCleaner(object):
def __init__(self, config):
"""Set appropriate tag names and regexes of tags to remove
from the HTML
"""
... |
<gh_stars>0
#!usr/bin/python
# -*- coding: utf-8 -*-
#
import os
import sys
import json
import unittest
def isOneMesh(plyPath):
u"""
ワンメッシュモデルかどうかを判定
"""
# ハイフンが無かったらワンメッシュモデル
return plyPath[-6] != "-"
def getCharacterId(plyPath):
u"""
plyのキャラID部を取得
ex : p000
"""
filename = os.path.... |
from __future__ import print_function
import os
import argparse
import torch
import torch.backends.cudnn as cudnn
import numpy as np
from data import cfg
from layers.functions.prior_box import PriorBox
from utils.nms_wrapper import nms
# from utils.nms.py_cpu_nms import py_cpu_nms
import cv2
from models.faceboxes impor... |
from jesse.helpers import get_candle_source, slice_candles
import talib
import numpy as np
from typing import Union
import math
from numba import njit
def ef(candles: np.ndarray, lp_per: int = 10, hp_per: int = 30, f_type: str = "Ehlers", normalize: bool = False, source_type: str = "close", sequential: bool = Fa... |
import os
import profile
import time
import threading
import configparser
import controller
controller = controller.Control()
working_path = os.path.dirname(os.path.abspath(__file__)) + "/queue"
class thread_working(threading.Thread):
def __init__(self, threadID, name, stopper):
threading.Thread.__init__... |
import unittest
import mock
from ioteclabs_wrapper.core.access import get_labs_dal, LabsDAL
from ioteclabs_wrapper.core.exceptions import LabsBadRequest, LabsException, LabsNotAuthenticated, \
LabsPermissionDenied, LabsResourceNotFound, LabsAPIException
class TestLabsDalPrivateCall(unittest.TestCase):
def ... |
<reponame>Nicolas-Lefort/conv_neural_net_time_serie
# convolutional neural net, time serie classification, stocks
# as expected, the model performed poorly (random walk ?), but we saw a
# possible way to treat a multivariate time serie classification problem
# improvement: labeling, wavelet transform
import pandas as ... |
<gh_stars>0
from unittest.mock import patch
from .test_base import BaseTestCase
from .test_data import (invalid_facebook_token, invalid_google_token, invalid_twitter_tokens,
one_twitter_token, social_reg_data, social_reg_no_email_data)
from authors.apps.authentication.social_registration import... |
<reponame>bogatyy/cs224d
import numpy as np
import random
from q2_sigmoid import sigmoid, sigmoid_grad
# First implement a gradient checker by filling in the following functions
def gradcheck_naive(f_and_grad, x):
"""
Gradient check for a function f
- f_and_grad should be a function that takes a single a... |
"""
Ethereum Virtual Machine (EVM) Block Instructions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. contents:: Table of Contents
:backlinks: none
:local:
Introduction
------------
Implementations of the EVM block instructions.
"""
from ethereum.base_types import U256
from .. import Evm
from ..gas ... |
"""
Example demonstrating usage of :py:meth:`simulation.simulation_tumor_growth_brain`:
- forward simulation
- 2D test domain from brain atlas, 4 tissue subdomains + 'outside'
- spatially heterogeneous parameters, as defined in simulation.simulation_tumor_growth_brain
- no displacement bc between 'outside' and othe... |
#------------------------------------------------------------------------------#
# fortnet-python: Python Tools for the Fortnet Software Package #
# Copyright (C) 2021 - 2022 <NAME> #
# #
# See th... |
<gh_stars>1-10
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from lcquad_test import Orchestrator
from learning.classifier.svmclassifier import SVMClassifier
from parser.lc_qua... |
"""
File name: evaluate_models_performance.py
Author: <NAME>
Date created: 21.05.2018
This is the main script to evaluate models performance. It reads the implementation
and path options from the config.yml script. It loads the training and test sets,
loads the specified trained model(s) and calculates the training ... |
# Data extracted using: https://ij.imjoy.io/
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from scipy.signal import argrelextrema
from scipy.constants import pi as π
import uncertainties as unc
from uncertainties import ufloat
distanceSS,grayValueSS = np.loadtxt(r"2021.11.18 D... |
<filename>transtory/shanghaimetro/trainstats.py
import os
import time
from sqlalchemy import func
from .configs import logger
from .publicdata import ShmPublicDataApp, get_public_data_app
from .dbdefs import Route, Departure, Arrival
from .dbdefs import Train, TrainType, Line
from .dbops import ShmDbOps, get_shm_db_o... |
<reponame>entn-at/clari_wavenet_vocoder
# coding: utf-8
from __future__ import with_statement, print_function, absolute_import
import math
import librosa
import numpy as np
from hparams import hparams
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
from waven... |
# from https://github.com/ronghuaiyang/arcface-pytorch/blob/master/models/metrics.py
# adacos: https://github.com/4uiiurz1/pytorch-adacos/blob/master/metrics.py
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd
... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Helpers to plot the lightcurve of a TESS subject, given a
LightCurveCollection
"""
# so that TransitTimeSpec can be referenced in type annotation in the class itself
# see: https://stackoverflow.com/a/49872353
from __future__ import annotations
import inspect
import warnings
f... |
<reponame>vishalbelsare/ade
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ade:
# Asynchronous Differential Evolution.
#
# Copyright (C) 2018-19 by <NAME>,
# http://edsuom.com/ade
#
# See edsuom.com for API documentation as well as information about
# Ed's background and other projects, software and otherwise.
#
# ... |
import numpy as np
def iou(coord_a, coord_b):
x1_a, y1_a, x2_a, y2_a = coord_a
x1_b, y1_b, x2_b, y2_b = coord_b
x_overlap = max(0, min(x2_a, x2_b) - max(x1_a, x1_b))
y_overlap = max(0, min(y2_a, y2_b) - max(y1_a, y1_b))
intersection = x_overlap * y_overlap
union = (x2_a - x1_a) * (y2_a - y1_... |
#
# Copyright <NAME> 2013
#
"""
Code to deal with MEME and MEME file formats.
"""
import biopsy
from Bio import SeqIO
from itertools import chain
from collections import defaultdict
def name_matcher(name):
"Create a function that matches strings in lower case"
name = name.lower()
def matcher(other):
... |
<gh_stars>0
from datetime import datetime
import pytz
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.executors.pool import ProcessPoolExecutor
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
from cryton.etc import config
from cryton.lib.util import logger
SCHED_MAX... |
_codes = (
( 200, 'Thunderstorm', 'Thunderstorm with light rain', '11d' ),
( 201, 'Thunderstorm', 'Thunderstorm with rain', '11d' ),
( 202, 'Thunderstorm', 'Thunderstorm with heavy rain', '11d' ),
( 210, 'Thunderstorm', 'Tight thunderstorm', '11d' ),
( 211, 'Thunderstorm', 'Thunderstorm', '11d' ),
... |
<reponame>lschmelzeisen/wikidata-history-analyzer
#
# Copyright 2021 <NAME>
#
# 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 requi... |
# coding=utf-8
__author__ = "<NAME>"
# Taken and adapted from:
# https://github.com/khammernik/sigmanet/blob/master/reconstruction/common/mytorch/models/sn.py
import numpy as np
import torch
def matrix_invert(xx, xy, yx, yy):
det = xx * yy - xy * yx
return yy.div(det), -xy.div(det), -yx.div(det), xx.div(det)... |
import gc
import time
import logging
import aiohttp
import asyncio
import socket
import pytest
from aiohttp.test_utils import TestServer
import aioamqp
import aioamqp.channel
import aioamqp.protocol
import aiohttp.web
import asyncpg
from docker.client import DockerClient
from docker.utils import kwargs_from_env
from as... |
import functools
import subprocess
try:
# This fails when the code is executed directly and not as a part of python package installation,
# I definitely need a better way to handle this.
from adbe.output_helper import print_error, print_error_and_exit, print_verbose
except ImportError:
# This works whe... |
<filename>server/auvsi_suas/views/odlcs.py<gh_stars>0
"""Odlcs view."""
from PIL import Image
import io
import json
import logging
import os
import os.path
import re
from auvsi_suas.models.gps_position import GpsPosition
from auvsi_suas.models.mission_config import MissionConfig
from auvsi_suas.models.odlc import Odlc
... |
<reponame>lovyan03/esp-idf<gh_stars>1000+
"""
Command line tool to assign tests to CI test jobs.
"""
import argparse
import errno
import json
import os
import re
import yaml
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader as Loader # type: ignore
import gitlab_api
from ti... |
#!/usr/bin/env python
"""
Toytree viewer.
Created Jan 2021
Copyright (C) <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 yo... |
"""Utilities for training the dependency parser.
You do not need to read/understand this code
"""
import time
import os
import logging
from collections import Counter
from general_utils import get_minibatches
from q2_parser_transitions import minibatch_parse
import numpy as np
P_PREFIX = '<p>:'
L_PREFIX = '<l>:'
UN... |
"""
tests that obiwan runs end to end and get reasonalbe outputs for varietry of
cases. Travis CI runs this script
"""
from __future__ import print_function
if __name__ == "__main__":
import matplotlib
matplotlib.use('Agg')
import unittest
import run_200x200_pixel_regions as tools
#from run_200x200_pixel_regio... |
import wpilib
from wpilib import XboxController
from wpilib import SpeedControllerGroup
from wpilib.command import Command
from wpilib.command import Subsystem
from wpilib.drive import DifferentialDrive
from wpilib.interfaces import GenericHID
from wpilib.interfaces import SpeedController
from wpilib.smartdashboard imp... |
<filename>inventory/accounts/admin.py
# -*- coding: utf-8 -*-
#
# inventory/accounts/admin.py
#
"""
Accounts admin.
"""
__docformat__ = "restructuredtext en"
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
from d... |
<filename>codegen_workspace/detection2onnx.py<gh_stars>0
import torch
import sys
# import os
# sys.path.append(os.environ["HOME"]+"/vision/")
import torchvision # https://pytorch.org/vision/stable/models.html
from pathlib import Path
from torch.onnx import TrainingMode
import onnx
import argparse
import warnings
get_m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.