text stringlengths 6.04k 39.5k |
|---|
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import AbstractUser
from django.template.defaultfilters import slugify
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.core.mail import send_mail
from django.core.validators imp... |
import numpy as np
import theano
import theano.tensor as T
import lasagne
import sys
import time
import utils
import config
import logging
import nn_layers
import lasagne.layers as L
from nn_layers import QuerySliceLayer
from nn_layers import AttentionSumLayer
from nn_layers import GatedAttentionLayerWithQueryAttentio... |
# Generated from expr.g4 by ANTLR 4.5.3
# encoding: utf-8
from antlr4 import *
from io import StringIO
def serializedATN():
with StringIO() as buf:
buf.write("\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\16")
buf.write("\63\4\2\t\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3")
buf.wri... |
import netCDF4
import numpy as np
import pandas as pd
import scipy as sci
# from scipy.spatial import *
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib.widgets import Widget
from matplotlib.colors import LogNorm, Normalize
from lmatools.coordinateSystems import Geo... |
"""
Copyright (c) <NAME>
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,... |
import argparse
import math
import random
import os
import numpy as np
import torch
from torch import nn, autograd, optim
from torch.nn import functional as F
from torch.utils import data
import torch.distributed as dist
from torchvision import transforms, utils
from tqdm import tqdm
import time
from d... |
import json
import re
from typing import Dict, List
import pandas
from constants import ASSISTIVE_EVENT_IDS, Correctness
from collections import Counter
def save_type_mappings(data_file: str):
sep = "," if data_file.endswith(".csv") else "\t"
src_data = pandas.read_csv(data_file, sep=sep, encoding="latin-1")
... |
# -*- coding: utf-8 -*-
""" VITA Person Registry, Models
@author: nursix
@see: U{http://eden.sahanafoundation.org/wiki/BluePrintVITA}
"""
prefix = "pr"
# *****************************************************************************
# Person Entity
#
pr_pe_types = Storage(
pr_person = T("Person"),
p... |
# coding: utf-8
# # DeepDreaming with TensorFlow
# >[Loading and displaying the model graph](#loading)
#
# >[Naive feature visualization](#naive)
#
# >[Multiscale image generation](#multiscale)
#
# >[Laplacian Pyramid Gradient Normalization](#laplacian)
#
# >[Playing with feature visualzations](#playing)
#
# >[... |
from __future__ import print_function
import argparse
import torch
import torch.utils.data
import torch.nn as nn
from tgcn.nn.gcn import gcn_pool, gcn_pool_4, ChebConv, ChebTimeConv
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import autograd.numpy as npa
from load.data_hcp import load... |
"""
Toolkit for analyzing HST/ACS WFC and HRC polarization data. For more information
about ACS polarization data analysis, see section 5.3 of the ACS Data Handbook:
https://hst-docs.stsci.edu/acsdhb/chapter-5-acs-data-analysis/5-3-polarimetry
"""
import os
import numpy as np
import yaml
from astropy import units
fr... |
from keras import backend as K
import tensorflow as tf
import numpy as np
def focal_loss(gamma=2., alpha=4.):
gamma = float(gamma)
alpha = float(alpha)
def focal_loss_fixed(y_true, y_pred):
"""Focal loss for multi-classification
FL(p_t)=-alpha(1-p_t)^{gamma}ln(p_t)
Notice: y_pred ... |
# -*- coding: utf-8 -*-
#
# This file is part of the FFEA simulation package
#
# Copyright (c) by the Theory and Development FFEA teams,
# as they appear in the README.md file.
#
# FFEA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... |
#
# Copyright (C) 2014 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish,... |
import hydra
from ncmw import community
from omegaconf import DictConfig, OmegaConf
import cobra
import logging
import socket
import time
import random
import numpy as np
import pandas as pd
from copy import deepcopy
import sys, os
import json, pickle
file_dir = os.path.dirname(os.path.dirname(__file__))
sys.path.... |
#!/usr/bin/env python
# coding: utf-8
import logging
import math
import numpy as np
#from PIL import ImageGrab #if windows or os X
import pyscreenshot as ImageGrab #if linux
from PIL import Image
import cv2 #opencv
import io
import time
#from matplotlib import pyplot as plt
#plt.rcParams['figure.figsize'] = (30, 30)
... |
# -*- coding: utf-8 -*-
"""The runner daemon.
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import aenum
import async_generator
import collections
import contextlib
imp... |
# import system packages
import os
from datetime import datetime
import sys
import argparse
import traceback
import pickle
import yaml
from argparse import ArgumentParser, RawTextHelpFormatter
# import numpy
import numpy as np
import healpy as hp
# the MPI comunicator class, customized for pycal data storage
from pyc... |
# ## Please select an option before submitting results to the competition
submit_flag = True #False #True
print(submit_flag)
# # TalkingData AdTracking Fraud Detection Challenge
# # Can you detect fraudulent click traffic for mobile app ads?
# # https://www.kaggle.com/c/talkingdata-adtracking-fraud-detection
# *... |
from __future__ import absolute_import
from __future__ import unicode_literals
import hashlib
import json
from django.core.serializers.json import DjangoJSONEncoder
from jsonobject.base_properties import DefaultProperty
from simpleeval import InvalidExpression
import six
from corehq.apps.locations.document_store impo... |
import sys, time
from PIL import Image
from datetime import datetime
sys.path.insert(0, 'hardware')
from controller import Controller
import camera_config
sys.path.insert(0, 'software')
from client import Client
import math
LEFT = 0 # Counter Clockwise
RIGHT = 1 # Clockwise
FORWARD = 2
STATE_NONE = ... |
import os
import random
import time
from datetime import timedelta
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as utils
import torch_geometric.transforms as T
from torch.autograd import Variable
from... |
# The training code for our ICLR position project.
# It will run on all the five groundtruth types, but you can change it only for one type, e.g., hor.
# The backbone used, VGG or ResNet, is pre-trained on ImageNet by default.
# Our work is to if the position information is encoded in the pre-trained model.
# A simple ... |
# -*- coding: utf-8 -*-
'''
Created on 2017. 6. 10.
@author: HyechurnJang
'''
import os
import time
import pygics
from page import *
#===============================================================================
# Internal APIs
#==========================================================================... |
import secrets
from datetime import timedelta
from bitcart.errors import BaseError as BitcartBaseError
from fastapi import HTTPException
from fastapi.encoders import jsonable_encoder
from gino.crud import UpdateRequest
from sqlalchemy.dialects.postgresql import ARRAY
from api import schemes, settings
from api.constan... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 <NAME> (plugin.video.netflix)
Copyright (C) 2018 Caphm (original implementation module)
Parsing of Netflix Website
SPDX-License-Identifier: MIT
See LICENSES/MIT.md for more information.
"""
from __future__ import absolute_import, division, unicode_lite... |
import os
import sys
import copy
import pefile
import struct
import argparse
from enum import Enum
"""
Checks that the metadata within a file's Rich header does not contradict the
other metadata contained within it.
References:
https://gist.github.com/skochinsky/07c8e95e33d9429d81a75622b5d24c8b
https://www.se... |
# Import modules.
import simplegui
import math
import random
# globals for user interface
WIDTH = 800
HEIGHT = 600
score = 0
lives = 3
time = 0
started = False
class ImageInfo:
def __init__(self, center, size, radius = 0, lifespan = None, animated = False):
self.center = center
sel... |
"""
;;#############################################################################
;; TropicalVariablity_wind.py
;; Author: <NAME> (FMI, Finland)
;; EMBRACE project
;;#############################################################################
;; Description
;; This script is the diagnostics and plotting script fo... |
from pythologist_reader.formats.inform.frame import CellFrameInForm, preliminary_threshold_read
from pythologist_reader.formats.inform.sets import CellSampleInForm, CellProjectInForm
from pythologist_reader.formats.inform.custom import CellFrameInFormLineArea, CellFrameInFormCustomMask
import os, re, sys
from tempfile ... |
#!/usr/bin/env python3
# pyusbip
# USBIP server in Python
#
# Copyright (c) 2018 <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
#
#... |
# --------------------------------------------------------
# Pytorch Multi-GPU Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>, <NAME>, based on code from Ross Girshick
# --------------------------------------------------------
from __future__ import absolute_import
from __fu... |
import torch
from torch.nn.functional import softmax, dropout, linear
from torch import Tensor
from typing import Optional, Tuple
from torch.nn import Module, Parameter
from torch.nn.modules.linear import _LinearWithBias
from torch.nn.init import xavier_uniform_, constant_
from torch.overrides import has_torch_function... |
"""LUNOS Heat Recovery Ventilation Fan Control (e2/eGO)"""
# FIXME: can we subscribe to updates from the w1/w2 entities to avoid polling?
import asyncio
import logging
import time
import voluptuous as vol
from homeassistant.components.fan import (
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
SPEED_HIGH,
SPEED_L... |
"""
Methods for finding descendant entities (participants in families, biospecimens
in those participants, etc).
"""
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor, as_completed
import psycopg2
import psycopg2.extras
from kf_utils.dataservice.patch import hide_entities, unhide_en... |
"""
Establishes a PyModbus server/slave context that maps to ClearBlade platform collections.
Requires a unique instance per slave device represented in the platform.
"""
from clearblade.ClearBladeCore import Query
from pymodbus.interfaces import IModbusSlaveContext
from pymodbus.datastore.context import ModbusServerC... |
from datetime import datetime, date, timedelta
try:
from itertools import izip_longest as zip_longest # 2
except ImportError:
from itertools import zip_longest # 3
import operator
import pytest
from django.db import connection
from caspy import query, models
from caspy.domain import models as dm
from testapp... |
from collections import OrderedDict
from frontera.exceptions import NotConfigured
from frontera.utils.misc import load_object
from frontera.settings import Settings, BaseSettings
from frontera.core.components import Backend, Middleware, CanonicalSolver
from frontera.logger import FrontierLogger
from frontera.core impo... |
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
"""
This file defines classes for job handlers specific for distgit
"""
import logging
from datetime import datetime
from os import getenv
import shutil
from typing import Optional, Dict, List
from celery import Task
from ogr.abstract imp... |
import numpy as np
from math import sqrt
import time
import multiprocessing
import copy
from functools import partial
from datetime import date
import matplotlib.pyplot as plt
import matplotlib
from ROAI_class import ROAI, RANDOM, RR, WRR
# this function is used to generate the instance
def generate_instance_bernoul... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from pyspark import SparkContext
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
from pyspark.sql.types import IntegerType
import urllib.request
from PIL import Image
from pyspark.sql.functions import *
import matplotlib.pyplot as plt
import ... |
"""
test infinite sheds
"""
import numpy as np
import pandas as pd
from pvlib.bifacial import infinite_sheds
from pvlib.tools import cosd
from ..conftest import assert_series_equal
import pytest
@pytest.fixture
def test_system():
syst = {'height': 1.0,
'pitch': 2.,
'surface_tilt': 30.,
... |
#!/usr/bin/env python
import re
import os
import sys
import pvl
import datetime
import pytz
import logging
import json
import hashlib
from ast import literal_eval
from pysis import isis
from pysis.exceptions import ProcessError
from pysis.isis import getsn
from pds_pipelines.RedisLock import RedisLock
from pds_pipeli... |
"""
Collection of basic neural net models used in the OTDD experiments
"""
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import pdb
from .. import ROOT_DIR, HOME_DIR
MODELS_DIR = os.path.join(ROOT_DIR, 'models')
MNIST_FLAT_DIM = 28 * 28
def reset_parameters(m):
if isinstance(... |
#!/usr/bin/python
#-*- coding: utf-8 -*-
# >.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.
# Licensed under the Apache License, Version 2.0 (the "License")
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# --- File Name: training_loop_vae.py
# --- Creation Date: 14-08-2020
# --- Last Modified:... |
import os
import re
import ssl
import json
import Queue
import base64
import logging
import urllib
import urllib2
import hashlib
import threading
from . import Maven, Docker, Gitlfs, Npm, Gems
class PutRequest(urllib2.Request):
def __init__(self, *args, **kwargs):
urllib2.Request.__init__(self, *args, **kw... |
import os
import json
import boto3
import time
import requests
import pyotp
import logging
import random
from datetime import datetime
from requests.exceptions import HTTPError
from requests.exceptions import ConnectionError
from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.dispatch_components imp... |
"""
Classes for implementing prior probabilities in the context of Bayesian
modelling and inference.
"""
# std libs
import numbers
import functools as ftl
# third-party libs
import numpy as np
from scipy import stats
from scipy.stats._distn_infrastructure import rv_frozen
# local libs
from obstools.modelling.utils i... |
from __future__ import print_function
import collections
import re
import sys
import copy
__author__ = '<NAME>'
__copyright__ = 'Copyright 2014 Sandia Corporation'
__license__ = 'GNU Lesser General Public License'
#### Exceptions
class ResponseError(Exception):
pass
class MissingSourceError(Exception):
pa... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import gym
from gym.envs.registration import register
from gym import wrappers
import random
from collections import deque
from collections import namedtuple
#from xml.etree.ElementTree import Element, SubElement, dump, ElementTree
im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Requermientos:
pip3 install pdfminer3k
pip3 install ply
"""
import os.path as op
from os import makedirs
import uuid
import pickle
import F2S_LoadPlugins
try:
from SimpleSoft.F2S_CrearPDF3 import objF2S_PDF
except Exception as e:
try:
from F2S_CrearP... |
import logging
import numpy as np
from joblib import Memory
from aspire.image import Image
from aspire.operators import PowerFilter, ZeroFilter
from aspire.utils.random import randn
logger = logging.getLogger(__name__)
class Xform:
"""
An Xform is anything that implements a `forward` method (and an `adjoin... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from math import sqrt
import random
def integer_sqrt(x: int):
"""
Return the integer part of the square root of x, even for very large integer values.
Python 'math' module does not operate as expected for large integers.
Got from https://stackoverflow.c... |
"""Probe classifiers.
Probe classifiers can be used as an estimate how good data has been
transformed to perform a classification task.
taken from:
phd_lab/train_probes.py
phd_lab/experiments/probe_training.py
"""
# standard imports
from typing import List, Tuple
from itertools import product
import os
import sys... |
# capture.py ---
# Author: <NAME>
# Created: Thu Feb 27 17:31:02 2020 (-0500)
# Code:
"""
========================
Capture or process video
========================
Usage:
::
python -m argos.capture -i 0 -o myvideo_motion_cap.avi
To see a list of all options try ``python -m argos.capture -h``
The above command ... |
# Copyright (C) 2011-2020 Airbus, <EMAIL>
from plasmasm.symbols import section_type, is_comm, compute_alignment
from plasmasm.symbols import comm_symbol_section
try:
from plasmasm.python.compatibility import bin
from plasmasm.python.compatibility import sorted, reversed
except ImportError:
pass
def symbols... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 25 14:23:46 2021
@author: dhulls
"""
import torch, time, sys
import autograd
import autograd.numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import scipy.integrate
solve_ivp = scipy.integrate.solve_ivp
from statsmodels.... |
# Copyright 2018 <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 required by applicable law or agreed to in writing, software... |
from hdfs import InsecureClient
from io import StringIO
import json
import math
import numpy as np
import os
import pandas as pd
from pyspark import SparkConf, SparkContext, StorageLevel
import random
import re
import shutil
from sklearn.ensemble import RandomForestRegressor
from sklearn.impute import SimpleImputer
fro... |
import pybullet as p
import numpy as np
from rlschool.quadrupedal.envs.utilities.pose3d import QuaternionFromAxisAngle
import time
STEP_HEIGHT_INTERVAL = 0.002
SLOPE_INTERVAL = 0.02
STEP_WIDTH_INTERVAL = 0.02
STEP_HEIGHT = np.arange(0.08, 0.101, STEP_HEIGHT_INTERVAL)
SLOPE = np.arange(0.3, 0.501, SLOPE_INTERVAL)
STEP_... |
#!/usr/bin/env python3
'''Used to run all HyperMinHash experiments'''
import sys
assert(sys.version_info.major >= 3)
import hashlib
import mmh3
import numpy as np
import math
import os
import copy
import decimal
import time
import struct
import bitstring
def packbits(b, L):
'''Returns a bytestring corresponding ... |
# The MIT License (MIT)
#
# Copyright (c) 2021
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, pu... |
import numpy as np
import random, string
import random_name_generator as rng
import random, string
import uuid
from anytree import Node, PreOrderIter
from core.individual import Individual
from core.types import DefaultConfig, Types
from core.registers import Variable, OperatorRegistry, VariableRegistry
from utils.op... |
#!/usr/bin/env python3.8
from threading import Thread
from enum import (
Enum,
auto
)
from time import sleep
from io import (
StringIO,
TextIOBase
)
from typing import (
Callable,
Union,
Optional,
NamedTuple
)
from collections import UserDict
from os import environ
import datetime
import... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 4 12:26:21 2019
@author: <NAME>
This file contains scripts used to download GOES-16 Geostationary Lightning
Mapper (GLM) & Advanced Baseline Imager (ABI) data files from NOAA's Amazon
Web Service (AWS) bucket.
Code that deals with AWS buckt adapted from <NAME... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SkyAlchemy
Copyright ©2016 <NAME>
Licensed under the terms of the MIT License.
See LICENSE for details.
@author: <NAME>
"""
# Built-in imports
from __future__ import division, unicode_literals, print_function
import sys
import os
import os.path as osp
import subproce... |
#!/usr/bin/env python
# coding: utf-8
from os import listdir, makedirs
from os.path import join, exists
from seaborn.rcmod import reset_defaults
from src.log import create_experiment
from tqdm import tqdm
import pandas as pd
import numpy as np
from collections import namedtuple
import logging
from argparse import A... |
"""
Classes related to metadata
"""
from datetime import datetime
from typing import List, Optional
from avionix.kube.base_objects import KubernetesBaseObject, Meta
from avionix.yaml.yaml_handling import HelmYaml
class APIResource(Meta):
"""
:param name: name is the plural name of the resource.
:param c... |
# -*- coding: utf-8 -*-
#
# Tencent is pleased to support the open source community by making QT4W available.
# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License");you may not use this
# file except in compliance with the License. You may... |
# coding: utf-8
""" Simulate low level RFI
We are interested in the effects of RFI signals that cannot be detected in the visibility data. Therefore,
in our simulations we add attenuation selected to give SNR about 1 in the unaveraged time-frequency data.
This is about 180dB for a DTV station in Perth.
The scenario i... |
import numpy as np
import scipy.linalg as la
from matplotlib import pyplot as plt
from scipy import sparse as sp
from time import time
import scipy.sparse.linalg as spla
from math import sqrt
import streaming_subclass as stsb
#####################################################################
# Obtain the necessary ... |
from collections.abc import Iterable
import scipy.optimize as opt
from scipy.interpolate import PchipInterpolator
from scipy.sparse import dia_matrix
from src.Forward import _de_americanize_vol
from src.utils import *
CALL_PUT = {'call': 1, 'put': -1}
class Lognormal_mixture_model_curve:
def __init__(self, T, ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 4 12:42:20 2020
@author: Mark
"""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import animation
import warnings
def frame_number(frame, speed, particles):
"""
Creates the text for the animation, called every fra... |
# -*- coding: utf-8 -*-
import os
import numpy as np
import statsmodels.api as sm # recommended import according to the docs
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats.mstats as mstats
from common import globals as glob
from datetime import datetime, timedelta
import seaborn as sb
sb.set... |
import os
import math
import sys
import pandas as pd
from citrination_client import CitrinationClient
from pypif import pif
from pypif.obj import *
from IN718_porosity_updater.pore_statistics import *
sys.path.insert(0, '/Users/cborg/projects/community_projects/')
from community_projects.pycc_utils import pycc_wrappers... |
"""Sudoku solving algorithm."""
from __future__ import annotations
from typing import List, Set, Tuple, Optional
from itertools import combinations
class InvalidGrid(Exception):
"""Exception raised when the Sudoku grid is invalid."""
class Box:
"""Box represents a single grid space on the board.
N... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
import os
# Implemented 01/08/2020 by <NAME>, based on
# https://github.com/Stick-To/ResNeXt-tensorflow
# Corrected and verified vs pretrained pytorch weights (up t... |
"""
Import as:
import dataflow.system.source_nodes as dtfsysonod
"""
# TODO(gp): -> source_nodes.py
import logging
from typing import Any, Dict, List, Optional, Tuple, Union
import pandas as pd
import core.finance as cofinanc
import dataflow.core as dtfcore
import helpers.hdatetime as hdateti
import helpers.hdbg a... |
"""
Implementation of the forward backward algorithm for one-step and two-step Hidden
Markov Models (Bishop 2009, Chapter 13).
"""
import numpy as np
import os
import torch
import pickle
def load_data(filename, print_filename=True):
if print_filename:
print("loading ", filename)
with open(filename, "... |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
.. currentmodule:: thelma.tools.metadata.generation
This is the handler for experiment design parsers. It is a component of the
:class:`ExperimentMetadataGe... |
# coding=utf-8
# main codes, call functions at stokes_flow.py
# <NAME>., and <NAME>. "Stokes flow due to a Stokeslet in a pipe." Journal of Fluid Mechanics 86.04 (1978): 727-744.
# the convergence of the series solution for the problem is bad around the stokeslet, i.e. z->0.
# thus, a numerical solution is given to fil... |
# Utilities related to materials.
import bpy
import os.path
def handleMaterialAttributeNodesException(mat, data_path, exc):
if data_path == "alpha" or data_path == "diffuse_color":
raise RuntimeError("Material '{}' was not set up with nodes corresponding to 2.79 attributes".format(mat.name)) from exc
... |
import numpy as np
import matplotlib.pyplot as plt
import sympy
from sympy import *
import sys
sys.path.append(r'C:\Users\elira\Google Drive\butools2\Python')
sys.path.append('/home/d/dkrass/eliransc/Python')
from tqdm import tqdm
from butools.ph import *
from butools.map import *
from butools.queues import *
from but... |
# -*- coding: utf-8 -*-
"""
generate_mes_stereopsis_set01.py
A Python Blender script for generating many paired image files of random polyhedra at random
distances from two different vantage points (left and right), simulating stereopsis
(aka binocular vision). The image pairs are meant to be used to train a computer ... |
import copy
import json
import pickle
import os
from typing import List
from pretty_midi import PrettyMIDI, Instrument, Note
from .Chord import Chord
from ..utils.string import STATIC_DIR
from ..utils.utils import compute_distance, compute_destination, Logging, read_lib
from ..utils.constants import *
from ..settings... |
"""
Functions for loading various types of hypnogram/sleep stage/labels file
formats from disk. Returns raw data either as a numpy array or
StartDurationStageFormat tuples.
Functions in utime.io.extractors.hyp_extractors will convert these data types
into utime.hypnogram objects which are used for all downstream opera... |
import os, sys, inspect
import cv2
import tensorflow as tf
import numpy as np
import source.utility as util
import source.cv_functions as cvf
PACK_PATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))+"/.."
def save_crops(image=None, boxes=None, ratio=1, file_name=None): # save the segmen... |
#########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... |
from datetime import datetime, timedelta
from functools import partial
from os import PathLike
from pathlib import Path
import fiona
import fiona.crs
import numpy
import pyproj
import rasterio
import shapely
from shapely.geometry import shape
from shapely.ops import transform
import xarray
from PyOFS import get_logge... |
'''
This code demonstrates the scenario of Subtle Data Crime II for CS and DictL reconstruction algorithms.
Here we use the hyperparameters values that were found in the hyperparam search performed for subtle data crime I,
for zero-padding with factor x1 (which means that there was no zero padding - because the JP... |
import geopandas as gpd
import pandas as pd
from shapely.geometry import Polygon,Point
import math
import numpy as np
def rect_grids(bounds,accuracy = 500):
'''
Generate the rectangular grids in the bounds
Parameters
-------
bounds : List
Create the bounds, [lon1, lat1, lon2, lat2](WGS84... |
###
#
# gene_catalog.py
#
# collection of methods for annotating gene_families
## normalize_coverage(input):
# process contig and read stats into map from gene to abundance
###
import re
import os
import json
import pandas
from Bio import SeqIO
from edl import taxon as edltaxon, util, hits as edlhits, blastm8, kegg
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 19 11:28:58 2022
@author: dboateng
"""
# coding: utf8
import gzip
from datetime import datetime, timedelta
from functools import partial
import netCDF4
import numpy as np
def from_netcdf(filename, usedatetime=True, msv=-999, unit='hours',
... |
#!/usr/bin/python
from optparse import OptionParser
import sys
import operator
import os
def parse_options():
userinfo = '''
FILTER LINES
Examples:
A. Filter the file "f1.txt" by keeping all lines which contain any of
the words listed in the file "words.txt". Assume the file to be filtered
... |
"""
General components.
"""
# Copyright (c) 2019 <NAME>. All rights reserved.
from typing import Tuple, List, Union, Callable
import numpy as np
import trimesh
from modeling import util
from modeling.types import Point3, Vec3, Verts2D, Verts, Faces, Mesh, MeshExtended
def surface_revolution(
xy_points: ... |
"""
This is an example of using the k-nearest-neighbors (KNN) algorithm for face recognition.
When should I use this example?
This example is useful when you wish to recognize a large set of known people,
and make a prediction for an unknown person in a feasible computation time.
Algorithm Description:
The knn classi... |
import sys
import re
import numpy as np
from collections import defaultdict
import logging
import logging.handlers
import argparse
from correspondences import ud_4lang_dict
from input_utils import basic_tree_dep_reader
from template import Template
parser = argparse.ArgumentParser(description = "Script for generating... |
import numpy as np
from typing import List, Tuple
from numba import njit, prange
from gym_rubiks_cube.envs.functions import RotationMatrix3D, getQuadrant
import gym_rubiks_cube.envs.objects3D as o3
@njit
def rasterizeBottomFlatTriangle(v1, v2, v3, width, height):
"""assumes v1.y < v2.y = v3.y"""
object_map =... |
from GearBox_template_1010 import *
#############################################
# User Class creation
#############################################
version = '1.1'
date = '2017.09.25'
log = '''
2017.09.25
* update version with template 1010
'''
help = '''
'''
# --------------------
# user module... |
import tempfile
from copy import deepcopy
from django.core.management import call_command, get_commands
from django.conf import settings
from django.core.cache import cache
from django.db.models import Prefetch, Q
from django.http import Http404, QueryDict
from django.urls import reverse
from django.utils.functional i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.