text stringlengths 8.04k 46.5k |
|---|
'''
Open Source Initiative OSI - The MIT License:Licensing
Tue, 2006-10-31 04:56 - nelson
The MIT License
Copyright (c) 2009 BK Precision
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 ... |
# -*- coding: utf-8 -*-
#
# 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 writing, software
... |
# Copyright 2017-2020 typed_python 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
import collections
import json
import sys
import warnings
import pandas as pd
from TM1py.Objects.Process import Process
from TM1py.Objects.Server import Server
if sys.version[0] == '2':
import httplib as http_client
else:
import http.client as http_client
def get_all_servers_from_adminhost(adminhost='local... |
import torch
import torch.nn as nn
from torch.nn import init
import functools
# import numpy as np
import gc
###############################################################################
# Helper Functions
###############################################################################
def get_norm_layer(norm_type='... |
#!/usr/bin/env python3
import calendar
import json
import yaml
from enum import Enum
from io import StringIO
from contextlib import redirect_stdout
from typing import Any, Dict, List, Optional, Tuple, Union
from jsonargparse_tests.base import *
from jsonargparse.actions import _find_action
from jsonargparse.util impor... |
import math
from .EmbConstant import *
class Transcoder:
def __init__(self, settings=None):
if settings is None:
settings = {}
self.max_stitch = settings.get("max_stitch", float('inf'))
self.max_jump = settings.get("max_jump", float('inf'))
self.full_jump = ... |
"NLP data loading pipeline. Supports csv, folders, and preprocessed data."
from ..torch_core import *
from .transform import *
from ..basic_data import *
from ..data_block import *
__all__ = ['LanguageModelLoader', 'SortSampler', 'SortishSampler', 'TextBase', 'TextDataset', 'TextMtd', 'TextFileList',
'pad_c... |
"""
Module for generating lists of frames using frame features, pca, kmeans, etc.
"""
import attr
import cattr
import itertools
import logging
import numpy as np
import random
from time import time
from typing import Dict, List, Optional, Tuple
import cv2
from sklearn.decomposition import PCA
from sklearn.cluster i... |
# regression y=Xw using block sparse Bayesian learning framework
#
# {y,X} are known, and w is assumed to be 'sparse' or 'block sparse'
# the indices of the non-zero blocks can be either known or unknown
#
# Authors: <NAME> <<EMAIL>>
# License: BSD 3 Clause
#
# For the BSBL-BO algorithm:
#
#@article{zhang2013extension,... |
# mobimol v0.6 for s60, a simple molecule viewer, (c) V.Ganesh, GPL
from math import sin,cos,acos,pi,sqrt
import appuifw,e32,sysinfo,string,dir_iter
from sysinfo import *
from appuifw import *
from e32 import *
from key_codes import *
from os.path import *
radii = {"H":0.23, "C":0.77, "N":0.75, "O":0.73, \
"S... |
from yamtof import collocation
import re
import casadi
import inspect
import collections
# symbolic variable naming scheme:
# flag/phase/name
# flag/phase/name[/index]
# flags:
# D - phase durations
# T - trajectory interior
# S - trajectory start
# E - trajectory end
# V - phaseless variable
# P - phaseless paramete... |
import os, sys, subprocess, site
from pathlib import Path
from python_helper import Constant, log, StringHelper, SettingHelper
class AttributeKey:
KW_API = 'api'
KW_NAME = 'name'
KW_EXTENSION = 'extension'
KW_DEPENDENCY = 'dependency'
KW_LIST = 'list'
KW_WEB = 'web'
KW_LOCAL = 'local'
... |
# -*- coding: utf-8 -*-
import locale
import logging
import math
import random
import os.path
import sys
import time
import string
from . import get_version
from . import utils
from .baseline import BaselineModel, AnnotationCorpusWeight, \
MorphLengthCorpusWeight, NumMorphCorpusWeight, FixedCorpusWeight
from .exce... |
#!/usr/bin/env python3
"""
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
Copyright (c) 2020 Juniper Networks, Inc.
All rights reserved.
"""
__appname__ = "sonicwall-parser.py"
__version__ = "v1"
__license__ = "GNU GPL 3.0 or later"
__developer__ = "<NAME>"
# Module Declarations
import re
from netaddr i... |
__all__ = ['to_itk_image', 'to_point_set', 'to_geometry', 'vtkjs_to_zarr', 'zarr_to_vtkjs']
import itk
import numpy as np
def is_arraylike(arr):
return hasattr(arr, 'shape') and \
hasattr(arr, 'dtype') and \
hasattr(arr, '__array__') and \
hasattr(arr, 'ndim')
# from IPython.core.debugger... |
import math
import torch
from torch.autograd import Variable
from ..utils import function_factory
from .. import beta_features, settings
class LazyVariable(object):
def __init__(self, *args, **kwargs):
self._args = args
self._kwargs = kwargs
@property
def _args(self):
return self.... |
"""An offline label visualizer for Scalable file.
Works for 2D / 3D bounding box, segmentation masks, etc.
"""
import argparse
import concurrent.futures
import copy
import io
import os
import sys
import urllib.request
from dataclasses import dataclass
from threading import Timer
from typing import Dict, List, Optiona... |
import time
import multiprocessing as mp
import psutil
import torch
from collections import deque
import math
from rlpyt.runners.base import BaseRunner
from rlpyt.utils.quick_args import save__init__args
from rlpyt.utils.logging import logger
from rlpyt.utils.collections import AttrDict
from rlpyt.utils.seed import s... |
# Copyright (C) 2021, QuantStack
# SPDX-License-Identifier: BSD-3-Clause
"""
Module that does most of the heavy lifting for the ``conda build`` command.
"""
from __future__ import absolute_import, division, print_function
import fnmatch
import io
import os
from os.path import isdir, isfile, join
import shutil
import ... |
import asyncio
import copy
import csv
import math
import queue
import threading
import uuid
import warnings
from datetime import datetime
from typing import List, Optional, Union, Callable, Coroutine, Iterable
import pandas
import pytz
from .dtypes import _termination_obj, Event
from .flow import Flow, Complete
from ... |
# Licensed under the MIT license.
'''tracer graphic user interface by wx'''
#pylint: disable=no-member,import-outside-toplevel,relative-beyond-top-level,too-many-instance-attributes,too-many-locals,too-many-branches,too-many-statements,too-many-return-statements,protected-access,no-name-in-module,too-few-public-methods... |
"""Algorithms for fixed effect absorption."""
import abc
import itertools
import functools
from typing import Callable, List, Optional, Tuple
import numpy as np
import scipy.linalg
import scipy.sparse
import scipy.sparse.linalg
from .utilities import Array, Groups, identify_singletons, max_norm_convergence
class A... |
from enum import Enum
from typing import Optional, List
import logging
import tensorflow as tf
from tensorflow.contrib.rnn import static_rnn, static_bidirectional_rnn
from tensorflow.contrib.framework import arg_scope
import tfsnippet as spt
from tfsnippet.bayes import BayesianNet
from tfsnippet.utils import (instance... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""auto_py_torrent.
This module provides utilities to download a torrent within specific types.
"""
# Author: <NAME>
# URL: https://github.com/ocslegna/auto_py_torrent
# Please do not download illegal torrents or torrents that you do not have
# permission to own.
# ... |
import unittest, inspect, json
from .context import WDL
class TestEval(unittest.TestCase):
def test_expr_render(self):
# types
self.assertEqual(str(WDL.parse_expr("false")), "false")
self.assertEqual(str(WDL.parse_expr("1")), "1")
self.assertEqual(str(WDL.parse_expr("1.1")), "1.1")
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) University of St Andrews 2020-2021
# (c) University of Strathclyde 2020-2021
# Author:
# <NAME>
# Contact
# <EMAIL>
# <NAME>,
# Biomolecular Sciences Building,
# University of St Andrews,
# North Haugh Campus,
# St Andrews,
# KY16 9ST
# Scotland,
# UK
# The MIT Li... |
import unittest
from quads import (
euclidean_compare,
euclidean_distance,
Point,
BoundingBox,
QuadNode,
QuadTree,
)
from . import test_data
class UtilsTestCase(unittest.TestCase):
def test_euclidean_compare(self):
comp = euclidean_compare(Point(0, 0), Point(4, 5))
self.a... |
'''
Soft Actor-Critic version 2
using target Q instead of V net: 2 Q net, 2 target Q net, 1 policy net
add alpha loss compared with version 1
paper: https://arxiv.org/pdf/1812.05905.pdf
https://github.com/quantumiracle/SOTA-RL-Algorithms
'''
import random
import gym
import numpy as np
import time
import torch
impor... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#pylint: disable=
"""
File : reader.py
Author : <NAME> <<EMAIL>>
Description: Reader for uproot
Access file via xrootd
xrdcp root://cms-xrd-global.cern.ch/<lfn>
for example:
xrdcp root://cms-xrd-global.cern.ch//store/data/Run2017F/Tau/NANOAOD/31Mar2018-v1/2... |
#!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm, ListedColormap,BoundaryNorm
import numpy as np
import datetime as dt
import sys, os, pickle, time
from scipy.ndimage.filters import gaussian_filter
import pandas as pd
#from mpl_toolkits... |
# Original code by:
# <NAME> <<EMAIL>>
# Copyright 2004 <NAME> and <NAME>
#
# Subsequent changes:
# The Matplotlib development team
# Copyright The Matplotlib development team
"""
This module provides functionality to add a table to a plot.
Use the factory function `~matplotlib.table.table` to create a re... |
# Zen Tetris - Tetris clone with two-player battle mode
# Uses Python arcade library: https://arcade.academy/index.html
# Background images are from https://pixabay.com/
# Sound data are from 魔王魂 at https://maoudamashii.jokersounds.com/
import arcade
from arcade import Matrix3x3
import random
import os
import timeit
... |
import timeout_decorator
from numbers import Number
from tribool import Tribool
from .query import Query, verify_sql_str, generate_sql_str
from .proto.duoquest_pb2 import TRUE, UNKNOWN, FALSE, COUNT, SUM, MIN, MAX, \
AVG, NO_SET_OP, INTERSECT, EXCEPT, UNION, EQUALS, NEQ, LIKE, IN, NOT_IN, \
BETWEEN, OR, NO_AG... |
#!/usr/bin/env python3
import requests
import pytz, datetime, dateutil.parser
import jinja2, markdown, html
import collections
import argparse, sys, os
import pyshorteners
import pyshorteners.exceptions
from .liteshort import Shortener as lss
import random
import subprocess
import tweepy
import pprint
import json
from... |
from __future__ import print_function
from crypto import decrypt, load_key
import sys
import os
import argparse
import subprocess
import tempfile
import json
import socket
import unicodedata
import tempfile
try:
import winreg
except ImportError:
import _winreg as winreg
class Options(object):
''' Contains... |
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers as tfkl
from tensorflow.keras.mixed_precision import experimental as prec
import common
def get_angles(pos, i, d_model):
angle_rates = 1 / np.power(10000, (2 * (i//2)) / np.float32(d_model))
return pos * angle_rates
def position... |
import argparse
import json
import logging
import os
import pprint
from collections import Counter, defaultdict, namedtuple
from dataclasses import dataclass
from itertools import chain
from typing import Any, Callable, Dict, List, Tuple
import numpy as np
import torch
from scipy.stats import entropy
from sklearn.me... |
"""Handle requests sent by Echo
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference
The requests are JSON formatted as:
{
"version": "string",
"session": {
"new": boolean,
"sessionId": "string",
"application": {
"applicationId": "string"
... |
import copy
from sdmxthon.model.base import InternationalString, LocalisedString, \
Annotation
from sdmxthon.model.component import Component, Dimension, TimeDimension, \
Attribute, PrimaryMeasure
from sdmxthon.model.definitions import DataStructureDefinition, \
DataFlowDefinition, ContentConstraint, DataK... |
# -*- encoding:utf-8 -*-
# 网易云音乐dlna推送
# Sparkle
# v2.1
import gzip
import re
import os
import sys
import json
import getopt
import time
import socket
import select
import traceback
import signal
from contextlib import contextmanager
py3 = sys.version_info[0] == 3
if py3:
from urllib impor... |
##################### generated by xml-casa (v2) from concateovsa.xml ###############
##################### cdf0275a4ed32b7fdcd90e799b22f760 ##############################
from __future__ import absolute_import
from casashell.private.stack_manip import find_local as __sf__
from casashell.private.stack_manip import find... |
import logging
from collections import OrderedDict
import copy
from datetime import datetime
from sqlalchemy import case, func, and_
from dataactcore.interfaces.db import GlobalDB
from dataactcore.interfaces.function_bag import get_time_period, get_certification_deadline
from dataactcore.models.domainModels import CG... |
from os.path import join
import numpy as np
import pandas as pd
import geopandas as gpd
import matplotlib.pyplot as plt
from src import utils as cutil
def convert_non_monotonic_to_nan(array):
"""Converts a numpy array to a monotonically increasing one.
Args:
array (numpy.ndarray [N,]): input array
... |
import collections
import logging
import os
import pathlib
import re
import types
import lxml
import lxml.etree
TWINCAT_TYPES = {}
USE_FILE_AS_PATH = object()
logger = logging.getLogger(__name__)
def _register_type(cls):
'Decorator to register a TwincatItem-based class'
TWINCAT_TYPES[cls.__name__] = cls
... |
#!/usr/bin/env python
# coding=utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import time
import sys
import os
import re
import json
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "lib"))
from splunklib.client import StoragePassword, Service
from splunklib.s... |
import pronoun_detect_2 as pd2
import json
import os
import urllib.request
import etri
import argparse
import socket
import struct
from urllib.parse import quote
import urllib.request
import re
NER_dic = {'PERSON': 0, 'TIME': 1, 'LOCATION' : 2, 'ORGANIZATION' : 3, 'EVENT': 4, 'ETC' : 5}
description = "[--input_path]... |
'''
Key take-away: feature engineering is important. Garbage in = Garbage Out
'''
from cleanData import cleanData
import time
import sys
plotBool = int(sys.argv[1]) if len(sys.argv)>1 else 0
resampleDataBool = int(sys.argv[2]) if len(sys.argv)>2 else 1
MISelectorBool = int(sys.argv[3]) if len(sys.argv)>3 else 0
star... |
#!/usr/bin/env python3
"""
Multivariate commutative polynomials.
"""
import os
from functools import reduce
import operator
from random import randint, shuffle, seed
import numpy
from bruhat.argv import argv
from bruhat.util import cross, factorial, choose, determinant
from bruhat.theta import divisors
if argv.fast... |
# Copyright 2020 DeepMind Technologies Limited. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
from flask import render_template,request, url_for, jsonify, redirect, Response, send_from_directory
from app import app
from app import APP_STATIC
from app import APP_ROOT
import json
import numpy as np
import pandas as pd
import os
import re
# from kmapper import KeplerMapper, Cover
from .kmapper import KeplerMapper,... |
# coding: utf-8
import sys
from python_environment_check import check_packages
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from matplotlib.colors impor... |
from basicgeo import P2, Along, I1
from math import sqrt
def RightSideHorizonSlice(p, hizin, hizout):
if p.v <= hizin.v and p.v <= hizout.v:
return hizin.u > hizout.u
if p.v > hizin.v and p.v > hizout.v:
return hizout.u > hizin.u
lam = (p.v - hizin.v) / (hizout.v - hizin.v)
hizu = Alon... |
# Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
import os
import torch
import torch.nn as nn
import shutil
import torch.nn.functional as F
from sklearn.cluster import KMeans
# from spherecluster import SphericalKMeans
import numpy as np
import random
import ipdb
def get_random_recover_index(num):
list_rand = list(range(num))
random.shuffle(list_rand)
l... |
from flask import render_template, request, session, flash, redirect, url_for, jsonify, abort, make_response, g
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import select
from sqlalchemy.engine import result
from colixpress_api import app, db, auth
from colixpress_api.tables import fournisseurs, villes, sui... |
#!/usr/bin/env python
"""the main thing"""
# built in imports
from shutil import copyfile
import argparse
import os
import datetime as dt
# 3rd party imports
import torch
from torch.utils.data import DataLoader
from pytorch_lightning import Trainer, seed_everything
from pytorch_lightning.callbacks import EarlyStoppin... |
""" Core ingredients for RL algorithms.
Author: <NAME> (<EMAIL>)
based on: Spinning Up's Vanilla Policy Gradient
https://github.com/openai/spinningup/blob/master/spinup/algos/pytorch/vpg/core.py
"""
import numpy as np
import scipy.signal
from gym.spaces import Box, Discrete
import abc
import torch
i... |
# Copyright © 2019 Province of British Columbia
#
# 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 agree... |
import os
import sys
import time
import datetime
import argparse
import json
import threading
import contextlib
import pkg_resources
import logging
import ctypes
import inspect
import torch
import justdeepit
import threading
import uvicorn
import traceback
from fastapi import FastAPI, Request, Form, BackgroundTasks
fro... |
import io as sysio
import time
import numba
import numpy as np
from scipy.interpolate import interp1d
from det3d.ops.nms.nms_gpu import rotate_iou_gpu_eval
from det3d.core.bbox import box_np_ops
from det3d.datasets.utils.eval import box3d_overlap_kernel
from det3d.datasets.utils.eval import box3d_overlap
from det3d.d... |
"""plotting.py: functions for visualizing insar products
"""
from __future__ import division, print_function
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.widgets import Slider
import matplotlib.dates as mdates
from apertools.log imp... |
"""Plotting functions for decoders."""
import copy
import matplotlib.animation as animation
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import numpy as np
import os
import pandas as pd
import pickle
from behavenet import make_dir_if_not_exists
from behaven... |
import itertools
import re
from tornado.httpclient import (HTTPError as HTTPClientError)
import mimetypes
import asyncio
from tornado.ioloop import IOLoop
import time
from .constants import (NB_TYPE,UNTITLED_FILE,FOLDER_SEPERATOR,UNTITLED_NB,UNTITLED_FOLDER,CHECKPOINT_NAME)
from tornado.web import HTTPError as HTTPSer... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 16 11:13:37 2021
@author: dv516
"""
import numpy as np
import pickle
import pyro
pyro.enable_validation(True) # can help with debugging
pyro.set_rng_seed(1)
from algorithms.PyBobyqa_wrapped.Wrapper_for_pybobyqa import PyBobyqaWrapper
from algorithms.Bayesian_opt_Pyro.... |
# Copyright 2020 Google 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 writing, ... |
from collections import namedtuple
from typing import Optional, List
import matplotlib.pyplot as plt
import numpy as np
from flatland.core.env_observation_builder import ObservationBuilder
from flatland.core.grid.grid4_utils import get_new_position
from flatland.envs.agent_utils import TrainState
from flatland.envs.ra... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 27 17:12:11 2016
@author: konop
Support for extracting 3d patches similar to extract patches 2d from scikit-learn
"""
import numbers
import numpy as np
from sklearn.utils import check_array, check_random_state
from numpy.lib.stride_tricks import as_strided
from itertoo... |
import os
import shutil
import stat
from time import sleep
from string import Template
import subprocess
from hardhat.util import hash_file, matches_hash, Object, \
open_file, read_process_async, save_url
from hardhat.environment import runtime_env, environment_strip_lto
from hardhat.tarball import Tarball
from har... |
#!/bin/env python
def co2_emissions(yr, escheme):
from scipy.interpolate import interp1d
import numpy as np
## historical emissions
time = np.arange(1764, 2006, step=1)
emit_hist = [0,0.003,0.003,0.003,0.003,0.003,0.003,0.004,0.004,0.004,0.004,0.004,0.004,0.004,0.004,0.004,0.004,
... |
"""
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2019 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
------------------------------------... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# $Id: test_nodes.py 6351 2010-07-03 14:19:09Z gbrandl $
# Author: <NAME> <<EMAIL>>
# Copyright: This module has been placed in the public domain.
"""
Test module for nodes.py.
"""
import sys
import unittest
import types
import DocutilsTestSupport # must be... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2012-2018 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This example demonstrates a simple web server providing visualization of data
from a MCC 172 DAQ HAT device for a single client. It makes use of the Dash
Python framework for web-based interfaces and a plotly graph. To install the
dependencies for this example, run:
... |
#
# BitBake (No)TTY UI Implementation
#
# Handling output to TTYs or files (no TTY)
#
# Copyright (C) 2006-2012 <NAME>
#
# SPDX-License-Identifier: GPL-2.0-only
#
from __future__ import division
import os
import sys
import logging
import progressbar
import signal
import bb.msg
import time
import fcntl
import struct
i... |
# -*- coding: utf-8 -*-
import datetime
import re
import dateparser
import scrapy
from scraper.items import BroadMeasurementCategory, MeasurementCategory, Measurement, Agency, Mission, Instrument
# Patch for gcos links in XML doc
def remove_gcos_links(links):
new_links = []
remove_link = 'gcos.wmo.int'
... |
"""Models of signal-chain systematics.
This module defines several models of systematics that arise in the signal chain, for
example bandpass gains, reflections and cross-talk.
"""
import numpy as np
import warnings
from typing import Dict, Tuple, Union
from scipy import stats
from scipy.signal import blackmanharris... |
"""
Specific algorithms to compute cardinality of elliptic curves over a finite field
Since point counting now uses PARI/GP, this code is only used when a
specific algorithm was specified or when the j-invariant lies in a
subfield.
AUTHORS:
- <NAME> (2008-2009): Original point counting code
- <NAME> (2017-2018): Re... |
import math
import torch
import warnings
import matplotlib.pyplot as plt
import torch.nn.parallel as parallel
from typing import Union, Tuple, List, Optional, Callable
from .._model import Model
class LossModule(torch.nn.Module):
"""
A wrapper around the module of the model that evaluates the loss
in the ... |
# This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) <NAME>.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
import re
from collections import OrderedDict
from functools imp... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Random vibration theory (RVT) based motions."""
import numpy as np
from scipy.stats import linregress
from scipy.interpolate import interp1d
from . import peak_calculators
DEFAULT_CALC = 'V75'
def sort_increasing(*args):
"""Sort arrays such that they are increasing... |
# import the library
import difflib
import pickle
import zlib
import datetime
from appJar import gui
import json
from pathlib import Path
import os
import urllib.request
from time import sleep
import sqlite3
from sqlite3 import Error
import requests
from os import listdir
from os.path import isfile, join
import re
from... |
"""
gui.py : DarkTurk - A Mechanical Turk training program for Darknet
Copyright 2018 Valkka Security Ltd. and <NAME>.
Authors: <NAME> <<EMAIL>>
This file is part of the Darknet python bindings
Valkka cpp examples is free software: you can redistribute it and/or modify
it under the terms of the MIT License.
T... |
from scene import *
from menu import MenuScene
import random
import sound
import ui
import json
A = Action
# This game engine is based on Q Learning (a form of Reinforcement Learning)
# GUI version for Pythonista
#
# Mar 2018
# Modified to account for the 8-fold symmetry of the board by mapping all board symmetries ... |
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import boto3
from boto3 import resource
from botocore.client import ClientError
import uuid
import logging
import os
#from datetime import date
#from datetime import time
from datetime import datetime
impor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import time
import netCDF4 as nc
import matplotlib.pylab as pl
from scipy.interpolate import interp2d
from mpl_toolkits.basemap import Basemap
import operator
import datetime as dt
from matplotlib.patches import Rectangle
# Personal librari... |
#!BPY
"""
Name: 'GAMX IPO KF Check & Auto-Fix'
Blender: 247
Group: 'Animation'
Tooltip: 'Checks IPOs for simultaneous, grouped, etc. and provides capabilities to fix broken IPOs before export to GAMX asset manifest file (.gamx)'
"""
__author__ = "<NAME>"
__url__ = ("http://gewizes.sourceforge.net/")
__version__ = "0.5... |
import math
from typing import List, Optional
import torch
from torch import nn
from torch.nn import functional as F
from torch.optim.lr_scheduler import LambdaLR
import math
def get_linear_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, min_lr=1e-6, last_epoch=-1):
# this scheduler will us... |
"""
Copyright: <NAME> 2017-2018
Author: <NAME>
Email: <EMAIL>
Created Date: May 8th 2018
Updated Date: Aug 29th 2018
Load frames with specified filter in given directories,
and provide inheritable API for specific loaders.
- Added BasicLoader and QuickLoader (multiprocessor loader)
- Will BatchLoader (and Loader)
"""
... |
#!/usr/bin/python
import hashlib
import logging
import numpy
import re
import base64
from django.http import Http404
from django.db import models
from gibbs import constants
from gibbs import formula_parser
from gibbs import conditions
#from django.core.files.base import ContentFile
import json
from util.thumbnail im... |
import os
import time
import yaml
import pygame
import random
import numpy as np
# Vehicle directions
COMPASS = {
"N": (0, -1),
"E": (1, 0),
"S": (0, 1),
"W": (-1, 0),
"X": (0, 0)
}
# Keeps info on all onjects, currently: (grid ID, cost)
#Each entry contains: id, cost, color (r, g, b)
'''
INFO... |
import os, glob, logging
import xarray as xr
import param
import numpy as np
import panel as pn
import cartopy.crs as ccrs
from adhmodel.simulation.dat_reader import get_variable_from_file_name
from genesis.util import Projection
from genesis.ui_util.map_display import DisplayRangeOpts, ColormapOpts
from adhmodel.simu... |
import numpy as np
import transformations
import math
import os
import logging
from scipy.spatial import KDTree
from utils import vec_angel_diff, dist_in_range
# TODO this should be specified in a configuration file
LAST_FINGER_JOINT = 'finger_2_joint_1'
# TODO this should be defined in a super module
class InvalidT... |
#!/usr/bin/env python
'''
Usage: ./eval.py model_checkpoint_file [val_start_index, val_stop_index]
model_checkpoint_file: Path of the checkpoint
optional val_start/stop_index: Only use validation images between these indexes
(Useful for GNU-parallel etc.)
'''
import glob
import... |
import argparse
import configargparse
import functools
import inspect
import logging
import sys
import tempfile
import types
import unittest
if sys.version_info >= (3, 0):
from io import StringIO
else:
from StringIO import StringIO
# enable logging to simplify debugging
logger = logging.getLogger()
logger.le... |
#
# This file is part of Bakefile (http://bakefile.org)
#
# Copyright (C) 2008-2013 <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 limita... |
import tensorlayerx as tlx
from tensorlayerx.nn.layers import Conv2d, ZeroPad2d, MaxPool2d, ReLU
import numpy as np
class FrozenBatchNorm2D(tlx.nn.Module):
def __init__(self, backbone_bn_shape, eps=1e-5, **kwargs):
super().__init__(**kwargs)
self.eps = eps
self.weight = self._get_weights(... |
"""
OCR-D CLI: workspace management
.. click:: ocrd.cli.workspace:workspace_cli
:prog: ocrd workspace
:nested: full
"""
import os
from os import getcwd
from os.path import relpath, exists, join, isabs
from pathlib import Path
from json import loads
import sys
from glob import glob # XXX pathlib.Path.glob doe... |
#!/usr/bin/env python
# Python 2/3 compatabilty and color printer
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import re
import json
import subprocess # for Bash interface
import io
import time
try:
import queue
except ImportError:
import Queue as queue
im... |
import os
import random
import time
import cv2
import shutil
import argparse
from multiprocessing.dummy import Pool
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.data import DataLoader, Dataset
from torchsummary import summary
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.