sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0a3a786dbf7b69a3ce70c2a9062c5eb6c1bcf003a850df3c9acc47666fa94140 | Python | 1,532 | 50 | """Test in memory indexer."""
import pytest
from langchain_tests.integration_tests.indexer import (
AsyncDocumentIndexTestSuite,
DocumentIndexerTestSuite,
)
from typing_extensions import override
from langchain_core.documents import Document
from langchain_core.indexing.in_memory import (
InMemoryDocument... |
d7aaa60e2311f4435f255d44657e84d73a80608254df8b8c8416e3a72ace7b81 | Python | 1,532 | 54 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import numpy.ma
import Stats
import Histogram
import cpgReport
from cgatReport.Tracker import *
from cgatReport.odict import OrderedDict as odict
##################################################################... |
28ab693dc3c56b3ff56eea1d4f9463ccf29ca5e7eeeb4859386665dc0b15c93a | Python | 1,535 | 48 |
import os.path as path
from . import rallpack1_membres as rallpack1
def setup_module():
global C
# defaults
C={ 'meshdir': 'validation_efield/meshes',
'mesh': 'axon_cube_L1000um_D866nm_1978tets',
'datadir': 'validation_efield/data/rallpack1_correct',
'v0data': 'v0',
'v1dat... |
5da830795548e9430817d8f8aca65f842392602b6ebce2a28ab4e073f74f9760 | Python | 1,535 | 37 | #!/usr/bin/python
import sys
import json
import os
import hashlib
import shutil
def md5sum(filename, blocksize=65536):
hash = hashlib.sha1()
with open(filename, "rb") as f:
for block in iter(lambda: f.read(blocksize), b""):
hash.update(block)
return hash.hexdigest()
def start(doc):
... |
079b6ea2aa867f807ce6154a27ec74ae66b92459cd58883b7d37adefe88a79df | Python | 1,536 | 38 | """the list of template meshes that ship with the app (src/craniumpy_core/templates/).
used by the "show template overlay" viewer feature, to compare a patient's
registered mesh against the reference it was aligned to.
"""
from __future__ import annotations
import sys
from pathlib import Path
import trimesh
from .i... |
0fd08ff25a2ea0d70ed90ba905b5a160290f91a0049bb16d0680ab5763d60050 | Python | 1,536 | 36 | TMDB_DOCS = """API documentation:
Endpoint: https://api.themoviedb.org/3
GET /search/movie
This API is for searching movies.
Query parameters table:
language | string | Pass a ISO 639-1 value to display translated data for the fields that support it. minLength: 2, pattern: ([a-z]{2})-([A-Z]{2}), default: en-US | opti... |
44637f5fd5ee50d3f9ea0f95f1da29783f5ffcf090bb13fe3bfddd804f02d3ad | Python | 1,536 | 57 | from sklearn.preprocessing import normalize
import scipy.sparse as sp
import torch
import torch.nn as nn
import numpy as np
def indices_to_one_hot(data, nb_classes):
"""Convert an iterable of indices to one-hot encoded labels."""
targets = np.array(data).reshape(-1)
labels = np.eye(nb_classes)[targets]
... |
daab61f6288b1f1038f2fedb2389ef85b8d12bc4f3d37ae5a3cb655cd0f5ef93 | Python | 1,536 | 56 | # main file for 3D Reconstruction GAN (multiple generators)
# Created: 11/4/2021
# Status: ok
# CUBLAS_WORKSPACE_CONFIG=:4096:8 python rcgans_main.py
import sys
import torch
import wandb
import numpy as np
from networks import RCGANs_Wrapper
from utils import read_json
SWEEP = 0
def RCGANs(model_name, config, Wra... |
f5d09184214cb9feb6b634e74a582961c16440a36a7c5c0babda6dcc9fb84203 | Python | 1,536 | 57 | """**Graphs** provide a natural language interface to graph databases."""
from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.graphs import (
ArangoGraph,
FalkorDBGraph,
HugeGraph,
KuzuGraph,
M... |
9943b89d1b99c624fbe5ac51e2748b0e3833be9e7058a5c0526ef4c243591e91 | Python | 1,537 | 44 | from langchain_core.utils.function_calling import convert_to_openai_function
from langchain_classic.chains.openai_functions.base import (
create_openai_fn_chain,
create_structured_output_chain,
)
from langchain_classic.chains.openai_functions.citation_fuzzy_match import (
create_citation_fuzzy_match_chain,... |
e3661f1c70dd266b59c8b1cb23b9caf3a856987274c30b871ece179a187f37ae | Python | 1,537 | 48 | from collections.abc import Sequence
from typing import Any
from langchain_core.documents import Document
from langchain_text_splitters.character import CharacterTextSplitter
from typing_extensions import override
from langchain_classic.retrievers import ParentDocumentRetriever
from langchain_classic.storage import I... |
83294b56834cbdbf581fc81faebc11175cb4679a7e4d6280571c27f034268944 | Python | 1,538 | 49 | import logging
import os
import socket
import numpy as np
import pandas as pd
from configs.configs import get_config_dict
from helpers.rockland import get_rockland_subjects, get_convolved_stim_array
if __name__ == '__main__':
pp_pipeline = 'custom_fsl_pipeline'
cfg = get_config_dict(
data_set_name... |
254806d11b68ba38aeeb6cafc46416be69be6d7eadb587ef8683eef5877b9769 | Python | 1,539 | 32 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import glob, sys, os
from plot import errors_ae_don, violin_plots
### Define inputs
#latent_dim = [25,49,64,81]
#method = ['MLAE', 'CAE']
#n_epochs_ae, n_epochs_don = [3000,3500,1500], [5000,5000,6000]
latent_dim = [81]
method... |
6be5b31a41cab6a4d9c743567086efe10459d1bfd2bb04b2f0372601e3626947 | Python | 1,541 | 69 | import joblib
import torch
torch.set_printoptions(precision=4, sci_mode=False, threshold=5000)
import matplotlib.pyplot as plt
from data import generate_recog_data
from net_utils import load_from_file
from plotting import plot_ROC, plot_output_distr
#%%
d = 25
T = 25
#%%
reset = True
Nh = 10
fname ... |
2b982a074f362213c2c8718800e1571c7075730b0d09068be3b4a31a887123bc | Python | 1,542 | 34 | import mne
from config_FaceName import Results_data_path,Ids,MEG_data_path,group_name,stats_conds_list,stats_comparisions
from custom_functions import do_cluster_permutation_1samp_test
from functools import partial
import os.path as op
bands = dict(theta=[4, 7],alpha=[8, 13],beta=[14, 30],gamma=[40, 90])
Ids.remove(1... |
d8072004e7858ab240545e453638319e39595afb537d63ca107250d37e656801 | Python | 1,542 | 44 | import matplotlib
from Articles.Sequential_Learning_Striatum.Figures.cfg_color import colors, cm
matplotlib.rcParams.update({
"font.family": "serif", # use serif/main font for text elements
"text.latex.preamble": "\n".join([
r"\usepackage{amsfonts,amssymb,mathtools,amsmath,xcolor}",
r"\def\e... |
2d77116178f1e41b424b36dea0bd06d63e4963d2d8c156d35534a2085c52d911 | Python | 1,543 | 36 | #TO BE UPDATED
from NeuronModel.NeuronClass import neuronClass
import numpy as np
import matplotlib.pyplot as plt
hsv = plt.get_cmap('hsv')
def colors(n):
return hsv(np.linspace(0., 1.0, len(n)+1))
class MMinf(neuronClass) :
parameters = {'save': True, 'spike': True, 'step' : 1., 'b' : (lambda x :np.maximum(... |
50346e9c45ad052e0ca1ceb10911dc490f4fdb2bd5c3a3412ddd084076acb763 | Python | 1,543 | 49 | # third party modules
import torch
from torch_geometric.utils import to_trimesh
# pnabind modules
from pnabind.mesh import getGeometricEdgeFeatures
class GeometricEdgeFeatures(object):
r"""docstring
"""
def __init__(self, assign_edges=True, pp_features=True, triangle_features=True, n_components=0):
... |
6f6fe42aa8d6d84e2c03fc714014eebd8df445e21f8f0119306608b4f48de59d | Python | 1,543 | 63 | #%%
'''
This script is for testing a model on new data.
You can chose to use the pretrained model or use the model that trained by yourself.
'''
%reload_ext autoreload
%autoreload 2
import numpy as np
import tensorflow as tf
import tensorflow.keras.backend as K
from brainagemodel.models.model_sinc import net
from bra... |
6f9163b34bdc8ab42a5ec058b280f7cd177ca042cb3abb089f1fd969acc32079 | Python | 1,547 | 49 | '''sampling used for preparing the training data.
'''
import numpy as np
class PlaneSampler:
'''samples annotated planes from a given stack & annotation.
'''
def __init__(self, stack, annotation, n_samples, patch_size):
'''initializes sampler given an image stack and its annotations.
'''... |
f0965b1ecb6af34875cfb67fb083779fe60c4c0d00231f139d62863364d5f137 | Python | 1,547 | 56 | import torch
import os
import numpy as np
from sampling import post_process
def restore_checkpoint(ckpt_dir, state, device):
if not os.path.exists(ckpt_dir):
if not os.path.exists(os.path.dirname(ckpt_dir)):
os.makedirs(os.path.dirname(ckpt_dir))
print(f"No checkpoint found at {ckpt_di... |
02d800d2d5f8cdd12b9b5d85dc2e40e977251e86fc9526cec4764e3769b75aa1 | Python | 1,548 | 32 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import glob, sys, os
from plot import errors_ae_don, violin_plots
### Define inputs
latent_dim = [25,49,64,81,100]
#method = ['MLAE', 'CAE']
#n_epochs_ae, n_epochs_don = [2000,2500,1500], [3500,5000,6000]
#latent_dim = [100]
m... |
746249fe227b56b2df0a2d268023177c96198b807b0a92a1fed8e5b1094eaf99 | Python | 1,548 | 44 | import os
import argparse
from tqdm.std import trange
def run(input_fasta, sa3m_folder):
ids = []
seqs = []
with open(input_fasta, 'r') as f:
lines = f.readlines()
print(f'Num of fasta seqs is {len(lines)/2}')
for line in lines:
line = line.strip()
... |
331404de24a2a0d943ac89e0040dae377b093ace73cb2c2157f965c82420f839 | Python | 1,549 | 43 | # Copyright 2024 DeepMind Technologies Limited
#
# AlphaFold 3 source code is 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... |
5af47fc4df0f55eb3de94ce02f4b62aeb00781d2dc8e02cf3a8d97286ad9df35 | Python | 1,549 | 38 | """
Generate the nrrd file containing only the new barrel annotation ids within SSp-bfd (primary somatosensory barrel cortex).
This file will extract all of the barrel columns annotations in SSp-bfd, remove faulty V1 subregions and create a new annotations array with zeros outside of the barrel columns.
This file can... |
d717604d9054b2b71d2fffe07f341220a045ae9f4f8145afc4845beef2670715 | Python | 1,549 | 45 | import re
from pathlib import Path
figures_directory = Path("./figures")
output_filename = "content/11-figures.tex"
# Function to format captions
def format_caption(caption: str):
# Formats strings like (A) to \textbf{(A)}
caption = re.sub(r'\(([A-Z])\)', r'\\textbf{(\1)}', caption)
caption = caption.rep... |
1d8675d435359c7dcf786fed6d0982e8fa7fc2f6c5487456edb8ab490abd91bc | Python | 1,551 | 52 | from ChipseqReport import *
class MappingStatus(Status):
'''status information for mapping stage.'''
def getTracks(self):
d = self.get(
"SELECT DISTINCT track FROM bam_stats WHERE track LIKE '%%.genome'")
return tuple([re.sub(".genome", "", x[0]) for x in d])
def testMapping... |
1c51304dcb3debce7cd2fd94c66a3511fb7937faa8b31f918dcd8fb3ddc80957 | Python | 1,552 | 36 | from langchain_core.prompts.prompt import PromptTemplate
KG_TRIPLE_DELIMITER = "<|>"
_DEFAULT_KNOWLEDGE_TRIPLE_EXTRACTION_TEMPLATE = (
"You are a networked intelligence helping a human track knowledge triples"
" about all relevant people, things, concepts, etc. and integrating"
" them with your knowledge ... |
838cf096af9413ca6866af3e4897df5d4c825b1378eb8df5345a73d092f3c6ac | Python | 1,552 | 37 | import copy
import numpy as np
T = 60
t_steps = 800
params_base = dict(w_params=dict(), inp_params=dict(P=40, seed=33, N=30000),
sim_params=dict(vspan=1, sig=.1, T=60, t_steps=800),
)
params_mf = copy.deepcopy(params_base)
params_mf['sim_params'] = dict(sim_type='mf_approx3', vspan... |
3b9b5215f86cd750cd5f1e95f0aafc41dd6fd98549c4b89ed91388db40ae6ede | Python | 1,553 | 46 | # standard modules
import os
# third party modules
import numpy as np
# pnabind modules
from pnabind.mesh import runMSMS
from .structure import StructureData
def getAtomSESA(atoms, prefix='area', mesh=None, clean=True, hydrogens=True, quiet=True, feature_name='sesa', binary=False, threshold=0.1, **kwargs):
if is... |
821859946bec75e48ecca8948c4347cd3cb49798bf26dab6ea7a66e430498b78 | Python | 1,554 | 41 | from typing import List
import torch
from tqdm import tqdm
from HMSA.data import MoleculeDataLoader, StandardScaler
from HMSA.models import HMSAModel
import numpy as np
from HMSA.args import TrainArgs
def predict(model: HMSAModel,
data_loader: MoleculeDataLoader,
args: TrainArgs,
d... |
cb15ace2c79ca6791f2ba5590e234935d9583ab459d7c450663d52df1350ef70 | Python | 1,554 | 50 | """Kept for backwards compatibility."""
from langchain_text_splitters import (
Language,
RecursiveCharacterTextSplitter,
TextSplitter,
Tokenizer,
TokenTextSplitter,
)
from langchain_text_splitters.base import split_text_on_tokens
from langchain_text_splitters.character import CharacterTextSplitter
... |
eb85570dee0b8275bc5dfe38b39913569d29b28b7dca009fe43e7b5d1d849c23 | Python | 1,554 | 45 | from utils.tensor_operator import tensor2array
from functools import wraps
def merge_loss_dict(loss_dict, weight_dict=None, loss_prefix_list=None):
re_loss_dict = dict()
re_total_loss = 0
for loss_name, sub_loss_dict in loss_dict.items():
prefix = '_'.join(loss_name.split('_')[:-1])
total_... |
bef6ad53739ca32d2f44e589308efdd0fa24cecf74fea74bda152355eaf7bef0 | Python | 1,555 | 54 | import pytest
import torch
from e3nn import o3
from e3nn.util.test import assert_auto_jitable, assert_equivariant
from allegro.nn._strided import MakeWeightedChannels
from test_contract_basic import _strided_to_cat
@pytest.mark.parametrize("irreps_in", ["0e + 1o", "0e + 1o + 2e + 3o"])
@pytest.mark.parametrize("mu... |
66c20fe2a58b0a5afc704b45a27c6d5a32fad35f28e97ac5f05cccb78cdc516e | Python | 1,557 | 51 | # Copyright 2022 DeepMind Technologies Limited.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
8f8b8451e7bf763cc0a138e6cf9ca8f0da5630aca29e775b079e91748dec1f3e | Python | 1,557 | 44 | # Copyright 2022 DeepMind Technologies Limited.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
adb082db69bdf5d77c57da63a83c4418df2b2c4903cd6c4043f38d91b1bb1aa2 | Python | 1,557 | 41 | import sys
import torch.nn.functional as F
import numpy as np
import joblib
import matplotlib.pyplot as plt
from dt_utils import Timer
from plastic import PlasticRecall
from data_utils import generate_delayed_recall_data, recall_chance, generate_arithmetic_data_onehot
from neural_net_utils import random_weigh... |
c3385f549fb7abee2ac88a802e18d78d5fa513c0094bcaec8442acfbca47e59c | Python | 1,558 | 37 | import torch
from torch.nn import Sequential, Conv3d, BatchNorm3d, ReLU, MaxPool3d, AdaptiveAvgPool3d, Linear, Module, Softmax
class CNN3D(Module):
def __init__(self, labels_number, channels_nb, width, depth):
super(CNN3D, self).__init__()
self.width = width
self.pool = 2
layers_li... |
028a1c50d942a8a79f02a0ef4bed29be3b27cc5dedb15c92b75c5394e70ffadd | Python | 1,559 | 47 | from torch import nn
import torch
import math
ACTIVATION_REGISTRY = {
"relu": nn.ReLU(),
"silu": nn.SiLU(),
"gelu": nn.GELU(),
"tanh": nn.Tanh(),
"sigmoid": nn.Sigmoid(),
}
class SinusoidalEmbedding(nn.Module):
# https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/90... |
1d6fb33624f6139c5440da05170c856946880741e158121ee0c1f075faa27f1c | Python | 1,560 | 56 | #!/usr/bin/python
import argparse
import functools
import pandas as pd
from rpy2.robjects import r, pandas2ri
@functools.lru_cache()
def get_pheno(fn):
pheno = pd.read_csv(fn, index_col=0)
return pheno[(pheno['Dx'].isin(['Control', 'Schizo'])) &
(pheno['Age'] > 17) &
(pheno['... |
5c7c047c6063bb40d6dad1e2dc6534a794db08e4c7976f89ad2daea1f536c1fd | Python | 1,560 | 47 | # Copyright Generate Biomedicines, Inc.
#
# 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 ... |
a410a8cfa73107486889b29ac1df87b5e023cbe53ee6808c08c65c66040ff62b | Python | 1,560 | 41 | from langchain_core.agents import AgentAction
from langchain_classic.agents.format_scratchpad.log import format_log_to_str
def test_single_agent_action_observation() -> None:
intermediate_steps = [
(AgentAction(tool="Tool1", tool_input="input1", log="Log1"), "Observation1"),
]
expected_result = "... |
a78d27678f6aa41828af89428c437943b1af7fe9c5cab67254e92c1f142fc213 | Python | 1,560 | 62 | import json
from collections import OrderedDict
from augmentations.ctaugment import *
class StorableCTAugment(CTAugment):
def load_state_dict(self, state):
for k in ["decay", "depth", "th", "rates"]:
assert k in state, "{} not in {}".format(k, state.keys())
setattr(self, k, state[... |
b5c87b0b610a06b49745fd25d6e4f0b2c565746ecf4da2b4450db0af708c3301 | Python | 1,560 | 22 | """Sentence-length audit for one section of paper/main.tex (floats, equations and macros removed).
Usage: python src/sentence_check.py "<start marker>" "<end marker>" [max_words=45]
Example: python src/sentence_check.py "\\section{Results}" "\\section{Discussion}"
Prints count, mean, number under 8 and over 30 words, a... |
f3cd256a5e0d42491011cad7e687ad452f32c338b83ed7dc56eca822b1270694 | Python | 1,561 | 74 | import argparse
import os
import numpy as np
from bindsnet.environment import GymEnvironment
parser = argparse.ArgumentParser()
parser.add_argument("-n", type=int, default=1000000)
parser.add_argument("--render", dest="render", action="store_true")
parser.set_defaults(render=False)
args = parser.parse_args()
n = a... |
51042727684a603cd63fd852498c59793df6a5197406659c69115e4e928824b1 | Python | 1,562 | 47 | import os
from _cif_to_substructure_dict import CifSubstructures
from openff.toolkit.utils.utils import get_data_file_path
if not os.path.exists("aa-variants-v1.cif"):
import requests
r = requests.get("https://files.wwpdb.org/pub/pdb/data/monomers/aa-variants-v1.cif")
print(r.ok)
if r.ok:
wi... |
583bdba1b63a29b391d468b79cced28c5a71b17d80d8f3e5ebfb4c580b79c84f | Python | 1,563 | 46 | # third party modules
import numpy as np
# pnabind modules
from pnabind.utils import clipOutliers
def getHKS(mesh, num_samples=3, num_components=50, feature_name='hks', tau=1, eps=1e-5, normalize=True, **kwargs):
try:
from scipy.sparse.linalg import eigsh as sp_eigs
from scipy.sparse import diags
... |
9b9a06cc6293ca0f542180808187b0bbf7c561832c952669d8098dee7ec7b78e | Python | 1,563 | 32 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import glob, sys, os
from plot import errors_ae_don, violin_plots
### Define inputs
latent_dim = [9,25,49,64]
method = ['vanilla-AE','MLAE','CAE']
n_epochs_ae, n_epochs_don = [3000,3000,5000,300], [18000,18000,10000,300]
#late... |
90d7d8c64a3fdf189e23629af7cabaa6075e418a405009dadcd595eb6b42c699 | Python | 1,564 | 47 | from pgmpy.base import DAG
from pgmpy.metrics import BaseUnsupervisedMetric
from pgmpy.structure_score import get_scoring_method
class StructureScore(BaseUnsupervisedMetric):
"""
Uses the standard model scoring methods to give a score for each structure.
The score doesn't have very straight forward interp... |
27bfc2fef6663c711265b5320491ce1424c07d61f16afeee2bf510cbea962358 | Python | 1,565 | 60 | import torch
from torch import nn
class Bias2DLayer(nn.Module):
"""
Bias per channel for a given 2d input.
"""
def __init__(self, channels, initial=0, **kwargs):
"""
Args:
channels (int): number of channels in the input.
initial (int, optional): intial value. D... |
5da8545c41f1436e2bc6f44cc1bb1f0efd2b00668264979bc3206ef32871330e | Python | 1,565 | 50 | """This module provides dynamic access to deprecated JSON tools in LangChain.
It ensures backward compatibility by forwarding references such as
`JsonGetValueTool`, `JsonListKeysTool`, and `JsonSpec` to their updated
locations within the `langchain_community.tools` namespace.
This setup allows legacy code to continue... |
5f1fcbd21204103a9e15a174b3050b3646a5ff46777966772479df1788d36fc5 | Python | 1,565 | 48 | from langchain_core.documents import Document
from langchain_core.language_models import FakeListChatModel
from langchain_classic.retrievers.document_compressors import LLMChainFilter
def test_llm_chain_filter() -> None:
documents = [
Document(
page_content="Candlepin bowling is popular in Ne... |
cb242389103305798b3f1ae0fa4d80bd9fb0cbfa357fc087af0bc84d3abf9c46 | Python | 1,566 | 42 | ###########################################
# IMPORTS
###########################################
from perses.annihilation.lambda_protocol import LambdaProtocol
from nose.tools import raises
import os
running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true'
########################################... |
f4f4167fa05a0ebe01a2c7d908d0a69176e886fe6a4d09ee719971a17d6606b4 | Python | 1,567 | 51 | import math
import numpy as np
import matplotlib.pyplot as plt
cb = 66
cp = 0.67 * 60
v = 70
def hub_func(delt, a, b):
# delt = y_pred - y_true
if delt <= 0:
return a * delt * delt
elif delt > 0:
return b * math.fabs(delt)
else:
return 0
def cost_loss(y_true... |
5223af0f82632af28054947dc99e031b462ee704b9d73eb3fc5959df77ead626 | Python | 1,568 | 45 | import os
import numpy as np
from audio_utils import WaveProcessor
from tqdm import tqdm
def create(
feature_dir: str,
tg_folder: str,
out_folder: str,
segments_list: list,
config: dict,
is_inverted: bool = False
) -> None:
""" Creates a numpy file with nerve rates.
This function crea... |
5ed03940d5c0c28190185c39e6bb9ce451f1a41e12b0156595ca8039a8d6be9c | Python | 1,569 | 44 | from typing import Optional
from neuralpredictors.utils import get_module_output
from ..common.random import set_random_seed
from .core import TaskDrivenCore
from .model import Model
from .nonlinearity import EluNonLinearity
from .params import SessionsDataLoaderSettings
from .params import TaskDrivenModelGaussianRea... |
6a13050dd55f48c5758b00adb9b5c21232fe3a405480d81549c1029364424a7a | Python | 1,569 | 41 | """
Acquire a time series of Z-stacks, and use and image processor to make a second channel
showing the maximum intensity projection of the z stack
"""
from pycromanager import JavaBackendAcquisition, multi_d_acquisition_events
import numpy as np
def img_process_fn(image, metadata):
# accumulate individual Z imag... |
3b3136986415306d6f0f005d42aaff51032aefd1206f37f9b5b8d6a33be85b3b | Python | 1,570 | 44 | import os
import sys
import unittest
import numpy as np
import seaborn as sns
from sklearn.metrics import pairwise_distances
from statsmodels.stats.correlation_tools import cov_nearest
from helpers.morphometricity import variance_component_model
class TestMorphometricity(unittest.TestCase):
def test_variance_c... |
dbe76e26ea24dd709735578acd01bfb81b01e830032c281b5208fb7cf956a7b0 | Python | 1,572 | 48 | import os
import pydicom
import numpy as np
import pandas as pd
from glob import glob,iglob
from tqdm import tqdm
from itertools import chain
import skimage.transform as sktf
from joblib import Parallel,delayed
from engine import utils
from constants import BASE_DATA_DIR,COVID_XRAY_SZ
from constants import COVID_INT_D... |
ec6e811c53e4e647c6dc8c7a3bf8959c08a6de33660cf2de1bf3ac85fb1926d6 | Python | 1,572 | 43 | """Test LLM Math functionality."""
import pytest
from langchain_classic.chains.llm_math.base import LLMMathChain
from langchain_classic.chains.llm_math.prompt import _PROMPT_TEMPLATE
from tests.unit_tests.llms.fake_llm import FakeLLM
@pytest.fixture
def fake_llm_math_chain() -> LLMMathChain:
"""Fake LLM Math ch... |
97d5d70d8e98b2462d3b7ab3ca1f1bcb5506a0f1412213bc61b19f0995b1d2a3 | Python | 1,573 | 60 | from voxcell import VoxelData
import numpy as np
import sys
argc = len(sys.argv)
atlas_nrrd = sys.argv[1]
flatmap_txt = sys.argv[2]
output_nrrd = sys.argv[3]
angle = None
if argc > 4:
angle = int(sys.argv[4])
if not angle in [0, 90, 180, 270]:
raise ValueError('Angle must be 0, 90, 180 or 270')
flipx... |
3fcc54534b39c90f395710140c2b74679067a2b0e87268fdf45216b625d37cd4 | Python | 1,574 | 38 | file_name = 'CellJ.json'
model_name = 'hof_param_471077857_'
import os, shutil
import pandas as pd
vdf = pd.read_csv('./required_files/Values.csv')
#Create threads
os.mkdir('R:/Temp/Threads3/')
for i in range(40):
base_name = 'R:/Temp/Threads3/Thread'+str(i)+'/'
os.mkdir(base_name)
os.mkdir(base_name+'ne... |
8548e13adf847675a5160d5b3bf45551fdc0a05ca0d628a1774d64b29df59e52 | Python | 1,577 | 38 | file_name = 'CellJ.json'
model_name = 'hof_param_569998790_'
import os, shutil
import pandas as pd
vdf = pd.read_csv('./required_files/Values.csv')
#Create threads
os.mkdir('R:/Temp/Threads10/')
for i in range(40):
base_name = 'R:/Temp/Threads10/Thread'+str(i)+'/'
os.mkdir(base_name)
os.mkdir(base_name+'... |
86c28bd0e4063da67f03c9bb7c8ac552e0ec402014170e160f170d12de92d66b | Python | 1,577 | 57 | # coding: utf-8
""" MIT License """
'''
Project: Parenchymal Attention Network
Authors: Axel Masquelin
Description:
'''
# Libraries
# --------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
# -----------------------... |
aafd97b5cd5f8c9d4c69ba6c2eee8bd00054d0d52b62cdef0482ded3019b6ffc | Python | 1,577 | 39 | #!/usr/bin/env python3
import sys
import os
import tempfile
from joblib import Parallel, delayed
def convert(a, b):
with tempfile.NamedTemporaryFile() as f:
return os.system(f"bigWigToBedGraph {a} {f.name}") + os.system(f"sort -k1,1 -k2,2n {f.name} > {b}")
def main(argc, argv):
if argc < 4:
... |
acb1cc0c53a84344897bf1fcd558c5dfc43d4905fe592c35660b12b07b976a47 | Python | 1,577 | 38 | file_name = 'CellJ.json'
model_name = 'hof_param_488698341_'
import os, shutil
import pandas as pd
vdf = pd.read_csv('./required_files/Values.csv')
#Create threads
os.mkdir('R:/Temp/Threads16/')
for i in range(40):
base_name = 'R:/Temp/Threads16/Thread'+str(i)+'/'
os.mkdir(base_name)
os.mkdir(base_name+'... |
fcbb0b6ed6f94cd39dc42cfbe0597032a91566b3ce1db0d6ccc37a9f7b7d19a0 | Python | 1,577 | 38 | file_name = 'CellJ.json'
model_name = 'hof_param_354190013_'
import os, shutil
import pandas as pd
vdf = pd.read_csv('./required_files/Values.csv')
#Create threads
os.mkdir('R:/Temp/Threads16/')
for i in range(40):
base_name = 'R:/Temp/Threads16/Thread'+str(i)+'/'
os.mkdir(base_name)
os.mkdir(base_name+'... |
1aff7145fddd53c36f02c5631186146350b27f6bdc4d0e9c7328ffedf16eb91b | Python | 1,579 | 32 | import pandas as pd
# Function takes the csv file with raw data, total number of ants, total number of 2 week old ants, and
# total number of 2 month old ants as input and outputs a dataframe with the number of ants outside the nest (total,
# 2 week old, and 2 month old), the number of ants inside the nest (total, 2 w... |
e6bb0250ae5448318cbb7ce2c5262bf2b4415d2f34bbc0ac3752f109600a10e7 | Python | 1,579 | 64 | """
Example for using langid.py to identify the language of messages
on a twitter livestream. Optionally, it can also filter messages
and display only those in a target language(s).
Expects a Twitterstream on STDIN, such as the one provided by:
# curl https://stream.twitter.com/1/statuses/sample.json -u<username> -s
... |
d5d1945f258e0640f30109285b855ce3d9be26066e47e7d560b672ef79768b2c | Python | 1,580 | 48 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
76a5ca1111db30a702b0ee86f839112af2f9856548d844e40caf724853a3a7bf | Python | 1,582 | 48 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.document_loaders import (
AirbyteCDKLoader,
AirbyteGongLoader,
AirbyteHubspotLoader,
AirbyteSalesforceLoader,
AirbyteShopifyLoader,
Ai... |
0aa33fb2b063bc01eb46993a3582b870518dbc783f1dde1decdaac91a867c888 | Python | 1,584 | 58 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import savgol_filter
from Articles.DMS_DLS.Code.FiguresDMS import burr_funct, burr_funct_fix
burr = 1
t = 0
init = 0.5
if burr == 0:
x = np.linspace(0, 10., 10000)
a = np.random.uniform(0.5, 1.)
c = np.random.uniform(1., 2.)
d = n... |
5882bd3834a298b2ba03697a3b672134b07d5322a94e773e7f829319c492cbd7 | Python | 1,584 | 64 | #!/usr/bin/env python
import sys
from itertools import takewhile
import networkx as nx
def parseKWData(file_name, G):
# read in uniprot kw data
with open(file_name) as handle:
for line in handle:
if line[0:2] != "ID":
# keep going
continue
... |
9d19059a56a9e4c43a967845d9df835d2bc63ebf58f24978997d34e387490413 | Python | 1,585 | 39 | # data at https://zenodo.org/record/3606767/#.Y87pt3bMJPa
from glob import glob
import numpy as np
import pandas as pd
import src.utils as utils
def load_data(cvx_dim, multi_clf="/srv/beegfs/scratch/groups/rodem/anomalous_jets/taggers/supervised/transformer_multiclass/outputs/combined_scores.h5",
uppe... |
2064bc91de0a795c710d79ff799f6b95aae65191680b33fc6bf46d87f923d70e | Python | 1,589 | 46 | import importlib
from types import SimpleNamespace
import pandas as pd
def prepare_dataset(dataset):
config_map = {'chbp': "config_chbp_eeg",
'lemon': "config_lemon_eeg",
'tuab': "config_tuab_eeg",
'camcan': "config_camcan_meg"}
if dataset not in config_map... |
1fc76d7ec82eeea026478fbb4fdc53baf5474188afd25f7712ba69153d5e3dcd | Python | 1,591 | 59 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 24 13:05:53 2020
@author: nishe
"""
import numpy as np
from scipy import signal
#%%
def find_Hilbert(sigIn, Fs, timeDim=-1, discardTime=None): #badChannels=None,
if len(sigIn.shape) >= 5:
raise Exception('Error: wrong "sigIn" format')
try:
t... |
27bf428d90f30c0630b804b0dd278517a94c6da5c052c6e33d311fe5b7d8af03 | Python | 1,592 | 46 | from __future__ import annotations
import ast
from dataclasses import dataclass
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from .json import load_json
@dataclass
class Session:
subject_id: str
session_id: str
responses: np.ndarray
image_ids: np.ndarr... |
998372c69e32358037afe4b4dc467d6cb4d64e6dae03eabd9e97736ce44432da | Python | 1,593 | 49 | import numpy as np
import scipy as sp
import scipy.stats
import mdshare
import pyemma
from pyemma.util.contexts import settings
import MDAnalysis as mda
import matplotlib.pyplot as plt
def write_cluster_traj(cluster_idx, top_file, trj_file, out_name, start_frame=0):
"""
Writes a trajectory into a separate f... |
fe615276fb617af1eb98ec4dc6b601ac924dffb476b81e5281b45e3ad04791dc | Python | 1,593 | 57 | from openff.toolkit.utils.constants import (
ALLOWED_AROMATICITY_MODELS,
ALLOWED_CHARGE_MODELS,
ALLOWED_FRACTIONAL_BOND_ORDER_MODELS,
DEFAULT_AROMATICITY_MODEL,
DEFAULT_CHARGE_MODEL,
DEFAULT_FRACTIONAL_BOND_ORDER_MODEL,
)
from openff.toolkit.utils.toolkit_registry import toolkit_registry_manager... |
3eb22141da658cdc00abae4026bdb907af3de72ab5b36d2ed43cf9cff746f044 | Python | 1,596 | 52 | import os
from LSTM import preprocess, train, predict, evaluate
from logger import ResultLogger
import uuid
import numpy as np
setting = {
'train_size': 0.8,
'epochs': 50,
'input_size': 60,
'batch_size': 32,
'pre_len': 1,
'fileName': "section_flow_fill",
... |
a8c136eb79a940e9524221606ff81b8d8a7b0dbe604a6d1d66e9642786bc2867 | Python | 1,596 | 48 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
bef9fd016011cb243ccd671efebb536920dd45e5201901188f6ead4e91d3b9e5 | Python | 1,596 | 48 | import numpy as np
from dival import TaskTable
from dival.measure import PSNR, SSIM
from dliplib.utils import Params
from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset
from dliplib.reconstructors.dip import DeepImagePriorReconstructor
from dliplib.utils.reports import save_results_tab... |
cec773ce4f69112738b81a6bcbd8acb6e3a35065a7c3ae0fa4746a34556d6b02 | Python | 1,598 | 54 | import sys
import os
import argparse
from tqdm import tqdm
import requests
STORAGE_URL = "https://zenodo.org/records/10642388/files"
BLOCK_SIZE = 1024
def get_out_path(out_dir, url):
fname = url.split('/')[-1]
if out_dir is None:
return f"./{fname}"
if not os.path.exists(out_dir):
pri... |
36a82de446a263cc9ee37c75e83449ab3760d16346b7a44e93de0336531ee397 | Python | 1,599 | 51 | import argparse
import numpy as np
import torch
import joblib
from networks import HebbAugRecog
from data import generate_aug_recog_data_batch
#%%
parser = argparse.ArgumentParser()
parser.add_argument('--R', type=int)
parser.add_argument('--T', type=int)
parser.add_argument('--batchSize', type=int)
pars... |
cf68962c92806247f029d5438a646559efaa4a067a53d94d1f267acf40f95b23 | Python | 1,599 | 55 | from typing import Dict, Tuple
import numpy as np
try:
# pymbar >= 4
from pymbar.timeseries import (
detect_equilibration,
statistical_inefficiency_multiple,
subsample_correlated_data,
statistical_inefficiency
)
from pymbar import MBAR
from pymbar.utils import Param... |
0a69e424ea68049295db6cb3b693791e1e9b1e40401f5ed3d769bd7aea123b19 | Python | 1,601 | 33 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
x = [100,200,300,400,500,559]
pep100 = [0.5049, 0.5051, 0.5056, 0.5071, 0.5035]
pep200 = [0.5355, 0.5368, 0.5364, 0.5348, 0.5398]
pep300 = [0.5846, 0.5993, 0.6077, 0.6057, 0.5893]
pep400 = [0.6040, 0.6141, 0.6077, 0.6090, 0.6267]
pep500 = [0.6445, ... |
756591c2efc2937f77cb32d855a0988a8c59970950027226cea08ed50e856998 | Python | 1,603 | 54 | import logging
from itertools import product
import numpy as np
import pytest
import torch
from torch import nn
from neuralpredictors.training import early_stopping
logger = logging.getLogger(__name__)
class CounterModel(nn.Module):
def __init__(self):
super().__init__()
self.counter = nn.Param... |
cf94fecfb085a521408a243a6bc3ca703f31539368ef8a61655cf04de322b8ea | Python | 1,605 | 50 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 16:28:30 2023
@author: biener
"""
import torch
import numpy as np
import mAECell_Utils as utils
from NN_Rslt_Anal import NN_Stat as stat
from NN_Rslt_Anal import NN_Rslt_Anal as Ana
relu1 = utils.ReLU1()
Ana_O = Ana()
NN_Stat_O ... |
6e2bc8a20d25b8df62c98d9d2c45bb97a2b105df681f3bcbcb43619789ab51de | Python | 1,607 | 36 | #! /bin/env python
#
# Michael Gibson 23 April 2015
# Modified Adrian Foy Sep 2018
def get_bytes_per_data_block(header):
"""Calculates the number of bytes in each 60 or 128 sample datablock."""
# Each data block contains 60 or 128 amplifier samples.
bytes_per_block = header['num_samples_per_data_block'] ... |
92c624b61f0727d24ec150db9183de0b4ca729739fc55527a1cfb8dcadf723e9 | Python | 1,607 | 52 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.agent_toolkits.openapi.planner import (
RequestsDeleteToolWithParsing,
RequestsGetToolWithParsing,
RequestsPatchToolWithParsing,
RequestsPostToolWithP... |
2cf377753124f71de0da933be5ffac8542cc865fdf54b144beb4e860bec062a6 | Python | 1,609 | 61 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 30 11:12:50 2021
@author: shni2598
"""
from coordination import lattice_dist
import numpy as np
#%%
def get_LFP(lattice, LFP_elec, width = 64, LFP_sigma = 8, LFP_effect_range = 2.5):
#w = np.zeros((len(LFP_elec),N))
w, i, j = [], [], []
... |
f3f73e45ab62ea310a032da108b02993e85527bf27b766ee07dc74bbe70ec296 | Python | 1,609 | 46 | # predicting diffusion barriers from machine learning model
import numpy as np
def linear_combination(data, parameters):
weights, biases = parameters
data = np.dot(data, weights) + biases
# print(data.shape, weights.shape)
return data
def batchnormalization(data, parameters):
gamma, beta, ... |
a95e0ba573a56beb2d9130bb81c75b9ce889dd907d00230a475230bda05cef3d | Python | 1,612 | 37 | import torch
from collections import namedtuple
import pandas as pd
import os
import numpy as np
def test(model, args, test_data):
# tests model and saves activations
transition = namedtuple('transition', ('observation', 'activation', 'reward'))
configuration = namedtuple('configuration', ('episode', 'buf... |
20b170aa0826d6cf41546e290a1c076542a334b12bd4ec964067617c38f44c68 | Python | 1,613 | 55 | import torch
import torch.nn as nn
from core.network.head import head_register
from utils.tensor_operator import tensor2array
@head_register
class SelfAttentionAggregationHead(nn.Module):
""" Window based multi-head self attention (W-MSA) module with relative position bias.
It supports both of shifted and no... |
872d46f87757bec607d61ecf0c4632322d301b71d2ea76d0a3adbffae40e167b | Python | 1,613 | 50 | from __future__ import annotations
import operator
from collections.abc import Sequence
from langchain_core.callbacks import Callbacks
from langchain_core.documents import BaseDocumentCompressor, Document
from pydantic import ConfigDict
from typing_extensions import override
from langchain_classic.retrievers.documen... |
7cb6525dd9dab1d3766306ae653a001b99cfb65e3ae5cd2151b5de20e829379a | Python | 1,614 | 55 | # main file for 3D Reconstruction GAN
# Created: 6/16/2021
# Status: ok
# CUBLAS_WORKSPACE_CONFIG=:4096:8 python rgan_main.py
import sys
import torch
import wandb
import numpy as np
from networks import RGAN_Wrapper
from utils import read_json
SWEEP = 0
def RGAN(model_name, config, Wrapper):
print('Loss metri... |
9e2dbec5ff5ab6f77afcd394002df8a0f34177bc190c0f700ef655415f26fd7d | Python | 1,614 | 52 | # istarmap.py
import multiprocessing.pool as mpp
import sys
def istarmap_p37(self, func, iterable, chunksize=1):
"""starmap-version of imap
"""
if self._state != mpp.RUN:
raise ValueError("Pool not running")
if chunksize < 1:
raise ValueError(
"Chunksize must be 1+,... |
c1a56be52a0694d06abe2845124c495be83c65fb55a9bc18c7867e751f7396b0 | Python | 1,614 | 32 | import random
import numpy as np
import torch
def set_random_seed(seed: int, deterministic: bool = True) -> None:
"""
Set random generator seed for Python interpreter, NumPy and PyTorch. When setting the seed for PyTorch,
if CUDA device is available, manual seed for CUDA will also be set. Finally, if `de... |
d6e19a2e6067b8170a3cd44788680dbf2055b847c862b96630c0cc1f9ae2702d | Python | 1,615 | 68 | #TCGA
RNA=['RNA_all_TPM']
DNA_methylation=['methylation_count',
'methylation_max',
'methylation_min',
'methylation_mean',
'promoter_methylation_count',
'promoter_methylation_max',
'promoter_methylation_min',
... |
ae27726953c94b72fd3fc8cdee7aa4731acd08ed09afcf43e6412047eef114c0 | Python | 1,617 | 53 | import pytest
from langchain_classic.evaluation import ExactMatchStringEvaluator
@pytest.fixture
def exact_match_string_evaluator() -> ExactMatchStringEvaluator:
"""Create an ExactMatchStringEvaluator with default configuration."""
return ExactMatchStringEvaluator()
@pytest.fixture
def exact_match_string_e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.