repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
SLIT
SLIT-master/SLIT/Lens.py
import numpy as np import matplotlib.pyplot as plt import pyfits as pf import scipy.signal as scp import warnings warnings.simplefilter("ignore") #Tool box for lensing def SIS(x0,y0,n1,n2,Re): kappa = np.zeros((n1,n2)) x,y = np.where(kappa == 0) count = 0 for i in x: kappa[x[count],y[count]] =...
6,888
28.440171
123
py
SLIT
SLIT-master/SLIT/__init__.py
from Solve import * import Lens import wave_transform import tools
67
12.6
21
py
SLIT
SLIT-master/Examples/Test_SLIT_forUsers.py
import pyfits as pf import matplotlib.pyplot as plt import numpy as np import matplotlib.cm as cm from scipy import signal as scp import SLIT import time from scipy import signal as scp import warnings warnings.simplefilter("ignore") #Example of a run of the SLIT algorithm on simulated images. #Here the first part ...
3,928
37.145631
150
py
SLIT
SLIT-master/Examples/Test_SLIT_MCA.py
from SLIT import Lens import pyfits as pf import matplotlib.pyplot as plt import numpy as np import matplotlib.cm as cm from scipy import signal as scp import SLIT as slit import time from scipy import signal as scp import warnings warnings.simplefilter("ignore") #Example of a run of the SLIT_MCA algorithm on simulat...
6,169
29.544554
133
py
SLIT
SLIT-master/Examples/Test_SLIT.py
import pyfits as pf import matplotlib.pyplot as plt import numpy as np import matplotlib.cm as cm import SLIT import time from scipy import signal as scp import warnings warnings.simplefilter("ignore") #Example of a run of the SLIT algorithm on simulated images. #Here the first part of the file shows how simulatio...
4,935
31.473684
130
py
SLIT
SLIT-master/Examples/Test_SLIT_HR.py
import pyfits as pf import matplotlib.pyplot as plt import numpy as np import matplotlib.cm as cm from scipy import signal as scp import SLIT import time from scipy import signal as scp import warnings warnings.simplefilter("ignore") #Example of a run of the SLIT algorithm on simulated images. #Here the first part ...
4,965
31.457516
130
py
SLIT
SLIT-master/Examples/Test_sparsity.py
from SLIT import Lens import pyfits as pf import matplotlib.pyplot as plt import numpy as np import matplotlib.cm as cm from scipy import signal as scp from SLIT import wave_transform as mw import time from scipy import signal as scp import SLIT as slit from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_ax...
4,021
33.672414
132
py
SLIT
SLIT-master/build/lib/SLIT/Solve.py
#from __future__ import division import wave_transform as mw import numpy as np import matplotlib.pyplot as plt import pyfits as pf import matplotlib.cm as cm from scipy import signal as scp import scipy.ndimage.filters as med import MuSCADeT as wine from numpy import linalg as LA import multiprocess as mtp from patho...
22,735
31.713669
131
py
SLIT
SLIT-master/build/lib/SLIT/wave_transform.py
import numpy as np import scipy.signal as cp import matplotlib.pyplot as plt import scipy.ndimage.filters as sc def symmetrise(img, size): n3, n4 = np.shape(img) n1,n2 = size img[:(n3-n1)/2, :] = np.flipud(img[(n3-n1)/2:(n3-n1),:]) img[:,:(n4-n2)/2] = np.fliplr(img[:,(n4-n2)/2:(n4-n2)]) img[(n3+n...
3,715
25.169014
81
py
SLIT
SLIT-master/build/lib/SLIT/tools.py
import numpy as np import matplotlib.pyplot as plt import pyfits as pf import scipy.ndimage.filters as sc import scipy.ndimage.filters as med import scipy.signal as cp def MAD(x,n=3): ##DESCRIPTION: ## Estimates the noise standard deviation from Median Absolute Deviation ## ##INPUTS: ## -x: a 2D ...
7,049
26.539063
131
py
SLIT
SLIT-master/build/lib/SLIT/Lens.py
import numpy as np import matplotlib.pyplot as plt import pyfits as pf import scipy.signal as scp import warnings warnings.simplefilter("ignore") #Tool box for lensing def SIS(x0,y0,n1,n2,Re): kappa = np.zeros((n1,n2)) x,y = np.where(kappa == 0) count = 0 for i in x: kappa[x[count],y[count]] =...
7,136
28.987395
123
py
SLIT
SLIT-master/build/lib/SLIT/__init__.py
from Solve import * import Lens import wave_transform import tools
67
12.6
21
py
eEVM
eEVM-main/3rdparty/intx/test/fuzzer/decode.py
#!/usr/bin/env python3 import os import sys ops_filter = () ops = ('/', '*', '<<', '>>', '+', '-', 's/') def err(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def decode_file(file): with open(file, 'rb') as f: print("Decoding {}".format(file)) decode_data(f.read()) def decode...
1,690
22.486111
61
py
frodo
frodo-main/setup.py
from setuptools import setup, find_packages install_requires=[ 'flask', 'rdflib', 'nltk', 'shortuuid', 'fredclient @ git+https://github.com/anuzzolese/fredclient' ] setup(name='frodo', version='1.0.0', packages=find_packages(), install_requires=install_requires)
284
20.923077
64
py
frodo
frodo-main/demo/frodo_webapp.py
from flask import Flask, Response, render_template, request from frodo import Frodo import shortuuid import webapp_conf myapp = Flask(__name__) @myapp.route("/") def index(): text = request.args.get("text") ontology_id = request.args.get("ontology-id") if text: print(text) #namespace = ''....
972
28.484848
77
py
frodo
frodo-main/demo/webapp_conf.py
import shortuuid FRED_ENDPOINT = 'http://wit.istc.cnr.it/stlab-tools/fred' FRED_KEY = '' NS = 'https://w3id.org/stlab/ontology/' PORT = 5555 BASEPATH = './' shortuuid.set_alphabet("0123456789abcdefghijkmnopqrstuvwxyz")
220
23.555556
61
py
frodo
frodo-main/demo/demo.py
from frodo import Frodo import shortuuid import webapp_conf #shortuuid.set_alphabet("0123456789abcdefghijkmnopqrstuvwxyz") sentence = 'What cars cost more than $50,000?' namespace = ''.join([webapp_conf.NS, shortuuid.uuid(sentence)[:8], '/']) frodo = Frodo( namespace=namespace, fred_uri=webapp_conf.FRED_EN...
609
26.727273
84
py
frodo
frodo-main/frodo/taxonomic_queries.py
update = { 'alias_instance': 'PREFIX dul: <http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#>\nPREFIX fred: <http://www.ontologydesignpatterns.org/ont/fred/>\n\nDELETE {\n ?alias_instance a fred:Alias;\n fred:aliasOf ?instance.\n\n ?s ?p ?o. # remove all statements about the fred:Alias class\n}\nI...
16,514
916.5
2,617
py
frodo
frodo-main/frodo/frodo.py
import os import re from fredclient import FREDClient, FREDParameters, FREDDefaults import nltk from nltk.stem import WordNetLemmatizer from rdflib import RDFS, RDF, OWL, XSD, URIRef, Literal, BNode, Graph, Namespace from rdflib.paths import evalPath, OneOrMore from abc import ABC, abstractmethod from typing import L...
22,735
37.601019
161
py
frodo
frodo-main/frodo/__init__.py
from frodo.frodo import *
26
12.5
25
py
minkasi
minkasi-master/setup.py
from setuptools import Extension, setup import ctypes import subprocess import os try: mylib=ctypes.cdll.LoadLibrary("libminkasi.so") except OSError: os.environ["prefix"] = "minkasi" subprocess.check_call(["make", "-e", "libminkasi"]) try: mylib=ctypes.cdll.LoadLibrary("libmkfftw.so") except OSError: ...
642
20.433333
55
py
minkasi
minkasi-master/examples/minkasi_mpi_example.py
import numpy from matplotlib import pyplot as plt import minkasi,pyfftw import time import glob reload(minkasi) plt.ion() #find tod files we want to map dir='../data/m0717_raw/' tod_names=glob.glob(dir+'*.fits') #if running MPI, you would want to split up files between processes #one easy way is to say to this: tod...
3,708
34.32381
95
py
minkasi
minkasi-master/examples/tsBowl_fitter.py
import minkasi import numpy as np from matplotlib import pyplot as plt import time fname = '/scratch/r/rbond/jorlo/MS0735/TS_EaCMS0f0_51_5_Oct_2021/Signal_TOD-AGBT19A_092_08-s26.fits' dat = minkasi.read_tod_from_fits(fname) minkasi.truncate_tod(dat) # figure out a guess at common mode and (assumed) linear detector d...
1,384
20.984127
100
py
minkasi
minkasi-master/examples/zw3146_tsBowl.py
#This is a template script to show how to fit multi-component models #directly to timestreams. The initial part (where the TODs, noise model etc.) #are set up is the same as general mapping scripts, although we don't #need to bother with setting a map/pixellization in general (although if #your timestream model used a...
4,147
30.907692
127
py
minkasi
minkasi-master/examples/fit_zw3146_multi_component.py
#This is a template script to show how to fit multi-component models #directly to timestreams. The initial part (where the TODs, noise model etc.) #are set up is the same as general mapping scripts, although we don't #need to bother with setting a map/pixellization in general (although if #your timestream model used a...
4,311
38.2
114
py
minkasi
minkasi-master/examples/minkasi_map_moo_python3.py
import numpy import numpy as np from matplotlib import pyplot as plt import minkasi import time import glob from importlib import reload reload(minkasi) plt.ion() def smooth_map(map,npix=3): n=map.shape[0] m=map.shape[1] v1=np.fft.fftfreq(n)*n v2=np.fft.fftfreq(m)*m rmat=np.outer(v1,np.ones(m))**2...
5,186
30.628049
122
py
minkasi
minkasi-master/examples/tsBowl_map_maker.py
import minkasi import numpy as np from matplotlib import pyplot as plt import glob import time import minkasi_jax.presets_by_source as pbs import os from astropy.coordinates import Angle from astropy import units as u dir = '/scratch/r/rbond/jorlo/MS0735//TS_EaCMS0f0_51_5_Oct_2021/' tod_names=glob.glob(dir+'Sig*.fits'...
6,463
28.788018
146
py
minkasi
minkasi-master/minkasi/code_scrapyard.py
def __run_pcg_old(b,x0,tods,mapset,precon): Ax=mapset.dot(x0) r=b-Ax z=precon*r p=z.copy() k=0 zr=r.dot(z) x=x0.copy() for iter in range(25): print(iter,zr) Ap=mapset.dot(p) pAp=p.dot(Ap) alpha=zr/pAp x_new=x+p*alpha r_new=r-Ap*alpha ...
14,023
31.843091
175
py
minkasi
minkasi-master/minkasi/minkasi_nb.py
import numpy as np import numba as nb @nb.njit(parallel=True) def map2tod_destriped(mat,pars,lims,do_add=True): ndet=mat.shape[0] nseg=len(lims)-1 for seg in nb.prange(nseg): for det in range(ndet): if do_add: for i in range(lims[seg],lims[seg+1]): ma...
9,537
31.114478
138
py
minkasi
minkasi-master/minkasi/minkasi.py
import os import numpy as np import ctypes import time from . import mkfftw #import pyfits from astropy.io import fits as pyfits import astropy from astropy import wcs from astropy.io import fits from astropy.cosmology import WMAP9 as cosmo #choose your cosmology here import scipy import copy import sys from numba impo...
187,717
34.674268
578
py
minkasi
minkasi-master/minkasi/mkfftw.py
import os import numpy import ctypes import time try: mylib=ctypes.cdll.LoadLibrary("libmkfftw.so") except OSError: mylib=ctypes.cdll.LoadLibrary(os.path.join(os.path.dirname(os.path.abspath(__file__)), "libmkfftw.so")) many_fft_r2c_1d_c=mylib.many_fft_r2c_1d many_fft_r2c_1d_c.argtypes=[ctypes.c_void_p,ctype...
6,217
31.385417
113
py
minkasi
minkasi-master/minkasi/pyregion_tools.py
import pyregion from astropy.io import fits from astropy.wcs import WCS import numpy as np import copy __all__ = ["region_binner", "bootstrap"] def bootstrap(data, n = 10000): """ Bootstraps data. Given an input data vector, the bootstrapping proceedure selects a random subsample of data, w...
7,945
36.658768
140
py
minkasi
minkasi-master/minkasi/__init__.py
from .minkasi import *
23
11
22
py
minkasi
minkasi-master/minkasi/zernike.py
import numpy def zernike_column(m,nmax,rmat): """Generate the radial part of zernike polynomials for all n from m up to nmax""" if ((m-nmax)%2!=0): #print 'm an n must have same parity' #return None #if parity is wrong, then drop nmax by one. makes external loop to generate all zns mu...
1,894
20.534091
105
py
tbsm
tbsm-main/tbsm_pytorch.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. ### import packages ### from __future__ import absolute_import, division, print_function, unicode_literals # miscellaneous import time import...
35,338
36.917382
148
py
tbsm
tbsm-main/tbsm_synthetic.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # miscellaneous from os import path import sys # numpy and scikit-learn import numpy as np from sklearn.metrics import roc_auc_score # pyto...
11,465
36.106796
88
py
tbsm
tbsm-main/tbsm_data_pytorch.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. ### import packages ### from __future__ import absolute_import, division, print_function, unicode_literals # miscellaneous from os import pat...
16,772
36.52349
88
py
tbsm
tbsm-main/tools/taobao_prepare.py
# Copyright (c) 2019 UIC-Paper # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # # Source: https://github.com/UIC-Paper/MIMN import cPickle as pkl import pandas as pd import random import numpy as np RAW_DATA_FILE = './data/taobao_data/User...
8,508
36.484581
204
py
rllab
rllab-master/setup.py
# setup.py from setuptools import setup,find_packages setup( name='rllab', packages=[package for package in find_packages() if package.startswith('rllab')], version='0.1.0', )
205
19.6
52
py
rllab
rllab-master/examples/trpo_cartpole_recurrent.py
from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.envs.normalized_env import normalize from rllab.policies.gaussian_gru_policy import GaussianGRUPolicy from rllab.optimizers.conjugate_gradient_opti...
1,003
25.421053
105
py
rllab
rllab-master/examples/cluster_gym_mujoco_demo.py
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.normalized_env import normalize from sandbox.rocky.tf.envs.base import TfEnv from sandbox.rocky.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy from sandbox.rocky.tf.algos.trpo import TRPO from rllab.misc.instrument impor...
1,919
25.30137
93
py
rllab
rllab-master/examples/trpo_cartpole.py
from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.envs.normalized_env import normalize from rllab.policies.gaussian_mlp_policy import GaussianMLPPolicy env = normalize(CartpoleEnv()) policy = Gau...
713
24.5
89
py
rllab
rllab-master/examples/trpo_cartpole_pickled.py
from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.envs.normalized_env import normalize from rllab.misc.instrument import run_experiment_lite from rllab.policies.gaussian_mlp_policy import GaussianM...
1,287
27
93
py
rllab
rllab-master/examples/vpg_2.py
from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.policies.gaussian_mlp_policy import GaussianMLPPolicy from rllab.envs.normalized_env import normalize import numpy as np import theano import theano.tensor as TT from lasagne.updat...
5,669
40.086957
119
py
rllab
rllab-master/examples/cluster_demo.py
from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.envs.normalized_env import normalize from rllab.misc.instrument import stub, run_experiment_lite from rllab.policies.gaussian_mlp_policy import Gau...
1,682
29.6
93
py
rllab
rllab-master/examples/trpo_gym_cartpole.py
from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.gym_env import GymEnv from rllab.envs.normalized_env import normalize from rllab.misc.instrument import run_experiment_lite from rllab.policies.categorical_mlp_policy import CategoricalMLPPolicy ...
1,597
30.96
93
py
rllab
rllab-master/examples/trpo_gym_pendulum.py
from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.gym_env import GymEnv from rllab.envs.normalized_env import normalize from rllab.misc.instrument import run_experiment_lite from rllab.policies.gaussian_mlp_policy import GaussianMLPPolicy def r...
1,582
31.306122
98
py
rllab
rllab-master/examples/trpo_point.py
from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from examples.point_env import PointEnv from rllab.envs.normalized_env import normalize from rllab.policies.gaussian_mlp_policy import GaussianMLPPolicy env = normalize(PointEnv()) policy = GaussianMLPPolicy( ...
478
25.611111
73
py
rllab
rllab-master/examples/ddpg_cartpole.py
from rllab.algos.ddpg import DDPG from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.envs.normalized_env import normalize from rllab.misc.instrument import run_experiment_lite from rllab.exploration_strategies.ou_strategy import OUStrategy from rllab.policies.deterministic_mlp_policy import DeterministicM...
1,538
28.037736
93
py
rllab
rllab-master/examples/trpo_swimmer.py
from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.mujoco.swimmer_env import SwimmerEnv from rllab.envs.normalized_env import normalize from rllab.policies.gaussian_mlp_policy import GaussianMLPPolicy env = normalize(SwimmerEnv()) policy = Gauss...
711
24.428571
89
py
rllab
rllab-master/examples/point_env.py
from rllab.envs.base import Env from rllab.spaces import Box from rllab.envs.base import Step import numpy as np class PointEnv(Env): @property def observation_space(self): return Box(low=-np.inf, high=np.inf, shape=(2,)) @property def action_space(self): return Box(low=-0.1, high=0.1...
866
26.967742
75
py
rllab
rllab-master/examples/__init__.py
0
0
0
py
rllab
rllab-master/examples/nop_cartpole.py
from rllab.algos.nop import NOP from rllab.baselines.zero_baseline import ZeroBaseline from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.envs.normalized_env import normalize from rllab.policies.uniform_control_policy import UniformControlPolicy env = normalize(CartpoleEnv()) policy = UniformControlPoli...
665
23.666667
89
py
rllab
rllab-master/examples/vpg_1.py
from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.policies.gaussian_mlp_policy import GaussianMLPPolicy from rllab.envs.normalized_env import normalize import numpy as np import theano import theano.tensor as TT from lasagne.updates import adam # normalize() makes sure that the actions for the environm...
5,002
40.347107
119
py
rllab
rllab-master/examples/trpo_gym_tf_cartpole.py
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.gym_env import GymEnv from rllab.envs.normalized_env import normalize from rllab.misc.instrument import stub, run_experiment_lite from sandbox.rocky.tf.envs.base import TfEnv from sandbox.rocky.tf.policies.categorical_mlp_policy ...
1,194
26.790698
91
py
rllab
rllab-master/sandbox/__init__.py
0
0
0
py
rllab
rllab-master/sandbox/rocky/__init__.py
0
0
0
py
rllab
rllab-master/sandbox/rocky/tf/__init__.py
0
0
0
py
rllab
rllab-master/sandbox/rocky/tf/launchers/vpg_cartpole.py
from sandbox.rocky.tf.algos.vpg import VPG from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.envs.normalized_env import normalize from sandbox.rocky.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy from sandbox.rocky.tf.env...
949
26.142857
89
py
rllab
rllab-master/sandbox/rocky/tf/launchers/trpo_cartpole_recurrent.py
from sandbox.rocky.tf.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.envs.normalized_env import normalize from sandbox.rocky.tf.policies.gaussian_gru_policy import GaussianGRUPolicy from sandbox.rocky.tf.p...
1,148
31.828571
116
py
rllab
rllab-master/sandbox/rocky/tf/launchers/trpo_cartpole.py
from sandbox.rocky.tf.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.box2d.cartpole_env import CartpoleEnv from rllab.envs.normalized_env import normalize from sandbox.rocky.tf.optimizers.conjugate_gradient_optimizer import ConjugateGradientOptimizer fro...
1,144
31.714286
95
py
rllab
rllab-master/sandbox/rocky/tf/launchers/__init__.py
1
0
0
py
rllab
rllab-master/sandbox/rocky/tf/core/network.py
import sandbox.rocky.tf.core.layers as L import tensorflow as tf import numpy as np import itertools from rllab.core.serializable import Serializable from sandbox.rocky.tf.core.parameterized import Parameterized from sandbox.rocky.tf.core.layers_powered import LayersPowered class MLP(LayersPowered, Serializable): ...
19,707
35.837383
155
py
rllab
rllab-master/sandbox/rocky/tf/core/layers.py
# -*- coding: utf-8 -*- import functools import numpy as np import math import tensorflow as tf from tensorflow.python.training import moving_averages from collections import OrderedDict from collections import deque from itertools import chain from inspect import getargspec from difflib import get_close_matches from w...
76,922
40.557536
120
py
rllab
rllab-master/sandbox/rocky/tf/core/layers_powered.py
from sandbox.rocky.tf.core.parameterized import Parameterized import sandbox.rocky.tf.core.layers as L import itertools class LayersPowered(Parameterized): def __init__(self, output_layers, input_layers=None): self._output_layers = output_layers self._input_layers = input_layers Parameter...
592
31.944444
89
py
rllab
rllab-master/sandbox/rocky/tf/core/__init__.py
1
0
0
py
rllab
rllab-master/sandbox/rocky/tf/core/parameterized.py
from contextlib import contextmanager from rllab.core.serializable import Serializable from rllab.misc.tensor_utils import flatten_tensors, unflatten_tensors import tensorflow as tf load_params = True @contextmanager def suppress_params_loading(): global load_params load_params = False yield load_pa...
4,226
37.081081
98
py
rllab
rllab-master/sandbox/rocky/tf/envs/parallel_vec_env_executor.py
import numpy as np import pickle as pickle from sandbox.rocky.tf.misc import tensor_utils from rllab.misc import logger from rllab.sampler.stateful_pool import singleton_pool import uuid def worker_init_envs(G, alloc, scope, env): logger.log("initializing environment on worker %d" % G.worker_id) if not has...
6,057
33.225989
119
py
rllab
rllab-master/sandbox/rocky/tf/envs/base.py
from rllab.envs.proxy_env import ProxyEnv from rllab.envs.base import EnvSpec from rllab.spaces.box import Box as TheanoBox from rllab.spaces.discrete import Discrete as TheanoDiscrete from rllab.spaces.product import Product as TheanoProduct from sandbox.rocky.tf.spaces.discrete import Discrete from sandbox.rocky.tf.s...
2,330
28.506329
106
py
rllab
rllab-master/sandbox/rocky/tf/envs/vec_env_executor.py
import numpy as np import pickle as pickle from sandbox.rocky.tf.misc import tensor_utils class VecEnvExecutor(object): def __init__(self, envs, max_path_length): self.envs = envs self._action_space = envs[0].action_space self._observation_space = envs[0].observation_space self.t...
1,412
27.836735
82
py
rllab
rllab-master/sandbox/rocky/tf/envs/__init__.py
1
0
0
py
rllab
rllab-master/sandbox/rocky/tf/distributions/recurrent_diagonal_gaussian.py
from sandbox.rocky.tf.distributions.diagonal_gaussian import DiagonalGaussian RecurrentDiagonalGaussian = DiagonalGaussian
127
17.285714
77
py
rllab
rllab-master/sandbox/rocky/tf/distributions/base.py
class Distribution(object): @property def dim(self): raise NotImplementedError def kl_sym(self, old_dist_info_vars, new_dist_info_vars): """ Compute the symbolic KL divergence of two distributions """ raise NotImplementedError def kl(self, old_dist_info, new...
982
22.97561
82
py
rllab
rllab-master/sandbox/rocky/tf/distributions/categorical.py
import numpy as np from .base import Distribution import tensorflow as tf from sandbox.rocky.tf.misc import tensor_utils TINY = 1e-8 def from_onehot(x_var): ret = np.zeros((len(x_var),), 'int32') nonzero_n, nonzero_a = np.nonzero(x_var) ret[nonzero_n] = nonzero_a return ret class Categorical(Distri...
3,514
32.47619
90
py
rllab
rllab-master/sandbox/rocky/tf/distributions/recurrent_categorical.py
import tensorflow as tf import numpy as np from sandbox.rocky.tf.distributions.categorical import Categorical from sandbox.rocky.tf.distributions.base import Distribution TINY = 1e-8 class RecurrentCategorical(Distribution): def __init__(self, dim): self._cat = Categorical(dim) self._dim = dim ...
2,923
33
87
py
rllab
rllab-master/sandbox/rocky/tf/distributions/__init__.py
1
0
0
py
rllab
rllab-master/sandbox/rocky/tf/distributions/diagonal_gaussian.py
import tensorflow as tf import numpy as np from sandbox.rocky.tf.distributions.base import Distribution class DiagonalGaussian(Distribution): def __init__(self, dim): self._dim = dim @property def dim(self): return self._dim def kl(self, old_dist_info, new_dist_info): old_...
3,627
36.020408
84
py
rllab
rllab-master/sandbox/rocky/tf/distributions/bernoulli.py
from .base import Distribution import tensorflow as tf import numpy as np TINY = 1e-8 class Bernoulli(Distribution): def __init__(self, dim): self._dim = dim @property def dim(self): return self._dim def kl_sym(self, old_dist_info_vars, new_dist_info_vars): old_p = old_dis...
2,050
33.183333
110
py
rllab
rllab-master/sandbox/rocky/tf/policies/base.py
from sandbox.rocky.tf.core.parameterized import Parameterized class Policy(Parameterized): def __init__(self, env_spec): Parameterized.__init__(self) self._env_spec = env_spec # Should be implemented by all policies def get_action(self, observation): raise NotImplementedError ...
2,755
24.757009
117
py
rllab
rllab-master/sandbox/rocky/tf/policies/uniform_control_policy.py
from sandbox.rocky.tf.policies.base import Policy from rllab.core.serializable import Serializable class UniformControlPolicy(Policy, Serializable): def __init__( self, env_spec, ): Serializable.quick_init(self, locals()) super(UniformControlPolicy, self).__init__(env_s...
658
25.36
69
py
rllab
rllab-master/sandbox/rocky/tf/policies/categorical_gru_policy.py
import numpy as np import sandbox.rocky.tf.core.layers as L import tensorflow as tf from sandbox.rocky.tf.core.layers_powered import LayersPowered from sandbox.rocky.tf.core.network import GRUNetwork, MLP from sandbox.rocky.tf.distributions.recurrent_categorical import RecurrentCategorical from sandbox.rocky.tf.misc im...
7,649
36.317073
105
py
rllab
rllab-master/sandbox/rocky/tf/policies/categorical_mlp_policy.py
from sandbox.rocky.tf.core.layers_powered import LayersPowered import sandbox.rocky.tf.core.layers as L from sandbox.rocky.tf.core.network import MLP from rllab.core.serializable import Serializable from sandbox.rocky.tf.distributions.categorical import Categorical from sandbox.rocky.tf.policies.base import StochasticP...
3,395
36.733333
97
py
rllab
rllab-master/sandbox/rocky/tf/policies/categorical_lstm_policy.py
import numpy as np import sandbox.rocky.tf.core.layers as L import tensorflow as tf from sandbox.rocky.tf.core.layers_powered import LayersPowered from sandbox.rocky.tf.core.network import LSTMNetwork, MLP from sandbox.rocky.tf.distributions.recurrent_categorical import RecurrentCategorical from sandbox.rocky.tf.misc i...
8,307
37.110092
105
py
rllab
rllab-master/sandbox/rocky/tf/policies/gaussian_mlp_policy.py
import numpy as np from sandbox.rocky.tf.core.layers_powered import LayersPowered import sandbox.rocky.tf.core.layers as L from sandbox.rocky.tf.core.network import MLP from sandbox.rocky.tf.spaces.box import Box from rllab.core.serializable import Serializable from sandbox.rocky.tf.policies.base import StochasticPol...
8,050
40.076531
117
py
rllab
rllab-master/sandbox/rocky/tf/policies/gaussian_lstm_policy.py
import numpy as np import sandbox.rocky.tf.core.layers as L import tensorflow as tf from sandbox.rocky.tf.core.layers_powered import LayersPowered from sandbox.rocky.tf.core.network import LSTMNetwork from sandbox.rocky.tf.distributions.recurrent_diagonal_gaussian import RecurrentDiagonalGaussian from sandbox.rocky.tf....
8,680
36.743478
105
py
rllab
rllab-master/sandbox/rocky/tf/policies/gaussian_gru_policy.py
import numpy as np import sandbox.rocky.tf.core.layers as L import tensorflow as tf from sandbox.rocky.tf.core.layers_powered import LayersPowered from sandbox.rocky.tf.core.network import GRUNetwork from sandbox.rocky.tf.distributions.recurrent_diagonal_gaussian import RecurrentDiagonalGaussian from sandbox.rocky.tf.m...
8,416
36.243363
105
py
rllab
rllab-master/sandbox/rocky/tf/policies/__init__.py
1
0
0
py
rllab
rllab-master/sandbox/rocky/tf/policies/categorical_conv_policy.py
from sandbox.rocky.tf.core.layers_powered import LayersPowered import sandbox.rocky.tf.core.layers as L from sandbox.rocky.tf.core.network import ConvNetwork from rllab.core.serializable import Serializable from sandbox.rocky.tf.distributions.categorical import Categorical from sandbox.rocky.tf.policies.base import Sto...
3,662
36.762887
97
py
rllab
rllab-master/sandbox/rocky/tf/policies/deterministic_mlp_policy.py
from rllab.core.serializable import Serializable from rllab.misc import ext from rllab.misc.overrides import overrides from sandbox.rocky.tf.core.layers_powered import LayersPowered from sandbox.rocky.tf.core.network import MLP from sandbox.rocky.tf.distributions.categorical import Categorical from sandbox.rocky.tf.pol...
2,794
36.266667
97
py
rllab
rllab-master/sandbox/rocky/tf/algos/npo.py
from rllab.misc import ext from rllab.misc.overrides import overrides import rllab.misc.logger as logger from sandbox.rocky.tf.optimizers.penalty_lbfgs_optimizer import PenaltyLbfgsOptimizer from sandbox.rocky.tf.algos.batch_polopt import BatchPolopt from sandbox.rocky.tf.misc import tensor_utils import tensorflow a...
4,814
35.755725
109
py
rllab
rllab-master/sandbox/rocky/tf/algos/vpg.py
from rllab.misc import logger from rllab.misc import ext from rllab.misc.overrides import overrides from sandbox.rocky.tf.algos.batch_polopt import BatchPolopt from sandbox.rocky.tf.optimizers.first_order_optimizer import FirstOrderOptimizer from sandbox.rocky.tf.misc import tensor_utils from rllab.core.serializable ...
4,899
34.766423
109
py
rllab
rllab-master/sandbox/rocky/tf/algos/trpo.py
from sandbox.rocky.tf.algos.npo import NPO from sandbox.rocky.tf.optimizers.conjugate_gradient_optimizer import ConjugateGradientOptimizer class TRPO(NPO): """ Trust Region Policy Optimization """ def __init__( self, optimizer=None, optimizer_args=None, ...
578
25.318182
95
py
rllab
rllab-master/sandbox/rocky/tf/algos/__init__.py
1
0
0
py
rllab
rllab-master/sandbox/rocky/tf/algos/npg.py
1
0
0
py
rllab
rllab-master/sandbox/rocky/tf/algos/batch_polopt.py
import time from rllab.algos.base import RLAlgorithm import rllab.misc.logger as logger from sandbox.rocky.tf.policies.base import Policy import tensorflow as tf from sandbox.rocky.tf.samplers.batch_sampler import BatchSampler from sandbox.rocky.tf.samplers.vectorized_sampler import VectorizedSampler from rllab.sampler...
6,100
36.89441
111
py
rllab
rllab-master/sandbox/rocky/tf/spaces/box.py
from rllab.spaces.box import Box as TheanoBox import tensorflow as tf class Box(TheanoBox): def new_tensor_variable(self, name, extra_dims, flatten=True): if flatten: return tf.placeholder(tf.float32, shape=[None] * extra_dims + [self.flat_dim], name=name) return tf.placeholder(tf.floa...
444
30.785714
101
py
rllab
rllab-master/sandbox/rocky/tf/spaces/discrete.py
from rllab.spaces.base import Space import numpy as np from rllab.misc import special from rllab.misc import ext import tensorflow as tf class Discrete(Space): """ {0,1,...,n-1} """ def __init__(self, n): self._n = n @property def n(self): return self._n def sample(self)...
1,672
21.306667
101
py
rllab
rllab-master/sandbox/rocky/tf/spaces/__init__.py
from .product import Product from .discrete import Discrete from .box import Box __all__ = ["Product", "Discrete", "Box"]
123
19.666667
40
py
rllab
rllab-master/sandbox/rocky/tf/spaces/product.py
from rllab.spaces.base import Space import tensorflow as tf import numpy as np class Product(Space): def __init__(self, *components): if isinstance(components[0], (list, tuple)): assert len(components) == 1 components = components[0] self._components = tuple(components) ...
2,360
33.217391
97
py
rllab
rllab-master/sandbox/rocky/tf/misc/tensor_utils.py
import tensorflow as tf import numpy as np def compile_function(inputs, outputs, log_name=None): def run(*input_vals): sess = tf.get_default_session() return sess.run(outputs, feed_dict=dict(list(zip(inputs, input_vals)))) return run def flatten_tensor_variables(ts): return tf.concat(ax...
3,406
27.157025
90
py