sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
01e7f463593cb2219696ec75a03249e679c7eb05900f564607f9496403b57a97 | Python | 9,624 | 247 | # 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 ... |
06a12b6b8b3fe11ba24894a1037b2872165e7751f13218c02aa9b1a793b44f5c | Python | 9,633 | 300 | # data loader
from __future__ import print_function, division
import glob
import torch
from skimage import io, transform, color
import numpy as np
import math
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
from PIL import Image
#===============... |
8b8d23f7c4d0daf805a3227e055bc10e8067d5b2d310d9631ac82e23ca5976df | Python | 9,637 | 200 | import numpy as np
import itertools
from Simulator.SimulatorPattern import simulatorPattern, simulatorPatternDual
from Articles.Sequential_Learning_Striatum.Code.ParserPattern import create_parser_main_pattern
from NetworkModel.StriatumNeurons import find_params_neuron
class paramsGestPattern:
def __init__(self):... |
6aca26cefeac47c5c885d5f7c139a5e15ebff5cb064d4a45f5aeb2a85068a9f9 | Python | 9,638 | 218 | 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... |
6ca5ba6ce8b37de61ba181f3ca4356c4185fe0496f41a31e32ae660184400f85 | Python | 9,638 | 211 | # Copyright (c) 2008-2026 the MRtrix3 contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Covered Software is provided under this License on an "as is"
#... |
0bd5b7ba05c7c083f9aedf5507612171525e171a29881df8da96ed8b6857971a | Python | 9,639 | 238 | """
Methods to obtain a timeseries distribution for the water pockets which respresents
a combination of the water occupancy (binary variable) and the water polarisation (continuous variable).
Water pockets are defined as radius 3.5 Angstroms (based off of hydrogen bond lengths)
centered on the probability density max... |
7538fe52c0e699a5d497d27ded7b9d12d208a0a390a43466f68e89b3d008ea9c | Python | 9,643 | 286 | import math
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
def get_inplanes():
return [64, 128, 256, 512]
def conv1x3x3(in_planes, mid_planes, stride=1):
return nn.Conv3d(in_planes,
mid_planes,
kernel_size=(1, 3, 3)... |
6495e61db7b1ff81613b3c8b32b90aa659c1f6148df4f29ac5a9aa5a0b9a11fd | Python | 9,648 | 288 | # -*- coding: utf-8 -*-
"""
Created on Wed May 5 20:08:52 2022
@author: Biao Zhang
"""
import came
from came import pipeline, pp, pl
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt # optional
import seaborn as sns # optional
... |
b2b9e2e00b0999e33858335b498bb22c502b340da0fc1b9559a62d9ed025b247 | Python | 9,648 | 269 |
'''
WrapperIDR.py - wrap idr analysis
=================================
:Tags: Python
Purpose
-------
Wrap the IDR analysis workflow.
For more information, see
https://sites.google.com/site/anshulkundaje/projects/idr
Usage
-----
Documentation
-------------
Code
----
This script requires some R functions with... |
999263933c2ee0f8be9f906efb09f53e1da0aca1c0ef2f382b960084c6346a05 | Python | 9,649 | 227 | # Copyright (c) <2024> <University of Paderborn>
# Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/
# https://github.com/SSTGroup/relationship_structure_identification
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and as... |
2222c873a3af676567fbaa302f641f67e266ec43ed0fdb9e061d02510da89dd0 | Python | 9,651 | 193 | import sys
import matplotlib.pyplot as plt
import numpy as np
from scipy.io import loadmat
import pandas as pd
from glob import glob
import matplotlib as mpl
import time
import scipy
from inputparameters import *
pd.options.mode.chained_assignment = None # default='warn'
def DetectIntervalsSWR(data, threshold, numbe... |
6d892c87fe567bfa80a205deb4fb99eeac289a080d6b99872f0640de7f808b0d | Python | 9,667 | 206 | # Take 1 cell-type, say inkt
# Take its metadata for everything: training, testing, dev
# Make a pandas df with gene and category
# Then for each of the other samples, join gene and category.
# merge by gene
# Sconda conda activate TensorFlow_CPU_01; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/For... |
ef3978b83b76d3acd05643a88da6fb0529f9d3b5539d263e165c594058a47cf4 | Python | 9,670 | 404 | # -*- coding: utf-8 -*-
"""
Created on Mon May 24 15:13:58 2021
@author: xiao208
2 state HH model with channel noise
list of unit and default parameters:
time: ms
voltage: mV
current: uA/cm^2
capacitance: uf/cm^2
conducrance: mS/cm^2
Cm = 1 uF/cm^2
Vna = 115mV
Vk = -12mV
Vl = 10... |
27decd79e1278ab3dfd1f1ba126c85f68938f77985cd89e06e9cc7598ae12760 | Python | 9,676 | 320 | # 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... |
d138112bf7505fc699f11ec7e03757c708d04d1027d34527d254657408caf922 | Python | 9,677 | 275 | # 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 sqrt, pi as PI
try:
import sympy... |
0ad7e64062805bd77c0de6241e6acd2d90c9d63335f9f03555116b59884527d5 | Python | 9,682 | 304 | import numpy as np
import torch
from scipy.sparse.linalg import LinearOperator
from .linear_operator import TorchLinearOperator
EPS = torch.finfo(float).eps
def in_bounds(x, lb, ub):
"""Check if a point lies within bounds."""
return torch.all((x >= lb) & (x <= ub))
def find_active_constraints(x, lb, ub, r... |
2c72415d37c7114b026c0b244c7151d6e7990e93a671730c26df730789ca543e | Python | 9,683 | 222 | # 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... |
71faad9bfb14f171ced994899ff427ece599d01fde7ecf737d3d1d9b2e7788b1 | Python | 9,687 | 230 | from optimization.GaussNewton import GaussNewton
from optimization.LinearSolvers import BlockPCG
from EPI_MRI.EPIMRIDistortionCorrection import *
import torch
import time
class ADMM(EPIOptimize):
"""
Alternating Direction Method of Multipliers (ADMM) for EPI-MRI Distortion Correction.
Solves min over b,z... |
356ec557106f614da06ddd50f3aac61c637ef8b74a2e005b54d25b81bc1efc61 | Python | 9,689 | 238 | # -*- coding: utf8 -*-
# import os
# os.environ["PATH"] += os.pathsep + 'C:\Program Files\Graphviz\bin' #注意修改你的路径
import numpy as np
import pandas as pd
import tensorflow.keras
from tensorflow.python.keras.utils import np_utils
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.... |
14234f6a4aa3c83a93a052ae94110bec5a2fec0fc32f4ab6da57e49adb38bec9 | Python | 9,690 | 195 | """
Module to generate supplementary figure analysing inhibition of Dfd line with GtACR 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 pick... |
ccf91cc5acefdc15b6e52c09110bc586866d7a704c4a4e0d651fd1c0dc149405 | Python | 9,693 | 432 | """A fake callback handler for testing purposes."""
from itertools import chain
from typing import Any
from uuid import UUID
from pydantic import BaseModel
from typing_extensions import override
from langchain_core.callbacks.base import AsyncCallbackHandler, BaseCallbackHandler
from langchain_core.messages import Ba... |
cbadf7f20ff2fe8d7545fd7037bcf77b781cf2c5990316705aa33297438f88d8 | Python | 9,696 | 217 | import numpy as np
import argparse
import os
import imp
import re
from mimic3models.decompensation import utils
from mimic3benchmark.readers import DecompensationReader
from mimic3models.preprocessing import Discretizer, Normalizer
from mimic3models import metrics
from mimic3models import keras_utils
from mimic3model... |
4ddc49003298beeec1628e404393f851d5ed8baa71259188d591b081fae2a33f | Python | 9,698 | 268 | """Linear algebra utilities for torch implementation."""
import math
import torch
def matrix_block_indexing(A, rows):
"""Get blocks in a matrix, A[rows,:][:,rows]."""
return A[rows[:, None], rows]
def matrix_add_to_diagonal(A, B):
"""Add vector B to diagonal elements in A, i.e., A + torch.diag(B)."""
... |
ca9872d6a9d0fddbf76df157756385d67a46ceacb341536a22844039d8dfde81 | Python | 9,703 | 268 | import functools
from importlib import util
from typing import Any
from langchain_core._api import deprecated
from langchain_core.embeddings import Embeddings
from langchain_core.runnables import Runnable
_SUPPORTED_PROVIDERS = {
"azure_ai": "langchain_azure_ai",
"azure_openai": "langchain_openai",
"bedro... |
388425a69613b37729df2ef00169c9f44e51e458d27235235ac2f4962367da42 | Python | 9,707 | 228 | import os
import sys
import shutil
import argparse
import pandas as pd
import torch
import torch.nn as nn
import torch.utils.tensorboard
from torch.nn.utils import clip_grad_norm_
from tqdm.auto import tqdm
from torchsummary import summary
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = T... |
e3298edad2b0f171cfa3c58f9414afc845c6d4e31265c9d00b6a542dca872ff9 | Python | 9,709 | 268 | """
Author: Anna M. Puszkarska
SPDX-License-Identifier: Apache-2.0
"""
import multiprocessing as mp
import time
from pathlib import Path
from typing import Tuple, List
import keras.backend as K
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
from peptide_models.aminoacids import AMINO... |
a98a2ac0f3e22c26a34b91830ffd1af519ed6f5cb967007930eb78341163122a | Python | 9,710 | 258 | #!/usr/bin/env python
from itertools import combinations
import networkx as nx
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from tqdm.auto import tqdm
from pgmpy import config
from pgmpy.causal_discovery._base import BaseCausalDiscovery, _TreeSearchMixin
class TAN(_TreeSearchMixin, B... |
4910e271aed0b557ac8bd51e8e4baa40dab9caa47f18eeab6133333dc62a47a7 | Python | 9,714 | 182 | """
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 environmen... |
a09d4c7626ba20925ce3ef3c85d6563f682c3bf63567bcbc14ce58e076ef16da | Python | 9,715 | 202 | import sys
from collections.abc import Hashable
from numbers import Real
import numpy as np
import pandas as pd
from numpy.typing import ArrayLike
from skbase.utils.dependencies import _safe_import
from sklearn.linear_model import LinearRegression
from pgmpy.parameterization._base import BaseParameter, _checked_evide... |
4ecaa865b7275b59b50c24749f58240fff136ac88c7cbddb6000b4bed941f81c | Python | 9,730 | 267 | from datetime import datetime
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Dropout, Dense, LSTM, SimpleRNN, GRU, Conv1D
import matplotlib.pyplot as plt
import os
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error, m... |
fb2590ebc1e580efa4a82bae4c1717c011f537c28af10e7ae841e323996da161 | Python | 9,736 | 217 | import os
import logging
import sys
import glob
import time
import numpy as np
import torch
import h5py
from collections import Counter
from lightning.pytorch.utilities import rank_zero_only # don't log twice while training on multiple GPUs
from lightning.pytorch.utilities.model_summary import ModelSummary
from helixe... |
a955191a59ea84ecea557470e22e78767b622218804e81a5f56a68984d3266ec | Python | 9,737 | 239 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class COSMIC():
""" This class introduces cosmic order and
cosmic-like plots for signatures """
def __init__(self,loc='data/COSMIC_v3.3.1_SBS_GRCh38.txt'):
self.order = ['A[C>A]A', 'A[C>A]C', 'A[C>A]G', 'A[C>A... |
169396b81d36a067ca68dd36ebec6e9fa6b6d3c1b969f9c5052ef8bed0137651 | Python | 9,742 | 262 | #### Biopython Disordered Atom Fix ####
try:
import Bio.PDB
copy = Bio.PDB.Atom.copy
def myCopy(self):
shallow = copy.copy(self)
for child in self.child_dict.values():
shallow.disordered_add(child.copy())
return shallow
Bio.PDB.Atom.DisorderedAtom.copy=myCopy
except M... |
dab6d45ffbafa7a270b383d6f2b2fba7b186f68cb401514d60ffd8d2c8f93f5a | Python | 9,742 | 278 | import math
from typing import Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.nn.modules.utils import _pair
def im2col_indices(
x: Tensor,
kernel_height: int,
kernel_width: int,
padding: Tuple[int, int] = (0, 0),
stride: Tuple[int,... |
d673a3e638bf008cbef1307b948efbd753baa3a565c2bbdb5268156ef84fc6e8 | Python | 9,743 | 257 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Description: :
@Date : 2022/06/14 18:35:36
@Author : Zilan Yu
@version : 1.0
'''
import pandas as pd
import os, re
from sklearn.utils import shuffle
root_filter_datasets = "../filter_datasets"
iedb_filepath = "./IEDB_20220614.csv"
vdj_filepath =... |
27b8ebfb0ebcd4351b059308ecb37e0f3c902ce99b62f41090a8a6d725a5ac8b | Python | 9,750 | 238 | 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 ug_preprocess_func
__all__ = ['ug_delta']
class UgDelta(TaskModel):
def __init__(self, **kwargs):
super().... |
8f755fe71cf050162cc9e737cfc5f7adabcad4236dd1eb03321318de307e035f | Python | 9,751 | 262 | # 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... |
2c8b87d7915427bad127cdddf60d2ac2f76a30d34b4107530265cf7b3193967f | Python | 9,752 | 251 | # 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... |
95e28897eec95a2d244b9452703695a824ac441a359701650b3274b8b51a22a2 | Python | 9,752 | 287 | # coding=utf-8
"""Define the ConvUnit and DenseUnit."""
import torch
import torch.nn as nn
import logging
from .utils import selu_bias_init_, selu_weight_init_
logger = logging.getLogger(__name__)
class BaseUnit(nn.Sequential):
"""
The base class for all layers.
Parameters:
weight_init : torch.nn... |
424521ef95484f0088e0702e26b6b5bdc2e539cfda7ca681a653c3b1916416e1 | Python | 9,758 | 249 | # coding=utf-8
import math
import torch
import torch.nn as nn
from network.util import init_weights
import torch.nn.utils.weight_norm as weightNorm
class feat_bottleneck(nn.Module):
def __init__(self, feature_dim, bottleneck_dim=256, type="ori"):
super(feat_bottleneck, self).__init__()
self.bn = n... |
e7dbcd3a21819efd52dfac8fc0f1e9bbfd49b57fc12ac12827100d35be1486d1 | Python | 9,762 | 182 | """
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 environmen... |
a26a74822ed2c3ed0389a4d4d96db734a008a1c665679502c1ca522483aa3a84 | Python | 9,763 | 308 | # Bond lengths from:
# http://www.wiredchemist.com/chemistry/data/bond_energies_lengths.html
# And:
# http://chemistry-reference.com/tables/Bond%20Lengths%20and%20Enthalpies.pdf
bonds1 = {'H': {'H': 74, 'C': 109, 'N': 101, 'O': 96, 'F': 92,
'B': 119, 'Si': 148, 'P': 144, 'As': 152, 'S': 134,
... |
c92df03168928ed0b7b668214b98510e0297db823c08f2fecc5304b736d26b68 | Python | 9,764 | 309 | # Bond lengths from:
# http://www.wiredchemist.com/chemistry/data/bond_energies_lengths.html
# And:
# http://chemistry-reference.com/tables/Bond%20Lengths%20and%20Enthalpies.pdf
bonds1 = {'H': {'H': 74, 'C': 109, 'N': 101, 'O': 96, 'F': 92,
'B': 119, 'Si': 148, 'P': 144, 'As': 152, 'S': 134,
... |
0f52b6f915c091bfa6dd081232b715950a26a1bb907d75ef5da94a5b60a4149c | Python | 9,765 | 246 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 9 21:41:15 2022
@author: Shencong Ni
"""
'''
Extract SUA data for each network realization
SUA will be used in reduced rank regression (RRR) analysis
Run the onoff_detection.py first before running this script.
'''
import mydata
import numpy as np... |
810a58b6c317965d94f7f52295587316f50b5540f00b3d0749930efb545daa27 | Python | 9,766 | 229 | from subprocess import check_call, check_output, PIPE, Popen
import os
import os.path as op
wd = op.dirname(op.realpath(__file__))
os.chdir(wd)
def rm(f):
try:
os.unlink(f)
except OSError:
pass
assert op.exists('../MethylDackel')
MPath = os.path.abspath('../MethylDackel')
check_call([MPath, '... |
3713808593ed2b74d3e121f7fb51a657401c2b04d053ca1d72e78e7b6b89fceb | Python | 9,770 | 238 | 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 wcs_preprocess_func
__all__ = ['wcs_sql']
class WcsSql(TaskModel):
def __init__(self, **kwargs):
super()._... |
170d9f92baa685a38cb56995f3075c87cdab4c2ff26961f4141367d1cb2a96dc | Python | 9,771 | 250 | import shutil
from subprocess import CalledProcessError
from protocol import UnspecifiedType
from mrQA.config import EqualCountType, CannotComputeMajority
from mrQA.tests.conftest import THIS_DIR
from mrQA.utils import majority_values, folders_modified_since
from mrQA.utils import list2txt, txt2list
import unittest
i... |
5868965ee00611a361235a9142c050e17cf0e649d5d1ab3200b219d844fc765e | Python | 9,773 | 249 | from collections import defaultdict
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
import numpy as np
from neuralpredictors.data.samplers import RepeatsBatchSampler
from pydantic import NonNegativeInt
from pydantic import PositiveFloat
from torch.utils.data import Da... |
86858a1158a3b077f52bbc127b52114127f6ee4cd99a5f6281d36602534b6692 | Python | 9,775 | 264 | # 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 ... |
d7d0ac05ee4c71b71e838ea921db40039ab584e3b1385b42f119fca263915c84 | Python | 9,776 | 264 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Description: :
@Date : 2024/04/02 19:37:38
@Author : Zilan Yu
@version : 1.0
'''
import pandas as pd
import os,re
def prefilter(df):
"""
@Description:
Select samples with only 1 TRA and 1 TRB.
----------
@Param:... |
36d4ce0dad1f833ed5e323fff0960f006f127b48c2439b452fa640098c08a69f | Python | 9,782 | 249 | from typing import Tuple, Union
from sklearn.ensemble import VotingRegressor
from sklearn.utils.validation import check_is_fitted
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn import metrics
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow... |
17d6b2f6ddb7a0452d4293c3a2e76906aff596cce80b3d546fbe297b38968306 | Python | 9,788 | 271 | """Vectorstore stubs for the indexing api."""
from typing import Any
from langchain_core.document_loaders import BaseLoader
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.language_models import BaseLanguageModel
from langchain_core.vectorstores impor... |
2e18517ca0da7cda8cf6664dab63db070cc73c1ce54a3179f10300983205f7cc | Python | 9,788 | 239 | """Methods for creating chains that use OpenAI function-calling APIs."""
from collections.abc import Callable, Sequence
from typing import (
Any,
)
from langchain_core._api import deprecated
from langchain_core.language_models import BaseLanguageModel
from langchain_core.output_parsers import (
BaseLLMOutputP... |
02fdd3704a14d6d386b4dcbfcf6fe3c256ff85a50b1863eeaa1ef20eaf621c05 | Python | 9,790 | 151 | """Reference verification for paper/refs_auto.bib against paper/main.tex and Crossref.
For every BibTeX entry:
1. cited in main.tex? (uncited entries are reported)
2. DOI present? (entries without DOI are listed for manual verification; conference papers and software may lack one)
3. DOI resolves on Crossref (... |
3066b536ded94ac40b3d7aea8f3c8be685af8173ff5f66b1e687dfc06d311939 | Python | 9,793 | 319 | import json
import pickle
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize
import torch
from matplotlib.ticker import NullFormatter
import figure_config # noqa: F402
from dopp import FeedForwardCell
mpl.rcParams.update(figure_config.mpl_style)
def _determine_output... |
10db9f516ea31e1253ee7e63dd0a664efecded497a094c02f599c590bb60b928 | Python | 9,807 | 189 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 6 16:08:39 2021
@author: Neil J Thomson
"""
import os
from pensa import *
# # # # Define where to save the GPCRmd files
root_dir = './mor-data'
# Define which files to download
md_files = ['11427_dyn_151.psf','11426_dyn_151.pdb', # MOR-apo
... |
b9ba60d5fd2ef0d400a92b86e93da430102d3067d08b535543b78116de5fabcc | Python | 9,808 | 264 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Contents of this file were adapted from the open source fairseq repository.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict, List, Optional
import torch
import... |
e8e134542bbe3c38dabe24a543cf72916c3985571026256aeb3d30ad9bdea5e6 | Python | 9,808 | 239 | # 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... |
32c112a35e8c851ab6590555afd97f2c7428171b26941fcb3143ccf9317d2f4e | Python | 9,809 | 231 | import os
import sys
import pathlib
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.mixture import GaussianMixture
from sklearn.preprocessing import StandardScaler
from matplotlib.backends.backend_pdf import PdfPages
module_path = os.path.abspat... |
eebf1d1c8451a86df60134a1f649566bae682d3449cb8cfa15ff5532ac74dddb | Python | 9,813 | 209 | # 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... |
3a24ac5546fd8ef3762650237d934d4f00ef2ef30e6759b5fbcb2b6fbd5f64e6 | Python | 9,822 | 293 | import logging
import os
import subprocess
import tempfile
import pytest
import simtk.openmm.app as app
import yaml
from openmmtools import mcmc
from openmmtools.multistate import MultiStateReporter
from pkg_resources import resource_filename
from simtk import unit
from perses.annihilation.lambda_protocol import Lamb... |
ceb635aeffa9a02d402f90f4f95f675a7c200795e012f9646913f27c2ae00d2c | Python | 9,822 | 234 | import numpy as np
"""
Compute the Zernike moments of a collection of points.
Authors:
- Arthur Mikhno, 2013, Columbia University (original MATLAB code)
- Brian Rossa, 2013, Tank Think Labs, LLC (port to Python)
- Arno Klein, 2013 (arno@mindboggle.info) http://binarybottle.com
Copyright 2013, Mindbog... |
bcbebc5fc7d4e9d52122ab316a964ae624ccb124e7c2e3328d0fadc5da1252df | Python | 9,823 | 309 | from warnings import warn
import numpy as np
import torch
import torch.nn as nn
from .base import Encoder
from .mean_variance_functions import (
fitted_zig_mean,
fitted_zig_variance,
fitted_zil_mean,
fitted_zil_variance,
)
class ZeroInflationEncoderBase(Encoder):
def __init__(
self,
... |
767ce03a087d7c6ae100c54a92f567863f944afce37c183c0c4c464d6b5a5316 | Python | 9,832 | 212 | import torch
from stable_baselines3.common.policies import BasePolicy
import torch as th
import gym
from gym import spaces
import math
import random
from stable_baselines3.common.preprocessing import get_action_dim, is_image_space, maybe_transpose, preprocess_obs
from stable_baselines3.common.type_aliases imp... |
ca4184de68b4a875d1be55f61036cadce8b522cd31538a646540fd0315ae4fde | Python | 9,833 | 212 | import torch
from stable_baselines3.common.policies import BasePolicy
import torch as th
import gym
from gym import spaces
import math
import random
from stable_baselines3.common.preprocessing import get_action_dim, is_image_space, maybe_transpose, preprocess_obs
from stable_baselines3.common.type_aliases imp... |
de7a7f07a4d9cf3a03a97be902cb603e785c58280d3f7eeaed413ae4fec04984 | Python | 9,833 | 212 | import torch
from stable_baselines3.common.policies import BasePolicy
import torch as th
import gym
from gym import spaces
import math
import random
from stable_baselines3.common.preprocessing import get_action_dim, is_image_space, maybe_transpose, preprocess_obs
from stable_baselines3.common.type_aliases imp... |
54bf29b7a720ce186583bc7e5b16a376c80ac26617d8b0938a7abb900ee96db0 | Python | 9,834 | 297 | import os
from unittest import mock
import pytest
from langchain_core.language_models import BaseChatModel
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnableConfig, RunnableSequence
from pydantic import SecretStr
from langchain_classic.chat_models.base import __all__, ... |
6f9d9fda3f7b422a14d7a5372c0fb79fed52713da4893a823068081246cf989e | Python | 9,839 | 285 | import argparse
import os
import logging
import numpy as np
import mxnet as mx
from nowcasting.config import cfg, save_cfg
from nowcasting.utils import logging_config
from nowcasting.hko_iterator import HKOIterator, precompute_mask
from nowcasting.hko_benchmark import HKOBenchmarkEnv
from nowcasting.models.deconvolutio... |
eb4c03dfccca7ab1ea883c36307f2d141f218675e005d7cb3d68760fb6b88fe0 | Python | 9,846 | 227 | import torch
import torch.nn.functional as F
import math
class NoiseScheduleVP:
def __init__(self,
schedule='discrete',
betas=None,
alphas_cumprod=None,
continuous_beta_0=0.1,
continuous_beta_1=20.,
dtype=torch.f... |
7d1fdb2d8be62bbc7749ec37cc5f8fb19069aeb0eee895d99ee0aed2721d1d9a | Python | 9,847 | 271 | import numpy as np
import time
import torch
import matplotlib.pyplot as plt
from omegaconf import OmegaConf
from dipy.data import fetch_stanford_hardi, read_stanford_hardi, read_stanford_t1, read_stanford_pve_maps
from dipy.denoise.localpca import mppca
from dipy.denoise.patch2self import patch2self
from dipy.reconst ... |
245f5fe28d1f3e002a41e9fa1d8e568ba633baf0a676efd3e306caea898febdc | Python | 9,851 | 250 | from copy import copy
import numpy as np
import pandas as pd
from patsy import PatsyError
from patsy import dmatrix
from statsmodels.stats.multitest import multipletests
def Spline_Model_Full(pdata, df):
"""
Natural Cubic Spline
This algorithm perform the Natural Cubic Spline regression
Args:
... |
33e31d00c252a12e6932c53e801d79a5d22fbf4b7569abe4d913baa00202d420 | Python | 9,853 | 190 | import os
import pickle
import logging
import tensorflow as tf
import numpy as np
import pandas as pd
from dipgnn.utils.classification_metrics import ClassificationMetrics
from dipgnn.utils.register import registers
from dipgnn.tasks.base_training_task import BaseTrainingTask
@registers.task.register("clas... |
61b098fb0422246edc6d67a927e7e86ab4d293f7ccf62a853d1a01bc8a6af67b | Python | 9,854 | 294 | import os
from torch.multiprocessing import Pool, RLock, set_start_method
try:
set_start_method('spawn')
except RuntimeError:
pass
import cv2
import torch
import torch.nn as nn
import joblib
import numpy as np
import pandas as pd
from tqdm import tqdm
from tiatoolbox.utils.misc import imread, imwrite
from ti... |
b67de0401d11d7cd0b50f4a505dc380aac027d989895514dfecd4b3fdfa3c797 | Python | 9,855 | 194 | import inspect
from typing import Any
import numpy as np
import pandas as pd
from skbase.utils.dependencies import _safe_import
from sklearn.base import BaseEstimator, clone, is_classifier, is_regressor
from sklearn.dummy import DummyClassifier, DummyRegressor
from pgmpy.parameterization._base import BaseParameter
fr... |
c8ca97b908d4bb9d1d0b92deeb384e529709484c1cdecb793be1ea532d6724f5 | Python | 9,855 | 283 | """
Superposition of atomic (VASP) charge densities and projection onto GTO coefficients.
Pipeline
--------
1. Collaborator provides isolated-atom VASP ``CHGCAR`` (or ASE-readable charge files) per element.
2. ``AtomicDensityLibrary`` loads each reference, centers the grid on the atomic nucleus, and
keeps VASP vale... |
52699e3e16aab063971362adef8d42e1fa5eca0544f1b1481db1a03dd32b147c | Python | 9,856 | 320 | import numpy as np
import torch
import os
import matplotlib.pyplot as plt
from rde.utils.protein.constants import chi_pi_periodic, AA
from rde.utils.misc import BlackHole
from rde.utils.early_stopping import EarlyStopping
class NoamOpt:
"Optim wrapper that implements rate."
def __init__(self, model_size, fact... |
9811f582264a71730bd2ff553a94cb4ec54bb5b3b500512fa44623856bc6532e | Python | 9,856 | 205 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 25 11:24:40 2020
@author: gritti
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 16:46:26 2020
@author: gritti
"""
import os, tqdm, glob, sys
import PyQt5.QtWidgets
from skimage.io import imread, imsave
import numpy as np
from morgana.DatasetTools import io as io... |
c3eb34d667aff8e3a67988f6cd6ee0acb8e83e816bdfe159fe9565423993bc9d | Python | 9,859 | 207 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 25 11:24:40 2020
@author: gritti
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 16:46:26 2020
@author: gritti
"""
import os, tqdm
from skimage.io import imread, imsave
import numpy as np
# import sys
# sys.path.append(os.path.join('..'))
from orgseg.DatasetTool... |
14dacb04537f6b90d4eb06e420e51d258c0bc3673251c932ca192891e310e678 | Python | 9,860 | 239 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 1 15:21:23 2022
@author: gui_d
"""
import os
import shutil
from copy import copy
from itertools import repeat
import pandas as pd
class circos():
def __init__(self, nebula_output, enrichment_cutoff=0.05, save=None):
group_data = copy(nebula_output.group_da... |
975f225c9d898b4c5f6ed4ba5317c49cd95e0a999c3add51c40f19bd85738a52 | Python | 9,861 | 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 ra_preprocess_func
__all__ = ['ra_noLA']
class RaNola(TaskModel):
def __init__(self, **kwargs):
super().__... |
29d3cf7b5e2ff0ee384c635d1c385562e5148cd126b0e58b4e6746ed08f77a0e | Python | 9,862 | 259 | """unit tests for src/craniumpy_core/facial_measurements.py - pure geometry,
no FastAPI needed, same style as test_cohort.py. router-level plumbing
(api/routers/facial.py) is covered separately in test_facial_api.py."""
from __future__ import annotations
from pathlib import Path
import numpy as np
import pytest
impo... |
49a86db2b35cc3d6a157f405c28ea39f927ed231a0d5dd368decfe730d5acf17 | Python | 9,866 | 403 | import argparse
import logging
import sys
from ._version import get_versions
__version__ = get_versions()["version"]
del get_versions
logger = logging.getLogger(__name__)
class MyParser(argparse.ArgumentParser):
"""
Overriden to show help on default.
"""
def __init__(self, *args, **kwargs):
... |
6d68d4c45504ec684ab5aff7e6df5ac33fcd10f86f2f03c2e8dd5ea92d18d6e0 | Python | 9,867 | 284 | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import pickle
from palettable.colorbrewer.sequential import Greens_9
from palettable.colorbrewer.qualitative import Paired_12
from matplotlib.patches import Patch
import seaborn as sns
import sys, os... |
45c15f4a0ab079e024a8b6b292202f6f34456f57222dc53ddb14c7b61239a074 | Python | 9,868 | 243 | """Reverse-complement equivariant modules.
"""
from collections import OrderedDict
from typing import Optional
import torch
from torch import Tensor
from torch import nn
from torch.nn import functional as F
try:
from mamba_ssm.ops.triton.layernorm import RMSNorm, layer_norm_fn, rms_norm_fn
except ImportError:
... |
63f57067c232d72b23d2ea7fb4a4ffa63376b1ba3eb481d4bc49b9a383249bb7 | Python | 9,870 | 286 | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import pickle
from palettable.colorbrewer.sequential import Greens_9
from palettable.colorbrewer.qualitative import Paired_12
from matplotlib.patches import Patch
import seaborn as sns
import sys, os... |
bf9d6a822cdd1de778220b2118a5a043a60fc9dc3a00b2cd4d3ef6eddcbe3a47 | Python | 9,870 | 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 ra_preprocess_func
__all__ = ['ra_noRA']
class RaNora(TaskModel):
def __init__(self, **kwargs):
super().__... |
284212ea28e835cb63c7683711acf8ad1e27925ae45daed4fcc5057645745c97 | Python | 9,872 | 237 | 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 bandit2arm_preprocess_func
__all__ = ['bandit2arm_delta']
class Bandit2ArmDelta(TaskModel):
def __init__(self, **k... |
2dd524a0d93038e799f3343edcc92893f8d821ef02b52578caf1974c01b98645 | Python | 9,877 | 237 | import numpy as np
import pandas as pd
from scipy import special, stats
from ._base import BaseCITest, _CITestResult
_LAMBDA_ALIASES = {
"pearson": 1.0,
"log-likelihood": 0.0,
"freeman-tuckey": -0.5,
"mod-log-likelihood": -1.0,
"neyman": -2.0,
"cressie-read": 2.0 / 3.0,
}
class PowerDivergen... |
92edb42efb0c85753dcff6308030d3c393f9df9da10ac64386403bc34d486302 | Python | 9,877 | 280 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import shutil
import os
import subprocess
import time
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
import math
from torch.nn.modules.loss import _WeightedLoss
import numpy as np
class Mixup_datase... |
a83f837edc028f8dff9b3adc6da021a8abe693bc2eca87196229170b174d10ef | Python | 9,877 | 292 | # 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 ... |
68ba9855f5c0638f62e11a93819a8bb704b6fdb598f7bd0aacae64468ec58819 | Python | 9,878 | 268 | import os
from os.path import join as opj
import warnings
from typing import List, Dict
import numpy as np
import large_image
import pyvips
from glob import glob
from pandas import read_csv
from MuTILs_Panoptic.utils.GeneralUtils import load_json
from MuTILs_Panoptic.utils.MiscRegionUtils import numpy2vips
from MuTILs... |
16bb84eee51bde7816ea50b3fdbebf1bcb5ba2eec98d3eac987243c5dad81ffa | Python | 9,885 | 243 | 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 bart_preprocess_func
__all__ = ['bart_ewmv']
class BartEwmv(TaskModel):
def __init__(self, **kwargs):
supe... |
341c0dcf83a2f006c741c21b0215ea8d035eb19eaaf5e1d1f22d5958fe06aae1 | Python | 9,893 | 335 | """
====================
Liftover pipeline
====================
:Author: Andreas Heger
:Release: $Id: pipeline_liftover.py 2900 2010-04-13 14:38:00Z andreas $
:Date: |today|
:Tags: Python
The liftover pipeline maps a set of intervals from one or more genomes
to a target genome. It uses the :term:`liftover` tool from ... |
30c4aa784f6a5ca5adbe1d16504ed9408fa28d089136cac2f113cb6fa0c6457a | Python | 9,894 | 265 | ## Taken from https://github.com/nloyfer/meth_atlas
#!/usr/bin/python3 -u
import numpy as np
import pandas as pd
from scipy import optimize
import argparse
import os.path as op
import sys
from multiprocessing import Pool
import math
import matplotlib.pylab as plt
import matplotlib.cm
import matplotlib.colors
ATLAS_FI... |
13f9d245dbd2217a09ffba54a8838a32c5b823ab9adce57bd253439052dde835 | Python | 9,901 | 262 | # coding=utf-8
import sys
sys.path.append('..')
from feature_extractor.for_image_data.backbone import CNN_GAP, ResNet3D, UNet3D
import torch
import torch.nn as nn
from torchvision import models
import torch.nn.functional as F
vgg_dict = {"vgg11": models.vgg11, "vgg13": models.vgg13, "vgg16": models.vgg16, "vgg19": mod... |
7010c7f3015bfbeaa1afd5a8292bc35d850e44793e103b10bbafbb8e839a1462 | Python | 9,901 | 296 | # 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... |
c55a0c6b551e053c0cb155642e4accb4efa03f00fa116e950d091ac47291a2b6 | Python | 9,901 | 299 | #!/usr/bin/env/python3
from data_utils import _read_pickle_select, initialize_ulr_rigid
import torch
import numpy as np
from h3xsemble.utils.rigid_utils import Rigid, Rotation
def data_preprocess(pdbfile):
return
def zeropadding_for_collate(fn_dat, n_crop):
curr_len = fn_dat.shape[0]
if curr_len == n_c... |
fe2e9c1af563400115921da39408b981b2662efd6849b3f8779a8fa41e4b76a3 | Python | 9,902 | 253 | import os
import tempfile
import pytest
from t5chem.data_utils import count_lines, python_chunked_count
class TestPythonChunkedCount:
"""Test the python_chunked_count function."""
def test_empty_file(self):
"""Test counting lines in an empty file."""
with tempfile.NamedTemporaryFile(mode=... |
4fb67918b7a38361554753096419e717c36c09a35b6164600eaab9636c87634c | Python | 9,903 | 267 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Description: :
@Date : 2024/04/02 19:37:38
@Author : Zilan Yu
@version : 1.0
'''
import pandas as pd
import os,re
def prefilter(df):
"""
@Description:
Select samples with only 1 TRA and 1 TRB.
----------
@Param:... |
2fcca93b73c71a4d32a01bd300c33c4ca6af78d272aaee5ddef13ee92060a162 | Python | 9,910 | 232 | #!/usr/bin/env python3
import os
import sqlite3
import pickle
import logging
from enrichm.data import Data
###############################################################################
class Databases:
"""Access the enrichm reference database.
Supports two on-disk formats:
- New (SQLite): $ENRICHM_DB... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.