text
stringlengths
3.07k
12.6k
""" The user has selected their options, collect them, edit rF2's data files as required and then call rF2 with any command switches. """ import steam import dummyRF2 from rF2_joinServer import runRf2Online # pylint: disable=import-error import os import subprocess import sys from data.rFactoryData import getSingleCa...
import pygame WHITE = (255, 255, 255) BLACK = (0, 0, 0) WIDTH = 600 HEIGHT = 600 pygame.init() game_font = pygame.font.SysFont('Ubuntu', 40) delay = 12 paddle_speed = 20 paddle_width = 10 paddle_height = 100 p1_x_pos = 10 p1_y_pos = HEIGHT / 2 - paddle_height / 2 p2_x_pos = WIDTH - paddle_width - 10 p2_y_pos =...
import os import re from functools import wraps from flask import request, redirect, url_for, render_template, \ send_from_directory, flash, jsonify, session, g from pe_uploader import app, db from pe_uploader.models import Files, User from pe_uploader.forms import LoginForm # from werkzeug import secure_filename ...
""" Utility functions """ import numpy as np from sklearn.metrics import * from sklearn.utils import multiclass from scipy.stats import pearsonr, spearmanr, kendalltau import torch def count_num_params(model): return sum(p.numel() for p in model.parameters() if p.requires_grad) def sum_ep_time(s_time, e_time)...
import os import sys import subprocess import argparse sys.path.append( os.path.dirname( os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) ) ) import pele_platform.constants.constants as cs class SystemBuilder(object): def __init__(self, receptor, ligand, residue, pele_...
import six from django import template from django.template.base import FilterExpression from django.template.loader import get_template from pypugjs.runtime import iteration register = template.Library() @register.tag(name="__pypugjs_attrs") def do_evaluate(parser, token): """Calls an arbitrary method on an ob...
# # Copyright (c) 2015 nexB Inc. and others. All rights reserved. # http://nexb.com and https://github.com/nexB/scancode-toolkit/ # The ScanCode software is licensed under the Apache License version 2.0. # Data generated with ScanCode require an acknowledgment. # ScanCode is a trademark of nexB Inc. # # You may not use...
# -*- coding: utf-8 -*- from flask import Flask, Response from flask_sqlalchemy import SQLAlchemy from flask import render_template from flask import request,redirect,url_for,jsonify import os from werkzeug.datastructures import Headers app = Flask(__name__) db_path = os.path.join(os.path.dirname(__file__), 'test.db...
from cryptography.fernet import Fernet from aiohttp import web try: import ujson as json except ImportError: import json from time import time, time_ns from Action import Action from Utils import Utils, Global, logs, loop, VkMethodsError from VkSession import VkSession class Data: __slots__...
# Globals # from bson.objectid import ObjectId from flask import jsonify, request from textblob import TextBlob from pprint import pprint import hashlib DEBUG = True """ DATA MODEL Collections: users, connections, conversations Users: {"_id": ObjectId(), "fb_id": int(), "email": str(), "password_hash": str(), "conn...
"""Collection of classes to convert data in text files to SQL files. Classes: - AutoMPGSQL: Class to convert the AutoMPG dataset to an SQL file. - BostonSQL: Class to convert the Boston dataset to an SQL file. - IrisSQL: Class to convert the Iris dataset to an SQL file. - WineSQL: Class to c...
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from django.conf import settings from django.contrib.staticfiles.templatetags.staticfiles import static from django.core.urlresolvers import get_resolver from django.core.urlresolvers import reverse fro...
from mathsat import msat_term, msat_env from mathsat import msat_make_constant, msat_declare_function from mathsat import msat_get_rational_type, msat_get_integer_type, \ msat_get_bool_type from mathsat import msat_make_and, msat_make_not, msat_make_or, msat_make_iff from mathsat import msat_make_leq, msat_make_equ...
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
# -*- coding: utf-8 -*- from collections import OrderedDict import six from slugify import UniqueSlugify from mlcomp.utils import camel_to_underscore, jsonutils from .types import get_default_report_types __all__ = [ 'ReportObject', 'ReportJsonEncoder', 'ReportJsonDecoder', ] class ReportObject(object): ""...
#!/usr/bin/env python import os import glob import subprocess as sp import argparse import sys from collections import defaultdict from itertools import chain import nose from conda_build.metadata import MetaData from toposort import toposort_flatten PYTHON_VERSIONS = ["27", "34", "35"] CONDA_NPY = "110" CONDA_PERL ...
import logging import copy import torch as th import torch.nn as nn from pgc_torch.utils.graph import NLayerFeedForwardNet from pgc_torch.utils.substructure import V1Inception, InceptionBaseRoute, EMTABMetaClass logger = logging.getLogger('django') IncMapping = dict() EMTABMetaClass.IncMapping = IncMapping class ...
# -*- coding: utf-8 -*- """ Created on Wed Apr 27 12:55:39 2016 @author: Dr. <NAME> European Space Agency (ESA) European Space Research and Technology Centre (ESTEC) Keplerlaan 1, 2201 AZ Noordwijk, The Netherlands Email: <EMAIL> GitHub: mnguenther Twitter: m_n_guenther Web: www.mnguenther.com """ from __future__ imp...
import numpy import marginalHelper import scipy.special import idcHelper # checked def newFastCalculationOfKLApproxForOneSigma(priorNu, n, p, tracePart, posteriorNu): firstLogPart = (n + priorNu) * p * numpy.log(posteriorNu + p + 1) # checked digammaPart = (posteriorNu - priorNu - n) * marginalHelper.get...
# Copyright (c) 2008, <NAME>, Inc. # All rights reserved. # # Software License Agreement (BSD License 2.0) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above co...
import torch import numpy as np import pylab as plt from skimage import filters import math global numpoints numpoints = 1000 side = 32 global background background = torch.zeros(2,side,side) for i in range(side): for j in range(side): background[0,i,j] = j background[1,i,j] = i def donut_matrix...
# Copyright 2017 <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, softw...
from flask import Flask,render_template,request,url_for,redirect import requests import re from nltk.corpus import wordnet from collections import Counter from bs4 import BeautifulSoup from numpy.linalg import norm from numpy import dot app=Flask(__name__) @app.route('/') def home(): return rende...
# -*- coding: utf-8 -*- from behave.configuration import Configuration from behave.userdata import UserData, parse_user_define from behave._types import Unknown from unittest import TestCase from nose.tools import eq_ class TestParseUserDefine(TestCase): """Test parse_user_define() function.""" def test_par...
import pandas as pd import numpy as np from sklearn.linear_model import SGDClassifier, LogisticRegression from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor from sklearn.naive_bayes import MultinomialNB, BernoulliNB from sklearn.ensemble import Ad...
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2016, <NAME> <<EMAIL>> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'communi...
import collections from typing import Union import numpy as np from sklearn.utils.validation import _deprecate_positional_args from sklearn.datasets import load_digits as sklearn_load_digits def _mg_eq(xt, xtau, a=0.2, b=0.1, n=10): """ Mackey-Glass time delay diffential equation, at values x(t) and x(t-tau)....
"""Tests for the plot module""" import numpy as np import pytest import matplotlib.pyplot as plt import earthpy.plot as ep plt.show = lambda: None @pytest.fixture def image_array_2bands(): return np.random.randint(10, size=(2, 4, 5)) @pytest.fixture def one_band_3dims(): return np.random.randint(10, size=...
#!/usr/bin/env python # Copyright (C) 2015-2021 Swift Navigation Inc. # Contact: https://support.swiftnav.com # # This source is subject to the license found in the file 'LICENSE' which must # be be distributed together with this source. All other rights reserved. # # THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHO...
# Using aiohttp server part since it already comes as part of aiohttp import asyncio import socket import ssl import subprocess from dataclasses import dataclass, field from http import HTTPStatus from pathlib import Path from tempfile import NamedTemporaryFile from typing import Optional import structlog from aiohttp...
from __future__ import print_function from enum import Enum EventType = Enum("EventType", "TICK BAR SIGNAL ORDER FILL SENTIMENT") class Event(object): """ Event is base class providing an interface for all subsequent (inherited) events, that will trigger further events in the trading infrastructure...
import os import fire import random from retry.api import retry_call from tqdm import tqdm from datetime import datetime from functools import wraps from stylegan2_pytorch import Trainer, NanException import torch import torch.multiprocessing as mp import torch.distributed as dist import numpy as np def cast_list(el...
from os import path from datetime import datetime import six import pytest from flaky import flaky import requests from Robinhood import Robinhood import helpers if six.PY2: from Robinhood import RH_exception HERE = path.abspath(path.dirname(__file__)) ROOT = path.dirname(HERE) CONFIG_FILENAME = path.join(HERE,...
import os import time import copy import datetime import json from argparse import ArgumentParser from pprint import pformat import logging import shutil import torch import numpy as np from torch.utils.tensorboard import SummaryWriter from utils import plot_confusion_matrix from dataset import SoundDataset from data...
# Copyright (c) 2016, <NAME> # # All rights reserved. # # See the file "LICENCE" for information about the copyright # and warranty status of this software. '''Class for handling environment configuration and defaults.''' import re from ipaddress import IPv4Address, IPv6Address from aiorpcx import Service, ServicePa...
from surpyvor import plots, utils, parse_arguments import tempfile import sys def main(): args = parse_arguments.get_args() utils.test_dependencies() if args.command == "merge": sv_merge(samples=args.variants, distance=args.distance, callers=args.callers, ...
import threading import time import datetime import struct from utils import int2bitarray from global_list import gloVar import logging logger = logging.getLogger(__name__) def dont_do_anything(): pass def robot_action(siemens_1500, positionByte, position, enableByte, enableBit, enable, glock): logger.inf...
# # Copyright (c) 2019-2022, NVIDIA CORPORATION. # # 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 ag...
#!/usr/bin/env python from optparse import OptionParser import urllib import urlparse import yaml import json, os, re, sys import pprint def get_command_line_options(executable_name, arguments): parser = OptionParser(usage="%s options" % executable_name) parser.add_option("-i", "--in", type="string", dest="inp...
import argparse import os from os.path import join import csv import unicodedata from string import punctuation import re from tqdm import tqdm import torch import torchaudio from librosa import resample MIN_SEC = 0.1 MAX_SEC = 15.0 TARGET_SR = 16000 # targeted sample rate for audio files TRAIN_ID = list(range(1, ...
import requests import sys import json import shutil import math import os import argparse USER_URL = 'https://api.unsplash.com/users/' HEADS = {'Accept-Version':'v1'} APP_ID = 'fa60305aa82e74134cabc7093ef54c8e2c370c47e73152f72371c828daedfcd7' #please provide your app_id here to download photos if not APP_ID: wit...
# coding: utf-8 ''' This script perform data matching between two journals Data Sets of various sources. ''' import logging import datetime from mongoengine import * import models logging.basicConfig(filename='logs/matches.info.txt', level=logging.INFO) logger = logging.getLogger(__name__) def match(dbcol1, dbcol2,...
import numpy as np from keras import backend as K from keras import Input, Model from keras.layers import Conv3D, MaxPooling3D, UpSampling3D, Activation, Conv3DTranspose, Concatenate, BatchNormalization from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint, EarlyStopping import tensorflow as tf...
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'efrenfuentes' MONEDA_SINGULAR = 'bolivar' MONEDA_PLURAL = 'bolivares' CENTIMOS_SINGULAR = 'centimo' CENTIMOS_PLURAL = 'centimos' MAX_NUMERO = 999999999999 UNIDADES = ( 'cero', 'uno', 'dos', 'tres', 'cuatro', 'cinco', 'seis', '...
#!/usr/bin/python3 import sys import os.path from icalendar import Calendar import recurring_ical_events from bs4 import BeautifulSoup import warnings from dateutil.parser import parse import datetime import csv warnings.filterwarnings("ignore", category=UserWarning, module='bs4') # We don't want warnings about URL's...
import os import platform import time import jinja2 import pandas as pd from docxtpl import DocxTemplate from pandas import DataFrame from webapp.controller.common import * from webapp.models import * import xlrd import xlutils.copy import platform from webapp.utils.date_encoder import * def reporter_chemical_not_li...
import numpy as np import os from PIL import Image import subprocess as sp import shutil import xml.etree.cElementTree as et import xml.dom.minidom from pathlib import Path def extract_frames(script_path, movies_path, images_path, image_size, isTraining): if (not os.path.isdir(os.path.join(script...
## @file Document.py # @brief Contains functions for adding text to document. # @author <NAME> # @date 12/31/2021 import win32com.client from enum import Enum, auto from pathlib import Path from docx import Document from docx.shared import Inches, Pt from docx.enum.text import WD_ALIGN_PARAGRAPH, WD_BREAK, W...
# -*- coding: utf-8 -*- """ kaylee.loader ~~~~~~~~~~~~~ Implements projects, controllers and Kaylee instance loader. :copyright: (c) 2012 by <NAME>. :license: MIT, see LICENSE for more details. """ import os import importlib import inspect import types from copy import deepcopy from collections i...
#!/bin/python ''' Sort coordinates to counterclockwise order, and make sure the polygon is closed Assumptions: - Coordinates are supplied as a list of lat, lon (y,x) pairs. - There is not a large polygon which spreads west -> east -175 lon -> 175 lon. All polygons are l...
# -*- coding: utf-8 -*- from dataclasses import dataclass from typing import List, Any, Dict import pandas as pd import matplotlib.pyplot as plt import json import os from user_events import UserEvents import user_events as uev from event_type import EventType import event_type as et @dataclass(frozen=True) class Fu...
from sentence_transformers import SentenceTransformer, util from tqdm.notebook import tqdm from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics import pairwise_distances_chunked from sklearn.metrics.pairwise import cosine_similarity from tensorflow.keras.metrics import CosineSimilarity from ...
# coding=utf-8 # Copyright 2022 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...
# 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...
# -*- coding: utf-8 -*- from gluon import current from gluon.html import * from s3 import FS, S3CustomController THEME = "historic.MCOP" # ============================================================================= class index(S3CustomController): """ Custom Home Page """ def __call__(self): resp...
"""Dyson climate platform.""" import logging from typing import List, Optional from libdyson import DysonPureHotCoolLink from custom_components.dyson_local.utils import environmental_property from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( CURRENT_H...
# Author: <NAME> # Email: <EMAIL> import os import cv2 import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.use("TkAgg") from toolkit.ui.ui_projectpoint import to_image_frame from toolkit.ui.ui_constants import RED_COLOR def _visualize_trajlet_on_frame(trajlet, bg_im, homog, color_rgb=RED_...
#!/usr/bin/python3 import os import sqlite3 from datetime import datetime from multiprocessing.dummy import Pool as ThreadPool from launchbar import LaunchBar DB_PATH = os.path.join(LaunchBar.support_path(), 'cache.db') def _get_or_fetch_map(x): return Cache().get_or_fetch(x[0], x[1]) class Cache: def __i...
# Case setup: using the number of cases, (1) iteratively create subdirectories for each case simulated. # (2) Create details files iteratively based on the case number (angle and flow rate in line one and 2 respectively--consider having a set number of figures for ease) import os import numpy as np import shutil ...
from collections import namedtuple, defaultdict import csv from distutils.util import strtobool import logging from pydoc import locate import math import gym import argparse import torch from . import wrappers as wrap Experience = namedtuple('Experience', ['state', 'action', 'reward', 'next_state', 'done']) class...
import os import sys from configparser import ConfigParser from datetime import datetime from itertools import islice from pathlib import Path from statistics import mean, stdev from time import strftime from typing import Union, Any, Dict import problog from problog.logic import Term parser = problog.parser.PrologPa...
# Sloppy Keras code to train a very basic MLP # Please have mercy on me. from __future__ import print_function import numpy as np np.set_printoptions(suppress=True) from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.utils import np_utils from keras.optimizers import SGD...
""" Sketching-based Matrix Computations """ # Author: <NAME> <<EMAIL>> # August 28, 2017 import numpy as np from scipy._lib._util import check_random_state, rng_integers from scipy.sparse import csc_matrix __all__ = ['clarkson_woodruff_transform'] def cwt_matrix(n_rows, n_columns, seed=None): r"""" Genera...
from fusion import * import torchvision.datasets as dset from lucchi import LucchiPPDataset, Resize, Scale from torch.utils import data import torch from torch.autograd import Variable from torchvision import utils as v_utils from torchvision import transforms import argparse, os from tqdm import tqdm from tensorboardX...
# Loading libraries import os import numpy as np import cv2 from PIL import Image import logging import tensorflow as tf # Function to greyscale, blur and change the receptive threshold of image def preprocess(image): gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) blur = cv2.GaussianBlur(gray, (3, 3), 6) ...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets from torchvision import transforms from torchvision.utils import make_grid from torchvision.utils import save_image from torch.utils.data import DataLoader import sys import os import ya...
#!/usr/bin/env python # wujian@2019 """ Provide a dependent io module for ndarray """ import struct import numpy as np def _serialize(fd, arr): support_dtype = { "float32": 'f', "float64": 'd', "int32": 'i', "int64": 'q' } dtype = str(arr.dtype) if dtype not in suppo...
from typing import ( List, Optional, Tuple ) from pathlib import Path from pydantic import ( BaseModel, Field, ) from .base import PyObjectId from datetime import datetime as dt from ..media.video import get_video_info class ExaminationDashboardData(BaseModel): id: Optional[PyObjectId] = Field...
# Helper functions to generate a simple C++ wrapper to support # enumeration in TCLAP def jHash(s): '''Compute the hash of the given string alla Java, but using uint32. See http://www.coderanch.com/t/329128/java/java/Java-String-hashcode-base-computation''' h = 0 for c in s: h = 0xFFFFFFFF & ((0xF...
# -*- coding: utf-8 -*- """ crawler egypt news into i18n_news_final use css selector template adopt multi site """ import sys, os reload(sys) sys.setdefaultencoding("utf-8") src_path = os.path.dirname(".") sys.path.append(src_path) sys.path.append(src_path+"/templates/") import logging import re import socket import ...
'''fitnes function creating individual creating gen selection from population new gens(N-Best/M-random) creating child creating children mutating word mutating population ''' #password==<PASSWORD> #individual== a palavra escolhida import random import operator #import time def fitne...
# 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 # distri...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ExtractorError class SkyItaliaBaseIE(InfoExtractor): _GET_VIDEO_DATA = 'https://apid.sky.it/vdp/v1/getVideoData?token={token}&caller=sky&rendition=web&id={id}' _RES = { 'low': [426, 240], ...
import sys from antlr4 import * from BitTuneGrammarLexer import BitTuneGrammarLexer from BitTuneGrammarListener import BitTuneGrammarListener from BitTuneGrammarParser import BitTuneGrammarParser total_notes = [] note_coordinates = [] current_shape = "oval" class BitTuneGrammarListener(BitTuneGrammarListener): ...
import logging import pandas as pd import os from collections import OrderedDict, Counter from config.constants import ANNOTATOR_A, ANNOTATOR_B, TYPE, SUBTYPE, ARG_1, ARG_2, ROLE, TP, FN, FP, P, R, F1 from scoring.scoring_utils import PRF def get_docs_by_annotator(docs, index_round, index_annotator, index_note, ta...
import datetime import operator import time import tushare as tushare from config import configManager from util import stockUtil # 初始化 TUSHARE_TOKEN = configManager.get(section='tushare', option='tushare_token') tushare.set_token(TUSHARE_TOKEN) tspro = tushare.pro_api(TUSHARE_TOKEN) # 计算过去n个交易日内最低价格 def get_history...
from weblogo.matrix import Motif from weblogo import * from weblogo.colorscheme import ColorRule, ColorScheme from weblogo.color import Color from weblogo import parse_prior import csv import re import numpy as np import matplotlib.pyplot as plt import matplotlib class SymbolIndexColor(ColorRule): """ Define ...
import os import sys from bs4 import BeautifulSoup import argparse import roblib __author__ = '<NAME>' def parse_run(filename, verbose): """ Parse a run.xml file. We mainly retrieve the SRA ID(s) from this file :param filename: the path and filename of the file to parse :type filename: str :par...
# coding=utf-8 import hashlib import os from subprocess import Popen, PIPE import arrow import yaml from bottle import route, run, auth_basic, redirect, response PROJECTS_FOLDER = 'projects' BUILD_ARCHIVE_FOLDER = 'builds' SOURCE_FOLDER = 'source' CONFIG_FILE = 'config.yaml' BUILD_NUMBER_FILE = '.lastbuildnumber' USE...
#!/usr/bin/env python #===- lib/sanitizer_common/scripts/gen_dynamic_list.py ---------------------===# # # The LLVM Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. # #===----------------------------------------...
from pyforms.gui.Controls.ControlBase import ControlBase from PyQt4 import QtGui try: from OpenGL.GL import * from OpenGL.GLU import * from PyQt4.QtOpenGL import QGLWidget except: print ("No OpenGL library available") import itertools class OpenglGLWidget(QGLWidget): def __init__(self, parent=None): QGLWidge...
import pytest import gilded_rose quality_test_cases = ( ("expected_quality", "item", "comment"), [ (0, gilded_rose.Item("foo", 10, 0), "idk what i'm doing"), (49, gilded_rose.Item("foo", 10, 50), ""), (49, gilded_rose.Item("foo", 50, 50), ""), (50, gilded_rose.Item("Aged Brie"...
from typing import Dict from Tools import counter as c from enum import Enum import copy class GameError(Exception): pass class CatSearchingError(GameError): pass class FrozenError(GameError): def __init__(self, type_of): super(FrozenError, self).__init__(self, f"This {type_of} is frozen") ...
""" File: bootstrap.py Version: 0.1.0 Author: Hugo4IT License: MIT Repository: https://github.com/Hugo4IT/Hug Description: Entry point for bootstrapper located in bootstrap/compiler.py """ import os import sys import time import logging import colorama import bootstrap.compiler as compiler LOGGING_FMT_BASE = coloram...
""" Functions for handling exclusion of images ranges from scans based on a command line option, as well as obtaining a selection to use for selecting the corresponding reflections. """ from __future__ import absolute_import, division, print_function from orderedset import OrderedSet import iotbx.phil from dials.arr...
import os import json import numpy as np import pandas as pd import model_training.config as train_cfg import datagen_config as datagen_cfg from utilities.preprocessing import apply_per_band_min_max_normalization def get_rgb_subtile(subtile): subtile_w0 = subtile.shape[0] subtile_w1 = subtile.shape[1] rg...
""" Support utilities for bindings. """ import glob import json import gettext import inspect import os import re import sys import importlib.util def load_source(module_name, file_path, add_to_sys=False): spec = importlib.util.spec_from_file_location(module_name, file_path) module = importlib.util.module_fro...
#!/usr/bin/env python3 # Copyright (C) 2017-2020 The btclib developers # # This file is part of btclib. It is subject to the license terms in the # LICENSE file found in the top-level directory of this distribution. # # No part of btclib including this file, may be copied, modified, propagated, # or distributed except...
"""Summarise XFEL data in files or folders """ import argparse from collections import defaultdict import os import os.path as osp import re import sys from .read_machinery import FilenameInfo from .reader import H5File, RunDirectory def describe_file(path, details_for_sources=()): """Describe a single HDF5 data...
import numpy as np import imutils import cv2 import argparse class TwoImagesStitcher: def __init__(self, ratio=0.75, reproj_thresh=4.0, show_matches=False): self.is_opencv_3 = imutils.is_cv3() self.ratio = ratio self.reproj_thresh = reproj_thresh self.show_matches = show_matches ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 5 20:58:34 2018 @author: harry """ import torch import torch.nn as nn from hparam import hparam as hp from utils import get_centroids, get_cossim, calc_loss from torch.nn.modules.utils import _triple from module import SpatioTemporalConv class...
########################################################## ### Import Necessary Modules import argparse #provides options at the command line import sys #take command line arguments and uses it in the script import gzip #allows gzipped files to be read ...
#!/usr/bin/env python3 import sys, getopt, math, os, time, multiprocessing, traceback import numpy as np ################################# Arguments ################################### # Default values end_t = 60 # in seconds dt = 0.015/1000 nsave = 5000 alpha = 4331293.0 n_traj = 100 mutant_type_list = ['fast', 'slow...
import itertools import pytest @pytest.mark.parametrize("predicate, inputs, expected", [ (lambda x : x == x, [], []), (lambda x : x == x, [-3,-2,-1,0,1,2,3], []), (lambda x : x < 6, [1,2,3,4,5], []), (lambda x : x > 6, [1,2,3,4,5], [1,2,3,4,5]), (lambda x : x % 3, [1,2,3,4,5], [3,4,5]), (lambda...
from compas.datastructures import Mesh from numba import jit import numpy as np from numba.typed import List __all__ = ['tia_mesh', "tia_assembly"] class tia_mesh: faces_boundary = List() faces_normal = List() def __init__(self, compas_mesh): for f in compas_mesh.faces(): face_loop = Li...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Copyright © 2014 - 2021 German Neuroinformatics Node (G-Node) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted under the terms of the BSD License. See LICENSE file in the root of the Project. Au...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals # The MIT License # Copyright (c) 2017 - 2022 <NAME>, <EMAIL> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"...
import pyfits as pf import matplotlib.pyplot as plt import emcee import numpy as np from astroML.density_estimation import XDGMM from matplotlib.patches import Ellipse from astroML.plotting.tools import draw_ellipse plt.switch_backend("Agg") import pandas as pd import seaborn as sns import itertools sns.set_style("wh...
"""A script which exports the subset of this repository required for target(s). This project is getting large. This has two major downsides: * Fresh checkouts of the git repository take longer and consume more space. * The large number of packages is confusing to newcomers. I feel like there's a 90-10 rule that a...
from __future__ import absolute_import import numpy as np import mxnet as mx import mxnet.ndarray as nd def data_type_dict(): return {'float16' : np.float16, 'float32' : np.float32, 'float64' : np.float64, 'uint8' : np.uint8, 'int8' : np.int8, 'int1...