sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fb89a988c5adf4b6fffb73c82e017849bc27d97c7b2cfd2cbf0b314e81716312 | Python | 8,147 | 145 | import pandas as pd
import numpy as np
import argparse
from sklearn.decomposition import PCA
from sklearn.preprocessing import MinMaxScaler
def get_pac(dataset,label_path,data_path,save_path):
pathway_data=pd.read_csv('/apps/home/lulab_liuxiaofan/qhsky/project/multi_omics_paper/reference/pathway_PathCNN.txt',sep='... |
213dc8abb80217b7b6bc3a12f3bd15ddbb3d52ae5bd395ec9c47517d110efa65 | Python | 8,153 | 280 | ####################################################################################
#
# 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... |
6b6bdbec32065d2534058869466a60910920d99a7a3068d53d8267861b9ee367 | Python | 8,155 | 270 | # 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... |
462e2941ceaaa1f32baaf8616ecc06d22b1d3fa271d627ae518a7dda7175a678 | Python | 8,157 | 261 | # Adapted from OpenFold
# 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/l... |
c89da2e14454872a22ffff9388daad9e740e2a0bcd51a20ecda0ffaa469fb83e | Python | 8,158 | 259 | #!/usr/bin/env python3
"""
filter_backbones.py
Filter a metrics CSV (one row per structure) by user-defined thresholds and
copy the corresponding structure files to an output directory.
Typical usage:
python filter_backbones.py \
--metrics metrics.csv \
--pdb-root /path/to/pdbs \
--outdir Passing_Backbo... |
8565303127c7f6ef349f4da2ecdbc7ff9fe110f57717627a3d1985ca1fe59bbd | Python | 8,159 | 293 | # An annotation is a coordinate in a 4D array. Worldlines are lists of
# annotations.
#
# author: vivekv2@gmail.com
import base64
import colorsys
from dataclasses import dataclass, asdict, field
from functools import lru_cache, reduce
import json
from pathlib import Path
import uuid
from typing import Tuple, Optional
... |
449098d92763d17105ca7b5db0bd6fdf6803cffea885f1b44d1780e686828754 | Python | 8,162 | 197 | # 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... |
1c2fd0695e36d2dd435a3a183962f68af7e19dedb1557bf13b449f80c8f0993b | Python | 8,163 | 239 | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import pandas as pd
import sys, os
from mantis_ml.config_class import Config
class Consensus_Gene_Predictions:
def __init__(self, config_file, output_dir, top_ratio, gene_class):
self.config_file = config_file
self.output_dir = output_d... |
0fefadbea85642d570fcee8e50b1de8553279f0c61c3025054288fa6ef2274b3 | Python | 8,167 | 236 | from collections.abc import Sequence
from typing import Any
from langchain_core._api import deprecated
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.callbacks import Callbacks
from langchain_core.language_models import BaseLanguageModel
from langchain_core.prompts.base import BasePromp... |
a7d3bf89776bf4f9794c43bb50a91f38fcc5bc4e37acf50c76858dda59a780b0 | Python | 8,169 | 280 | ####################################################################################
#
# 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... |
08bc92e4cf5ea5fad5b9a03039b7ab3f0cb03c3cac74632257fe3b28d77a4f8c | Python | 8,173 | 201 | # 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... |
e904cd15cc2eb05ac038066587e5d79d11cae4466beb76f8182392db34fe567d | Python | 8,185 | 286 | from enum import Enum
import os
from typing import Dict
import torch
import hienet._keys as KEY
from hienet.nn.activation import ShiftedSoftPlus
HIENET_VERSION = '1.0.0'
_prefix = os.path.abspath(f'{os.path.dirname(__file__)}')
HIENET_0 = f'{_prefix}/../checkpoints/HIENet-V3.pth'
IMPLEMENTED_RADIAL_BASIS = ['bes... |
8429536cef0278f87402d79a15699ee14907723e44a970b3ad90e2d3e3599ffd | Python | 8,187 | 229 | import numpy as np
from voxcell import VoxelData
from os import cpu_count
import sys
from tqdm import tqdm
import flatmap_util as fmutil
import best_line_fit as blf
from trsqrpyr import normalized_volume_r_fun, linear_volume_increase_fun
from lmfit import Parameters, Model
flatmap_nrrd = sys.argv[1]
pixel_res = i... |
9c05900c77e81d9499e6f02a6d62879bb1de1fea51095834897cac2042aba431 | Python | 8,187 | 218 | # *=========================================================================
# *
# * 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... |
f2201bb050e0d73bd230c622039238e592a992106bc6c9431a596a40081b8224 | Python | 8,187 | 224 | import numpy as np
from rdkit import Chem
from eval_follow_jodo.bond_analyze import get_bond_order, geom_predictor, allowed_bonds, allowed_fc_bonds
from eval_follow_jodo.rdkit_metric import eval_rdmol
from rdkit.Geometry import Point3D
import copy
import torch
bond_list = [None, Chem.rdchem.BondType.SINGLE, Chem.rdch... |
c3d586b5df85192e37c92fd480834ed12caa7502ce76d539c6a179c7bcbac342 | Python | 8,190 | 254 | # Copyright (c) 2017-present, Facebook, Inc.
# 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 pickle
import numpy as np
import re
from scipy.ndimage import distance_transform_edt as distance
from skimage i... |
4712853f29651cd9b149b5e6b97b685a0721a19988005a8ba5fcee7206dde1f0 | Python | 8,191 | 168 | import numpy as np
import torch
from rdkit import Chem
from rdkit.Chem.rdchem import Atom
from torch_geometric.data import Data
import torch.nn.functional as F
# from dgl.batch import batch as batch_graphs
# allowable node and edge features
from utils.geometric_graph import ATOM_ENCODER
weight_dict = {'H': '1.01', ... |
862d338c34b305c68774e17ba23b9b03131c0925abc31e15de274588c4eb89c4 | Python | 8,194 | 259 | import os
import tempfile
import subprocess
import numpy as np
class ChainSequence(object):
def __init__(self, chain, full_seq=None):
from Bio.SeqUtils import seq1
self.chain_seq = seq1(''.join([residue.resname for residue in chain]))
self.seq_map = {}
if full_seq:
... |
be6004272569469b0ae31390086333a8ebc66a3215e271b6e30bacd97eb37f15 | Python | 8,196 | 253 | from collections import Counter
from itertools import product
import numpy as np
import pytest
import torch
from torch.nn import functional as F
from chroma.layers.structure.potts import (
GraphPotts,
compute_potts_energy,
fold_symmetry,
sample_potts,
)
def test_graphpotts():
# Testing symmetry
... |
f257c24f5ec58f2c0391f50dfaec1ed588f628d89ebb563040c3e5ad1ed2aa9d | Python | 8,199 | 263 | 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 conv3x3x3(in_planes, out_planes, stride=1):
return nn.Conv3d(in_planes,
out_planes,
kernel_size=3,
... |
3db2c18ae315cb1a7864be9d3a011393bf3c84370bb5d015472786ae2bde13c1 | Python | 8,202 | 212 | import os, sys, re, types, itertools
import Stats
import IndexedGenome
import pipelineTracks
from ChipseqReport import *
from cgatReport.Tracker import *
##################################################################################
#################################################################################... |
6e495d1cdb79a36d4d63b064117dcd6a30308e4e8783eb079bab20673cdd166e | Python | 8,203 | 222 | # this script inference based on trained models
# Mask-RCNN on detectron2:
# the folder structure should be:
# data/test (images)
# pretrained: the pretrained model model_best.pth
# Running:
# module load Detectron2/0.3-fosscuda-2019b-Python-3.7.4-PyTorch-1.6.0
#
import argparse
import os
import random
import shu... |
dc19cd1789e2cdc035126ee52bc6eae416cea4bc241c872bc20bcbbb97b0ec0d | Python | 8,206 | 177 | """
Tests for notification API and asynchronous acquisition API
"""
from pycromanager import multi_d_acquisition_events, Acquisition, AcqNotification
import time
import numpy as np
# Existing tests
def test_async_image_read(launch_mm_headless, setup_data_folder):
events = multi_d_acquisition_events(num_time_point... |
795ba994676bbfb327e34b7c5f6014d94b05284fa66a3287699be4aa581d5355 | Python | 8,211 | 226 | """A tracer that runs evaluators over completed runs."""
from __future__ import annotations
import logging
import threading
import weakref
from concurrent.futures import Future, ThreadPoolExecutor, wait
from typing import TYPE_CHECKING, Any, cast
from uuid import UUID
import langsmith
from langsmith.evaluation.evalu... |
200afc013db87f1fac09547ea129eff43a41c5843667d05584d0f6f34ee9d571 | Python | 8,212 | 202 | import argparse
import time
import math
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
import sys
sys.path.append("../../")
from TCN.word_cnn.utils import *
from TCN.word_cnn.model import *
import pickle
from random import randint
parser = argparse.ArgumentParser(de... |
9dbdea43b0f37e8f95f7fd1212fb5dd797f0c1633b80f12e805e8d1fe8e3de23 | Python | 8,212 | 210 | """
Module for defining and computing different behavioural measures of one subject in one task.
"""
import argparse
import data_analysis_utils as dana
import numpy as np
import pandas as pd
import scipy.stats
import sklearn.linear_model
BMEAS_KEYS = [
"update-freq",
"avg-lr",
"baseline-lr",
"diff-lr-... |
7501f1de10268f1f8a92a3a6e972ee9dbcfdc12fe387afe743b569bf6707306b | Python | 8,213 | 206 | # -*- coding: utf-8 -*-
"""
################################################
MIT License
Copyright (c) 2021 L. C. Lee
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 ... |
9dfa1a716e87ec947bc1e719525377c2e9ed67a900e2b9e4a3fd5dac9bccbe7a | Python | 8,216 | 176 | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from scipy.stats import pearsonr
import sys
from mantis_ml.config_class import Config
feature_imp_classifiers = ['RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBo... |
200869de38158aac115f36c29df5f64fba9316ae10c73abb7f95c3aa9967e101 | Python | 8,218 | 244 | # -*- coding: utf-8 -*-
#
# Test documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 23 15:27:57 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... |
36b63e292714abdd21edfb149bd2fbe153b07eebfeedca63aab0575409e16ced | Python | 8,219 | 245 | from __future__ import annotations
import os
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Sequence
from typing import Tuple
from typing i... |
129c55691e9471a5eeca2e6fa463a2a36e11b144ea048d91be65243aae38075a | Python | 8,220 | 136 | """Controls answering reviewer points, all CPU/sklearn:
(1) ribosomal gene count reconciled to the paper's 186-gene definition; HVG drop recomputed on it.
(2) supervised-after-PCA: does the standard DR (HVG+PCA) preserve memory for a SUPERVISED classifier?
(separates 'genes removed by HVG' from 'signal lost', fo... |
ea648fdbfc1b39a6d7fd83cfce9c7419d717c57252a3a96d05c9ca1c0f12f72e | Python | 8,221 | 240 | """
miscellaneous functions
"""
import torch
import pathlib
import pickle as pkl
#import cupy as cp
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.style as style
import sklearn.feature_extraction as skfet
import sklearn.metrics as skmts
import scipy.stats... |
828ef8d8b13632dc8c7e0965ee5e2fdf8e3a6fa7ee455042dd342c23cefe6ad0 | Python | 8,223 | 216 | from functools import partial
import torch
from torch import nn
from e3nn.nn import BatchNorm, Gate, Dropout
from e3nn.nn.models.v2103.voxel_convolution import LowPassFilter
from e3nn.o3 import Irreps, Linear
from nnunet.network_architecture.neural_network import SegmentationNetwork
from .voxel_convolution import Convo... |
3d8dcd411f679bb49fa0a0b436a565b3559d4b87bd6f5cb5b1ee259e1b050aff | Python | 8,224 | 216 | """Chain that does self-ask with search."""
from __future__ import annotations
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any
from langchain_core._api import deprecated
from langchain_core.language_models import BaseLanguageModel
from langchain_core.prompts import BasePromptTemplate
from ... |
3cae43ab335afad9415fd3ca0f4fa51207fa7d82014be7b790ccc29ed8912ec0 | Python | 8,229 | 273 | """Small utility functions"""
import logging
import os
import pathlib
import platform
import re
import socket
import sys
from datetime import datetime
from typing import Dict, Iterable, List, Optional, Tuple
import depthcharge
import numpy as np
import pandas as pd
import psutil
import torch
from . import __version_... |
f18015778c42b3c29c79585f939ef675ad97714937f93fb2691cb6e10946fd45 | Python | 8,232 | 286 | from pathlib import Path
import lz4, gzip, zlib
import lz4.frame
import lzma
import os
import pickle
import tarfile
import argparse
import multiprocessing as mp
import lmdb
import numpy as np
import torch
from tqdm import tqdm
from scdp.data.data import AtomicData, AtomicNumberTable
def get_atomic_number_table_from... |
9fceca62766776220b39d05bf55cf7a0fcda8497e1ab5bc2eb514a99da722ce1 | Python | 8,234 | 321 | """ Hebb-activation functions.
:Version:
2.0.0
:Date:
04.07.2018
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
:License:
Copyright (C) 2018 Jan Melchior
This program is free software: you can redistribute it and/or modify
it under t... |
c49a8634b0bfa1c422b64353fd2df5218aadc7eb86d4b9b7a4c0087f1ded1202 | Python | 8,237 | 171 | from utils.utils import create_directory
from data.load import load_dataset, load_dataset_kfold
import argparse
import os
import numpy as np
import pandas as pd
import sklearn
from utils.utils import plot_conf_matrix
def fit_classifier_kfold(data_loader, classifier_name, output_directory, apply_gradient=False)... |
2737e7421f2672071b043e6fdd187b9f8798beff8adf5ad0971015243b1cef15 | Python | 8,238 | 289 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch_geometric.nn as gnn
class ConvT(nn.Sequential):
def __init__(
self,
in_chans,
F1=8,
kernel_length=32,
pool_mode="mean",
drop_prob=0.5,
):
super().__init__()
pool_cla... |
e6771ea2836d081a673418ae33894b7d561ea51347a5592ad433bcaadf50a463 | Python | 8,246 | 170 | """
In this file the DSS engine is set up.
The objects for circuit, bus, and branch are also set up for further use in the RL environment.
This file also includes function to modify the base DSS circuit with sectionalizing, tie switch, and generator information.
The translation of DSS Circuit into a graph structure... |
3b5a6d8b41428f5052be5aab6b432164670f76bd36d5fac99beddf11220fa440 | Python | 8,254 | 213 | from typing import Any
import torch
from ptrnets.utils.config import load_state_dict_from_model_name
from ptrnets.zoo.third_party.taskonomy.networks import LIST_OF_TASKS
from ptrnets.zoo.third_party.taskonomy.networks import TaskonomyEncoder
encoders = ["_".join([task, "encoder"]) for task in LIST_OF_TASKS] # name... |
186efd5c6a39c2e400429fde778eadebcae65b2a00bbe32984b83118abb12f64 | Python | 8,268 | 168 | # 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... |
aced5ab810aae9826873ba93ac74e7925e4c6446641820c2fff2054d5054a6b2 | Python | 8,270 | 266 | """Callback handler that writes to a file."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Any, TextIO, cast
from typing_extensions import Self, override
from langchain_core._api import warn_deprecated
from langchain_core.callbacks import BaseCallbackHandler
from lan... |
ea67dec3949a24051cbef3269e4762c772e33d68698e6a1eba94d3730f0cdd4a | Python | 8,276 | 145 | import simtk.openmm as openmm
import simtk.unit as unit
import numpy as np
import os
from openmmtools.constants import kB
from perses.rjmc.geometry import check_dimensionality
from perses.tests.test_geometry_engine import _get_internal_from_omm
###########################################################################... |
b530dc3c542d4023505fc478a339f732942a77956723befa40052a48c9d6678b | Python | 8,283 | 230 | # Code base from https://github.com/transcranial/stochastic-depth/blob/master/cifar10.py
import os
os.environ['KERAS_BACKEND'] = 'tensorflow'
import numpy as np
import tensorflow as tf
from keras.datasets import cifar10
from keras.layers import Dense, Activation, Flatten, Lambda, Convolution2D, AveragePooling2D, Batc... |
442d9f6f585b624ef275572393cb982e6956d9355611342844c4c52172d4139f | Python | 8,289 | 217 | import torch
from torch_geometric.loader import DataLoader
import os
import pickle
from sklearn.model_selection import KFold
import numpy as np
import random
from torch_geometric.nn import global_mean_pool, GATConv
import torch.nn.functional as F
import torch.nn as nn
from torch import optim
import datetime
class GATC... |
734a6fca8ebdd0e3ee911df75a860470b983db2cbab6c9847f7f9a79f8f98607 | Python | 8,296 | 194 | from __future__ import division
from __future__ import print_function
import os
import time
import h5py
import random
import argparse
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from torch_geometric.data import Data
from models import *
def seed_everything(seed):
ra... |
f9aea5842f36cf64fe7ed408fa5db5f60f6ee02e62c54792ff856c54d9dba9e8 | Python | 8,301 | 188 | import logging
import os
import socket
import sys
from fcest.helpers.array_operations import get_all_lower_triangular_indices_tuples
import numpy as np
import pandas as pd
import pingouin
from configs.configs import get_config_dict
# TODO: instead of saving a mean and std/ste csv file, it would be good to save all ... |
6daccf4238271a0b20139af4462e7f957f3fdb56ff30fc7fd0da193899374646 | Python | 8,303 | 220 | ''' Toy example using GB-RBMs on a blind source seperation toy problem.
:Version:
1.0
:Date:
06.06.2016
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
:License:
Copyright (C) 2016 Jan Melchior
This program is free software: you can redistrib... |
e3fdbf7477b9d448fadd18cf4e9b6cc7de1568f9043370369c68c2100abc1ebd | Python | 8,306 | 254 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
if '../../../embeddings' not in sys.path:
sys.path.append('../../../embeddings')
from seq2tensor import s2t
import keras
from keras.models import Sequential, Model
from keras.layers import De... |
eebb3253c32e0d77238267f3b7615b0621f37bdd6715d68cea456216cde950cb | Python | 8,306 | 164 | from langchain_core.prompts.prompt import PromptTemplate
_DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE = """You are an assistant to a human, powered by a large language model trained by OpenAI.
You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth expla... |
2aae7aaf583971a8a64dc0f2e1981b1f014318acf6031fe8175dc3be38adbbc8 | Python | 8,308 | 245 | """
===============================================================================
File: schnet
Date: 6/16/2024
Description: Code is adapted from torch geometric implementation https://github.com/pyg-team/pytorch_geometric/blob/master/torch_geometric/nn/models/schnet.py.
All rights reserved to ... |
09e881d2fc6d4a2c981f113bab0b506d52246a60c18d7a29bf20ae7f80974a2e | Python | 8,310 | 198 | """rigid registration - point-to-point ICP (used by the asymmetry mirror step)
plus the landmark-triangle alignment that's the main registration step.
convention everywhere here: transformed = points @ R.T + t, points as (N, 3).
"""
from __future__ import annotations
from dataclasses import dataclass
import numpy a... |
60eb97c8bd9eaaf5be2bfdcb27a8e9047d881ae99ffef58066f149fce03e3fa9 | Python | 8,312 | 282 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 22 15:03:49 2019
@author: 2624224
"""
import math
import numpy as np
def ray_triangle_intersect(ray_tri):
'''
https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection
input:
r... |
3a661142f5565f1ecda5befa636113ff3df7939d2463759bb29aac3d918c78df | Python | 8,316 | 207 | from typing import Literal
from pgmpy.base import ADMG, DAG
from pgmpy.identification.probability_expression import ProbabilityExpressionTree
class BaseGraphicalIdentification:
"""Base class for identification methods that return annotated graphs.
Graph-returning identification methods inherit `BaseGraphica... |
51d0412e2322e24cf5785dca83b4e4946550746b973dfcc83b8dd00b36d86a4d | Python | 8,321 | 218 | import warnings
import numpy as np
import torch
from torch import nn as nn
from .base import Readout
class FullFactorized2d(Readout):
"""
Factorized fully connected layer. Weights are a sum of outer products between a spatial filter and a feature vector.
"""
def __init__(
self,
in_s... |
77319b21771cdd31f867c245548b5fdae5cc283ce353ff2d3b72e7e13e952f60 | Python | 8,324 | 197 | import os
import functools
import torch_geometric.data.batch
from core.loss import get_loss
from core.loss.utils import merge_loss_dict, loss_dict_remake_wrapper
from core.network import network_register
from core.network.utils import global_mean_pool_with_mask
from utils.my_containers import deep_dict_get
from util... |
85b3ab22584da26c621e003ccbff8e72795358bb38a016d72f5bd95bd6087568 | Python | 8,328 | 182 | import logging
import re
from pathlib import Path
logger = logging.getLogger(__name__)
citations = {
"hori2026rgi": """@article{hori2026rgi,
author = {Hori, Tatsuki and Moriwaki, Yoshitaka and Ishitani, Ryuichiro},
title = {{RGI-Toolkit}: Differentiable Restraints for Controllable Biomolecular Structure Pr... |
3828bde08019cfc31dc37aac8148128ed7a8acaf948133459df594a31ac32a2d | Python | 8,331 | 245 | import json
import random
from typing import Optional, Dict
from pathlib import Path
from tqdm import tqdm
import hydra
import numpy as np
import pytorch_lightning as pl
import torch
from omegaconf import DictConfig
from torch.utils.data import Dataset, Subset
from scdp.common.pyg import DataLoader
from scdp.data.dat... |
157eae7b60aa5d3f6f20018d5b85b2cfb90e8231856c44a08648ba5fcb166235 | Python | 8,332 | 281 | # Adapted from OpenFold
# 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/l... |
7f653cf7d02365bef0fe5390a6faa8ac87a5ff36bd7df8179a0aa81f5cefe1cd | Python | 8,332 | 190 | """
Retrain the YOLO model for your own dataset.
"""
import numpy as np
import keras.backend as K
from keras.layers import Input, Lambda
from keras.models import Model
from keras.optimizers import Adam
from keras.callbacks import TensorBoard, ModelCheckpoint, ReduceLROnPlateau, EarlyStopping
from yolo3.model import p... |
432fd049e49c5bf3334e7a03f64ed7adb7dfe3fae8bbba94ad0feb7719f0acef | Python | 8,334 | 248 | from __future__ import annotations
from typing import List, Tuple, Optional, Dict, Union
import pandas as pd
import numpy as np
from tqdm import tqdm
from ._types import PfpData, FingerprintFunction
from .core import create_pfp
from .utils import test_polymer_smiles, test_endgroup, test_startgroup
from .logger import ... |
ba80c6d6e8e2552961969dbbe4ad25dcbf20f534ad731070dc7ccec81069cc3d | Python | 8,338 | 241 | # 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... |
fb4c00237b5cd618dcb4644acc968844c0a024595d2a48286f7ba34e72735bef | Python | 8,338 | 247 | from collections.abc import Iterable
from typing import Any
from typing_extensions import override
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings, FakeEmbeddings
from langchain_core.example_selectors import (
MaxMarginalRelevanceExampleSelector,
SemanticSimilari... |
b016f8bba8354266fc7ae59a2ebf7d9e907c5080781de14b4084c938494c6570 | Python | 8,339 | 222 | # coding: utf-8
""" MIT License """
'''
Project: Parenchymal Attention Network
Authors: Axel Masquelin
Description: Image manipulation and visualization function
'''
# Libraries
# ---------------------------------------------------------------------------- #
from PIL import Image
import torch.nn.functional ... |
a6824edd443aa018b0c22188c55c7e363fc5c99f9908c02d87c0a156ba2984aa | Python | 8,340 | 219 | import unittest
from rdkit import Chem
from rdkit.Chem import Descriptors
import numpy as np
class TestmolarWtfromSmiles(unittest.TestCase):
def test_molar_wt_fromSmiles_1(self):
from polyfingerprints.utils import molar_wt_fromSmiles
smiles_1 = "C" # Methane
smiles_2 = "CC" # Water
... |
804bd9f6ebbe3f3f7fbe88da7b93a524d85dd72ba894244344cc217b6ee96bfe | Python | 8,341 | 159 | # 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"
#... |
d10579c8629b7f8347273f21706fa2fcc88d07afe02491643f22711d3ede714b | Python | 8,344 | 211 | import logging
import warnings
import torch
import torch.distributions as d
from torch import nn
logger = logging.getLogger(__name__)
class Corr(nn.Module):
def __init__(self, eps=1e-12, detach_target=True):
"""
Compute correlation between the output and the target
Args:
eps... |
065d49a62b444b4f4ee09845860d7de30ad2cfae268db27248959dfd21b427d1 | Python | 8,347 | 276 | """
2023.08.30
author: femke.hurtak@epfl.ch
Script to compute the recurrence of specific subnetworks.
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
from tqdm import tqdm
import pickle
import math
from loaddata import load_graph_and_matrices, load_nodes_and... |
e26c310d7125b0d088e775346bdc1e157032048b7cb6178d3024635a5a6d6b0f | Python | 8,348 | 176 | """
Analyze learning rates locked around change points at the group level.
"""
import argparse
import data_analysis_utils as dana
import matplotlib.pyplot as plt
import matplotlib.ticker
from mne.stats import permutation_cluster_1samp_test
import numpy as np
import os.path as op
import pandas as pd
import learning_rat... |
21df8fdfe5523bcb038c5ede877113a6cbc147140d8577ddeb39cfa8c767274a | Python | 8,350 | 238 | import random
import numpy as np
import torch
from torch.utils.data import TensorDataset
def generate_recog_data(T=2000, d=50, R=1, P=0.5, interleave=True, multiRep=False, xDataVals='+-', softLabels=False):
"""Generates "image recognition dataset" sequence of (x,y) tuples.
x[t] is a d-dimensi... |
4ee9ec9fd38cf009e1a36d63609e79daf654fff503c3de3e84bf3cb39315c75c | Python | 8,350 | 262 | """Contains tests for the Conv2D-layer LRP implementations"""
import numpy as np
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Conv2D, Input
from explainability.layers import Conv2DLRP
def test_conv2d_lrp():
input = Input((4, 4, 2))
layer = Conv2D(2, (3, 3), ... |
ee97ea468a94217dae378e21ce91a1e3b81bd7a596d8ea54fb73c0aad421ec9b | Python | 8,350 | 248 | import logging
import os
import socket
import sys
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from configs.configs import get_config_dict
from helpers.evaluation import leave_every_other_out_split
from helpers.hcp import load_human_connectome_project_data
from helpers.plotters import conv... |
68aae7a980d9a59b52db8581100312410d2afd7a5ecf9912e0e94c5456f09787 | Python | 8,351 | 176 | import torch
import torch.nn as nn
from torch.nn import functional as F
import numpy as np
from VariationalNC.Variational_utils import Gaussian, ScaleMixtureGaussian
from VariationalNC.Variational_utils import VariationalModule
class VariationalLinear(VariationalModule):
"""
Variational Linear l... |
57e0adf9aedac5234574f60e4f9a55d834a2b5f9ca2bd0639ebe3294800761f4 | Python | 8,352 | 259 | import math
import numpy as np
import torch
import torch.nn.functional as F
from numpy import pi
from numpy.polynomial.polynomial import polyval
from scipy.special import gamma
from torch import nn
def hermite_coefficients(mu, nu):
"""Generate coefficients of 2D Hermite functions"""
nur = np.arange(nu + 1)
... |
94502861547b0b20dfbaf334be0501f8ba5ec6b4f6dce3c3f22f3d99d6a20031 | Python | 8,356 | 254 | # 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... |
1891be4b6ece1781a51cd7f88f8e52a1e9717a7c58f5a175c070a363faed8d22 | Python | 8,360 | 173 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 27 10:52:43 2021
@author: mariano
"""
coolDict = {
'GSC275' : ['GSC275-Arima-allReps-filtered.mcool',
{
'test': {
'10000':['chr13:99,230,000-105,430,000'] ,
'5000':['chr... |
647b31b9ff47e803a557d4550f29ab4a19303d108bd5f2506ab41f2b84f470c3 | Python | 8,360 | 219 | import torch
from torch_geometric.loader import DataLoader
import os
import pickle
from sklearn.model_selection import KFold
import numpy as np
import random
from torch_geometric.nn import global_mean_pool, GATConv
import torch.nn.functional as F
import torch.nn as nn
from torch import optim
import datetime
class GATC... |
f5127b3468166b562409e4f14382a3d7871c884c25e1cd7358b43f3b0a1b0748 | Python | 8,360 | 170 | import torch
from .base_model import BaseModel
from . import networks
from util.metrics import SSIM3D
class LpLoss(torch.nn.Module):
def __init__(self, p):
torch.nn.Module.__init__(self)
self.p = p
def forward(self, fake, real):
# expect input with (B x C x H x W x D)
if fake.... |
4ebe59e59b3b5fb054c3334cf425b8278714126c1c3703aaa4fb158e0107bd77 | Python | 8,361 | 227 | from typing import Callable, Optional, Tuple, Union
import torch
from torch import Tensor
from torch.nn import Parameter
from torch_geometric.utils import scatter, softmax
from torch_geometric.utils.num_nodes import maybe_num_nodes
from torch_geometric.nn.inits import uniform
def topk(
x: Tensor,
ratio: Opt... |
530212148f273da63b2ae3b088bd7dc213c9ce248733ac97f219f23a06b6faba | Python | 8,361 | 226 | """Load summarizing chains."""
from collections.abc import Mapping
from typing import Any, Protocol
from langchain_core.callbacks import Callbacks
from langchain_core.language_models import BaseLanguageModel
from langchain_core.prompts import BasePromptTemplate
from langchain_classic.chains.combine_documents.base im... |
7c50aacc82edb0a8e5ac1ca2d7f3a6ae9e43c060e727af1960f43c0b4d7641d0 | Python | 8,364 | 236 | # 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... |
64e8cc75e9aa0eca2bdd0e5ca776f8e0bb0da69a87b553b3a2cae9804be2789a | Python | 8,365 | 217 | # Copyright 2022 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 writi... |
dd5bda6be7b94ee7b07b53ce253dc11f034194290f6c8db3a98a19dd9888a42b | Python | 8,369 | 216 | import argparse
import logging
import os
import mxnet as mx
import numpy as np
from nowcasting.config import cfg, save_cfg
from nowcasting.utils import logging_config
from nowcasting.movingmnist_iterator import MovingMNISTAdvancedIterator
from nowcasting.helpers.gifmaker import save_gif, save_gifs
from nowcasting.model... |
e4dab0f48ff8d613113178d4c833df62c5ba55a873b027ace6cb8acae58ab776 | Python | 8,369 | 229 | import torch
from torch import nn
from torch.nn import Linear, Embedding
from torch_geometric.nn.acts import swish
from torch_geometric.nn.inits import glorot_orthogonal
from torch_scatter import scatter
from math import sqrt
from .features import dist_emb, angle_emb, torsion_emb
try:
import sympy as sym
except ... |
359ab46621c36d6c91ce3b6e78dec4c73d30f9b2b0f058c46af1fdb20c50cec0 | Python | 8,370 | 186 | #! /usr/bin/env python
from __future__ import print_function
import os
import pickle
import numpy as np
import nibabel as nib
import argparse
from .pipeline import estimate_tensor, calculate_scalars, tissue_rois, initial_fit, gradient_descent
from .utils import nifti_image, read_dwi
DESCRIPTION = '''
FERNET : Freewat... |
06a6565d08f1387b2e2e68a3cc89d204d3c8fc6a14174c6139fda01b0d44e699 | Python | 8,373 | 184 | import torch
import torch.nn as nn
import torch.nn.functional as F
from topk_pool_hsm import TopKPooling
from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp, TransformerConv
from torch_geometric.utils import add_self_loops, sort_edge_index, remove_self_loops
from torch_sparse import spspmm
fr... |
8ba196609bcff00bd4bd3a23c632cd85dbcb5206ba8762cde8883637304dabad | Python | 8,375 | 222 | #!/usr/bin/env python3
# coding: utf-8
"""
Run many ABCD Task Prep Wrapper jobs in parallel via SBATCH
Greg Conan: gconan@umn.edu
Created: 2021-03-05
Updated: 2021-11-29
"""
# Import standard libraries
import argparse
from datetime import datetime
import os
import subprocess
import sys
import time
def find_local_im... |
cbc31c239cde9a49f1e3ee95e4dc0e256831a2f3b3f42b410fb4d87e2f2e7136 | Python | 8,375 | 245 | """Implementation based on the template of Matformer."""
from typing import Tuple
import math
import numpy as np
import torch
import torch.nn.functional as F
from pydantic.typing import Literal
from torch import nn
from comformer.models.utils import RBFExpansion
from comformer.utils import BaseSettings
from comformer.... |
56381e4c350b0a770468fd2ea5058bf8d66c4fb7286454a3164a9117e5b162aa | Python | 8,378 | 160 | import argparse
import glob
import torch
import numpy as np
import pandas as pd
import torch.nn as nn
import pytorch_lightning as pl
import torch.nn.functional as F
from pathlib import Path
from typing import Union
from typing import List
from typing import Tuple
from typing import TypeVar
from torchmetrics import Ave... |
5a236fa4e008494895748434801ded5e057d98870cb38a9c2104afab005a5c25 | Python | 8,380 | 191 | import sys,os,gc
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import numpy as np
import pickle
from Simulator.SimulatorPattern import simulatorPatternSeq
from FiguresFunctions.FiguresPattern import *
import matplotlib.pyplot as plt
import argparse
import itertools
from datetime import datetime
parser = argparse... |
dd521c352204a41ed5e5e6025a66d1b7fb6f595f759caee1e352761323e6bf35 | Python | 8,386 | 223 | 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 pyscf.md as md
import apsw
import os
BOHR2ANG = 1.8897259886
class Frame:
def __init__(self,
ekin=Non... |
59905567070282dde11ed093110837e0f13bf838d17d72c15100b7ee7740a6e2 | Python | 8,388 | 192 | # 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... |
7d74d686852cc3b9d4af2d4335f34cd7ceef03635bc407b61017dd881009e298 | Python | 8,392 | 189 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Description: :
@Date : 2022/06/15 16:32:32
@Author : Zilan Yu
@version : 1.0
'''
import pandas as pd
import numpy as np
import os
import pickle
import torch
import torchmetrics
from torch_geometric.data import HeteroData
from torch_geometric.transf... |
c7b4f71e7915f4f52e8ddb3942b23dbecb71c878eb042790778af372a18128ca | Python | 8,392 | 254 | """SSRF-safe httpx transport with DNS resolution and IP pinning."""
import asyncio
import socket
import httpx
from langchain_core._security._exceptions import SSRFBlockedError
from langchain_core._security._policy import (
DEFAULT_SSRF_POLICY,
SSRFPolicy,
_effective_allowed_hosts,
validate_resolved_i... |
4136ba08587d9e7411c892ac3aa96e65daeaf349a847b0367f1761a2f0682a16 | Python | 8,393 | 183 | import sys
import os
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import numpy as np
sys.path.insert(1, os.path.join(sys.path[0], '../../../../'))
from Articles.Sequential_Learning_Striatum.Figures.FigureSequential import set_blank_axis
from Simulator.SimulatorPattern import s... |
25bd56a274297e3a46bede4b81ac64760cde637adafe2b3f32f7d8861df46ae1 | Python | 8,397 | 136 | from collections import namedtuple
import os
from os.path import join, split, exists
import sys
import numpy as np
from PIL import Image
# a label and all meta information
Label = namedtuple( 'Label' , [
'name' , # The identifier of this label, e.g. 'car', 'person', ... .
# We use them... |
c54229ab9bc5fb59bcb11a8bda31e6b68ef8dc55737e9fcc23b1eb86eaee5684 | Python | 8,399 | 139 | import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_estimator_deps, _check_soft_dependencies, _safe_import
from pgmpy.parameterization.adapters import DistributionAdapter
from pgmpy.parameterization.distributions import NominalDistribution
Delta = _safe_import("skpro.dist... |
a68e46f067e5f817701bccc51e703fe4a186f11c2fcbb693ffbc3cd74ba5c7b5 | Python | 8,401 | 239 | """Prompt template that contains few shot examples."""
from pathlib import Path
from typing import Any
from pydantic import ConfigDict, model_validator
from typing_extensions import Self
from langchain_core._api import deprecated
from langchain_core.example_selectors import BaseExampleSelector
from langchain_core.pr... |
ac27f812e6824714297cba609f19cbd5d9d5941d7bddca371ee7f1692c1433f8 | Python | 8,401 | 216 | import torch
from torch_geometric.loader import DataLoader
import os
import pickle
from sklearn.model_selection import KFold
import numpy as np
import random
from torch_geometric.nn import global_mean_pool, GATConv
import torch.nn.functional as F
import torch.nn as nn
from torch import optim
import datetime
# 定义图神经网络模... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.