sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
79cb9a4b8511da9536ce64fd2d7e11e05c19154f9b144159f6eea38fd752d8c9 | Python | 4,221 | 132 | """Callback handlers allow listening to events in LangChain."""
from typing import TYPE_CHECKING
from langchain_core._import_utils import import_attr
if TYPE_CHECKING:
from langchain_core.callbacks.base import (
AsyncCallbackHandler,
BaseCallbackHandler,
BaseCallbackManager,
Callb... |
3aa880ef4b3a93066377627314ecaaf74633fafcb66a2b5f620cc56c9f054fd5 | Python | 4,225 | 98 | #! /usr/bin/env python
from __future__ import print_function
import os
import numpy as np
import nibabel as nib
import argparse
from fernet.pipeline import *
from fernet.utils import nifti_image, read_dwi, write_dwi
DESCRIPTION = '''
Apply free water elimination to a DWI image using an existing water volume fr... |
8a5311254f9b992601bf5234d2a24d82633cf68ab33eb9b76738bc386ead1473 | Python | 4,225 | 159 | import base64
import io
import os
import zlib
from pathlib import Path
from typing import List, Union
import cv2
import numpy as np
from PIL import Image
CLASS_MAP = {
'Arteriole lumen': {
'id': 1,
'color': [212, 0, 2],
},
'Arteriole media': {
'id': 2,
'color': [255, 124, 1... |
9caa19c9648f3bbb8e15cbcdefd94561d09063ae98acd46e2d6d43f6ddd0c24d | Python | 4,225 | 87 | import numpy as np
import pandas as pd
import pickle
import csv
from sklearn.linear_model import LogisticRegression, PoissonRegressor
from sklearn.utils.class_weight import compute_sample_weight
from sklearn.exceptions import ConvergenceWarning
import matplotlib.pyplot as plt
import collections
import os
import argpars... |
8cc6b484b8e55a87cea0e8c158b90109ed10bce3a1caf91a1a358bfe0489988f | Python | 4,227 | 129 | #!/usr/bin/env python3
import os
import warnings
import argparse
from pathlib import Path
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Suppress TensorFlow messages and deprecation warnings
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
warnings.filterwarnings('ignore')
# Your project imports
fro... |
95319f2326d580d7fb64be9b9a59e54c52e0e491673a10a16d20ea7d9c7bc129 | Python | 4,227 | 115 | import torch
from typing import List
def time_integrate(
times: torch.Tensor,
u: torch.Tensor,
dim: int
):
assert times.ndim == 1, times.shape
u = u.transpose(0, dim)
assert len(times) == len(u), [times.shape, u.shape]
u_shape = u.shape
u = u.flatten(1)
delta_t = times.d... |
3b85e1b03a49acf1a1d20a42c422bdce1fe89d8c40e2cd776689995213077cbe | Python | 4,228 | 122 | """
Window-size sensitivity analysis for the SMdRQA UI.
Seeded, vectorised re-implementation of the bootstrap procedure in
``SMdRQA.window_size``: for each candidate window size, line-length
distributions are pooled over all diagonal sub-windows of the recurrence
plot, resampled ``n_boot`` times, and the width of the ... |
b43a08ea0bbd74b5417a9777ed2294707aa22f47e9df5c1b93497db857a86b7e | Python | 4,228 | 140 | import torch
import torch.nn as nn
from .util import Conv2d
class LinearWithConstraint(nn.Linear):
def __init__(self, *args, max_norm: float = 1.0, **kwargs):
self.max_norm = max_norm
super(LinearWithConstraint, self).__init__(*args, **kwargs)
def forward(self, x):
self.weight.data =... |
15567b15f7269791a07326b7ed6cc0cc58a030ea74208991a5375251cbc183c2 | Python | 4,230 | 112 | import os.path as osp
import numpy as np
from tqdm import tqdm
import torch
import pickle
from torch_geometric.data import InMemoryDataset, download_url
import pyscf
from pyscf import dft
import apsw
import os
BOHR2ANG = 1.8897259886
class GenerateQH9Stable(InMemoryDataset):
def __init__(self, root='dataset/', d... |
a682f8d0521e9d9a01cac635f36013228b77a1f00c5ca76c5fa16fd3506856e6 | Python | 4,231 | 107 | # Copyright (c) <2021> <University of Paderborn>
# Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/
# https://github.com/SSTGroup/independent_vector_analysis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated d... |
d4914b7006fde9f474678e818f91030d408e85f8f1fe5f8eceac0aa2998faa1c | Python | 4,232 | 77 | # *=========================================================================
# *
# * Copyright Erasmus MC Rotterdam and contributors
# *
# * Licensed under the GNU GENERAL PUBLIC LICENSE Version 3;
# * you may not use this file except in compliance with the License.
# *
# * Unless required by applicable law or agre... |
e4a8ac8cc227a2857a29a8049daaa302ea353a5bf36e61989e26e9033631799d | Python | 4,234 | 116 | """Load agent."""
import contextlib
from collections.abc import Sequence
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import BaseCallbackManager
from langchain_core.language_models import BaseLanguageModel
from langchain_core.tools import BaseTool
from langchain_cla... |
f77aafbabb5938d65971f834c0cafbe17bf2e83026cb8cd0ce2269e04f23a95e | Python | 4,237 | 119 | import pytest
import torch
from chroma.layers.structure.geometry import rotations_from_quaternions
from chroma.layers.structure.transforms import (
average_transforms,
collect_neighbor_transforms,
compose_inner_transforms,
compose_transforms,
compose_translation,
equilibrate_transforms,
fus... |
2ac9dbdc6c9a9d8797e73cd3172705662778f4cf8f9ebbb4936261c710e146e6 | Python | 4,242 | 90 | """
Compute parameter values of the noisy delta rule model at the subject-level
using analytical formulae, and plot the distribution of parameters across subjects.
This is used to determine sensible parameter values to use for simulations
of the noisy delta rule model in subsequent analyses.
"""
import data_analysis_... |
3c8c7e7a47c949389ac2888a16a0ea85ae92eae81ee2fa5f16cc50e5c3bd2bd3 | Python | 4,242 | 135 | from collections import OrderedDict
from typing import Optional
from typing import Tuple
from typing import Union
import torch
from torch import nn
class Flatten(nn.Module):
"""
Helper module for flattening input tensor to 1-D for the use in Linear modules
"""
def forward(self, x: torch.Tensor) -> ... |
dfce18dfcabb406cdc2b3cf1f32ba618e3959161d738f436355f9d54c2d2abca | Python | 4,243 | 140 | import torch
import numpy as np
class EMA():
def __init__(self, beta):
super().__init__()
self.beta = beta
def update_model_average(self, ma_model, current_model):
for current_params, ma_params in zip(current_model.parameters(), ma_model.parameters()):
old_weight, up_weigh... |
55d843aa8c30e2b5d8f2bb178afb7d43d7ace7982fedfd107df254006259007c | Python | 4,244 | 151 | # pylint: skip-file
"""
This script is simply a modified version of an example described in
https://group-lasso.readthedocs.io/en/latest/.
The original script can be found here:
https://github.com/yngvem/group-lasso/blob/master/examples/example_group_lasso.py
Notice that there are various extra plots included in the... |
8cddf92bc69eada663a264244f4e74cac4b2326d89304d110faf3fadfb7697a1 | Python | 4,246 | 120 | """Create a key-value store for any langchain serializable object."""
from collections.abc import Callable
from typing import Any
from langchain_core.documents import Document
from langchain_core.load import Serializable, dumps, loads
from langchain_core.stores import BaseStore, ByteStore
from langchain_classic.stor... |
4c3848a69a1968a918ce8700950dc4173533f74945ebebbe6153e1423d82e130 | Python | 4,247 | 137 | # !/usr/bin/env python
"""
Script to convert mmCIF files to PDB format.
usage: python cif2pdb.py ciffile [pdbfile]
Requires python BioPython (`pip install biopython`). It should work with recent version of python 2 or 3.
@author Spencer Bliven <spencer.bliven@gmail.com>
"""
import os
import sys
import argparse
import l... |
1a54b29a358f38be8249e7cfe0b0dc57cc3dcbe35e74cb85ab84d565a9afdd4d | Python | 4,249 | 103 | import gc
import os
import numpy as np
import pandas as pd
from keras import backend as K
import keras
import random
import tensorflow as tf
from keras.models import Sequential,load_model
from keras.layers import Dense, Dropout, Activation, Conv1D, Input
from keras import regularizers
from scipy.stats import pearsonr
... |
6022bbf0f61bb3b4d55d85f059ed96aeea1ca540f6629b2357ecd7d8949ec0ca | Python | 4,249 | 136 | import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
from ..plotting.saturation_model import SaturationModel
epsilon = 10e-10
def softmax_max(xs, a=1):
"""
Computes softmax of an array
"""
xs = np.array(xs)
e_ax = np.exp(a * xs)
return (xs * (e_ax.T / np.sum(e_ax, axis=... |
a30ffde00a2a75c01989e165a633bbe65f997270705f39d3321aeaaee5eff20c | Python | 4,249 | 112 | """Derivations of standard content blocks from provider content.
`AIMessage` will first attempt to use a provider-specific translator if
`model_provider` is set in `response_metadata` on the message. Consequently, each
provider translator must handle all possible content response types from the provider,
including tex... |
c11a7e942bd7bad9c8e85acbcf7471675c847f9edbae21202686dc4636ae6f28 | Python | 4,249 | 140 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Author: Yulia Rubanova
###########################
# Create a synthetic dataset
from __future__ import absolute_import, division
from __future__ import print_function
import os
import matplotlib
if os.path.exists("/Users/yulia"):
matplotl... |
dda6947c44739f853c66bf2c20186c73a64225092d5c2f22acbd82348b4f7fcb | Python | 4,249 | 99 | import numpy as np
import gym
from stable_baselines3 import PPO
import torch
from stable_baselines3 import A2C, PPO
from stable_baselines3.common.torch_layers import BaseFeaturesExtractor
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
import pickle
from stable_baselines3.common.utils... |
3e9b0f57e10405fb9aa5ac638f3b9ef7c176bb50c53b231d0edd958a72af7998 | Python | 4,250 | 96 | """ Definition of the Vector Quantized Variational Autoencoder.
Based on:
https://github.com/rosinality/vq-vae-2-pytorch
https://github.com/ritheshkumar95/pytorch-vqvae
https://colab.research.google.com/github/zalandoresearch/pytorch-vq-vae/blob/master/vq-vae.ipynb#scrollTo=kgobZjvvGs3q
https://github.com/rll/deepul/b... |
b8b776bee350becc6b4f39321e3ad575f8e88942174c69d35c0e6d62fcbfbfe1 | Python | 4,254 | 119 | # 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"
#... |
9809fd025ecd19ecbd3fee364aad2f30242013ed1e0b041e34e3788da83f09dd | Python | 4,260 | 125 | # Loading in Stanford Cars Dataset data
import scipy.io
import numpy as np
from os import listdir
from os.path import isfile, join
from PIL import Image
# Paths to files, change if necessary
TEST_LABELS_PATH = '../../data/data_cars/cars_test_annos_labels.mat'
TRAIN_LABELS_PATH = '../../data/data_cars/cars_train_annos... |
042e873f5ec60a1d80ca1170081ca232b510e3925e3f3da67e87247b95c9063c | Python | 4,261 | 57 | """fig06: predicted vs true SOH for the anchored GBDT under P3 (left) and P4 (right), hexbin density with per-dataset marginal error.
fig14: error vs training cost Pareto (P4 MAPE vs seconds per fit) for all backbones."""
from __future__ import annotations
import os, sys
import numpy as np, pandas as pd, matplotlib.pyp... |
5e1cf2fbd481ff971fefa18cc0b40938d49b08f550c51fe8bf2f36500cd50a86 | Python | 4,264 | 127 | # 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... |
10779c030d2a3ebe045c3c71e1d8b8520fab3128781a652ba205a80425b781a1 | Python | 4,266 | 128 | import os
import pickle
import pandas as pd
import networkx as nx
import numpy as np
from fuzzywuzzy import fuzz
import torch
import torch_geometric
from src import constants
from src import model
from src import utils
from src import data_loader
def path_to_data(path):
x = path
steps = [node[0] for nod... |
55483d9ec7b5eb1efd30cf98ad41a4c2058524e79eefcd38eea2a4d994f5c7d3 | Python | 4,266 | 113 | # Copyright 2019 DeepMind Technologies Limited. All Rights Reserved.
#
# 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... |
29857e460c74524150ff95a31995eae7a6233156d7bddde8226e879f2ac9dc38 | Python | 4,270 | 118 | """
This script summarized DE results using mash model.
"""
import session_info
import pandas as pd
from pyhere import here
from functools import lru_cache
@lru_cache()
def get_mash_eqtl(feature, tissue, fdr):
# lfsr < 0.05 for significant eQTL by features
df = pd.read_csv(f"../../{feature}/_m/lfsr.sex_interac... |
523718a060aa8f4656fbeb1b4d99802fb332dea49e0a231fa2c16d2f78b19e32 | Python | 4,270 | 128 | import os
import argparse
from tqdm.std import trange
def run(hhb, input, tg, tg_hhm, tmp_folder, db):
"""
Using HHblits to search against Uniclust2018 database, to generate .a3m and .hhm files
parameters:
:param hhb: path of the hhblits
:param input: input .fasta file containing... |
2e7f1736d08b9347faac6ab4be6abe25836d94f4525b40e7eb206aebabb858bf | Python | 4,272 | 105 | r""""Contains definitions of the methods used by the _BaseDataLoaderIter workers to
collate samples fetched from dataset into Tensor(s).
These **needs** to be in global scope since Py2 doesn't support serializing
static methods.
"""
import torch
import re
import collections.abc as container_abcs
# from datasets.crea... |
b752c9decf829b380faf5a352666918ef6c338d8dff092f87f081a612b8faea6 | Python | 4,272 | 117 | # 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... |
087d43bb9303677c3da4c32a0fbb35f7eaefcde8a14ba13312efc478db76525f | Python | 4,273 | 86 | import os
from evaluation.load import get_dictionary, get_test, get_colors, get_data
from evaluation.plots import *
from utils.utils import viz_cam
from data.load import load_dataset
import argparse
def run(data_path, result_path, color_path):
print(data_path, result_path, color_path)
result_paths = [ { 'name'... |
2e3836811337a0dd7b18620e43865f90bd37d92e4df3c5a0704dfabfae3772ae | Python | 4,274 | 111 | #!/usr/bin/env python3
# coding: utf-8
"""
Hemisphere analysis for run_level_1_analysis.py parallel processing
Greg Conan: gconan@umn.edu
Created: 2021-01-29
Updated: 2021-09-20
"""
# Import standard libraries
from glob import glob
import os
import shutil
import subprocess
import sys
def find_local_imports(flg):
... |
de5729d62f24adf3546abe1bb808c0b826a98ccdc68736aa9c5a9665627a7f06 | Python | 4,274 | 140 | """User-facing API tests beyond the per-model fit smoke tests.
Fits one small hierarchical model and exercises everything the user touches
*after* the fit returns: result properties, plotting dispatch, diagnostics,
information criteria, HDI helpers.
"""
import matplotlib
matplotlib.use("Agg") # headless
import matp... |
db184ca0d18ff992253c9c431935d2ad5796a00edd14d8542456ec7b3f60fce4 | Python | 4,275 | 105 | # 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... |
ea471a1b20aebf6f69f8e0777b03b2c2fa0702beee88a87a20fda3168ef65bbc | Python | 4,275 | 135 | ## code from: https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch
import torchvision
# __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
# 'resnet152', 'ResNet34P','ResNet50S',... |
5cc78a3ad61dce9fbcfce69b3cdf9813a459f4fd9bdf7fdaf6d4cb9ec307891c | Python | 4,277 | 124 | """Callback Handler that tracks `AIMessage.usage_metadata`."""
import threading
from collections.abc import Generator
from contextlib import contextmanager
from contextvars import ContextVar
from typing import Any
from typing_extensions import override
from langchain_core.callbacks import BaseCallbackHandler
from la... |
f993a10fb6abdaa2d8ff15017e381530b430e416fdc0881386d58171d2292a1b | Python | 4,277 | 120 | """
This script examines the Spearman correlation of effect sizes
between brain regions.
"""
import session_info
import pandas as pd
from pyhere import here
from functools import lru_cache
from scipy.stats import spearmanr
from scipy.stats import fisher_exact
from rpy2.robjects import r, globalenv, pandas2ri
@lru_cach... |
d60fa9cd26fc6991efb7f8407cc6e3b8d3647d506ad142d1edcc6a50fbc91864 | Python | 4,278 | 145 | '''
Author: Zhenyu Yuan
Email: zhenyuyuan@outlook.com
Brief: some utility functions for sequence super resolution model training
'''
import os
import numpy as np
from scipy import interpolate
from matplotlib import pyplot as plt
from scipy import signal
import h5py
import pickle
import pandas as pd
class... |
4045cd34e8e367340e414a27130df3517e4b7c2f48fbc3713cff1ad8658ab6a0 | Python | 4,282 | 136 | #!/usr/bin/env python3
# Author: Francois Aguet
import numpy as np
import pandas as pd
import scipy.stats as stats
import warnings
def normalize_quantiles(df):
"""
Quantile normalization to the average empirical distribution
Note: replicates behavior of R function normalize.quantiles from library("preproce... |
762e321e83300c998e98fb632378df307237d5fd5d0ad9433cb371391025d932 | Python | 4,282 | 118 | import torch
""" accuracy eval fns """
label_coarse = {0:0,1:0,2:0, 3:1,4:1, 5:2,6:2, 7:3,8:3, 9:4,10:4,11:4,12:4,13:4, 14:5,15:5,16:5, 17:6,18:7, 19:8}
label_res_single_dict_coarse= {0:'(+)', 1:'(-)', 2: 'ST', 3: 'NQ', 4: 'SH', 5:'LH', 6:'P', 7:'G', 8:'C'}
label_polar = {0:0, 1:0,2:0,3:0,4:0,5:0,6:0, 7:0... |
494e562a2b58b5490b9a94545ac61f9e734c08a4f6b329c89a2651fe357ec7af | Python | 4,284 | 133 | """
Tools for managing datafiles in perses
"""
import logging
__author__ = 'John D. Chodera'
def get_data_filename(relative_path):
"""get the full path to one of the reference files shipped for testing
in the source distribution, these files are in ``perses/data/*/``,
but on installation, they're mov... |
5af9629cbfbf5445e312f94cb5018e29f0978539348b10ab8b863ad194098bcd | Python | 4,284 | 106 | # 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... |
f076a6eb8a94af13115cd34b81fd09c87cc90dfb6609284b667f6d763ccc2c6e | Python | 4,285 | 114 | import rdkit
import rdkit.Chem as Chem
import numpy as np
elem_list = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'As', 'Al', 'I', 'B', 'V', 'K', 'Tl', 'Yb', 'Sb', 'Sn', 'Ag', 'Pd', 'Co', 'Se', 'Ti', 'Zn', 'H', 'Li', 'Ge', 'Cu', 'Au', 'Ni', 'Cd', 'In', 'Mn', 'Zr', 'Cr', 'Pt', 'Hg', 'Pb', '... |
b5ffee213c5877ec8a7ac0c8790233b7929ce95093f489038f398d79d81e47ba | Python | 4,288 | 112 | # 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... |
e3d071bd9c52f66ce169f09323015beb82ee83d01b802a281d2235bbf0b86837 | Python | 4,288 | 128 | # built in modules
import os
import shutil
import subprocess
from random import choice
from string import ascii_letters
# third party modules
import numpy as np
# pnabind modules
from .strip_hydrogens import stripHydrogens
from .structure import StructureData
def loadPQR(pqrFile, structure_name=None, add_charge_radi... |
e75aa86f75e3ab7d38899236b9651ef707a5f2109598c14f2711f0b37a3161dc | Python | 4,288 | 120 | """Test phase-difference type of fieldmaps."""
import pytest
from niworkflows.interfaces.bids import DerivativesDataSink
from nipype.pipeline import engine as pe
from ..phdiff import init_phdiff_wf, Workflow
@pytest.mark.parametrize('dataset', [
'ds001600',
'testdata',
])
def test_phdiff(bids_layouts, tmpdir... |
9c4b4673d2e30376704245cf9e2f62f07484898ed804b7479139157ca6b55169 | Python | 4,290 | 116 | # Training procedure for LeNet-5 CIFAR-10.
#Code base from https://github.com/BIGBALLON/cifar-10-cnn/blob/master/1_Lecun_Network/LeNet_dp_da_wd_keras.py
import keras
import numpy as np
from keras import optimizers
from keras.datasets import cifar10
from keras.models import Sequential
from keras.layers import Conv2D, ... |
b4e09d25d9435ad943fb5f00f569df13f0bb55d1b371cb2b26c1f8cf12f498be | Python | 4,290 | 127 | import numpy as numx
import model as MODEL
import pydeep.rbm.trainer as TRAINER
import pydeep.rbm.estimator as ESTIMATOR
import pydeep.misc.visualization as STATISTICS
import pydeep.misc.io as IO
import pydeep.misc.visualization as VISUALIZATION
import pydeep.misc.preprocessing as PREPROCESSING
import pydeep.misc.nump... |
1efdbe8a4c8f1798ebf820a9acada4783e02488624334266c28dbec829f5f317 | Python | 4,297 | 113 | import argparse
import numpy as np
# My own functions
from pensa.features import \
read_structure_features
from pensa.clusters import \
obtain_combined_clusters, \
write_cluster_traj, \
wss_over_number_of_combined_clusters
# -------------#
# --- MAIN --- #
# -------------#
if __name__ == "__main__":... |
0e2e0f8ecb89a4971271dbae964ceea579f67df29271b6e4e8047808b7b554c8 | Python | 4,304 | 132 | """ Metrics. """
import mdtraj as md
import numpy as np
from analysis import utils as au
from data import utils as du
from openfold.np import residue_constants
from openfold.np.relax import amber_minimize
import tree
from tmtools import tm_align
CA_IDX = residue_constants.atom_order['CA']
INTER_VIOLATION_METRICS = [
... |
1d7eba2a8f0f72c3be2e8ca22d877d3d61720d67323aa335b25d2764f376346f | Python | 4,304 | 124 | ''' Example using GB-RBMs on the MNIST handwritten digit database.
:Version:
3.0
:Date
15.07.2014
:Author:
Jan Melchior
:Contact:
pydeep@gmail.com
:License:
Copyright (C) 2014 Jan Melchior
This program is fre... |
27ab5aba7f14226509b28fcf5ca8edb85756113df931540477a3067282df2abe | Python | 4,306 | 107 | from typing import List, Tuple
import torch
import torch.optim as optim
from bisect import bisect
from scdp.common.utils import scatter
def get_probe_chunks(
n_probes: torch.Tensor, max_n_probe_per_pass: int
) -> Tuple[int, List[torch.Tensor], List[torch.Tensor]]:
"""
Split a batched probe grid into pas... |
b4bc5dc9a0853a5af0c3e1122aa32fdd88322fc7217fc83894b67e01f573b2ba | Python | 4,307 | 142 | import os
import tempfile
import pytest
from qupkake.cli import (
check_output_file,
embed_molecule,
main_file,
main_smiles,
)
from rdkit import Chem
@pytest.fixture
def mock_args():
class MockArgs:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
return MockArg... |
d1a34e3e37e9febe6b95028c81f446befa319c771e2cdb73ace2cd3ba0e5f34a | Python | 4,308 | 117 | import pandas
import tqdm
import json
import os
from src import constants
from src import utils
def load_tsv(path, req_published=False, req_not_deleted=False, req_error_free=False):
df = pandas.read_csv(path, sep='\t', header=None, names=["wf_id", "wf_updated", "in_id", "in_tool", "in_tool_v", "out_id", "out_tool... |
5d4dfa241874d238163f91411ece84f1591379762bdacc207647b2ac522fcaab | Python | 4,310 | 111 | # 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 ... |
cafa5808c6158bf673a7e35ea17f53a26a4facd6fed10832a08ee4cd3f5358ec | Python | 4,311 | 165 | import os
import time
import random
import logging
from typing import OrderedDict
import torch
import torch.linalg
import numpy as np
import yaml
import json
from easydict import EasyDict
from glob import glob
class BlackHole(object):
def __setattr__(self, name, value):
pass
def __call__(self, *args,... |
29ca82cae15d21cf504e96cf0de15e591c00785622962bf3643d66e1eb1d2da1 | Python | 4,315 | 148 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Authors: Yulia Rubanova and Ricky Chen
###########################
import os
import numpy as np
import torch
from lib.utils import get_dict_template
import lib.utils as utils
from torchvision.datasets.utils import download_url
class Hoppe... |
db4edbdb240f9a7e3c35fc6eab5dd5024c15e3a4efa8155295fdb30489a34b75 | Python | 4,317 | 120 | """Configuration for unit tests."""
from collections.abc import Iterator, Sequence
from importlib import util
from uuid import UUID
import pytest
from blockbuster import BlockBuster, blockbuster_ctx
from pytest_mock import MockerFixture
@pytest.fixture(autouse=True)
def blockbuster() -> Iterator[BlockBuster]:
w... |
55aee7acea02b1b9e63baf6a0a786b43b130af08445aaa657b53aebcc323c196 | Python | 4,318 | 125 | # licensed under the MIT License
# http://opensource.org/licenses/mit-license.php
import operator
class IntervalTree(object):
__slots__ = ('intervals', 'left', 'right', 'center')
def __init__(self, intervals, depth=16, minbucket=16, _extent=None, maxbucket=512):
"""\
`intervals` a list of in... |
2c2002b7773a509e576f6471bed327d095b26b0cfc130dc95d359f6a438a8045 | Python | 4,319 | 91 | """Full DeepMapper CNN + integrated-gradients run on mouse naive vs TEM CD4
(Elyahu SCP490). Shows whether unbiased attribution over the full unfiltered
gene set recovers the ribosomal module de novo, the cross-species method claim.
Phase 0 smoke: python bench/mouse_dm_run.py --per-class 800 --passes 1 --epochs 60
Ph... |
a2a26ba5c7461d73a8dd2565c50c274cfc33d777d40c3fe05e3f3cce5da586b2 | Python | 4,320 | 108 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 6 21:44:54 2021
@author: athanasiadis
"""
import numpy as np
def computer(subsamplings,att_res):
"""
computer
______________________
This is a function that averages over all patterns within a cluster.
Then it combin... |
71be2fbf1f52ab8b05c5a904bba11f23be1b894a9507d79987eb2f9de4fdc2e3 | Python | 4,323 | 149 | ####################################################################################
#
# 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... |
c8cf171d70bbb75fc18567ebe67fe08cb7aedb04df53f78a4906f69b684fcfec | Python | 4,324 | 149 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
31ecc85da50f0d557f695e13129c84513abeaddc7a8fe571062fb5d8d3a1aea6 | Python | 4,325 | 115 | """
Author: Benny
Date: Nov 2019
"""
from data_utils.ModelNetDataLoader import ModelNetDataLoader
import argparse
import numpy as np
import os
import torch
import logging
from tqdm import tqdm
import sys
import importlib
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = BASE_DIR
sys.path.append(os.path.... |
9a8bfa16479bdd3bf69d156f8ebc4b03bf4c7eff9bf0e5a147cb2948cbb17bd7 | Python | 4,327 | 102 |
from .context import parsers as p
from .context import classic
import unittest, os, subprocess
HERE = os.path.dirname(__file__)
in_vcf = os.path.join(HERE, "data/example.vcf")
in_bam = os.path.join(HERE, "data/NA12878.target_loci.sorted.bam")
lib_info_json = os.path.join(HERE, "data/NA12878.bam.json")
out_vcf = os.pa... |
922b0a74a2682613c5dceae8d2b73f463cbc47532aa7f957441a423f9067b1da | Python | 4,328 | 80 | """Major-5 benchmark: does the LEARNED exhaustion chord add value over a standard multi-marker exhaustion
SCORE (and over the best single marker)? TIL-vs-blood CD8, patient/sample held out, both cohorts.
Three readouts on the same 8 canonical exhaustion genes:
best_single, best single-gene AUC (the single-marker bas... |
56b3d751003586808dd20ec521998b889039b7706942eb7d95f70b59f33fb0e5 | Python | 4,330 | 101 | import numpy as np
import scipy as sp
import scipy.stats
import scipy.spatial
import scipy.spatial.distance
import pyemma
from pyemma.util.contexts import settings
import MDAnalysis as mda
import matplotlib.pyplot as plt
import os
from pensa.features import *
def relative_entropy_analysis(features_a, features_b, all... |
9da6f0555cb568c1575c4454a62f872c1e309c84dd767549cca5d6633c8b4e57 | Python | 4,330 | 120 | """
This file can be used to configure the project. The different
attributes of the "Settings" class can be accessed as follows:
from fidnet import config.
A typical use case for this file is to keep track of paths
to different files in the project.
This is using pydantic-settings. In order to read more about how
to... |
e38d0385053b5848175d294653e825efc2b8ae1f3220d3ff2c19695c228735e4 | Python | 4,332 | 132 | import pydeep.misc.visualization as VIS
import pydeep.misc.io as IO
import pydeep.base.numpyextension as npExt
from pydeep.dbm.unit_layer import *
from pydeep.dbm.weight_layer import *
from pydeep.dbm.model import *
# Set the same seed value for all algorithms
numx.random.seed(42)
# Load Data
train_data = IO.load_mni... |
de904765abc6f982291b103973ef8de90ad173925ec240f6231dbe610e15ce17 | Python | 4,336 | 99 | # 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... |
e1073188c84530ef42494f09ed76acf2e7eaa523ad3eda9ecd461a0a8ddcefd7 | Python | 4,336 | 83 | # Sconda conda activate abc; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/gene_expression_class_concordance; python
# python expression_threshold_per_celltype.py
import pandas as pd
import numpy as np
import os
# Function to TPM normalize the gene counts
def tpm_normalize(df):
... |
225d732ae17820187875b14c41ed8e2c85ba2e7fe15beb4f3e5e76d14cf0f073 | Python | 4,337 | 134 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import nibabel as nib
import numpy as np
import os
import pylab as plt
DESCRIPTION = 'Removal of Rician Bias with simple method of moments. Cornelius Eichner 2020'
def buildArgsParser():
p = argparse.ArgumentParser(description=DESCRIPTION)
p.... |
ca21e475a742665f0eaf7aea5e03f624667dccd2ac9607c4e961a95dd1068fcf | Python | 4,342 | 121 | """ Example for sparse Autoencoder (SAE) on natural image patches.
:Version:
1.0.0
:Date:
25.01.2018
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
:License:
Copyright (C) 2018 Jan Melchior
This file is part of the Python library PyDeep.
... |
ce5edd301c65d32c4f674f50428e13f4875a5c01dcad67c013627451ecb2ed32 | Python | 4,342 | 97 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class Diagonal(nn.Module):
def __init__(self, units, input_shape, activation=None, use_bias=True,
kernel_initializer='glorot_uniform', bias_initializer='zeros'):
super(Diagonal, self).__init__()
... |
1aa9789015070943e984a4ada2c246606d6505dd8de8b1c27dc6f80f8112bb0c | Python | 4,343 | 141 | import logging
import pymysql
from sqlalchemy import Column, Integer, String, Float, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import datetime
class Logger:
_instance = None
def __new__(cls):
... |
6f2f3ab984c8f2bf7d1660043ce899409c5b78cefd8b0c6235744811fb77f7ca | Python | 4,343 | 105 | from __future__ import annotations
import io
import os
from typing import Any
class _FileIOMixin:
"""
Adds ``save`` and ``load`` methods that dispatch to the readers and writers registered in
``pgmpy.readwrite.FORMATS``.
A format is available to a model class if the format's writer lists the class (... |
69055f478535cc2a708521d6e7a0ec44556e93d3f53981e117a70a354ac0be2b | Python | 4,344 | 126 | # modified from Pytorch official resnet.py
# from CLAM implementation: https://github.com/mahmoodlab/CLAM
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch
import torch.nn.functional as F
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_url... |
d3b5b94bba9c5331f4c16a02752415012f230b1a5aeef7f1b3d9fd6bf7176925 | Python | 4,344 | 136 | import json
import numpy as np
import openmm
import pytest
from openff.units.openmm import to_openmm
from openmm import unit as openmm_unit
from openff.toolkit._tests.utils import get_data_file_path, requires_rdkit
from openff.toolkit.topology import Molecule, Topology
from openff.toolkit.typing.engines.smirnoff impo... |
b9c6c47b638e15538e7984ebfa7c3828da761f0f9103a04c2140dc32344df680 | Python | 4,347 | 136 | """
Parse Chemical Checker datasets
download link: https://chemicalchecker.org/downloads/root
version: NA
"""
import h5py
import pathlib
import numpy as np
import pandas as pd
import itertools as itr
import DrugComb_DataParser as DrugCombParser
from torch.utils.data import Dataset, DataLoader
class ChemicalCheckerD... |
6d20cd960478906b54939f6369275f15a0a6985f109113b450b664db30138343 | Python | 4,349 | 132 | """
This script summarized DE results.
"""
import numpy as np
import pandas as pd
import session_info
from pyhere import here
from functools import lru_cache
@lru_cache()
def get_annotation(feature, tissue):
"""
Get the annotation file based on feature and tissue.
"""
feat_lt = {"genes": "gene", "trans... |
069a5060ef47f4f5259580ae706b8dd7c3b573857b0d5822d118e8d894836582 | Python | 4,350 | 124 | import logging
import os
import numpy as np
import pandas as pd
from helpers.data import normalize_array
def load_rockland_data(data_file: str, verbose: bool = True) -> (np.array, np.array):
"""
Load Rockland BOLD time series from .csv file.
:param data_file:
:param verbose:
:return:
"""
... |
aa2180f5da10fd153de905e241593ab9a03ccc3c1c8e4550a735d0e4333bd4e6 | Python | 4,353 | 97 | import torch
class GaussianSmearing(torch.nn.Module):
def __init__(
self,
start: float = -5.0,
stop: float = 5.0,
num_gaussians: int = 50,
basis_width_scalar: float = 1.0,
) -> None:
super().__init__()
self.num_output = num_gaussians
... |
ec50ecdd3624d9158dbbe4fe0055988d4202452e63e89502834d379042409a29 | Python | 4,355 | 114 | # Analysis of validation data
# Copyright (c) 2021 Laurent Caplette
import os, csv, re
import numpy as np
np.random.seed()
homedir = '' ### path of home directory
os.chdir(homedir+'/final_validation_results')
pattern = '[0-9]{1,3}_DNN.+csv'
resfiles = []
for file in os.listdir():
match = re.fullmatch(pattern,f... |
a96d5d220dc882e58077afb270dc654f10c36e5ba34487c549e1b09904569e67 | Python | 4,357 | 117 | # Copyright 2022 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... |
40e25002d1a5cb1a4266d92ffb5d629456b9a0f53409376c49a2a58607fc512f | Python | 4,359 | 114 | """
Functions to generate plots to analyse the antennae cutting experiments.
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 pickle
from tqdm import tqdm
from... |
9aaa167a6358d4ef4b27343efeebbe94193ec8e7569f428846ab6784a061c166 | Python | 4,361 | 166 | ### Toy example to test LocanConnection1D (the dataset used is MNIST but each image is raveled (each sample has shape (784,)).
import torch
from torch.nn.modules.utils import _pair
from tqdm import tqdm
import os
from bindsnet.network.monitors import Monitor
import torch
from torchvision import transforms
from tqdm ... |
3010b12236fff2852b224b0831e981c7f6c2061282a9f2594f478a96a92cbf43 | Python | 4,363 | 218 | import mne
import yaml
bad_ABR_channels_dict = {
'p01': ['T8', 'PO4', 'O2', 'F4', 'FC1', 'AF4'],
'p02': ['T7'],
'p03': ['AF4', 'Oz', 'F4', 'PO4'],
'p04': [],
'p05': [],
'p06': [],
'p07': ['FC2'],
'p08': ['F3'],
'p09': [],
'p10': ['Fp2'],
'p11': [],
'p12': ['CP5', 'PO4', ... |
6c9e1b10afe4517fbed085f4af3719d3acf08f2982fa4a24b8f93f05aae87734 | Python | 4,365 | 117 | def test_PointMutationExecutor():
"""
Check that a PointMutationExecutor can be instantiated properly for ALA->ASP dipeptide in solvent and that a
HybridTopologyFactory object can be generated.
Also check that counterions are added.
"""
from pkg_resources import resource_filename
from simtk... |
39956540c37ac96f4e3ecf5ef40f7fb81e96e529833c43ecf73727a34fec3349 | Python | 4,367 | 106 | import logging
import os
import socket
import sys
from fcest.models.mgarch import MGARCH
import pandas as pd
from configs.configs import get_config_dict
from helpers.evaluation import leave_every_other_out_split
from helpers.hcp import get_human_connectome_project_subjects, load_human_connectome_project_data
if __n... |
3e6d3bd81e5f82c9d4b81198e4264cddae12dbafa2550e317a02bdfe91d158cc | Python | 4,370 | 75 | #!/usr/bin/env python
import sys
import os
import argparse
import tempfile
from .binary import BinaryAnnotations, ContinuousAnnotations
from .annotations import Annotations
from ..constants.constants import HUMAN_SOMATIC_CHROMOSOMES
from ..model.ld import LDScores
from ..model.plink import Plink
from ..utilities.util... |
cebc93b8ac20f566d883478bf8a26b6f6617f921d55c49d1acecad454103381f | Python | 4,370 | 121 | # 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... |
0cf293fe4d15ce641c2b0f57a9f16b1b963d84cf860fa03b4c3380e998eac696 | Python | 4,372 | 159 | import pandas as pd
import numpy as np
import sqlite3
from cgatReport.Tracker import SingleTableTrackerRows
from cgatReport.Tracker import SingleTableTrackerHistogram
from cgatReport.Tracker import *
from cgatReport.Utils import PARAMS as P
from IsoformReport import *
################################################... |
27d5134366319470be734eb5bafbf89c84205b8c5ea0c9cc906db0ffe3ff0310 | Python | 4,372 | 135 | import pandas as pd
import os
import matplotlib.pyplot as plt
import numpy as np
from loaddata import load_nodes_and_edges
import plot_params
from draw_meta_network import load_communities
from graph_plot_utils import make_nice_spines
def get_synapses_in_brain_neuropil(edges, communities):
"""
Get the number... |
abd6d84e4bc920a60d22033a789592b7ead11fd44b7afeab739c613f81acf46a | Python | 4,375 | 119 | # main file for 3D Reconstruction GAN
# Created: 10/7/2021
# Status: ok
# CUBLAS_WORKSPACE_CONFIG=:4096:8 python rcgan_main.py
import sys
import torch
import wandb
import numpy as np
from networks import RCGAN_Wrapper
from networks import CNN_Wrapper
from utils import read_json
from tabulate import tabulate
from mak... |
d876c7162b06154a40437a1b4714891563c8e22ad57559fadc405ab93729aab3 | Python | 4,377 | 120 | import numpy as np
import matplotlib.pyplot as plt
from distutils.spawn import find_executable
from dival.measure import PSNR, SSIM
from dival.util.plot import plot_images
if find_executable('latex'):
plt.rc('font', family='serif', serif='Computer Modern')
plt.rc('text', usetex=True)
plt.rc('xtick', lab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.