sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e26cce6bd4054259f50e8118ff5701389fea36f8065db68e42f956c78f662a37
Python
10,444
232
import argparse from os.path import join import torch import pickle from qm9.models import get_model, get_autoencoder, get_latent_diffusion from configs.datasets_config import get_dataset_info from qm9 import dataset from qm9.utils import compute_mean_mad from qm9.sampling import sample from qm9.property_prediction.mai...
d422f11f8ec5c7e7d49e7f041d8025d6e31e1463f8b331dc1e6e62bbae630e8c
Python
10,445
242
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import banditNarm_preprocess_func __all__ = ['banditNarm_2par_lapse'] class Banditnarm2ParLapse(TaskModel): def __init__(...
8da97b4ef20baecdead89c3c8e14bfaf387a5528cb2623f2901ad0d645e4c877
Python
10,460
225
import os import copy import torch import numpy as np from inverse_fold_models.model import InverseFoldModel import sys sys.path.append('packages') from ProteinMPNN.protein_mpnn_utils import ( _scores, _S_to_seq, tied_featurize, parse_PDB ) from ProteinMPNN.protein_mpnn_utils import ProteinMPNN as ProteinMPNNBas...
afe772ebe8d0406f69099cf9f29651a8c83678f8ee19ed5eaccb3aedcae4f6c9
Python
10,463
207
''' read channel info 8/31/2022 jz103 ''' import os import gc import warnings from copy import deepcopy from time import time import re import datetime import json import xml.etree.ElementTree as ET import numpy as np import matplotlib.pyplot as plt import pandas as pd VALID_SESSION_LAMBDA = lambda x: (('_' in x) an...
3dc5a042bd4b6fdd604441d2ce58fee29240259ffa403f4b82f7e68003dcc2e1
Python
10,467
339
# Adapted from https://github.com/Nguyen-Hoa/Activation-Maximization/tree/master import torch import torch.nn as nn import torchvision.models as models # Showing images import cv2 # Reading images from torchvision import transforms from PIL import Image from numpy import asarray, percentile, tile # Gaussian Kernel ...
3b114c97d94c7cade6aaf1f67c860224d743087f3b3a9100da0c45b1bd1a1e56
Python
10,471
267
import pickle as pk import spglib import numpy as np from tqdm import tqdm from pymatgen.core.lattice import Lattice from pymatgen.core.structure import Structure from e3nn import o3 from e3nn.io import CartesianTensor import torch import json from pymatgen.io.vasp import Poscar import pdb from pymatgen.io.jarvis impor...
e253df3010a09db5b3ca876aab195dfa1d1fb7bc42d4b1a2122287db6b698767
Python
10,473
260
#!/usr/bin/env python import unittest import os import sys import tempfile sys.path = [os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')] + sys.path from enrichm.parser import Parser # Minimal emapper.annotations fixture content (21 tab-separated columns) # Comment lines and header start with '#' and a...
865b5683c69643b08ce7642acc04a0956d1041087a479a6dac4c35a90b61602c
Python
10,477
267
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Fieldmap-based estimation of susceptibility distortions. .. _sdc_direct_b0 : Direct B0 mapping sequences ~~~~~~~~~~~~~~~~~~~~~~~~~~~ When the fieldmap is directly measured with a prescribed sequence (...
d7b48eea001f3b8ce5988f641f7d7f9dc0a9d947c3391e768d97aa09cb43322d
Python
10,477
321
import torch import numpy as np import seaborn as sns import matplotlib.pyplot as plt from matplotlib import gridspec #%% Plotting def plot_hebb(update_fn, pre=None, post=None, surf=False): pre = torch.tensor([-1.,1]) if pre is None else pre post = torch.arange(1, -0.05, -0.05) if post is None else p...
d2339c6f2665bd84b6cbba89aed2f45c2367a09e5dab60f046f96223366fb309
Python
10,479
246
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import banditNarm_preprocess_func __all__ = ['banditNarm_lapse'] class BanditnarmLapse(TaskModel): def __init__(self, **k...
1a0317450a15e2dc862d4c3df7e58f6acfa2d6e4989b1436cc09300c174c0871
Python
10,483
163
import argparse import os import sys import glob import pytorch_lightning as pl from torch.utils.data import DataLoader from torch.utils.data import ConcatDataset from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.callbacks ...
374d440ba8ea187d184f99378e7ae40196d3da89d41f89fc324db94a3ffde7f2
Python
10,487
468
#################################################################################### # # 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...
be21ec1db98e8eb903f652df435ec60282bc839c3a1a121d6a9f3cf6604f59bc
Python
10,489
218
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ POCIF-BAT R2 — H-R2-1, transformation T1 : contrôle d'amplitude et escalier causal. MOTIF DE LA TRANSFORMATION, déclaré avant retest et décidé sur des considérations de structure du contrôle, non sur le résultat observé. Le contrôle négatif préenregistré était binair...
1d86aaf09547cfa4beeb792da85c5b43d537b6438875d005b4123ab65b95da9b
Python
10,491
309
import numpy as np import torch from rfdiffusion.chemical import INIT_CRDS from rfdiffusion.util import generate_Cbeta PARAMS = { "DMIN" : 2.0, "DMAX" : 20.0, "DBINS" : 36, "ABINS" : 36, } # ============================================================ def get_pair_dist(a, b): """calculat...
28ccb1bb3edcc9f2e620d6c070fb9326513fb8204085b4f5208e76cdb047e957
Python
10,491
342
import torch import numpy as np import torch.nn.functional as F restype_1to3 = { 'A': 'ALA', 'R': 'ARG', 'N': 'ASN', 'D': 'ASP', 'C': 'CYS', 'Q': 'GLN', 'E': 'GLU', 'G': 'GLY', 'H': 'HIS', 'I': 'ILE', 'L': 'LEU', 'K': 'LYS', 'M': 'MET', 'F': 'PHE', 'P': 'PRO', 'S': 'SER', 'T': 'THR', 'W': 'TRP', '...
809b434f75bd10dbbb49f86da574d4d97ffcb9cb4530d4ccc4c61c073c610fe9
Python
10,498
249
#!/bin/env python import numpy as np from openff.toolkit.typing.engines.smirnoff.forcefield import ForceField # Function definitions for parsing sections within parameter file def _parse_nonbon_line( line ): """Parse an AMBER frcmod nonbon line and return relevant parameters in a dictionary. AMBER uses rmin_half ...
2d8e842435960fca7d7512e081c93fbf2859f2e8e884c42b56626268ea5553b4
Python
10,500
310
import numpy as np import torch from torch import nn import torch.nn.functional as F from neural_net_utils import check_dims, random_weight_init #%% class InitializedLinear(nn.Linear): def __init__(self, initW, initB=None): self.initW = torch.as_tensor(initW) out_features, in_features =...
7010939f4e7614e9c43249891604ceb1bbe2c15894615954e8d7bb3aa1c6d6a9
Python
10,504
244
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import banditNarm_preprocess_func __all__ = ['banditNarm_singleA_lapse'] class BanditnarmSingleaLapse(TaskModel): def __i...
5ce4bb30816bd6ab7a3651fea20cf38209265b8fed4186ee3852f8dfbaae9982
Python
10,516
295
import os from abc import ABC from typing import TYPE_CHECKING, Dict, Iterable, Optional, Union import numpy as np import torch from bindsnet.network.nodes import Nodes from bindsnet.network.topology import AbstractConnection if TYPE_CHECKING: from .network import Network class AbstractMonitor(ABC): # lang...
9e8199436036e3ccb7d8ab3b9582982c7636ebf856fe32b333508f630f9bf0eb
Python
10,516
243
import sys import os import random import pandas as pd import numpy as np from einops import rearrange, repeat, reduce import argparse import torch import torch.nn as nn import torch.optim as optim from torch.optim import Adam, SGD, AdamW,RMSprop import torch.utils.data as Data from torch.utils.data import Dataset, Dat...
129b72a9bc37a813f45752606ffb13d9c4c1dabbda66e391fef158427ad13fe2
Python
10,524
315
import numpy as np import pandas as pd import seaborn as sns from pymbar import BAR import matplotlib.pyplot as plt import seaborn from simtk.openmm import unit import json from tqdm.auto import tqdm from openmmtools.constants import kB import joblib import logging import os from typing import Optional from perses.anal...
4d136d3fcc468404af26eace8a8daa22dd627351f77b3862554a029cec021391
Python
10,527
240
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import pst_preprocess_func __all__ = ['pst_gainloss_Q'] class PstGainlossQ(TaskModel): def __init__(self, **kwargs): ...
72016e8eeac8ee8bf8ef0683d7ba4f39f5974c15f504ede73ef3af65763396ff
Python
10,538
286
import argparse import numpy as np from pensa.features import \ read_structure_features, \ sort_features, \ select_common_features, \ get_multivar_res_timeseries from pensa.statesinfo import \ get_discrete_states from pensa.comparison import \ relative_entropy_analysis, \ kolmogorov_smirnov...
0d3b7f4356e534fe7d04765b03804dae73543a7f9270289121f6f0b0de7297f6
Python
10,540
367
import os import subprocess import cgatcore.experiment as E import sqlite3 as sql import pandas as pd import pandas.io.sql as pdsql import re import numpy as np # ------------------------------------------------------- # # Functions for expression quantification # ------------------------------------------------------...
7e92485368cd33d0a93398ccbb3e2f638623ae4a7c469a7b27d0fb03e08f0ca9
Python
10,542
326
import numpy as np from itertools import product from dreye.api import barycentric, spherical import seaborn as sns from scipy.spatial import ConvexHull from dreye.api.plotting.simplex_plot import plot_simplex from chreyesees import TINTERP_S from chreyesees import plot_scalebar from mpl_toolkits.mplot3d import axes3d...
b57bf886fb2fd6c8a559741fb9ca86e3f21bdad50ce4936616d69debaa3e2bc7
Python
10,546
314
import numpy as np import deeptime import matplotlib.pyplot as plt # --- METHODS FOR CLUSTERING --- def obtain_clusters(data, algorithm='kmeans', num_clusters=2, min_dist=12, max_iter=100, plot=True, saveas=None): """ Clusters the provided data. Parameters --...
347264adfa68b3bcabc0686e4b9abe84f38f9f1aa5cda7482d9561c4620d6d97
Python
10,547
240
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pdb import torch from torch import nn from functools import partial from .activations import ACTIVATION_REGISTRY import numpy as np # Run SineNet inference at 4x higher resolution. class ConvBlock(nn.Module): def __init__(self, in_ch...
c0ebea9c36ab3399c5d2bf53a1000a0b31e3363f74c2d4e4c7b7e7f0ffb67dde
Python
10,551
267
# 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...
759aa8bf3e3b660b729a31be7873c329215ed4d19d4442e65c1709fe66b52c86
Python
10,553
272
## This is a rewritten version of learn.py from the ML-Agents Toolkit ## It is used to load the AnimalAI Environment and pass the ## environment-specific parameters and custom SideChannel ## for loading config yml files. # # Unity ML-Agents Toolkit from animalai.envs.settings import AAIOptions from animalai.envs.envi...
1973bf3ced4d202b05638e6bd924b2f712cfeced1639be6f8c8eb16a42bd159c
Python
10,554
286
import os import shutil import zipfile from typing import Iterable, List, Tuple from urllib.request import urlretrieve import numpy as np import torch from scipy.io import wavfile class SpokenMNIST(torch.utils.data.Dataset): # language=rst """ Handles loading and saving of the Spoken MNIST audio dataset ...
c1b52e1ca54e722fd9025e3aa7fa0677088886f315962d71ad2206d0c44c2045
Python
10,557
220
import torch import torch.nn as nn from .odeint import SOLVERS, odeint from .misc import _check_inputs, _flat_to_shape, _rms_norm, _mixed_linf_rms_norm, _wrap_norm #adjoint_forward_calls = 0 #adjoint_backward_calls = 0 class OdeintAdjointMethod(torch.autograd.Function): @staticmethod def forward(ctx, sha...
e83a9955b27f9380e6c9a12331199e9a0c4768d9be3f79932546dc2b7569e09e
Python
10,559
242
import sys import os import random import pandas as pd import numpy as np from einops import rearrange, repeat, reduce import argparse import torch import torch.nn as nn import torch.optim as optim from torch.optim import Adam, SGD, AdamW,RMSprop import torch.utils.data as Data from torch.utils.data import Dataset, Dat...
e118686a251c8a07d2c75a765c08c4553711f72ad6c2a9244578f378a43f9f48
Python
10,583
246
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import choiceRT_preprocess_func __all__ = ['choiceRT_ddm'] class ChoicertDdm(TaskModel): def __init__(self, **kwargs): ...
2ffffe503d7ad8aee230f6c1e2eacc7710ef899d6965cb124b33779e1f1e694c
Python
10,590
275
"""Factory functions for embeddings.""" import functools import importlib from collections.abc import Callable from typing import Any from langchain_core.embeddings import Embeddings def _call(cls: type[Embeddings], **kwargs: Any) -> Embeddings: return cls(**kwargs) _BUILTIN_PROVIDERS: dict[str, tuple[str, st...
00289b586c338444e16a6063be9772585aab18bf1f2596b83c2e75e86b411bf3
Python
10,593
276
import seaborn as sns import matplotlib.pyplot as plt import os.path as op import pandas as pd import numpy as np from config_FaceName import MEG_data_path,group_name,Ids import scipy.stats as stats from statsmodels.stats.anova import AnovaRM sns.reset_defaults() def auroc2(accuracies:list, confidences:list, number_o...
4646e56121d3e0c9f8e231447b257e38ee875b69353e2ce872259edeace9c656
Python
10,593
192
"""Opt-in masking, native geometry and safe reuse of generated masks.""" import json import os from pathlib import Path import tempfile import unittest from unittest.mock import patch import nibabel as nib import numpy as np from preprocessing.brain_mask import generate_mask, mean_b0, synthstrip_environment from prep...
dedce5e435df6165369550b86bcddc87aea628bbfc3b53ede1a144d162459f87
Python
10,595
197
# srun --nodes=1 --ntasks=1 --cpus-per-task=24 --mem=80g --time=04:00:00 --pty bash -i # Sconda conda activate TensorFlow_CPU_01; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/code/; python # NOTE: # 1c part 2: The reviewers specifically asked us to do some robustness analysis wher...
da35b08b7037d140d64b2f6aaf0f0dc48f6938310911219bc4dec32208488fad
Python
10,596
198
import os import time d='/jukebox/griffiths/bert-brains/' dependencies=['prep','pobj','det','nsubj','amod','dobj','advmod','aux','poss','ccomp','mark','prt'] with open("joblist.txt","w") as f: for dataset in ['slumlordreach','black']: #Slumlordreach if dataset=='slumlordreach': subs=['sub-145', 'sub-1...
0415d13a287da3a1324c4ecfeec08a1e59fdb3d84216e59f59e39c6f05298173
Python
10,603
244
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import igt_preprocess_func __all__ = ['igt_pvl_decay'] class IgtPvlDecay(TaskModel): def __init__(self, **kwargs): ...
b1efbbbba809d9c17e2b88d9fe2bb8316dfd4b78302ef2c9ab0a39c607d9b71d
Python
10,603
282
# coding: utf-8 import os import tensorflow as tf import keras from absl import flags from absl import app from dlutils.layers.input_scaler import ScalingLayer from dlutils.models.unet import GenericUnetBase from retchat.callbacks import CosineAnnealingSchedule from retchat.callbacks import ExtendedTensorBoard from...
d1919558625e3421611387dbdc9656c7a65ab1c8b7bd4029cfe301911cb80ab9
Python
10,608
256
#### Examining enrichment in psychiatric disorders (TWAS and DEGs) import session_info import pandas as pd from os import environ from pyhere import here from functools import lru_cache from scipy.stats import fisher_exact from statsmodels.stats.multitest import multipletests environ['NUMEXPR_MAX_THREADS'] = '10' con...
06066035dd79598b9351028fe29d1eb9f9b2fd0152a0254dc2ebd556f485fba4
Python
10,612
322
"""Test automatic tool call count storage in tracers.""" from __future__ import annotations from unittest.mock import MagicMock import pytest from langchain_core.messages import AIMessage from langchain_core.messages.tool import ToolCall from langchain_core.outputs import ChatGeneration, LLMResult from langchain_co...
82e4f55296791da9f8f993860c8f1bac5c48f64e3a8a10d2eef2ddc58eb9d232
Python
10,618
198
#################################################################################### # # 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...
ea6bf1139b9ec44715a4a9cad049841e3a1c87d781c0456ad0952056810e1de8
Python
10,618
271
import math from e3nn import o3 from typing import Optional, Tuple, Union import torch import torch.nn.functional as F from torch import Tensor from torch_sparse import SparseTensor import torch.nn as nn from torch_geometric.nn.conv import MessagePassing from torch_geometric.typing import Adj, OptTensor, PairTensor f...
7067cf1d886702110a4698d0f6816ef2b955422bed53a16b438d2f464c411459
Python
10,620
256
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import rdt_preprocess_func __all__ = ['rdt_happiness'] class RdtHappiness(TaskModel): def __init__(self, **kwargs): ...
8e2c1e3fbfcc062c23fa44c9d6c46d491eb3e6f901b3f24a1ed0d50d890c6d57
Python
10,622
316
from cloudpathlib import AnyPath import numpy as np import pandas as pd import seaborn as sns from openmmtools.multistate.pymbar import _pymbar_bar import matplotlib.pyplot as plt import seaborn from simtk.openmm import unit import json from tqdm.auto import tqdm from openmmtools.constants import kB import joblib impor...
65634e702dcd0024121e48d7ca046a00e37832dc2cd0876a85d102cb645dea1d
Python
10,623
306
# Based on the code from: https://github.com/klicperajo/dimenet, # https://github.com/rusty1s/pytorch_geometric/blob/master/torch_geometric/nn/models/dimenet_utils.py import numpy as np from scipy.optimize import brentq from scipy import special as sp import torch from math import pi as PI try: import sympy as sy...
d7d53e17d010d0694fb0c46e7a20bf712c4611f84bef9aa7fe305e11136b79d3
Python
10,623
316
import math import numpy as np import h5py import random import torch from torch import nn from torch import Tensor import torch.utils.data as Data import torch.nn.functional as F from torch.autograd import Variable from torchsummary import summary from einops import rearrange from einops.layers.torch import Rearrange,...
b6f04e3ab8cea7181d7933ee164463617fc0543d4cf07363afb350e2b8a4a54f
Python
10,625
252
import logging _logger = logging.getLogger() _logger.setLevel(logging.INFO) _logger = logging.getLogger("load_simulations") class Simulation(object): """Object that holds the results of a free energy simulation. # TODO make this much more flexible Assumes that the output is in the form lig{A}to{B}/out-{ph...
85b9df2329cc4311f7264dbf5a836613ea3a194113bb43616b2a3a7568ed9f15
Python
10,626
283
import numpy as np from scipy.signal import filtfilt, butter,decimate from matplotlib import pyplot as plt import math import mat73 from scipy.io import loadmat import scipy import csv #Defining the probe site map, importing the chunk of data where the SWR from iHP and dHP are extracted siteMap = [28,27,29,26,30,25,...
18e6ad8cefbb1c6a0c8dcd701078b266d56ffc434bfc173213358db6d8c289d7
Python
10,628
293
#!/usr/bin/env python """ index.py - Index a corpus that is stored in a directory hierarchy as follows: - corpus - domain1 - language1 - file1 - file2 - ... - language2 - ... - domain2 - language1 - file1 - file2 - ... - language2 - .....
a26e29d2b893adeb25f75666ee3054f0b7b0926cfe0f349fe7a1339bb994c69c
Python
10,631
314
from collections.abc import AsyncIterator, Iterable from typing import TypeVar from langchain_core.output_parsers.list import ( CommaSeparatedListOutputParser, MarkdownListOutputParser, NumberedListOutputParser, ) from langchain_core.runnables.utils import aadd, add def test_single_item() -> None: ""...
31361b64b6f92ae5636be9dd09162a3210730af7ec1d1363a2a8b415b31e12c4
Python
10,634
246
import argparse import logging import os import random import shutil import sys import time import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tensorboardX import SummaryWriter from torch.nn import B...
66e46ec09b2caa17d4fa0def4d480a16b4e8deb972e05e3b5ea8914b155bf920
Python
10,636
237
import os import torch from collections import OrderedDict from abc import ABC, abstractmethod from . import networks class BaseModel(ABC): """This class is an abstract base class (ABC) for models. To create a subclass, you need to implement the following five functions: -- <__init__>: ...
33cf81f3c5e1073f4fad65bece1717a3f60693dc47b06f43ec17284495fe1ceb
Python
10,638
201
# -*- coding: utf-8 -*- """ Created on Tue Aug 22 17:32:38 2023 @author: plai3 """ import streamlit as st import numpy as np import pandas as pd from keras.models import model_from_json from Bio import SeqIO from io import StringIO from anarci import anarci def one_hot_encoder(s): d = {'A': 0...
5a3ad8fce3d130713e0f7cf8c0b1ac28e4816d0878906fb5aae56a5c35e2eddb
Python
10,639
300
import pandas as pd import numpy as np from itertools import combinations from sklearn.model_selection import RepeatedStratifiedKFold from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics import accuracy_score, roc_auc_score from sklearn.preprocessing import StandardScaler def feature_selection(x_tr...
f1dc103b5903a30e9bc3fc7ec6df1f7efc1be48cd7f21a9ca580a4fef0cd6f62
Python
10,639
341
import functools import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import spectral_norm from training.networks_stylegan2 import Conv2dLayer, Conv2dLayerDepthwise ### single layers def conv2d(*args, **kwargs): return spectral_norm(nn.Conv2d(*args, **kwargs)) def convTranspose...
7d16a3f8c445d48323e88a194ffe017faaeb354df2b401951b0c64b678d496a4
Python
10,641
313
# Copyright 2020 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...
560e9f6fe7a6a6db13b6ad08da33e4a4933fd99c96664e1da90869dc0d63f874
Python
10,642
313
#!/usr/bin/env python3 # Imports import re ############################################################################### KEGG = r'^(K\d{5})$' GH = r'(GH\d+)' PL = r'(PL\d+)' TIGRFAM = r'^(TIGR\d{5})$' PFAM = r'(PF\d+)' CE = r'(CE\d+)' EC = r'\\d{1,2}(\\.(\\-|\\d{1,2})){3}' class ModuleDescription: def __init__...
ab67514eeb4e7c6ce805e612777b74c343edfb8cd36e92215abd90a8336d5797
Python
10,647
300
import pandas as pd import numpy as np from itertools import combinations from sklearn.model_selection import RepeatedStratifiedKFold from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics import accuracy_score, roc_auc_score from sklearn.preprocessing import StandardScaler def feature_selection(x_tr...
10e42044973aab9da6f1f7c74d121364a6131adec597de260fe4cdfa4294a0cb
Python
10,648
246
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import choiceRT_single_preprocess_func __all__ = ['choiceRT_ddm_single'] class ChoicertDdmSingle(TaskModel): def __init__...
3ab3500a1b308b328b223fa227a5c2e8deeb463dcf72d02053e28d7b484d56bc
Python
10,653
205
import torch from torch.utils.data import DataLoader, dataset import os import time import pandas as pd import numpy as np from model import GraphBP from dataset_from_scratch import CrossDocked2020_SBDD, collate_mols import torch.optim as optim from torch_scatter import scatter from Bio.PDB import PDBParser import war...
76422422ebd143b9ba994b4f0e8be2cae2a6e89633d220a75cc30e226ea07fa6
Python
10,653
263
"""This module contains various functions for plotting data from `MotorNet` training and simulation sessions. """ import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from matplotlib import animation from matplotlib.collections import LineCollection from IPython.display import HTML, display_html ...
8858f4056085efca4853bf55ffd2a141b059291771b9f268b7e034a0650f9dec
Python
10,653
217
''' Test module for FNN trainer methods. :Version: 1.0 :Date: 08.02.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 Jan Melchior This program is free software: you can redistribute it and/or modify ...
fb9359a7e01d95724c564d206831f5289e95fd64344e4546da6e79893859ffef
Python
10,654
278
""" This script aims to convert BRAT format data into BIO format data for NER Entities will be mapped from their original offsets to the new offsets after sentence tokenization Two sentences are separated by a empty line entities and relations information are also provided in json format """ import os import sys impor...
0f9e34c1f7cb4d4c79d74ae3a397c77e6688a047b1a2163b81370690a65c5d6c
Python
10,655
282
"""Module describes PyTorch Geometric interfaces for nablaDFT datasets""" import logging import os from pathlib import Path from typing import Callable, List import numpy as np import torch from ase.db import connect from torch_geometric.data import Data, Dataset, InMemoryDataset from tqdm import tqdm from nablaDFT....
f3724f396be629c0265cf0179605b18bde28976d082400622e54e1e2c341c843
Python
10,658
240
import sys import os import matplotlib.pyplot as plt import matplotlib.patches as patches import itertools sys.path.insert(1, os.path.join(sys.path[0], '../../../../')) from Simulator.SimulatorPattern import simulatorPattern, simulatorPatternDual import Articles.Sequential_Learning_Striatum.Figures.cfg_pdf as cfg fr...
4b46f79c0622e0cef303ca619728276bdf4d59574c8eb0bd01c9a3c43b9d13b9
Python
10,662
302
import torch import torch.nn.functional as F import pandas as pd import numpy as np import json import esm import pickle from torch.utils.data import DataLoader from tqdm import tqdm import requests import os from src.dataloaders.utils.selene_utils import MemmapGenome from src.tasks.utils import index_mapping protei...
414be229bf674777382601a0e62b1278a2d8627ee3dc16b0c03c06e4a2584d4d
Python
10,664
280
import uncertainpy as un import numpy as np import matplotlib.pyplot as plt from prettyplot import * import os import h5py from scipy.stats import zscore def compute_local_maxima(t,variable,interval): index_left = np.where(t >= interval[0])[0][0] index_right = np.where(t >= interval[1])[0][0] local_time ...
4141e1d7b74d7e4c83436aa51eada9ef276789805535413267a812efe5318e34
Python
10,666
403
#!/usr/bin/env python """ Create a series of color overlays of prob labels on cor, sag or ax ROIs - ROIs are specified in a text file Usage ---- atlas_report.py -a <atlas directory created by atlas.py> atlas_report.py -h Authors ---- Mike Tyszka, Caltech Brain Imaging Center Dates ---- 2017-02-21 JMT Split from atla...
1225e27fa67d67ce60b307b7e3a6473fc8465024960734ba8612b8efe2b6873f
Python
10,671
295
import argparse import logging import os import random from functools import partial from typing import Dict import numpy as np import torch from datetime import datetime from transformers import (DataCollatorForLanguageModeling, T5Config, T5ForConditionalGeneration, TrainingArguments) from ...
901f4b33f26b833ecafec058d448e93af57cd6c9e9a630418c390f9742f3842b
Python
10,671
320
"""Implementation based on the template of ALIGNN.""" from multiprocessing.context import ForkContext from re import X import numpy as np import pandas as pd from jarvis.core.specie import chem_data, get_node_attributes # from jarvis.core.atoms import Atoms from collections import defaultdict from typing import List, ...
d09c9e8b0ddc20fbdefb939a5850612ad707ee207d99154df1cf3cbc52c0a6f4
Python
10,676
246
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import igt_preprocess_func __all__ = ['igt_orl'] class IgtOrl(TaskModel): def __init__(self, **kwargs): super()._...
2fae75e1f204f320e806115cd5707a7bbc70a6ad852b3ae6e4e2bf34ec04bc8c
Python
10,679
330
"""readqc.py - Tasks for QC'ing short read data sets ============================================================ The majority of the functions in this module are for running and processing the information from the fastqc_ tool. Reference --------- """ import os import re import glob import collections from io impo...
1b0f2585358cb3152acd25fcd4ad95dfc540e127e0e65790235a8781e461d2d0
Python
10,681
248
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import copy def get_clones(module, N): return nn.ModuleList([copy.deepcopy(module) for i in range(N)]) class seq_256bp_encoder(nn.Module): def __init__(self, base_size=4, out_dim=128, conv_dim=256): super(seq_256bp...
8e93518261deeece0968631090abde89117cab09b98856847074e2ac26f168c7
Python
10,681
291
#################################################################################### # # 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...
a760451aba277ff097dd007b220fe170b7686a7c622e9a2a51e6f90b83f3b2e6
Python
10,684
296
"""Load prompts.""" import json import logging from collections.abc import Callable from pathlib import Path from typing import Any import yaml from langchain_core._api import deprecated from langchain_core.output_parsers.string import StrOutputParser from langchain_core.prompts.base import BasePromptTemplate from l...
069979e897522515752b2e3251199951cd3908a08d7cc852d743d41a691ee135
Python
10,686
222
""" Retrain the YOLO model for your own dataset. """ import os import numpy as np import keras.backend as K from keras.layers import Input, Lambda from keras.models import Model from keras.optimizers import Adam from keras.callbacks import TensorBoard, ModelCheckpoint, ReduceLROnPlateau, EarlyStopping from yolo3.model...
ec6277b72e387e9dbecf025d5700555525e7f2202c2a84816727631fcfc30db7
Python
10,690
230
""" In this file the DSS engine is set up. The objects for circuit, bus, and branch are also set up for further use. 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 also defined here....
28a6faa028699365c59c59ab82979942f59e5d35d58fa95329e5bcb8f07d8858
Python
10,692
282
from __future__ import print_function import numpy as np """ This file contains utility functions to fit the free-water corrected tensor field from DWIs. """ water_diffusivity = 3.0e-3 # Convention for the tensor: we always represent the tensor elements # in this order: Dxx, Dxy, Dyy, Dxz, Dyx, Dzz def tensor_from_i...
18e4dbfa38dd37f973d5b7fbeca46c9e139c71fc3344ee8778a18a45f999ae7e
Python
10,693
207
#! /usr/bin/env python3 import os import logging import logging.config import tempfile import torch import datetime from torch.utils.data import DataLoader import lightning.pytorch as pl from lightning.pytorch.strategies import DDPStrategy from lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping from pre...
e4418c8a642b08dcab4d9c03c3e2ae10552c107dbac9b9cc7641f9192775defc
Python
10,693
231
import torch from CEL.networks.models.meta_model import ModelClass from torch.autograd import Function from itertools import chain from copy import deepcopy from tqdm import tqdm from torch.func import stack_module_state from torch.func import functional_call from einops import rearrange, reduce, repeat, pack, unpack i...
ef7d25be44fb7be0ef8e1f0795caa3d80a0710e166e62f7fe968f689ac70497d
Python
10,693
230
import os from time import time from copy import deepcopy import gc import json import re import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from utils.read_mda import readmda plt.rcParams["font.weight"] = "bold" plt.rcParams["axes.labelwei...
b17dbe1deee834806be1cb03a498d7f5d7a559b10f528577fe190f9376a80b78
Python
10,698
243
from __future__ import absolute_import from dataclasses import dataclass, field from typing import Optional, MutableMapping, Union, TypedDict, List, Dict, Any import numpy as np import pandas as pd @dataclass class TemporalData: """1-D time series datasets corresponding with an imaging trial. Accomodates all 1-D...
303308b6693794b12d4d3c327e2a2240a78f07bb788c4e23f292766453fa8a56
Python
10,699
281
import os, random from tqdm import tqdm import numpy as np import pandas as pd from torch_geometric.data import DataLoader import torch import torch.nn as nn import torch.optim as optim from torch.optim.lr_scheduler import StepLR from sklearn.metrics import roc_auc_score, mean_squared_error import sys from utils.co...
db51dbffd65dd591cfb296857e0de79872db95804754efacafad5f18bad4bf42
Python
10,701
244
import warnings from docstring_inheritance import NumpyDocstringInheritanceMeta from pycromanager.acquisition.acq_eng_py.main.AcqEngPy_Acquisition import Acquisition as pymmcore_Acquisition from pycromanager.acquisition.acquisition_superclass import _validate_acq_events, Acquisition from pycromanager.acquisition.acq_en...
c8dd58e4c066a7f3790619e91ffc9b732441f04b0841a638a13fcdb9568889e2
Python
10,706
222
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # 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...
35c512a563f56db8c035051142cc50cc673d098e7b0e26fde5d85c9196ec22a8
Python
10,711
299
def initialize_roi_dict( roi_dir, subj ): ''' Creates a dictionary of ROI NifTI mask file paths. Key value corresponds to ROIs name (e.g., 'R_amygdala') Input Parameters ---------------- roi_dir : str Root directory where ROI NifTI files are stored. (e.g., 'your/path/MN...
85f74b874335e7cd89687a1962ead44e23a91555c1d14ca66def70a4a777fac6
Python
10,711
164
"""Corpus-A number ledger: every corpus-A number quoted in the manuscript, recomputed from the final result files. Writes tables/summary_a.csv with columns key,value,ci,n,lo,hi,note. Statistics rules (progress.md, AUDIT_1 M1, AUDIT_2 C4): P1, P3: average the four datasets within (seed, fold), then mean and 95 % CI (...
7bffc7d6a7096e4d8e28fc92db2893c5eb0d1b68bac8fd76d764fb9e1a007944
Python
10,712
286
from __future__ import division import sys import os import json import numpy import datetime import argparse import time if(sys.version_info >= (3,0)): import configparser as cfg_parser else: import ConfigParser as cfg_parser import steps import steps.API_1.model as smod import steps.API_1.geom as swm impor...
580061ec4ff19d41f65e9362f44bce9bb13bd67f345dc1ebb107ed1bc3f6402f
Python
10,716
229
import pickle import numpy as np import os import sys import ntpath import time import torch from . import util, myhtml from subprocess import Popen, PIPE if sys.version_info[0] == 2: VisdomExceptionBase = Exception else: VisdomExceptionBase = ConnectionError def save_images(webpage, visuals, image_path,...
feded5f53e6a4b4140bb7fb1352cff334e0db1ade968d6b91dd1425caf5d9631
Python
10,720
268
# 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...
7530124d52e2a1620c9fb367f76073a107058290ad6a64281b2c45ae1cc057be
Python
10,724
343
"""Trainer for the spiking neural model.""" import statistics import torch import tqdm def training( dataloader_train, dataloader_val, model, learning_rate, device, epochs, optimizer, savepath, ): model.train(mode=True) # model = model.to(device) optimizer = str(optimizer)...
df71d5ca94699e749099c91a6c59b8bf8926278e3a7d8417d91bfefadc840353
Python
10,725
311
from __future__ import annotations import logging import re from collections.abc import Sequence from typing import Any from langchain_core.callbacks import ( CallbackManagerForChainRun, ) from langchain_core.language_models import BaseLanguageModel from langchain_core.messages import AIMessage from langchain_cor...
fda079212bdcbe4073ceb1cf79bcefad4657838cca34b9cb1f36ddd81963a833
Python
10,727
278
import sys;sys.path.append('../src/') import ClusterModelNEST import pylab import spiketools from GeneralHelper import (Organiser, nice_figure, simpleaxis, ax_label, psth_plot) import defaultSimulate as default datafile = 'suppl_fig4_balanced_state' def simulate_and_analyse(params): pylab.seed(None) ...
4a4edf62006cfc57453a7557436b14f07e6d8072641923b76e9d19fb815cc151
Python
10,728
295
import MDAnalysis as mda import pyemma import numpy as np import os import requests from MDAnalysis.analysis import align # -- Functions to preprocess trajectories -- def extract_coordinates(top, pdb, trj_list, out_name, sel_string, start_frame=0, rename_segments=None, residues_offset=0 ): ...
6781d0173da44326f1acc3fb888ad49099a199f37b862f58731034ab9f7bc6c0
Python
10,729
364
"""Simple benchmark to test the memory allocation of annotation stores. This is to be run as a standalone script to avoid inteference from the jupyter notebook environment. Tracking memory allocation in Python is quick tricky and this is not perfect. Two methods are used here for comparison. The first is simply to rec...
8b538125f5bc2ec40a9125d01a9c93dd9502f87f0ede7063a0af1be838512bfc
Python
10,729
247
import numpy as np import scipy as sp import pandas as pd import networkx as nx import itertools import time from scipy.spatial import cKDTree def get_knn_onesided(source, target, knn_k, knn_n_jobs, st=True): """Get kNN connections between source and target source: pandas dataframe which rows will be placed a...
5b80292b9ec1468056486fc54459ae59de6b874188bc72b2dc25fc08dc4f4b47
Python
10,731
284
# coding=utf-8 """Defines the ConvNet class.""" import torch import torch.nn as nn import numpy as np from .basenetwork import BaseNetwork from .layers import DenseUnit, ConvUnit, FlattenUnit from .utils import pad import logging from inspect import getfullargspec from math import ceil from collections import Ordere...
e9ff9e3f7b95062fe382b8203012ab7eb86148994239cce9a237d0a0e1cdecab
Python
10,731
299
import joe_and_lili import analyse_experiment as analyses import pylab from copy import deepcopy import analyse_model import numpy as np from GeneralHelper import Organiser def reaction_time_plot(monkey,nbins = 40, condition_colors = ['0','0.3','0.6']): rts = [] minrt = 1000000 max...