sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ad963d760a85fde126490340393abb3440403cf18d09aa191199483d1c5f8ee2 | Python | 7,169 | 178 | import numpy as np
import argparse
import os
import imp
import re
from mimic3models.phenotyping import utils
from mimic3benchmark.readers import PhenotypingReader
from mimic3models.preprocessing import Discretizer, Normalizer
from mimic3models import metrics
from mimic3models import keras_utils
from mimic3models impo... |
2d8fdc954f025e70717b992a1382d8a020eff9170af8e92c961e74759287793b | Python | 7,171 | 234 | from typing import Union, Iterable
import numpy as np
import torch
import torch.nn.functional as F
from rdkit import Chem
import networkx as nx
from networkx.algorithms import isomorphism
from Bio.PDB.Polypeptide import is_aa
class Queue():
def __init__(self, max_len=50):
self.items = []
self.max... |
4d09adfc1580449e18533ea8364b3c480db7905045cb3b4f7d6c389642d18e38 | Python | 7,172 | 230 | """Utilities for JSON."""
from __future__ import annotations
import json
import re
from typing import TYPE_CHECKING, Any
from langchain_core.exceptions import OutputParserException
if TYPE_CHECKING:
from collections.abc import Callable
def _replace_new_line(match: re.Match[str]) -> str:
"""Replace newline... |
776c911ac1f45944c52f86eaf1880f6ac956564725e824f3ace962033b4fbb31 | Python | 7,173 | 158 | """
In this file the sectionalizing and tie switch details are specified.
The DER details are also specified (in particular the ones with and without grid forming capability).
Also the path for the DSS file containing the circuit information is specified.
The final DSS circuit which will be used by the environment is... |
82f08df693976da5183bbf252cc2715016ba3251e0d2ac504e9aa32a011482b2 | Python | 7,175 | 169 | # 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... |
d1c64de4f918d14238a0822b204a36776737d38ae043c2d79031df3e8bc12740 | Python | 7,175 | 239 | """`Runnable` that routes to a set of `Runnable` objects."""
from __future__ import annotations
from collections.abc import Mapping
from typing import (
TYPE_CHECKING,
Any,
cast,
)
from pydantic import ConfigDict
from typing_extensions import TypedDict, override
from langchain_core.runnables.base import... |
9cfefecf2024d585628ea69c53d677f1c68df3d2fed255ce69ab31220d84adb3 | Python | 7,177 | 179 | import numpy as np
import argparse
import os
import imp
import re
from mimic3models.in_hospital_mortality import utils
from mimic3benchmark.readers import InHospitalMortalityReader
from mimic3models.preprocessing import Discretizer, Normalizer
from mimic3models import metrics
from mimic3models import keras_utils
from... |
75d92807ec23ca795f5a6c09dd38fb2512edcb2ff346ca1a504be76a45c3b5bf | Python | 7,191 | 261 | #!/usr/bin/env
"""
# Author: Kai Cao
# Modified from SCALEX
"""
import numpy as np
import torch
from torch import nn as nn
from torch.distributions import Normal
__all__ = ['activation', 'DSBatchNorm', 'Block', 'NN', 'Encoder', 'Decoder']
activation = {
'relu':nn.ReLU(),
'rrelu':nn.RReLU(),
'sigmoid':... |
38292f73478bfc96701cdbba5865d38ab41dd0500a409f5bead94e4ce97f711e | Python | 7,193 | 220 | """Parse the YAML configuration."""
import logging
import shutil
import warnings
from pathlib import Path
from typing import Callable, Dict, Optional, Tuple, Union
import yaml
from . import utils
logger = logging.getLogger("casanovo")
# FIXME: This contains deprecated config options to be removed in the next
# m... |
8345326edae2b9c9b39391d23a9ea0b2850dfed4928a94c6e172b19d85ce694b | Python | 7,194 | 174 | # 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... |
58d59ae6cafbba6fcfd300694ccc589357ec10aa813e81b96486aabdcd3205a5 | Python | 7,196 | 191 | #%% Train XgBoost
import numpy as np
from xgboost import XGBClassifier
import pickle
import os
#from sklearn.metrics import auc, accuracy_score, confusion_matrix, mean_squared_error
from sklearn.model_selection import cross_val_score,KFold, RandomizedSearchCV, train_test_split
from sklearn.metrics import accuracy_score... |
81153add5f4dd5bf34c361ac29983a0c140f6ddc9db4ad46db5ace707c180b64 | Python | 7,196 | 201 | ########################################################################
# 2D diffusion on an infinite surface from point source.
# AIMS: to verify STEPS spatial-stochastic solver 'Tetexact' supports
# local initial conditions and calculates surface diffusion rates correctly.
# STEPS equivalent model: Stochastic 2... |
84f5af7377c7eaa58a647abfbab396412769963f06ff1b3d5cb2edf5e07c86e3 | Python | 7,196 | 174 | import numpy as np
import pandas as pd
from sklearn.gaussian_process.kernels import RBF, Kernel
from ._base import _CITestResult
from .hsic import HSIC, _gamma_pvalue_from_moments
class KCI(HSIC):
r"""
Test whether two continuous variables are independent given a set of other variables.
KCI can detect b... |
b033ff0cb2bda01032b30516b4f7916fa376e205b32543692109b1c81d46ff5d | Python | 7,198 | 167 | """
Author: Benny
Date: Nov 2019
"""
import argparse
import os
from data_utils.ShapeNetDataLoader import PartNormalDataset
import torch
import logging
import sys
import importlib
from tqdm import tqdm
import numpy as np
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = BASE_DIR
sys.path.append(os.path.j... |
0c1e2069ad1f826e0dbc84645fe6e6ad6c74b5013b71fc99ad4f8b448be98cca | Python | 7,200 | 180 | import sys
sys.path.append(".")
import os
import argparse
import io
import tarfile
import multiprocessing as mp
from tqdm import tqdm
from contextlib import nullcontext
import torch
from mat2seq import CIFTokenizer
from mat2seq import (
GPT,
GPTConfig,
)
from crystallm import array_split
# Set the visible CU... |
5ac8e764498b1049a876adace0bc3b6d6fc03309960d5a2fb925b74a53f4fd56 | Python | 7,203 | 160 | """
In this file the sectionalizing and tie switch details are specified.
The DER details are also specified (in particular the ones with and without grid forming capability).
Also the path for the DSS file containing the circuit information is specified.
The final DSS circuit which will be used by the environment is... |
2f5c94577ffd6577f0011ae74d0acf1a313d2293adf29e344bd5d58c5122e4f7 | Python | 7,204 | 218 | """Single-cell adapters for BERNN.
The functions in this module keep the core BERNN trainer matrix-based while
providing a thin AnnData-facing API suitable for scRNA-seq benchmarks.
"""
from __future__ import annotations
from typing import Any, Optional
import numpy as np
import pandas as pd
import torch
from scipy... |
6deab5156fd95b6413e2283427754b6bc08eeeef2648ffcc5fc1fd6b09a6ca1e | Python | 7,204 | 194 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class _DenseLayer(nn.Sequential):
def __init__(self, num_input_features, growth_rate, bn_size, drop_rate):
super().__init__()
self.add_module('norm1', nn.BatchNorm3d(num_input_featur... |
3a358a8b7ffaea6dee4882b0390c653d6910b3a4335fdc35a5337d458e0a7d69 | Python | 7,208 | 219 | ########################################################################
# 1D diffusion in a finite tube with fully-reflective boundary.
# Circular "point source" from one face.
# AIMS: to verify STEPS spatial-deterministic solver 'TetODE' supports
# local initial condition on boundary, calculates volume diffusion ... |
eb5bddc52bc72b93696e6b1e5ac8f01adcc774863792901d0fda89db229cf3fe | Python | 7,208 | 208 | from funlib.learn.torch.models import Vgg3D
from synister.read_config import \
read_worker_config, \
read_predict_config, \
read_train_config
from synister.synister_db import SynisterDb
from synister.utils import init_vgg, predict, get_raw
import json
import logging
import multiprocessing
import numpy as np... |
b451e8f55b33a877d5f3081aec90611700fe302f8967bc2f91b8cced45284c27 | Python | 7,211 | 209 | import os
import numpy as np
import xarray as xr
import pandas as pd
import argparse
from frites.io import logger, set_log_level
from frites.config import CONFIG
from frites.workflow import WfMi, WfMiCombine, WfStats
from frites.dataset import DatasetEphy
from pathta import Study
from research.study.pblt import (ge... |
a61ce23193ab5d48ef2008f96703305a3e2545828f7cb3a1ca6f61e6adb53120 | Python | 7,213 | 208 | # 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.
# model settings
model = dict(
type='CascadeRCNN',
pretrained=None,
backbone=dict(
type='ConvNeXt',
... |
db7a036e06e1f2273f4a7f8478dcbd4d85eb3afdcf006a9c168ff2b9699517a4 | Python | 7,220 | 170 | 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 jax.tree_util as jtu
import tensorflow as tf
import tensorflow_datasets as tfds
import optax
import seaborn as sns
import hydra
from omegaconf... |
3da9a6fb52923733b680a3d150ad779eeb2d06c7c296284bd692e5179de62f9a | Python | 7,225 | 219 | ########################################################################
# 1D diffusion in a finite tube with fully-reflective boundary.
# Circular "point source" from one face.
# AIMS: to verify STEPS spatial-deterministic solver 'TetODE' supports
# local initial condition on boundary, calculates volume diffusion ... |
59059060a29ef49fc5ba1d9ff1f3fc3f18c4df21f1e2b7458be70a083f43cf08 | Python | 7,225 | 202 | from __future__ import annotations
from pathlib import Path
from typing import Dict, Union
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from libs.eval.expresult import ExpResult
class Visualizer:
def __init__(self) -> None:
self.fsize = 16
self.plt_label = [
... |
93823fa7a4fac79f1bc4a930a7576ca50069ac5bdfa718fad266ad98e2c4a798 | Python | 7,227 | 208 | ####################################################################################
#
# 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... |
f8cc56acb904457c2d55c305c210f926f6f10efa5ac97d1aa4de63bda19222f4 | Python | 7,227 | 184 | import pandas as pd
from skbase.base import BaseObject
from skbase.lookup import all_objects
class BaseSupervisedMetric(BaseObject):
"""
Base class for all metric classes in pgmpy that require ground truth causal graph.
Every supervised metric sets all of the tags listed by ``pgmpy.registry.all_tags("sup... |
66da6deffccf4fbab6cb7eb75da4159ce3845a008eedd481b443a40c1cb9d5a4 | Python | 7,233 | 193 | import torch
import numpy as np
import matplotlib.pyplot as plt
import joblib
from data import generate_recog_data
from net_utils import load_from_file
class BogaczAntiHebb():
"""As described in Bogacz and Brown 2003."""
def __init__(self, init, eta=.5):
"""init is either an integer (number of novelty... |
47d91450b9862585ebc7de164ab1fd30e3a1b0807df60d1dbc969952fe11019e | Python | 7,234 | 169 | # 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... |
704ae8523e7143b50ef4433be4151bf483547d91cac712be7b20ce4575c340ba | Python | 7,235 | 176 | # -*- coding: utf-8 -*-
# :noTabs=true:
import os, sys, time, collections, math
import stat as stat_module
try:
from .base import *
except ImportError: # workaround for B2 back-end's
import imp
imp.load_source(__name__, '/'.join(__file__.split('/')[:-1]) + '/base.py') # A bit of Python magic here, what... |
b9a11e9414df2acc82c0871ba69bcf28b9dbb0af336759ced2cbf089bd2c640a | Python | 7,235 | 215 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
from dipy.core.gradients import gradient_table
from dipy.io.gradients import read_bvals_bvecs
import dipy.reconst.dti as dti
import nibabel as nib
import numpy as np
import pylab as pl
# from scilpy.utils.bvec_bval_tools import (normalize_bvecs, is_normali... |
915ba3f8232d2bdff2b0bbc6cdeb025b4c95b490cfad359ad815fd2bb5745976 | Python | 7,239 | 224 | import argparse
from pathlib import Path
from datetime import datetime
import logging
import pickle
import quantities as pq
import neo
from neo.utils import get_events, cut_segment_by_epoch, add_epoch
from elephant.signal_processing import butter
from elephant.spectral import welch_psd
import numpy as np
from numpy... |
9be1b6ef08111047fdcc83b9847b6a4c4d942e58c565593e7a8a4e265cd33f90 | Python | 7,239 | 155 | """
Samplers for perses automated molecular design.
TODO:
* Refactor tests into a test class so that AlanineDipeptideSAMS test system only needs to be constructed once for a battery of tests.
* Generalize tests of samplers to iterate over all PersesTestSystem subclasses
"""
__author__ = 'John D. Chodera'
##########... |
654c457808c0e0ce19f63adaf60bbf7726f564780bcdbc9e86aedf08ba3f8092 | Python | 7,240 | 192 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import scipy.stats
import numpy.ma
import Stats
import Histogram
from cgatReport.Tracker import *
from cpgReport import *
##########################################################################
class Externa... |
209ebc5afcfc9d5f93813b8a96fdbb02120d2c81e8eb7ef11ee862c1000c4c6e | Python | 7,241 | 177 | import torch
def linear_interpolate(
values: torch.Tensor,
times: torch.Tensor,
target_times: torch.Tensor,
dim: int,
) -> torch.Tensor:
"""
values : (T, d) float32/float64
times : (T,) same dtype, strictly increasing
target_times : (S,) same dtype, each in [tim... |
2984fab45e00df9ba3224351fd8c100b274e7db597942ce171828203480d651f | Python | 7,243 | 208 | ####################################################################################
#
# 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... |
f5c3a2bff938c952077eea60f7f52631617465e43921e53d08c43ae10fddefec | Python | 7,243 | 205 | #
# import networkx as nx
import numpy as np
import torch
import scipy.sparse as sp
from sklearn.neighbors import kneighbors_graph
##### generate n
def generate_adj_mat(adata, include_self=False, n=6):
from sklearn import metrics
assert 'spatial' in adata.obsm, 'AnnData object should provided spa... |
b2de992672e68fec7e153d128b454638ad9fe3b63d73736785bf59326a52b206 | Python | 7,249 | 212 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import List
import torch
# import torch.utils.data.datapipes.datapipe as dp
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader
from .registry import DATAPIPE_REGISTRY
from .utils import PDEDataC... |
9916ff91d66dfccbe1beac3eceac44cd5e9a9f95a3e0abe4b95cfd8730a7ded8 | Python | 7,256 | 231 | # 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... |
32535306a8959323835f0e71ef0ee0de58f7f3c291065724bb16cc28cd619e58 | Python | 7,257 | 205 | # todo:
# add compatibility for SingleImage frames
import os.path
from datetime import datetime
from dateutil import tz
import numpy as np
from imagingplus.utils.images import ImportTiff
from imagingplus.main.subcore import TemporalData
from imagingplus.main.core import ImagingTrial
from pynwb.file import Subject... |
9bd6b3221e61ac2bfdef7ecb120786df5cba3f8fc51c317ad7d31eafffb82353 | Python | 7,258 | 151 | """
Module to generate supplementary figure analysing stimulation at different locations
Author: jonas.braun@epfl.ch
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter1d
from scipy.ndimage import center_of_mass
import pickle
import cv2
from tw... |
b20c5092161e383430c47697953c9b7459156aec77846378c14f5a13afda0718 | Python | 7,262 | 207 | # Utils for computing properties for one molecule
import torch
import scipy.constants as sc
import numpy as np
def S_prod(x, y, mat_S):
"""
x: B, T, nbands, norbs
y: B, T, nbands, norbs
mat_S: B, norbs, norbs
return: B, T, nbands
"""
# prod = x[:, :, :, None, :] @ (mat_S[:, None, None, :, ... |
40493a2b35d6fc7dfe4407e29e69669f35ad7b6f65fdfcaf4fc6292872dd51e6 | Python | 7,269 | 199 | import torch
from torch.utils.data import Dataset
import numpy as np
import re
import json
class Mol3DDataset(Dataset):
def __init__(self, texts, tokenizer, max_len, conditions=None, conditions_split_id=None):
self.texts = texts
self.conditions = conditions
self.conditions_split_id = condi... |
909645c4b4e34bd779a8d82dfbb4ee076d30eddc197dc42b4856c9295a68dcc8 | Python | 7,270 | 249 | """Parsers for list output."""
from __future__ import annotations
import csv
import re
from abc import abstractmethod
from collections import deque
from io import StringIO
from typing import TYPE_CHECKING, TypeVar
from typing_extensions import override
from langchain_core.messages import BaseMessage
from langchain_... |
75518ecd709710f0602ef559a0d7dfdb373f515597df2cc567fb67c4c669396b | Python | 7,273 | 169 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 16:36:51 2019
@author: shni2598
"""
import numpy as np
import numpy.ma as ma
from connection import coordination
#from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
#from numba import jit
#import pdb
#nan
#isnan
def connec... |
504359990f33f59fbea75fd64c25fb561c59b338b9153833db7e782394aa8763 | Python | 7,278 | 203 | ########################################################################
# 2D diffusion on an infinite surface from point source.
# AIMS: to verify STEPS spatial-stochastic solver 'Tetexact' supports
# local initial conditions and calculates surface diffusion rates correctly.
# STEPS equivalent model: Stochastic 2... |
9c4c9448e76898ee0c95186ed8859ffa7c356864ada8a7066c86054dd9459a8e | Python | 7,280 | 150 | import numpy as np
import copy
from NeuronModel import integrate_and_fire, izhikevich, integrate_and_fire_MSN
class synapticClass:
parameters = {'save': False}
def __init__(self, weightInstance, **kwargs):
self.weight = weightInstance
self.I_output = [np.zeros(self.weight.neurons_output.P)]
... |
ca4313d4cae84e5fa7e978e70fae0f53b5bf7d0d8735a36b642e177da6bd1384 | Python | 7,283 | 173 | # 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.
import math
from typing import Iterable, Optional
import torch
from timm.data import Mixup
from timm.utils import accura... |
8439626a42d08e16e3fe6d8c4c73575c8543d99b11b723e1170eb5a91aa8b437 | Python | 7,287 | 223 | import pickle
from pathlib import Path
from typing import Union, List
from MRdataset import logger
from MRdataset.base import BaseDataset
from MRdataset.bids import BidsDataset
from MRdataset.config import VALID_DATASET_FORMATS
from MRdataset.dicom import DicomDataset
from MRdataset.utils import random_name, check_mrd... |
af52e1b704b9cf9b2564e254796f67d3fcac9950a0e09b38e731e236ef945a53 | Python | 7,287 | 189 | import numpy as numx
import pydeep.base.numpyextension as npExt
from pydeep.base.activationfunction import Sigmoid
class BinaryBinaryDBM(object):
def __init__(self, input_dim, hidden1_dim, hidden2_dim, offset_typ, data, dtype = numx.float64):
''' Initializes the network
:Parameters:
... |
5e368f198e124bc6f29471a68db5eb6ba3f1e8ded2a4dc61ffa86013e9ad0477 | Python | 7,288 | 189 | # Import relevant packages
from __future__ import print_function
import argparse
import numpy as np # for simple calculations
import os # for saving
import sys
from rdkit import RDLogger
lg = RDLogger.logger()
lg.setLevel(4)
import rdkit.Chem as Chem
from pymongo import M... |
e014e493febf3114f251668328a654d564c402391a45604b68ae641bb44c6377 | Python | 7,288 | 158 | import threading
from pycromanager.acquisition.acq_eng_py.main.acq_notification import AcqNotification
from types import GeneratorType
def _axes_to_key(axes):
""" Turn axes into a hashable key """
return None if axes is None else frozenset(axes.items())
class AcquisitionFuture:
def __init__(self, acq, ax... |
4d01931153269db2299b986bf63459e0f2709866b2f3b4f0a4f7dddcdc1c45ab | Python | 7,289 | 183 | """Class for a conversation memory buffer with older messages stored in a vectorstore .
This implements a conversation memory in which the messages are stored in a memory
buffer up to a specified token limit. When the limit is exceeded, older messages are
saved to a `VectorStore` backing database. The `VectorStore` ca... |
f7974127128a0ec45ef78ab0cf37263c56089549998b77aa45b4c99900a41fd3 | Python | 7,289 | 162 | """
A helper module to compute HSV colors for each frame in an animated DR plot.
The colors are chosen such that the perceptual distance between colors
corresponds to the difference between the frames, with respect to some set of
points of interest.
"""
import numpy as np
from sklearn.cluster import AgglomerativeCluste... |
256d2de92ce1de5fcf9572c7c425df413944995cd13946561f69a87acc84edd9 | Python | 7,291 | 129 | import gzip
import argparse
from collections import deque
def add_species_coords(main_args):
probes_file = gzip.open(main_args.probes_file, 'rt')
maf_seq_file = gzip.open(main_args.maf_seq_file, 'rt')
output_file = gzip.open(main_args.output_file, 'wt')
isMammal = {"hg19": 1,"panTro4": 1,"gorGor3": 1,... |
394be6627785340da7c2ba05c40a4f22d7d25f514f1ca1c56e12ed3a92fe11e9 | Python | 7,292 | 224 | """
2023.08.30
author: femke.hurtak@epfl.ch
Script to compute how for a signal can propagate in the network starting from
a specific neuron.
"""
import pandas as pd
import matplotlib.pyplot as plt
import os
from tqdm import tqdm
import numpy as np
from scipy.stats import bootstrap
import neuron_params
import plot_par... |
a06e60bd0b03ebbf711442d9a74958b6dc9d1a386c0ba99ca618aa9e5c6f5d17 | Python | 7,295 | 153 | """
The objective of this analysis is to assess the reliability of the results
when using a reduced number of sessions, in order to determine a minimum
number of sessions to perform in the study.
We assess reliability of a scalar measurement in three ways:
1) The correlation across subjects of the measurements obtaine... |
1f5d6c98b643e416c98c7e6d526e5f55bad706001db6fccf58f4e20c757c6e38 | Python | 7,296 | 227 | import math
from typing import Tuple, Union, Callable
import inspect
import numpy as np
import torch
import torch.nn as nn
from sam.nn.common import get_act_fn, AF2_PositionalEmbedding
from sam.nn.autoencoder.ca_models import AE_IdpGAN_TransformerBlock
##############################################################... |
20d7fc6732af0ace7e8db52a8a3243f6d66de4f265b550837e356b837d353822 | Python | 7,296 | 146 | import pytest
from openff.toolkit import ForceField
class StaleForceFieldTests:
@pytest.mark.skip(reason="Needs to be updated for 0.2.0 syntax")
def test_create_forcefield_from_file_list(self):
# These offxml files are located in package data path, which is automatically installed and searched
... |
480a3e748c793d9987071a5a169646d0cbc0f1316d76bd73ca19d524f8308fbd | Python | 7,296 | 230 | """
##############################################################################
#
# Filter the protein-coding set of exons that have valid(long-enough)
# regions around 5/3-splice-site.
#
# AUTHOR: Maciej_Bak
# AFFILIATION: University_of_Basel
# AFFILIATION: Swiss_Institute_of_Bioinformatics
# CONTACT: w... |
cd8c54de159a923cbfe5f6ca3deae3be039f3772f37f264657720de2a970a3e5 | Python | 7,296 | 131 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
a0af23789b2322d76e6f257b77eadbf65cca1be091fa466533b5a493d3934ca6 | Python | 7,299 | 215 | """
##############################################################################
#
# A wrapper for tasks related to extraction of window-wise information:
# Given a list of sites in bed format, genome in fasta and an encoded
# relative coordinates of windows -> extract absolute window coordinates
# and their... |
c3f12660f56ed4e8154e1ba682c07a0affcb07a3f5e3811d34e6d6399396bd7c | Python | 7,300 | 192 | import argparse
import torch.nn as nn
import torch.optim as optim
import sys
sys.path.append("../../")
from TCN.char_cnn.utils import *
from TCN.char_cnn.model import TCN
import time
import math
import warnings
warnings.filterwarnings("ignore") # Suppress the RunTimeWarning on unicode
parser = argparse.ArgumentPa... |
323391488ea9dadda604f4fd763466e39db113cc4740453c22779a733c71a5cf | Python | 7,303 | 206 | '''Splits image filenames (ID's) to use in training, validation and testing sets
Notes:
(i) ID's are shuffled before splitting
(ii) images without corresponding annotation files are dropped
Example usage:
python create_splits.py \
--images_dir "./data/scales_data_sample/images/"\
--annotations_di... |
66b328b77482b855b730c1499e66c8ef43b3e5b76ed66aef119b89c3774f1ea3 | Python | 7,304 | 176 | # ~ based off code originally written by Adam R. (in the Josselyn Lab ~ 2023)
"""
!!!! READ FIRST !!!! ~ HOW TO USE THIS SCRIPT
As of now, this script can be run with two options. Note that this script is also not tested yet, so there maybe be errors that you should fix and git commit/push please :)
Option 1) use fo... |
4c8a2adc8f0bed28ab2db30057bba08a6f8a71474ec7e8a04ac46469145dd102 | Python | 7,306 | 172 | ''' Toy example using FNN on MNIST.
:Version:
3.0
:Date
15.07.2014
:Author:
Jan Melchior
:Contact:
pydeep@gmail.com
:License:
Copyright (C) 2014 Jan Melchior
This program is free software: you can redistribut... |
954e63ade5e8b8f811897e40b22d81308451054753327cd9de2942c658dfd7bf | Python | 7,308 | 176 | import argparse
import warnings
from pathlib import Path
from time import time
import torch
from rdkit import Chem
from tqdm import tqdm
from lightning_modules import LigandPocketDDPM
from analysis.molecule_builder import process_molecule
import utils
MAXITER = 10
MAXNTRIES = 10
if __name__ == "__main__":
pars... |
ece78eab2a9adaff352f6fe44299515471785e9b7457f91575328bf0af43941d | Python | 7,310 | 229 | # coding: utf-8
""" MIT License """
'''
Project: Parenchymal Attention Network
Authors: Axel Masquelin
Description:
'''
# Dependencies
# ---------------------------------------------------------------------------- #
from torch.utils.data import Dataset
from sklearn.utils import resample
from PIL import Imag... |
cf3af7b394ffc0bd9a3795cdeee6c570f7d6f187a8acc9f0bef09f111dfefd87 | Python | 7,313 | 155 | # Sconda conda activate TensorFlow_CPU_01
# cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/results/fcdnn_most_variable_genes; python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import roc_curve, auc
from scipy.sta... |
b74fa3d38602d55b9a9f0a82673b6794768eef5c61ea71c58869b1f65e2bd747 | Python | 7,320 | 231 | # 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... |
1f545b44b661b7436c441713bd05569fbc672f486f8804e4f91848c1f8c7a2a6 | Python | 7,323 | 188 | import matplotlib
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
import cv2
import numpy as np
import torch
from torchvision.transforms import Compose, Normalize, ToTensor
from typing import List, Dict
import math
from scipy.ndimage import zoom
def preprocess_image(
img: np.ndarray, mean... |
941274284b7018ad36180e8437488447738bdbc2104b36a19420e48debf95a04 | Python | 7,325 | 224 | import argparse
from multiprocessing import Value
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
import mne
from mne_bids import BIDSPath
import coffeine
from mne_features.feature_extraction import extract_features
from mne.minimum_norm import apply_inverse_cov
import h5io
from utils imp... |
16ba7f1f855fb990d10faeb88cf4108d2e590ff3e4e25892f8b906d4e5dc7b2f | Python | 7,330 | 203 | # coding: utf-8
""" MIT License """
'''
Project: Parenchymal Attention Network
Authors: Axel Masquelin
Description: Secondary Analysis showing the distribution of performance across all runs
'''
# Libraries
# ---------------------------------------------------------------------------- #
from sklearn.metrics... |
066cf5bae82131eed2ad251fc05b2ed65366b322bb7ec9e95099228cc37c5a86 | Python | 7,333 | 156 | """
Samplers for perses automated molecular design.
TODO:
* Refactor tests into a test class so that AlanineDipeptideSAMS test system only needs to be constructed once for a battery of tests.
* Generalize tests of samplers to iterate over all PersesTestSystem subclasses
"""
__author__ = 'John D. Chodera'
##########... |
db2ee93d8cf3befa662e2d1a399df2b438fe22ec6ff10fd7cdb90bb1cad1a0e6 | Python | 7,333 | 262 | """Tests for handle_event and _ahandle_event_for_handler fallback behavior.
Covers the NotImplementedError fallback from on_chat_model_start to on_llm_start.
Handlers must declare `serialized` and `messages` as explicit positional args
(not *args) — see on_chat_model_start docstring for details.
See: https://github.c... |
2d03719c272ee562aa50583ecd17f75fd78d77103c6fbe37ccc59d36d0f47de3 | Python | 7,339 | 208 | """Load question answering with sources chains."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any, Protocol
from langchain_core._api import deprecated
from langchain_core.language_models import BaseLanguageModel
from langchain_core.prompts import BasePromptTemplate
fro... |
f29dd3e6e1cbcacc4819a5e60bc23a37b3e080d50a7e066cefcb94e0fa33909c | Python | 7,339 | 197 | # 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.
import torch
from torch import optim as optim
from timm.optim.adafactor import Adafactor
from timm.optim.adahessian imp... |
b18cc5e34db466dfa988d00709dc21c14a9264212daa781d0fc79cffd27a80ee | Python | 7,341 | 155 | import gym
import random
from gym import spaces
import numpy as np
import logging
from random import sample, choices, uniform, randint
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', ... |
b890cc569bda0bad68a5273f48706ec2e7600ad960818fca44105080c54bfc26 | Python | 7,341 | 196 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import scipy.stats
import numpy.ma
import Stats
import Histogram
from cgatReport.Tracker import *
from cpgReport import *
##########################################################################
class Interva... |
4799bfc5d436dfd49628e0ccf0e0eda35f900344c05da5888d3720636d405e6c | Python | 7,348 | 168 | import logging
import numpy as np
from openmmtools.integrators import PeriodicNonequilibriumIntegrator
from openmmtools.utils import get_fastest_platform
from pkg_resources import resource_filename
from simtk import unit
from simtk import openmm
import os
import pathlib
import time
from perses.app.relative_point_mutati... |
7d833e1da232eea28325200f5572fb04b84a260da0655121ba8c76bc54113c23 | Python | 7,349 | 212 | # Functions for calibration of results
from __future__ import division, print_function
import sklearn.metrics as metrics
import numpy as np
import pickle
import keras
def evaluate_model(model, weights_file, x_test, y_test, bins = 15, verbose = True, pickle_file = None, x_val = None, y_val = None):
"""
Eva... |
6de18d0c39a687aaff1917acd31a21b123eb7facc88c23a1772becf48bdb8246 | Python | 7,351 | 211 | """
:AUTHOR: Jonas Scherer
:ORGANIZATION: Department of Neurobiology and Department of Cognitive Neuroscience, Bielefeld University, Germany
:CONTACT: jonas.scherer@uni-bielefeld.de
:SINCE: Tue Dec 13 17:57:00 2022
:VERSION: 0.1
This module contains helper functions for plotting figures.
"""
import pandas as pd
import... |
6f4fc6b522d38b175928eaa4df19bd33ef73a746cd6cf8de545e11913a4a2540 | Python | 7,352 | 200 | ########################################################################
# 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... |
393bf83ee078d7f8dcd2dd3e166cfa8720e943cd36c88b44820c151787e1d7c9 | Python | 7,355 | 229 | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------'
import os
import yaml
from yacs.config import CfgNode as CN
_C = CN()
... |
33e3ff62c7f3e91e5bebf7d88453bc56b95f314a824870628b9baf48a7d37d8c | Python | 7,357 | 216 | 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... |
a077d58e2fa6bdd74ee8b43ef17a4591a198935cbad907cb59b360f7bf51a28c | Python | 7,359 | 230 | import os
import pickle
import argparse
import numpy as np
#from sklearn import preprocessing
#from sklearn.metrics import confusion_matrix
#from sklearn.metrics import accuracy_score
#from sklearn.ensemble import RandomForestClassifier
#
#import scipy.ndimage
#import skimage.restoration
import img3
SCALER = "classi... |
1728e15ce89366901372b7919b12bb9ce37b93b05fe2902986528b1954165097 | Python | 7,360 | 169 | import math
import logging
from tqdm import tqdm
import numpy as np
import copy
import torch
import torch.optim as optim
from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data.dataloader import DataLoader
from torch.cuda.amp import GradScaler
import re
import pandas as pd
from rdkit import Chem
logger = l... |
fe8137ff104b4f02165eb1ffd3a06f5ae5de81afe721fa05820a83bd106e7f06 | Python | 7,362 | 198 | # /// script
# requires-python = ">=3.12"
# dependencies = ["iohub", "napari[pyqt6]", "numpy", "pyyaml", "waveorder[all]"]
# ///
"""Sweep one or two config parameters, reconstruct each value, and view results.
Writes one config per value (or per value pair) into an output folder, runs
``wo rec`` for each, then opens t... |
ca19e0df43c11a64b5daa4769c608dc789aca5205efe253c9fad1a07ffda5059 | Python | 7,363 | 199 | """Use GTR to model distribution of future viral sequences
"""
import numpy as np
from easyDesign import alignment
from easyDesign.utils import predict_activity
from scipy.linalg import expm
class GTRSubstitutionMutator:
"""Use the GTR Substitution model to mutate viral sequences
"""
def __init__(self, a... |
2c9e9ec1245a70e71dd874e10afe3c6eb2bb638e915d2b1f2b14f90a612fab82 | Python | 7,364 | 198 | import math
import torch.nn as nn
from torch.nn.modules.dropout import Dropout
from torch.nn.modules.linear import Linear
from torch.nn.modules.normalization import LayerNorm
from torch.nn import functional as F
from torch import Tensor
from core.network.model import model_register
from core.network.model.encoder.gra... |
fb23819b369404fe9b3ae2f077a81337f95700ea1da258534a50d1b66071b5cf | Python | 7,371 | 184 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function
import os
import torch
import torch.nn as nn
from torch.nn import functional as F
import joblib
f... |
33fd65c8e5cdcbaff84ff6242be1cd158d23032584f58fe722bcaeb4e91887e5 | Python | 7,373 | 206 | import Bio.SeqIO as sio
import tensorflow as tf
import numpy as np
from sklearn.preprocessing import LabelBinarizer
from tensorflow.keras.utils import to_categorical
import random
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import tqdm
#load model
filterm = tf.keras.models.load_model(os.path.join(os.path.dirnam... |
61a5ad09dbc1551a44dcddf885b48802e6d27469eec578cc6d06b34d06382773 | Python | 7,375 | 206 | import torch
from torch_scatter import scatter_sum
from e3nn import o3
from .blocks import (
EdgeBoosterBlock,
AtomicBaseUpdateBlock,
PolynomialManyBodyBlock,
NonLinearReadoutBlock,
AtomicScaleShiftBlock
)
from .utils import get_edge_vectors_and_lengths, compute_forces
from .embs import (
MLP,... |
4d96900f447361d93b89f451e689a35dd6a3fe3b34e301f76b19e113ef21a9f7 | Python | 7,378 | 153 | from argparse import ArgumentParser
import pandas as pd
import numpy as np
from typing import List, Tuple
from sklearn.model_selection import StratifiedKFold, train_test_split
replace_dict = {'NV':0, 'MEL':1, 'SCC':2, 'BKL':3, 'BCC':4, 'AK':5, 'DF':6, 'VASC':7}
def get_states(random_state, low, high, size):
rs = ... |
72b0c596e519bf5bd7499512d7a022b8c98d40ae9bdf475198dfb425d7ca43fd | Python | 7,379 | 200 | import pytest
import torch
from e3nn import o3
from e3nn.util.test import assert_equivariant
from nequip.utils import torch_default_dtype, dtype_from_name
from allegro.nn._strided import Contracter
@pytest.mark.parametrize("irreps_in1", ["0e + 0o + 1e + 1o", "2o + 1e + 0e"])
@pytest.mark.parametrize("irreps_in2", [... |
95cdec0ce368296be1bcc4593915ef4031a0faa84fffed2405b2a3c7e61faa11 | Python | 7,387 | 198 | from typing import Tuple, Union, Callable
import torch
import torch.nn as nn
import torch.nn.functional as F
################################################################################
# Common functions for all neural networks. #
##############################################... |
03471fb05ba303fc9bf357d704522c9245ec80c3e3c9697c5802908c4c45c60c | Python | 7,390 | 184 | # -*- coding: utf-8 -*-
# :noTabs=true:
import time as time_module
import codecs
import signal
import os, sys
try:
from .base import *
except ImportError: # workaround for B2 back-end's
import imp
imp.load_source(__name__, '/'.join(__file__.split('/')[:-1]) + '/base.py') # A bit of Python magic here, w... |
190d380ed24a12cbd5ce4f48875f03bc14234873ed4832524a4b10159a683b14 | Python | 7,391 | 212 | # 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... |
07d132a666210230d410270869e4c35d1aa3a686d9e6490e50bb749d1b04c785 | Python | 7,395 | 216 | 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... |
9b726af98d6a4810604deae1973a73378c110bd0cdf886708953c2385c220714 | Python | 7,395 | 247 | from typing import Final
"""
How to add new feature?
1. Add new key to this file.
2. Add new key to _const.py
2.1. if the type of input is consistent,
write adequate condition and default to _const.py.
2.2. if the type of input is not consistent,
you must add your own input validation code to
parse_input.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.