sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
51b3066f3c27435a57c1f48e27dd51f370645d794e43e01f92fbc3c3fd0063cd
Python
3,525
138
"""=========================== Pipeline template =========================== .. Replace the documentation below with your own description of the pipeline's purpose Overview ======== This pipeline computes the word frequencies in the configuration files :file:``pipeline.yml` and :file:`conf.py`. Usage ===== See ...
59bcf9a4eb6b1365c964ccee5c8a892357674f0e152cbb5cbae2f5b79fc4ef29
Python
3,526
125
""" Test cwas.preparation """ import random from multiprocessing import cpu_count from pathlib import Path from typing import Tuple import pytest from cwas.env import Env from cwas.preparation import Preparation import cwas.cli import sys class PreparationMock(Preparation): """Mocking the Preparation class""" ...
e1b1e0a8043a46c5652b04929a7c7b5cdcef2468332b0553cfb765e8080e5454
Python
3,527
81
import matplotlib.pyplot as plt import torch from skimage.io import imread, imsave import os import numpy as np import cupy as cu from cucim.skimage.morphology import dilation, ball """ 3D patches generation from Svetlana annotations for visualisation """ binary = torch.load("/mnt/86e98852-2345-4dcb-ae92-58406694998...
81f46ba84b706b09aa2fb9249b474509d537a4fe953c6541f2091c56cfe2cac5
Python
3,532
75
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://...
97b2df2c5a0617c9baa5c48db0b9b7bce1423f95661473bd7a9e9df9aaba26a6
Python
3,533
81
# Imports import sys import os import argparse import inspect from datetime import datetime import numpy as np from tqdm import tqdm from math import ceil from time import perf_counter, process_time import torch import torch.optim as optim try: from torchdiffeq.__init__ import odeint_adjoint as odeint except Impo...
bdda867ce1329486b139493314e1cb09c64036858439193a581d04c2a76e8209
Python
3,533
103
import numpy as numx import pydeep.base.numpyextension as numxExt import DBM3LayerBinary.model as MODEL import DBM3LayerBinary.trainer as TRAINER import DBM3LayerBinary.estimator as ESTIMATOR from pydeep.base.activationfunction import Sigmoid import pydeep.misc.io as IO import pydeep.misc.toyproblems as TOY import pyde...
26c4ab7bda36ec82fc5eee8a2b0c5533d3981c836f5b1a50dd27332429bbd2a2
Python
3,534
103
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.openapi.planner_prompt import ( API_CONTROLLER_PROMPT, API_CONTROLLER_TOOL_DESCRIPTION, API_CONTROLLER_TOOL_NAME, API_ORCHESTRATOR_PROM...
10ef948fdedb4a4dca49a94fe91443b8cf76c5163e4da8e1ae53300418ac9cc6
Python
3,538
94
import os os.nice(19) import numpy as numx import pydeep.rbm.model as MODEL import pydeep.rbm.trainer as TRAINER import pydeep.rbm.estimator as ESTIMATOR import pydeep.misc.visualization as VISUALIZATION import pydeep.misc.io as IO import pydeep.misc.numpyextension as npExt import mkl import scipy.io as sio mkl.set_nu...
aac5e7d83dafdecb7081e468491ac1cbde6487ba62f92083423390f7ab2c962f
Python
3,539
93
# coding=utf-8 import torch import torch.nn.functional as F from alg.algs.ERM import ERM class MMD(ERM): def __init__(self, args): super(MMD, self).__init__(args) self.args = args self.kernel_type = "gaussian" def my_cdist(self, x1, x2): print('---------MMD my_cdist()--------...
f4243152ab800f7437cc432a0165dd1fdd662d9d3916fec75bf7d26faee73743
Python
3,539
97
# 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 ...
b15e9020698194c52fea94042e800e9706dffdc5e8aa47398050d9cceba164e4
Python
3,542
93
import sys import os import matplotlib.pyplot as plt import pandas as pd import numpy as np sys.path.insert(1, os.path.join(sys.path[0], '../../../../')) import Articles.Sequential_Learning_Striatum.Figures.cfg_pdf as cfg from NetworkModel.StriatumNeurons import find_params_neuron def step_AP(t, beg, end, I_value): ...
e3e0ea3da56eceec74d5e563b1fa22da3e1579aa7d86c9628ab246679aea7eb6
Python
3,543
112
""" ############################################################################## # # Select columns with pas expression table for the latter MARA model script # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # C...
b27732befc23bdf95e93c1870eb6795bc7aec2b6f2d0f03f40a67d3d8815b686
Python
3,545
116
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Adapted from https://github.com/florentmeyniel/TransitionProbModel """ from . import Inference_ChangePoint as io_hmm import numpy as np from scipy.stats import dirichlet def run_inference(seq, options=None): """ run_inference is a wrapper that computes the p...
ec62a3221bf94356b6c660c169dcb69103a58419434fbd147cd26b0ccbcc852a
Python
3,545
109
"""Triton GTO pair density: same math as ``(R[:,rad] * Y[:,sph] * c).sum(-1)``. Spherical harmonics stay in e3nn so Y matches the original kernel exactly. The kernel never materializes ``phi[N, n_orb]``. """ from __future__ import annotations import torch try: import triton import triton.language as tl ...
13dc6ffb3ba1f87b6676b03a997bce5eb386e05c65fdfa3ce0f115f4a5f78935
Python
3,546
112
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division, print_function import argparse from time import time # import pylab as pl import nibabel as nib import numpy as np from dipy.data import get_sphere from dipy.reconst.shm import real_sh_tournier, real_sh_descoteaux, order_from_ncoef fro...
31ca6eba6a21436549b25d2adc4b7460b06c63bce05e79773f78942f1155f27e
Python
3,546
113
import torch import torch.nn as nn from torch.utils.data import Dataset from torch.utils.data import DataLoader import torchvision import numpy as np import os import cv2 as cv class SampleDataset(Dataset): def __init__(self, sample_dir, target_dir, transform=None): self.sample_dir = sample_dir se...
8e5a454060565e78baf86a09a5d1d9012ae7601e657e09269961e476c758e2f3
Python
3,546
85
# Copyright (c) MONAI Consortium # 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 in writing, so...
3fdd5c4ee928e307b100d7fd8c4558842fce46881bc8f3bb2cbbf1ea2c7a87b5
Python
3,547
113
import os.path as osp import numpy as np import ase.io from tqdm import tqdm import torch from torch_geometric.data import InMemoryDataset, Data from torch_geometric.loader import DataLoader class Pyg3BPA(InMemoryDataset): def __init__( self, root="dataset/", name="train_300K", tra...
edd7ab7795df09809082c502e46fa2ab902f09aa4e35591863f80b990f53d0df
Python
3,547
113
import os.path as osp import numpy as np import ase.io from tqdm import tqdm import torch from torch_geometric.data import InMemoryDataset, Data from torch_geometric.loader import DataLoader class PygAcAc(InMemoryDataset): def __init__( self, root="dataset/", name="train_300K", tra...
78903cad14de781be49ff7f8d2371170821a95da49cca52bdcfb239ddf8d0069
Python
3,548
134
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import division, print_function import argparse from time import time # import pylab as pl import nibabel as nib import numpy as np import skfuzzy as fuzz DESCRIPTION = """ Compute fuzzy segmentation from an arbitrary amount of images. """ EPILOG = ...
d90f9663affe6d358f9a38702056f421b6ecf0f6b6454053066d2923e3e32e57
Python
3,549
90
# Copyright 2021 AlQuraishi Laboratory # Copyright 2021 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
096c60f55ac717e8a3eaabd46837b751df8abe4cd4a6ef148024a42747906c6f
Python
3,550
99
""" In this file the functions to create particle, swarm, and the main BPSO algorithm is defined """ import time import pandas as pd from model_functions import* No_switches = n_actions #----- BPSO parameters N_particles = 80 itermax = 400 # Particle parameters particle_dims=No_switches #dimension ...
dd5047e040da522882424fb717906cbc7f2394488353cd6d740d02d369baad28
Python
3,555
70
import pandas as pd import numpy as np import re import argparse def get_data(reference_path,rawdata_path,save_path,cancer): data_CNV = pd.read_csv(rawdata_path+'/'+cancer+'.CNV_masked_seg.csv', sep=',') data_CNV['ID'] = 'chr' + data_CNV['Chromosome'].astype(str) + '_' + data_CNV['Start'].astype(str) + '_' + d...
36ce73052011fca2979dcb6d435def9e0bfb69f1ebe1656282e0da75f278c4cb
Python
3,557
82
import os import pytest from imagingplus.processing.paq import PaqData from imagingplus.processing.microscopes import PrairieViewMetadata from imagingplus.workflows.TwoPhotonImaging import TwoPhotonImaging @pytest.mark.skip def test_TwoPhotonImagingTrial(twophoton_imaging_multitrial_noPreDoneSuite2p_fixture, exist...
8c4dd99e5b3c1794f9f6f39f23143b44a248f6e10ae69d005a1e90ebd8ce3775
Python
3,557
96
# 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 ...
442606d75de5e06817a57ca3b6046d809d78ac0dd6b4bfccfc13646577e5be21
Python
3,558
114
import numpy as np import torch import sys; sys.path.append('/Users/danil/My') from dt_utils import Timer from data_utils import generate_recognition_data, data_to_tensor, chance from plastic import PlasticNet, LearnedHebb from torch_net_utils import plot_hebb from fastweights_numpy import FastWeights as Fa...
55323decdc84d646fab35a7edf54d7a0d2dfa08c8762aebc907e0d74c50f7f3a
Python
3,558
111
import glob import os import SimpleITK as sitk import numpy as np import argparse from medpy.metric import binary def read_nii(path): return sitk.GetArrayFromImage(sitk.ReadImage(path)) def new_dice(pred,label): tp_hard = np.sum((pred == 1).astype(np.float) * (label == 1).astype(np.float)) fp_hard = np.su...
e28c2bfecc9ac4586f812b844d1d69d481107efa78cc5118de983d8228492540
Python
3,558
97
# Fine-tuning procedure for Stanford Cars using ResNet 50 import keras import pickle from keras.callbacks import EarlyStopping, ModelCheckpoint from keras.models import Model from keras.optimizers import SGD from sklearn.model_selection import train_test_split from load_data_cars import load_data_cars from image_gen_...
2f7a7efb57ab7002c828dedd656f10e2915be94e686aba83978a8e70697bc161
Python
3,559
67
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
47f52625958a70de61c9f54a20b3f292d637dc91d36c93dea332f041b68513e7
Python
3,560
117
############################################################################# # #Updated by: Yiqin Wang # ############################################################################## import sys, os #set probe names probe_all = [] #46 mtDNA probes for i,n in [("A",12),("B",12),("C",12),("D",10)]: for j in range(1,n...
6fa40606390148af76e5c86297e8e259b34e2fdcafcd7a8935108c32c987cf8b
Python
3,560
74
# Creation of binary visual-semantic mapping (no semantic embedding) and further analyses # Copyright (c) 2021 Laurent Caplette import numpy as np import pickle ncomps_feat = 213 nperms = 1000 # load visual features all_im_words = np.load('all_im_words_final.npy', allow_pickle=True) all_feats = np.load('all_feats_fi...
85d6cda67f5dde87362498ea7c102fab0411d7f1db48096b2e09ef0665fe28ce
Python
3,560
111
import numpy import pandas def vtxs_edges_to_linesegments(vtxs, edges): return [(vtxs[i], vtxs[j]) for i, j in edges] def vtxs_edges_rootid_read_compact_detail(compactdetail, **kwargs): nodes, conns, tags, _something, annos = compactdetail if conns: raise NotImplementedError("Connectors are not...
d6f98b9d12c99c961c5f3dbd989c6c3b9be419b18c5fa47259bde8d74e58db00
Python
3,560
85
# Sconda conda activate ghmc1; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/GhmCN/reviewer_questions/distribution_of_genes_and_distances_activ72B; python import pandas as pd import numpy as np import torch import torch_geometric from scipy.sparse import load_npz device = torch.device("...
a28249b138251967665a594cdf6c7e1eff8f097a90eca4b6745b814f7315b622
Python
3,561
97
import os, tqdm import numpy as np import matplotlib as mpl from textwrap import wrap import matplotlib.pyplot as plt from skimage.io import imread from matplotlib import rc rc('pdf', fonttype=42) from itertools import repeat import multiprocessing from morgana.DatasetTools import io # from orgseg import ImageTools d...
c50651758aed47ba58ac8daa2f063dfcb7897ad5a01b88e987301cb5d23ab671
Python
3,561
135
from typing import Tuple import cv2 import gradio as gr import numpy as np import torch import torchvision from PIL import Image from src.data.utils import CLASS_COLOR, CLASS_ID_REVERSED from src.models.smp.model import HistologySegmentationModel model = HistologySegmentationModel.load_from_checkpoint( 'models/u...
f1b9107f6ee76ef1713d3f2ca4e9e1f7612a59756c3b7d53df37536c1511992a
Python
3,561
152
# -*- coding: utf-8 -*- """ Created on Mon Nov 28 23:11:35 2022 @author: Agus """ ''' Imports ''' #matplotlib.use('Qt5Agg') import os import numpy as np import glob ''' FUNCTIONS ''' def deltaf_f(traces): #calculate delta F/F for every trace #traces is array containing traces for all neurons in one mouse ...
48b9d25dbd1fb8317e5a1574918e898c4261b285ccff719c1d77533920bbb4df
Python
3,564
73
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
4edbbd81c230fc9d275641bd00067c185b639586af60539c7d30102e84108565
Python
3,564
116
""" ############################################################################## # # Collapse result tables from distinct windows # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # CREATED: 18-04-2020 # LICENS...
7894ceac90ea5fa60d1dc61ea6593af39c2cbdd81d0a824f0cfef8e5488c94a1
Python
3,566
95
import os import numpy as np import random from PIL import Image from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True import torch.utils.data as data import torch class featuresdataset_inference(data.Dataset): def __init__(self, data_path, data_frame, raw_images=False, transform=None): # opens...
2029c150cce97d981200c0e01aaa992795e19a29e0b67a66560f675c32309cac
Python
3,568
79
# Copyright (c) 2008-2026 the MRtrix3 contributors. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Covered Software is provided under this License on an "as is" #...
821d0a656b2b64a3e53c1bb507400edb9586015849dfabc471cd6f574fc5d4f7
Python
3,568
100
#################################################################################### # # 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...
9fe82cfa25076e0a261f01f4a58919092e82e7e510d001db4693f587428190ff
Python
3,568
123
#!/usr/bin/env python3 """ Calculate probability-weighted metrics given a metric image and a probabilistic atlas Authors ---- Mike Tyszka, Caltech Brain Imaging Center License ---- This file is part of atlaskit. atlaskit is free software: you can redistribute it and/or modify it under the terms of the GNU Ge...
570b28962d0106bf8066e2be4a122feed157c3f0eaf0968266b5ff05b1f6b7b9
Python
3,569
100
#################################################################################### # # 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...
6a51a9141eb1fc6468299ae1028dae9097ef916879aae8ce670d66208aa3c174
Python
3,569
93
import argparse import numpy as np from pensa.features import \ read_structure_features from pensa.dimensionality import \ calculate_pca, \ pca_eigenvalues_plot, \ sort_trajs_along_common_pc, \ compare_projections from pensa.comparison import \ pca_feature_correlation # -------------# # --- MA...
a9b70c144450760d7dc9ab9e35a4c9252847537c97ee9375213784eb2b2e0429
Python
3,570
62
"""Generate LaTeX tables from final result files (rerun after every result update). tables/table4_conformal.tex : PICP / MPIW / Winkler / late-life PICP by method under P3 and P4 (GBDT anchored, 5 seeds) tables/table5_fewcell.tex : few-cell curve (adapted_split and references) """ from __future__ import annotatio...
c9094dfc417c275c647cda95d0a877865311d85670b72e37263a3acf3f9ebbfd
Python
3,570
156
import re def parse_task(log): if re.search('ihm_C', log): return 'multitask' if re.search('partition', log): return 'los' if re.search('deep_supervision', log): return 'decomp' if re.search('ave_auc_micro', log): return 'pheno' if re.search('AUC of ROC', log): ...
c740a0b5134c2fc7043cd2cbb9b8b24a52a77b52be0ce20c595d57d846842ecd
Python
3,571
107
# standard packages import os import subprocess # third party packages import numpy as np # pnabind packages from pnabind.utils import moveFile from .mesh import Mesh def runMSMS(atoms, file_prefix='mesh', basedir='.', clean=True, quiet=True, hydrogens=True, area_only=False, mesh_kwargs={}, **kwargs ): ...
51ad565b1f2f7a6140d3822900b940fd3650b0a43f2080d65161850d460ae18b
Python
3,572
116
""" ############################################################################## # # Collapse result tables from distinct windows # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # CREATED: 09-04-2020 # LICENS...
8f151fd84bcfbc0e42e602cd59b56ad03efb2127d21fb4346460882c3a19c6cb
Python
3,573
36
"""Generate main_2col.tex from main.tex: two-column elsarticle (5p) with wide floats promoted to starred environments. Single-column floats keep [!htbp]; starred floats use [!tp] (two-column LaTeX cannot place them here or at the bottom). Float barriers come from placeins in main.tex, so no float drifts past a section ...
1f5ef4c4ed627fe18f7a66c7cab2f34d657ac4c71fbd9a6e993f0391a644b641
Python
3,575
138
import os from typing import Tuple, Optional import numpy as np from scipy import stats import torch import torch.utils.data as td from sklearn.utils.class_weight import compute_class_weight class ImbalancedDataSampler(td.Sampler): def __init__(self, targets: np.ndarray): # [len(data),] self.num_samples...
952c213f992791dcf0ac5e520f4aece26abca656e1dc1a9f54c53f588cf7dd0b
Python
3,575
116
import logging import os import socket import sys import matplotlib.pyplot as plt import numpy as np import seaborn as sns from configs.configs import get_config_dict from helpers.rockland import get_rockland_subjects, load_rockland_data def plot_static_functional_connectivity_estimate( config_dict: dict, c...
ce6fb5667f735080e8696de71b0b8618becb720adfca798ea8293bbb5c3d4a84
Python
3,575
79
""" Domain boundary distance score, as defined in CASP 7 paper: Assessment of predictions submitted for the CASP7 domain prediction category (2007) https://onlinelibrary.wiley.com/doi/10.1002/prot.21675 Under our scoring scheme all predictions within 8 residues of the correct boundary will score, but predictions that ...
efaaf7b5b4be0975f214afca74f4c8e01c83349de20edfa155900121096d7591
Python
3,576
104
from proto_net.protonet.model import Protonet from proto_net.utils.engine import Engine from proto_net.protonet.dataLoader import ProtoNetDataLoader,ProtoNetDataSet from processing.constants import * from processing.data_structure import data_structure from sklearn.model_selection import KFold import numpy as np ...
168adcf95019b79a007629441301fd2fa4eb8b256fdd51bb50d1fe79647b5e84
Python
3,577
68
import mne from config_FaceName import Results_data_path,stats_comparisions,MRI_data_path,Results_data_path from custom_functions import read_stats_list, print_sig_stats cluster_method='tfce' tfce_p_sig=0.05/2.0 # adjust for sensor and source stat tests #sensor stats for comparision in stats_comparisions: print(c...
fa83b6f82edd76ea43a93d460236a3ed4031880c84eed8c542c3fafb636c00a2
Python
3,579
93
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class inter_att(nn.Module): def __init__(self, hidden_dim, attn_drop): super(inter_att, self).__init__() self.fc = nn.Linear(hidden_dim, hidden_dim, bias=True) nn.init.xavier_normal_(self.fc.weight, gain=...
f947702fb8e8f109baa3c599e2115970176f660e0d6b72f206138962bc41617c
Python
3,580
86
import logging import os import socket import sys from fcest.helpers.array_operations import get_all_lower_triangular_indices_tuples import numpy as np import pandas as pd import pingouin from configs.configs import get_config_dict if __name__ == "__main__": data_split = 'LEOO' # leave-every-other-out exp...
d36c81669f346940e08ecc445e365658fe01f0efb50b91231d706009df5e2fcf
Python
3,581
129
from typing import Any import pytest from langchain_tests.integration_tests.base_store import ( BaseStoreAsyncTests, BaseStoreSyncTests, ) from typing_extensions import override from langchain_core.stores import InMemoryStore # Check against standard tests class TestSyncInMemoryStore(BaseStoreSyncTests[Any]...
6cc7a426d7a89d625352bc6f8184d237945ff840fa7efa150db79f8873fc85de
Python
3,583
97
"""PyTorch Hub models Usage: import torch model = torch.hub.load('repo', 'model') """ from pathlib import Path import torch from models.yolo import Model from utils.general import check_requirements, set_logging from utils.google_utils import attempt_download from utils.torch_utils import select_device dep...
a7754fb14e730ddb314930471750478f43ccc8c709b4e714ed535f036c5add39
Python
3,584
89
from mimic3models.metrics import print_metrics_multilabel, print_metrics_binary import sklearn.utils as sk_utils import numpy as np import pandas as pd import argparse import json import os def main(): parser = argparse.ArgumentParser() parser.add_argument('prediction', type=str) parser.add_argument('--te...
aa3c58b3f6222ad934c07186672a2492fe957eac7215d8706724048f0051e894
Python
3,586
116
from langchain_core.messages import AIMessage, ToolCall, ToolMessage from langchain_classic.agents.format_scratchpad.openai_tools import ( format_to_openai_tool_messages, ) from langchain_classic.agents.output_parsers.openai_tools import ( parse_ai_message_to_openai_tool_action, ) def test_calls_convert_agen...
84b93a05f4358b6e11e38cf54a223ddac44ee1b804343d96edc113f897ab3ce6
Python
3,587
104
import numpy as np import pytest import torch import torch.nn.functional as F from chroma.data import Protein from chroma.layers.structure.backbone import RigidTransformer from chroma.layers.structure.protein_graph import ProteinFeatureGraph def test_protein_feature_graph(): torch.manual_seed(10) dim_nodes,...
a2e80d6248421c7e9b54da017a46fb7c80d27a29e0ea8edebb15404f0597bb2a
Python
3,588
91
# Prepare images and labels for validation #3 # Copyright (c) 2023 Laurent Caplette import numpy as np import os, csv, h5py from PIL import Image np.random.seed() homedir = '' ### path of home directory imSize = 224 nRecon = 25 # number of concepts / recons nppim = 3 # number of perm images per recon nIms = int((nR...
bc5495eb1197f9d981df7469bf8b9168c4dbbf2d87aa822e7c43647aed2e90f9
Python
3,588
90
from torch.utils.data import Dataset import pandas as pd import torch from pathlib import Path import numpy as np device = "cuda:0" if torch.cuda.is_available() else "cpu" smi_char = {'<MASK>': 0,'C': 1, ')': 2, '(': 3, 'c': 4, 'O': 5, ']': 6, '[': 7, '@': 8, '1': 9, '=': 10, 'H': 11, 'N': 12, '...
495613c759e57061552f26c1bb392986b7af53b9b3217a9eeb78671fd05e9668
Python
3,589
54
"""Figure 3: schematic of the five evaluation protocols. Each panel shows a grid of cells or vehicles (rows) x cycles or charges (columns); train in blue, test in orange, calibration in green. Datasets are grouped by colour bands on the left; P5 adds a grey band of field vehicles that only ever appears as test data."""...
c786f26db6bd11df7a9f19d0673a8667ec3afd1f2faa266b2169595c41da71f1
Python
3,589
114
import sys import os import subprocess import re ######################################################################## ######################################################################## # Import setuptools # Use existing setuptools, otherwise try ez_setup. try: import setuptools except ImportError: # ...
634838f0ed319219d4c078a6a657c00afeda85bf4a4c037dd27c64841791dc9b
Python
3,590
147
""" Common functions Marco Lui, January 2013 """ from itertools import islice import marshal import tempfile import gzip class Enumerator(object): """ Enumerator object. Returns a larger number each call. Can be used with defaultdict to enumerate a sequence of items. """ def __init__(self, start=0): s...
bc639082347b3848cefb6939b3b4a6658a39421be38d08c5e51e2b7755cfa4aa
Python
3,590
147
# use threshold > 100 if not training until threshold reward # 2 Bit XOR cur_1 = { 'name' : 'cur_1', 'folder' : 'src/configs/AAI_tasks/2_bit_XOR/', 'thresholds' : [ 200 ], 'train_files' : [ '2_bit_XOR-all.yml' ], 'test_files' : [ '2_bit_XOR-0.yml', '2_bit_XOR...
d6e70547d889f0c6fc71e1c71cec7e0c8d435e784f8fb3d5c66fb1c7de4b6da7
Python
3,591
109
import os import nibabel as nib import numpy as np from scipy.ndimage.morphology import binary_erosion def erode_mask(mask_data, iterations=1): '''Erode a mask N times using scipy binary_erosion.''' mask_data = (mask_data > 0)*1 mask_data[0,:,:] = 0 mask_data[:,0,:] = 0 mask_data[:,:,0] = 0 ...
16277ebe43fa9d1ed69c95de439ff4733011403378feb28366ef520b658643be
Python
3,592
122
import math from collections import Counter # ================================================== # Statistical tools # ================================================== # efficient combinatorial function to handle extremely large numbers def log_choose(n, k): r = 0.0 # swap for efficiency if k is more than h...
42a9971e6e2a760a0a6fd3dd5b1c471d9cbc7de54341d47639b00734e82816a3
Python
3,592
103
""" Preform gene term enrichment analysis with GOATools. """ import session_info import pandas as pd import collections as cx from pybiomart import Dataset from functools import lru_cache from statsmodels.stats.multitest import multipletests # GO analysis from goatools.obo_parser import GODag from goatools.base import...
48eb59cfd53227fb072d69445a3d38464f6feb69e99c12250a3bb6d29d7fcb77
Python
3,592
114
#!/usr/bin/env python3 import argparse import os import re import shutil import subprocess import yaml import collections.abc def update_dict_recursively(d, u): for k, v in u.items(): if isinstance(v, collections.abc.Mapping): d[k] = update_dict_recursively(d.get(k, {}), v) else: ...
25bfb130b0fcb92a6d8166d75e95de68569d84030c8431cc94fce90d039aa538
Python
3,594
71
import argparse import os import h5py import numpy as np def get_metric(h5df, metric, key): # A function to calculate the average or median coverage of each h5 file for each key present. metrics = [] n = 1000 for i in range(0, len(h5df["data/X"]), n): # len(h5df["data/X"]) array = np.array(h...
ee7814b027e835ca28c52a4786eaa8fc6246d0d552a93ce1ebb2681e687d0f52
Python
3,595
84
import numpy as np import pandas as pd from utils.features.spatial import get_spatial_features from utils.features.morph import get_inst_stat def update_with_affix(dict, name): new_dict = {} for k in dict.keys(): new_dict[name + ": " + k] = dict[k] return new_dict def get_morph_features(dict, pa...
241562221a4378b3aeb1d24b0a40a4f86eb4ec88a12ad17daa26221ea0a717ed
Python
3,596
74
from config_FaceName import group_name,Ids,RSA_data_path,MRI_data_path,Results_data_path import mne import os.path as op from custom_functions import print_sig_stats,read_stats_list from scipy import stats as stats import numpy as np from scipy import stats as stats import matplotlib.pyplot as plt from mne_rsa.source_l...
8c708cadb26bfe18be5053dda094de28ac98c2cd37c4539df2350dc9422ad13b
Python
3,597
75
#Built-in and external imports import math import torch from torch.utils.data import TensorDataset import torch.nn.functional as F #My imports from data import generate_recog_data_batch, generate_recog_data from networks import HebbNet from plotting import plot_train_perf, plot_recog_generalization, plot_reco...
b7b4aa7d0b5bbe7e3dea0e7871eb327ed468a1f13a8526d41375dfa83c2a2e6c
Python
3,598
118
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or module...
f2f4251c5bf1799b4a4ee5f43c547b3d663899d30e825c1fbcc0f456e7da1fab
Python
3,598
95
import torch def compute_mean_mad(dataloaders, properties, dataset_name): if dataset_name == 'qm9': return compute_mean_mad_from_dataloader(dataloaders['train'], properties) elif dataset_name == 'qm9_second_half' or dataset_name == 'qm9_second_half': return compute_mean_mad_from_dataloader(dat...
8f5ef294a7c1f22205bc2e5c1edab883019695cdf646aec427ea4552488f0307
Python
3,599
75
import os import socket import sys from configs.configs import get_config_dict from helpers.slurm import send_slurm_job_to_queue, save_slurm_job_to_file if __name__ == "__main__": hostname = socket.gethostname() assert hostname == 'hivemind' data_set_name = sys.argv[1] # 'd2', 'd3d', or 'd{%d}s' ...
e9d36c36e799c831ab632f774e190f0fa1bafbdd48fc02f284ef9e94e200d734
Python
3,599
95
import numpy as numx import scipy as sc def seperateDataByLabelsForMNISTandCIFAR10(data, label, status = False): zeros = None ones = None twos = None threes = None fours = None fives = None sixes = None sevens = None eights = None nines = None for i in range(data.shape[0])...
cd98446b9ee165c9a5fa6f8fe7d7aa883bdad734542bdb00a20cfeb7a2cce536
Python
3,600
88
# MIT License # Copyright (c) 2021 Yuyang Wang # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, pu...
3d932b60a94231c03c13f3c6f4c321484b95c2a59021d47aef7abe633154ba74
Python
3,602
69
# Copyright (c) 2008-2026 the MRtrix3 contributors. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Covered Software is provided under this License on an "as is" #...
e5480b72aaa896ef4489ff15ef66099680cf2c1ff399d8e86d5bf45f3aa1b9cb
Python
3,603
86
from typing import Callable, List, Union import numpy as np from rdkit import Chem, DataStructs from rdkit.Chem import AllChem Molecule = Union[str, Chem.Mol] FeaturesGenerator = Callable[[Molecule], np.ndarray] FEATURES_GENERATOR_REGISTRY = {} def register_features_generator(features_generator_name: str) -> Cal...
dc45829f258de1da29fbc0f856a9654b2f76b3d098cafe025335166cfcf53839
Python
3,604
45
#! /bin/env python # # Michael Gibson 23 April 2015 # Modified Adrian Foy Sep 2018 import sys, struct import numpy as np def read_one_data_block(data, header, indices, fid): """Reads one 60 or 128 sample data block from fid into data, at the location indicated by indices.""" # In version 1.2, we moved from s...
04e4e3e920e7235bbc2395b6cfcdcbb8dbcd7813d3fee7c072bf43451d9bc605
Python
3,605
105
import os import utils.hhblits_search as hh import utils.psiblast_search as psi from tqdm.std import trange import yaml import argparse import time # Load the paths of tools and databases with open("config.yaml", 'r') as f: cfg = yaml.load(f, Loader=yaml.FullLoader) psiblast = cfg['psiblast'] rosett...
3f779fda63004947e2aba326e20d155e91474f1402122fb0dac0c0b55a1f959b
Python
3,607
96
# Fine-tuning procedure for Birds using ResNet 50 import keras import pickle from keras.callbacks import EarlyStopping, ModelCheckpoint from keras.models import Model from keras.optimizers import SGD from sklearn.model_selection import train_test_split from load_data_birds import load_data_birds from image_gen_extend...
17bd0830e0a3d7414b41d2b6f648892622e93ec30f4c30d03d88dee9bca54477
Python
3,608
72
pdb_protein = { 'amino_acid_names': [ 'ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLU', 'GLN', 'GLY', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL'], 'NON_STANDARD_SUBSTITUTIONS': { '2AS':'ASP', '3AH':'HIS', '5HP':'GLU', 'ACL':'ARG', 'AGM':'ARG', 'AIB':'ALA', 'ALM...
28d1d25ea86b0d42dcf67cbf6859cde779292eaf25139ab1f85ac1fe773ad9fa
Python
3,608
110
# Training procedure for CIFAR-10 using DenseNet 40 with growth rate 12. from __future__ import print_function import os.path import densenet import numpy as np import sklearn.metrics as metrics from keras.datasets import cifar10 from keras.utils import np_utils from keras.preprocessing.image import ImageDataGenera...
2409a63e23a5f1ba369b297607ac83906d5df03d4a5d832a4063fbbb226f13c5
Python
3,609
116
# Copyright (c) MONAI Consortium # 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 in writing, so...
93e28cda94883ccacf6cddda56808dae40e919ee3cfeea5ca371c1d2068b6e8b
Python
3,611
87
import cv2 import numpy as np import pandas as pd from glob import glob from tqdm import tqdm import matplotlib.pyplot as plt from joblib import Parallel,delayed import librosa import librosa.display from engine import utils from constants import JUST_DIR,ICBHI_DIR,BASE_DATA_DIR from constants import MEL_SPEC_SZ LUNG...
6ae5946954dc5160de6d6db3afe046efdf2e37a516f4bac8a6df74602a90d94e
Python
3,612
92
"""tests for registration/rigid.py. test_landmark_align_matches_legacy checks against the old picking.py math (tests/fixtures/landmark_align_baseline.json). test_procrustes_icp_recovers_known_transform is just a correctness check on made-up data. """ import json from pathlib import Path import numpy as np import pyt...
721e55a8ff0c8ad5483d0a2c0ca8deab5457c3a6484a2479813e8b2344512d63
Python
3,613
88
import torch import torch.nn.functional as F from torch_geometric.nn import EdgePooling as EdgePoolingBase from torch_geometric.data import Data class EdgePooling(EdgePoolingBase): def __init__(self, in_channels, edge_dim=None, edge_score_method=None, dropout=0, add_to_edge_score=0...
ac582ee1995e5eaa37879226630e7e91123d16b54873ff1f2d80a327b98097c2
Python
3,614
88
# Copyright (c) 2008-2026 the MRtrix3 contributors. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Covered Software is provided under this License on an "as is" #...
c16e318b67edfb9a10b4906e77a6e01b5ce486c313d135ec2ae4a7055c7ff1f8
Python
3,615
120
import json import pickle import numpy as np import torch import utils # noqa: E402 from dopp import FeedForwardCell from sim import (_compute_input_potentials, _compute_input_rates, # noqa: E402 _compute_preferred_angles) def sim(params, model, *, angle_1, angle_2): angle_1 = torch.Tensor([...
acdd888194b7eab8e6752bdab8ec1934ab55ef6e0c1ac828b9971160157dd21a
Python
3,619
114
import os.path as osp import numpy as np import ase.io from tqdm import tqdm import torch from torch_geometric.data import InMemoryDataset, Data from torch_geometric.loader import DataLoader class rMD17(InMemoryDataset): def __init__( self, root="dataset/", name="benzene", mode="tr...
b242544d804617346609a1b2d79cab957a852f1e50bd737d625198db2bcb6f15
Python
3,619
105
try: from rdkit import Chem from eval_follow_edm.rdkit_functions import BasicMolecularMetrics use_rdkit = True except ModuleNotFoundError: use_rdkit = False import torch import matplotlib matplotlib.use('Agg') import numpy as np from eval_follow_edm import bond_analyze ############################ # V...
665ceff184005d2521b2a977d6fcf5a75f95e92cd7b9a0677cbade4bf2d79900
Python
3,621
100
# -*- coding: utf-8 -*- """ An implementation of the 3D U-Net paper: Özgün Çiçek, Ahmed Abdulkadir, Soeren S. Lienkamp, Thomas Brox, Olaf Ronneberger: 3D U-Net: Learning Dense Volumetric Segmentation from Sparse Annotation. MICCAI (2) 2016: 424-432 Note that there are some modifications from the origina...
e518b4c61f5b81a327deda1c69fa2f776a9716bc506420d6143c1233bcd7edda
Python
3,621
109
""" Virtual node generation methods. """ import numpy as np import torch from ase import Atoms from pymatgen.io.ase import AseAtomsAdaptor from pymatgen.analysis import local_env from pymatgen.analysis.graphs import StructureGraph from scdp.common.utils import compute_bonds CrystalNN = local_env.CrystalNN( dista...
3317ba1c3e14568417a9cf2bebc3229e90f2549e753ae5ada35e435726bfd003
Python
3,622
90
## Imports import numpy as np from chromograph.pipeline import config from chromograph.preprocessing.utils import * from cytograph.visualization.scatter import * from cytograph.visualization.colors import Colorizer import torch from torch import nn from twobitreader import TwoBitFile from deeplift.dinuc_shuffle impor...
5e32463f0f5330ac0eee0b1f95e5c9b81cdb5d1981907e008352ff382bda86ec
Python
3,622
113
from collections.abc import Sequence from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts.chat import ChatPromptTemplate from langchain_core.runnables import Runnable, RunnablePassthrough from langchain_core.tools import BaseTool from langchain_core.utils.function_calling import con...
7bfe580a527b420adb894ca6fe3d117a560df9148438dbb932c262bc0150fe0d
Python
3,622
93
"""This package includes all the modules related to data loading and preprocessing To add a custom dataset class called 'dummy', you need to add a file called 'dummy_dataset.py' and define a subclass 'DummyDataset' inherited from BaseDataset. You need to implement four functions: -- <__init__>: ...