text
stringlengths
3.07k
22.1k
"""Functions for image processing """ # MIT License # # Copyright (c) 2017 <NAME> # Copyright (c) 2020 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includin...
#! /usr/bin/python import os import sys import json import luigi import numpy as np import nifty.tools as nt import vigra from elf.segmentation.mutex_watershed import mutex_watershed import cluster_tools.utils.volume_utils as vu import cluster_tools.utils.function_utils as fu from cluster_tools.cluster_tasks import ...
""" PV system functions """ import logging import os from datetime import datetime, timedelta, timezone from typing import List, Optional import pandas as pd from nowcasting_datamodel.models.pv import PVSystem, PVSystemSQL from nowcasting_datamodel.read.read_pv import get_latest_pv_yield from nowcasting_datamodel.read...
import urllib.request import urllib.parse import sys, os # # Refer https://wiki.cancerimagingarchive.net/display/Public/REST+API+Usage+Guide for complete list of API # source: github.com/sharmalab/tcia-sdk class TCIAClient: GET_IMAGE = "getImage" GET_SINGLE_IMAGE = "getSingleImage" GET_MANUFACTURER_VALUES ...
r"""Functions for exclusive $D\to P\ell\nu$ decays. Copied from `flavio.physics.bdecays.bplnu` """ from math import sqrt import flavio from flavio.physics import ckm from flavio.classes import AuxiliaryQuantity from flavio.config import config from flavio.physics.running import running from flavio.physics.bdecays imp...
# Copyright 2018 DeepMind Technologies Limited. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
import asyncio import functools import logging from multiprocessing.managers import ( # type: ignore # Typeshed definition is lacking `BaseProxy` BaseManager, BaseProxy, ) import pathlib import pickle import threading import traceback from typing import ( # noqa: F401 Any, AsyncGenerator, Callable...
import matplotlib.pyplot import matplotlib import altair as alt import seaborn as sns def get_colors(all_palettes=False): """ Generates a dictionary of standard colors and returns a sequential color palette. Parameters ---------- all_palettes : bool If True, lists of `dark`, `primary`...
# Copyright (c) 2017-2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from io import StringIO from itertools import product import json from keyword import iskeyword import os.path from typing import Dict, TextIO from google.protobuf.compiler.plug...
#cnn_datastruct #helpful dataa structures and statistics functions for the cnn_mlrad project # Author: <NAME> et al. #Updated: 04 July 2019 import argparse import os import time import sys import math import numpy as np import tensorflow as tf from sklearn import metrics from PIL import Image import time import re impo...
import os import pickle from socket import socket from sys import path import time from OpenSSL import SSL from OpenSSL import crypto import OpenSSL from flask import Flask, json,jsonify,send_file from flask.helpers import flash, url_for from flask import Flask, redirect, url_for, request from flask.templating import r...
# -*- encoding: UTF-8 -*- import minivisitor import miniutils import minitypes import specializers def admissible(broadcasting_tuple, n_loops): """ Check for admissibility. Indicates whether partial hoisting is the most efficient thing to perform. See also partially_hoistable() """ if len(broadcas...
## Normal to depth with knowing one depth map and corresponding normal map. ## Infer the depth map based on neighboring 4/8 pts ## Author: <NAME> ## Date: 06/07/2017 import tensorflow as tf import numpy as np import scipy.misc as sm def normal2depth_layer(depth_map, normal_map, intrinsic): ## depth is of rank 3...
import os, os.path, shutil, json, sys try: import IPython from notebook import notebookapp from IPython.terminal.ipapp import TerminalIPythonApp from jupyter_client import kernelspec from traitlets.config import Config except: print("Warning: Failed to load IPython/Jupyter. Some features disa...
#!/usr/bin/env python3 # Copyright GC-DPR authors. # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Command line tool to get dense results and validate them """ impor...
#뭔가추가 from Crypto.Cipher import AES import pickle import os from tkinter import * import tkinter.messagebox from tkinter import filedialog from Crypto.Hash import SHA256 as SHA from src.Structure import filesystem from src.Structure import foldersystem from pathlib import Path import shutil filename = '' def makeWi...
import tkinter as tk from tkinter import ttk from tkinter import messagebox from datetime import datetime from . import widgets as w class DataRecordForm(tk.Frame): """The input form for our widgets""" def __init__(self, parent, fields, settings, *args, **kwargs): super().__init__(parent, *args, **kw...
import torch import numpy as np from e2edet.utils.det3d.geometry import points_in_convex_polygon_3d_jit def box_cxcyczlwh_to_xyxyxy(x): x_c, y_c, z_c, l, w, h = x.unbind(-1) b = [ (x_c - 0.5 * l), (y_c - 0.5 * w), (z_c - 0.5 * h), (x_c + 0.5 * l), (y_c + 0.5 * w), ...
# Copyright 2012 Google Inc. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agre...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Model an astronomical source for spectroscopic simulations. An source model is usually initialized from a configuration used to create a simulator and then accessible via its ``source`` attribute, for example: >>> import specsim.simulator >>> ...
# Copyright 2021 <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, soft...
import numpy as np import tensorflow as tf import time as time from datetime import datetime from data_wrapper import DataReader reader = DataReader() graph = tf.Graph() session = tf.Session(graph=graph) start_time = datetime.now().strftime('%m-%d-%H-%M-%S') # global parameters batch_size = 65 learning_rate = .0005 ...
##################################### #/---------------------------------\# #| pokemon.py v3.4 by <NAME> |# #| |# #| requires (in same folder): |# #| - m_db.py |# #| |# #| use module_help() for |# #| instructions on ...
################################################################################ # 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...
import tensorflow as tf from typing import List, Tuple from calamari_ocr.ocr.model.params import ModelParams, LayerType, LayerParams from tensorflow.python.ops import array_ops from tensorflow.python.ops import ctc_ops as ctc from tfaip.base.model.graphbase import GraphBase keras = tf.keras K = keras.backend KL = k...
# coding: utf-8 """JupyterLab Server handlers""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json import os from urllib.parse import urlparse from jinja2 import FileSystemLoader, TemplateError from tornado import template, web from traitlets import Bool,...
import preproc.utils as utils import visualization.utilsviz as utilsviz import models.models as models from models.metrics import numpy_dice import os from os.path import join, getmtime import SimpleITK as sitk from pandas import DataFrame from config.MainConfig import getMakeSegmentationConfig from inout.io_mri import...
import torch import torch.nn as nn from torch.nn import functional as F class proto_support_detector(nn.Module): def __init__(self, obj_dim, rel_dim, num_rel_cls): super().__init__() self.obj_dim = obj_dim self.rel_dim = rel_dim # self.conv_sub = nn.Conv1d(obj_dim, 512, kernel_size...
""" Used to draw R-D curves data format: bpp, ms-ssim(db), psnr(db) """ import os import argparse import numpy as np from fjcommon import functools_ext as ft from fjcommon.iterable_ext import flag_first as flag_first_iter import matplotlib as mpl mpl.rcParams['text.latex.unicode'] = True mpl.use('Agg') # No display...
import numpy as np def get_pad_shape(auto_pad, # type: Text input_spatial_shape, # type: Sequence[int] kernel_spatial_shape, # type: Sequence[int] dilations_spatial, strides_spatial, # type: Sequence[int] output_spatial_shape...
#!/usr/bin/env python import unittest import random from collections import Counter from hypothesis import given, assume, settings, note from hypothesis.strategies import text, builds, floats, sampled_from, composite, random_module, integers from Bio import Phylo from Bio.Phylo.BaseTree import Tree, Clade from StringIO...
#!/usr/bin/env python3 import os import shutil from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, am_patches, walk_if, copy_to def run_global_replacements(wpiutil_llvm_files): for wpi_file in wpiutil_llvm_files: with open(wpi_file) as f: cont...
""" Constructor for permutations This module contains the generic constructor to build element of the symmetric groups (or more general permutation groups) called :class:`~sage.groups.perm_gps.permgroup_element.PermutationGroupElement`. These objects have a more group theoretic flavor than the more combinatorial :clas...
from utils import * from sklearn.metrics import auc def compute_p(true_val, n_interest, n_total, n_permutations=10000): null_distribution = [] norm = n_interest * n_total for _ in range(n_permutations): interest = set(np.random.choice(n_total, size=n_interest, ...
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS I...
# encoding=utf-8 """ Created on 21:38 2019/07/23 @author: <NAME> It's about the class of dataset """ import numpy as np from torch.utils import data import h5py import os import torch import tables from batchup.datasets import dataset, svhn from batchup.image.utils import ImageArrayUInt8ToFloat32 from confi...
# coding: utf-8 """Convert array syntax in php files. """ import os import json import subprocess import sublime import sublime_plugin __version__ = '0.2.0' __author__ = '<NAME>' __copyright__ = 'Copyright 2017 - 2021, <NAME>' __license__ = 'MIT' SETTINGS_KEY = 'PhpArrayConverter.sublime-settings' class PhpArray...
"""Wrappers for different backbones for models that follows Encoder-Decoder architecture. Encodes listed here provides easy way to swap backbone of classification/segmentation/detection model. """ from collections import OrderedDict from typing import List import torch from torch import nn from torchvision.models imp...
from enum import Enum import functools import copy import numpy as np from numpy.linalg import inv, norm import scipy.integrate from scipy.spatial.transform import Rotation class ExitStatus(Enum): """ Exit status values indicate the reason for simulation termination. """ COMPLETE = 'Success: End reached.' ...
import numpy as np from scipy import optimize import matplotlib.pyplot as plt def u_func(c,h,phi=0.3): # equation 1 """ Equation (1) from the sheet (a Cobb-Douglas util func) Returns utility from consumption and housing Arguments: c: consumption h: housing phi: preferences (d...
############################################################################### # EvoMan FrameWork - V1.0 2016 # # DEMO : Neuroevolution - Genetic Algorithm with neural network. # # Author: <NAME> # # <EMAIL> ...
from flask import Flask, g, render_template, url_for, abort from flask import make_response, request from jinja2 import FileSystemLoader from sqlalchemy.sql.expression import func import itertools import pickle from trajectory import config as TRJ from trajectory.utils.prereqs import get_prereq_graph from trajectory.u...
import numpy import pytest import sympy from mpmath import mp import quadpy mp.dps = 50 test_cases = [ (lambda t: 1, -1, +1, 2), (lambda t: 1, 0, +5, 5), (lambda t: t, -0, +1, sympy.Rational(1, 2)), (lambda t: t ** 2, -1, +1, sympy.Rational(2, 3)), # Bailey example 1: (lambda t: t * sympy.log...
#!/usr/bin/env python # a bar plot with errorbars import matplotlib import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Ellipse, Polygon from pylab import * width=0.28 # the width of the bars font = {'family' : 'sans-serif', 'variant' : 'normal', 'weight' : 'light', ...
# Copyright (c) 2022 <NAME> from __future__ import annotations import enum from typing import TYPE_CHECKING from pywayland.server import Signal from wlroots import ffi, lib, Ptr, PtrHasData, str_or_none from wlroots.wlr_types.surface import Surface as WlrSurface if TYPE_CHECKING: from typing import TypeVar ...
# Futu Algo: Algorithmic High-Frequency Trading Framework # Copyright (c) billpwchan - All Rights Reserved # Unauthorized copying of this file, via any medium is strictly prohibited # Proprietary and confidential # Written by <NAME> <<EMAIL>>, 2021 import csv import sqlite3 import humanize import openpyxl impor...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal from torch.optim import Adam from collections import deque import copy class ReplayMemory: def __init__(self, capacity): self.capacity = capacity self.buffer = deque(maxlen =...
"""Tentative prolongator""" __docformat__ = "restructuredtext en" import pdb import sys import warnings import numpy as np from scipy.sparse import isspmatrix_csr, isspmatrix_bsr, bsr_matrix, csr_matrix, identity, vstack, dia_matrix from scipy import linalg, array from pyamg import amg_core from copy import deepcop...
import torch import matplotlib.pyplot as plt import numpy as np from skimage import io as img from skimage import color, filters, morphology import os import glob from PIL import Image import torchvision.transforms as transforms from . import keypoint_functions def makedir(path): try: os.makedirs(path) ...
import sys, pygame from config import * import numpy as np from random import choice class game_matrix: __slots__ = "grade_type","edit_cubes","round","color_matrix","new_color","sand_board","cube_count","cube_matrix" def __init__(self): self.cube_matrix = [[0 for j in range(5)] for i in range(3)] ...
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
from typing import List, Dict, Any from sqlalchemy import tuple_, func, literal, and_, desc, Float from sqlalchemy.sql import case, cast from vardb.datamodel import gene, user as user_model from api.util.util import paginate, rest_filter, authenticate, request_json from api import schemas, ApiError from api.v1.resourc...
import os import time import torch import numpy as np import cv2 import argparse from model.vbde_stepmask import VBDE_STEPMASK from tqdm import tqdm ########################################## # Open a log file ## # Write log message to file and stdout ## ########################################...
import pickle as pkl from argparse import ArgumentParser from copy import deepcopy from time import time import numpy as np import pandas as pd import torch from allennlp.commands.predict import Predictor from allennlp.data import Vocabulary from allennlp.models.archival import load_archive from tqdm import tqdm from...
"""Tensor Class.""" import functools import operator import numpy as np # PyCUDA initialization import pycuda.driver as cuda import pycuda.autoinit from pycuda.compiler import SourceModule from .gpu_kernels import add, arithmetic from .states import TensorState ops = {"+": operator.add, "-": operator.sub, "*":...
import requests from time import sleep import os def crash_on_error(response): """ Function used to raise exception and end client work. :param response: Response object with answer from rest api game server """ if response.status_code != 200: raise Exception(f"Something goes wrong. Server...
""" 해당 코드는 pyTorch를 통해서 다음의 [논문](https://akmenon.github.io/papers/autorec/autorec-paper.pdf)을 구현한 코드입니다. """ import pickle import pandas as pd import numpy as np import os, sys, gc from torch.utils.data import Dataset, DataLoader import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.in...
import os import sys import numpy as np import drlfads if drlfads.USE_MATLAB: import matlab.engine from pathlib import Path from scipy.stats import multivariate_normal from pybulletX.utils.space_dict import SpaceDict from gym import spaces from drlfads.utils.force_plot import ForcePlot from drlfads.utils.path ...
import os from metaseg_io import metaseg import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from scipy.stats import pearsonr, kde from sklearn.metrics import mean_squared_error, r2_score, roc_curve, auc import numpy as np def add_scatterplot_vs_iou(ious, sizes, dataset, shortname, size_fac, sc...
#! /usr/bin/env python # -*- coding:utf8 -*- # # solver.py # # This file is part of pymls, a software distributed under the MIT license. # For any question, please contact one of the authors cited below. # # Copyright (c) 2017 # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # Permission is hereby granted,...
# coding=utf-8 """ Nifti file consistency checking utilities """ #------------------------------------------------------------------------------ #Author: <NAME> <<EMAIL>> #Grupo de Inteligencia Computational <www.ehu.es/ccwintco> #Universidad del Pais Vasco UPV/EHU # #2013, <NAME> #Use this at your own risk! #--------...
from daiquiri.core.renderers import XMLRenderer from daiquiri.core.renderers.datacite import DataciteRendererMixin from daiquiri.core.renderers.dublincore import DublincoreRendererMixin from daiquiri.core.renderers.voresource import VoresourceRendererMixin class OaiRenderer(DublincoreRendererMixin, DataciteRendererMi...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- #### # File: create_folder_by_season.py # Project: Desktop #----- # Created Date: Sunday 29.12.2019, 20:45 # Author: Apop85 #----- # Last Modified: Tue Jan 07 2020 #----- # Copyright (c) 2020 Apop85 # This software is published under the MIT license. # Check http://www.ope...
from pathlib import Path from datetime import datetime, timezone import requests import dataclasses import json import subprocess import shutil import sys from typing import Optional api_version = "v0a884" api = f"https://api.cloudflareclient.com/{api_version}" reg_url = f"{api}/reg" status_url = f"{api}/client_config...
from functools import partial import argparse import os import os import torch # Internal Imports from operations import LEN_OPS # DEFAULTS # LOGGING Congig LOGDIR = "logs" # DATASET Config dir_path = os.getcwd() DATASET = "cifar10" DATAPATH = os.path.join(dir_path, "data") # WEIGHTS Config WEIGHTS_LR = .025 WE...
import eventlet eventlet.monkey_patch() import os import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), u".."))) import re from flask import Flask, request, session, render_template, abort, Response from flask_socketio import SocketIO, join_room, emit, send import json import uuid from c...
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 """ About: YOLOv2 Server """ import argparse import os import socket import struct import sys import json import time import cv2 import numpy as np import tensorflow as tf from utils.config import class_names, anchors from utils.imgutils import image_...
from flask import Flask, render_template, request, jsonify, render_template, url_for import nltk import pickle import json import string import spacy import re nlp = spacy.load('en_core_web_sm') nltk.download('wordnet') nltk.download('vader_lexicon') from sklearn.feature_extraction.text import TfidfVectorizer from s...
from collections import OrderedDict from glob import glob import numpy as np import os import tqdm import mne from mne.io.eeglab.eeglab import _check_load_mat, _get_info from mne.preprocessing import read_ica_eeglab from mne.io import read_raw_eeglab from .config import eegip_config, load_additionnal_config from .uti...
import torch import torch.nn as nn import torch.nn.functional as F from vit_pytorch.face_losses import CosFace # Pre-defined CCT Models __all__ = ['cct_2', 'cct_4', 'cct_6', 'cct_7', 'cct_8', 'cct_14', 'cct_16'] def cct_2(*args, **kwargs): return _cct(num_layers=2, num_heads=2, mlp_ratio=1, embedding_dim=128, ...
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
# Copyright 2019 The TensorFlow Probability 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 o...
import os import random import sys import time from matplotlib import pyplot as plt import numpy as np from PIL import Image import seaborn as sns class Battleship(object): """ This class is used to start a game: initialize a Field() and randomply place Ship()'s. """ def __init__(self, num_ships=2, s...
''' Update notes by PRK Nov 10: Taken out zipcode column entirely and added three more column removals (have commented in front) Also commented out the print order''' # Importing the required libraries and methods import matplotlib.pyplot as plt import numpy as np import pandas as pd import math impor...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json from json import JSONEncoder import os import sys from collections.abc import Mapping from glob import glob import re from typing import List, Dict, Optional, Any, Tuple, Iterator, overload, Union if sys.version_info >= (3, 8): from typing import Literal ...
""" Support functions for digital gates """ from functools import partial from qcodes import ChannelList from qcodes.utils.validators import Numbers, Bool, MultiType, Enum try: import MDAC except ModuleNotFoundError: class _Blank(): MDACChannel = type(None) MDAC = type(None) MDAC = _Blank(...
"Functions implementing part editing" import json from ... import skilift from ....skilift import fromjson, editpage, editsection, item_info from ... import FailPage, ValidateError, GoTo, ServerError from ....ski.project_class_definition import SectionData def retrieve_editpart(skicall): "Fills in the edit a...
#!/usr/bin/env python3 #coding=utf-8 import argparse import signal import sys,os import time,datetime import logging from rpi_rf import RFDevice #sudo pip3 install rpi-rf from my_mqttClass import * #Connect to your cloud if you have (second version) rfdevice = None pathname = os.path.join(os.getcwd(),'debug...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2014: # <NAME>, <EMAIL> from __future__ import print_function import time import sys from opsbro.characters import CHARACTERS from opsbro.log import cprint, logger from opsbro.unixclient import get_request_errors from opsbro.cli import get_opsbro_local...
import re import os import random import numpy as np from PIL import Image import matplotlib.pyplot as plt class ImageNotExistError(FileNotFoundError): pass class RamdonWalk: ''' RamdonWalk class instance properties: mu, x0, sigma2, N methods: walk, show_info, plot ''' def __init__(self,...
import numpy as np import time import matplotlib.pyplot as plt bit_num_in_uint8 = np.array([0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, \ 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, \ 2, 3, 3, 4, 2, 3...
# __filename__: json_builder.py # # __description__: this collects all newsdata and combines it to a json file/ data # # __remark__: # # __todos__: # # Created by <NAME> in November 2017 import pickle import re from datetime import datetime as dt from script_structure import my_main from my_constants import * from j...
#!/usr/bin/env python """ Run a command in docker without requiring full docker permissions. Allowing a user to run the docker command directly is equivalent to giving them root access to the host machine. In order to avoid that, this command lets a system administrator grant a regular user access to run a specific d...
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython NOTE: Partially functional (more information needed) """ import datetime from dataclasses import dataclass, field from tkinter import Button, Entry, Frame, Label, Text, Toplevel, Tk, ttk def _today_date(): return datetime.date.today().strftime("%d/%m/...
""" Provides a method of normalising the flow rules in a pipeline to canonical form so that two solutions can easily be compared for equality and in the case of conflicts those conflicting portions of traffic can be identified. This implementation uses binary decision diagrams to compute equality. """ # Copyright 201...
# Copyright Amazon.com Inc. or its affiliates. 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. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying...
#!/usr/bin/env python # # Copyright (c) ZeroC, Inc. All rights reserved. # import os, subprocess, glob, tempfile from IceCertUtils.CertificateUtils import DistinguishedName, Certificate, CertificateFactory, b, d, read, opensslSupport, write class KeyToolCertificate(Certificate): def __init__(self, *args): ...
import os import numpy import time import json from xminds.compat import logger from ..baserecoapi import BaseRecoApi, JobFailedException, S3Exception from ..config import AWS_SCHEMAS, AWS_LOCAL_DATASET_DIR class AmazonPrepareApi(object): LOCAL_DIR = AWS_LOCAL_DATASET_DIR def __init__(self, api_clients): ...
from __future__ import print_function import torch from torch.autograd import Variable from .visual_evaluation import plot_images from .load_data import load_dataset from .distributions import log_Normal_diag from .knnie import kraskov_mi as ksg_mi import numpy as np import time import os from sklearn.cluster impor...
import logging import random import time from json import JSONEncoder import WMCore from Utils.IteratorTools import grouper from WMCore.Database.CMSCouch import CouchNotFoundError from WMCore.Services.WMStats.WMStatsReader import WMStatsReader def monitorDocFromRequestSchema(schema): """ prun and convert ...
import numpy as np from sklearn.neighbors import NearestNeighbors import torch ### def square_distance(src, dst): # link: http://www.programmersought.com/article/8737853003/#14_query_ball_point_93 """ dist = (xn - xm)^2 + (yn - ym)^2 + (zn - zm)^2 = sum(src**2,dim=-1)+sum(dst**2,dim=-1)-2*src^T*...
import sys, random, json, os.path from PyQt5 import QtCore, QtWidgets from PyQt5.QtWidgets import QMainWindow, QWidget, QLabel, QGridLayout, \ QPushButton, QTextEdit, QVBoxLayout, QHBoxLayout, QGroupBox, QSpinBox, \ QMessageBox from PyQt5.QtCore import pyqtSlot from PyQt5.QtGui import QIcon class MainWindow(Q...
""" DeepCache DeepCache is distributed under the following BSD 3-Clause License: Copyright(c) 2019 University of Minensota - Twin Cities Authors: <NAME>, <NAME>, <NAME>, <NAME>, and <NAME> All rights reserved. Redistribution and use in source and bin...
import numpy as np import tensorflow as tf1 import tensorflow.compat.v2 as tf import argparse from utils import * tf1.compat.v1.enable_eager_execution() class NN(tf.keras.Model): def __init__(self, in_size, out_size): super(NN, self).__init__() # assert tf1.executing_eagerly() ######### Yo...
""" Info: Coordinate system: EPSG::4326 see http://epsg.io/4326 gdal : Geospatial Data Abstraction Library ogr: OpenGis simple features Reference implementation http://gismanual.com/relational/99-049_OpenGIS_Simple_Features_Specification_For_SQL_Rev_1.1.pdf Sources: https://desktop.a...
import tkinter as tk import numpy as np from matplotlib.figure import Figure from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) from .AdvancedSimulator import AdvancedSimulator from .InvestmentHistory import InvestmentHistory from Bots.Bot import Bot class AdvancedSimulatorGUI: ...
# Fern # # Author: <NAME> # Email: <EMAIL> # # ============================================================================= """model trainer""" import logging import pickle from pathlib import Path from typing import * import numpy as np import tensorflow as tf from tensorflow.keras.metrics import Metric from fern.m...
from __future__ import print_function import os.path def validate_crud_functions(crud, expected): actual = dir(crud) # Ensures expected functions are on the actual list missing = [] for exp_funct in expected: try: pos = actual.index(exp_funct) actual.remove(exp_funct) ...
# -*- coding:utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as f from torch.autograd import Variable import numpy as np import os class FocalLoss(nn.Module): r""" This criterion is a implemenation of Focal Loss, which is proposed in Focal Loss for Dense Object ...
from flask import Flask, render_template, request, redirect, url_for, make_response, abort from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, Form, SelectField, SubmitField, BooleanField, FieldList, FormField, TimeField, RadioField from wtforms.widgets import TextArea from flask_compress im...