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
trieste-develop
trieste-develop/docs/notebooks/scalable_thompson_sampling_using_sparse_gaussian_processes.pct.py
# -*- coding: utf-8 -*- # %% [markdown] # # Scalable Thompson Sampling using Sparse Gaussian Process Models # %% [markdown] # In our other [Thompson sampling notebook](thompson_sampling.pct.py) we demonstrate how to perform batch optimization using a traditional implementation of Thompson sampling that samples exactly...
6,553
46.839416
703
py
trieste-develop
trieste-develop/docs/notebooks/recovering_from_errors.pct.py
# %% [markdown] # # Recovering from errors during optimization # %% import numpy as np import tensorflow as tf import random np.random.seed(1793) tf.random.set_seed(1793) random.seed(3) # %% [markdown] # Sometimes the Bayesian optimization process encounters an error from which we can recover, without the need to re...
7,238
43.140244
628
py
trieste-develop
trieste-develop/docs/notebooks/deep_gaussian_processes.pct.py
# %% [markdown] # # Using deep Gaussian processes with GPflux for Bayesian optimization. # %% import numpy as np import tensorflow as tf np.random.seed(1794) tf.random.set_seed(1794) # %% [markdown] # ## Describe the problem # # In this notebook, we show how to use deep Gaussian processes (DGPs) for Bayesian optimiz...
11,347
30.348066
699
py
trieste-develop
trieste-develop/docs/notebooks/asynchronous_nongreedy_batch_ray.pct.py
# %% [markdown] # # Asynchronous batch Bayesian optimization # # As shown in [Asynchronous Bayesian Optimization](asynchronous_greedy_multiprocessing.ipynb) tutorial, Trieste provides support for running observations asynchronously. In that tutorial we used a greedy batch acquisition function called Local Penalization,...
8,288
38.28436
804
py
trieste-develop
trieste-develop/docs/notebooks/code_overview.pct.py
# %% [markdown] # # An overview of Trieste types # %% [markdown] # Trieste is dedicated to Bayesian optimization, the process of finding the *optimal values of an expensive, black-box objective function by employing probabilistic models over observations*. This notebook explains how the different parts of this process...
13,431
54.04918
985
py
trieste-develop
trieste-develop/docs/notebooks/expected_improvement.pct.py
# %% [markdown] # # Noise-free optimization with Expected Improvement # %% import numpy as np import tensorflow as tf np.random.seed(1793) tf.random.set_seed(1793) # %% [markdown] # ## Describe the problem # # In this example, we look to find the minimum value of the two-dimensional Branin function over the hypercub...
13,740
41.541796
836
py
trieste-develop
trieste-develop/docs/notebooks/lunar_lander_videos/generate_video.py
"""This script is used to generate videos for the OpenAI Gym notebook. First two functions, as well as constants, shall be in sync with the notebook. At the bottom of this file there are parameters and random seeds used to generate each video. The video and several json files will be created in this folder, with some ...
3,532
34.686869
265
py
trieste-develop
trieste-develop/docs/notebooks/quickrun/quickrun.py
# Copyright 2021 The Trieste Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
4,104
30.821705
100
py
ba-complement
ba-complement-master/experimental/experimental-compare.py
#!/usr/bin/env python3 """ 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 STATESL...
2,684
23.189189
101
py
ba-complement
ba-complement-master/experimental/experimental.py
#!/usr/bin/env python3 """ 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 = 3...
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
#!/usr/bin/env python 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....
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/tensor_eigenvalues.py
""" This file contains a set of utilities to compute tensor eigenvalues since there is no standard library to do so. """ ############################################################################### # initial imports: from itertools import permutations import numpy as np import scipy.linalg import scipy.integrate i...
25,511
32.436435
79
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 ####################...
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/__init__.py
__author__ = 'Marco Raveri' __version__ = "0.1.2" __url__ = "https://tensiometer.readthedocs.io" from . import gaussian_tension, mcmc_tension, cosmosis_interface
163
26.333333
64
py
tensiometer
tensiometer-master/tensiometer/tests/test_utilities.py
############################################################################### # initial imports: import unittest import tensiometer.utilities as ttu import numpy as np ############################################################################### class test_confidence_to_sigma(unittest.TestCase): def setU...
5,405
31.371257
92
py
tensiometer
tensiometer-master/tensiometer/tests/test_tensor_eigenvalues.py
############################################################################### # initial imports: import unittest import tensiometer.tensor_eigenvalues as te import os import numpy as np ############################################################################### class test_utilities(unittest.TestCase): ...
1,612
32.604167
79
py
tensiometer
tensiometer-master/tensiometer/tests/test_chains_convergence.py
############################################################################### # initial imports: import unittest import tensiometer.chains_convergence as conv import tensiometer.utilities as ttu from getdist import loadMCSamples import os import numpy as np ########################################################...
2,635
38.343284
106
py
tensiometer
tensiometer-master/tensiometer/tests/test_mcmc_tension_flow.py
############################################################################### # initial imports: import unittest import tensiometer.mcmc_tension.param_diff as pd import tensiometer.mcmc_tension.flow as mt import tensiometer.utilities as tut from getdist import loadMCSamples import os import numpy as np ##########...
2,043
36.163636
88
py
tensiometer
tensiometer-master/tensiometer/tests/test_gaussian_tension.py
############################################################################### # initial imports: import unittest import tensiometer.gaussian_tension as gt import os import numpy as np from getdist.gaussian_mixtures import GaussianND from getdist import loadMCSamples ###############################################...
3,369
34.473684
79
py
tensiometer
tensiometer-master/tensiometer/tests/test_cosmosis_interface.py
############################################################################### # initial imports: import unittest import tensiometer.cosmosis_interface as ci import os ############################################################################### class test_cosmosis_interface(unittest.TestCase): def setUp(...
815
24.5
79
py
tensiometer
tensiometer-master/tensiometer/tests/test_mcmc_tension_kde.py
############################################################################### # initial imports: import unittest import tensiometer.mcmc_tension.param_diff as pd import tensiometer.mcmc_tension.kde as mt import tensiometer.utilities as tut from getdist import loadMCSamples import os import numpy as np ###########...
5,748
41.585185
91
py
tensiometer
tensiometer-master/tensiometer/mcmc_tension/flow.py
""" """ ############################################################################### # initial imports and set-up: import os 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 scip...
26,170
49.040153
648
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
tensiometer
tensiometer-master/tensiometer/mcmc_tension/param_diff.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...
12,497
42.852632
79
py
tensiometer
tensiometer-master/tensiometer/mcmc_tension/__init__.py
""" This module contains the functions and utilities to compute non-Gaussian Monte Carlo tension estimators. The submodule `param_diff` contains the functions and utilities to compute the distribution of parameter differences from the parameter posterior of two experiments. The submodule `kde` contains the functions ...
1,111
37.344828
98
py
tensiometer
tensiometer-master/docs/example_notebooks/pymaxent.py
#!/usr/bin/env python """PyMaxEnt.py: Implements a maximum entropy reconstruction of distributions with known moments.""" __author__ = "Tony Saad and Giovanna Ruai" __copyright__ = "Copyright (c) 2019, Tony Saad" __credits__ = ["University of Utah Department of Chemical Engineering", "University of Utah UROP ...
9,329
40.838565
237
py
tensiometer
tensiometer-master/docs/source/conf.py
# -*- coding: utf-8 -*- # # MyProj documentation build configuration file, created by # sphinx-quickstart on Thu Jun 18 20:57:49 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # Al...
9,842
32.593857
190
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/run_tron_q_assist_sim.py
#%% -*- coding: utf-8 -*- """NC submission Neurotron q assist Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1Grqd8YloStHVD0eoAnUtOJ3jSxX1A8rA #Introduction """ # %% Import packages import numpy as np import random from random import sample import ...
10,704
39.703422
146
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/presto_src/prestoswig.py
# This file was automatically generated by SWIG (http://www.swig.org). # Version 4.1.0 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info < (2, 7, 0): raise Runtime...
22,317
45.11157
215
py
presto
presto-master/python/presto_src/__init__.py
from __future__ import print_function from __future__ import absolute_import from builtins import input from builtins import range from .prestoswig import * import os.path import numpy as np from presto import Pgplot from presto import psr_utils def val_with_err(value, error, length=0, digits=2, latex=0): """ ...
27,908
36.562584
86
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/binopttest/comb.py
from __future__ import print_function from builtins import range from Numeric import * from presto import * from LeastSquares import leastSquaresFit from orbitstuff import * # Observation parameters dt = 0.000125 # The duration of each data sample N = 2**28 # The number of points in the observation T =...
1,549
31.978723
71
py
presto
presto-master/python/binopttest/bindata.py
from __future__ import print_function from future import standard_library standard_library.install_aliases() from builtins import range def catvar(col): ret = [] global a, b, c, d, e for i in range(shape(a)[0]): ret.append(a[i][col]) for i in range(shape(b)[0]): ret.append(b[i][col]) ...
5,131
34.638889
81
py
presto
presto-master/python/binopttest/montebinopt.py
from __future__ import print_function from future import standard_library standard_library.install_aliases() from builtins import str from builtins import input from builtins import range import math, string, Numeric, presto, random, sys, pickle from LeastSquares import leastSquaresFit from orbitstuff import * # Some ...
8,294
34.448718
81
py
presto
presto-master/python/presto/sifting.py
#!/usr/bin/env python 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 info...
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/pypsrcat.py
from __future__ import print_function from __future__ import absolute_import from builtins import object from operator import attrgetter import struct import os.path import math import csv import astropy.coordinates as c import astropy.units as u from presto import presto import presto.psr_utils as pu import presto.psr...
16,621
44.539726
676
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
#!/usr/bin/env python 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": ...
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
presto
presto-master/python/presto/prepfold.py
from __future__ import print_function from __future__ import absolute_import from builtins import range from builtins import object import sys import numpy as Num import copy, random, struct from presto import psr_utils, infodata, polycos, Pgplot import six import numbers from presto.bestprof import bestprof from prest...
41,422
46.071591
103
py
presto
presto-master/python/presto/injectpsr.py
#!/usr/bin/env python """Inject a fake pulsar into real data, creating a filterbank file. Patrick Lazarus, June 26, 2012 """ from __future__ import print_function from builtins import zip from builtins import object import sys import argparse import warnings import copy import numpy as np import scipy.integrate impo...
48,769
37.371361
94
py
presto
presto-master/python/presto/fftfit.py
from _fftfit import *
21
21
21
py
presto
presto-master/python/presto/Pgplot.py
""" Routine for easy to use 1-D and 2-D plotting using 'PGPLOT' and the Python 'PPGPLOT' package Written by Scott M. Ransom (ransom@cfa.harvard.edu) last revision: 01 Jul 2000 'PGPLOT' was writtten by Tim Pearson <tjp@astro.caltech.edu>, and can be found at http://astro.caltech.edu/~tjp/pgplot/ ...
29,817
41.965418
81
py
presto
presto-master/python/presto/polycos.py
from __future__ import absolute_import from builtins import range from builtins import object import os import sys import subprocess from presto import parfile import numpy as Num # Constants NUMCOEFFS_DEFAULT = 12 SPAN_DEFAULT = 60 # span of each polyco in minutes # Telescope name to TEMPO observatory code conversi...
10,605
36.878571
92
py
presto
presto-master/python/presto/kuiper.py
from __future__ import print_function from __future__ import absolute_import from builtins import range import numpy as num from presto import Pgplot from functools import reduce def noverk(n,k): # This is the combinations formula return float(reduce(lambda a,b: a*(n-b)/(b+1), range(k),1)) def Tt(t, z, N): ...
4,426
32.793893
87
py
presto
presto-master/python/presto/residuals.py
from __future__ import print_function from builtins import range from builtins import object import struct import numpy as Num # # From the TEMPO Documentation: # # The file resid2.tmp contains residuals, etc. in inary format. # Each record contains eight real*8 values: # --TOA (MJD, referenced to solar sy...
3,668
38.451613
97
py
presto
presto-master/python/presto/__init__.py
0
0
0
py
presto
presto-master/python/presto/simple_roots.py
from __future__ import print_function from builtins import range # 'Safe' Newton-Raphson and Secant method # for numerical root-finding # # Written by Scott M. Ransom <sransom@nrao.edu> def bisect(func, lox, hix, TOL=1e-14, MAXIT=200): """ bisect(func, lox, hix, TOL=1e-14, MAXIT=200): Try to find a r...
3,967
29.75969
78
py
presto
presto-master/python/presto/bestprof.py
from builtins import object ## Automatically adapted for numpy Apr 14, 2006 by convertcode.py import numpy as num def get_epochs(line): i, f = line.split("=")[-1].split(".") f = "0."+f epochi = float(i) epochf = float(f) # Check to see if it is very close to 1 sec # If it is, assume the epoch ...
5,982
42.671533
93
py