sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5fc26c080738c383006b643c998cb9684ce0a5e3b03d399683ddfecab964e58e
Python
7,400
132
"""Equivalent volume processing, minimal DTI output and selective resumption.""" import argparse from pathlib import Path import sys import tempfile from threading import Lock import time import unittest from unittest.mock import patch import nibabel as nib import numpy as np import SimpleITK as sitk from preprocessi...
b56486765451768bd8d50ea45c0e37e528335a70147229769c8432606b71cda8
Python
7,401
206
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import time import torch.optim as optim from torch.autograd import Variable import re import os import matplotlib.image as mpimg from torch.utils.data import DataLoader, Dataset import sys import scipy.io as io import cv2 ''' class Bl...
897b708ad01a37d817977d364c26837937f1920abbf3dfc87f27ebb079a0d9d6
Python
7,402
188
# 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...
774f39b54eb28d61c413feb22568a3a76d17fde07d5e6b8a61247ead80fcc376
Python
7,405
191
import numpy as numx import pydeep.base.numpyextension as npExt from pydeep.base.activationfunction import Sigmoid import pydeep.rbm.model as RBM_MODEL import pydeep.rbm.sampler as RBM_SAMPLER import pydeep.rbm.estimator as RBM_ESTIMATOR class BinaryBinaryDBM(object): def __init__(self, input_dim, hidden1_dim...
c265a91e8ada9450d81eca8cb91bdd2973730d5d2f743cc6635c4d0f4809a1ce
Python
7,405
214
"""Chain for summarization with self-verification.""" from __future__ import annotations import logging import warnings from pathlib import Path from typing import Any from langchain_core._api import deprecated from langchain_core.callbacks import CallbackManagerForChainRun from langchain_core.language_models import...
f20c27139074ee861011b758330789875776f5097786d35b66911620bd353ad4
Python
7,409
153
"""Optionally extract a native DWI brain mask with FreeSurfer SynthStrip.""" from __future__ import annotations import argparse import json import os from pathlib import Path import shutil import subprocess import sys import tempfile if __package__ in (None, ''): sys.path.insert(0, str(Path(__file__).resolve().pa...
45fd107899644953f958281b36a6c1305232fea804d81471a9197db5626b3953
Python
7,417
212
"""Unit tests for verifying event dispatching. Much of this code is indirectly tested already through many end-to-end tests that generate traces based on the callbacks. The traces are all verified via snapshot testing (e.g., see unit tests for runnables). """ import contextvars from contextlib import asynccontextmana...
ea04b41dd938e9ccadf919cfda5c53b3c8ad544f913c2a16b1257552548d236b
Python
7,423
132
# 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...
7b8305a83545a719eda1710bfebdc0e4281a701cc396f817245b7efe9c1e2ff1
Python
7,425
163
import numpy as np import uncertainpy as un from scipy.integrate import solve_ivp from edNEGmodel.edNEGmodel_params import * from functions.initial_values import * import time def model_setup(t,k, g_Na, g_DR, g_Ca, g_AHP, g_C): Na_sn, Na_se, Na_sg, Na_dn, Na_de, Na_dg, K_sn, K_se, K_sg, K_dn, K_de, K_dg, Cl_sn...
b60d9ddc4221a3af8d649388d4854aa5c07bffe73122045cc875217f7e876dc9
Python
7,425
152
# 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" #...
4effbe66d7e3b526454d6f7451043a48f6caf1ccf0e4acdd5f61573b5b04d07d
Python
7,426
184
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 6 21:39:56 2021 @author: athanasiadis """ from sklearn.cluster import DBSCAN import numpy as np def computer_local(eigenvectors,min_samples,epsilon,nvalues): """ computer_local ______________________ This is a function that ...
53cb66372a0e508fc65000e508986070f93d465c76469960f09bd089b4e289ab
Python
7,427
203
######################################################################## # 2D diffusion on an infinite strip from line "point source". # AIMS: to verify STEPS spatial-stochastic solver 'Tetexact' supports # local initial conditions and calculates surface diffusion rates correctly. # STEPS equivalent model: Stochas...
4489313d8cfd31885c4982eeff2f4ca74c43395b8645c2881cb7eed1daa3fbc2
Python
7,428
184
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/9/28 10:40 # @Author : zhangchao # @File : trainer.py # @Software: PyCharm # @Email : zhangchao5@genomics.cn import os import time import torch import numpy as np from torch.utils.data import DataLoader from spatialid import SpatialModel, KDLoss, DN...
00d3778f4504c6816f9644a55e72bfa2211a26747efc99a9a56c0c4088b24d6d
Python
7,429
241
#!/usr/bin/env python # coding:utf-8 """ This is the old version of vectorization, maybe used in research work instead of engineering one. Tips: - Embeddings are extracted to numpy matrix - Use pickle instead of json file to avoid string variations ??? - Vectorization and padding can be done togethe...
68b8c244f0df1eb409c171d08ea851818d13e4ee5827d28923ff693e4ade3206
Python
7,430
149
import argparse import os import random import logging import numpy as np import mxnet as mx import mxnet.ndarray as nd from mnist_rnn_factory import MovingMNISTFactory from nowcasting.config import cfg, cfg_from_file, save_cfg from nowcasting.helpers.gifmaker import save_gif from nowcasting.my_module import MyModule f...
ea458beb68a783f436d573102cbb34d233747386ce73e46c334dca9663d0b8d0
Python
7,431
196
import numpy as np import os import json import random from mimic3models.feature_extractor import extract_features def convert_to_dict(data, header, channel_info): """ convert data from readers output in to array of arrays format """ ret = [[] for i in range(data.shape[1] - 1)] for i in range(1, data.sha...
9649e62aa3d1bfeed6798eef26acab4b3b0c8acdf183c77e68557c58447fa4de
Python
7,432
123
# 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...
46dcfc1fb3c56dccc98f2348d575f25a73df0628676a939ace16ddcffcfa03bc
Python
7,433
216
# This script is used to convert the green view index results saved in txt to Shapefile # considering the facts many people are more comfortable with shapefile and GIS # Copyright(C) Xiaojiang Li, Ian Seiferling, Marwa Abdulhai, Senseable City Lab, MIT def Read_GSVinfo_Text(GVI_Res_txt): ''' This function is...
1bf2c504ecf23acd1ef76d9ce0f0dc8f767a103eef29eaf41adc55374d337b5d
Python
7,434
168
import unittest import os from EPI_MRI.EPIMRIDistortionCorrection import DataObject from EPI_MRI.InitializationMethods import * class TestInitializationMethods(unittest.TestCase): def setUp(self): """ Initialize any common data or setup needed for the tests. """ torch.manual_seed(81) # reproducib...
ab9da6485e431e39a281128d5dae6151f0fc23b642b11d3d4fb2ad3dbb0e91bb
Python
7,434
180
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from functools import partial import torch import torch.nn as nn import torch.nn.functional as F from timm.models.layers...
ae11c2b11c3040bbab21cd3104dd0d3a0149c60f0bc16972470b0cc7b9b389db
Python
7,434
145
from OCC.Extend.TopologyUtils import TopologyExplorer from OCC.Core.BRepGProp import brepgprop from OCC.Core.GProp import GProp_GProps from feature_test import Compound def ask_face_centroid(face): """Get centroid of B-Rep face.""" mass_props = GProp_GProps() brepgprop.SurfaceProperties(face, mass_props) ...
44ab503a3694a4ba5f6bbe3a99228e1df16a07f2a176f2fe016905dabcf791b9
Python
7,438
217
import os import sys import re import types import itertools from cgatReport.Tracker import * from cgatReport.odict import OrderedDict as odict from RnaseqReport import * class TrackerGenemodels(RnaseqTracker): mPattern = "_gene_expression" def getTracks(self, subset=None): print("getTracks") ...
9ded5f160966997c17b5122ca7df5945ca76a59d2469e8fa6cf445eb2e31ac5c
Python
7,443
167
"""Agent toolkits contain integrations with various resources and services. LangChain has a large ecosystem of integrations with various external resources like local and remote file systems, APIs and databases. These integrations allow developers to create versatile applications that combine the power of LLMs with t...
f0ece05dcdf1f75596537b674f09c82e897b4ac47fe101c51c16551756d738b8
Python
7,445
189
import diffrax import equinox as eqx import jax # import jax.numpy as jnp from jax import random as jr, numpy as jnp import pysindy as ps import sympy as sp import sympy2jax as sp2j import numpy as np from CEL.networks.models.PhyCDE import CDEModel, RNN @jax.custom_vjp def ste_func(input): return (input > 0).ast...
5e4d266f775ba751b5416b9e50e8970fb41b47d5d472657b57c3058bd990ade3
Python
7,446
154
""" Module to plot effect of different stimulation powers on behaviour. Author: jonas.braun@epfl.ch """ import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib as mpl from matplotlib.backends.backend_pdf import PdfPages import seaborn as sns from scipy.stats import...
82d713087b503d7504fc66b1810b2f3cb42741dce0cc4e1a46afda07d234dd2d
Python
7,447
182
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from functools import partial import torch import torch.nn as nn import torch.nn.functional as F from timm.models.layer...
d37e721aa86e13a50a28017e9a16b88dbb9f222d77502e91a7984ef655fde4ab
Python
7,450
172
from typing import List import numpy as np import copy import pickle import lmdb # install lmdb by "pip install lmdb" class ImageFeaturesH5Reader(object): """ A reader for H5 files containing pre-extracted image features. A typical H5 file is expected to have a column named "image_id", and another column...
b2de3f622899c3d41cadf69760303847e2e4e06a8ac2e5686f6d7cdbbc10b142
Python
7,454
250
# -*- coding: utf-8 -*- import os import re # Add any Sphinx extension module names, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. import sys import importlib_metadata # -- General configuration ---------------------------------------------------- # If your do...
77bac6796342f767b5fd8c380f8ae5f40a9be8f7c83d09048fc6d1497dd4c4f6
Python
7,455
198
# 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...
ee183971a61ae935b684e3ccfa7913e97bfcaacf433cd30be5912a286297f380
Python
7,455
217
""" Wrapper classes for providing a minimal consistent interface to cheminformatics toolkits Currently supported toolkits: * The `OpenEye Toolkit <https://docs.eyesopen.com/toolkits/python/quickstart-python/index.html>`_ * The `RDKit <http://www.rdkit.org/>`_ * `AmberTools <http://ambermd.org/AmberTools.php>`_ .. to...
fa6909e68723a09ee5390b970834a84be4685f1ab2bc0c83393329920cdd73ee
Python
7,456
194
import numpy as np import os from scipy import interpolate from scipy.ndimage import binary_fill_holes from skimage.morphology import binary_dilation, disk, medial_axis from skimage import transform from skimage.measure import find_contours import matplotlib.pyplot as plt from matplotlib import rc rc('font', size=17) r...
25d3bc17ebb3d02e6684f901830a6a6f30e8863b8998a6635e0d3692ed77be85
Python
7,463
305
# -*- coding: utf-8 -*- from typing import Callable, Optional import torch from torch import nn from torch.nn.parameter import Parameter from torch.distributions import Normal from torch.distributions import kl_divergence as kl class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxi...
9f13eac317a327df6180d9bb53ce4060bf8c7470d8d5b4a65d98d2a8abcdeaaf
Python
7,469
202
#!/usr/bin/env python3 import traceback from torch.autograd import grad import torch.nn as nn from .utils import clone_module, update_module def maml_update(model, lr, grads=None): """ [[Source]](https://github.com/learnables/learn2learn/blob/master/learn2learn/algorithms/maml.py) **Description** ...
10f5e55d9bff53b50d968c53a2ff69ae060b3f78abfead20bf73a6d1149a793e
Python
7,470
235
# coding=utf-8 import random import numpy as np import torch import sys import os import torchvision import PIL def set_random_seed(seed=0): # seed setting random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.backends.cudnn.deterministic = True ...
97b7f9b8def1efeb5ae4b88a7d4fe1b2ac02e26aef2877add55353a630de4ca9
Python
7,470
187
# Take 1 cell-type, say inkt # Take its metadata for everything: training, testing, dev # Make a pandas df with gene and category # Then for each of the other samples, join gene and category. # merge by gene # Sconda conda activate TensorFlow_CPU_01 # cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/Fo...
a2e7f3e4c55ec5fd6d6545ffb8b13a5114ed69c73bfd637919c037717eddc492
Python
7,471
251
"""Unittests for langchain.agents.chat package.""" from textwrap import dedent from typing import Any from langchain_core.agents import AgentAction, AgentFinish from langchain_core.prompts.chat import ( ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, ) from langchain_core.tool...
af53c056047429bd561e92c6449858cb7791e8a9b85093381a7e1b28f163a489
Python
7,474
238
import os, cv2 import _pickle as cPickle import logging import numpy as np import pandas as pd import torch from torch.utils.data import Dataset import lmdb, pickle import clip logger = logging.getLogger(__name__) os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE" LABEL_MAP = {"amusement": 0, "awe": 1, "contentment": 2, "...
2fd69c79a059da0c4c9df60d41446ab2e114eaaa221396cd35954588379c4220
Python
7,475
162
# 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...
cec1663de319718d8eed8c6a22f340cf7e18f0af3b5e4efd48a51be09d8699de
Python
7,475
234
""" This file collects key functions for preprocessing data and annotations. """ import datetime from functools import lru_cache, partial import h5py import importlib.util import json import numpy as np import pathlib from pathlib import Path import platform import torch from tqdm import tqdm from typing import Option...
98934429245cb59ba444a1fff552d510e291b9c4d42c3d63880ca0f738318661
Python
7,477
208
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import time import torch.optim as optim from torch.autograd import Variable import re import os import matplotlib.image as mpimg from torch.utils.data import DataLoader, Dataset import sys import scipy.io as io import cv2 ''' class Bl...
a2b4c343f964ec7de4c876d37e8ba86a8eaf16c156adf230d3279f013f022379
Python
7,481
184
import torch import numpy as np import logging import os from torch.utils.data import DataLoader from qm9.data.dataset_class import ProcessedDataset from qm9.data.prepare import prepare_dataset def initialize_datasets(args, datadir, dataset, subset=None, splits=None, force_download=False, su...
4714e8c2a77f5452e2c1df58d2bc867e26345f66505db0c9e33d693ba26f00f0
Python
7,483
220
"""VectorStore agent.""" from typing import Any from langchain_core._api import deprecated from langchain_core.callbacks.base import BaseCallbackManager from langchain_core.language_models import BaseLanguageModel from langchain_classic.agents.agent import AgentExecutor from langchain_classic.agents.agent_toolkits.v...
007c123fc72a4b402b9ff2bf964068367c63baa8224cbea95e4eec8f29c560c6
Python
7,487
199
import numpy as np import os from scipy import interpolate from scipy.ndimage import binary_fill_holes from skimage.morphology import binary_dilation, disk, medial_axis from skimage import transform from skimage.measure import find_contours import matplotlib.pyplot as plt from matplotlib import rc rc('font', size=17) r...
d74b2b5ba790eeff54ae786e576829f148b074c806c0c836756d19ee31b7afca
Python
7,489
192
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ POCIF-BAT R2 — Extraction des trajectoires par cycle du corpus Kim et al. (2025). Source : Kim, I. et Choi, J. W. (2024) 'Battery raw data', Mendeley Data, V2. doi:10.17632/h2y7mj4kt7.2 — licence CC BY 4.0. Article : Kim, I., Kim, H., An, S., Oh, J., Kim, M. ...
b7b462d82c602221eccdcce8920df55d0bbdde1e3525c53317e02094e4f311f8
Python
7,490
153
#!/usr/bin/env python3 #$ -cwd #$ -V #$ -N m5_his_c #$ -e /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/m5_his_ce.err #$ -o /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/m5_his_ce.out #$ -pe smp 2 #$ -jc long import os import sys import time import numpy as np import...
17c87e11602faab313130ff54580d0b938af5529d653ef041866eef6b9fda00b
Python
7,494
176
import torch import torch.nn as nn from rde.modules.common.layers import AngularEncoding class AAEmbedding(nn.Module): def __init__(self, feat_dim, infeat_dim): super(AAEmbedding, self).__init__() self.hydropathy = {'-': 0, '#': 0, "I": 4.5, "V": 4.2, "L": 3.8, "F": 2.8, "C": 2.5, "M": 1.9, "A": 1....
3d11337f2df2e602e56f121f744435d07e04aafec968477511fd007cb81fa588
Python
7,496
162
#!/usr/bin/env python3 # coding: utf-8 """ Create list of Bash commands to run ABCD task prep jobs simultaneously with SBATCH Greg Conan: gconan@umn.edu Created: 2021-02-26 Updated: 2021-09-20 """ # Import standard libraries import argparse from glob import glob import os import sys def find_myself...
0ba6950996f27bb95be08c39ae0f0cc93eabd1c2388fc2a5234f7e3629839269
Python
7,500
177
""" Script to build an aggregated dataset for a study, where all subjects are described within the same file, from the original data, which is made of one data file per subject. The dataset is structured such that data that are uniquely defined at the level of a trial, a session, or a subject are contained in their res...
59c8b08648b3e9c0d3bc83e0a83a31cda89f8899a41eba82511d0dd1fe3e441d
Python
7,501
179
# import shutil # import subprocess # import time # import unittest # import zipfile # from pathlib import Path # from random import randint # # import pytest # from MRdataset import import_dataset, load_mr_dataset, MRDS_EXT # from MRdataset.utils import is_same_dataset # from numpy.random import default_rng # # from m...
73f6ba23b825ac39834b74f7e838559a5bce203be883d1ca9ef261e2aeb8b832
Python
7,506
202
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pickle import os import json import datetime import argparse import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns from sklearn.impute import SimpleImputer import torch import torch.nn.functional as F...
2ef7d1f005c9c919bfbc33d89e35627455c34218b5cb63ae42ea80d1df141c7b
Python
7,508
212
import sys sys.path.append(".") import argparse import tarfile import queue import multiprocessing as mp from tqdm import tqdm import numpy as np import pandas as pd from crystallm import ( CIFTokenizer, bond_length_reasonableness_score, extract_data_formula, extract_numeric_property, extract_spac...
7659b9b792e1f740759f260abf9cfe8264cf5c1f721ee3f1d6002d2faa66b9dc
Python
7,509
221
import logging try: from collections import Mapping except: from collections.abc import Mapping from pathlib import Path from zipfile import ZIP_DEFLATED, ZipFile import h5py import numpy as np from tqdm import tqdm logger = logging.getLogger(__name__) def zip_dir(zip_name: str, source_dir): """ Zi...
9d143167511314a86444df47d47902ab04cdf8d243340de1652ed32663b24418
Python
7,513
217
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torchvision.transforms import Normalize import pickle from training.diffaug import DiffAugment from training.networks_stylegan2 import FullyConnectedLayer from pg_modules.blocks import conv2d, DownBlock, DownBlockPatch from pg_m...
9571462f292be95f71f5ae7fdf1f7001c1bf2e30c598c00a640376ae16138b89
Python
7,514
171
#pylint: disable=E1101, E0401, E1102, W0621, W0221 import argparse import numpy as np import torch import torch.nn as nn import torch.optim as optim import random import time from random import SystemRandom import models import utils parser = argparse.ArgumentParser() parser.add_argument('--niters', type=int, default...
1471307ecdab5c7185013660b79e56b6c10c59ff621df32409658f2b4037aa02
Python
7,515
159
#!/usr/bin/env python3 #$ -cwd #$ -V #$ -N m5_his_a2 #$ -e /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/m5_his_ce.err #$ -o /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/m5_his_ce.out #$ -pe smp 2 #$ -jc long import os import sys import time import numpy as np impor...
574b6964262e300294fdce450ce78d325cf6f556e34b6237eade73d5df3d2b5a
Python
7,517
157
import gym import random from gym import spaces import numpy as np import logging from random import sample, uniform from math import ceil from DSS_Initialize import * from state_action_reward import * from gym.utils import seeding logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=l...
a264ca75bbe7d62b2c3eef2f3c8a1a1f12e2087d33edd837deb79f623a8837c0
Python
7,518
158
""" In this file the DSS engine is set up. The objects for circuit, bus, and branch are also set up for further use in the RL environment. This file also includes function to modify the base DSS circuit with sectionalizing, tie switch, and generator information. The translation of DSS Circuit into a graph structure...
c7bafb65f2777d53b86ba2bd3ec75828ff458d70df264b844649dee7b85c2a7f
Python
7,518
179
import os # this stops jax from stealing all the memory os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"]="false" import jax import jax.numpy as jnp import jax.random as jrng import tensorflow as tf import seaborn as sns import hydra from omegaconf import DictConfig from math import sqrt # from clu.metrics import Collectin...
606a23adb058cd507671f0b1b149c92ec792f5035317ed66077f0a0da6e40089
Python
7,520
164
file_name = 'CellJ.json' Step = 0.1 #ms Edel = 100 #ms stopTime = [20000] #ms rangesL = [10000] #phase calculation crop limit low rangesH = [-10000] #phase calculation crop limit high signalInd = 0 import pycircstat import numpy as np import pandas as pd import matplotlib.pyplot as plt import efel from sc...
20d2b8c6d99dc9dc905c22dc61bd10a2f3f95e8bc5fee763aa9683c03255649c
Python
7,524
229
"""Utilities for working with iterators.""" from collections import deque from collections.abc import Generator, Iterable, Iterator from contextlib import AbstractContextManager from itertools import islice from types import TracebackType from typing import ( Any, Generic, Literal, TypeVar, overloa...
ee34c7b91b188e7fae64428f48efc305b123747e3075aa3374d392d40c95858b
Python
7,528
164
file_name = 'CellJ.json' Step = 0.1 #ms Edel = 100 #ms stopTime = [20000] #ms rangesL = [10000] #phase calculation crop limit low rangesH = [-10000] #phase calculation crop limit high signalInd = 0 import pycircstat import numpy as np import pandas as pd import matplotlib.pyplot as plt import efel from sc...
dfc362b8f74847d05a945e977fecc0d37f0eea5b5516cc86ea419200681b5119
Python
7,531
238
# 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...
05e07d894e497830fdd095025722eb62886969c44a6521bf96af362a1829742f
Python
7,533
198
import torch import numpy as np from pymatgen.core.structure import Structure from pymatgen.core.lattice import Lattice from pymatgen.analysis.graphs import StructureGraph from pymatgen.analysis import local_env from .mat_utils import lattice_params_to_matrix CrystalNN = local_env.CrystalNN( distance_cutoffs=None...
a3b512edfdee21014dd2d5227a5bb30d82541f85c0ca15c936cbce2e40a8efa2
Python
7,534
222
from pathlib import Path from unittest.mock import AsyncMock, Mock import pytest from langchain_tests.integration_tests.vectorstores import VectorStoreIntegrationTests from langchain_core.documents import Document from langchain_core.embeddings.fake import DeterministicFakeEmbedding from langchain_core.vectorstores i...
746a0f017d45f6a0f55d449f67a1dbabc80ffcb39c41b3f68f639ae28964fa43
Python
7,535
208
"""Chain pipeline where the outputs of one step feed directly into next.""" from typing import Any from langchain_core.callbacks import ( AsyncCallbackManagerForChainRun, CallbackManagerForChainRun, ) from langchain_core.utils.input import get_color_mapping from pydantic import ConfigDict, model_validator fro...
9dcdd188b448daae494cd27975b116fd959f2b1da3ffc0c2c7206b57612e5d44
Python
7,535
209
# this script quality check the segmentation for tiles # Mask-RCNN on detectron2: # the folder structure should be: # data/train, val (images) # pretrained: the pretrained model model_best.pth # qc: quality check # ini_infer: inference with no training on the data # training: training on the new dataset # Run...
46257bd88303dc580899149248eeddba7dab7a4831573b9e82bcbb9139066190
Python
7,536
217
import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt import pandas as pd import sys, os import pickle from mantis_ml.config_class import Config clf_alias = {'ExtraTreesClassifier': 'ET', 'SVC': 'SVC', 'DNN': 'DNN', 'RandomForestClassifier': 'RF', 'XGBoost': 'XGB', 'GradientBoostingClassifier': 'GB'...
d01f5f21553003d9042beb2c256e0ed27d9f01902702c945706afa212de64162
Python
7,538
222
from sklearn.svm import SVC from sklearn.metrics import accuracy_score from sklearn.model_selection import StratifiedKFold import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader, TensorDataset import os from sklearn.metrics import confusion_mat...
10c1941cdeae88ca7f029feec86da9c8ec1ef27a6a01f7d42fb0f2dc14bbc799
Python
7,541
200
""" %Copyright (C) 2020, Manel Vila-Vidal, for the translation from Matlab to Python Contact details: m@vila-vidal.com %Copyright (C) 2019, Adria Tauste Campo, for the adapted Matlab code (https://github.com/AdTau/DI-Inference) %Contact details: adria.tauste@gmail.com %Copyright (C) 2019, Jiantao Jiao, for the original...
3a8263330573551200a266ed9eefd7a6be3d745af10c288ade7f999b22b27c74
Python
7,541
208
import torch from rfdiffusion.potentials import potentials as potentials import numpy as np def make_contact_matrix(nchain, intra_all=False, inter_all=False, contact_string=None): """ Calculate a matrix of inter/intra chain contact indicators Parameters: nchain (int, required): How many chai...
be7ed7728f035b503544e0c838c99840a05b82d873d2fc79ff51114f2e1ca258
Python
7,543
274
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 27 11:12:51 2023 @author: weihan """ import pandas as pd def read_fasta_to_dict(fasta_file: str = 'demo.fa') -> dict: """ Read fasta to py dict. The seq name is dict keys and seq is values. Parameters ---------- fasta_...
0751554a8b504577e17f1faf47653bde1a284806b36194a020978dcfaf418c3f
Python
7,544
199
import numpy as np import torch import torch.nn.functional as F from torch import nn from utils import RBFExpansion from torch_scatter import scatter from torch.nn import Embedding from typing import Union from torch import Tensor from torch_sparse import SparseTensor from torch_geometric.nn.conv import MessagePassin...
efeb775fd42eaae647bdd51c395a88d031b4e8ecff781f59c83794c0e05f081b
Python
7,544
182
from tensorboardX import SummaryWriter import torch import json import sys import os import argparse import numpy import pickle import pandas def parse_arg(): ''' This Function Parse the Argument ''' p=argparse.ArgumentParser( description = 'Example: %(prog)s -h', epilog='Library dependency :') p.add_argum...
beeae7aa0cfb62d67d2e50398759ddb999d8bb0e626ca862a6bf0873329a94fc
Python
7,548
195
import linecache import os import subprocess from typing import Dict, List, NamedTuple import numpy as np import torch from torch.nn.utils.rnn import pad_sequence from torch.utils.data import Dataset from transformers import BatchEncoding, PreTrainedTokenizer from transformers.trainer_utils import PredictionOutput de...
f4561f649c88a8739be16bf5d7b1d1fb2485de85fc1f6f395bc1e7bca1b96148
Python
7,548
233
import math from functools import partial import torch import torch.nn as nn import torch.nn.functional as F def get_inplanes(): return [64, 128, 256, 512] def conv3x3x3(in_planes, out_planes, stride=1): return nn.Conv3d(in_planes, out_planes, kernel_size=3, ...
eebad623e634accc327cacfafeef3cea02df5b8465b4ae06f13ea63accdd351b
Python
7,550
172
import anndata as ad from typing import Optional, Literal, Union import numpy as np import pandas as pd class AnnotatedData(ad.AnnData): """Creates annotated cellsdata (see anndata library for more information on AnnotatedData) object based around the Ca2+ matrix of the imaging trial.""" def __init__(self, ...
15c3f206f612bcb913f00caa52dc78e5358b9895a14be5501ed5590014c2bb97
Python
7,551
201
from SMdRQA.RQA_functions import entropy from SMdRQA.RQA_functions import average from SMdRQA.RQA_functions import maxi from SMdRQA.RQA_functions import mode from SMdRQA.RQA_functions import percentmorethan from SMdRQA.RQA_functions import diaghist from SMdRQA.RQA_functions import onedhist from SMdRQA.RQA_functions imp...
38e21e7071f224aff09ca1c1a7088f1eb95bebaecccd84bf92603a3fb054f756
Python
7,551
262
"""Fixtures used for testing.""" import numpy as np import psims import pytest import yaml from pyteomics.mass import calculate_mass @pytest.fixture def mgf_small(tmp_path): """An MGF file with 2 annotated spectra.""" peptides = ["LESLIEK", "PEPTIDEK"] mgf_file = tmp_path / "small.mgf" return _create_...
e523bdc50ec1fbe51865b21e5c265c109406166cd79d5eb1082accf79b0b7de4
Python
7,553
312
# -*- coding: utf-8 -*- """ Created on Sat Feb 20 12:16:32 2021 @author: Xingyan Liu Basic functions """ import os import logging from typing import Sequence, Union, Mapping import json import pickle import time import datetime import numpy as np import pandas as pd from scipy import sparse def strline(seq): ...
326b041214ade509b5ddc4c232fcb9885373ee939f01b16a327f892b9d1c062d
Python
7,554
222
from datetime import datetime as dt from datetime import timezone from typing import Any, TypeVar import pytest from langchain_core.exceptions import OutputParserException from langchain_core.messages import AIMessage from langchain_core.output_parsers import BaseOutputParser from langchain_core.prompts.prompt import ...
e7e684cb72b78906cd95903f11619768ec93698d1f715953be74293eb532ea84
Python
7,554
186
# *========================================================================= # * # * Copyright Erasmus MC Rotterdam and contributors # * # * Licensed under the GNU GENERAL PUBLIC LICENSE Version 3; # * you may not use this file except in compliance with the License. # * # * Unless required by applicable law or agre...
2517bd191515307798588ae492ec9cc90b786db616769ae1413441a1199b6f0f
Python
7,561
210
"""Mass spectrometry file type input/output operations.""" import collections import csv import operator import os import re from pathlib import Path from typing import List import natsort from .. import __version__ from ..config import Config class MztabWriter: """ Export spectrum identifications to an mzT...
eafac899c37f42ed87def7e19b110adc353b91b22fad56b004b31cc013df6c22
Python
7,565
164
""" In this file the DSS engine is set up. The objects for circuit, bus, and branch are also set up for further use in the RL environment. This file also includes function to modify the base DSS circuit with sectionalizing, tie switch, and generator information. The translation of DSS Circuit into a graph structure is ...
9a94791423a6db3362a1f4b9afeda8e2d2ff114a7f3518d2f464b53a7443d32c
Python
7,566
253
'''pipeline_quickstart.py - setup a new pipeline ============================================= Purpose ------- This script creates a new pipeline according to the cgat pipeline layout. This is useful when starting a new pipeline from scratch. Usage ----- To start a new project, use :file:`pipeline_quickstart.py`:...
ad9a64f1e234b352408ff68ec941b4de5e807f7fb40ab1f289620a36501b610f
Python
7,566
195
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.tools.render import ToolsRenderer...
ec975c4e6e94b7ad6485d265894462d49d026ccd64ba212e692ae8d309d208d4
Python
7,570
219
######################################################################## # Stochastic degradation-diffusion process. # AIMS: to verify STEPS spatial stochastic solver 'Tetexact' # supports spatially-separated initial conditions and computes # diffusion and reaction rates correctly when applied to a # degradation-di...
07491857f9e64e7fa06b0b7222f07b78c264525edc29cca1ee27e6ba8062c93e
Python
7,574
219
"""Loading datasets and evaluators.""" from collections.abc import Sequence from typing import Any from langchain_core.language_models import BaseLanguageModel from langchain_classic.chains.base import Chain from langchain_classic.evaluation.agents.trajectory_eval_chain import ( TrajectoryEvalChain, ) from langc...
631f9af0f48a8f9bdacee91f7f94f30f6100eb18e404f7076355d6afbba878c9
Python
7,574
241
import torch import warnings def _handle_unused_kwargs(solver, unused_kwargs): if len(unused_kwargs) > 0: warnings.warn('{}: Unexpected arguments {}'.format(solver.__class__.__name__, unused_kwargs)) def _rms_norm(tensor): return tensor.pow(2).mean().sqrt() def _mixed_linf_rms_norm(shapes): de...
51dd81be0572192274d08d6a5b61594c0ee853d1de56ef940f1c07715364710d
Python
7,581
211
import os import re import tempfile import numpy as np import torch from pathlib import Path import argparse import pandas as pd from rdkit import Chem from tqdm import tqdm try: import utils except ModuleNotFoundError as e: print(e) def calculate_smina_score(pdb_file, sdf_file): # add '-o <name>_smina.s...
57a3e9ae989a9018b986ed2d4d51e0991863ce0902ca41ed440e128b1080b1e2
Python
7,584
203
import os import numpy as np np.random.seed(0) from collections import defaultdict, Counter # import pickle5 as pickle import pickle import torch import torch.nn as nn import scipy.sparse as sp import sys sys.path.append('../../') from BrainAlign.SR_RSC.utils import process #import sys class embedder: def __init__...
317de5dac2244243533ef7018a9db9467435f6a55b221e13122fa5864259b705
Python
7,586
158
# 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" #...
242238988e15d4f0b3b584d39f096b07c45cd09d950b5830929e70686c423255
Python
7,587
219
######################################################################## # Stochastic degradation-diffusion process. # AIMS: to verify STEPS spatial stochastic solver 'Tetexact' # supports spatially-separated initial conditions and computes # diffusion and reaction rates correctly when applied to a # degradation-di...
4fa8d8b342be4377806c2a963b371fdbc22edc2a484608e56bdb9b9524cb0d5f
Python
7,588
209
import os import pandas as pd import torch import numpy as np from torch_geometric.data import DataLoader import random import torch.nn as nn import torch.optim as optim from torch_geometric.nn import global_mean_pool from torch_geometric.nn import GATConv import torch.nn.functional as F from sklearn.metrics import roc...
af59a6f18b3db32a319755adb6b2473f96f4f0507919736ea320130a367631fa
Python
7,598
184
import os import numpy as np import matplotlib.pyplot as plt import skimage.io from cellpose import models import pandas as pd import argparse import torch from Classifier_functions import predict_batch from calculs_masks_1et2 import calcul_masks_1et2 from mosaique_images_brutes import generate_mosa_raw_images from m...
efd2bd73de378c4ed66f656a7ec7ba2b57a467acfddd4ae85ddb7dd9f2bba630
Python
7,601
220
"""Hybrid density synthesis: soft GTOs via FT+IFFT, sharp GTOs via real-space. Opt-in only (``density_eval_mode=hybrid_fft``). Default training stays real-space. """ from __future__ import annotations from typing import Optional, Sequence, Tuple, Union import torch from scdp.model.gto_fourier import density_from_g...
a8e79620e1779c69f6730e01e646b679e1435bab7e99ba7a04939c66be92b2fa
Python
7,606
207
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 ##################################################################...
dcc897b2c643e733feb4da60573dad09ec417001074924ab07865a4cd695a472
Python
7,614
183
#!/usr/bin/env python3 # pylint: disable=line-too-long """ Various functions that take genome annotations, and determine the metabolic pathways they encode. """ # Imports import os import logging from itertools import chain # Local from enrichm.databases import Databases from enrichm.module_description_parser import Mo...
8522f7c0e2935cfdf058cf8a0a0b05a86532de4f18ec296dc0a86e29141d9573
Python
7,615
271
import numpy as np from mpl_toolkits.axes_grid1 import make_axes_locatable import pandas as pd import DAE_params as prms from time import time import datetime ################################################# # # This script activates each node at the # bottleneck layer for the full ensemble # of networks and comp...
8220b8955fad1d45563f343e9d38af053f2e47fd9da806ca48374e40276a0d5f
Python
7,617
167
# -*- coding: utf-8 -*- """ %Copyright (C) 2020, Manel Vila-Vidal, for the translation from Matlab to Python Contact details: m@vila-vidal.com / manel.vila-vidal@upf.edu %Copyright (C) 2019, Adria Tauste Campo, for the original Matlab code (https://github.com/AdTau/DI-Inference) %Contact details: adria.tauste@gmail.com...
f11bded526ae1129b9a2948c32045cc4ff55630900685e2e62e026c33d4356a0
Python
7,623
194
"""Test pepolar type of fieldmaps.""" from os import cpu_count import pytest from niworkflows.interfaces.bids import DerivativesDataSink from nipype.pipeline import engine as pe from ..pepolar import ( check_pes, _split_epi_lists, init_prepare_epi_wf, init_pepolar_unwarp_wf ) def test_split_epi_lists(bids_layout...