text stringlengths 3.07k 12.6k |
|---|
"""
Build script for pymcuprog, tested on Windows 10, Windows 11, Ubuntu and Debian. Invoke this build
script like so:
$ python3 pymcuprog_build.py
A 'build/' folder gets created with the executable and dll's / so's inside. To clean, invoke:
$ python3 pymcuprog_build.py --clean
"""
import sys
import os
impor... |
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Union
from tartiflette.types.exceptions.tartiflette import InvalidValue, NullError
from tartiflette.types.helpers import has_typename, reduce_type
from .coercer_way import CoercerWay
def _set_typename(result: Any, typename: Option... |
"""
A script to compute the energy minima of Lennard-Jones clusters.
Call with: python energy_landscapes.py [save file name]
"""
import math
import random
import numpy as np
import pickle
def LJ(r):
"""Returns the LJ energy"""
return 4 * (((1 / r) ** 12) - ((1 / r) ** 6))
def morse(r, a=6):
"""Returns... |
# -*- coding: utf-8-*-
# Copyright 2016 g10dras.
import re
import pyowm
from semantic.numbers import NumberService
WORDS = ["TEMPS", "METEO", "PREVISION"]
PRIORITY = 4
def handle(text, mic, profile):
serviceNum = NumberService()
def formatTimeStamp(unix_time):
return datetime.fromtimestamp(uni... |
from builtins import object
from yapsy.IPlugin import IPlugin
import jsonpickle
import lxml.etree as etree
from elasticsearch_dsl import Search
from elasticsearch_dsl.query import Match
from opentargets_urlzsource import URLZSource
from mrtarget.common.UniprotIO import Parser
import logging
class ReactomeRetriever(ob... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 20:55:26 2021
@author: stephenschmidt
"""
import numpy as np
import tensorflow as tf
import tensorflow.compat.v1 as v1
v1.disable_eager_execution()
import time
import os
from load_data import H5MSI, shuffle_data
from tensorflow.python.keras.ba... |
import constant_parameters as c
import time
import output_controller as oc # pylint: disable=unused-wildcard-import
import light_effects as leff
import bedtime_protocol as bp
import threading
SESSION = 0
SPRINT = 1
BREAK = 2
INTERRUPTION = 3
inSession = False
inInterruption = False
inBreak = False
inSprint = False
in... |
"""
Routines anc Classes to manipulate Octopus Inputs
"""
import os as _os
import gzip as _gzip
import numpy as _np
import pychemia
def execute(basedir, num_threads=1, num_procs=2):
"""
Call octopus in parallel with a given number of threads and
MPI process
:param basedir: (str) Working directory fo... |
"""
GraphQL Client
"""
from datetime import datetime
import json
import random
import string
import threading
import time
import websocket
from six.moves import urllib
from . import __version__
class GraphQLClient:
"""
A simple GraphQL client
"""
def __init__(self, endpoint, session=None, verify=T... |
"""
datamodel.py
"""
from bs4 import BeautifulSoup
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Table, Numeric, Boolean, DateTime
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
# create the declarative base
Base = ... |
# Copyright (C) 2020 <NAME> (Technical University of Munich)
# For more information see <https://vision.in.tum.de/research/vslam/dh3d>
#
# 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... |
# -*- coding: utf-8 -*-
"""Operator controller."""
from datetime import datetime
from sqlalchemy.exc import InvalidRequestError, ProgrammingError
from werkzeug.exceptions import BadRequest, NotFound
from ..database import db_session
from ..models import Operator
from .parameters import list_parameters
from .dependenc... |
import io
import os
import gzip
import codecs
from collections import Counter
from contextlib import contextmanager, ExitStack
from pathlib import Path
from typing import NamedTuple
from glob import glob
import ir_datasets
from ir_datasets.util import DownloadConfig, GzipExtract, TarExtract
from ir_datasets.formats imp... |
import openpyxl
from zipfile import ZipFile
from django.core.files import File
from io import TextIOWrapper
import re
import io
from django.core.files.base import ContentFile
import threading
import xlsxwriter
import json
import traceback
from . import utils
from . import models
from setups import models as s_models
... |
import numpy as np
import pickle, torch
from . import tools
class Feeder_single(torch.utils.data.Dataset):
""" Feeder for single inputs """
def __init__(self, data_path, label_path, shear_amplitude=0.5, temperal_padding_ratio=6, mmap=True):
self.data_path = data_path
self.label_path = label_p... |
from argparse import ArgumentParser
import logging
from torch import nn
from torch.optim import SGD
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torchvision.transforms import Compose, ToTensor, Normalize
from torchvision.datasets import MNIST
from ignite.engine import (
Events, cre... |
#!/usr/bin/env python3
import argparse
import collections
import os
import sys
ENCODING = 'utf-8'
BIG_FIRST = 1
BIG_LAST = 2
JOIN_INNER = 1
JOIN_LEFT = 2
JOIN_RIGHT = 3
JOIN_FULL = 4
DEFAULT_OUTER_NULL = ''
def header_and_column_to_rows(path, column):
with open(path, encoding=ENCODING) as f:
column_to_r... |
import logging
import os
import shutil
from collections import namedtuple
from pathlib import Path
import pytest
from deepmerge import always_merger
from ermaket import create_app
from ermaket.api.config import Config
from ermaket.api.database import DBConn
from ermaket.api.erd import ERD, Algorithm
from ermaket.api.... |
# Copyright (c) 2018 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, pyqtSlot
from typing import List, Mapping, Optional, TYPE_CHECKING
from UM.Application import Application
from UM.i18n import i18nCatalog
from UM.Logger import Logger... |
# Balanced binary search tree (AVL tree) implementation
class Node:
def __init__(self, key, value=None, parent=None, left=None, right=None):
self.key, self.value, self.parent = key, value, parent
self.child = [left, right]
self.balance, self.height = 0, 1
def __str__(self) -> str:
... |
#!/usr/bin/env python
from rdflib import Graph, Namespace, URIRef, Literal, RDF
import csv
import sys
import re
if len(sys.argv) != 4:
print >>sys.stderr, "Usage: %s <classes.csv> <glossary.csv> <metadata.csv>" % sys.argv[0]
sys.exit(1)
classes_file = sys.argv[1]
glossary_file = sys.argv[2]
metadata_file = s... |
"""
Refactored so more suitable for sharded daily qfq data table
"""
import sys
import time
import datetime
import logging
from sqlalchemy.exc import IntegrityError
import Utils.configuration_file_service as config_service
import Utils.DB_utils as dbUtil
import pandas as pd
import tushare as ts
from sqlalchemy impor... |
import asyncio
import random
import discord
from discord.ext import commands
import re
ball_response = [
"It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs ... |
from __future__ import annotations
from pygravity.twod.physics import PhysicsManager
from pygravity.twod.gravity import GravityAcceptor, GravityCaster, GravityContainer
from pygravity.twod.vector import Vector2
from typing import Dict, Generator, Iterable, List, Optional, Tuple, TypedDict, Union
__all__ = ['Body', '... |
import os
import time
from xml.etree import ElementTree as ET
from concurrent.futures import ProcessPoolExecutor
from tqdm import tqdm
import json
from util.normalization import (clean_text_from_xml)
from util.filters import (filter_allowed_letters_and_symbals, filter_right_length,
filter_only_words_in_BIN, filter_ou... |
# Modified scrip from http://karpathy.github.io/2016/05/31/rl/
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
# import cPickle as pickle
import pickle
import gym
from keras.layers import Dense, Input, Flatten, Convolution2D
from keras.models import Model, load_mo... |
#! /usr/bin/env python
import argparse
from pathlib import Path
import numpy as np
import pandas as pd
import xarray as xr
import scipy.stats as stats # for easy linear regression and testing
# GOAL: replace the "Tables" set in AMWG
# Set Description
# 1 Tables of ANN, DJF, JJA, global and regional means and RMSE.
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
####### - Usefuls links
# https://cryptobook.nakov.com/secure-random-generators/secure-random-generators-csprng
# https://en.wikipedia.org/wiki/List_of_random_number_generators
import os
from .bytesMethods import bytes_to_int, circularRotation, bytes_needed
from ressourc... |
# -*- coding: utf-8 -*-
""" Incident Reporting System - Controllers
@author: Sahana Taiwan Team
"""
module = request.controller
if module not in deployment_settings.modules:
session.error = T("Module disabled!")
redirect(URL(r=request, c="default", f="index"))
# Options Menu (available in all Function... |
import os
import time
import shutil
import mimetypes
import argparse
import json
import http.server
import urllib
from pathlib import Path
from collections import defaultdict
from .template import script, header
class RequestHandler(http.server.BaseHTTPRequestHandler):
def _get_item_list(self, path, recursive=Fa... |
#!/usr/bin/python3
"""A simple text editor app."""
import os
from os import listdir
import kivy
from kivy.app import App
from kivy.core.window import Window
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.modalview import ModalView
from kivy.u... |
import sys
import pdb
import numpy as np
import pandas as pd
import seaborn as sns
import pickle
from sqlalchemy import create_engine
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from sklearn.pipeline import Pipeline
from sklearn.metrics import confusion_matrix
from sklearn.model_sele... |
#!/usr/bin/env python3
# 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
# "L... |
from pymtl import *
from lizard.util.rtl.interface import UseInterface
from lizard.util.rtl.method import MethodSpec
from lizard.util.rtl.drop_unit import DropUnit, DropUnitInterface
from lizard.util.rtl.register import Register, RegisterInterface
from lizard.mem.rtl.memory_bus import MemMsgType, MemMsgStatus
from liza... |
import os # TODO remove this.
import pygame
import sys
from typing import Union
from pygame import Surface, SurfaceType
# from numpy import ndarray
import time
import numpy as np
import random
WIDTH = 600
HEIGHT = 600
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
PURPLE = (255, 0, 255)
WHITE = (255, 255, ... |
"""Read and write notebook files as XML.
Authors:
* <NAME>
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part ... |
#!/usr/bin/env python
# coding: utf-8
'''
Usage:
process_task.py <config_file>
process_task.py (--help|--version)
Arguments:
config_file the path of config_file
Options:
-h --help show this help message and exit
-v --version show version and exit
'''
import time
import sys
import os
i... |
#!/usr/bin/env python3
##############################################################################
# Copyright 2020 IBM Corp. 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 ... |
import traceback
def explore(adj, x, visited):
if x not in visited:
visited.append(x)
return list(adj[x])
return None
def number_of_components(adj):
visited = []
connected = 0
for x in range(len(adj)):
branch = explore(adj, x, visited)
if branch:
whi... |
from typing import Iterable
from nltk import Tree
from fastNLP.io.base_loader import DataBundle, DataSetLoader
from fastNLP.core.vocabulary import VocabularyOption, Vocabulary
from fastNLP import DataSet
from fastNLP import Instance
from fastNLP.io.embed_loader import EmbeddingOption, EmbedLoader
import csv
from typing... |
import json
import seaborn as sns
import re
import sys
import os
import os.path
import pandas as pd
import tinydb
from matplotlib import pyplot as plt
import pprint
DEFAULT_STYLE = {
'secondary': 'style'
}
pp = pprint.PrettyPrinter()
class ExperimentPlotter(object):
def __init__(self, base_path, data, confi... |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# modify: cyang
# date: 2018.05.08
# base on https://github.com/Litreily/capturer
# author: litreily
# date: 2018.03.07
"""Capture pictures from lofter with username."""
import re
import os
import platform
import requests
import time
import random
from download_process impor... |
#*****************************************************************
# terraform-provider-vcloud-director
# Copyright (c) 2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
#*****************************************************************
from pyvcloud.vcd.client import _WellKnownEndpoint
fr... |
import logging
import hipchat.room
import hipchat.config
from django.template.loader import render_to_string
from django.contrib.sites.models import Site
from djblets.siteconfig.models import SiteConfiguration
from reviewboard.accounts.signals import user_registered
from reviewboard.reviews.models import ReviewReques... |
import numpy as np
import torch
from torch import nn
import tensorflow as tf
from tensorflow.python.keras.engine import training
from tensorflow.python.keras import layers
# from tensorflow.python.keras.layers import VersionAwareLayers
import models
from handlers.fuse_torch_model import fuse
va_layers = layers # V... |
import argparse
import base64
import json
import os
import traceback
from electionguard import group
from electionguard.auxiliary import AuxiliaryKeyPair, AuxiliaryPublicKey
from electionguard.ballot import CiphertextAcceptedBallot
from electionguard.data_store import DataStore
from electionguard.decryption import com... |
# -*- coding: utf-8 -*-
"""Test the functions defined in vector_wave_functions.py."""
import numpy as np
import smuthi.field_expansion as fldex
import smuthi.vector_wave_functions as vwf
tau = 0
l = 4
m = -2
pol = 0
omega = 2 * 3.15 / 550
kp = omega * 1.7
alpha = 3.15/7
kz = np.sqrt(omega**2 - kp**2 + 0j)
x = 120
y =... |
import json
import mongodb_consistent_backup
import sys
from datetime import datetime
from argparse import Action
from pkgutil import walk_packages
from yconf import BaseConfiguration
from yconf.util import NestedDict
def parse_config_bool(item):
try:
if isinstance(item, bool):
return item
... |
from djitellopy import Tello
import cv2
import pygame
from pygame.locals import *
import numpy as np
import time
# Speed of the drone
S = 60
# Frames per second of the pygame window display
FPS = 25
class FrontEnd(object):
""" Maintains the Tello display and moves it through the keyboard keys.
Press esca... |
import os, sys
import moviepy.editor as mp
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from moviepy.video.VideoClip import TextClip, DataVideoClip
from moviepy.video.io.bindings import mplfig_to_npimage
from datafinder import DataFinder
import moviepy
"""
Creates a video that... |
import numpy as np
from matplotlib.colors import to_rgb, to_rgba
class SystemViewer:
default_settings = {'xlim': (-1.0, 1.0),
'ylim': (-1.0, 1.0),
'visible_dims': (0, 1),
'resolution': 10}
def __init__(self,
system: 'Con... |
# -*- coding: utf-8 -*-
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
import tensorflow as tf
from matplotlib.pylab import get_cmap
def expand_image_height(
tf_image: tf.Tensor, factor: int, scope: str = None
):
"""
Enlarges the input image-like tensor [H, W, C] of rank 3 in the first dimension (... |
""" Supermarket simulation
This module reads the probability tables and arrays processed by
probability_matrix_and_array.py to simulate customer behavior.
"""
import numpy as np
import random
from random import randint
import cv2
from probability_matrix_and_array import PorbabilityClass
class Customer(PorbabilityCla... |
import json
import logging
import requests
import os
try:
from tinydb import TinyDB
from flask import Flask, render_template, request, redirect, url_for
from scripts.utils import retrieve_hosts, retrieve_detections, update_needed, mailer
except Exception as error:
print(f'\nMissing import requirements:... |
from django.db import models
from modelcluster.contrib.taggit import ClusterTaggableManager
from modelcluster.fields import ParentalKey
from ndh.models import TimeStampedModel
from taggit.models import TaggedItemBase
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel
from wagtail.core.fields import RichTe... |
# -*- encoding:utf-8 -*-
import os
import zen
import math
import time
import hashlib
import binascii
from collections import OrderedDict
import flask
import dposlib
import dposlib.rest
import zen.misc
from zen.app.core import app
from zen.tbw import initDb
def connect(username):
if not hasatt... |
#!/usr/bin/python3
import numpy as np
import cv2
def parse_truth(truth):
"""
Parse the ground truth file, mapping each frame to the
number of people in it.
:param truth: Path to the truth file.
:return: A dict mapping keys to the true number of people contained in it.
"""
frame_to_count = ... |
# Copyright (c) 2015 Cisco Systems
#
# 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 writ... |
import os
import sys
path = os.path.dirname(os.path.abspath(""))+"/"
sys.path.append(path)
sys.path.insert(1, path+'cellpose/')
print(path)
from skimage import io
import numpy as np
from CellAnalysis.utils import *
from CellAnalysis import evaluation
from mAP_3Dvolume import vol3d_eval_custom, vol3d_util_custom
import ... |
from __future__ import absolute_import, division, print_function
import numpy as np
import pdb
from cfractald import corrDim, getCOMs
__all__ = ['corrcalc','getCOMsPy','getCOMs','getCOMnumpy','methodL','fit2']
def getCOMnumpy(poslist,masslist):
#return com coordinates of a single molecule, written in python using... |
from django.db import models
SOURCE = "source"
def SINK(arg):
print(arg)
assert arg == SOURCE
def SINK_F(arg):
print(arg)
assert arg != SOURCE
# ==============================================================================
# Inheritance
#
# If base class defines a field, there can be
# 1. flow w... |
import os
from daops.ops.subset import subset
from pywps import (
BoundingBoxInput,
LiteralInput,
Process,
FORMATS,
Format,
ComplexOutput,
)
from pywps.app.Common import Metadata
from pywps.app.exceptions import ProcessError
from flamingo.utils.input_utils import parse_wps_inpu... |
from numpy.linalg import inv, LinAlgError
from numpy import dot
from scipy.stats import norm
import numpy as np
import warnings
import matplotlib.pyplot as plt
def z_score(conf):
"""
:param conf: The level of confidence desired
:return: The Z-score corresponding to the level of confidence desired.
"""... |
from datar.base.verbs import complete_cases, proportions
import pytest
from pandas import DataFrame
from datar.base import *
from datar.tibble import tibble
from .conftest import assert_iterable_equal
def test_rowcolnames():
df = DataFrame(dict(x=[1,2,3]))
assert colnames(df) == ['x']
assert rownames(df) ... |
''' Define the sublayers in encoder/decoder layer '''
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import ipdb
import torchvision
import sys
sys.path.append('../.')
import models.cnn as cnn
import models.pretrained as pretrained
__author__ = "<NAME>"
class MGN(nn.Module):
... |
import torch
from torch import nn
from torch.nn import CrossEntropyLoss
from transformers import ElectraConfig
from transformers.modeling_electra import ElectraPreTrainedModel, ELECTRA_PRETRAINED_MODEL_ARCHIVE_MAP, ElectraModel
from seq2seq import seq2seq_rnn as sq
from seq2seq import highway as hw
import numpy as np
... |
#!/usr/bin/env python3
"""Check a user's KiCad6 configuration and emit diagnostics"""
import sys
import os
import argparse
import pathlib
import re
import json
import sexpdata
VERSION = '2022-03-12' # today's date
SYM_LIB_TABLE = {'name': 'sym_lib_table', 'file': 'sym-lib-table',
'var': 'KICAD6_SY... |
"""Utility functions for working with RDDs
These functions either take RDDs as their arguments
or can be used in the function call for a .map, .flatMap,
etc."""
from pyspark.mllib.regression import LabeledPoint
from constants import raster_extent
from raster_utils import coords_to_utm
def parse_taxi_record(line):
... |
#!/usr/bin/python
# 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
# "Licens... |
from lettuce import *
import importlib
import workflow
import activity
@step('Given I have imported a settings module')
def import_settings_module(step):
imported = None
try:
import settings as settingsLib
world.settingsLib = settingsLib
imported = True
except:
imported = Fa... |
# Copyright 2021 The XLS 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 or agreed to in writ... |
#!/usr/bin/env python
import numpy # Hint to PyInstaller
import cv2
import os
import threading
import wx
from HistogramClassifier import HistogramClassifier
from ImageSearchSession import ImageSearchSession
import PyInstallerUtils
import ResizeUtils
import WxUtils
class Luxocator(wx.Frame):
def __init__(self,... |
#!/usr/bin/env python
from argparse import ArgumentParser
from collections import Counter
from random import choice, random, seed
from typing import List
from evol import Evolution, ContestPopulation
from evol.helpers.pickers import pick_random
from evol.helpers.groups import group_duplicate
class RockPaperScissors... |
import os
import argparse
import molbart.util as util
from molbart.models.pre_train import BARTModel, UnifiedModel
from molbart.decoder import DecodeSampler
# Default training hyperparameters
DEFAULT_BATCH_SIZE = 128
DEFAULT_ACC_BATCHES = 1
DEFAULT_MASK_PROB = 0.10
DEFAULT_MASK_SCHEME = "span"
DEFAULT_LR = 1.0
DEFAU... |
# MIT License
#
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.options import Options
from database import queryCRNs, insertData
import ... |
"""Serializers for the importer app."""
from django.db.models import Q
from rest_framework import serializers
from projectroles.serializers import SODARProjectModelSerializer
from variants.serializers import CoreCaseSerializerMixin
from .models import (
BamQcFile,
CaseImportInfo,
DatabaseInfoFile,
Effe... |
from selenium.webdriver.common.keys import Keys
def search_for(browser, search_term):
browser.fill("search", search_term)
browser.type("search", Keys.RETURN)
browser.is_text_present("Create surface", wait_time=1)
def clear_search_term(browser):
clear_btn = browser.find_by_id('clear-search-term-btn')... |
from configparser import ConfigParser
import json
import logging
import mmap
import os
import requests
import sys
import time
import traceback
import yara
from subprocess import Popen, PIPE
# custom ConfigParser to keep case sensitivity
class CaseConfigParser(ConfigParser):
def optionxform(self, optionstr):
... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under ... |
import numpy as np
from bayes_implicit_solvent.molecule import Molecule
from simtk import unit
def sample_path_to_unitted_snapshots(path_to_npy_samples):
xyz = np.load(path_to_npy_samples)
traj = [snapshot * unit.nanometer for snapshot in xyz]
return traj
from glob import glob
from pkg_resources import ... |
import numpy as np
from pyoaz.memory import ArrayBuffer, MemoryBuffer
MAXLEN = 6
BOARDS_1 = np.array([[0, 0, 0], [1, 1, 1], [2, 2, 2],])
POLICIES_1 = np.array([[0.5, 0.5], [1.0, 0.0], [0, 1.0],])
VALUES_1 = np.array([0.0, 1.0, -1.0])
DATASET_1 = {"Boards": BOARDS_1, "Policies": POLICIES_1, "Values": VALUES_1}
BOARD... |
import numpy as np
import numpy.lib.recfunctions as nlr
from sigfig import round
from badcrossbar import utils
def complete_path(ctx, rgb=(0, 0, 0), width=1):
"""Completes the current path.
Parameters
----------
ctx : cairo.Context
Context.
rgb : tuple of int
Normalized RGB value ... |
"""
Simple Flask web site
"""
import flask
# from flask import render_template
from flask import request # Data from a submitted form
from flask import url_for
from flask import jsonify # For AJAX transactions
import json
import logging
import argparse # For the vocabulary list
import sys
# Our own modules
from l... |
# -*- coding: utf-8 -*-
"""
Tests for `simSpec` module.
"""
import numpy as np
from pathlib import Path
from astropy.io import fits
from copy import deepcopy
from fabspec import Spectra
from fabspec.simSpec import SimSpec
from fabspec.simSpec import SpecUtil as spec_util
from fabspec.skyLines import SkyLines
_PARENT... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright © 2012, 2013, 2014 OnlineGroups.net and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should acco... |
#!/usr/bin/python
# coding: utf8
# Copyright (c) 2014, 2015 <NAME>.
#
# This file is distributed under the new BSD License, see the LICENSE file or
# checkout the license terms at http://opensource.org/licenses/BSD-3-Clause).
from __future__ import absolute_import, division, print_function
from distutils.command.bu... |
'''
MIT License
Copyright (c) 2019 Harish
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, distri... |
import functools
import time
from .cache import Cache
class _Link(object):
__slots__ = (
'key', 'expire', 'size',
'ttl_prev', 'ttl_next',
'lru_prev', 'lru_next'
)
def __getstate__(self):
if hasattr(self, 'key'):
return (self.key, self.expire, self.size)
... |
from dash.exceptions import PreventUpdate
from dash import callback_context as ctx
from dash.dependencies import Input, Output, State
import plotly.express as px
import plotly.graph_objects as go
from plotly.colors import sample_colorscale, get_colorscale
from app import app, db
@app.callback(
Output('gene-drop... |
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from tkinter import *
import pyttsx3 as pp
import speech_recognition as sr
from googletrans import Translator
# --Training & Initializing the Bot--
# Creating a Chatbot Object
cbot = ChatBot('Demini')
# Read Text file
conv = open('data.txt', 'r... |
import configparser
from datetime import datetime
import os
import pymongo
import tweepy
tweet_time_format = "%a %b %d %H:%M:%S +0000 %Y"
cnfg = configparser.ConfigParser()
cnfg.read("../data/twitdata.ini")
error_fn = "twitter_errors.txt"
if not os.path.isfile(error_fn):
with open(error_fn, "w", encoding="utf-8... |
"""
Includes code from:
evolution-strategies-starter Copyright (c) 2016 OpenAI (http://openai.com)
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... |
from src.DataReader.KF_Data.KF_PrepData import DataManager
from scipy import signal
from src.Params import *
from src.Models.KF_Model.KF_BLock import *
from src.Models.KF_Model.KF_Model import *
import torch.optim as optim
import matplotlib.pyplot as plt
from src.Params import getNoiseLevel
dsName, subType,... |
import gc
import glob
import os
import json
import random
import numpy as np
import scipy.ndimage.interpolation as inter
import tensorflow as tf
from keras import backend as K
from numpyencoder import NumpyEncoder
from scipy.signal import medfilt
from scipy.spatial.distance import cdist
from sklearn.metrics import au... |
#!/usr/bin/python3
from pathlib import Path
def _parse_entry(entry):
"""Wrap in DocEntry object if it the entry was just a string"""
if isinstance(entry, str):
return doc_entry(entry)
else:
return entry
class Doc:
def __init__(self, title, underline_char, options, entries):
... |
#!/usr/bin/env python
"""
Stable split of files based on filename hash
Usage:
split.py [options] ALL_DATA_FOLDER OUTPUT_FOLDER
Options:
-h --help Show this screen.
--train-ratio FLOAT Ratio of files for training set. [default: 0.6]
--valid-ratio FLOAT Ratio of file... |
"""
Smart Symbols.
pymdownx.smartsymbols
Really simple plugin to add support for:
copyright, trademark, and registered symbols
plus/minus, not equal, arrows via:
copyright = `(c)`
trademark = `(tm)`
registered = `(r)`
plus/minus = `+/-`
care/of = `c/o`
fractions = `1/2` etc.
... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from kameleon_rks.tools.convergence_stats import autocorr
def pdf_grid(Xs, Ys, est):
D = np.zeros((len(Xs), len(Ys)))
G = np.zeros(D.shape)
# this is in-efficient, log_pdf_multiple on a 2d array is faster
for i, x in enumerate... |
from mesa import Mesa
from jogador import Jogador
from deck import Deck
import os
jogadores = [Jogador(), Jogador(), Jogador()]
deck = Deck()
cartaCentro = deck.comprar(1)
(cor,num) = cartaCentro[0].split("-")
pulo = 0
while num == "+2" or num == "@" or num == "<>" or num == "+4" or num=="COR":
cartaCentro = deck.co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.