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
flair
flair-master/flair/trainers/plugins/functional/__init__.py
0
0
0
py
flair
flair-master/flair/trainers/plugins/functional/anneal_on_plateau.py
import logging import os from flair.trainers.plugins.base import TrainerPlugin, TrainingInterrupt from flair.trainers.plugins.metric_records import MetricRecord from flair.training_utils import AnnealOnPlateau log = logging.getLogger("flair") class AnnealingPlugin(TrainerPlugin): """Plugin for annealing logic i...
3,975
31.859504
132
py
flair
flair-master/tests/test_lemmatizer.py
import torch import flair from flair.data import Sentence from flair.models import Lemmatizer def test_words_to_char_indices(): sentence = Sentence("Hello look what a beautiful day!") lemmatizer = Lemmatizer() # lemmatizer uses standard char dictionary d = lemmatizer.dummy_index e = lemmatizer.end...
1,907
33.690909
116
py
flair
flair-master/tests/test_labels.py
from typing import List from flair.data import Label, Relation, Sentence, Span def test_token_tags(): # example sentence sentence = Sentence("I love Berlin") # set 4 labels for 2 tokens ('love' is tagged twice) sentence[1].add_label("pos", "verb") sentence[1].add_label("sentiment", "positive") ...
10,789
37.673835
80
py
flair
flair-master/tests/test_datasets.py
import copy import shutil import pytest import flair import flair.datasets from flair.data import MultiCorpus, Sentence from flair.datasets import ColumnCorpus from flair.datasets.sequence_labeling import ( ONTONOTES, JsonlCorpus, JsonlDataset, MultiFileJsonlCorpus, ) def test_load_imdb_data(tasks_b...
32,776
34.168455
120
py
flair
flair-master/tests/test_tokenize_sentence.py
from typing import List import pytest import flair from flair.data import Sentence, Token from flair.splitter import ( NewlineSentenceSplitter, NoSentenceSplitter, SciSpacySentenceSplitter, SegtokSentenceSplitter, SpacySentenceSplitter, TagSentenceSplitter, ) from flair.tokenization import ( ...
16,472
34.967249
115
py
flair
flair-master/tests/embedding_test_utils.py
from typing import Any, Dict, List, Optional, Type import pytest import torch from flair.data import Sentence from flair.embeddings import Embeddings from flair.embeddings.base import load_embeddings class BaseEmbeddingsTest: embedding_cls: Type[Embeddings[Sentence]] is_token_embedding: bool is_document...
7,511
39.387097
113
py
flair
flair-master/tests/test_trainer.py
import pytest from torch.optim import Adam import flair from flair.data import Sentence from flair.datasets import ClassificationCorpus from flair.embeddings import DocumentPoolEmbeddings, FlairEmbeddings, WordEmbeddings from flair.models import SequenceTagger, TextClassifier from flair.trainers import ModelTrainer t...
4,999
28.585799
118
py
flair
flair-master/tests/test_language_model.py
import pytest from flair.data import Dictionary, Sentence from flair.embeddings import FlairEmbeddings, TokenEmbeddings from flair.models import LanguageModel from flair.trainers.language_model_trainer import LanguageModelTrainer, TextCorpus @pytest.mark.integration() def test_train_language_model(results_base_path,...
4,360
36.594828
109
py
flair
flair-master/tests/test_tars.py
from flair.data import Sentence from flair.datasets import ClassificationCorpus from flair.models import TARSClassifier from flair.trainers import ModelTrainer def test_init_tars_and_switch(tasks_base_path): # test corpus corpus = ClassificationCorpus(tasks_base_path / "imdb") # create a TARS classifier ...
2,404
31.945205
115
py
flair
flair-master/tests/conftest.py
from pathlib import Path import pytest import torch import flair @pytest.fixture(scope="module") def resources_path(): return Path(__file__).parent / "resources" @pytest.fixture(scope="module") def tasks_base_path(resources_path): return resources_path / "tasks" @pytest.fixture() def results_base_path(r...
1,620
23.19403
89
py
flair
flair-master/tests/test_corpus_dictionary.py
import os import pytest import flair from flair.data import Corpus, Dictionary, Label, Sentence from flair.datasets import ColumnCorpus, FlairDatapointDataset, SentenceDataset def test_dictionary_get_items_with_unk(): dictionary: Dictionary = Dictionary(add_unk=True) dictionary.add_item("class_1") dict...
10,036
30.662461
106
py
flair
flair-master/tests/model_test_utils.py
from typing import Any, Dict, List, Optional, Type import pytest import flair from flair.data import Dictionary, Sentence from flair.embeddings import TransformerEmbeddings from flair.models import FewshotClassifier from flair.nn import Model from flair.trainers import ModelTrainer class BaseModelTest: model_cl...
8,882
36.167364
118
py
flair
flair-master/tests/test_visual.py
from flair.data import Sentence, Span, Token from flair.embeddings import FlairEmbeddings from flair.visual import Highlighter from flair.visual.ner_html import HTML_PAGE, PARAGRAPH, TAGGED_ENTITY, render_ner_html from flair.visual.training_curves import Plotter def test_highlighter(resources_path): with (resourc...
2,506
31.141026
95
py
flair
flair-master/tests/test_datasets_biomedical.py
import inspect import logging import os import tempfile from operator import itemgetter from pathlib import Path from typing import Callable, List, Optional, Type import pytest from tqdm import tqdm import flair from flair.data import Sentence, Token, _iter_dataset from flair.datasets import ColumnCorpus, biomedical ...
13,573
34.815303
118
py
flair
flair-master/tests/test_sentence.py
from flair.data import Sentence def test_sentence_context(): # make a sentence and some right context sentence = Sentence("George Washington ging nach Washington.") sentence._next_sentence = Sentence("Das ist eine schöne Stadt.") assert sentence.right_context(1) == [sentence._next_sentence[0]] as...
2,992
38.381579
120
py
flair
flair-master/tests/__init__.py
0
0
0
py
flair
flair-master/tests/test_multitask.py
import pytest import flair from flair.data import Sentence from flair.datasets import SENTEVAL_CR, SENTEVAL_SST_GRANULAR from flair.embeddings import TransformerDocumentEmbeddings from flair.models import MultitaskModel, TextClassifier from flair.nn.multitask import make_multitask_model_and_corpus from flair.trainers ...
2,209
31.5
117
py
flair
flair-master/tests/test_utils.py
from flair.data import Dictionary from flair.training_utils import convert_labels_to_one_hot def test_convert_labels_to_one_hot(): label_dict = Dictionary(add_unk=False) label_dict.add_item("class-1") label_dict.add_item("class-2") label_dict.add_item("class-3") one_hot = convert_labels_to_one_ho...
440
26.5625
66
py
flair
flair-master/tests/models/test_relation_classifier.py
from operator import itemgetter from typing import Dict, List, Optional, Set, Tuple import pytest from torch.utils.data import Dataset from flair.data import Relation, Sentence from flair.datasets import ColumnCorpus, DataLoader from flair.embeddings import TransformerDocumentEmbeddings from flair.models import Relat...
9,948
40.627615
118
py
flair
flair-master/tests/models/test_sequence_tagger.py
import pytest import flair from flair.embeddings import FlairEmbeddings, WordEmbeddings from flair.models import SequenceTagger from flair.trainers import ModelTrainer from tests.model_test_utils import BaseModelTest class TestSequenceTagger(BaseModelTest): model_cls = SequenceTagger pretrained_model = "ner-...
4,859
38.193548
120
py
flair
flair-master/tests/models/test_relation_extractor.py
import pytest from flair.data import Sentence from flair.datasets import ColumnCorpus from flair.embeddings import TransformerWordEmbeddings from flair.models import RelationExtractor from tests.model_test_utils import BaseModelTest class TestRelationExtractor(BaseModelTest): model_cls = RelationExtractor tr...
2,183
33.666667
102
py
flair
flair-master/tests/models/test_tars_classifier.py
import pytest from flair.data import Sentence from flair.datasets import ClassificationCorpus from flair.embeddings import TransformerDocumentEmbeddings from flair.models import TARSClassifier from tests.model_test_utils import BaseModelTest class TestTarsClassifier(BaseModelTest): model_cls = TARSClassifier ...
4,232
38.194444
119
py
flair
flair-master/tests/models/test_text_regressor.py
import pytest import flair from flair.embeddings import DocumentRNNEmbeddings, WordEmbeddings from flair.models.text_regression_model import TextRegressor from tests.model_test_utils import BaseModelTest class TestTextRegressor(BaseModelTest): model_cls = TextRegressor train_label_type = "regression" tra...
1,016
31.806452
116
py
flair
flair-master/tests/models/test_entity_linker.py
import pytest from flair.data import Sentence from flair.datasets import NEL_ENGLISH_AIDA from flair.embeddings import TransformerWordEmbeddings from flair.models import EntityLinker from tests.model_test_utils import BaseModelTest class TestEntityLinker(BaseModelTest): model_cls = EntityLinker train_label_t...
1,132
28.815789
102
py
flair
flair-master/tests/models/__init__.py
0
0
0
py
flair
flair-master/tests/models/test_tars_ner.py
import pytest import flair from flair.data import Sentence from flair.embeddings import TransformerWordEmbeddings from flair.models import TARSTagger from tests.model_test_utils import BaseModelTest class TestTarsTagger(BaseModelTest): model_cls = TARSTagger train_label_type = "ner" model_args = {"task_n...
3,630
34.950495
120
py
flair
flair-master/tests/models/test_text_classifier.py
import pytest import flair.datasets from flair.data import Sentence from flair.embeddings import DocumentRNNEmbeddings, FlairEmbeddings, WordEmbeddings from flair.models import TextClassifier from flair.samplers import ImbalancedClassificationDatasetSampler from flair.trainers import ModelTrainer from tests.model_test...
4,076
39.77
118
py
flair
flair-master/tests/models/test_word_tagger.py
import pytest import flair from flair.embeddings import TransformerWordEmbeddings from flair.models import TokenClassifier from tests.model_test_utils import BaseModelTest class TestWordTagger(BaseModelTest): model_cls = TokenClassifier train_label_type = "pos" training_args = { "max_epochs": 2, ...
1,212
26.568182
67
py
flair
flair-master/tests/embeddings/test_word_embeddings.py
from typing import Any, Dict from flair.embeddings import MuseCrosslingualEmbeddings, NILCEmbeddings, WordEmbeddings from tests.embedding_test_utils import BaseEmbeddingsTest class TestWordEmbeddings(BaseEmbeddingsTest): embedding_cls = WordEmbeddings is_token_embedding = True is_document_embedding = Fal...
1,033
30.333333
87
py
flair
flair-master/tests/embeddings/test_byte_pair_embeddings.py
from flair.embeddings import BytePairEmbeddings from tests.embedding_test_utils import BaseEmbeddingsTest class TestBytePairEmbeddings(BaseEmbeddingsTest): embedding_cls = BytePairEmbeddings is_token_embedding = True is_document_embedding = False default_args = {"language": "en"}
299
29
57
py
flair
flair-master/tests/embeddings/test_transformer_word_embeddings.py
import importlib.util import warnings import pytest import torch from PIL import Image from transformers.utils import is_detectron2_available from flair.data import BoundingBox, Dictionary, Sentence from flair.embeddings import TransformerJitWordEmbeddings, TransformerWordEmbeddings from flair.models import SequenceT...
15,110
45.352761
120
py
flair
flair-master/tests/embeddings/test_flair_embeddings.py
from flair.data import Dictionary, Sentence from flair.embeddings import ( DocumentLMEmbeddings, DocumentRNNEmbeddings, FlairEmbeddings, ) from flair.models import LanguageModel from tests.embedding_test_utils import BaseEmbeddingsTest class TestFlairEmbeddings(BaseEmbeddingsTest): embedding_cls = Fla...
1,707
30.054545
119
py
flair
flair-master/tests/embeddings/test_simple_token_embeddings.py
from flair.data import Dictionary from flair.embeddings import CharacterEmbeddings, HashEmbeddings, OneHotEmbeddings from tests.embedding_test_utils import BaseEmbeddingsTest vocab_dictionary = Dictionary(add_unk=True) vocab_dictionary.add_item("I") vocab_dictionary.add_item("love") vocab_dictionary.add_item("berlin")...
923
29.8
82
py
flair
flair-master/tests/embeddings/test_stacked_embeddings.py
from flair.data import Sentence from flair.embeddings import ( FlairEmbeddings, StackedEmbeddings, TokenEmbeddings, WordEmbeddings, ) from flair.embeddings.base import load_embeddings def test_stacked_embeddings(): glove: TokenEmbeddings = WordEmbeddings("turian") flair_embedding: TokenEmbeddi...
1,851
33.296296
95
py
flair
flair-master/tests/embeddings/test_transformer_document_embeddings.py
from flair.data import Dictionary from flair.embeddings import TransformerDocumentEmbeddings from flair.models import TextClassifier from flair.nn import Classifier from tests.embedding_test_utils import BaseEmbeddingsTest class TestTransformerDocumentEmbeddings(BaseEmbeddingsTest): embedding_cls = TransformerDoc...
1,549
37.75
104
py
flair
flair-master/tests/embeddings/__init__.py
0
0
0
py
flair
flair-master/tests/embeddings/test_tfidf_embeddings.py
from flair.data import Sentence from flair.embeddings import DocumentTFIDFEmbeddings from tests.embedding_test_utils import BaseEmbeddingsTest class TFIDFEmbeddingsTest(BaseEmbeddingsTest): embedding_cls = DocumentTFIDFEmbeddings is_document_embedding = True is_token_embedding = False default_args = ...
508
27.277778
57
py
flair
flair-master/tests/embeddings/test_document_transform_word_embeddings.py
from typing import Any, Dict, List from flair.embeddings import ( DocumentCNNEmbeddings, DocumentLMEmbeddings, DocumentPoolEmbeddings, DocumentRNNEmbeddings, FlairEmbeddings, TokenEmbeddings, WordEmbeddings, ) from tests.embedding_test_utils import BaseEmbeddingsTest word: TokenEmbeddings ...
2,301
33.358209
91
py
LSTM_Covariance
LSTM_Covariance-main/shallow_water/DA_preparation.py
# -*- coding: utf-8 -*- # assimilation shallow water import numpy as np def VAR_3D(xb,Y,H,B,R): #booleen=0 garde la trace dim_x = xb.size #dim_y = Y.size Y.shape = (Y.size,1) xb1=np.copy(xb) xb1.shape=(xb1.size,1) K=np.dot(B,np.dot(np.transpose(H),np.linalg.pinv(np.dot(H,np.dot(B,np.transpose(...
1,041
25.05
129
py
LSTM_Covariance
LSTM_Covariance-main/shallow_water/prediction_plotting.py
# %% # -*- coding: utf-8 -*- """ Created on Wed Jan 6 13:39:58 2021 @author: siboc """ import numpy as np import scipy import math import matplotlib.pyplot as plt # data=np.load('data2/trainset_withx_repeat_shwater3_uniform0011_test6_1114.npy').astype(np.float32) data1=np.load('data2/trainset_withx_repeat_shwater...
12,529
31.973684
109
py
LSTM_Covariance
LSTM_Covariance-main/shallow_water/data_generation_no_v_20.py
#shallow water propagation """ Solution of Shallow-water equations using a Python class. Adapted for Python training course at CNRS from https://github.com/mrocklin/ShallowWater/ Dmitry Khvorostyanov, 2015 CNRS/LMD/IPSL, dmitry.khvorostyanov @ lmd.polytechnique.fr """ import time from pylab import * import matplotli...
7,057
25.335821
176
py
LSTM_Covariance
LSTM_Covariance-main/shallow_water/shallowwater.py
""" Solution of Shallow-water equations using a Python class. Adapted for Python training course at CNRS from https://github.com/mrocklin/ShallowWater/ Dmitry Khvorostyanov, 2015 CNRS/LMD/IPSL, dmitry.khvorostyanov @ lmd.polytechnique.fr """ import time from pylab import * import matplotlib.gridspec as gridspec impor...
9,745
24.989333
169
py
LSTM_Covariance
LSTM_Covariance-main/shallow_water/simulated_data_generation.py
#shallow water propagation """ Solution of Shallow-water equations using a Python class. Adapted for Python training course at CNRS from https://github.com/mrocklin/ShallowWater/ Dmitry Khvorostyanov, 2015 CNRS/LMD/IPSL, dmitry.khvorostyanov @ lmd.polytechnique.fr """ import time from pylab import * import matplotli...
7,041
25.276119
176
py
LSTM_Covariance
LSTM_Covariance-main/shallow_water/constructB.py
# coding: utf8 #construction of matrix B and special H with measure on the boarder import numpy as np import math from scipy.linalg import sqrtm from shallowwater import * ##def B_Balgovind(n,Sigma,L): ## Gamma = np.identity(n) ## for i in xrange(n): ## for j in xrange(n): ## Gamma[i,j] = ( 1. ...
4,880
31.324503
84
py
LSTM_Covariance
LSTM_Covariance-main/shallow_water/shallowwater_lstm1000_model.py
# -*- coding: utf-8 -*- """ Created on Wed Jan 6 13:39:58 2021 @author: siboc """ import numpy as np import scipy import math from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from sklearn.metrics import r2_score import tensorflow as tf import tensorflow.keras.backend as K #...
6,880
30.135747
157
py
LSTM_Covariance
LSTM_Covariance-main/shallow_water/shallowwater_lstm200_model.py
# -*- coding: utf-8 -*- """ Created on Wed Jan 6 13:39:58 2021 @author: siboc """ import numpy as np import scipy import math from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from sklearn.metrics import r2_score import tensorflow as tf import tensorflow.keras.backend as K #...
6,889
29.622222
157
py
LSTM_Covariance
LSTM_Covariance-main/lorenz/lstmR_d05R_plotting.py
# -*- coding: utf-8 -*- """ Created on Wed Jan 6 13:39:58 2021 @author: siboc """ import numpy as np import matplotlib.pyplot as plt # check scikit-learn version # check scikit-learn version import pandas as pd # def data_set_order(file): # train_data = np.array(pd.read_csv(file)) # r0=train_data[:,:1...
9,710
29.731013
101
py
LSTM_Covariance
LSTM_Covariance-main/lorenz/lorenz_lstm1000.py
# -*- coding: utf-8 -*- """ Created on Wed Jan 6 13:39:58 2021 @author: siboc """ import numpy as np import scipy import math import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers import Dense from sklearn.metrics import r2_score import tensorflow as tf import keras.backend as K imp...
6,328
25.817797
121
py
LSTM_Covariance
LSTM_Covariance-main/lorenz/simulated_data_generation.py
# -*- coding: utf-8 -*- # generate the trainning set for keras regression import numpy as np from scipy.optimize import fmin from scipy.optimize import fmin_l_bfgs_b #from scipy.optimize import fmin_ncg from scipy.linalg import sqrtm import math from constructB import * from lorentz_attractor import * import matp...
5,902
34.993902
192
py
LSTM_Covariance
LSTM_Covariance-main/lorenz/constructB.py
# coding: utf8 #construction of matrix B and special H with measure on the boarder import numpy as np import math from scipy.linalg import sqrtm ##def B_Balgovind(n,Sigma,L): ## Gamma = np.identity(n) ## for i in xrange(n): ## for j in xrange(n): ## Gamma[i,j] = ( 1. + abs(i-j)/L)*np.exp(-abs(i...
3,935
32.355932
130
py
LSTM_Covariance
LSTM_Covariance-main/lorenz/lorentz_attractor.py
# -*- coding: utf-8 -*- # lorentz system import numpy as np import time import random import matplotlib.pyplot as plt import itertools import math from constructB import * # This import registers the 3D projection, but is otherwise unused. from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import def...
5,328
30.720238
119
py
LSTM_Covariance
LSTM_Covariance-main/lorenz/lorenz_lstm200.py
# -*- coding: utf-8 -*- """ Created on Wed Jan 6 13:39:58 2021 @author: siboc """ import numpy as np import scipy import math import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers import Dense from sklearn.metrics import r2_score import tensorflow as tf import keras.backend as K # c...
6,201
25.618026
121
py
PMEmo
PMEmo-master/features.py
#! usr/bin/env python3 # -*- coding: utf-8 -*- ''' This features.py is used to extract audio features based on openSIMLE. Require: openSMILE-2.2rc1 OpenSMILE only support audios in WAV format, so before using this script you could transform MP3s into WAVs by transformat.sh. ''' __author__ = 'huizhang' import csv im...
14,123
81.116279
8,566
py
ExplainableAIImageMeasures
ExplainableAIImageMeasures-main/setup.py
import pathlib from setuptools import setup # The directory containing this file HERE = pathlib.Path(__file__).parent # The text of the README file README = (HERE / "README.md").read_text() # This call to setup() does all the work setup( name="explainable_ai_image_measures", version="1.0.1", description=...
989
32
91
py
ExplainableAIImageMeasures
ExplainableAIImageMeasures-main/explainable_ai_image_measures/scoring_metric.py
import numpy as np import torch from sklearn.metrics import auc import torch.nn.functional as F from explainable_ai_image_measures.irof import IrofDataset from explainable_ai_image_measures.pixel_relevancy import PixelRelevancyDataset class Measures: def __init__(self, model, ba...
7,637
37.771574
120
py
ExplainableAIImageMeasures
ExplainableAIImageMeasures-main/explainable_ai_image_measures/pixel_manipulation.py
import torch from torch.utils.data import Dataset import abc class PixelManipulationBase(Dataset): """ Requires that self._pixel_batches is defined in the constructor """ def __init__(self, image, attribution, insert, batch_size, device, baseline_color): self._image = image self._batc...
5,848
35.55625
118
py
ExplainableAIImageMeasures
ExplainableAIImageMeasures-main/explainable_ai_image_measures/irof.py
import torch import numpy as np from skimage.segmentation import slic from explainable_ai_image_measures.pixel_manipulation import PixelManipulationBase class IrofDataset(PixelManipulationBase): def __init__( self, image, attribution, batch_size, irof_segments, irof_sigma, device, baseline_color ): ...
3,308
35.766667
95
py
ExplainableAIImageMeasures
ExplainableAIImageMeasures-main/explainable_ai_image_measures/pixel_relevancy.py
import torch from explainable_ai_image_measures.pixel_manipulation import PixelManipulationBase class PixelRelevancyDataset(PixelManipulationBase): def __init__(self, image, attribution, insert, batch_size, package_size, device, baseline_color): PixelManipulationBase.__init__( self, image, at...
2,552
41.55
101
py
ExplainableAIImageMeasures
ExplainableAIImageMeasures-main/explainable_ai_image_measures/__init__.py
from explainable_ai_image_measures.scoring_metric import Measures __version__ = "1.0.1" __all__ = ["Measures"]
112
21.6
65
py
ellip-corr
ellip-corr-master/PyEllipCorr.py
import os from numpy import f2py import numpy as np from collections import defaultdict from pyellip import select_phase, coeffs, ellip class PyEllipCorr: def __init__(self): self._tbl_fn = os.path.join(os.path.dirname(__file__), 'ellip/elcordir.tbl') self._coeffs = defaultdict(list) # end func...
1,696
32.94
95
py
ellip-corr
ellip-corr-master/__init__.py
0
0
0
py
ellip-corr
ellip-corr-master/tests/test_ellipticity_corr.py
from __future__ import print_function import pytest from PyEllipCorr import PyEllipCorr """ The values below were extracted from ttimel """ """ Source latitude: -30 Source depth (km): 124 Azimuth from source: 39 delta: 65 # code time time(el) dT/dD dT/dh d2T/dD2 """ data= """ 1 ...
3,076
42.957143
80
py
ellip-corr
ellip-corr-master/ellip/__init__.py
0
0
0
py
ellip-corr
ellip-corr-master/tau/__init__.py
0
0
0
py
zpdgen
zpdgen-master/itg_ai_loc.py
import numpy as np import matplotlib.pyplot as plt import gpdf as gp from scipy.optimize import root etai=2.5 LnbyR=0.2 rbyR=0.18 kpar=0.1 tau=1.0 def epsfun(v): om=v[0]+1j*v[1] omsi=-ky omdi=2*omsi*LnbyR za=-om/omdi zb=-np.sqrt(2)*kpar/omdi b=ky**2 i10=gp.Inm(za,zb,b,1,0) i12=gp.Inm(z...
1,029
21.888889
69
py
zpdgen
zpdgen-master/itg_ai_loc_mat.py
import numpy as np import matplotlib.pyplot as plt import gpdf as gp from scipy.optimize import root etai=2.5 LnbyR=0.2 rbyR=0.18 kpar=0.1 tau=1.0 def epsfun(v): om=v[0]+1j*v[1] omsi=-ky omdi=2*omsi*LnbyR za=-om/omdi zb=-np.sqrt(2)*kpar/omdi b=ky**2 anm=np.zeros((4,3),dtype=np.complex128) ...
1,084
22.085106
68
py
zpdgen
zpdgen-master/plot_eps.py
import numpy as np import matplotlib.pyplot as plt import gpdf as gp etai=2.5 LnbyR=0.2 rbyR=0.18 kpar=0.1 tau=1.0 ky=0.06 def epsfun(v): om=v omsi=-ky omdi=2*omsi*LnbyR za=-om/omdi zb=-kpar/omdi*np.sqrt(2) b=ky**2 i10=gp.Inm(za,zb,b,1,0) i12=gp.Inm(za,zb,b,1,2) i30=gp.Inm(za,zb,b,...
908
21.170732
86
py
zpdgen
zpdgen-master/py_time.py
import numpy as np import matplotlib.pyplot as plt import gpdf as gp import time nlist=[[1,0],[1,2],[3,0]] ii=0; xx,yy=np.meshgrid(np.arange(-6,6,0.1),np.arange(-6,6,0.1)) za=xx+1j*yy; zb=0.0 b=0.09 for ns in nlist: ii=ii+1; [n,m]=ns; print('computing I'+str(n)+str(m)+' ...') t0 = time.clock() inm=g...
376
19.944444
58
py
zpdgen
zpdgen-master/gpdf.py
from numpy import reshape,shape,rank,transpose from inmzpd import inmweid,gmweid from epszpd import epsweid,sigweid def Inm(za,zb,b,n,m): res=inmweid(za,zb,b,n,m) if (shape(za) ==()): res=res[0] return res res=reshape(res,shape(transpose(za))) res=transpose(res) return res def epsi...
1,280
22.290909
54
py
zpdgen
zpdgen-master/plot_inm_re.py
import numpy as np import matplotlib.pyplot as plt import gpdf as gp nlist=[[1,0],[2,0],[3,0],[1,2],[2,2],[3,2],[1,4],[2,4],[3,4]] cnts=np.arange(-2,2.2,0.2) wdts=np.ones(cnts.shape); wdts[0]=2.0 wdts[5]=2.0 wdts[10]=4.0 wdts[15]=2.0 wdts[20]=2.0 vcb = np.arange(-12,14,2) ii=0; xx,yy=np.meshgrid(np.arange(-6,6,0.1),np....
1,970
35.5
97
py
zpdgen
zpdgen-master/plot_itg_jykim94.py
import numpy as np import matplotlib.pyplot as plt import gpdf as gp from scipy.optimize import root etai=2.5 LnbyR=0.2 rbyR=0.18 kpar=0.1 tau=1.0 def epsfun(v): om=v[0]+1j*v[1] omsi=-ky omdi=2*omsi*LnbyR za=-om/omdi zb=-np.sqrt(2)*kpar/omdi b=ky**2 i10=gp.Inm(za,zb,b,1,0) i12=gp.Inm(z...
1,715
24.61194
69
py
zpdgen
zpdgen-master/itg_ai_loc_comb.py
import numpy as np import matplotlib.pyplot as plt import gpdf as gp from scipy.optimize import root etai=2.5 LnbyR=0.2 rbyR=0.18 kpar=0.1 tau=1.0 def epsfun(v): om=v[0]+1j*v[1] omsi=-ky omdi=2*omsi*LnbyR za=-om/omdi zb=-np.sqrt(2)*kpar/omdi b=ky**2 pars=(omdi,etai,tau,ky,kpar) eps=gp....
935
20.767442
68
py
zpdgen
zpdgen-master/plot_inm_im.py
import numpy as np import matplotlib.pyplot as plt import gpdf as gp nlist=[[1,0],[2,0],[3,0],[1,2],[2,2],[3,2],[1,4],[2,4],[3,4]] cnts=np.arange(-2,2.2,0.2) wdts=np.ones(cnts.shape); wdts[0]=2.0 wdts[5]=2.0 wdts[10]=4.0 wdts[15]=2.0 wdts[20]=2.0 vcb = np.arange(-12,14,2) ii=0; xx,yy=np.meshgrid(np.arange(-6,6,0.1),np....
1,970
35.5
97
py
GAStimator
GAStimator-master/setup.py
from setuptools import setup with open("README.md", "r") as fh: long_description = fh.read() setup(name='gastimator', version='0.4.7', description='Implementation of a Python MCMC gibbs-sampler with adaptive stepping', url='https://github.com/TimothyADavis/GAStimator', author='Timoth...
962
29.09375
90
py
GAStimator
GAStimator-master/gastimator/priors.py
#!/usr/bin/env python3 # coding: utf-8 import numpy as np class priors: def __init__(): pass class gaussian: def __init__(self,mu,sigma): self.mu=mu self.sigma=sigma def eval(self,x,**kwargs): xs = (x - self.mu) / self.sigma ...
422
22.5
92
py
GAStimator
GAStimator-master/gastimator/__init__.py
#!/usr/bin/env python3 # coding: utf-8 from gastimator.gastimator import gastimator from gastimator.priors import priors
120
29.25
44
py
GAStimator
GAStimator-master/gastimator/corner_plot.py
############################################################################## # # This is the history of Michele Cappellari modifications # to Daniel Foreman-Mackey corner_plot routine. # # V1.0.0: Included "like" and "xstry" optional inputs # to show individual points coloured by their likelihood # and to show al...
19,149
35.406844
97
py
GAStimator
GAStimator-master/gastimator/gastimator.py
#!/usr/bin/env python3 # coding: utf-8 import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm from joblib import Parallel, delayed,cpu_count from joblib.externals.loky import get_reusable_executor def lnlike(data,model,error): # default log-likelihood function chi2=np.nansum((data - model)**2...
16,793
38.146853
312
py
python-pesq
python-pesq-master/setup.py
from setuptools import setup, Extension, find_packages from setuptools.command.build_ext import build_ext as _build_ext import os includes = ['pypesq'] try: import numpy as np includes += [os.path.join(np.get_include(), 'numpy')] except: pass extension = Extension("pesq_core", source...
1,498
30.893617
120
py
python-pesq
python-pesq-master/pypesq/__init__.py
import warnings import numpy as np from pesq_core import _pesq from math import fabs EPSILON = 1e-6 def pesq(ref, deg, fs=16000, normalize=False): ''' params: ref: ref signal, deg: deg signal, fs: sample rate, ''' ref = np.array(ref, copy=True) deg = np.array(deg, copy=True...
1,501
25.350877
73
py
scaper
scaper-master/setup.py
from setuptools import setup import imp with open('README.md') as file: long_description = file.read() version = imp.load_source('scaper.version', 'scaper/version.py') setup( name='scaper', version=version.version, description='A library for soundscape synthesis and augmentation', author='Justin...
1,903
33.618182
71
py
scaper
scaper-master/tests/test_core.py
import scaper from scaper.scaper_exceptions import ScaperError from scaper.scaper_warnings import ScaperWarning from scaper.util import _close_temp_files import pytest from scaper.core import EventSpec import tempfile import backports.tempfile import os import numpy as np import soundfile import jams import numbers fr...
99,295
39.661753
119
py
scaper
scaper-master/tests/profile_speed.py
""" This is a profiling script to check the performance of Scaper. It generates 100 soundscapes in sequence (no parallelization). Running it on 2019 Macbook Pro currently takes 158.68 seconds (02:38). """ import scaper import numpy as np import tempfile import os import tqdm import zipfile import subprocess import ti...
5,749
30.944444
122
py
scaper
scaper-master/tests/test_util.py
# CREATED: 10/15/16 7:52 PM by Justin Salamon <justin.salamon@nyu.edu> ''' Tests for functions in util.py ''' from scaper.util import _close_temp_files from scaper.util import _set_temp_logging_level from scaper.util import _validate_folder_path from scaper.util import _get_sorted_files from scaper.util import _popul...
11,535
30.605479
102
py
scaper
scaper-master/tests/create_regression_data.py
import os import scaper import jams os.chdir('..') # FIXTURES # Paths to files for testing FG_PATH = 'tests/data/audio/foreground' BG_PATH = 'tests/data/audio/background' ALT_FG_PATH = 'tests/data/audio_alt_path/foreground' ALT_BG_PATH = 'tests/data/audio_alt_path/background' REG_NAME = 'soundscape_20200501' # REG_...
4,773
34.626866
103
py
scaper
scaper-master/tests/__init__.py
0
0
0
py
scaper
scaper-master/tests/test_audio.py
# CREATED: 5/5/17 14:36 by Justin Salamon <justin.salamon@nyu.edu> from scaper.audio import get_integrated_lufs, match_sample_length from scaper.audio import peak_normalize from scaper.util import _close_temp_files import numpy as np import scipy.signal as sg import os import pytest from scaper.scaper_exceptions impor...
6,611
37.219653
86
py
scaper
scaper-master/docs/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # scaper documentation build configuration file, created by # sphinx-quickstart on Thu May 4 17:32:22 2017. # # 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 # aut...
11,254
27.20802
80
py
scaper
scaper-master/scaper/scaper_warnings.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # CREATED: 10/13/16 7:08 PM by Justin Salamon <justin.salamon@nyu.edu> '''Warning classes for Scaper''' class ScaperWarning(Warning): '''The root Scaper warning class''' pass
235
18.666667
70
py
scaper
scaper-master/scaper/core.py
try: import soxbindings as sox except: # pragma: no cover import sox # pragma: no cover import soundfile import os import warnings import jams from collections import namedtuple import logging import tempfile import numpy as np import shutil import csv from copy import deepcopy from .scaper_exceptions import S...
106,280
43.712242
111
py
scaper
scaper-master/scaper/scaper_exceptions.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # CREATED: 10/11/16 6:07 PM by Justin Salamon <justin.salamon@nyu.edu> '''Exception classes for Scaper''' class ScaperError(Exception): '''The root Scaper exception class''' pass
239
19
70
py
scaper
scaper-master/scaper/audio.py
# CREATED: 4/23/17 15:37 by Justin Salamon <justin.salamon@nyu.edu> import numpy as np import pyloudnorm import soundfile from .scaper_exceptions import ScaperError def get_integrated_lufs(audio_array, samplerate, min_duration=0.5, filter_class='K-weighting', block_size=0.400): """ Re...
4,982
35.108696
85
py
scaper
scaper-master/scaper/version.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Version info""" short_version = '1.6' version = '1.6.5'
106
14.285714
23
py
scaper
scaper-master/scaper/util.py
# CREATED: 10/14/16 12:35 PM by Justin Salamon <justin.salamon@nyu.edu> ''' Utility functions ================= ''' from contextlib import contextmanager import logging import os import glob from .scaper_exceptions import ScaperError import warnings from .scaper_warnings import ScaperWarning import scipy import numpy ...
15,371
28.964912
100
py
scaper
scaper-master/scaper/__init__.py
#!/usr/bin/env python """Top-level module for scaper""" from .core import Scaper from .core import generate_from_jams from .core import trim from .version import version as __version__
186
22.375
43
py
rpg_svo
rpg_svo-master/svo_analysis/setup.py
#!/usr/bin/env python from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup d = generate_distutils_setup( packages=['svo_analysis'], package_dir={'': 'src'}, install_requires=['rospkg', 'yaml'], ) setup(**d)
266
21.25
60
py
rpg_svo
rpg_svo-master/svo_analysis/src/svo_analysis/filter_groundtruth_smooth.py
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import transformations from scipy import signal save = True data_filename = '/home/cforster/Datasets/SlamBenchmark/asl_vicon_d2/groundtruth.txt' filtered_data_filename = '/home/cforster/Datasets/SlamBenchmark/asl_vicon_d2/groundtruth_filtered.txt' ...
1,875
29.754098
137
py
rpg_svo
rpg_svo-master/svo_analysis/src/svo_analysis/analyse_logs.py
#!/usr/bin/python import os import yaml import numpy as np import matplotlib.pyplot as plt def analyse_logs(D, trace_dir): # identify measurements which result from normal frames and which from keyframes is_kf = np.argwhere( (D['dropout'] == 1) & (D['repr_n_mps'] >= 0)) is_frame = np.argwhere(D['repr_n_mps']...
3,497
45.64
96
py
rpg_svo
rpg_svo-master/svo_analysis/src/svo_analysis/analyse_timing.py
#!/usr/bin/python import os import numpy as np import matplotlib.pyplot as plt def analyse_timing(D, trace_dir): # identify measurements which result from normal frames and which from keyframes is_frame = np.argwhere(D['repr_n_mps'] >= 0) n_frames = len(is_frame) # set initial time to zero D['timestamp'...
3,476
50.132353
128
py