text stringlengths 6.04k 39.5k |
|---|
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 3 09:52:47 2021
@author: Mina.Melek
"""
# ==== Helper Methods =====
import os
import pickle
import re
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import confusion_matrix
import nltk
from nltk.corpus i... |
import random
from transformers import (ConstantLRSchedule, WarmupLinearSchedule, WarmupConstantSchedule)
from modeling.modeling_kagnet import *
from utils.optimization_utils import OPTIMIZER_CLASSES
from utils.utils import *
def evaluate_accuracy(eval_set, model, model_type):
n_correct = 0
model.eval()
... |
import numpy as np
import re, os, json
import k_model
import torch
import sys
import torch.autograd as autograd
import datetime
import torch.nn.functional as F
import os
CURRENT_FOLDER = os.path.dirname(os.path.abspath(__file__))
UNKNOWN_TOKEN = '<unnown>'
PADDING_TOKEN = '<<PASSWORD>>'
def extract_text_from_line_nu... |
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
import PyQt5.QtWebEngineWidgets
from PyQt5.QtPrintSupport import *
import sys
import sqlite3
import time
import os
class InsertDialog(QDialog):
def __init__(self, conn, table):
super(InsertDialog, self).__init__... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This program synchronizes OpenProject tasks with Google Calendar.
Each work package created as a "task" on OpenProject will be represented as an
event on Google Calendar where "dueHour" of the task is the start of the event.
Synchronization requires a common structure ... |
"""
Implementation of different statistical analysis tools that are used to compare the significant difference between two trajectories.
(1) Splinectomy longitudinal statistical analysis tools
References:
- https://github.com/RRShieldsCutler/splinectomeR
- https://www.frontiersin.org/articles/10.3389/fmicb.2018.0078... |
import pytest
import numpy as np
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
#import auto_diff_pkg.ReverseADNode as AutoDiff
from auto_diff_pkg.ReverseAutoDiff import ReverseADNode, sqrt, sin, cos, exp, log, tan, arcsin, arccos, arctan, sinh, cosh, tanh, ja... |
# Authors: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from __future__ import print_function
import chemplot.descriptors as desc
import chemplot.parameters as parameters
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import umap
import base64
import functo... |
"""
This module contains all functions that are required to perform a single property maximum loglike optimization.
"""
import numpy as np
def calc_opt_params(beta,exp,exp_sig,sig):
ratio = (sig**2.0)/(exp_sig**2.0)
opt_params = (ratio*(exp-beta))/(1.0+ratio)
return opt_params
def normal_loglike(x, mu, ... |
import os.path as osp
import os
import torch
from torch_geometric.data import Data
from torch_geometric.data import InMemoryDataset
from torch_geometric.utils import remove_self_loops
import torch_geometric.transforms as T
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit import RDLogger
from rdkit.Chem ... |
import pygame
from pygame.locals import *
from sys import exit
import os
import random
from classes import *
pygame.init()
#armazena o caminho do diretorio numa string
diretorio_principal = os.path.dirname(__file__)
diretorio_imagens = os.path.join(diretorio_principal, 'imagens')
janela_inicial = pygame.display.set_m... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import logging
from concurrent import futures
from itertools import count as _count
from queue import Queue
from subprocess import PIPE, Popen
from threading import Event, RLock, Thread
from wolframclient.evaluation.kern... |
import warnings
import numpy as np
from load_heka import LoadHeka
from os.path import join
def test_heka_reader(base_path, version, group_series_to_test, dp_thr=1e-6, info_type="mean_dp_match", assert_mode=False, include_stim_protocol=True):
"""
Test the data read my LoadHeka matches the the data when loading ... |
import keras
import tensorflow as tf
from .. import initializers
from .. import layers
from ..utils.anchors import AnchorParameters
from . import assert_training_model
def default_classification_model(
num_classes,
num_anchors,
pyramid_feature_size=256,
prior_probability=0.01,
classification_featu... |
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2008, <NAME> <<EMAIL>>
#
# All rights reserved.
#
# 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 copyright notice, this... |
'''
Created on Jul 3, 2014
@author: roj-idl71
'''
import os
import datetime
import numpy
try:
from gevent import sleep
except:
from time import sleep
from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader
from schainpy.model.data.jrodata import Voltage
from schainpy.model.proc.jropro... |
# -*- coding: utf-8 -*-
from functools import reduce
from itertools import product
from copy import copy, deepcopy
from collections import Mapping
from .util import reorder, hashlist, deprecated
from .storage import PickleStorage
__author__ = "<NAME> <<EMAIL>>"
__copyright__ = "3-clause BSD License"
class Hasher(o... |
"""Generate C code and data for the fast gradient method."""
import json
import numpy as np
from muaompc._ldt.codegen.codegen import BaseCodeGenerator as BCG
from muaompc._ldt.codegen.former.cvp.codegen import CVPDataGenerator as CVPDG
from muaompc._ldt.codegen.former.cvp.codegen import CDataGenerator as CVPCDG
cl... |
from torch.functional import Tensor
from models.utils import plotting
from typing import Dict, Iterable, Tuple
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from torch.utils import data
from torch.utils.data import TensorDataset, Dataset, DataLoader, Subset
from torch.utils.data im... |
import sys, os, re
from pathlib import Path
import asyncio
import tempfile
import websockets
import traceback
from enum import Enum
from runpy import run_path
from subprocess import call
import argparse, importlib, inspect, json, ast
from typing import Tuple
import coldtype
from coldtype.helpers import *
from coldt... |
# -*- coding: utf-8 -*-
"""
"""
__author__ = "<NAME>"
__copyright__ = "MedPhyDO - Machbarkeitsstudien des Instituts für Medizinische Strahlenphysik und Strahlenschutz am Klinikum Dortmund im Rahmen von Bachelor und Masterarbeiten an der TU-Dortmund / FH-Dortmund"
__credits__ = ["R.Bauer", "K.Loot"]
__license__ = "MIT... |
# -*- coding: utf-8 -*-
# Copyright (C) 2013-2018 Mag. <NAME> All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# #*** <License> ************************************************************#
# This module is part of the package _GTW.__test__.
#
# This module is licensed under the terms of the BSD 3... |
from osgeo import osr, ogr
import multiprocessing as mp
from sys import argv
import pickle
import json
import sys
import time
import gc
from demLib.common import File, group_multi, Timer
from demLib.spatial import Vector
from scripts.data import above_coords
from scripts.data import can_file_dir, tile_file, out_file, o... |
import os, sys, os.path as op
import numpy as np
import imageio
import logging
import shutil
import traceback
from pprint import pformat
from operator import itemgetter
import PIL
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
'''
The support for reading and writing media in the form of single files a... |
from __future__ import print_function
import argparse
import os
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchv... |
# coding=utf-8
# Copyright 2020 The jax_verify 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 la... |
# -*- coding: utf-8 -*-
import sys
import textwrap
import unittest
from brew.constants import GRAIN_TYPE_CEREAL
from brew.constants import GRAIN_TYPE_DME
from brew.constants import GRAIN_TYPE_LME
from brew.constants import GRAIN_TYPE_SPECIALTY
from brew.constants import IMPERIAL_UNITS
from brew.constants import PPG_DM... |
import numpy as np
import paddle
import paddle.nn as nn
import paddle.vision.transforms as T
import ppim.models.vit as vit
from ppim.models.common import add_parameter, load_model
from ppim.models.common import trunc_normal_, zeros_, ones_
transforms = T.Compose(
[
T.Resize(248, interpolation="bicubic"... |
from sympy import Symbol, symbols, together, hypersimp, factorial, binomial, \
collect, Function, powsimp, separate, sin, exp, Rational, fraction, \
simplify, trigsimp, cos, tan, cot, log, ratsimp, Matrix, pi, integrate, \
solve, nsimplify, GoldenRatio, sqrt, E, I, sympify, atan, Derivative, S
... |
from multiprocessing import Process, Queue
import matplotlib.pyplot as plt
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget
from PyQt5.QtWidgets import QAction, QTabWidget,QVBoxLayout, QFileDialog
import os
from pysilcam.config import PySilcamSettings
import pysilcam.oilgas as scog
import nu... |
import itertools
import json
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.multivariate_normal import MultivariateNormal
from pose_prediction.setup import load_model
from view.openpose3d import eval_nppose3Ds_on_hm, eval_nppose3Ds_on_paf
from view.open... |
"""
Determine haplotypes based on co-occurrences of alleles
"""
import sys
import logging
from typing import List, Tuple, Iterator
from itertools import product
from argparse import ArgumentParser
import pandas as pd
import dnaio
from ..table import read_table
logger = logging.getLogger(__name__)
# The second-most e... |
import atexit
import json
import os
import re
import subprocess
import sys
from datetime import datetime
from io import TextIOWrapper, StringIO
from json import JSONDecodeError
from os.path import normpath
from threading import Lock
from time import sleep, monotonic
from munch import Munch
from types import SimpleName... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import re
from joblib import dump, load
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
from sklearn.model_selection import StratifiedKFold, KFold
from sklearn.utils import compute_class_weight
from sklearn.metrics impor... |
#!/usr/bin/python
# (c) 2018-2019, NetApp, Inc
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview']... |
# Author: <NAME>
# Date: Mar 19, 2020
# Version: 0.11.4
from collections import deque
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
from scipy.cluster.hierarchy import single, leaves_list
from scipy.linalg import solve, inv
from scipy.optimize import minimiz... |
from gurobipy import *
import config
import re
from itertools import combinations, permutations
# bs: Converts a binary vector into a set.
def bs(v):
'''
v (list)
output: s (set) set representation of v
'''
s=set([])
for j in range(0,config.vrbls):
if v[j]==1:
s.add(j)
... |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2021 <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... |
# -*- coding: utf-8 -*-
# Compatible with Python 3.8
# Copyright (C) 2020-2021 <NAME>
# mailto: <EMAIL>
r"""Graphical routines."""
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm
from matplotlib.gridspec import GridSpec
from orca_memories.misc import build_t_mesh, build_Z_m... |
import numpy as np
from bbox.bbox import bbox_overlaps_cython
def bbox_overlaps(boxes, query_boxes):
return bbox_overlaps_cython(boxes, query_boxes)
def bbox_overlaps_py(boxes, query_boxes):
"""
determine overlaps between boxes and query_boxes
:param boxes: n * 4 bounding boxes
:param query_boxe... |
#! /usr/bin/python
# -*- coding: utf8 -*-
"""
"""
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
import numpy as np
import time, random, model
def prepro(x):
x = tl.prepro.flip_axis(x, axis=1, is_random=True)
# x = tl.prepro.rotation(x, rg=16, is_random=True, fill_mode='ne... |
"""SORTING ALGORITHMS
Any compare-based sorting algorithms must use at least log(N!) ~ NlogN
compares in the worst-case
algorithm | guarantee | random | space | stable
-------------------------------------------------------
insertion sort | N**2/2 | N**2/4 | 1 | yes
bubble sort | N**2/2 | N... |
# Copyright 2020 DeepMind Technologies Limited.
#
# 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... |
import os
import torch
import argparse
import numpy as np
import torchvision.models as models
import torchvision.datasets as datasets
import torchvision.transforms as transforms
import torch.optim as optim
import torch.nn as nn
from PyQt5 import QtCore
from PIL import Image
DATA_BACKEND_CHOICES = ['pytorch... |
"""Federated datasets."""
import enum
import os
import random as rnd
from collections import Counter, defaultdict
from dataclasses import dataclass
from typing import (Callable, Dict, Generator, Iterable, List, Optional, Set, Tuple, Union)
import torch
from torch.utils.data import Dataset
from torchtext.data.utils im... |
import logging
import re
from smtplib import SMTPException
import cmarkgfm
import chevron
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import User
from django.core.mail import EmailMultiAlternatives
from django.shortcuts import get_object_or_404
from django.urls import re... |
# set up environment
# define command line parameters
# define location of input data
# create output directories
# start the class FeatureCorrelations
import argparse
import os
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import csv
import pathlib
import numpy as np
import pandas as pd
im... |
#!/usr/bin/env python
#
# Runs all unit tests included in Pints.
#
# This file is part of PINTS.
# Copyright (c) 2017-2018, University of Oxford.
# For licensing information, see the LICENSE file distributed with the PINTS
# software package.
#
from __future__ import absolute_import, division
from __future__ import ... |
#
# Copyright (c) 2014-2015 <NAME>
#
# This file is part of rdpy.
#
# rdpy 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 3 of the License, or
# (at your option) any later version.
#
# This pro... |
"""
Helper functions for calculating standard meteorological quantities
"""
import numpy as np
import pandas as pd
import xarray as xr
# constants
epsilon = 0.622 # ratio of molecular weights of water to dry air
def e_s(T, celsius=False, model='Tetens'):
"""Calculate the saturation vapor pressure of water, $e_s... |
#coding=utf-8
'''
2 tables: users, usergroup
User:
id
username
password
avatar
nickname
description
status
student_number
department
truename
tel
e_mail
register_date
user_group
auth_method
Usergroup
id
name
Token expiration can be set in User.genera... |
# Copyright 2022 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... |
import numpy as np
from enum import Enum
from collections import defaultdict
import networking
# adapted from https://github.com/soong-construction/dirt-rally-time-recorder/blob/master/cars.sql
# max_rpm, idle_rpm, car_name
car_data = [
# 1960s
[7330.38, 1047.2, 'Mini Cooper S'],
[7833.04, 984.366, 'Lanc... |
from abc import abstractmethod
import pandas
import datetime
from .readers import PolymorphicReader, CompoundReader, ImplicitReader,\
SimpleReader
import random
from frozendict import frozendict, FrozenOrderedDict
from oreader.reader_configs import SimpleReaderConfig
from decimal import Decimal
from oreader.writers... |
from __future__ import annotations
import abc
import multiprocessing as mp
import os
import sys
import threading as th
import time
from dataclasses import dataclass, field
from functools import wraps
import multiprocessing.managers as mp_mngr
from traceback import StackSummary, extract_tb
from typing import Any, cast,... |
import pathlib
from datetime import datetime
from django.urls import reverse
from django.http import HttpResponse, HttpResponseRedirect, FileResponse, HttpResponseNotFound
from django.template import loader
from django.shortcuts import get_object_or_404
from django.contrib.auth.models import User
from django.contrib.a... |
"""
Miscellaneous utility functions,
mostly for internal use.
"""
import inspect
import sys
from collections import namedtuple
from functools import partial
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
if sys.version_info >= (3, 9):
from functools import cache
else:
from functoo... |
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple, Union
from fastapi import Depends, Path, Request
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from fastapi_jwt_auth import AuthJWT
from passlib.context import CryptContext
from pydantic import Field, SecretStr
f... |
__all__ = ['Panel', 'Button']
from direct.gui.DirectFrame import DirectFrame
from direct.gui.DirectButton import DirectButton
from direct.gui.OnscreenText import OnscreenText
import direct.gui.DirectGuiGlobals as DGG
from direct.interval.IntervalGlobal import LerpFunctionInterval, Func, Sequence, Parallel
from panda3d... |
#!/usr/bin/env python
import io
import json
import os
import random
import requests
import sys
import tarfile
import urllib
from cards import CARDS
from relics import RELICS
from xjson import *
ITEMS = CARDS.union(RELICS)
CACHE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "cache")
TMP = os.path.join(... |
from __future__ import unicode_literals
import os
import random
from datetime import (datetime, date)
from django.contrib.auth.models import (User)
from django.db import (models)
from django.db.models.signals import (post_save, pre_save)
from django.dispatch import (receiver)
from django.utils.translation import gett... |
#!/usr/bin/env python
import sys
import io
import os
import shutil
import base64
import json
import cv2
import paho.mqtt.client as mqtt
import picamera
from picamera.array import PiRGBArray
from picamera import PiCamera
from mail import sendEmail
from subprocess import Popen, PIPE
from string import Template
from str... |
"""
A recipe describes how to generate a codeplug
"""
from importlib_resources import files
import json
import logging
from pathlib import Path
import shutil
from typing import Any, Union
import attr
from dzcb import __version__
import dzcb.anytone
import dzcb.data
import dzcb.farnsworth
import dzcb.gb3gf
import dzcb... |
"""
Build: parse and add user-supplied files to store
"""
import json
import os
from shutil import copyfile, move, rmtree
from stat import S_IRUSR, S_IRGRP, S_IROTH, S_IWUSR
import uuid
from enum import Enum
import numpy as np
import pandas as pd
from .const import (DEFAULT_TEAM, PACKAGE_DIR_NAME, QuiltException, SYS... |
import warnings
import numpy as np
import xarray as xr
from scipy.stats import ttest_ind
from . import cal
def get_climatology(data):
"""Compute 12-month climatological annual cycle.
First we group all values by month and then we take the mean for
every month.
Parameters
----------
data: x... |
import os
import numpy as np
from PIL import Image
from scipy.ndimage import filters
from skimage.segmentation import slic
import skimage.color as color
import glob
import cv2
import sys
# Map each label text to RGB color
#text_2_rgb_id = {
# 'cd16': [(0, 0, 0), 2, (0, 0, 1, 0, 0, 0, 0, 0)],
# 'cd20': [(255, 0, ... |
from cgi import FieldStorage
from datetime import date
from decimal import Decimal
from io import BytesIO
from onegov.swissvotes.collections import SwissVoteCollection
from onegov.swissvotes.collections import TranslatablePageCollection
from onegov.swissvotes.forms import AttachmentsForm
from onegov.swissvotes.forms im... |
# coding: utf-8
import cv2
import json
import h5py
import logging
import asyncio
import numpy as np
import tensorflow as tf
from pathlib import Path
from itertools import starmap
from functools import partial
from sys import stderr, stdout
from operator import itemgetter, truth, mul
from collections import defaultdict... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 8 09:01:01 2021
@author: jwbrooks
"""
import johnspythonlibrary2 as jpl2
import nrl_code as nrl
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
import pandas as pd
# from johnspythonlibrary2.Instruments.velmex_vxm import velmex_vxm
# motor=velme... |
try:
from pathlib import Path
Path().expanduser()
except (ImportError,AttributeError): # Python < 3.5
from pathlib2 import Path
#%%
from .iriweb import iriwebg
from timeutil import TimeUtilities
from numpy import arange, nan, ones, squeeze, where
class IRI2016(object):
def __init__(self):
sel... |
import logging
import time
import sys
import os
import numpy as np
from multiprocessing import Pool, cpu_count
import random
import string
import pickle
import tvm
import topi
from topi.testing import conv2d_nchw_python
from tvm import te
from tvm import autotvm
from tvm.autotvm.tuner import XGBTuner, GATuner, Random... |
# Copyright (c) 2010-2020 openpyxlzip
import atexit
from collections import defaultdict
from io import BytesIO
import os
from tempfile import NamedTemporaryFile
from warnings import warn
from openpyxlzip import LXML
from openpyxlzip.xml.functions import xmlfile, tostring
from openpyxlzip.xml.constants import SHEET_MA... |
"""Evaluation"""
from __future__ import print_function
from collections import OrderedDict
import numpy as np
import paddle
import sys
import time
# import torch
# from torch.autograd import Variable
# from model import SCAN, xattn_score_t2i, xattn_score_i2t
#
# def get_non_pad_mask(seq):
# assert seq.dim() ... |
from NNCONFIG import *
import scipy.linalg
import numpy as np
from sklearn.metrics import confusion_matrix, roc_curve
from sklearn.utils import resample
from numpy import genfromtxt
from sklearn.decomposition import PCA
import glob, os
import pickle as pk
import matplotlib.pylab as plt
import math
from time import p... |
import numpy as np
import pandas as pd
from PIL import Image, ImageFile
from scipy import ndimage
import pydicom
import os
from tqdm import tqdm
from time import time
ImageFile.LOAD_TRUNCATED_IMAGES = True
data_path = "/mnt/storage_dimm2/kaggle_data/rsna-intracranial-hemorrhage-detection/"
def get_metadata(image_di... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import base64
import os
import io
import pyperclip
import tempfile
import time
import hashlib
import zlib
from contextlib import contextmanager
from .. import TestUnitBase
from refinery.lib.loader import load_detached as L
@contextmanager
def temporary_clipboard():
... |
#!/usr/bin/python3
#
# File: voaAreaPlot.py
#
# Copyright (c) 2008 J.Watson
#
# 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 ver... |
import numpy as np
import time
import copy
# This is where you can build a decision tree for determining throttle, brake and steer
# commands based on the output of the perception_step() function
def decision_step(Rover):
# Implement conditionals to decide what to do given perception data
# Here you're all s... |
import numpy as np
import matplotlib.pyplot as plt
from photutils import Background2D, MedianBackground
from astropy.stats import SigmaClip
from skimage.transform import hough_circle, hough_circle_peaks
from skimage.feature import canny
from skimage.draw import circle_perimeter
from skimage import util, filters, morpho... |
# Copyright 2016 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 a... |
import os
import re
import hashlib
from ioc_writer import ioc_api
from lib.cuckoo.common.abstracts import Report
from lib.cuckoo.common.exceptions import CuckooReportError
class IOCAware_OpenIOC(Report):
"""Creates IOC XML Document from Cuckoo Analysis Results"""
def run(self, results):
"""Invokes I... |
from django.db import models
from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField
from django.conf import settings
from mptt.models import MPTTModel, TreeForeignKey
import os
import errno
import datetime
import pytz
import cvtools
import shutil
import time
import numpy as np... |
# ===========================================================================
# twhlecture.py -----------------------------------------------------------
# ===========================================================================
# import ------------------------------------------------------------------
# -----... |
# -*- coding: utf-8 -*-
"""Utilities for BEL repositories."""
import json
import logging
import os
import sys
import time
from dataclasses import dataclass, field
from itertools import chain
from typing import Any, Iterable, Mapping, Optional, Set, TextIO, Tuple, Union
import click
import pandas as pd
from tqdm.auto... |
# coding: utf-8
import functools
LIBERTY = 'liberty'
ROCKY = 'rocky'
QUERIES = {}
def query(q):
'''Decorator to include all the queries into a dictionary'''
global QUERIES
QUERIES[q.__name__] = {'f': q}
return q
def project_col(version):
'''
The name of the column changed somewhere between... |
"""
Certificates Data Model:
course.certificates: {
'certificates': [
{
'version': 1, // data contract version
'id': 12345, // autogenerated identifier
'name': 'Certificate 1',
'description': 'Certificate 1 Description',
'course_title': 'course ti... |
"""
Contains the Django models used to represent the various steps of a
syntactic derivation.
- Users submit a DerivationRequest with some underspecified array of lexical
items.
- One or more Derivations matching those lexical items are generated or
retrieved.
- One or more DerivationSteps within that Derivation... |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Python standard library
import operator
import os
import re
from copy import copy
# Backport needed if Python 2 is used
from enum import IntEnum
from fractions import Fraction
from ... |
"""
Unit tests for the :mod:`strawberryfields` full toolchain.
"""
import logging
logging.getLogger()
import unittest
import inspect
import itertools
import numpy as np
from numpy.random import (randn, uniform, randint)
from numpy import pi
import tensorflow as tf
# NOTE: strawberryfields must be imported from def... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: tang39
"""
import time
import numpy as np
import h5py
import os
import sys
sys.path.append("./src/")
from pca import PCA
from utils import *
from sat_surrogate_forward import saturation_prediction
from mid_press_surrogate_forward import mid_pressure_predictio... |
from os.path import join
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial.distance import squareform
from brainiak.isc import isc, isfc
# Load helper function(s) for interacting with CTF dataset
from ctf_dataset.load import create_wrapped_dataset
base_dir = '/mnt/bucket/labs/hasson/snastase/soci... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
from sklearn.metrics import explained_variance_score
from sklearn.metrics import r2_score
from sklearn.model_selection import train_test_split
from skle... |
"""
Notes
-----
dill[1] is required to extend pickle (see https://stackoverflow.com/a/25353243)
If possible, pickle is prefered (since it is faster).
[1] https://github.com/uqfoundation/dill
"""
from copy import deepcopy
from datetime import datetime
from pathlib import Path
from rlberry.seeding.seeding import saf... |
####
#
# The MIT License (MIT)
#
# Copyright 2017, 2018 <NAME> <<EMAIL>>
#
# 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 us... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 4 20:31:47 2022
@author: jper0011
"""
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras import backend as K
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
from os.path imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from collections import OrderedDict
from functools import total_ordering
from datetime import datetime
from itertools import chain
from lxml import etree
from operator import attrgetter
import s... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright © 2009-2011 University of Zürich
# Author: <NAME> <<EMAIL>>
import sys
import os
import getopt
import shlex
import pipes
from subprocess import Popen, PIPE
if sys.version_info < (2, 6):
enable_multiprocessing = 0
else:
enable_multiprocessing = 1
#list ... |
from PIL import Image, ImageDraw, ImageOps, ImageChops, ImageStat
import math
import numpy as np
from sklearn.cluster import KMeans
import cv2
from skimage.measure import compare_mse as mse
import colorsys
def gcr(im, percentage, separate=False):
'''basic "Gray Component Replacement" function. Returns a CMYK imag... |
import argparse
import ast
from datetime import datetime
import json
import matplotlib.pyplot as plt
import numpy as np
import os
import time
from typing import Optional, Dict, Union, List
from warnings import warn
from experiment.experiment_utils import get_args_string
import snc
from snc.agents.hedgehog.hh_agents.bi... |
# Copyright (c) 2021, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# pylint: disable=no-member
# definition of various activation fcns
import numpy as np
from sympy im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.