sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
922e75c1365e6619ebccfd18dd279e79e9c730f13facaf51a0ad05652dc3964f | Python | 16,616 | 465 | import random
import xml.dom.minidom as md
import xml.etree.ElementTree as etree
from collections.abc import Hashable
from itertools import chain
import networkx as nx
from pgmpy.factors.discrete import TabularCPD
from pgmpy.models import DiscreteBayesianNetwork
from pgmpy.readwrite._base import BaseReader, BaseWrite... |
620603aa50e664550de2938be23f8e73f855396ba87aa7c474d7ff4ab2d31d55 | Python | 16,619 | 400 | import torch
from torch import nn
from torch.nn import functional as F
from networks.networks_other import init_weights
class _GridAttentionBlockND(nn.Module):
def __init__(self, in_channels, gating_channels, inter_channels=None, dimension=3, mode='concatenation',
sub_sample_factor=(2,2,2)):
... |
91badc89df9856f356cad55a0603ea541a91765d43f3d7307942832cc00e43cb | Python | 16,634 | 479 | ''' This module provides different math functions that extend the numpy library.
:Implemented:
- log_sum_exp
- log_diff_exp
- get_norms
- multinominal_batch_sampling
- restrict_norms
- resize_norms
- angle_between_vectors
- get_2D_gauss_... |
866b102c1eeece492dd2ab16c97296ea021b8af9e7d271030e0494f1ae0cd14a | Python | 16,639 | 472 | """Functions for working with sequence (and related) i/o.
"""
from collections import defaultdict
from collections import OrderedDict
import gzip
import logging
import re
import textwrap
logger = logging.getLogger(__name__)
def process_fasta(f, replace_degenerate=False,
skip_gaps=False, make_upper... |
4f7348a27184764c4517a3680044abc9f2cc56b42f69cc0a47bfd0f68035b681 | Python | 16,644 | 426 | import os
import sys
import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from tqdm import tqdm
import common.run_manager
import seq_des.models as models
import seq_des.util.voxelize as voxelize
import glob
import seq_des.util.canonicalize as canonicalize
import pickle
import se... |
3e0173de90e0d112ae2c3085843eae5734665ca8fc57f847a768fcef63979c91 | Python | 16,647 | 464 | from typing import Union
import numpy as np
import pandas as pd
from pyriemann.tangentspace import TangentSpace
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import Pipeline
def _check_data(X):
# make proper 3d array of covariances
out = None
if X.ndim == 3:
out = ... |
9f2e5beea7492a1b8ba03983103fd7ae8c68019409319e33fa02be441ca770cb | Python | 16,647 | 425 | import argparse
import logging
import os
import re
import random
import shutil
import sys
import time
from xml.etree.ElementInclude import default_loader
from more_itertools import sample
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
import t... |
39e6b673e3f97aca9c52d72f3cf43d9f42a26e0d1252f836aa3f9865ee85412e | Python | 16,659 | 465 | import os
import utils
import numpy as np
import tarfile
import torch
from torch.utils.data import DataLoader
from torchvision.datasets.utils import download_url
def get_data_min_max(records, device):
#device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
data_min, data_max = None, None
inf = to... |
2ee1e4e0eaa0b60815fe77567616cff5da25050345a4148f6c7d19eebc094feb | Python | 16,665 | 449 | import scipy
import torch
import numpy as np
from scipy import interpolate, ndimage
import torchvision
import cv2
from datasets.utils.utils import recist_euclidean_distance
from scipy.spatial.distance import directed_hausdorff
import tqdm
from medpy import metric as medpyMetric
########################################... |
44384ec0a9fda5669d97828d4086cecacbb518c21625a850bb172051afd41cd3 | Python | 16,666 | 402 | import torch
import torch.nn as nn
from egnn.egnn_new import EGNN, GNN
from equivariant_diffusion.utils import remove_mean, remove_mean_with_mask
import numpy as np
class EGNN_dynamics_QM9(nn.Module):
def __init__(self, in_node_nf, context_node_nf,
n_dims, hidden_nf=64, device='cpu',
... |
808dd4bb7da86be21fd509c7daf55de14881ab14c08238c744a7350f58786739 | Python | 16,669 | 475 | import logging
import time
from sys import platform
from typing import (
TYPE_CHECKING,
Any,
TypedDict,
)
if TYPE_CHECKING:
from playwright.sync_api import Browser, CDPSession, Page
logger = logging.getLogger(__name__)
black_listed_elements: set[str] = {
"html",
"head",
"title",
"meta... |
a8044494a5cee8434294761651364330d66811146ad36032444a56151ce0ef6f | Python | 16,669 | 439 | import math
from typing import Optional, Tuple, Union
from collections import OrderedDict
from hienet.nn.linear import AtomReduce, FCN_e3nn, IrrepsLinear, eComfIrrepsLinear, DynamicIrrepsLinear
import torch
import hienet.util as util
import hienet._keys as KEY
from hienet._const import AtomGraphDataType
from torch im... |
48e0a974a970e1c30c1cc3c3ddafff122d2aafd98369a4baa2dd91db3154092f | Python | 16,675 | 500 | from typing import TYPE_CHECKING
import copy
import matplotlib.pyplot as plt
import numpy as np
from math import isnan
import math
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from skimage.draw i... |
075391eee254516f19affcf73aa77ea82663f736c19f146deb1b66c45bd249a5 | Python | 16,694 | 462 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS well-mixed stochastic solver 'TetVesicle' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# Note, while these are well-mi... |
8d2f24fd0c5a3d2e29dfd449360884e5182078c0b9b6d90dc8cfa6d9a7579bcf | Python | 16,698 | 472 | """Model fallback middleware for agents.
When an outer caching middleware modifies a request, those changes happen before
the fallback loop runs. Provider-specific cache settings can cause API errors if
the loop reuses them with a different provider. This middleware therefore strips
unsupported Anthropic and Fireworks... |
2b78d07dfef9345c438ba4b988868996403c3f8310c489a91ca3297161daa6b7 | Python | 16,701 | 439 | from typing import Union
import numpy as np
import pandas as pd
from scipy.stats import trim_mean
try:
from pyriemann.estimation import CospCovariances
except ImportError:
# CospCovariances was renamed to CoSpectra in pyriemann 0.6
# and removed in pyriemann 0.7 (PR #327)
from pyriemann.estimation impor... |
6d643680a1ab51678ea251b3c26be609e6c75d1f9f60e8d1ccb3b535ed008347 | Python | 16,701 | 463 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS well-mixed stochastic solver 'TetVesicle' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# Note, while these are well-mi... |
ffea630735907225a2f63c33f8e89c09ab84092ffbcd38f62e0dddcbee926244 | Python | 16,704 | 446 | # 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... |
a2acc4dd70d20cf387f2ac5e0695b59deb9e4226cbadf7eb46586d80c7fc82eb | Python | 16,707 | 587 | # 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... |
3ff9fb5342ea6cca675c438881d885eb1b3878ef13e5a7a0a78c927edf417cb5 | Python | 16,739 | 483 | '''
runZinba.py - wrap zinba peak caller
========================================
:Tags: Python
Purpose
-------
Runs the zinba peak caller.
Note that for zinba to work, a mappability file needs to have
been created.
The output bed files contain the P-value as their score field.
Usage
-----
Documentation
--------... |
9cf40daff1ec5ce59d56cb07b9bcdd464d44375e0ab455ae1d71e5216c84df01 | Python | 16,741 | 508 | import warnings
from collections import OrderedDict
from typing import Callable, Dict, List, Tuple
from e3nn.o3 import Irreps
from torch.nn import Module
import hienet._const as _const
import hienet._keys as KEY
from hienet.nn.convolution import IrrepsConvolution
import hienet.util as util
from hienet.nn.edge_embeddi... |
def9472029018c3d10e3a6cfaf74164330b884fd87502794ef24f510fc065086 | Python | 16,745 | 466 | from collections import OrderedDict
from pandas import read_csv
from matplotlib.colors import ListedColormap
from copy import deepcopy
import os
from os.path import join as opj
from MuTILs_Panoptic.utils.GeneralUtils import (
ordered_vals_from_ordered_dict, reverse_dict
)
from MuTILs_Panoptic.configs.nucleus_styl... |
7c8325bc9075192b5a47f31c133b9a7019f27f5eb74cf73cb985cf956f23856e | Python | 16,762 | 571 | import numpy
import openmm
import openmm.unit
import pytest
from openff.toolkit import ForceField, Molecule, Topology
from openff.units import Quantity, unit
from openff.units.openmm import ensure_quantity
from openmm.app import ForceField as OpenMMForceField
from openmm.app import HAngles
from openforcefields.tests.c... |
fbbebff421da2103b611b08d7b204e85b08ac5ce157eeff1308222c90f30e161 | Python | 16,779 | 338 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Description: :
@Date : 2022/11/17 16:23:07
@Author : Zilan Yu
@version : 1.0
'''
import pandas as pd
import os
import random
root_clustered = "../clustered_datasets"
clustered_iedb_filepath = os.path.join(root_clustered, "clustered_iedb.tsv")
clus... |
0424f57cbaecc2a317c045807b334790c84254b3c475f946b7491cb2aea0c286 | Python | 16,790 | 357 | # Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
86269ab32525aa001a59be2f6fcf64c3ad5e389e0b3034a921a7d8ba42c937da | Python | 16,801 | 720 | """**LLMs**.
**LLM** classes provide access to the large language model (**LLM**) APIs and services.
"""
import warnings
from collections.abc import Callable
from typing import Any
from langchain_core._api import LangChainDeprecationWarning
from langchain_core.language_models.llms import BaseLLM
from langchain_clas... |
0c166122f8b90a96f28c809f9ac4001977ef8985370915448f7687d75a937e2f | Python | 16,804 | 545 | import numpy as np
import os
from pensa.preprocessing import sort_coordinates
def get_feature_subset(feat, data, selection):
"""
Returns a subset of selected features.
Does not check whether the selected features are actually present in the input.
Parameters
----------
feat : list of str
... |
07bf3d4cf2fb3dff090748a18e39d7183f72899630db3b13d10698806e4c97ef | Python | 16,822 | 489 | from pathlib import Path
from typing import Tuple, Union
from unittest import SkipTest, TestCase
import numpy as np
import pytest
import torch
import torch.nn.functional as F
import chroma
from chroma.data import Protein
from chroma.layers.structure import backbone, rmsd
from chroma.layers.structure.diffusion import ... |
b41208cab038443123635bf38fc337a24446e4499b24398faaf983cbd4c4fa3b | Python | 16,826 | 313 | """
Module to compare natural behaviour and stimulus responses in more detail.
Author: jonas.braun@epfl.ch
"""
import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.backends.backend_pdf import PdfPages
import seaborn as sns
from scipy.stats... |
759584524c629f370f22c4496c719bf0353a0924c53362e6efc2c5b4d36b2715 | Python | 16,830 | 372 | import mxnet as mx
import numpy as np
from nowcasting.config import cfg
class ParamsReg(object):
def __init__(self):
self._params = {}
self._old_params = []
def get(self, name, **kwargs):
if name not in self._params:
self._params[name] = mx.sym.Variable(name, dtype=np.float... |
d93e1e24fbab1c18d73a15a41ac5e535a29489052a7f11d08bacda576096c899 | Python | 16,831 | 290 | import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
import pgmpy.parameterization
from pgmpy.example_models import load_model
from pgmpy.factors.continuous import LinearGaussianCPD as LegacyLinearGaussianCPD
from pgmpy.models import LinearGaussianBayesian... |
46dba2e03e65a5c6ca35fc9ef61425d2589c97cfd80e98ec6e5fdb3b183f1ec3 | Python | 16,843 | 471 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS well-mixed stochastic solver 'Wmdirect' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# This model combines all we... |
1fbe1bde831659905061fd928581787b68228e4ea50e9c16bd42771ba0d60ce0 | Python | 16,854 | 424 | import os
import sys
import time
import numpy as np
import torch
import torch.nn.functional as F
from torch.optim import lr_scheduler
from torch_geometric.data import DataLoader
from tensorboardX import SummaryWriter
from sklearn.metrics import confusion_matrix, classification_report
from datetime import datetime
# lo... |
600f32fb3885953503465a8ad6988dcaf113f9159472808c6913354d62db2499 | Python | 16,860 | 471 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS well-mixed stochastic solver 'Wmdirect' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# This model combines all we... |
66578e7d93e1ffc103ef0f9592d5c1b6264be5ca1cc9ac78ee9f391da12a0fc1 | Python | 16,865 | 393 | import os
import sys
import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from tqdm import tqdm
import common.run_manager
import seq_des.models as models
import seq_des.util.voxelize as voxelize
import glob
import seq_des.util.canonicalize as canonicalize
import pickle
import se... |
340d907aeab81263852065f007941875ee5d40ebfc680aec08de0de3268f8f54 | Python | 16,875 | 329 | # 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... |
c703180829d6493940ac58d74c2e27e56dd33758506c25b22f6b36c278cb94e1 | Python | 16,877 | 311 | import os
import pytest
import unittest
from perses.rjmc.atom_mapping import AtomMapper, AtomMapping, InvalidMappingException
from openff.toolkit.topology import Molecule
################################################################################
# LOGGER
#########################################################... |
a54b22662c54b3438680060cd2d3ad412be62fa3742e11eefefbcb95747bbf43 | Python | 16,883 | 379 | import math
import logging
import torch
import torch.nn as nn
from torch.nn import functional as F
logger = logging.getLogger(__name__)
class GPTConfig:
""" base GPT config, params common to all GPT versions """
embd_pdrop = 0.1
resid_pdrop = 0.1
attn_pdrop = 0.1
cross_pdrop = 0.1
def __init... |
8404bf35f2ba152d2e25d5c459ec9b3678f0b766e844418ea4f0e3af189ceae6 | Python | 16,903 | 573 | """==========================================================
pipeline_promotors.py - Defining promotor characteristics
==========================================================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python
Pipeline to annotate promotors according to certain properties:
1. TATA... |
f602e61894d0fef065c878e041e0b0a648a5f08d99d3ee05a2fd821c740740e8 | Python | 16,916 | 429 | """
FitSynergyNet
Optimize AUC for classification task
Optimize RMSE for regression task
"""
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
import sklearn.metrics as skmts
import sklearn.feature_extraction as skfet
import scipy.stats as scistat
from numba import jit
import cupy as cp
import torch
i... |
04a7f4dc6d742e2d71e87ede9ed6064dfe7bcd3a44e90e7db8930341541d6311 | Python | 16,938 | 432 | from __future__ import annotations
import asyncio
import logging
import time
from collections.abc import AsyncIterator, Iterator
from typing import (
TYPE_CHECKING,
Any,
)
from uuid import UUID
from langchain_core.agents import (
AgentAction,
AgentFinish,
AgentStep,
)
from langchain_core.callbacks... |
f7eb20f5f6e6a3f42733c076b9933472e0e5a15a1ad592c84a8d671b9d48037b | Python | 16,940 | 473 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS well-mixed stochastic solver 'Wmrssa' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# This model combines all well... |
8a365599728b375cc12fb6938e957279f633307d3d0e374e7bdbf6404ad6ba93 | Python | 16,953 | 502 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS distributed stochastic solver 'DistTetOpSplit' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
#########################... |
540ef3e57956bda16829433c97ee30732e12167d049c8e997c888fa92f363054 | Python | 16,957 | 473 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS well-mixed stochastic solver 'Wmrssa' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# This model combines all well... |
defbe34d0842ce896af748653cfba3b8cc209161e344727d1df79112a3a0dd04 | Python | 16,984 | 393 | import os
import time
import re
from typing import Optional, TypedDict
import pickle
import numpy as np
import pandas as pd
import tifffile as tf
# grabbing functions from .utils_funcs that are used in this script - Prajay's edits (review based on need)
from packerlabimaging.processing.imagingMetadata import Prairi... |
5b9383d552ca0c5a1e475b16f36c1a454e741dd58612f0703daf01f4dc507f6d | Python | 17,003 | 464 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
head_classifier.py
==================
Classification heads that are fully trained on frozen AE encoder embeddings.
Supported head types
--------------------
xgboost XGBoost gradient-boosted trees
random_forest sklearn RandomForestClassifier
linea... |
ac5d01ce5e55872b5c8c195aa59d8b49fb706700aa8c9a5a19a3b4b6ad604eb2 | Python | 17,031 | 429 | """EMBanded model implementation using torch."""
import copy
from typing import List, Tuple
import torch
from .helpers import (
check_positive_float, check_input, check_boolean, check_smooth_params
)
from ._torch_model_utils import (
prepare_smoothness_cov, create_matrix_indexer,
fit_model_multidimensiona... |
898f651e100d61134a021f1b733265bf106e34e9b984cf121f31050421bc0314 | Python | 17,033 | 357 | # Imports
import sys
import os
import argparse
import inspect
from datetime import datetime
import numpy as np
import torch
import scipy
import tensorflow as tf
from tensorflow import keras
from time import perf_counter, process_time
from scipy.integrate import odeint, solve_ivp
#from datagenerator import DataGen... |
c27ce95f2acf5bdecaede9f621f9909057f404078e5e1b43dc8c46dddb88e933 | Python | 17,035 | 371 | import os
import shutil
from pkg_resources import resource_filename
from simtk import unit
from perses.dispersed import feptasks
from perses.app import setup_relative_calculation
import mdtraj as md
from openmmtools import states, alchemy, testsystems, cache
from unittest import skipIf
from perses.tests.utils import ... |
4775b701af7c5cc849b0f501d82984f34e37d7385941f7aeb255c95609713663 | Python | 17,044 | 338 | # 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... |
34fd70eab8930b790f70d7ed09abf9495ab89fb7e126f2ff4e5979b17d080449 | Python | 17,052 | 518 | import math
from typing import Optional, Tuple, Union
import torch
import hienet._keys as KEY
from hienet._const import AtomGraphDataType
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
from torch_scatter import scatter
from torch_geometric.nn.conv import MessagePassing
from torch_geomet... |
b6f323656caffaeb1d933d01f37becad7a93739fef3cb1a1966cab105d220237 | Python | 17,082 | 431 | import copy
from math import pi, log
from einops import rearrange, repeat
import torch
import torch.nn as nn
from torch.nn.utils import weight_norm
from torch.nn.utils.weight_norm import WeightNorm
class WNLinear(nn.Linear):
def __init__(self, in_features: int, out_features: int, bias: bool = True, device=None, d... |
0b8b253b307df2eb33245fc2f301f9a36262065a6a208d6a95bb05e0a4b63c21 | Python | 17,083 | 473 | """Script for running inference and sampling.
Sample command:
> python scripts/run_inference.py
"""
import os
import time
import tree
import numpy as np
import hydra
import torch
import subprocess
import logging
import pandas as pd
import shutil
from datetime import datetime
from biotite.sequence.io import fasta
imp... |
2d663f5bea1a1d7c291394775a794f0ae797e103c75e1f6d32c13832f90290a8 | Python | 17,093 | 474 | import random
import numpy as np
import torch
from torch.utils.data import TensorDataset
#%%################
### Recognition ###
###################
def generate_recog_data(T=2000, d=50, R=1, P=0.5, interleave=True, multiRep=True, xDataVals='+-', softLabels=False):
"""Generates "image rec... |
898ab2fcfaf11f0bd231d21dd38477b40afa2da8389e84c5da842596b75869fd | Python | 17,107 | 463 | # Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
4ca7593cc3c6d005bfb3193c3474b741ee766a137a748bc1591a98df91626712 | Python | 17,122 | 443 | from pathlib import Path
from time import time
import argparse
import shutil
import random
import matplotlib.pyplot as plt
import seaborn as sns
from tqdm import tqdm
import numpy as np
from Bio.PDB import PDBParser
from Bio.PDB.Polypeptide import three_to_one, is_aa
from rdkit import Chem
from scipy.ndimage import ... |
a0915117b7f407c98c32da916744a5ba76274a929c09ce2e9b11a62d63dacd12 | Python | 17,139 | 393 | #!/usr/bin/env python
# coding: utf-8
# download_rockland_raw_bids_ver2.py
#
# Modified by: Yiwen Tian 2021
# Based on Ver1 by: Daniel Clark, John Pellman 2015/2016, Carlos G.Candano 2017/2018
"""
TODO: set up for SLURM to paralellize downloading
This script downloads data from the NKI Rockland Public releases store... |
cd94e00f73fdccbfe8b3d8eedb19e6c97eb4b1c89db4c170ffac49c2057c2ff5 | Python | 17,171 | 439 | ####################################################################################
#
# 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... |
d8fea70f62935b234605a8cd6a479cea474a99f1212d477e5d371c424c0b752a | Python | 17,178 | 393 | import albumentations as A
from albumentations.pytorch import ToTensorV2
from joblib import Parallel, delayed
from torch.utils.data import DataLoader
from modulable_CNN3D import CNN3D
import os
import torch
from torch import nn
import numpy as np
from skimage.io import imread, imsave
from src.napari_svetlana.CustomDa... |
91f904deff55c3023d756a94ac441545a35f11ebaf5ac15be7dba088dccbdba9 | Python | 17,193 | 501 | from nowcasting.config import cfg, cfg_from_file, load_latest_cfg, save_cfg
from nowcasting.utils import * # TODO use explicit import
from nowcasting.utils import load_params
from nowcasting.ops import fc_layer, activation
from nowcasting.my_module import MyModule
from nowcasting.models.deconvolution_symbol import dis... |
ea946f7a85942e8cac4f702c4871cafb59a4721dae0fb4c1060eb84c383a7fdb | Python | 17,206 | 391 | from collections.abc import Callable, Hashable
from itertools import combinations
import pandas as pd
from sklearn.base import clone
from pgmpy.base import PDAG
from pgmpy.causal_discovery import ExpertKnowledge
from pgmpy.causal_discovery._base import BaseCausalDiscovery, _ConstraintMixin
from pgmpy.ci_tests import ... |
0a415fff533a87f0e92dd29efa7d31a449d63ff1fda5886eceef9523ef1e96be | Python | 17,221 | 515 | # 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... |
d03673cb242038966b33ed9e7f5c8b1ae70764eee438e1d72aede697eee5f161 | Python | 17,224 | 377 | import numpy as numx
import pydeep.base.numpyextension as numxExt
from pydeep.base.activationfunction import Sigmoid
class Binary_layer(object):
def __init__(self,
input_weight_layer,
output_weight_layer,
data = None,
initial_bias = '... |
5d86f8579a57e7e3b5e3bd111bf74674f9c9f839f7abb5bcd12245db0e58a97a | Python | 17,235 | 524 | #!/usr/bin/env python3
"""Analyze backbone metrics for a directory of PDB files.
Computes, per PDB:
1) N-term and C-term normalized end scores against an interface point
2) Radius of gyration (Rg) for a chain + atom selection
3) STRIDE secondary-structure percentages
Example:
python analyze_backbones.py \
--pdb-dir... |
ecd25f240bcbec88704fb504de22f2120873e362650e80031e627ff48c6a5dc3 | Python | 17,235 | 426 | import math
import torch
from torch import nn
from torch_geometric.nn import MessagePassing
import math
EPS = 1e-8
class VecLayerNorm(nn.Module):
def __init__(self, hidden_channels, trainable, norm_type="max_min"):
super().__init__()
self.weight = nn.Parameter(torch.empty(hidden_channels), require... |
4f3eb4f64a0d0cade4cbb61497691d3f95d736f3de7a7f16f975d12596f18121 | Python | 17,271 | 390 | #!/usr/bin/env python3
import logging
import sys
import os
import shutil
import time
from enrichm.data import Data
from enrichm.enrichment import Enrichment
from enrichm.annotate import Annotate
from enrichm.classifier import Classify
from enrichm.generate import GenerateModel
from enrichm.predict import Predict
###... |
5f22ea327693c2aad32391d9004791d55481ac020b8bbd5f79e04bb51e99a692 | Python | 17,271 | 500 | """Base language models class."""
from __future__ import annotations
import builtins # noqa: TC003 # runtime-evaluated; subclass `dict()` shadows the builtin
import warnings
from abc import ABC, abstractmethod
from collections.abc import Callable, Mapping, Sequence
from functools import cache
from typing import (
... |
5313cb9cdcdd34b306b698e82e972e2faed9501abc95451179c7d3b7dde35fa5 | Python | 17,281 | 353 | import argparse
import json
import os
from pathlib import Path
from threading import Thread
import numpy as np
import torch
import yaml
from tqdm import tqdm
from models.experimental import attempt_load
from utils.datasets import create_dataloader
from utils.general import coco80_to_coco91_class, check_dataset, check... |
39ada67c4aa66941de1c32f25ebe6c13a056641d7b824afc3be7efd54dd9ccf9 | Python | 17,300 | 351 | """
Module used to create videos from functional imaging data
Author: jonas.braun@epfl.ch
"""
import os
import sys
import numpy as np
import pandas as pd
import matplotlib as mpl
mpl.use('agg')
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import pickle
from tqdm import tqdm
from... |
88f76a22b20e90e91a0d3fe4c5e42d5fcaf65e5effdeb3e8830c88a4f8b17705 | Python | 17,337 | 528 | import gzip
import pandas as pd
try:
from importlib.resources import files
except ImportError:
# For python 3.8 and lower
from importlib_resources import files
from pgmpy import logger
from pgmpy.utils._warnings import _warn_external
def get_example_model(model: str):
"""
Fetches the specified ... |
61bc2cca7d1a5765aad29fbce2630117aa0f6acd2d22cab0da4220c6616850e6 | Python | 17,340 | 379 | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) venkatesh-sivaraman.
# Distributed under the terms of the Modified BSD License.
"""
Emblaze is a Jupyter notebook widget for **visually comparing embeddings** using
animated scatter plots. It bundles an easy-to-use Python API for performing
dimensionality reducti... |
7f755641ae788a35fc7af67b69d7b231415ebb915b974d1029cc83db10cf537c | Python | 17,340 | 507 | # 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 os
import math
import time
from collections import defaultdict, deque
import datetime
import numpy as np
from tim... |
80d3cea00f0cc442602df7cc79ba8f016524556e34ebf4420f71e948c34c4bad | Python | 17,341 | 428 | import pandas as pd
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
import sys
import re
from pathlib import Path
import numpy as np
import re
import os, sys
import random
from gensim.models import KeyedVectors
from mantis_ml.config_class import Config
def ex... |
c130db6db7ad739ab70e5134cccf0bd13d7ef229b785982846b59029a63d98d2 | Python | 17,345 | 430 | # 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... |
d28a78968375e07f0b919f6a6ff23f77a8f98e25fa2cc4e557c7b3fb3cccca2a | Python | 17,381 | 358 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
POCIF-BAT R3 — H-R2-5 et H-R2-6, axe C : certificat d'admissibilité et couverture.
Seuls axes ayant franchi la porte P0 avec un espace brevet vérifié. Les seuils
sont ceux du préenregistrement R2 (condensat a181aa09…) ; les choix opératoires
sont ceux de l'addendum R3... |
49aeccaece6f7632e4d53a2b87048895c45e1943e444b49bb5bbf6f1e0e9f62a | Python | 17,382 | 445 | from .combinators import *
from .universal_tree_visualization import *
from .derivation import Node
from typing import List, Tuple
import os
import shutil as sh
def jupyter_display(tree, vtype=None, title=None, warning=False):
from IPython.display import Image, display, HTML
if vtype is None or vtype in [1, '... |
ff1db9d414e27bb695ae622d21462240ab80dd8a167811ab136156f7f8b2c70c | Python | 17,386 | 426 | import math
import torch
from torch import nn
from torch_geometric.nn import MessagePassing
import math
EPS = 1e-8
class VecLayerNorm(nn.Module):
def __init__(self, hidden_channels, trainable, norm_type="max_min"):
super().__init__()
self.weight = nn.Parameter(torch.empty(hidden_channels), require... |
8b4362ea8c13313a02bf6a2a640986cf2eae9ea1d8fdd14a5c26bc7904be4561 | Python | 17,389 | 436 | """
In this file the action is evaluated on the circuit to obtain result
"""
import os
import networkx as nx
from DSS_CircuitSetup import*
#------------------- User defined inputs to modify the standard test network ---------------------------------
sectional_swt=[{'no':1,'line':'L19'},
{'... |
3fb2eadb66395f26b799839dcb5cc6a6e977de2ee41a697c7ad8608be333433c | Python | 17,391 | 480 | import tempfile
from typing import Dict, Iterable, Optional, Type
import torch
from bindsnet.learning.reward import AbstractReward
from bindsnet.network.monitors import AbstractMonitor
from bindsnet.network.nodes import CSRMNodes, Nodes
from bindsnet.network.topology import AbstractConnection
def load(file_name: st... |
3d97eac925400059fa5e669363a6b4104e073b8247127dfc1f325cf7ccaa2f4b | Python | 17,435 | 558 | import os
import numpy as np
import subprocess
from importlib.machinery import SourceFileLoader
import json
from itertools import combinations
import math
import functools
import logging
import traceback
from collections.abc import MutableMapping
from typing import Union, Iterable
from pandas import DataFrame, read_csv... |
754cc9e1dea1c863d56d9b0a9b01f6302e9ec108384bd95560a82b8cfb63f2f8 | Python | 17,438 | 289 | """
module used to compute different types of baselines for neural signals and to add the DF/F signals to the twop_df.
Author: jonas.braun@epfl.ch
"""
import sys
import numpy as np
from scipy.signal import find_peaks
from scipy.ndimage import gaussian_filter1d
from twoppp import utils, rois
import params, stimulation... |
a16a1fa9fe4529e0fd0b08a3a6da0547e75ccb76f44eda930b173de884bbdf82 | Python | 17,444 | 394 | import os
import pathlib
import time
from typing import Union, List, Literal
import equinox as eqx
import numpy as np
import torch
import torch.nn.functional as F
import wandb
from einops import rearrange, repeat, pack, unpack, reduce
from torch_scatter import scatter, scatter_std
from torchdiffeq import odeint as nn_... |
686391a9b85e9b4aeeca295dbb52e368987293944485ee0d6d03536eb8f59686 | Python | 17,454 | 487 | import pandas as pd
import numpy as np
import cgatcore.iotools as iotools
import random
import itertools
from cgatcore.pipeline import cluster_runnable
import json
import decimal
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.patches as mpatches
@cluste... |
889e7c281034c32552addda7f53099220e3cbe8de727e88abd3eb65694648ad0 | Python | 17,455 | 494 | """
Functions which create a topological molecule directly, without a toolkit.
These are common to several test modules.
"""
import numpy as np
from openff.toolkit import unit
from openff.toolkit._tests.utils import requires_openeye
from openff.toolkit.topology import Molecule, Topology
from openff.toolkit.utils im... |
fd1af3d89c6011a773c527dabd06dfa9d941c1f4fda26fcecc7283723df75802 | Python | 17,457 | 442 | # 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 ... |
a4577654a04a09de799a81da7ec94d473c9aecd71f0837c0af80d5728888fe1d | Python | 17,471 | 266 | import os
import torch
from torch_geometric.data import DataLoader
import numpy as np
from model import MatGen
from dataset import MatDataset
from utils import StandardScalerTorch
class Runner():
def __init__(self, conf, score_norm_path):
self.conf = conf
score_norm = np.loadtxt(score_norm_path)
... |
0154f653b9cb60c1f55eb4849313d5ebf3faf3b463938a4a0cf95139895fc57c | Python | 17,487 | 591 | import sys
from typing import (
Optional,
Callable,
List,
DefaultDict,
Union,
Tuple,
Dict,
Any,
)
from collections import defaultdict
# From 3.9, typing.Iterable is deprecated
# in favour of collections.abc.Iterable.
# collections.abc.Iterable can be used for isinstance checks,
# but no... |
e9de0fb600734fd18edcf333de574c2dff1fbd982314c91c35b4ccb7d877eba2 | Python | 17,506 | 439 | import pytest
from pgmpy.identification.probability_expression import (
DivisionNode,
MarginalNode,
OneNode,
ProbabilityExpressionTree,
ProbabilityNode,
ProductNode,
_TreeNode,
)
@pytest.fixture
def prob_y():
return ProbabilityNode(frozenset({"Y"}))
@pytest.fixture
def prob_x():
... |
f2f608fba240b0d596889a9ca96ca1f8f4f49690bc24abd094f1b87c776c7f30 | Python | 17,508 | 508 | """Base class for prompt templates."""
from __future__ import annotations
import builtins
import contextlib
import json
from abc import ABC, abstractmethod
from collections.abc import Callable, Mapping
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING, Any, Generic, TypeV... |
03aae9f965be8f67753477b98c651d009bd646f3772eab1ba19c5a39b2f28824 | Python | 17,556 | 529 | import os
import re
import sys
from contextlib import AbstractContextManager, nullcontext
from copy import deepcopy
from typing import TYPE_CHECKING, Any
from unittest.mock import patch
import pytest
from pydantic import BaseModel, Field, SecretStr
from pydantic.v1 import BaseModel as PydanticV1BaseModel
from pydantic... |
7a643c057e12abaa9109e9ee06f990efec7e84f3c9adb332c15697365a354ad2 | Python | 17,560 | 467 | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 3 15:18:38 2014
@author: Dan Denman and Josh Siegle
Loads .continuous, .events, and .spikes files saved from the Open Ephys GUI
Usage:
import OpenEphys
data = OpenEphys.load(pathToFile) # returns a dict with data, timestamps, etc.
"""
import os
import numpy a... |
7398bb4db990af959df71dd81243e04b1a5f665602155a6f808271d910c4a62d | Python | 17,578 | 518 | """Base message."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, cast, overload
from pydantic import ConfigDict, Field
from langchain_core._api.deprecation import warn_deprecated
from langchain_core.load.serializable import Serializable
from langchain_core.messages import content as typ... |
9364ddd2f17de04c12f866fc6681f5ff5bf083f8fd09a3211c08ae536bd0e68c | Python | 17,579 | 578 | """
Utility functions for simulations using openeye toolkits
"""
__author__ = 'John D. Chodera'
from simtk import unit
from simtk.openmm import app
import simtk.unit as unit
import numpy as np
import logging
logging.basicConfig(level=logging.NOTSET)
_logger = logging.getLogger("utils.openeye")
_logger.setLevel(lo... |
07bdf25d9df9ebecc0b7b3110be9311273eec5ff38aeb346c25bf86a8752ee36 | Python | 17,584 | 471 | from __future__ import annotations
import logging
import warnings
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import torch
from scvi import REGISTRY_KEYS, settings
from scvi.data import AnnDataManager
from scvi.data.fields import (
CategoricalObsField,
LabelsWithUnlabeledObsField,... |
52d6bcd1481222e7bdc967f52d8d063f4183cfc669101a8c9da7635af530bfe6 | Python | 17,584 | 413 | """
Visualization tools for perses (protein mutations or small molecule transformations).
Requires PDB and trajectory (.dcd or .xtc) files for old and new atoms.
Pre-requisites:
conda install -c schrodinger pymol (+ PyMOL license)
conda install -c conda-forge moviepy
"""
__author__ = 'Ivy Zhang'
###################... |
ec515b9041db1708fa8be347d15073389d878fd8cf6b03aa2a2c8a51e0cd3c64 | Python | 17,626 | 414 | """
Visualization tools for perses (protein mutations or small molecule transformations).
Requires PDB and trajectory (.dcd or .xtc) files for old and new atoms.
Pre-requisites:
conda install -c schrodinger pymol (+ PyMOL license)
conda install -c conda-forge moviepy
"""
__author__ = 'Ivy Zhang'
###################... |
00637a38cb8418dbe79a2ec396091c122d8aeaa3228726fe1fa033057efd74ef | Python | 17,638 | 457 | import pandas as pd
import src.util as util
import numpy as np
from sklearn import ensemble
def get_sim_data(label, file):
ds_path = f'../data/{file}'
static_features = ['Gender', 'Foreigner', 'BMI', 'Age']
seq_features = ['ER Registration', 'Medication B', 'Medication A', 'Heart Rate', 'Blood Pressure']... |
fbe80bfb404dafe8769623649168e0b7d5653b2c6fe1c03e9ff23c2714c6f5cd | Python | 17,641 | 534 | import re
from typing import List
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from efficientnet_pytorch import EfficientNet
from efficientnet_pytorch.utils import get_model_params, url_map
from torchvision.models.densenet import DenseNet
from torchvision.models.resnet import BasicBlock... |
f8b6a07f38a2ff6bd35ac2b03960cc71f5fba188a29cdd0cf309e16d369f0339 | Python | 17,657 | 485 | # 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... |
9df3b457cc8fe745e86094e2ab37026f5665e830e0b34c13baf22d6ae4810bfd | Python | 17,664 | 406 | # This scripts needs to run DFT for evaluation, and the process needs a long time
import os
NUM_THREADS = 6
os.environ['OMP_NUM_THREADS'] = str(NUM_THREADS)
os.environ['MKL_NUM_THREADS'] = str(NUM_THREADS)
os.environ['NUMEXPR_NUM_THREADS'] = str(NUM_THREADS)
os.environ["OPENBLAS_NUM_THREADS"] = str(NUM_THREADS)
os.envi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.