code
stringlengths
114
1.05M
path
stringlengths
3
312
quality_prob
float64
0.5
0.99
learning_prob
float64
0.2
1
filename
stringlengths
3
168
kind
stringclasses
1 value
import rlutils.tf as rlu import tensorflow as tf from rlutils.infra.runner import TFOffPolicyRunner, run_func_as_main class SACAgent(tf.keras.Model): def __init__(self, obs_spec, act_spec, num_ensembles=2, policy_mlp_hidden=256, ...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/algos/tf/mf/sac.py
0.754553
0.236538
sac.py
pypi
import rlutils.tf as rlu import tensorflow as tf from rlutils.infra.runner import TFOffPolicyRunner, run_func_as_main def gather_q_values(q_values, actions): batch_size = tf.shape(actions)[0] idx = tf.stack([tf.range(batch_size, dtype=actions.dtype), actions], axis=-1) # (None, 2) q_values = tf.gather_nd...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/algos/tf/mf/dqn.py
0.838944
0.429549
dqn.py
pypi
import time import numpy as np import tensorflow as tf from rlutils.tf.utils import set_tf_allow_growth set_tf_allow_growth() from rlutils.infra.runner import TFRunner from rlutils.tf.nn import AtariQNetworkDeepMind, hard_update from rlutils.replay_buffers import PyUniformParallelEnvReplayBufferFrame from rlutils.i...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/algos/tf/mf/images/dqn.py
0.842345
0.414366
dqn.py
pypi
import os import time import gym import numpy as np import rlutils.tf as rlu import tensorflow as tf import tensorflow_probability as tfp from rlutils.infra.runner import TFRunner from rlutils.logx import EpochLogger from rlutils.replay_buffers import PyUniformReplayBuffer from tqdm.auto import tqdm, trange tfd = tfp...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/algos/tf/offline/bracp.py
0.750736
0.269163
bracp.py
pypi
import os import time import gym import numpy as np import tensorflow as tf import tensorflow_probability as tfp from rlutils.tf.future import get_adam_optimizer, minimize from rlutils.logx import EpochLogger from rlutils.replay_buffers import PyUniformReplayBuffer from rlutils.infra.runner import TFRunner from rlutil...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/algos/tf/offline/plas.py
0.656768
0.292513
plas.py
pypi
import time import gym import numpy as np import tensorflow as tf from rlutils.replay_buffers import PyUniformReplayBuffer from rlutils.infra.runner import TFRunner, run_func_as_main from rlutils.tf.distributions import apply_squash_log_prob from rlutils.tf.functional import soft_update, hard_update, compute_target_va...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/algos/tf/offline/cql.py
0.824144
0.258443
cql.py
pypi
import time import gym.spaces import numpy as np import tensorflow as tf from rlutils.replay_buffers import PyUniformReplayBuffer from rlutils.infra.runner import TFRunner, run_func_as_main from rlutils.tf.nn.models import EnsembleDynamicsModel from rlutils.tf.nn.planners import RandomShooter class PETSAgent(tf.kera...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/algos/tf/mb/pets.py
0.744749
0.252284
pets.py
pypi
import numpy as np import tensorflow as tf EPS = 1e-6 def compute_accuracy(logits, labels): num = tf.cast(tf.argmax(logits, axis=-1, output_type=tf.int32) == labels, dtype=tf.float32) accuracy = tf.reduce_mean(num) return accuracy def expand_ensemble_dim(x, num_ensembles): """ functionality for out...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/functional.py
0.915202
0.438424
functional.py
pypi
import numpy as np import rlutils.tf as rlu import tensorflow as tf import tensorflow_probability as tfp tfd = tfp.distributions tfb = tfp.bijectors tfl = tfp.layers EPS = 1e-4 class CenteredBeta(tfd.TransformedDistribution): def __init__(self, concentration1, concentration0, ...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/distributions.py
0.867064
0.432303
distributions.py
pypi
import tensorflow as tf from rlutils.tf.nn.functional import build_mlp OUT_KERNEL_INIT = tf.keras.initializers.RandomUniform(minval=-1e-3, maxval=1e-3) class EnsembleMinQNet(tf.keras.Model): def __init__(self, ob_dim, ac_dim, mlp_hidden, num_ensembles=2, num_layers=3): super(EnsembleMinQNet, self).__ini...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/nn/values.py
0.860501
0.406273
values.py
pypi
import tensorflow as tf from tensorflow.keras.regularizers import l2 from .layers import EnsembleDense, SqueezeLayer def build_mlp(input_dim, output_dim, mlp_hidden, num_ensembles=None, num_layers=3, activation='relu', out_activation=None, squeeze=False, dropout=None, batch_norm=False, la...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/nn/functional.py
0.927544
0.579817
functional.py
pypi
from abc import ABC, abstractmethod import numpy as np import rlutils.tf as rlu import sklearn import tensorflow as tf import tensorflow_probability as tfp from rlutils.tf.callbacks import EpochLoggerCallback from rlutils.tf.generative_models.vae import ConditionalBetaVAE tfd = tfp.distributions tfl = tfp.layers MIN...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/nn/behavior.py
0.858541
0.356699
behavior.py
pypi
import sklearn import tensorflow as tf import tensorflow_probability as tfp from rlutils.tf.callbacks import EpochLoggerCallback from rlutils.tf.distributions import make_independent_normal_from_params, apply_squash_log_prob, \ make_independent_centered_beta_from_params, make_independent_truncated_normal, make_inde...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/nn/actors.py
0.816589
0.30654
actors.py
pypi
import tensorflow as tf from rlutils.np.functional import inverse_softplus from rlutils.tf.functional import clip_by_value_preserve_gradient from .initializer import _decode_initializer class SqueezeLayer(tf.keras.layers.Layer): def __init__(self, axis=-1): super(SqueezeLayer, self).__init__() se...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/nn/layers.py
0.86771
0.277732
layers.py
pypi
import math import tensorflow as tf class _RandomGenerator(object): """Random generator that selects appropriate random ops.""" dtypes = tf.dtypes def __init__(self, seed=None): super(_RandomGenerator, self).__init__() if seed is not None: # Stateless random ops requires 2-in...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/nn/initializer.py
0.921473
0.333693
initializer.py
pypi
import tensorflow as tf import tensorflow_probability as tfp from rlutils.tf.functional import compute_accuracy tfd = tfp.distributions class GAN(tf.keras.Model): def __init__(self, n_critics=5, noise_dim=100): super(GAN, self).__init__() self.n_critics = n_critics self.noise_dim = noise...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/generative_models/gan/base.py
0.918822
0.341198
base.py
pypi
import tensorflow as tf from rlutils.tf.functional import compute_accuracy from tqdm.auto import tqdm from .base import GAN, ACGAN class WassersteinGANGradientPenalty(GAN): def __init__(self, gp_weight=10, *args, **kwargs): self.gp_weight = gp_weight super(WassersteinGANGradientPenalty, self).__i...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/generative_models/gan/wgan_gp.py
0.913464
0.311047
wgan_gp.py
pypi
import tensorflow as tf import tensorflow_probability as tfp tfd = tfp.distributions class BetaVAE(tf.keras.Model): def __init__(self, latent_dim, beta=1.): super(BetaVAE, self).__init__() self.latent_dim = latent_dim self.beta = beta self.encoder = self._make_encoder() se...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/generative_models/vae/base.py
0.83545
0.586671
base.py
pypi
import tensorflow as tf import tensorflow_probability as tfp from rlutils.tf.future import get_adam_optimizer tfd = tfp.distributions tfl = tfp.layers eps = 1e-6 class Flow(tf.keras.Model): """ A flow is a function f that defines a forward (call) and backward path """ def call(self, x, training=No...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/generative_models/flow/base.py
0.920397
0.615608
base.py
pypi
import tensorflow as tf import tensorflow_probability as tfp from rlutils.tf.distributions import make_independent_normal_from_params from rlutils.tf.nn.functional import build_mlp from .base import Flow, SequentialFlow, ConditionalFlowModel tfd = tfp.distributions tfl = tfp.layers class AffineCouplingFlow(Flow): ...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/tf/generative_models/flow/realnvp.py
0.8727
0.505554
realnvp.py
pypi
import os import pprint import random from abc import abstractmethod, ABC import numpy as np import rlutils.gym import rlutils.infra as rl_infra from rlutils.logx import EpochLogger, setup_logger_kwargs from rlutils.replay_buffers import PyUniformReplayBuffer, GAEBuffer from tqdm.auto import trange class BaseRunner(...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/infra/runner/base.py
0.634204
0.206354
base.py
pypi
from abc import ABC, abstractmethod import numpy as np import rlutils.np as rln from rlutils.gym.vector import VectorEnv from tqdm.auto import trange class Sampler(ABC): def __init__(self, env: VectorEnv): self.env = env def reset(self): pass def set_logger(self, logger): self.l...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/infra/samplers/base.py
0.743541
0.368235
base.py
pypi
import multiprocessing as mp import sys import time from copy import deepcopy from enum import Enum import numpy as np from gym import logger from gym.error import (AlreadyPendingCallError, NoAsyncCallError, ClosedEnvironmentError) from gym.vector.utils import (create_shared_memory, create_empty...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/gym/vector/async_vector_env.py
0.410402
0.216156
async_vector_env.py
pypi
import numpy as np from gym.vector.utils import create_empty_array from .vector_env import VectorEnv __all__ = ['SyncVectorEnv'] class SyncVectorEnv(VectorEnv): """Vectorized environment that serially runs multiple environments. Parameters ---------- env_fns : iterable of callable Functions...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/gym/vector/sync_vector_env.py
0.862279
0.714441
sync_vector_env.py
pypi
try: from collections.abc import Iterable except ImportError: Iterable = (tuple, list) from .async_vector_env import AsyncVectorEnv from .sync_vector_env import SyncVectorEnv from .vector_env import VectorEnv def make(id, num_envs=1, asynchronous=True, wrappers=None, **kwargs): """Create a vectorized env...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/gym/vector/__init__.py
0.876423
0.462048
__init__.py
pypi
import inspect import sys import numpy as np from .base import ModelBasedStaticFn model_based_wrapper_dict = {} class ReacherFn(ModelBasedStaticFn): reward = False terminate = True env_name = ['Reacher-v2'] class HopperFn(ModelBasedStaticFn): reward = False terminate = True env_name = ['H...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/gym/static/mujoco.py
0.581184
0.678387
mujoco.py
pypi
import numpy as np from .base import ModelBasedStaticFn class InvertedPendulumBulletEnvFn(ModelBasedStaticFn): env_name = ['InvertedPendulumBulletEnv-v0'] terminate = True reward = True @staticmethod def terminate_fn_numpy_batch(states, actions, next_states): cos_th, sin_th = next_states...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/gym/static/pybullet.py
0.822118
0.630756
pybullet.py
pypi
class Schedule(object): def value(self, t): """Value of the schedule at time t""" raise NotImplementedError() class ExponentialScheduler(Schedule): def __init__(self, epsilon=1.0, decay=1e-4, minimum=0.01): self.epsilon = epsilon self.decay = decay self.minimum = minimu...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/np/schedulers.py
0.954563
0.588091
schedulers.py
pypi
import numpy as np from rlutils.np.functional import discount_cumsum from rlutils.np.functional import flatten_leading_dims from .utils import combined_shape class GAEBuffer(object): """ A buffer for storing trajectories experienced by a PPO agent interacting with the environment, and using Generalized A...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/replay_buffers/pg_py.py
0.767733
0.666669
pg_py.py
pypi
from abc import ABC, abstractmethod from typing import Dict import gym.spaces import numpy as np from gym.utils import seeding from rlutils.np.functional import shuffle_dict_data from .utils import combined_shape class BaseReplayBuffer(ABC): def __init__(self, seed=None): self.set_seed(seed) def re...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/replay_buffers/base.py
0.895936
0.377225
base.py
pypi
from collections import deque try: import reverb except: print('Reverb is not installed.') import tensorflow as tf from .base import BaseReplayBuffer class ReverbReplayBuffer(BaseReplayBuffer): def __init__(self, data_spec, replay_capacity, batch_size, ...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/replay_buffers/reverb.py
0.802633
0.272454
reverb.py
pypi
from typing import Dict import gym.spaces import numpy as np from .base import PyReplayBuffer from .utils import segtree EPS = np.finfo(np.float32).eps.item() class PyPrioritizedReplayBuffer(PyReplayBuffer): """ A simple implementation of PER based on pure numpy. No advanced data structure is used. """...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/replay_buffers/prioritized_py.py
0.911838
0.350727
prioritized_py.py
pypi
from typing import Union, Optional import numpy as np from numba import njit class SegmentTree: """Implementation of Segment Tree. The segment tree stores an array ``arr`` with size ``n``. It supports value update and fast query of the sum for the interval ``[left, right)`` in O(log n) time. The deta...
/rlutils-python-0.0.3.tar.gz/rlutils-python-0.0.3/rlutils/replay_buffers/utils/segtree.py
0.942804
0.831622
segtree.py
pypi
from . import driver import traceback import weakref class Engine(object): """ @ivar proxy: Proxy to a driver implementation @type proxy: L{DriverProxy} @ivar _connects: Array of subscriptions @type _connects: list @ivar _inLoop: Running an event loop or not @type _inLoop: bool @ivar _...
/rlvoice_1-1.1.1-py3-none-any.whl/rlvoice/engine.py
0.699254
0.238129
engine.py
pypi
from ..voice import Voice import time def buildDriver(proxy): ''' Builds a new instance of a driver and returns it for use by the driver proxy. @param proxy: Proxy creating the driver @type proxy: L{driver.DriverProxy} ''' return DummyDriver(proxy) class DummyDriver(object): ''' D...
/rlvoice_1-1.1.1-py3-none-any.whl/rlvoice/drivers/dummy.py
0.641535
0.301908
dummy.py
pypi
# Reinforcement Learning Zoo [![Documentation Status](https://readthedocs.org/projects/rlzoo/badge/?version=latest)](https://rlzoo.readthedocs.io/en/latest/?badge=latest) [![Supported TF Version](https://img.shields.io/badge/TensorFlow-2.0.0%2B-brightgreen.svg)](https://github.com/tensorflow/tensorflow/releases) [![Dow...
/rlzoo-1.0.4.tar.gz/rlzoo-1.0.4/README.md
0.933051
0.986244
README.md
pypi
import argparse from pathlib import Path from typing import List, Optional import cv2 import numpy as np import onnxruntime as rt from huggingface_hub.file_download import hf_hub_download SCALE: int = 255 def get_mask( session_infer: rt.InferenceSession, img: np.ndarray, size_infer: int = 1024, ): ...
/rm_anime_bg-0.2.0-py3-none-any.whl/rm_anime_bg/cli.py
0.739893
0.318989
cli.py
pypi
import math import matplotlib.pyplot as plt from .Generaldistribution import Distribution class Gaussian(Distribution): """ Gaussian distribution class for calculating and visualizing a Gaussian distribution. Attributes: mean (float) representing the mean value of the distribution stdev (float) representing ...
/rm_gaussian_binomial_distributions-0.1.tar.gz/rm_gaussian_binomial_distributions-0.1/rm_gaussian_binomial_distributions/Gaussiandistribution.py
0.688364
0.853058
Gaussiandistribution.py
pypi
import subprocess # List if problem letters that have some problems to show in current version of simple PROBLEM_LETTERS = "ěščřžýáíéúů" # Current version of this module is trying to prevent SAS from crash by doing some edits # to texts displayed on screen and adding "." after letters that wont render without it. #...
/rm_pysas-0.0.1-py3-none-any.whl/rm_pySAS/__init__.py
0.415729
0.288488
__init__.py
pypi
import boto3 import json from pkg_resources import resource_filename def get_region_name(region_code): endpoint_file = resource_filename("botocore", "data/endpoints.json") with open(endpoint_file, "r") as f: endpoint_data = json.load(f) region_name = endpoint_data["partitions"][0]["regions"][re...
/rm_runner-0.1.0-py3-none-any.whl/rm_runner/utils.py
0.445288
0.213972
utils.py
pypi
port_service_map = {1: 'tcpmux', 2: 'compressnet', 3: 'compressnet', 5: 'rje', 7: 'echo', 9: 'discard', 11: 'systat', 13: 'daytime', 17: 'qotd', 18: 'msp', 19: 'chargen', 20: 'ftp-data', 21: 'ftp', 22: 'ssh', 23: 'telnet', 25: 'smtp', 27: 'nsw-fe', 29: 'msg-icp', 31: 'msg-auth', ...
/rm-sec-toolkit-0.2.4.tar.gz/rm-sec-toolkit-0.2.4/rmsectkf/core/network/port_service_map.py
0.408631
0.316805
port_service_map.py
pypi
import numpy as np import pandas as pd from scipy.optimize import minimize def vol_risk_parity(stockMeans, covar, b=None): n = len(stockMeans) # Function for Portfolio Volatility def pvol(w): x = np.array(w) return np.sqrt(x.dot(covar).dot(x)) # Function for Component Standard...
/rm545_xd-0.7.2.tar.gz/rm545_xd-0.7.2/src/qrm545_xd/risk_parity.py
0.649356
0.419053
risk_parity.py
pypi
import numpy as np import pandas as pd from . import cov_matrix from scipy.stats import t, norm from scipy.optimize import minimize # Multivariate Normal Simulation def multivariate_normal_simulation(covariance_matrix, n_samples, method='direct', mean = 0, explained_variance=1.0, seed=1234): """ A function to...
/rm545_xd-0.7.2.tar.gz/rm545_xd-0.7.2/src/qrm545_xd/simulation.py
0.848361
0.830869
simulation.py
pypi
import numpy as np import pandas as pd def risk_contrib(w, covar): risk_contrib = w * covar.dot(w) / np.sqrt(w.dot(covar).dot(w)) return risk_contrib def expost_attribution(w, upReturns): _stocks = list(upReturns.columns) n = upReturns.shape[0] pReturn = np.empty(n) weights = np.empty((n, len(...
/rm545_xd-0.7.2.tar.gz/rm545_xd-0.7.2/src/qrm545_xd/risk_attribution.py
0.818193
0.604457
risk_attribution.py
pypi
import numpy as np # Exponentially Weighted Covariance Matrix def exp_weighted_cov(returns, lambda_=0.97): """ Perform calculation on the input data set with a given λ for exponentially weighted covariance. Parameters: - data: input data set, a pandas DataFrame - lambda_: fraction for unpdate...
/rm545_xd-0.7.2.tar.gz/rm545_xd-0.7.2/src/qrm545_xd/cov_matrix.py
0.933688
0.824356
cov_matrix.py
pypi
INFINITY = float('inf') NEGATIVE_INFINITY = -INFINITY class IntervalSet: __slots__ = ('intervals', 'size') def __init__(self, intervals, disjoint=False): self.intervals = intervals if not disjoint: self.intervals = union_overlapping(self.intervals) self.size = sum(i.size for i in self.interva...
/rmap-7.5.tar.gz/rmap-7.5/graphite-dballe/intervals.py
0.719482
0.318737
intervals.py
pypi
from hashlib import md5 from itertools import chain import bisect try: import pyhash hasher = pyhash.fnv1a_32() def fnv32a(string, seed=0x811c9dc5): return hasher(string, seed=seed) except ImportError: def fnv32a(string, seed=0x811c9dc5): """ FNV-1a Hash (http://isthe.com/chongo/tech/comp/fnv/) in ...
/rmap-7.5.tar.gz/rmap-7.5/graphite-dballe/render/hashing.py
0.535827
0.237377
hashing.py
pypi
import json class FloatEncoder(json.JSONEncoder): def __init__(self, nan_str="null", **kwargs): super(FloatEncoder, self).__init__(**kwargs) self.nan_str = nan_str def iterencode(self, o, _one_shot=False): """Encode the given object and yield each string representation as avai...
/rmap-7.5.tar.gz/rmap-7.5/graphite-dballe/render/float_encoder.py
0.660391
0.18717
float_encoder.py
pypi
import csv import math import pytz from datetime import datetime from time import time from random import shuffle from httplib import CannotSendRequest from urllib import urlencode from urlparse import urlsplit, urlunsplit from cgi import parse_qs from cStringIO import StringIO try: import cPickle as pickle except I...
/rmap-7.5.tar.gz/rmap-7.5/graphite-dballe/render/views.py
0.418459
0.159643
views.py
pypi
from pyparsing import ( ParserElement, Forward, Combine, Optional, Word, Literal, CaselessKeyword, CaselessLiteral, Group, FollowedBy, LineEnd, OneOrMore, ZeroOrMore, nums, alphas, alphanums, printables, delimitedList, quotedString, __version__, ) ParserElement.enablePackrat() grammar = Forward() expr...
/rmap-7.5.tar.gz/rmap-7.5/graphite-dballe/render/grammar.py
0.745769
0.171165
grammar.py
pypi
__all__ = ["GeoJsonMapLayer"] import json from kivy.properties import StringProperty, ObjectProperty from mapview.view import MapLayer from mapview.downloader import Downloader def flatten(l): return [item for sublist in l for item in sublist] class GeoJsonMapLayer(MapLayer): source = StringProperty() ...
/rmap-7.5.tar.gz/rmap-7.5/mapview/geojson.py
0.569134
0.253959
geojson.py
pypi
(function() { var B = { "B33194": { "description": "[SIM] Space consistency", "unit": "%" }, "B33195": { "description": "[SIM] MeteoDB variable ID", "unit": "NUMERIC" }, "B33196": { "description": "[SIM] Data has...
/rmap-7.5.tar.gz/rmap-7.5/showdata/static/showdata/borinud.B.js
0.503662
0.538923
borinud.B.js
pypi
from imagekit.models import ImageSpecField from imagekit.models import ProcessedImageField from imagekit.processors import ResizeToFill, Transpose, SmartResize, ResizeToFit from djgeojson.fields import PointField from django.db import models from django.contrib.auth.models import User from django.utils.translation impo...
/rmap-7.5.tar.gz/rmap-7.5/geoimage/models.py
0.577614
0.280422
models.py
pypi
import json import dballe class BaseJSONEncoder(json.JSONEncoder): """Base JSON encoder.""" def default(self, o): from datetime import datetime if isinstance(o, datetime): return o.isoformat() else: return super(BaseJSONEncoder, self).default(o) class GeoJSONEnc...
/rmap-7.5.tar.gz/rmap-7.5/borinud/utils/codec.py
0.588298
0.280382
codec.py
pypi
(function() { var B = { "B33194": { "description": "[SIM] Space consistency", "unit": "%" }, "B33195": { "description": "[SIM] MeteoDB variable ID", "unit": "NUMERIC" }, "B33196": { "description": "[SIM] Data has...
/rmap-7.5.tar.gz/rmap-7.5/borinud/static/borinud/borinud.B.js
0.503662
0.538923
borinud.B.js
pypi
from django.conf import settings from django.contrib.sites.requests import RequestSite from django.contrib.sites.models import Site from registration import signals from registration.models import RegistrationProfile from registration.views import ActivationView as BaseActivationView from registration.views import Reg...
/rmap-7.5.tar.gz/rmap-7.5/registration/backends/default/views.py
0.802594
0.326218
views.py
pypi
import numpy as np import scipy from scipy import stats import matplotlib.pylab as plt class gaussian_kde_set_covariance(stats.gaussian_kde): ''' from Anne Archibald in mailinglist: http://www.nabble.com/Width-of-the-gaussian-in-stats.kde.gaussian_kde---td19558924.html#a19558924 ''' def __init__(se...
/rmats2sashimiplot-2.0.4-py3-none-any.whl/MISO/misopy/kde_subclass.py
0.675444
0.533519
kde_subclass.py
pypi
from scipy import * from numpy import * def format_credible_intervals(event_name, samples, confidence_level=0.95): """ Returns a list of print-able credible intervals for an NxM samples matrix. Handles both the two isoform and multi-isoform cases. """ num_samples, num_...
/rmats2sashimiplot-2.0.4-py3-none-any.whl/MISO/misopy/credible_intervals.py
0.840062
0.505432
credible_intervals.py
pypi
from numpy import * from scipy import * import time import csv def dictlist2csv(filename, dictlist, header_fields, delimiter='\t'): """ Serialize a list of dictionaries into the output """ str_header_fields = [str(f) for f in header_fields] header = "\t".join(str_header_fields) + '\n' output =...
/rmats2sashimiplot-2.0.4-py3-none-any.whl/MISO/misopy/parse_csv.py
0.489259
0.375964
parse_csv.py
pypi
import os import time import scipy import numpy from scipy import * from numpy import * import misopy import misopy.sam_utils as sam_utils from misopy.Gene import load_genes_from_gff from misopy.parse_csv import * import pysam def rpkm_per_region(region_lens, region_counts, read_len, num_tota...
/rmats2sashimiplot-2.0.4-py3-none-any.whl/MISO/misopy/sam_rpkm.py
0.517815
0.339307
sam_rpkm.py
pypi
import os import sys import glob import matplotlib # Add misopy path miso_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, miso_path) # Use PDF backend matplotlib.use("pdf") from scipy import * from numpy import * import pysam import shelve import misopy import...
/rmats2sashimiplot-2.0.4-py3-none-any.whl/MISO/misopy/sashimi_plot/sashimi_plot.py
0.446253
0.235988
sashimi_plot.py
pypi
import os import matplotlib import matplotlib.pyplot as plt from matplotlib import rc import misopy.sashimi_plot.plot_utils.plot_settings as plot_settings import misopy.sashimi_plot.plot_utils.plotting as plotting class Sashimi: """ Representation of a figure. """ def __init__(self, label, output_dir...
/rmats2sashimiplot-2.0.4-py3-none-any.whl/MISO/misopy/sashimi_plot/Sashimi.py
0.642657
0.254677
Sashimi.py
pypi
import matplotlib.pyplot as plt from mpl_toolkits.axes_grid.axislines import SubplotZero import scipy.stats as stats from scipy import * from numpy import array from scipy import linalg import sys def plot_cumulative_bars(data, bins, bar_color='k', edgecolor='#ffffff',...
/rmats2sashimiplot-2.0.4-py3-none-any.whl/MISO/misopy/sashimi_plot/plot_utils/plotting.py
0.438545
0.59658
plotting.py
pypi
import os import numpy as np from disorder.diffuse import scattering, space from disorder.diffuse import displacive, magnetic from disorder.material import crystal, symmetry def factor(u, v, w, atms, occupancy, U11, U22, U33, U23, U13, U12, a, b, c, alpha, beta, gamma, symops, dmin=0.3, source='neutron'):...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/material/structure.py
0.856242
0.541227
structure.py
pypi
import os import numpy as np directory = os.path.abspath(os.path.dirname(__file__)) def magnetic_form_factor_coefficients_j0(): """ Table of magnetic form factors zeroth-order :math:`j_0` coefficients. Returns ------- j0 : dict Dictionary of magnetic form factors coefficients with magne...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/material/tables.py
0.796055
0.513668
tables.py
pypi
import numpy as np import matplotlib import matplotlib.style as mplstyle mplstyle.use('fast') import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.transforms as mtransforms from matplotlib import ticker from matplotlib.ticker import Locator from matplotlib.patches import Polygon fro...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/graphical/plots.py
0.533884
0.403714
plots.py
pypi
import mayavi.mlab as mlab import numpy as np from scipy.stats import chi2 from scipy.spatial.transform.rotation import Rotation from mayavi.sources.api import ParametricSurface from mayavi.modules.api import Surface class CrystalStructure: def __init__(self): self.fig = mlab.figure(fgc...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/graphical/visualization.py
0.641871
0.33595
visualization.py
pypi
import re import os import numpy as np from disorder.diffuse import experimental, space, filters, scattering from disorder.diffuse import monocrystal, powder from disorder.diffuse import magnetic, occupational, displacive, refinement from disorder.material import crystal, symmetry, tables import disorder.correlatio...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/graphical/model.py
0.602062
0.358044
model.py
pypi
import numpy as np from disorder.material import crystal from disorder.material import symmetry def reciprocal(h_range, k_range, l_range, mask, B, T=np.eye(3)): nh, nk, nl = mask.shape[0], mask.shape[1], mask.shape[2] h_, k_, l_ = np.meshgrid(np.linspace(h_range[0],h_range[1],nh), ...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/diffuse/space.py
0.498291
0.533337
space.py
pypi
import numpy as np from disorder.diffuse.displacive import number def transform(U_r, A_r, H, K, L, nu, nv, nw, n_atm): """ Discrete Fourier transform of Taylor expansion displacement products and \ relative occupancy parameter. Parameters ---------- U_r : 1d array Displacement para...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/diffuse/nonmagnetic.py
0.919326
0.823186
nonmagnetic.py
pypi
import numpy as np def composition(nu, nv, nw, n_atm, value=0.5): """ Generate random relative site occupancies. Parameters ---------- nu, nv, nw : int Number of grid points :math:`N_1`, :math:`N_2`, :math:`N_3` along the :math:`a`, :math:`b`, and :math:`c`-axis of the superce...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/diffuse/occupational.py
0.928506
0.835919
occupational.py
pypi
import numpy as np def expansion(nu, nv, nw, n_atm, value=1, fixed=True): """ Generate random displacement vectors. Parameters ---------- nu, nv, nw : int Number of grid points :math:`N_1`, :math:`N_2`, :math:`N_3` along the :math:`a`, :math:`b`, and :math:`c`-axis of the supercel...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/diffuse/displacive.py
0.926116
0.631225
displacive.py
pypi
import numpy as np from scipy.special import erfc from disorder.material import crystal def __A(alpha,r): c = 2*alpha/np.sqrt(np.pi) return -(erfc(alpha*r)/r-c*np.exp(-alpha**2*r**2))/r**2 def __B(alpha,r): c = 2*alpha/np.sqrt(np.pi) return (erfc(alpha*r)/r+c*np.exp(-alpha**2*r**2))/r**2 def _...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/diffuse/interaction.py
0.519521
0.568655
interaction.py
pypi
import numpy as np from nexusformat.nexus import nxload import pyvista as pv from functools import reduce from disorder.diffuse import filters def data(filename): data = nxload(filename) signal = np.array(data.MDHistoWorkspace.data.signal.nxdata.T) error_sq = np.array(data.MDHistoWorkspace.data.error...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/diffuse/experimental.py
0.41182
0.567697
experimental.py
pypi
import numpy as np from disorder.material import tables def j0(Q, A, a, B, b, C, c, D): """ Appoximation of the zeroth-order spherical Bessesl function :math:`j_0(Q)`. Parameters ---------- Q : 1d array Magnitude of wavevector :math:`Q`. A : float :math:`A_0` constant. a ...
/rmc_discord-0.0.4-cp36-cp36m-win_amd64.whl/disorder/diffuse/magnetic.py
0.93739
0.823825
magnetic.py
pypi
class Preprocessor: def __init__(self, fileName): self.fileName = fileName """ Pre processing class for receive data and return normalized data Attributes: fileName """ def __repr__(self): print(self.data) return "Nome do Arquivo em estudo:...
/rmclino_preprocessor-1.0.tar.gz/rmclino_preprocessor-1.0/rmclino_preprocessor/preprocessor.py
0.627609
0.396535
preprocessor.py
pypi
Rmdawn: a Python package for programmatic R markdown workflows ============================================================== |Chat| |Build| |License| |PyPI| |Status| |Updates| |Versions| Introduction ------------ The ``rmdawn`` Python package allows you to (de)construct, convert, and render `R Markdown <https://rma...
/rmdawn-0.1.2.tar.gz/rmdawn-0.1.2/README.rst
0.898907
0.732296
README.rst
pypi
import matplotlib.pyplot as plt import numpy as np from shapely.geometry import Polygon def trapezoidal_rule(f, a: float, b: float, n: int) -> float: """ Returns a numerical approximation of the definite integral of f between a and b by the trapezoidal rule. Parameters: f...
/rmg_numerical_integration-4.1-py3-none-any.whl/rmg_numerical_integration/trapezoidal.py
0.885018
0.879147
trapezoidal.py
pypi
import numpy as np import matplotlib.pyplot as plt def simpson_rule(f, a: float, b: float, n: int) -> float: """ Returns a numerical approximation of the definite integral of f between a and b by the Simpson rule. Parameters: f(function): function to be integrated a(fl...
/rmg_numerical_integration-4.1-py3-none-any.whl/rmg_numerical_integration/simpson.py
0.875321
0.85315
simpson.py
pypi
from scipy.special.orthogonal import p_roots import numpy as np import matplotlib.pyplot as plt def gauss_rule(f, n: int, a: float, b: float) -> float: """ Returns a numerical approximation of the definite integral of f between a and b by the Gauss quadrature rule. Parameters: f(function): fu...
/rmg_numerical_integration-4.1-py3-none-any.whl/rmg_numerical_integration/gaussian_quadrature.py
0.949342
0.805747
gaussian_quadrature.py
pypi
import matplotlib.pyplot as plt import numpy as np from shapely.geometry import Polygon def midpoint_rule(f, a: float, b: float, n: int) -> float: """ Returns a numerical approximation of the definite integral of f between a and b by the midpoint rule. Parameters: f(function...
/rmg_numerical_integration-4.1-py3-none-any.whl/rmg_numerical_integration/midpoint.py
0.893007
0.840815
midpoint.py
pypi
import torch import torch.nn as nn import torch.nn.functional as F EPSILON = 0.0005 class RMILoss(nn.Module): """ PyTorch Module which calculates the Region Mutual Information loss (https://arxiv.org/abs/1910.12037). """ def __init__(self, with_logits, radius=3, ...
/rmi-pytorch-0.1.1.tar.gz/rmi-pytorch-0.1.1/rmi/rmi.py
0.948811
0.722233
rmi.py
pypi
codes = { 0: { "message": "No error", "response_code": 200 }, 1: { "message": "Unknown error", "response_code": 500 }, 2: { "message": "Invalid input", "response_code": 400 }, 3: { "message":"Insufficient permissions", "response_code": 401 }, 4: { "message": "Bad ti...
/rmi_qb_sdk-0.4.1.tar.gz/rmi_qb_sdk-0.4.1/rmi_qb_sdk/error_codes.py
0.557123
0.387632
error_codes.py
pypi
[![Build Status](https://travis-ci.org/wouterboomsma/eigency.svg?branch=master)](https://travis-ci.org/wouterboomsma/eigency) # Eigency Eigency is a Cython interface between Numpy arrays and Matrix/Array objects from the Eigen C++ library. It is intended to simplify the process of writing C++ extensions using the Eige...
/rmjarvis.eigency-1.77.1.tar.gz/rmjarvis.eigency-1.77.1/README.md
0.790732
0.973418
README.md
pypi
import argparse import dataclasses import itertools import os from copy import deepcopy from enum import Enum from typing import Any, Dict, Optional, Sequence, Tuple, Union class ConfigField(Enum): ARGUMENT = "argument" ATTRIBUTE = "attribute" VARIABLE = "variable" class PrefixSeparator(Enum): ARGUM...
/rmk2_py-0.1.2-py3-none-any.whl/rmk2/config.py
0.843122
0.232452
config.py
pypi
import datetime import json import logging import os from enum import Enum from typing import Iterator, Union, Any Expected = Union[bool, str, int, float, datetime.date, datetime.datetime, None] Jsonified = Union[bool, str, int, float, None] class WriteMode(Enum): APPEND = "a" CREATE = "x" TRUNCATE = "w"...
/rmk2_py-0.1.2-py3-none-any.whl/rmk2/file.py
0.665084
0.295725
file.py
pypi
import time import os import struct import stat import logging logging.basicConfig(format='%(message)s') log = logging.getLogger('resim') def affine_map(x, a0, a1, b0, b1): """Map x in range (a0, a1) to (b0, b1) Args: x (float): input a0 (float): input range start a1 (float): input ran...
/rmkit-sim-0.0.2.tar.gz/rmkit-sim-0.0.2/remarkable_sim/evsim.py
0.790652
0.254903
evsim.py
pypi
import array import operator from base64 import b64decode import qrcode from reportlab.lib.units import toLength DEFAULT_PARAMS = { 'size': '5cm', 'padding': '2.5', 'fg': '#000000', 'bg': None, 'version': None, 'error_correction': 'L', } GENERATOR_PARAMS = {'size', 'padding', 'fg', 'bg', 'x', 'y'} QR_PARAMS = ...
/rml_qrcode-1.1.0.tar.gz/rml_qrcode-1.1.0/rml_qrcode/__init__.py
0.433502
0.245108
__init__.py
pypi
import logging import traceback from typing import List, Mapping _Logger = logging.getLogger(__name__) # ---- HTTP-related class ClientError(Exception): """Client request is incorrect.""" pass class AuthenticationError(Exception): """Failed to authenticate user.""" pass class ForbiddenError(Exce...
/rmlab_errors-0.1.6-py3-none-any.whl/rmlab_errors/__init__.py
0.910466
0.216964
__init__.py
pypi
import os, io from dataclasses import dataclass from typing import Callable, List, Optional from inspect import signature, Parameter from typing import Any, List, Mapping from rmlab_errors import ValueError from enum import Enum import aiohttp class EnumStrings(Enum): @classmethod def str_to_enum_value(cls...
/rmlab_http_client-0.4.0-py3-none-any.whl/rmlab_http_client/types.py
0.890235
0.219819
types.py
pypi
from typing import Any, Mapping, Optional, Union from rmlab_errors import ValueError from rmlab_http_client import ( Endpoint, AsyncEndpoint, ) _EndpointType = Union[Endpoint, AsyncEndpoint] class Cache: """Singleton cache to store credentials and endpoints, meant to be initialized once. Raise...
/rmlab_http_client-0.4.0-py3-none-any.whl/rmlab_http_client/cache.py
0.918242
0.167083
cache.py
pypi
# RMM: RimWorld Mod Manager Do you dislike DRM based platforms but love RimWorld and it's mods? RMM is cross platform mod manager that allows you to download, update, auto-sort, and configure mods for the game without relying on the Steam consumer client. RMM has a keyboard based interface that is easy to use and will...
/rmm-spoons-1.0.15.tar.gz/rmm-spoons-1.0.15/README.md
0.678433
0.691484
README.md
pypi
from contextlib import contextmanager import re import shutil import subprocess import sys import xml.etree.ElementTree as ET from pathlib import Path from typing import Generator, Optional, cast, Union, List from xml.dom import minidom def platform() -> Optional[str]: return sys.platform def execute(cmd) -> Ge...
/rmm-spoons-1.0.15.tar.gz/rmm-spoons-1.0.15/src/rmm/util.py
0.57069
0.206574
util.py
pypi
import curses class WindowSizeException(Exception): pass class AbortModOrderException(Exception): pass def multiselect_order_menu(stdscr, data): data = [ ( n.packageid, n.enabled ) for n in data ] k = 0 # Clear and refresh the screen for a blank canvas stdscr.clear() stdscr.refresh()...
/rmm-spoons-1.0.15.tar.gz/rmm-spoons-1.0.15/src/rmm/multiselect.py
0.479016
0.351116
multiselect.py
pypi
from pathlib import Path from typing import Optional, List import rmm.util as util class PathFinder: DEFAULT_GAME_PATHS = [ ("~/GOG Games/RimWorld", "linux"), ("~/games/rimworld", "linux"), ("~/.local/share/Steam/steamapps/common/RimWorld", "linux"), ("/Applications/RimWorld.app/M...
/rmm-spoons-1.0.15.tar.gz/rmm-spoons-1.0.15/src/rmm/path.py
0.631481
0.262877
path.py
pypi
import torch.nn as nn from .basic_layers import ResidualBlock class AttentionModule(nn.Module): def __init__(self, in_channels, out_channels, size1, size2, size3): super(AttentionModule, self).__init__() self.first_residual_blocks = ResidualBlock(in_channels, out_channels) self.trunk_bra...
/rmn-3.1.1-py3-none-any.whl/models/attention_module.py
0.946088
0.40592
attention_module.py
pypi
import torch import torch.nn as nn class PreActivateDoubleConv(nn.Module): def __init__(self, in_channels, out_channels): super(PreActivateDoubleConv, self).__init__() self.double_conv = nn.Sequential( nn.BatchNorm2d(in_channels), nn.ReLU(inplace=True), nn.Conv2...
/rmn-3.1.1-py3-none-any.whl/models/brain_humor.py
0.966036
0.455622
brain_humor.py
pypi
from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F from .utils import load_state_dict_from_url __all__ = ["Inception3", "inception_v3"] model_urls = { # Inception v3 ported from TensorFlow "inception_v3_google": "https://download.pytorch.org/models/incepti...
/rmn-3.1.1-py3-none-any.whl/models/inception.py
0.954041
0.539226
inception.py
pypi
import torch.nn as nn from .attention_module import AttentionModule from .basic_layers import ResidualBlock class ResidualAttentionModel(nn.Module): def __init__(self, in_channels=3, num_classes=1000): super(ResidualAttentionModel, self).__init__() self.conv1 = nn.Sequential( nn.Conv2...
/rmn-3.1.1-py3-none-any.whl/models/residual_attention_network.py
0.906467
0.410402
residual_attention_network.py
pypi
import torch import torch.nn as nn from .masking import masking from .resnet import BasicBlock, ResNet from .utils import load_state_dict_from_url model_urls = { "resnet18": "https://download.pytorch.org/models/resnet18-5c106cde.pth", "resnet34": "https://download.pytorch.org/models/resnet34-333f7ec4.pth", ...
/rmn-3.1.1-py3-none-any.whl/models/resmasking_naive.py
0.8777
0.393152
resmasking_naive.py
pypi