repo
stringlengths
2
99
file
stringlengths
14
239
code
stringlengths
20
3.99M
file_length
int64
20
3.99M
avg_line_length
float64
9.73
128
max_line_length
int64
11
86.4k
extension_type
stringclasses
1 value
trieste-develop
trieste-develop/trieste/models/interfaces.py
from __future__ import annotations from abc import ABC, abstractmethod from typing import Any, Callable, Generic, Optional, TypeVar import gpflow import tensorflow as tf from typing_extensions import Protocol, runtime_checkable from ..data import Dataset from ..types import TensorType from ..utils import DEFAULTS f...
30,175
41.263305
100
py
trieste-develop
trieste-develop/trieste/models/optimizer.py
r""" This module contains common optimizers based on :class:`~tf.optimizers.Optimizer` that can be used with models. Specific models can also sub-class these optimizers or implement their own, and should register their loss functions using a :func:`create_loss_function`. """ from __future__ import annotations import...
9,230
37.949367
100
py
trieste-develop
trieste-develop/trieste/models/gpflux/sampler.py
from __future__ import annotations from abc import ABC from typing import Callable, cast import gpflow.kernels import tensorflow as tf from gpflow.inducing_variables import InducingPoints from gpflux.layers import GPLayer, LatentVariableLayer from gpflux.layers.basis_functions.fourier_features import RandomFourierFe...
20,609
40.302605
100
py
trieste-develop
trieste-develop/trieste/models/gpflux/builders.py
""" This file contains builders for GPflux models supported in Trieste. We found the default configurations used here to work well in most situation, but they should not be taken as universally good solutions. """ from __future__ import annotations from typing import Optional import gpflow import numpy as np import...
6,191
38.43949
100
py
trieste-develop
trieste-develop/trieste/models/gpflux/models.py
from __future__ import annotations from typing import Any, Callable, Optional import dill import gpflow import tensorflow as tf from gpflow.inducing_variables import InducingPoints from gpflux.layers import GPLayer, LatentVariableLayer from gpflux.models import DeepGP from tensorflow.python.keras.callbacks import Ca...
18,255
44.526185
100
py
trieste-develop
trieste-develop/trieste/models/gpflux/interface.py
from __future__ import annotations from abc import ABC, abstractmethod import tensorflow as tf from gpflow.base import Module from ...types import TensorType from ..interfaces import SupportsGetObservationNoise from ..optimizer import KerasOptimizer class GPfluxPredictor(SupportsGetObservationNoise, ABC): """...
3,501
37.483516
98
py
trieste-develop
trieste-develop/trieste/models/keras/sampler.py
""" This module is the home of the sampling functionality required by some of the Trieste's Keras model wrappers. """ from __future__ import annotations from typing import Dict, Optional import tensorflow as tf from ...types import TensorType from ...utils import DEFAULTS, flatten_leading_dims from ..interfaces im...
9,679
41.643172
100
py
trieste-develop
trieste-develop/trieste/models/keras/utils.py
from __future__ import annotations from typing import Optional import tensorflow as tf import tensorflow_probability as tfp from ...data import Dataset from ...types import TensorType def get_tensor_spec_from_data(dataset: Dataset) -> tuple[tf.TensorSpec, tf.TensorSpec]: r""" Extract tensor specifications...
5,241
37.262774
100
py
trieste-develop
trieste-develop/trieste/models/keras/architectures.py
""" This file contains implementations of neural network architectures with Keras. """ from __future__ import annotations from abc import abstractmethod from typing import Any, Callable, Sequence import dill import numpy as np import tensorflow as tf import tensorflow_probability as tfp from tensorflow_probability....
14,523
40.497143
100
py
trieste-develop
trieste-develop/trieste/models/keras/builders.py
""" This file contains builders for Keras models supported in Trieste. We found the default configurations used here to work well in most situation, but they should not be taken as universally good solutions. """ from __future__ import annotations from typing import Union import tensorflow as tf from ...data impor...
3,471
40.831325
99
py
trieste-develop
trieste-develop/trieste/models/keras/models.py
from __future__ import annotations import re from typing import Any, Dict, Optional import dill import tensorflow as tf import tensorflow_probability as tfp import tensorflow_probability.python.distributions as tfd from tensorflow.python.keras.callbacks import Callback from ... import logging from ...data import Da...
25,439
47.923077
100
py
trieste-develop
trieste-develop/trieste/models/keras/interface.py
from __future__ import annotations from abc import ABC, abstractmethod from typing import Optional import tensorflow as tf import tensorflow_probability as tfp from typing_extensions import Protocol, runtime_checkable from ...types import TensorType from ..interfaces import ProbabilisticModel from ..optimizer impor...
4,335
36.37931
100
py
trieste-develop
trieste-develop/trieste/models/gpflow/inducing_point_selectors.py
""" This module is the home of Trieste's functionality for choosing the inducing points of sparse variational Gaussian processes (i.e. our :class:`SparseVariational` wrapper). """ from __future__ import annotations from abc import ABC, abstractmethod from typing import Generic import gpflow import tensorflow as tf ...
18,538
39.655702
100
py
trieste-develop
trieste-develop/trieste/models/gpflow/sampler.py
""" This module is the home of the sampling functionality required by Trieste's GPflow wrappers. """ from __future__ import annotations from abc import ABC, abstractmethod from typing import Callable, Optional, Tuple, TypeVar, Union, cast import tensorflow as tf import tensorflow_probability as tfp from gpflow.kerne...
40,450
42.402361
100
py
trieste-develop
trieste-develop/trieste/models/gpflow/utils.py
from __future__ import annotations from typing import Tuple, Union import gpflow import tensorflow as tf import tensorflow_probability as tfp from ...data import Dataset from ...types import TensorType from ...utils import DEFAULTS from ..optimizer import BatchOptimizer, Optimizer from .interface import GPflowPredi...
14,693
41.964912
99
py
trieste-develop
trieste-develop/trieste/models/gpflow/builders.py
""" This module contains builders for GPflow models supported in Trieste. We found the default configurations used here to work well in most situation, but they should not be taken as universally good solutions. """ from __future__ import annotations import math from typing import Optional, Sequence, Type import gp...
27,128
42.68599
99
py
trieste-develop
trieste-develop/trieste/models/gpflow/models.py
from __future__ import annotations from typing import Optional, Sequence, Tuple, Union, cast import gpflow import tensorflow as tf import tensorflow_probability as tfp from gpflow.conditionals.util import sample_mvn from gpflow.inducing_variables import ( SeparateIndependentInducingVariables, SharedIndepende...
90,637
43.825915
100
py
trieste-develop
trieste-develop/trieste/models/gpflow/interface.py
from __future__ import annotations from abc import ABC, abstractmethod from typing import Any, Optional import gpflow import tensorflow as tf from gpflow.models import GPModel from gpflow.posteriors import BasePosterior, PrecomputeCacheType from typing_extensions import Protocol from ... import logging from ...data...
7,905
37.754902
100
py
trieste-develop
trieste-develop/trieste/models/gpflow/optimizer.py
r""" This module registers the GPflow specific loss functions. """ from __future__ import annotations from typing import Any, Callable, Optional import tensorflow as tf from gpflow.models import ExternalDataTrainingLossMixin, InternalDataTrainingLossMixin from tensorflow.python.data.ops.iterator_ops import OwnedIte...
3,374
34.526316
91
py
trieste-develop
trieste-develop/trieste/utils/misc.py
from __future__ import annotations from abc import ABC, abstractmethod from time import perf_counter from types import TracebackType from typing import Any, Callable, Generic, Mapping, NoReturn, Optional, Tuple, Type, TypeVar import numpy as np import tensorflow as tf from tensorflow.python.util import nest from typi...
11,630
28.371212
100
py
trieste-develop
trieste-develop/trieste/acquisition/sampler.py
""" This module is the home of the sampling functionality required by Trieste's acquisition functions. """ from __future__ import annotations from abc import ABC, abstractmethod from typing import Callable, Generic import tensorflow as tf import tensorflow_probability as tfp from scipy.optimize import bisect from ....
11,521
41.674074
100
py
trieste-develop
trieste-develop/trieste/acquisition/utils.py
import functools from typing import Tuple, Union import tensorflow as tf from ..data import Dataset from ..space import SearchSpaceType from ..types import TensorType from .interface import AcquisitionFunction from .optimizer import AcquisitionOptimizer def split_acquisition_function( fn: AcquisitionFunction, ...
5,297
37.391304
100
py
trieste-develop
trieste-develop/trieste/acquisition/interface.py
""" This module contains the interfaces relating to acquisition function --- functions that estimate the utility of evaluating sets of candidate points. """ from __future__ import annotations from abc import ABC, abstractmethod from typing import Callable, Generic, Mapping, Optional from ..data import Dataset from .....
16,951
41.916456
100
py
trieste-develop
trieste-develop/trieste/acquisition/combination.py
from __future__ import annotations from abc import abstractmethod from collections.abc import Mapping, Sequence from typing import Callable, Optional import tensorflow as tf from ..data import Dataset from ..models import ProbabilisticModelType from ..types import Tag, TensorType from .interface import AcquisitionFu...
6,417
36.752941
100
py
trieste-develop
trieste-develop/trieste/acquisition/optimizer.py
r""" This module contains functionality for optimizing :data:`~trieste.acquisition.AcquisitionFunction`\ s over :class:`~trieste.space.SearchSpace`\ s. """ from __future__ import annotations from typing import Any, Callable, List, Optional, Sequence, Tuple, Union, cast import greenlet as gr import numpy as np impor...
30,061
42.254676
100
py
trieste-develop
trieste-develop/trieste/acquisition/function/greedy_batch.py
""" This module contains local penalization-based acquisition function builders. """ from __future__ import annotations from typing import Callable, Dict, Mapping, Optional, Union, cast import gpflow import tensorflow as tf import tensorflow_probability as tfp from typing_extensions import Protocol, runtime_checkable...
34,562
42.257822
100
py
trieste-develop
trieste-develop/trieste/acquisition/function/utils.py
""" This module contains utility functions for acquisition functions. """ from typing import Callable, Tuple import tensorflow as tf from tensorflow_probability import distributions as tfd from ...types import TensorType # Multivariate Normal CDF class MultivariateNormalCDF: def __init__( self, ...
7,456
36.285
87
py
trieste-develop
trieste-develop/trieste/acquisition/function/multi_objective.py
""" This module contains multi-objective acquisition function builders. """ from __future__ import annotations import math from itertools import combinations, product from typing import Callable, Mapping, Optional, Sequence, cast import tensorflow as tf import tensorflow_probability as tfp from ...data import Datase...
33,929
43.821664
100
py
trieste-develop
trieste-develop/trieste/acquisition/function/continuous_thompson_sampling.py
""" This module contains acquisition function builders for continuous Thompson sampling. """ from __future__ import annotations from typing import Any, Callable, Optional, Type import tensorflow as tf from ...data import Dataset from ...models.interfaces import HasTrajectorySampler, TrajectoryFunction, TrajectoryFun...
10,279
40.788618
100
py
trieste-develop
trieste-develop/trieste/acquisition/function/function.py
""" This module contains acquisition function builders, which build and define our acquisition functions --- functions that estimate the utility of evaluating sets of candidate points. """ from __future__ import annotations from typing import Callable, Mapping, Optional, cast import tensorflow as tf import tensorflow...
77,739
38.262626
100
py
trieste-develop
trieste-develop/trieste/acquisition/function/active_learning.py
""" This module contains acquisition function builders and acquisition functions for Bayesian active learning. """ from __future__ import annotations import math from typing import Optional, Sequence, Union import tensorflow as tf import tensorflow_probability as tfp from ...data import Dataset from ...models impo...
20,764
39.320388
100
py
trieste-develop
trieste-develop/trieste/acquisition/function/entropy.py
""" This module contains entropy-based acquisition function builders. """ from __future__ import annotations from typing import List, Optional, TypeVar, cast, overload import tensorflow as tf import tensorflow_probability as tfp from typing_extensions import Protocol, runtime_checkable from ...data import Dataset, a...
36,326
41.787986
100
py
trieste-develop
trieste-develop/trieste/acquisition/multi_objective/pareto.py
""" This module contains functions and classes for Pareto based multi-objective optimization. """ from __future__ import annotations try: import cvxpy as cp except ImportError: # pragma: no cover (tested but not by coverage) cp = None import numpy as np import tensorflow as tf from ...types import TensorType...
11,521
39.006944
99
py
trieste-develop
trieste-develop/trieste/acquisition/multi_objective/dominance.py
"""This module contains functionality for computing the non-dominated set given a set of data points.""" from __future__ import annotations import tensorflow as tf from ...types import TensorType def non_dominated(observations: TensorType) -> tuple[TensorType, TensorType]: """ Computes the non-dominated set...
2,789
38.295775
97
py
trieste-develop
trieste-develop/trieste/acquisition/multi_objective/partition.py
"""This module contains functions of different methods for partitioning the dominated/non-dominated region in multi-objective optimization problems.""" from __future__ import annotations from dataclasses import dataclass from typing import Any, Optional import tensorflow as tf from ...types import TensorType from .....
16,741
41.492386
100
py
trieste-develop
trieste-develop/trieste/experimental/plotting/plotting_plotly.py
from __future__ import annotations from typing import Callable, Optional import numpy as np import plotly.graph_objects as go import tensorflow as tf from plotly.subplots import make_subplots from trieste.models.interfaces import ProbabilisticModel from trieste.types import TensorType from trieste.utils import to_n...
8,489
31.653846
99
py
trieste-develop
trieste-develop/trieste/experimental/plotting/inequality_constraints.py
from __future__ import annotations from abc import abstractmethod from typing import Optional, Type, cast import matplotlib.pyplot as plt import numpy as np from matplotlib.figure import Figure from typing_extensions import Protocol from ...space import SearchSpace from ...types import TensorType from .plotting imp...
6,314
32.590426
88
py
trieste-develop
trieste-develop/trieste/experimental/plotting/plotting.py
from __future__ import annotations from typing import Callable, Optional, Sequence import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from gpflow.models import GPModel from matplotlib import cm from matplotlib.axes import Axes from matplotlib.collections import Collection from matplotlib.cont...
17,758
32.070764
99
py
trieste-develop
trieste-develop/docs/notebooks/quickrun/quickrun.py
""" A script to apply modifications to the notebook scripts based on YAML config, used to make them run more quickly in continuous integration. """ from jsonschema import validate from pathlib import Path import re import sys import yaml import logging import argparse logging.basicConfig(format="%(asctime)s %(levelna...
4,104
30.821705
100
py
ba-complement
ba-complement-master/experimental/experimental-compare.py
""" Script for automated experimental evaluation. @title experimental.py @author Vojtech Havlena, June 2019 """ import sys import getopt import subprocess import string import re import os import os.path import resource import xml.etree.ElementTree as ET VALIDLINE = -2 TIMELINE = -1 STATESLINE = -3 DELAYSIM = -4 ...
2,684
23.189189
101
py
ba-complement
ba-complement-master/experimental/experimental.py
""" Script for automated experimental evaluation. @title experimental.py @author Vojtech Havlena, April 2019 """ import sys import getopt import subprocess import string import re import os import os.path import resource VALIDLINE = -2 TIMELINE = -1 STATESLINE = -2 DELAYSIM = -4 TIMEOUT = 300 #in seconds QUOTIENT...
3,042
25.008547
108
py
tensiometer
tensiometer-master/.material.py
""" This is random material, do not read it :) """ def _vec_to_log_pdm(vec, d): """ """ # get indexes: ind = np.tril_indices(d, 0) # initialize: mat = np.zeros((d, d)) mat[ind] = vec # take exponential of the diagonal to ensure positivity: mat[np.diag_indices(d)] = np.exp(np.diagon...
3,098
28.514286
127
py
tensiometer
tensiometer-master/setup.py
import re import os import sys import setuptools # warn against python 2 if sys.version_info[0] == 2: print('tensiometer does not support Python 2, \ please upgrade to Python 3') sys.exit(1) # version control: def find_version(): version_file = open(os.path.join(os.path.dirname(__file__), ...
2,749
33.375
103
py
tensiometer
tensiometer-master/tensiometer/gaussian_tension.py
""" This file contains the functions and utilities to compute agreement and disagreement between two different chains using a Gaussian approximation for the posterior. For more details on the method implemented see `arxiv 1806.04649 <https://arxiv.org/pdf/1806.04649.pdf>`_ and `arxiv 1912.04880 <https://arxiv.org/pdf/...
51,236
43.246114
111
py
tensiometer
tensiometer-master/tensiometer/cosmosis_interface.py
""" File with tools to interface Cosmosis chains with GetDist. """ """ For testing purposes: chain = loadMCSamples('./../test_chains/1p2_SN1_zcut0p3_abs') chain_root = './test_chains/DES_multinest_cosmosis' chain_root = './chains_lcdm/chain_1x2pt_lcdm' chain_min_root = './chains_lcdm/chain_1x2pt_lcdm_MAP.maxlike' pa...
15,767
37.179177
97
py
tensiometer
tensiometer-master/tensiometer/chains_convergence.py
""" This file contains some functions to study convergence of the chains and to compare the two posteriors. """ """ For test purposes: from getdist import loadMCSamples, MCSamples, WeightedSamples chain = loadMCSamples('./test_chains/DES') chains = chain param_names = None import tensiometer.utilities as utils import...
14,904
36.638889
104
py
tensiometer
tensiometer-master/tensiometer/utilities.py
""" This file contains some utilities that are used in the tensiometer package. """ # initial imports: import numpy as np import scipy import scipy.special from scipy.linalg import sqrtm from getdist import MCSamples def from_confidence_to_sigma(P): """ Transforms a probability to effective number of sigma...
15,550
34.997685
88
py
tensiometer
tensiometer-master/tensiometer/experimental.py
""" Experimental features. For test purposes: import os, sys import time import gc from numba import jit import numpy as np import getdist.chains as gchains gchains.print_load_details = False from getdist import MCSamples, WeightedSamples import scipy from scipy.linalg import sqrtm from scipy.integrate import simps f...
4,211
26.350649
121
py
tensiometer
tensiometer-master/tensiometer/mcmc_tension/kde.py
""" """ """ For test purposes: from getdist import loadMCSamples, MCSamples, WeightedSamples chain_1 = loadMCSamples('./test_chains/DES') chain_2 = loadMCSamples('./test_chains/Planck18TTTEEE') chain_12 = loadMCSamples('./test_chains/Planck18TTTEEE_DES') chain_prior = loadMCSamples('./test_chains/prior') import ten...
43,456
41.688605
151
py
Atari-5
Atari-5-main/atari_util.py
import matplotlib.pyplot as plt cmap10 = plt.get_cmap('tab10') cmap20 = plt.get_cmap('tab20') def color_fade(x, factor=0.5): if len(x) == 3: r,g,b = x a = 1.0 else: r,g,b,a = x r = (1*factor+(1-factor)*r) g = (1*factor+(1-factor)*g) b = (1*factor+(1-factor)*b) return (r...
5,851
23.082305
112
py
Atari-5
Atari-5-main/atari5.py
import numpy as np import pandas import pandas as pd import itertools import sklearn import sklearn.linear_model import statsmodels import statsmodels.api as sm import json import csv import matplotlib.pyplot as plt import multiprocessing import functools import time from sklearn.model_selection import cross_val_score ...
25,279
33.301221
157
py
white_box_rarl
white_box_rarl-main/wbrarl_plotting.py
from pathlib import Path import numpy as np import pickle import matplotlib.pyplot as plt from matplotlib import rc from scipy import stats rc('font', **{'family': 'serif', 'serif': ['Palatino']}) plt.rcParams['pdf.fonttype'] = 42 results_path = Path('./results/') N_TRAIN_STEPS = 2000000 FS = 15 N_EXCLUDE = 20 TOTAL...
12,269
34.877193
121
py
white_box_rarl
white_box_rarl-main/wbrarl.py
import sys import os import time import random import argparse import multiprocessing import pickle import copy from multiprocessing import freeze_support import numpy as np import torch import gym from stable_baselines3.ppo import PPO from stable_baselines3.sac import SAC from stable_baselines3.common.vec_env import S...
24,786
43.341682
148
py
neurotron_experiments
neurotron_experiments-main/run_sim05.py
# %% Import packages import numpy as np from pathlib import Path from neurotron import NeuroTron from sim_setup import output_path, sim05_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Set the seed np.random.seed(sim05_setup['seed']) # %% Instantiate Neur...
956
22.341463
106
py
neurotron_experiments
neurotron_experiments-main/plot_sim01.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim01_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,838
24.123894
120
py
neurotron_experiments
neurotron_experiments-main/run_sim07.py
# %% Import packages import numpy as np from pathlib import Path from neurotron import NeuroTron from sim_setup import output_path, sim07_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Set the seed np.random.seed(sim07_setup['seed']) # %% Instantiate Neur...
956
22.341463
106
py
neurotron_experiments
neurotron_experiments-main/plot_sim05.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim05_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,830
24.053097
119
py
neurotron_experiments
neurotron_experiments-main/plot_sim06.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim06_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,830
24.053097
119
py
neurotron_experiments
neurotron_experiments-main/plot_tron_theta_no_attack.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim01_setup, sim02_setup, sim03_setup, sim04_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_e...
3,020
22.787402
108
py
neurotron_experiments
neurotron_experiments-main/plot_sim04.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim04_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,841
24.150442
120
py
neurotron_experiments
neurotron_experiments-main/run_sim02.py
# %% Import packages import numpy as np from pathlib import Path from neurotron import NeuroTron from sim_setup import output_path, sim02_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Set the seed np.random.seed(sim02_setup['seed']) # %% Instantiate Neur...
956
22.341463
106
py
neurotron_experiments
neurotron_experiments-main/plot_tron_merged_theta.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim01_setup, sim02_setup, sim03_setup, sim04_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_e...
4,623
28.832258
108
py
neurotron_experiments
neurotron_experiments-main/neurotron_torch.py
# %% [markdown] # # Settings # %% import torch import matplotlib.pyplot as plt import numpy as np import torch.nn as nn from sklearn.datasets import fetch_california_housing from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from torch.utils.data import DataLoader...
8,128
25.478827
122
py
neurotron_experiments
neurotron_experiments-main/plot_tron_q_assist_sim.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_neuron1_error_loaded = [] for k in range(3): tro...
2,981
20.608696
126
py
neurotron_experiments
neurotron_experiments-main/plot_merged_sim05.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim05_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,834
23.025424
104
py
neurotron_experiments
neurotron_experiments-main/sim_setup.py
# %% Import packages import numpy as np from pathlib import Path # %% Set output path output_path = Path().joinpath('output') # %% Setup for simulation 1: data ~ normal(mu=0, sigma=1), varying theta_{*} sim01_setup = { 'sample_data' : lambda s : np.random.normal(loc=0.0, scale=1.0, size=s), 'filterlist' :...
5,716
38.157534
84
py
neurotron_experiments
neurotron_experiments-main/plot_merged_sim01.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim01_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,851
23.169492
112
py
neurotron_experiments
neurotron_experiments-main/plot_sim08.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim08_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,833
24.079646
119
py
neurotron_experiments
neurotron_experiments-main/plot_merged_sim03.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim03_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,851
23.169492
112
py
neurotron_experiments
neurotron_experiments-main/plot_sim07.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim07_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,830
24.053097
119
py
neurotron_experiments
neurotron_experiments-main/plot_merged_sim08.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim08_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,834
23.025424
104
py
neurotron_experiments
neurotron_experiments-main/run_sim03.py
# %% Import packages import numpy as np from pathlib import Path from neurotron import NeuroTron from sim_setup import output_path, sim03_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Set the seed np.random.seed(sim03_setup['seed']) # %% Instantiate Neur...
956
22.341463
106
py
neurotron_experiments
neurotron_experiments-main/plot_merged_sim06.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim06_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,834
23.025424
104
py
neurotron_experiments
neurotron_experiments-main/run_sim08.py
# %% Import packages import numpy as np from pathlib import Path from neurotron import NeuroTron from sim_setup import output_path, sim08_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Set the seed np.random.seed(sim08_setup['seed']) # %% Instantiate Neur...
956
22.341463
106
py
neurotron_experiments
neurotron_experiments-main/run_sim01.py
# %% Import packages import numpy as np from pathlib import Path from neurotron import NeuroTron from sim_setup import output_path, sim01_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Set the seed np.random.seed(sim01_setup['seed']) # %% Instantiate Neur...
956
22.341463
106
py
neurotron_experiments
neurotron_experiments-main/plot_merged_sim07.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim07_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,834
23.025424
104
py
neurotron_experiments
neurotron_experiments-main/plot_merged_sim04.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim04_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,851
23.169492
112
py
neurotron_experiments
neurotron_experiments-main/run_sim04.py
# %% Import packages import numpy as np from pathlib import Path from neurotron import NeuroTron from sim_setup import output_path, sim04_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Set the seed np.random.seed(sim04_setup['seed']) # %% Instantiate Neur...
956
22.341463
106
py
neurotron_experiments
neurotron_experiments-main/plot_tron_merged_beta.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim05_setup, sim06_setup, sim07_setup, sim08_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_e...
4,409
27.451613
108
py
neurotron_experiments
neurotron_experiments-main/run_sim06.py
# %% Import packages import numpy as np from pathlib import Path from neurotron import NeuroTron from sim_setup import output_path, sim06_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Set the seed np.random.seed(sim06_setup['seed']) # %% Instantiate Neur...
956
22.341463
106
py
neurotron_experiments
neurotron_experiments-main/neurotron.py
import numpy as np class NeuroTron: def __init__(self, sample_data=None, w_star=None, d=None, eta_tron=None, eta_sgd=None, b=None, width=None, filter=None): self.sample_data = sample_data self.reset(w_star, d, eta_tron, b, width, filter) def reset(self, w_star, d, eta_tron, b, width, filter, ...
5,583
33.68323
124
py
neurotron_experiments
neurotron_experiments-main/plot_merged_sim02.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim02_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,851
23.169492
112
py
neurotron_experiments
neurotron_experiments-main/plot_sim03.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim03_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,838
24.123894
120
py
neurotron_experiments
neurotron_experiments-main/plot_sim02.py
# %% Import packages import numpy as np from matplotlib import pyplot as plt from pathlib import Path from sim_setup import output_path, sim02_setup # %% Create output path if it does not exist output_path.mkdir(parents=True, exist_ok=True) # %% Load numerical output tron_error_loaded = np.loadtxt(output_path.jo...
2,838
24.123894
120
py
presto
presto-master/setup.py
from __future__ import print_function import os import sys import numpy # setuptools has to be imported before numpy.distutils.core import setuptools from numpy.distutils.core import Extension, setup version = "4.0" define_macros = [] undef_macros = [] extra_compile_args = ["-DUSEFFTW"] include_dirs = [numpy.get_inc...
3,895
40.010526
96
py
presto
presto-master/python/binresponses/monte_short.py
from __future__ import print_function from builtins import range from time import clock from math import * from Numeric import * from presto import * from miscutils import * from Statistics import * import Pgplot # Some admin variables showplots = 0 # True or false showsumplots = 0 # True or false debugou...
3,677
36.530612
79
py
presto
presto-master/python/binresponses/monte_ffdot.py
from __future__ import print_function from builtins import range from time import clock from math import * from Numeric import * from presto import * from miscutils import * from Statistics import * # Some admin variables parallel = 0 # True or false showplots = 0 # True or false debugout = 0 ...
7,526
40.585635
85
py
presto
presto-master/python/binresponses/monte_sideb.py
from __future__ import print_function from builtins import range from time import clock from math import * from Numeric import * from presto import * from miscutils import * from Statistics import * from random import expovariate import RNG global theo_sum_pow, b_pows, bsum_pows, newpows, noise, fftlen # Some admin v...
9,594
37.075397
97
py
presto
presto-master/python/binresponses/montebinresp.py
from __future__ import print_function from builtins import range from time import clock from math import * from Numeric import * from presto import * from miscutils import * from Statistics import * # Some admin variables parallel = 0 # True or false showplots = 1 # True or false debugout = 1 ...
12,905
46.623616
85
py
presto
presto-master/python/presto/sifting.py
from __future__ import print_function from __future__ import absolute_import from builtins import zip, str, range, object from operator import attrgetter import sys, re, os, copy import numpy as np import matplotlib import matplotlib.pyplot as plt import os.path import glob from presto import infodata from presto.prest...
54,077
39.146993
99
py
presto
presto-master/python/presto/infodata.py
from builtins import object ## Automatically adapted for numpy Apr 14, 2006 by convertcode.py class infodata(object): def __init__(self, filenm): self.breaks = 0 for line in open(filenm, encoding="latin-1"): if line.startswith(" Data file name"): self.basenm = line.split...
6,965
47.041379
98
py
presto
presto-master/python/presto/binary_psr.py
from __future__ import print_function from __future__ import absolute_import from builtins import object import numpy as Num from presto import parfile, psr_utils from presto.psr_constants import * def myasarray(a): if type(a) in [type(1.0),type(1),type(1),type(1j)]: a = Num.asarray([a]) if len(a) == 0...
10,195
38.366795
84
py
presto
presto-master/python/presto/parfile.py
from __future__ import print_function from __future__ import absolute_import from builtins import object import six import math, re from presto import psr_utils as pu from presto import psr_constants as pc try: from slalib import sla_ecleq, sla_eqecl, sla_eqgal slalib = True except ImportError: slalib = Fal...
10,504
41.703252
96
py
presto
presto-master/python/presto/events.py
from __future__ import print_function import bisect from presto.psr_constants import PI, TWOPI, PIBYTWO from presto.simple_roots import newton_raphson from scipy.special import iv, chdtri, ndtr, ndtri from presto.cosine_rand import * import numpy as np def sine_events(pulsed_frac, Nevents, phase=0.0): """ sin...
18,498
40.947846
89
py
presto
presto-master/python/presto/mpfit.py
""" Perform Levenberg-Marquardt least-squares minimization, based on MINPACK-1. AUTHORS The original version of this software, called LMFIT, was written in FORTRAN as part of the MINPACK-1 package by XXX. Craig Markwardt converted the FORTRAN code to IDL. The information for ...
88,531
38.190792
97
py
presto
presto-master/python/presto/sigproc.py
from __future__ import print_function from __future__ import absolute_import from builtins import zip import os import struct import sys import math import warnings from presto.psr_constants import ARCSECTORAD telescope_ids = {"Fake": 0, "Arecibo": 1, "ARECIBO 305m": 1, "Ooty": 2, "Nancay": 3, "Parke...
7,132
31.130631
92
py
presto
presto-master/python/presto/waterfaller.py
../../bin/waterfaller.py
24
24
24
py
presto
presto-master/python/presto/spectra.py
from builtins import str from builtins import range from builtins import object import copy import numpy as np import scipy.signal from presto import psr_utils class Spectra(object): """A class to store spectra. This is mainly to provide reusable functionality. """ def __init__(self, freqs, dt, da...
12,864
36.616959
88
py
presto
presto-master/python/presto/psr_utils.py
from __future__ import print_function from __future__ import absolute_import from builtins import str from builtins import range import bisect import numpy as Num import numpy.fft as FFT from scipy.special import ndtr, ndtri, chdtrc, chdtri, fdtrc, i0, kolmogorov from scipy.optimize import leastsq import scipy.optimize...
75,060
36.399601
112
py
presto
presto-master/python/presto/psr_constants.py
## Automatically adapted for numpy Apr 14, 2006 by convertcode.py ARCSECTORAD = float('4.8481368110953599358991410235794797595635330237270e-6') RADTOARCSEC = float('206264.80624709635515647335733077861319665970087963') SECTORAD = float('7.2722052166430399038487115353692196393452995355905e-5') RADTOSEC = float('1...
1,369
51.692308
77
py