sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
52cd41fbcb2438ec550c340bb63e004b5d8db7c32d1b93a1b50cc3f7137c2f6a | Python | 12,922 | 294 | import gc
import h5py
from datetime import datetime
import pickle
import os
from os.path import join
import matplotlib.pyplot as plt
import sys
import numpy as np
import tensorflow as tf
import random as python_random
from glob import glob
import pyemma as pe
from model import unflatten, DataGenerator, KoopmanModel
fr... |
278d777af7890e2e45901cbc50897d2f0d2b4ef376039c0a7a27e882ec6b90ac | Python | 12,924 | 340 |
import numpy as np
import os, sys
gpu_device = sys.argv[1]
print('using gpu ' + gpu_device)
os.environ["CUDA_VISIBLE_DEVICES"]=gpu_device
import tensorflow as tf
from tensorflow.keras import backend as K
gpus = tf.config.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(gpus[0], True)
tf.keras.ut... |
260fd85c02f5cefa833992987dda6057a106adb217f3b2289c9fef0dcb5c2ccf | Python | 12,928 | 278 | from __future__ import print_function
import argparse
import numpy as np
from random import shuffle
import torch
from torch.utils.data import Dataset, DataLoader
import torchvision
import torchvision.transforms as transforms
import os
import time
from spiking_model import*
from Ncars_dataset import*
PATH_... |
5b358c218c19243889563f969d9cd7a5bea08668be013a7643c60d14c323a6f0 | Python | 12,935 | 336 | """Project given image to the latent space of pretrained network pickle."""
import copy
import os
from time import perf_counter
import dill
import click
import imageio
import numpy as np
import PIL.Image
import torch
import torch.nn.functional as F
from tqdm import trange
import dnnlib
import legacy
from metrics imp... |
5648d3451a33c83c1428d570941bd851d3bce45df7060df412f42e27b8f334c0 | Python | 12,938 | 392 | import nibabel as nib
import numpy as np
from himalaya.ridge import GroupRidgeCV
import sys
from sklearn.model_selection import KFold
from scipy.stats import pearsonr
from scipy.stats import zscore
from sklearn.model_selection import TimeSeriesSplit
from sklearn.model_selection import train_test_split
from sklearn... |
501406ffb8a09c5b395f48d5c73f8aef32f0bb47a12621d82ec14ea4ab1e8299 | Python | 12,950 | 324 | # This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it.
from typing import Optional, Union, Sequence, Dict
import functools
import torch
from e3nn.o3._irreps import Irrep, Irreps
from e3nn.util.jit import compile_mode
from nequip.data import AtomicDataDi... |
746088b104275393665c3820985e0e83526ab556efa46c04f10a8d956037bfbe | Python | 12,961 | 260 | import numpy as np
import gffpandas.gffpandas as gffpd
import argparse
import os
import pyBigWig
def pear_coeff(replicate, target, is_log=False):
"""Calculate the pearson correlation coefficient (numpy version).
This function only accepts tensors with a maximum of 2 dimensions. It excludes NaNs
... |
dc29a788e7c5016f4e69b19c1a0db40200efd7533daae11928c540c0b610aae6 | Python | 12,962 | 291 | """
This script uses dRFEtools to classify female versus male
in BrainSeq Phase 2 DLPFC, Hippocampus, and BrainSeq Phase 3
Caudate Nucleus. This is a RiboZero total RNA datasets.
"""
import numpy as np
import polars as pl
import pandas as pd
from pyhere import here
import re, errno, os, argparse
import dRFEtools, sessi... |
b33cbc455e0a235f1bd6ed0e1dfd01867349245d81c1debff17c17c14b264300 | Python | 12,977 | 381 |
import os
from warnings import warn
import pickle as pickle
import pylab
import numpy as np
import pandas as pd
import numpy as np
gdf_path = '../data/'
pickle_path = os.path.join(gdf_path,'experimental_data')
def find(condition):
"""old pylab.find function"""
res, = np.nonzero(np.ravel(condition))
retur... |
3b177617b99321578da75bcf4bb9c0f55816855d92c59d60cf229ccfdd2854b8 | Python | 12,980 | 235 | # 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... |
da361f83bad1223937b089e960244c691cb1b05cc0c4a6995a015067b42110b7 | Python | 12,993 | 299 | # -*- coding: utf-8 -*-
"""
Twokenize -- a tokenizer designed for Twitter text in English and some other European languages.
This tokenizer code has gone through a long history:
(1) Brendan O'Connor wrote original version in Python, http://github.com/brendano/tweetmotif
TweetMotif: Exploratory Search and Topic ... |
62d837b2488e4867f1540b250fe4491319c76fd2fdb067a153c854cf92317b09 | Python | 13,003 | 355 | import logging
import warnings
from typing import Literal
import numpy as np
import pandas as pd
import scipy
import torch
from anndata import AnnData
from mudata import MuData
from scvi import settings
from scvi.data import AnnDataManager, AnnDataManagerValidationCheck, fields
from scvi.external.tangram._module impo... |
3464833f6f9d79250e197a719704187fa500f8b9d2c707aac182f089f78dc6e2 | Python | 13,006 | 381 | """===================
CAPseq pipeline
===================
The CAPseq pipeline imports reads from one or more CAPseq experiments and
performs the following tasks:
* Align reads to the genome using Bowtie
* Call peaks using MACS
* Compare intervals across tracks
* Compare intervals with external bed files
... |
4149cc93f1790b964d8706ea10221513d0bf6e9633235d54dd48f674122ecbb2 | Python | 13,017 | 279 | import json
import os
import numpy as np
from nowcasting.config import cfg
from nowcasting.helpers.visualization import save_hko_movie
from nowcasting.hko_iterator import HKOIterator
from nowcasting.hko_evaluation import HKOEvaluation
class HKOBenchmarkEnv(object):
"""The Benchmark environment for the HKO7 Dataset... |
35df4a71e8a8a22d3943039e42b028ea64348e6a7edd96dbd32bb12f7405cb91 | Python | 13,019 | 276 | """
Simple training loop; Boilerplate that could apply to any arbitrary neural network,
so nothing in this file really has anything to do with GPT specifically.
"""
import math
import logging
from tqdm import tqdm
import numpy as np
import torch
import torch.optim as optim
from torch.optim.lr_scheduler import Lambda... |
2005a724227f669393d25c14d515c07273299996243a96373a25dcadc39f14aa | Python | 13,031 | 330 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Author: Yulia Rubanova
###########################
import os
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot
import matplotlib.pyplot as plt
import time
import datetime
import argparse
import numpy as np
import... |
91794aad0455c5a6e3fe2f189e3df8199d69976397a1d8599096acef59d234e4 | Python | 13,046 | 336 | # This file is part of the markovmodel/deeptime repository.
# Copyright (C) 2017, 2018 Computational Molecular Biology Group,
# Freie Universitaet Berlin (GER)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by... |
3cc620368aaaf4a1e05fcfbc43eb87ef8b48c7c440d5b40048f0afd7e84e746b | Python | 13,052 | 425 | import os
import argparse
from configobj import ConfigObj
def main(directory, config, dset, usr_name, ref):
print("Note: This is just an additional helper script to use RNAsleek for ATAC- and ChIP-seq data, "
"as it was originally designed for RNA-seq data. Please run RNAsleek BEFORE this script, as it ... |
67358adb4354a98e3b665084190200000a1b155e857664049316d4093394f55f | Python | 13,070 | 340 | # tile images into majority 512*512
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
import sys
import json
import uuid as uuid
import cv2
import re
import shutil
from operator import itemgetter
import math
import random
import shapely
import shapely.geometry
from shapely.geometry impor... |
9a29ffcc577fdea2681495d771bde1e821d59465d4a32c68572358757de340a4 | Python | 13,079 | 289 | # Rdkit import should be first, do not move it
try:
from rdkit import Chem
except ModuleNotFoundError:
pass
import copy
import utils
import argparse
import wandb
from configs.datasets_config import get_dataset_info
from os.path import join
from qm9 import dataset
from qm9.models import get_optim, get_model
from... |
7e26a3d60ed271439006488d6d7ea107f2abd1463003e45b0f6467d9c7c75bb3 | Python | 13,081 | 402 | import json
import os
import re
import tempfile
from pathlib import Path
import pytest
from hypothesis import given, strategies as st, settings
from hypothesis.strategies import characters
from pydicom import dcmread
from MRdataset.dicom_utils import is_dicom_file, is_valid_inclusion
from MRdataset.utils import conve... |
bf9725f6d8d5a1fdcf33c2525f40b2f54bb4bb682b4230d9b5df6237b6646b69 | Python | 13,085 | 318 | from collections import OrderedDict
import copy
import torch.nn as nn
import torch.optim as optim
from itertools import product
from scipy.interpolate import griddata
from ..models.losses import *
from ..utils.utils import *
def track_all(
container,
results,
zephir,
zephod,
clip_grad,
lambda... |
a0ec90c723d1b08db34dae91c3353331c3754f27a9dc447912b114beb6ab1d0b | Python | 13,095 | 348 | # %% imports
import argparse
import importlib
from copy import deepcopy
from logging import warning
import mne
import h5io
import numpy as np
import pandas as pd
from sklearn.linear_model import RidgeCV
from sklearn.dummy import DummyRegressor
from sklearn.pipeline import make_pipeline
from sklearn.ensemble import Ran... |
3b3d6dd3199b49f7028f6132c058c2d42d3f83807cc9c6f6b93d11e8035f3770 | Python | 13,106 | 251 | import argparse
import os.path
def main(args):
import json, time, os, sys, glob
import shutil
import warnings
import numpy as np
import torch
from torch import optim
from torch.utils.data import DataLoader
import queue
import copy
import torch.nn as nn
import torch.nn.functi... |
46a07b3791c19b971cd057ff1a1b1d66f696d9954a0b45a5dc6d59dc827b7ef9 | Python | 13,126 | 294 | # -*- coding: utf-8 -*-
import os
import copy
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler, StandardScaler
# from pypots.data import mcar, masked_fill
from pygrinder import mcar, masked_fill
import torch
class DataReader:
def __init__(
self,
data=No... |
77da82e4629e4d11313db93946e98fecbe5b5198dbab3bcd216b8db7a0009a39 | Python | 13,126 | 445 | import h5py
import numpy as np
from typing import Tuple, Sequence, List, Union, Generator, Callable, Any, Dict, TypeVar, Set
from collections import UserList
from pathlib import Path
T = TypeVar("T")
MaybeListType = Union[List[T], T]
NNDataType = Tuple[List[np.ndarray], np.ndarray]
MaybePathType = Union[Path, str]
F... |
c8151a04ecea8ee442b86ff4faf5f2ebadc87da43cddf434a701460a28752c0d | Python | 13,130 | 271 | import tempfile
from collections import defaultdict
from pathlib import Path
import hypothesis.strategies as st
from MRdataset import import_dataset
from hypothesis import given, settings, assume
from mrQA import check_compliance
from mrQA.tests.simulate import make_test_dataset
from mrQA.utils import get_config_from_... |
80e082b47f046f01eb65ec1025f35ce445e05bdf482e0a973e926512e39e38ad | Python | 13,132 | 384 | # -*- coding: utf-8 -*-
#
# test documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 7 11:33:27 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
d4c9338c9ffc9f970c7f217f43f20bb1f8148a91ae2f9051d3361fcff9f2d303 | Python | 13,132 | 383 | import argparse
import os
from time import time as t
import matplotlib.pyplot as plt
import numpy as np
import torch
from torchvision import transforms
from tqdm import tqdm
from bindsnet.analysis.plotting import (
plot_assignments,
plot_input,
plot_performance,
plot_spikes,
plot_voltages,
plo... |
6b62cd3291d97cddc78eb6fb4027fadd5fb3ffa5fd598284455b6d2d781e860f | Python | 13,139 | 323 | # 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... |
6f43a819046cccb5886f0cd0751786efb0d0ceeca4bc6c074cb63b5dbcc0a4da | Python | 13,141 | 384 | # -*- coding: utf-8 -*-
#
# test documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 7 11:33:27 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
3e87a2ae5ec49445a401680bc10a4a354b6c9fe7859b857145d00219ed0652cc | Python | 13,142 | 437 | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import importlib
import logging
import os
import sys
import warnings
from functools import pa... |
20745a91838f9c8abccf7c3845c6530ed08a8179efd4266776b0afd93ff945ce | Python | 13,149 | 307 |
"""
In this file the action is evaluated on the circuit to obtain result
PLease uncomment the required solution and outage scenario
"""
import os
import networkx as nx
from DSS_CircuitSetup import*
#------------------- User defined inputs to modify the standard test network ---------------------------------
... |
2fd5c647e31933634ec13908c8bb46fd7644dc234939ecd31482c2a070b9d795 | Python | 13,156 | 315 | ## main module for parsing, processing and interacting with cellsdata/files of 2p-stim protocols (i.e. NAPARM outputs)
from __future__ import absolute_import
from dataclasses import dataclass
from typing import TypedDict, Optional, MutableMapping
import re
import tifffile as tf
import os
import numpy as np
import xml.e... |
278dd45e42d6465f379ebaf08a4d0dd6530c6164dd96e4ea142096c1fd8ddda4 | Python | 13,157 | 334 | import random
from itertools import chain, cycle
import numpy as np
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from keras.utils import to_categorical
from matplotlib import pyplot as plt
from sklearn import svm
from sklearn.ensemble import GradientBoostingClassifier, RandomForestClas... |
d215daac3efe085991f4f0d85ca92e506f0d9ad68d3ae3d40081c6b0b094ae73 | Python | 13,161 | 226 | # 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... |
efe88c4c76f72ed65ed9b719fa8132c2b5ed02497d03d31a20d96b4766b6cbca | Python | 13,171 | 391 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 7 17:52:43 2022
@author: Shencong Ni
"""
import mydata
import numpy as np
import firing_rate_analysis as fra
import get_onoff_cpts
import connection as cn
import coordination as cd
import sys
import os
import matplotlib.pyplot as plt
import ti... |
1cad22e134da3c938872119439a6a3f466826800e7ecf7948760b45a6b67a764 | Python | 13,172 | 425 | # util functions for RGAN
# Created: 6/16/2021
# Status: ok
import csv
import json
import math
import os
import sys
try:
import matlab.engine
except:
matlab = None
import collections
import numpy as np
import pandas as pd
from scipy import stats
from scipy.interpolate import interp1d
from skimage import img_... |
004fc2b7486d40e825339bedb22f6538d962ff45d9aac5b41f034f4c83fe05be | Python | 13,174 | 278 | """geometry primitives for the Facial Anthropometrics workspace: point-to-point
straight/geodesic distance, angle, and enclosed mesh surface area, given
landmarks as VERTEX INDICES (not free 3D points) on a mesh.
vertex indices, not raw points, is the load-bearing design choice here - it's
the same guarantee registrat... |
bac05343828ec4aaf14a9914ca3dac4b1b7eccb4638685ef68d548ddf79a32bc | Python | 13,175 | 338 | import numpy as np
import networkx as nx
from tqdm import tqdm
from copy import deepcopy
from scipy.sparse.linalg import eigsh
import matplotlib.pyplot as plt
from numpy.random import randn
import os
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import ReLU
from torch_sc... |
5e87ab536d8a2b1edbfed518ebaa36efc0900fe6845f88616cf9b10a213a4c4b | Python | 13,181 | 402 | import re
import tempfile
from datetime import datetime, timedelta, date
from pathlib import Path
import pytest
from hypothesis import given, settings, assume
from hypothesis.strategies import lists, integers, dates, text, composite, \
characters, booleans, tuples
from mrQA.tests.conftest import sample_protocol, T... |
5aa57194c2c02d80366665d4ebadc61079a9f9ccf279a0ebafdc28fe3f5ec213 | Python | 13,187 | 333 | """Derivations of standard content blocks from Amazon (Bedrock Converse) content."""
import base64
from collections.abc import Iterator
from typing import Any, cast
from langchain_core.messages import AIMessage, AIMessageChunk
from langchain_core.messages import content as types
def _bytes_to_b64_str(bytes_: bytes)... |
7de04c572546e91dec44675bd287a7e7a6fc25053a2f4cf550f2a93cc4d1395e | Python | 13,190 | 277 | """
From a standard simtk.openmm.system, make a REST2-amenable system
"""
"""
Imports
"""
import simtk.openmm as openmm
import copy
from perses.annihilation.relative import HybridTopologyFactory
#######LOGGING#############################
import logging
_logger = logging.getLogger("REST")
_logger.setLevel(logging.INF... |
d9cf0b8819192666e35b3125fa1b361d74af2869e9852e9e74500aa7577b5109 | Python | 13,195 | 386 | import contextlib
import sys
import numpy as np
import torch
import utils # noqa: E402
sys.path.insert(0, "../include/")
# def feature_detector(angle, preferred_angle, min_rate, max_rate, concentration):
# return min_rate + (max_rate - min_rate) * np.exp(
# concentration * (np.cos(np.radians(angle - p... |
a57cbfdf8904eebba11e3051b2f0cb6dfdf50054eeaca52d50efe8dc3cfa35e4 | Python | 13,196 | 347 | import torch
from torch.utils.data import Dataset
import numpy as np
import re
import json
import lmdb
from functools import lru_cache
import pickle
import gzip
import os
import random
class NewMol3DDataset(Dataset):
def __init__(self, texts, tokenizer, max_len, conditions=None, conditions_split_id=None, db_path=... |
dc93f99042d6dde64fcf69436b6f9a983b3374c5bbcfdf8994aadba0f31c3fdb | Python | 13,200 | 400 | #!/usr/bin/env python3
import copy
import torch
import argparse
import dataclasses
import warnings
def magic_box(x):
"""
[[Source]](https://github.com/learnables/learn2learn/blob/master/learn2learn/utils.py)
**Description**
The magic box operator, which evaluates to 1 but whose gradient is \\(dx\\... |
0e200487872024c763d6ae086d0244f4497f23a22b38469f02851158bcec3b74 | Python | 13,201 | 420 | import os
from os.path import join as opj
import torch
import numpy as np
from pandas import DataFrame
from scipy import ndimage
from skimage.feature import peak_local_max
from skimage.segmentation import watershed
from skimage.morphology import binary_opening, disk
from scipy.special import softmax
from scipy.ndimage ... |
9727584b918d8c5e087123f8a7dd6d4b5b705bba77acfb0fbe43e9bd87ffe315 | Python | 13,206 | 313 | # This code is built from the PyTorch examples repository: https://github.com/pytorch/vision/tree/master/torchvision/models.
# Copyright (c) 2017 Torch Contributors.
# The Pytorch examples are available under the BSD 3-Clause License.
#
# =================================================================================... |
027de5fc35f89bfaba32c072626cf072efa629cb955971cce0ef6682f92a69ec | Python | 13,207 | 407 | # -*- coding: utf-8 -*-
#~~~~~~~~~~~~~~IMPORTS~~~~~~~~~~~~~~#
# Standard library imports
import sys
import os
import inspect
from collections import *
from glob import iglob
import datetime
import logging
import json
import gzip
# Local imports
from pycoMeth import __version__ as pkg_version
from pycoMeth import __na... |
4388b85529c0e0df6a2cb537b5f0420c6bfd32a84232dfa570a0ce54f76b3fcf | Python | 13,207 | 383 | """Parse tools for OpenAI tools output."""
import copy
import json
import logging
from json import JSONDecodeError
from typing import Annotated, Any
from pydantic import BaseModel, SkipValidation, ValidationError
from pydantic.v1 import BaseModel as BaseModelV1
from langchain_core.exceptions import OutputParserExcep... |
92957b096858304aa01e8f54bb71b757f92476878c2d0fba98b32b346d2035fe | Python | 13,208 | 424 | """Main entrypoint into package."""
import warnings
from importlib import metadata
from typing import Any
from langchain_core._api.deprecation import surface_langchain_deprecation_warnings
try:
__version__ = metadata.version(__package__)
except metadata.PackageNotFoundError:
# Case where package metadata is ... |
441802e723a02b7266e5943a7f1f97be46f36e093fd61a8c6a6282e5cf2f96c5 | Python | 13,209 | 409 | """
Copyright (c) Meta, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
---
MIT License
Copyright (c) 2021 www.compscience.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this softwa... |
ec87f5829375e9519219b4a09799802790fd19362dfdf42eb86fb2c1748eeaee | Python | 13,209 | 409 | """
Copyright (c) Meta, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
---
MIT License
Copyright (c) 2021 www.compscience.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this softwa... |
4c21cd1f420544034f35ad1628ac86f7967ff96c5446b6b5e30d14eacd867e26 | Python | 13,211 | 309 | from __future__ import division
from __future__ import print_function
import os
import time
import h5py
import random
import argparse
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from copy import deepcopy
from torch_geometric.data import Data
from models import *
def see... |
79b3b6fc75787aa7b9caa806c771e2f55e5f0fba307a7709bbdb157078de43ad | Python | 13,212 | 408 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
bfd7a91faefebdb9cda2004474a42d07f81e853decad587cd5e76c01eef0aca4 | Python | 13,215 | 219 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_scatter import scatter
from .spherenet import SphereNetEncoder
from .modules import build_mlp
from .coordgen import CoordGen
class MatGen(torch.nn.Module):
def __init__(self, enc_backbone_params, dec_backbone_params, latent_dim, num_fc_... |
6a7d349c1ed63850d8d281165e23d2881960f214cc03f4ffaaef6df39a666fcc | Python | 13,217 | 367 | from __future__ import annotations
import json
import logging
import re
from collections import defaultdict
from collections.abc import Callable
from typing import TYPE_CHECKING, Any
import requests
from langchain_core._api import deprecated
from langchain_core.callbacks import CallbackManagerForChainRun
from langcha... |
cd88f29a7da59d7c2d256919c8282ab01ff238866d778c54382e13c4aa96d7e7 | Python | 13,222 | 314 | import numpy as np
import itertools
def get_subpattern(pattern, simulator):
list_pattern = []
if pattern.reward > 0.:
for i in np.arange(1, len(pattern.index)):
for subset in itertools.combinations(pattern.index, i):
list_pattern.append(subpattern(simulator, list(subset), pa... |
3cf68e5abccce68ef511e391fd4f5b32100b43838ebad3026c6e25c8b965836a | Python | 13,224 | 297 | import numpy as np
import os
import yaml
import logging
from collections import OrderedDict
from .helpers.ordered_easydict import OrderedEasyDict as edict
__C = edict()
cfg = __C # type: edict()
# Random seed
__C.SEED = None
# Dataset name
# Used by symbols factories who need to adjust for different
# inputs based ... |
1a9cb23cd05469b1a5c3b1f576e5de023f4cddaa53d08730f3067cf0004bad19 | Python | 13,228 | 338 | import numpy as np
import pyemma
from pyemma.util.contexts import settings
import MDAnalysis as mda
import matplotlib.pyplot as plt
from pensa.preprocessing import sort_coordinates, merge_and_sort_coordinates
from .visualization import project_on_eigenvector, sort_traj_along_projection
# --- METHODS FOR TIME-LAGGED I... |
74dfd8511312af3ef185599fc01479b13742ad32bcf40a9053d2663887eb6732 | Python | 13,232 | 300 | from skimage import transform
import numpy as np
import pandas as pd
import os
import sys
sys.path.append(os.path.join('..','..'))
from morgana.ImageTools.locoefa import initialize
def compute_EFA(contour, mode, DEBUG=False):
if (DEBUG):
print('Computing EFA coefficients...')
N_points = len(contour.x... |
aea61d3f8f2be8a31432284a336104e5be25e6dc9dfe6c8dfdd8b2288d51e7a9 | Python | 13,234 | 278 | """
From a standard simtk.openmm.system, make a REST2-amenable system
"""
"""
Imports
"""
import simtk.openmm as openmm
import copy
from perses.annihilation.relative import HybridTopologyFactory
#######LOGGING#############################
import logging
logging.basicConfig(level = logging.NOTSET)
_logger = logging.ge... |
b60b855366d28e53393bc333f5a5831efb45ba1b4cb402d0ee63a279861f606e | Python | 13,234 | 356 | ####################################################################################
#
# 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... |
28a3f40995b77f51f94f80c79138d90c3b733fd22560303555a5d7d5e78f9215 | Python | 13,235 | 394 | """Classes and methods to shard (or split) k-mers across separate tries.
The basic idea is as follows. Without loss of generality, consider a 28-mer S
that we split into 2 parts. S has two signatures: s_1 and s_2. s_1 is the
first 14-mer of S collapsed down to a 2-letter alphabet (to account for G-U
pairing). s_2 is ... |
2f6969d4c5694a8bd53406679e78949d46e35949761cf8efc4048e4b40aa5319 | Python | 13,238 | 300 | import numpy as numx
import pydeep.base.numpyextension as numxExt
class Weight_layer_1D(object):
''' This class implements a weight layer that connects one unit
layer to another.
'''
@classmethod
def generate_2D_connection_matrix(cls,
input_x_dim... |
611a3d93047fdc16e4150a53836919cb73a6319387e5f9061eb4b9c00374d8e5 | Python | 13,239 | 334 | import mxnet as mx
from mxnet.rnn import BaseRNNCell
from nowcasting.ops import activation
from nowcasting.operators.common import group_add
class MyBaseRNNCell(BaseRNNCell):
def __init__(self, prefix="MyBaseRNNCell", params=None):
super(MyBaseRNNCell, self).__init__(prefix=prefix, params=params)
def ... |
56f21bc892f0009cb66944c731c080901455e58275df19876c97160b5618e4c9 | Python | 13,241 | 353 | #!/usr/bin/env python
import tempfile
import argparse, sys, os
import math, time, re
from argparse import RawTextHelpFormatter
from subprocess import Popen, PIPE, STDOUT
__author__ = "Colby Chiang (cc2qe@virginia.edu)"
__version__ = "$Revision: 0.0.1 $"
__date__ = "$Date: 2014-04-28 14:31 $"
# ----------------------... |
1ca45509b235045c6068740ef9e363cffdda2783c787baf3e4470633e64a513e | Python | 13,244 | 234 | """Compile only DDSurfer's required surface commands from pinned upstream source."""
from __future__ import annotations
import argparse
import json
import os
from pathlib import Path
import re
import shutil
import subprocess
import sys
import tempfile
import urllib.request
from postprocessing.core.archive import extr... |
9051bbc35df3e54a479976f151ac82c087f59450d86537490f399e8e7827be46 | Python | 13,260 | 418 | import torch
import numpy as np
from scipy.sparse import coo_matrix
def apply_affine_mat(vert, affine):
"""
Apply affine transformation to surface vertices.
Inputs:
- vert: mesh vertices, (|V|,3) numpy.array
- affine: affine matrix, (4,4) numpy.array
Returns:
- vert: vertices aft... |
940097b6dcf3565edb2744a4d6f227c6d72e97c91337c44f5d452020c542c126 | Python | 13,277 | 301 | 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... |
ad8c318088f355a6e12b21396df82e56df2885b60a90e2f9b8aed03c034a2043 | Python | 13,280 | 317 | import albumentations as A
from albumentations.pytorch import ToTensorV2
from joblib import Parallel, delayed
from torch.utils.data import DataLoader
from CNN2D import CNN2D
from CNN3D import CNN3D
import os
import torch
from torch import nn
import numpy as np
from skimage.io import imread, imsave
from src.napari_sve... |
30027358b1f825a650496fe0dc1b853d3c383b4453110a7b0834431730ee92d1 | Python | 13,281 | 361 | """Compute conn (PID | II) + stats per condition in the time domain.
This script can :
- Compute connectivity metrics like conn_pid and conn_ii
- Perform RFX-contacts on ii (two-tailed), redu | syn | redu - syn | syn - redu
(one-tailed)
- Computations are performed within conditions (i.e. rew | pun)
- Significance t... |
c375c4aec6a4ed30ca636b1e5690438ef20f2a59fe83d50a543be55fc6f3a456 | Python | 13,285 | 301 | 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... |
3cc5bc55fb2b0ba043449975781e968d6d8cd498f9ea352a0fdbe5f7671c2798 | Python | 13,288 | 395 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
# flake8: noqa
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path ... |
fb352c00d7f6e2d29a1358ef2e6c4a27543fc04ab997df3095fafd6d360f1671 | Python | 13,293 | 375 | import torch
torch.multiprocessing.set_sharing_strategy("file_system") # type: ignore
import pytorch_lightning as pl
from torch_geometric.nn import (
GATConv,
TransformerConv,
Linear,
Sequential,
GCNConv,
SAGEConv,
NNConv,
BatchNorm,
)
import torch.nn.functional as F
import torch.nn a... |
1374bb9b8aa8c85ab4562feceb2967f74cb194e7579cc84a19517ec59e72c7e1 | Python | 13,305 | 394 | try:
from rdkit import Chem
from qm9.rdkit_functions import BasicMolecularMetrics
use_rdkit = True
except ModuleNotFoundError:
use_rdkit = False
import qm9.dataset as dataset
import torch
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as sp_... |
d00d606c7345d70ead85cf8fe2e6a838b70f5f7adf8a9eadce4cab895e467f40 | Python | 13,305 | 322 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import time
from collections import defaultdict
from typing import Any, Dict, List, Optional
import torch
from pytorch_lightning import LightningModule
from pytorch_lightning.cli import instantiate_class
import torch.distributed as dist
import os... |
7c5dbcfa53903021c5808860a3372c23ac98596e781585abc1b26c216a9ce7ac | Python | 13,312 | 352 | # Copyright Generate Biomedicines, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
1422e5547564ec67cb003109dce0b201c27fff9506aab6e4cdf2d1c5e1a54e91 | Python | 13,315 | 355 | #from absl import flags
#from absl.flags import FLAGS
import numpy as np
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import (
Add,
Concatenate,
Conv2D,
Input,
Lambda,
LeakyReLU,
MaxPool2D,
UpSampling2D,
ZeroPadding2D,
BatchNormalization... |
e8eace056ee511f0f34bf7a7d81d1ff6a634a82f5c4c9b186b5ea893164375df | Python | 13,320 | 300 | from PyQt5.QtWidgets import (QApplication, QComboBox, QGridLayout, QGroupBox, QLabel, QPushButton,
QFileDialog, QMessageBox, QWidget, QSizePolicy, QCheckBox, QLineEdit)
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationT... |
0b451ed4c6ab8b69393bcc475562bc879b497faa08c1cfba41bc8bc5cb547fcb | Python | 13,329 | 418 | """Messages for tools."""
import json
from typing import Any, Literal, cast, overload
from uuid import UUID
from pydantic import Field, model_validator
from typing_extensions import NotRequired, TypedDict, override
from langchain_core.messages import content as types
from langchain_core.messages.base import BaseMess... |
d0d686c335219891a37a23fc518ada72fd5ba694cdfcfb08ce21caa30a5f5d95 | Python | 13,342 | 313 | import sys
import os
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.lines import Line2D
import itertools
sys.path.insert(1, os.path.join(sys.path[0], '../../../../'))
from Simulator.SimulatorPattern import simulatorPattern, simulatorPatternDual
import Articles.Sequential_Learnin... |
54ca416f7cca6e74b93266d50a7f4e717697bfabf57eb29a6aed8e6348b0aaa0 | Python | 13,346 | 305 | """
Author: Benny
Date: Nov 2019
"""
import argparse
import os
import torch
import datetime
import logging
import sys
import importlib
import shutil
import provider
import numpy as np
from pathlib import Path
from tqdm import tqdm
from data_utils.ShapeNetDataLoader import PartNormalDataset
BASE_DIR = os.path.dirname(... |
65adb963226b2ee69bebcfb6bbce897f7620f14933145bd66277b1f3e9b72282 | Python | 13,365 | 404 | import copy
import numpy as np
import pytest
from openff.toolkit import Molecule, Topology
from openff.toolkit._tests.create_molecules import create_ethanol
from openff.toolkit._tests.create_molecules import (
dipeptide_residues_perceived as create_dipeptide,
)
from openff.toolkit._tests.utils import get_data_fil... |
c846982399f4f0e07c43060af36a1e79d8ef6ede7eb06eb4192a5fdc1be7d1d5 | Python | 13,365 | 415 | import warnings
from collections.abc import AsyncIterator, Iterator
from typing import Any, get_type_hints
import pytest
from typing_extensions import override
from langchain_core._api import LangChainDeprecationWarning
from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLL... |
26fb722c9c6ce2faf6bb3a8c27589b9389128aece50b0c498e80a6d4d7e0190d | Python | 13,369 | 329 | import os
import glob
import numpy as np
import matplotlib.pyplot as plt
from utils.constants import ALL_MODELS
from paths import TRAINING_DATA_PATH, TEST_DATA_PATH, MODEL_PATH
from utils.distribution_distance import compute_jsd
import matplotlib.gridspec as gridspec
from matplotlib_scalebar.scalebar import ScaleBar
fr... |
5858cc9a201108105a1e102e5073b41d4c8229b1f79a2fa154962afd7eeb6507 | Python | 13,371 | 359 | # emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... |
7b9d9a1e8503bba35a83b2a351302ea5671fcd9b41c0458b0275d7db3397e9b0 | Python | 13,379 | 228 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .net_utils import *
from .geometric_computing import *
from .features import dist_emb, angle_emb, torsion_emb
from .schnet import SchNet
class GraphBP(nn.Module):
def __init__(self, cutoff, num_node_types, num_lig_node_types, num_interactions... |
4b065af4ec3c546cc784d78ed50a853213a6ff45ed379a683532096159b6c88c | Python | 13,386 | 402 | # 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... |
4dcbcb02d113f56a9a5bd31d6d196d0396c48a65ff441f62324c9c95c96f4909 | Python | 13,387 | 331 | # This file fits the linear model to the data
# It shows plots of the model fit and error
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import PolynomialFeatures
from sklearn import linear_model
from sklearn.neural_network import MLPRegressor
from sklearn.metrics im... |
e17bd4d3f53b817f7d3635805f464711b9c3c5a97ae2637e3e930170c7a6493f | Python | 13,388 | 284 | 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... |
7fa44245977f10d1f0d6b6d1e15a8da5eeaeb643a5f0ac2c1751a83b61b5dff0 | Python | 13,405 | 314 | import io
import os
import pickle
import pandas
import numpy as np
import scipy.io as sio
import torch
from scipy.io import loadmat
from scipy.ndimage import zoom
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score
from sklearn.preprocessing import Min... |
aa7cb8f1ac20cd0e1215a072aea296831c0405319f01233e42565439161d9fcb | Python | 13,405 | 417 | import numpy as np
import torch
import torch.nn as nn
import torchvision.models as zoomodels
from torch.autograd import Function
import timm
from feature_networks import clip
from feature_networks.vit import _make_vit_b16_backbone, forward_vit
from feature_networks.constants import ALL_MODELS, VITS, EFFNETS, REGNETS
... |
132d5d9de0a5f7a7d74f972e326710cfbcd56f4e1bbd7e91ce6bd2d5fceb22ba | Python | 13,407 | 346 | from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole, ReactionToImage, MolToImage, MolsToGridImage
import rdkit.Chem.AllChem as AllChem
from IPython.display import SVG, display, clear_output
from rdkit.Chem.Draw.MolDrawing import MolDrawing, DrawingOptions
IPythonConsole.ipython_useSVG = True
IPythonConsol... |
4ad1f8b40edcba9d310581bb905517e0ced2544d12678eca600a79f2a5db2f8c | Python | 13,408 | 319 | import argparse
import os
import pytorch_lightning as pl
import torch
import torch.nn.functional as F
import torch.optim as optim
import torch_geometric.loader as geom_data
from pytorch_lightning.callbacks import (EarlyStopping, ModelCheckpoint,
TQDMProgressBar)
from pytorch_li... |
0b9ce17c5b9832f2c74de42e40595732fbbdc47910e1e8a26eb0fd90f200c79e | Python | 13,409 | 296 | #!/usr/bin/env python
"""
train.py -
All-in-one tool for easy training of a model for langid.py. This depends on the
training tools for individual steps, which can be run separately.
Marco Lui, January 2013
Copyright 2013 Marco Lui <saffsd@gmail.com>. All rights reserved.
Redistribution and use in source and binary... |
8be69d56f34865b7aaeba90563bfb49f5db2ad81de2e3d842cbe1da70805f47f | Python | 13,416 | 248 | import argparse
import torch
import os
import random
import itertools
import numpy as np
import pandas as pd
from typing import Tuple
from typing import List
from typing import TypeVar
from pathlib import Path
from tqdm import tqdm
Self = TypeVar('Self', bound = 'Dataset')
class Dataset(torch.utils.data.Dataset):
... |
95369a8efa71808cae70e6379696d253f2f49e0a4d8d50a54f594afcac723d9d | Python | 13,429 | 260 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 28 15:17:21 2021
@author: shni2598
"""
import numpy as np
from sklearn.linear_model import LinearRegression
import scipy.stats
#%%
class fano_mean_match:
def __init__(self):
self.spk_sparmat = None # sparse matrix; time and... |
22e79539d0d3a9505fa05378634db9c32e55af9227eb7711e160861062b6a8dd | Python | 13,435 | 447 | # network models for RGAN
# Created: 6/10/2022
# Status: ok
import sys
import math
import torch.nn as nn
import torch
# 2 options:
# (1): put all Gs in one, and directly combine them
# (2): put all in networks, and combine outside
class _MLP_Surv(nn.Module):
def __init__(self, in_size, drop_rate, fil_num, out... |
c5e1531827113bad2dc1347d8337fe92766b562a5b3db367274242d25621b5d6 | Python | 13,435 | 382 | """ This module contains several classes for data preprocessing.
:Implemented:
- Standarizer
- Principal Component Analysis (PCA)
- Zero Phase Component Analysis (ZCA)
- Independent Component Analysis (ICA)
- Binarize data
- Rescale data
- Remove row means
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.