text stringlengths 6.04k 39.5k |
|---|
#!/usr/bin/python
# This file will handle everything to do with sound
import speech_recognition as sr
import pyaudio
import subprocess
import os
from threading import Thread, ThreadError, Event
from base64 import b64encode
import wave
from math import ceil
from chaslib.sound.input import WaveReader
from chaslib.misc... |
from .ControlCommon import *
import subprocess
import sys
import re
import glob
try:
from .Jobs import *
except ImportError:
JobsControl = None
def complete_job_id(prefix, parsed_args, **kwargs):
arcconf = get_parsed_arcconf(parsed_args.config)
return JobsControl(arcconf).complete_job(parsed_args)
... |
# -*- coding: utf-8 -*- #?????
'Copyright (c) 2019 <NAME>, All Rights Reserved.'
import time
import ctcsound #kernel
from ctcsound import * #The kernel
from random import randint # :)
import json
import nltk #word processing
from nltk import word_tokenize #tokens from strings
import os
import os.path #File containguren... |
from print_handler import printer, screen_handler, verbose
import asyncio, websockets, logger, threading, sys, os, psutil, pin_controll, updater, usb_player, json
from time import sleep
from datetime import datetime, timedelta
import print_handler, inspect
from os import path, remove
ws = None
ip="localhost"
port = 69... |
# Modifications Copyright 2018 Anonymous Authors. All Rights Reserved.
# Copyright 2017 The TensorFlow Authors. 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:/... |
import datetime
import json
import logging
import os
import requests
import time
import multiprocessing
from multiprocessing import pool
from multiprocessing.pool import ThreadPool
from typing import List
import boto3
from cache import cache
from CodePackage import CodePackage
def invoke(tid, idx, url, json_data):... |
# -*- coding: utf-8 -*-
# pylint: disable-msg=R0921
# pylint-version = 0.7.0
#
# Copyright 2005 <NAME> or his licensors, as applicable
#
# 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
#
# ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 26/11/19
@author: <NAME>
"""
import numpy as np
import scipy.sparse as sps
from Base.DataIO import DataIO
from Data_manager.DataReader_utils import reconcile_mapper_with_removed_tokens, remove_features
from Data_manager.data_consistency_check import asser... |
from datetime import datetime
from os import name
import time
import random
import pandas as pd
import pyqtgraph as pg
from collections import deque
from pyqtgraph.Qt import QtGui, QtCore
from mintsXU4 import mintsSensorReader as mSR
from mintsXU4 import mintsDefinitions as mD
from mintsXU4 import mintsProcessing as mP... |
from conans import ConanFile, CMake, tools, AutoToolsBuildEnvironment, RunEnvironment, python_requires
from conans.errors import ConanInvalidConfiguration, ConanException
from conans.tools import os_info
import os, re, stat, fnmatch, platform, glob, traceback, shutil
from functools import total_ordering
# if you using... |
import argparse
import csv
from collections import defaultdict
from get_schema import build_schema, build_schema_from_desc, build_schema_from_str_table
import tensorflow as tf
from tensorflow import keras
import json
from keras.models import Sequential
from keras.layers import Dense
import multiprocessing as mp
# impor... |
import types
from types import ModuleType
from typing import Any, Callable, List, Mapping, Optional, Tuple, Union
import importlib
import inspect
import json
import os
import pickle
import random
import re
import string
import sys
from keyword import iskeyword
from pathlib import Path
import arrow
import commandlib
i... |
###################
# 0. General Setup:
###################
import sqlite3
import numpy as np
MAX_IMAGE_ID = 2**31 - 1
# Strings of SQL Commands:
##########################
CREATE_CAMERAS_TABLE = """CREATE TABLE IF NOT EXISTS cameras (
camera_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
model INTEGER NOT ... |
import diffrend.numpy.ops as ops
import numpy as np
def point_along_ray(eye, ray_dir, ray_dist):
return eye[np.newaxis, np.newaxis, :] + ray_dist[..., np.newaxis] * ray_dir.T[np.newaxis, ...]
def ray_sphere_intersection(eye, ray_dir, sphere):
"""Bundle of rays intersected with a batch of spheres
:param ... |
"""Module for mesh refinement including algorithms and mesh error calculation.
Attributes
----------
DEFAULT_MESH_TOLERANCE : float
Default value for py:class:`Settings` for the default minimum acceptable
mesh error tolerance.
DEFAULT_MAX_MESH_ITERATIONS : int
Default value for py:class:`Settings` for the ... |
############################################################################
## Tool name: BetterBusBuffers
## Created by: <NAME>, Esri, <EMAIL>
## Last updated: 6 December 2017
############################################################################
''' GP tool validation code'''
##################################... |
import sys
import warnings
from collections import defaultdict
from itertools import product, combinations
import numpy as np
import pandas as pd
import scipy.stats
from networkx import Graph
from plotly.graph_objs import Scatter, Figure, Layout
from scipy.stats._continuous_distns import _distn_names
from scipy.stats.... |
from flask import Flask, jsonify, request, send_from_directory, redirect
from flask_apscheduler import APScheduler
from flask_cors import CORS
import requests
from datetime import datetime, timedelta
import json, random, threading, uuid, threading
VERSION = 8
SWIPING_SECONDS = 60
WRITING_PICKUPS_SECONDS = 60
NUM_ROU... |
import os
import ray
import time
import torch
import queue
import threading
from shutil import copy2
from copy import deepcopy
import pytorchrl as prl
from pytorchrl.scheme.base.worker import Worker as W
from pytorchrl.scheme.utils import ray_get_and_free, broadcast_message, pack, unpack
# Puts a limit to the allowed... |
import harfang as hg
from os import path
from math import radians, cos, sin
from random import uniform, randint
from constants import *
hg.LoadPlugins()
def rvect(r):
return hg.Vector3(uniform(-r, r), uniform(-r, r), uniform(-r, r))
def setup_game_level(plus=None):
scn = plus.NewScene()
while not scn.IsReady()... |
# -*- coding: utf-8 -*-
# Copyright 2017 Kakao, Recommendation Team
#
# 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... |
import argparse
import json
import logging
import os
import sys
import time
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from sklearn.metrics import accuracy_score, f1_score
from torch.utils.data import DataLoader, Subset
from tqdm import tqdm
from t... |
# 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
# d... |
import json
from collections import defaultdict
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import PermissionDenied
from django.db.models import Q, Count
from django.conf import settings
from django.http import HttpRes... |
import json
import logging
from typing import Optional, Any, List, Tuple, Union
from qcodes import Parameter
from . import parameters, keepSmallHorizontally
from .parameters import ParameterWidget
from .. import QtWidgets, QtCore, QtGui
from ..client import ProxyInstrument, SubClient
from ..helpers import stringToArg... |
import os
import json
import utm
import numpy as np
import matplotlib.pyplot as plt
from obspy.geodetics import gps2dist_azimuth
import re
import glob
import time
import pickle
import xarray as xr
import warnings
from . import RTMWarning
def prepare_fdtd_run(FDTD_DIR, FILENAME_ROOT, station, dem, H_MAX, TEMP, MAX_T,
... |
'''
Author: <NAME>
Contact: <EMAIL>
'''
"""show_bgp_detail.py
NXOS parsers for the following show commands:
* 'show bgp vrf {vrf} ipv4 unicast detail'
"""
# Python
import re
# Metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Schema, Any, Optional, Or, And,\
... |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
#%%
"""
Created on July 05 2021
The Heston-Hull-White model and pricing European Options with Monte Carlo and the COS method
This code is purely educational and comes from "Financial Engineering" course by <NAME>
The course is based on the book “Mathematical Modeling and Computation
in Finance: With Exercises ... |
import sys
import os
import shutil
def create_app_py():
#this file will create a boilerplate for app.py
try:
f = open("app.py","w+")
#populate the file with template
f.write("""
import os
from flask import Flask, render_template,request
app = Flask(__name__)
from inferenc... |
from __future__ import unicode_literals
import uuid
from django.contrib import auth
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.db.models.functions import Concat
from django.utils import six
import django_filters
from django_filters.filterset import FilterSetM... |
import pandas as pd
import numpy as np
import random
import datetime
from tqdm import tqdm
from tr.core.resources import f1_in_tasks, f1_in_checks
from tr.core.utils import dict_to_list, diff_time_list, get_slots, diff_time_list_peak_season
from tr.core.utils import advance_date, days_between_dates, convert_iso_to_tim... |
import random as rd
import re
import warnings
from itertools import chain
import nltk
import numpy as np
import pandas as pd
from datasketch import MinHash, MinHashLSH
from similarity.levenshtein import Levenshtein
from similarity.normalized_levenshtein import NormalizedLevenshtein
nltk.download('stopwords')
from nlt... |
import warnings
from collections import OrderedDict, Sequence
from functools import partial
from datetime import datetime
import numpy as np
import xarray
from datacube.model import Measurement
from datacube_stats.utils.dates import datetime64_to_inttime
from datacube_stats.utils import da_nodata
from datacube_stats... |
# 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
# distributed under t... |
import requests
import torch
from torchvision import datasets,models,transforms
import torch.nn.functional as F
from sklearn.model_selection import KFold
import os
import numpy as np
import argparse
import matplotlib.pyplot as plt
import random
import deeprobust.image.utils
from deeprobust.image.attack.fgsm import FG... |
import numpy as np
from matplotlib import pyplot as plt
import glob
from matplotlib import patches as mpatches
from scipy.interpolate import PchipInterpolator
import scipy.ndimage
plt.style.use("../template.mplstyle")
# purple - green - darkgoldenrod - blue - red
colors = ['purple', '#306B37', 'darkgoldenrod', '#3F7BB... |
"""Integration tests, testing main scripts."""
from __future__ import division
import json
import math
import os
import tempfile
import shutil
import numpy as np
import fitsio
import cubefit
def add_gaussian(A, y, x, sigma_y, sigma_x, angle, scale):
"""Add a 2-d gaussian to 2-d array A."""
gnorm = 1.... |
# -*- encoding: utf-8 -*-
__version__ = "0.9"
__author__ = "fcFn"
from tkinter.constants import N,E,W,S
from tkinter import messagebox
from tkinter import ttk
import tkinter
class App:
def __init__(self, name):
self.MESSAGES = ['Duplicate item!', 'Enter item name', 'No name provided!']
... |
import tsvector_field
from decimal import Decimal
from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.postgres.search import SearchRank, SearchQuery
from django.db import models
from django.db.models.expressions import F, Q, RawSQL
from django.db.models.ma... |
import matplotlib.pyplot as plt
from matplotlib.colors import TwoSlopeNorm
import numpy as np
import einops
import xarray as xr
from climart.data_loading.constants import get_coordinates
def set_labels_and_ticks(ax,
title: str = "",
xlabel: str = "", ylabel: str = ""... |
import os
from os.path import join
import argparse
import re
from collections import Counter, defaultdict
import numpy as np
import json
from utils.io import LEN_BINS, LEN_BINS_RANGE
PREPOSITION = ['a', 'an', 'the']
END_TOKENS = ['.', '!', '?', '...', "'", "`", '"', ")"]
def _make_n_gram(sequence, n=2):
return ... |
from __future__ import annotations
import argparse
import ast
import os
import shutil
import sys
from typing import Sequence
from CCAgT_utils import describe
from CCAgT_utils import slice
from CCAgT_utils.categories import CategoriesInfos
from CCAgT_utils.categories import read_json
from CCAgT_utils.constants import ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 22 12:07:09 2019
@author: fgw
"""
import os
import tensorflow as tf
import numpy as np
from collections import deque
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
np.random.seed(1)
tf.set_random_seed(2)
class ClockworkRNN(object):
def __init__(self,... |
#!/usr/bin/env python
import sys, operator, argparse, os
from collections import defaultdict, deque
from namegen_utils import *
# -------------------------------------------------------------------------------------------------
# HistoryState
# ---------------------------------------------------------------... |
from .units import dimension, dimension_name, SI_symbol, pg_units
from .interfaces.astra import write_astra
from .interfaces.opal import write_opal
from .readers import particle_array
from .writers import write_pmd_bunch, pmd_init
from h5py import File
import numpy as np
import scipy.constants
mass_of = {'electron'... |
"""
Distributed under the terms of the BSD 3-Clause License.
The full license is in the file BSD_LICENSE, distributed with this software.
Author: <NAME> <<EMAIL>>
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH.
All rights reserved.
Modified from https://github.com/European-XFEL/EXtra-foam, version 1.... |
import asyncio
import logging
import json
import inspect
import aiohttp.client_exceptions
from botocore.utils import ContainerMetadataFetcher, InstanceMetadataFetcher, \
IMDSFetcher, get_environ_proxies, BadIMDSRequestError, S3RegionRedirector, \
ClientError, InstanceMetadataRegionFetcher, IMDSRegionProvider, ... |
# -*- coding: utf-8 -*-
"""
PET-MR image preprocessing nipype workflows.
"""
import os
import nipype.pipeline.engine as pe
from nipype.algorithms.misc import Gunzip
from nipype.interfaces import spm
from nipype.interfaces.utility import Merge, IdentityInterface, Function
from neuro_pypes._utils import format_pair_lis... |
# Copyright 2014 Netflix, 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 law... |
"""
Python script for compute lower and upper bounds for the
mnll and jsd metrics
License:
MIT License
Copyright (c) 2020 Kundaje Lab
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"... |
import importlib
import os.path
import signal
import sys
import uuid
from email.utils import formatdate
from functools import partial
from random import random
from typing import List, Optional
from PyQt6.QtCore import QObject, QTimer, pyqtSlot
from PyQt6.QtNetwork import (
QHostAddress,
QNetworkDatagram,
... |
from IPython.display import Image
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import math, copy, time
from torch.autograd import Variable
import matplotlib.pyplot as plt
import seaborn
from utils.config import *
from utils.data_loader import DataLoader
#from torchtext import da... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Diagnostic script to calculate ECS following Gregory et al. (2004).
Description
-----------
Calculate the equilibrium climate sensitivity (ECS) using the regression method
proposed by Gregory et al. (2004).
Author
------
<NAME> (DLR, Germany)
Project
-------
CRESCENDO... |
import re
import hashlib
import inspect
import collections
from base64 import b64decode
import idiokit
from idiokit.xmlcore import Element, Elements
def _replace_non_xml_chars(unicode_obj, replacement=u"\ufffd"):
return _NON_XML.sub(replacement, unicode_obj)
_NON_XML = re.compile(u"[\x00-\x08\x0b\x0c\x0e-\x1f\u... |
import argparse
import os
import subprocess
from datetime import datetime
from ruamel.yaml import YAML
from jsonpath_ng import parse
import time
import sys
import glob
from ruamel.yaml.compat import StringIO
import re
from colorama import Fore, Style
class Unit:
def initialize_unit(self):
"""
Helm... |
#!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of t... |
import argparse
import collections
import math
import torch
import numpy as np
import model.metric as module_metric
from utils.util import MetricTracker
from data_process import data_process as module_data_process
from torch.utils.data import dataloader as module_dataloader
import model.model as module_arch
from utils.... |
import datetime
import functools
import os
import traceback
import appdaemon.plugins.hass.hassapi as hass
import voluptuous as vol
import conditions
CONF_TRIGGER_ACTIVATE_CONDITION = 'trigger_activate_condition'
CONF_TRIGGER_DEACTIVATE_CONDITION = 'trigger_deactivate_condition'
CONF_EXTEND_CONDITION = 'extend_condit... |
#!/usr/bin/env python3
"""
RESOURCE MANAGEMENT - POLICIES MODULE
Area Resilience - Keep always a Leader in the area!
"""
import threading
import requests
import socket
from time import sleep
from random import randrange
from common.logs import LOG
from common.common import CPARAMS, URLS
from policies.leader... |
# Author: <NAME>
# Date: 02/08/18
import math
import time
import numpy as np
class GAU(object):
'''
Genetic Algorithm Util Functions
__init_population__
__mutation__
__selection__
__crossover__
__statisics__
'''
@staticmethod
def __init_population__(... |
import itertools
import logging
import re
from typing import Optional, Dict, Union
import nltk
# Git PR #35
def _nltk_downloader():
try:
nltk.download('punkt', quiet=True)
except LookupError as e:
print(e)
_nltk_downloader()
import torch
from transformers import(
AutoModelForSeq2SeqLM,
... |
#
# Copyright 2015-2017 <NAME>
#
import sys
from random import random
from PySide2.QtCore import Qt, QByteArray, QDataStream, QIODevice, QMimeData, QRect, QRectF, QPointF
# from PySide2.Qt import QString
from PySide2.QtGui import QKeySequence, QFont
from PySide2.QtWidgets import QMainWindow, QApplication, QLineEdit, ... |
#----------------------------------------------------------
# allows loading data from netatmo meteorological stations for the certain territory
#
# (C) 2020 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# Released under MIT license
# email <EMAIL>, <EMAIL>
#----------------------------------------------------------
... |
import re
from hyde.plugin import Plugin
from hyde.site import Resource
import json, yaml
import os
import requests
import urllib
import uuid
import sys
from rdflib import ConjunctiveGraph, URIRef
from pyld.jsonld import expand, to_rdf, JsonLdProcessor, set_document_loader
import cromulent
from cromulent import model... |
"""Request Models."""
# pylint: disable=invalid-name, too-many-instance-attributes
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
from enum import Enum
from ..const import ALL
from .base import BaseModel
from .const import ProtocolType
from .request_common import (
... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import numpy as np
from lstm_layers_xrh import *
from initializer_xrh import *
from utils_xrh import *
import pickle
class CaptionLSTM:
"""
LSTM 循环神经网络,
适用于构建
(1) 语言模型 (language model)
(2) 对图片做文字描述 (image caption)
词典大小为 vocab_size
词向量的维度为 m
... |
# -*- coding: utf-8 -*-
"""
@author: <NAME> & <NAME>
"""
#Import Statements
from scipy.constants import physical_constants, Boltzmann, R, femto, pico, nano
from math import pi, pow, sqrt, cos, radians, exp, floor
import codons
import pandas
import json, sys, os
def is_number(self,c):
numbers = ".0123456789"
i... |
from inflection import camelize
from jsonclasses.cdef import CDef
from jsonclasses.fdef import FType
from .unary_sort_order import unary_sort_order
from .codable_struct import codable_struct, codable_struct_class, codable_struct_item
from .codable_enum import codable_associated_item, codable_enum, codable_enum_item
fro... |
import os
import re
import argparse
import tempfile
import subprocess
import urllib.parse
import urwid
from wikicurses import formats, settings
from wikicurses.wiki import Wiki, WikiError
from wikicurses.htmlparse import parseDisambig
def executeCommand(cmd):
try:
subprocess.call(cmd)
except FileNot... |
# coding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License... |
# Copyright 2017 Google Inc.
#
# 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 and the following disclaimer.
#
#... |
from pythologist_reader import CellFrameGeneric, CellSampleGeneric, CellProjectGeneric
from pythologist_image_utilities import read_tiff_stack, make_binary_image_array, image_edges, binary_image_dilation
import sys, json
from uuid import uuid4
import pandas as pd
import numpy as np
from mibidata import segmentation as ... |
#%%
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import shutil
import sys
import datetime
import numpy as np
import pandas as pd
import math
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import ... |
"""
DSC20 WI22 HW05
Name: <NAME>
PID: A16679845
"""
# begin helper methods
def ceil(x):
"""
Simulation to math.ceil
No doctest needed
"""
if int(x) != x:
return int(x) + 1
return int(x)
def log(x):
"""
Simulation to math.log with base e
No doctests needed
"""
n = 1e... |
import os
import sys
import time
import argparse
import random
import datetime
import numpy as np
import tensorflow as tf
from utils.aol_utils import get_data_aol_feat_list
from utils.utils import get_stat, git_log, AverageMeter, keep_latest_files
from utils.nn_utils import fc_layers, write_summary
def construct_gra... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 4.26
# in conjunction with Tcl version 8.6
# Dec 30, 2019 01:06:36 AM GMT platform: Darwin
__doc__ = """
This software takes UDP readouts from TAIT Stage Tech's eChameleon software, and
translates it into useful things.
Origi... |
from contextlib import contextmanager
import inspect
import sys
import time
from contextlib2 import ExitStack
from dagster import check
from dagster.core.definitions import PipelineDefinition, create_environment_type
from dagster.core.definitions.mode import ModeDefinition
from dagster.core.definitions.resource impor... |
import discord
from discord.ext import commands
import datetime
import os
from binascii import hexlify
import asyncio
import re
import json
class Giveaway(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.client = bot.client
self.table = self.client['Giveaways']
self.code... |
import sys
from PIL import Image
import matplotlib.pyplot as plt
from Constants import Constant_Images
import numpy as np
def convert2gray(img):
#original image size
width, height = img.size
#create empty image
new_im = Image.new('I', [width,height])
new_px=new_im.load()
#hesaplamalar
su... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>-<NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
# Project Imports
from mosqito.functions.hearing_model.sone2phone import sone2phone
from mosqito.functions.hearing_model.phone2spl import phone2spl
from mosqito.functions.hearing_model.comp_loudness impo... |
"""
Materials for the objects in a scene.
"""
import random
import math
import numpy
from PIL import Image
RNG = numpy.random.default_rng()
AXIS_COLOUR_PAIRS = [
# +X : Red
(numpy.array([1.0, 0.0, 0.0], dtype=numpy.single), numpy.array([1.0, 0.0, 0.0], dtype=numpy.single)),
# +Y : Green
(numpy.arr... |
"""
@brief Script used for the pick and place of a small cilinder over a circular
target and for the reaching task of the robot tool tip over same
circular target
@author <NAME>
@date 03 Sep 2020
"""
import numpy as np
import time
# My import
from dVRL_simulator.PsmEnv import PSMEnv
from dVRL_... |
DESEncryptParam = "key(16 Hex Chars), Number of rounds"
INITIAL_PERMUTATION = [58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, ... |
import numpy as np
import scipy.odr
import numba
import skimage.io
import skimage.measure
from matplotlib import path
class SimpleImageCollection(object):
"""
Load a collection of images.
Parameters
----------
load_pattern : string or list
If string, uses glob to generate list of files ... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy import stats, interpolate
import matplotlib.pyplot as plt
from ReflectivitySolver import ReflectivitySolver
from sourcefunction import SourceFunctionGenerator
from utils import create_timevector, create_frequencyvector
def plot_PT_summary(samplers, burn_in=0):
... |
"""Sample from the multivariate distribution defined by the model."""
from typing import Any, Callable, Dict, Iterator, Optional, Tuple
import jax
import jax.numpy as jnp
import numpy as np
from jax.flatten_util import ravel_pytree as jax_ravel_pytree
from tqdm import tqdm
import mcx
from mcx.jax import progress_bar_... |
"""
Module to rechunk existing .h5 files
"""
import h5py
import logging
import numpy as np
import pandas as pd
from pandas.api.types import CategoricalDtype
import time
logger = logging.getLogger(__name__)
def get_dataset_attributes(h5_file, out_json=None):
"""
Extact attributes, dtype, and chunk size for al... |
# ##### BEGIN MIT LICENSE BLOCK #####
#
# 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, co... |
import torch
import torch.nn as nn
import torchvision.transforms as T
import pandas as pd
from typing import Dict, List
from pathlib import Path
from mvqag import CNF_PATH
from mvqag.utils import load_yaml, load_json, get_recent_githash, load_qa_file
from mvqag.data import (
VQADataset,
DataLoaders,
Tokeniz... |
import os
import sys
import math
import numpy as np
from PIL import Image
import scipy.linalg
import chainer
import chainer.cuda
from chainer import Variable
from chainer import serializers
from chainer import cuda
import chainer.functions as F
sys.path.append(os.path.dirname(__file__))
sys.path.append('../')
from s... |
import os
import errno
import random
import yaml
import json
import re
import numpy as np
import torch
import matplotlib.pyplot as plt
from utils import multiview
from scipy.optimize import least_squares
def config_to_str(config):
return yaml.dump(yaml.safe_load(json.dumps(config))) # fuck yeah
def update_after_... |
# define the dataset used in training on offline CARLA dataset
import os
from PIL import Image
import numpy as np
import torch
import torch.utils.data as data
import math
from utils import meshgrid, box_iou, box_nms, change_box_order
import random
class AngleSpliter:
# class to spliter the original angle into bin... |
import os, logging, json
from tqdm import tqdm
import torch
from torch import nn, optim
from .data_loader import SentenceREDecodeLoader, SentenceRETrainLoader
from .utils import AverageMeter
from datetime import datetime
import time
logger = logging.getLogger()
import numpy as np
import codecs
import glob
import re
cl... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from builtins import zip
from builtins import range
from builtins import object
from copy import deepcopy
import numpy as np
import theano
import theano.tensor as T
from theano import sparse
from .ann import AN... |
import csv
import itertools
import re
from collections import defaultdict, Counter
import difflib
import openpyxl
MIN_SIMILAR_VALUES = 3
MIN_SIMLARITY_RATIO = 0.75
# path = '/home/dodobas/WORK/waterboard/Water points of whole Tigray Imported into new database-November 2018.xlsx'
path = '/home/dodobas/WORK/waterboard... |
# Copyright 2015 by <NAME> (RabbitStack)
# 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 applicabl... |
# Copyright (c) 2018, Vienna University of Technology (TU Wien), Department
# of Geodesy and Geoinformation (GEO).
# All rights reserved.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MER... |
# Copyright (C) 2011 <NAME>
# Distributed under the MIT license, see the LICENSE file for details.
import logging
import uuid
from sqlalchemy import sql
from acoustid import tables as schema, const
from acoustid.data.fingerprint import lookup_fingerprint, insert_fingerprint, inc_fingerprint_submission_count, Fingerpri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.