sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0f7fb61d25c40689dc81b79d05eacb32a9cd8d393c33283ee3fbe313d4478eca
Python
6,469
157
import torch from e3nn import o3 def FirstOrder4NormActivation(act, features, R, irreps = None): norms = act.norm(features) if act._eps_squared > 0: # See TFN for the original version of this approach: # https://github.com/tensorfieldnetworks/tensorfieldnetworks/blob/master/tensorfieldnetw...
60a764b8b1dc506a6b5a085924e5afc9cba807c09fbf3101be823a807051104c
Python
6,469
181
import warnings from typing import Any from typing import Callable import ptrnets import torch from ptrnets.utils.mlayer import clip_model from ptrnets.utils.mlayer import hook_model_module from torch import nn class Core2d(nn.Module): def initialize(self, cuda: bool = False) -> None: self.apply(self.ini...
8e786a85eeffeb0eaf14fb750cad21ad6ea21e2b38a3b24d052d1d64491fb2ed
Python
6,469
208
# 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...
a22624d7d40d3d207d91e92163441da5a778c867ed6ea85aa546cc9fdbeb2105
Python
6,469
198
#!/usr/bin/env python """ Inference script. To run with base.yaml as the config, > python run_inference.py To specify a different config, > python run_inference.py --config-name symmetry where symmetry can be the filename of any other config (without .yaml extension) See https://hydra.cc/docs/advanced/hydra-comman...
7f510cc3e4bfd81c478f62aaa52dc1a3458b7ab9b983ef7f1e8099caf8a848f0
Python
6,470
171
# Author: Seyedeh Somayyeh Mousavi and Reza Sameni # 2024-2025 import numpy as np import matplotlib.pyplot as plt from scipy.stats import gaussian_kde from scipy.ndimage import gaussian_filter import matplotlib.ticker as ticker # =========================================================================================...
f0e00cbbabf7d726b2e9605b96e3d9754d3323931b548b3fc2b00c96a0ed5ce7
Python
6,471
195
#!/usr/bin/env python3 from typing import Optional import pandas as pd import argparse import yaml import pathlib import matplotlib.pyplot as plt import upsetplot import tqdm def get_upset_data_frame(data, reference, query): sets = data.groupby(reference)[query].unique().map(set) all_values = data[query].uni...
1ee68ad7482bbbe37a0e415606f5bc358e954752afa531be2facbab7ecb37268
Python
6,476
177
import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib.colors import hsv_to_rgb import cv2 import moviepy.editor as mpy import numpy as np from nowcasting.helpers.gifmaker import save_gif def flow_to_img(flow_dat, max_displacement=None): """Convert optical flow data to HSV images ...
3d10c064e29ad64f8bb955d8b780766098a77cb35fa0876b68933571f16b43b5
Python
6,479
193
# this script count the result based on detectron2 inference # import argparse import os import random import time import warnings import pickle import numpy as np import math import sys import copy import re import pandas as pd import json import cv2 from shapely.geometry import Polygon from detectron2.structures imp...
6b5ae20a25166e25f2824bcb9f1204983ba29221d2c2ba26d0589b9001e7b663
Python
6,483
191
#################################################################################### # # 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...
92f7cc3c456807be782e83cd5916301e101f157967cfa9646d87897520f11961
Python
6,483
194
# this script count the result based on detectron2 inference # import argparse import os import random import time import warnings import pickle import numpy as np import math import sys import copy import re import pandas as pd import json import cv2 from shapely.geometry import Polygon from detectron2.structures imp...
aa276f7e64051cc4e73480a69946df10cfcdc20c2aebf95b8db296606487abd1
Python
6,483
186
""" Test util functions """ __author__ = 'John D. Chodera' import os from perses.utils.openeye import smiles_to_oemol from unittest import skipIf import pytest running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true' # functions testing perses.utils.data #@skipIf(running_on_github_actions, "Sk...
b98f2d111171ce02a00aa707b1050950449211ef3b610030932e4a333e069c83
Python
6,484
191
#################################################################################### # # 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...
631193580df41672d467f6bff9592822af02c417adc4e6a7a45e9ae68924f91a
Python
6,487
235
from typing import Any import pytest from langchain_core.utils.function_calling import _rm_titles output1 = { "type": "object", "properties": { "people": { "description": "List of info about people", "type": "array", "items": { "description": "Infor...
6de10805ddd023146ecea16ecde3b7205dea2d3d50f2f9f0a8f91dbedc88d0fe
Python
6,488
169
"""**Retriever** class returns Documents given a text **query**. It is more general than a vector store. A retriever does not need to be able to store documents, only to return (or retrieve) it. Vector stores can be used as the backbone of a retriever, but there are other types of retrievers as well. """ from typing ...
a100636e883901c4071191ce4dd18688f7882824170e8eb92cbb6b16ae935b71
Python
6,489
187
""" Utility classes and functions to create objects supporting callback registration. """ __all__ = [ "Callbackable", "callback_method", ] import functools import inspect from openff.toolkit.utils.exceptions import CallbackRegistrationError def callback_method(func=None, events=()): """Decorator used...
1d19bb137fe26fe2dd663eed48f6e3c9c2a35485fe4bc8eff97389832ecca0fd
Python
6,492
195
### ################################################################################# # # 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 deta...
1aa3cbaf3a998241da02c9def3da32e022c8d196807bc67999f8763e6c3d88aa
Python
6,494
197
#################################################################################### # # 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...
f5d8475fa0e4cfc5692eb41da8648ae250995b1a07dd18e60e29f354a02870b1
Python
6,494
203
from typing import List, Optional, Tuple import matplotlib.animation as animation import matplotlib.pyplot as plt import numpy as np import torch def plot_weights_movie(ws: np.ndarray, sample_every: int = 1) -> None: # language=rst """ Create and plot movie of weights. :param ws: Array of shape ``[n...
f625c325452886cc69711f6456f8e5f6b2e4f47f017fe29f2f1a5ffc6d963acd
Python
6,494
178
import copy from warnings import warn import torch import numpy as np from torch.optim import Adam, SGD from torch.nn import MSELoss, BCELoss from odl.contrib.torch import OperatorModule from dival import IterativeReconstructor from dliplib.utils.losses import poisson_loss, tv_loss from dliplib.utils.models import ...
66f2f0f6ec0e917591ca2368e5f3798bf9262cbf9dc9b99b6aa60ccc678fb017
Python
6,495
197
#################################################################################### # # 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...
7559b0507fec6b2750ec0a4498f0fb2add338bee260a4c292483b11599a52705
Python
6,496
139
"""Publication-quality figures for DeepMapper evaluations. matplotlib only (no seaborn). Every figure is saved as BOTH a 300-DPI PNG and a vector PDF, with a consistent clean style. Legends are placed OUTSIDE the data area so they never overlap bars. All functions take an output stem (no extension) and write ``<stem>....
9ca21849cf4e6b045ca4a0bf60f5db1e58a61ab02572e37107ec5915a6f33399
Python
6,497
201
import numpy as np import torch from scipy.stats import multivariate_normal def box_radial_dist(shape): Z, Y, X = shape z, y, x = np.meshgrid(np.linspace(-Z // 2, Z // 2, Z), np.linspace(-Y // 2, Y // 2, Y), np.linspace(-X // 2, X // 2, X), ...
bbb5de28b2378727fc1bc7b72c419aacf1e7cebfbd1b42dc7aac5347893c9d16
Python
6,500
165
"""Tests for langchain_core.vectorstores.utils module.""" import math import pytest pytest.importorskip("numpy") import numpy as np import numpy.typing as npt from langchain_core.vectorstores.utils import _cosine_similarity class TestCosineSimilarity: """Tests for _cosine_similarity function.""" def test...
076d85f2024865a567fa6f31eead2f6649dce1fe20c1481e9d465a7095da4867
Python
6,502
157
""" This script is used to prep files for plotting with eQTpLot for eQTL-GWAS colocalization plots. It is modified from a jupyter-notebook Apua development. Changes are for module plotting. """ import numpy as np import pandas as pd from pyhere import here from functools import lru_cache import subprocess, argparse, s...
9cbfe7e28da6180c2fb80db0245d6d08be272b11aa0d68e508933ce4cdd408f6
Python
6,503
251
from typing import Any, Optional, Union, Literal, Sequence, Tuple, Dict, List import numpy as np from ..utils import _eval_remote_instance from ..client import CatmaidInstance from enum import IntEnum from dataclasses import dataclass, asdict Dimension = Literal["x", "y", "z"] class Orientation(IntEnum): XY = 0 ...
3eb47d7be70c47a539e6b898d61d104e85c74519f434b5b0f9b3e42f93642f62
Python
6,505
179
from typing import Any from langchain_core._api import deprecated from langchain_core.messages import BaseMessage, get_buffer_string from langchain_core.utils import pre_init from typing_extensions import override from langchain_classic.base_memory import BaseMemory from langchain_classic.memory.chat_memory import Ba...
dc93f25ad4d15687e72324b18ad371db448d7b03246b40afe95593e3f5867123
Python
6,513
215
"""Helper class to draw a state graph into a PNG file.""" from itertools import groupby from typing import Any, cast from langchain_core.runnables.graph import Graph, LabelsDict try: import pygraphviz as pgv # type: ignore[import-not-found] _HAS_PYGRAPHVIZ = True except ImportError: _HAS_PYGRAPHVIZ = F...
5f8e855e76bb2cad6ee3d39963355abd7500fd99d50412045db6417554e03add
Python
6,515
186
from rdkit import Chem def has_one_oxygen_and_sp3_carbons_in_ring(m, ring_elements): '''has one oxygen and sp3 carbons in ring''' cnt = 0 cflag = 1 hflag = 1 for i in range(len(ring_elements)): idx = ring_elements[i] atom = m.GetAtomWithIdx(idx) atom_type = atom.GetSymbol(...
1e48bcfa28bf144aadae6951fd9592b5045d472e9b9b7fecf0fbeea0443f7411
Python
6,517
196
import functools import pandas as pd from torch.utils.data import DataLoader import numpy as np import pandas as pd from sklearn.metrics import roc_auc_score from sklearn.linear_model import LinearRegression from tqdm.auto import tqdm import torch import os import pickle import random from rde.utils.misc import inf_it...
cca1739e3ff90d4b3ae3b6a030358b3870517ba1bbe03dcfda659cef8fc206bf
Python
6,525
172
import os import matplotlib.pyplot as plt plt.rc('savefig', format='pdf', bbox='tight') plt.rc('legend', fontsize=8) # legend fontsize import torch from data import generate_recog_data from plotting import plot_train_perf, plot_W, plot_B, plot_recog_generalization, maxabs from networks import HebbNet ...
19854478334b27b40ab624bca052db427070f7eb0ff54c355cd5ea4c72cf625b
Python
6,529
175
import math from EPI_MRI.utils import * class LeastSquaresCorrection: """ Given a field map, produces a corrected image. This class provides functionality to correct distorted images using a field map. The method is based on Least Squares Restoration. Reference: https://fsl.fmrib.ox.ac.uk/fsl/fs...
3a8d138d09af8b377de37af5546da98fe6870bb000e3032883c70e86e9616f81
Python
6,531
171
"""Test conversation chain and memory.""" import re from typing import Any import pytest from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models import LLM from langchain_core.prompts.prompt import PromptTemplate from typing_extensions import override from langchain_classic....
b337842311fc35a6b3b3efe7bd4233637d1fcfc7e3f8c07ae5312b25c73380cf
Python
6,533
190
import numpy as np from params_emt import * from numba import jit_module import matplotlib.pyplot as plt def pos_hill(x, x0, n): ''' positive hill function ''' return ((x/x0)**n)/(1+(x/x0)**n) def neg_hill(x, x0, n): ''' negative hill function ''' return 1./(1+(x/x0)**n) def joint_hill(x1, x2, x01, x02, n1, ...
f5837b670a5c5c1419d524bcfbfc508aa67855c46ea0001fcfd3340815b21e50
Python
6,534
165
import os import shutil import subprocess import tempfile import mdtraj as md import numpy as np from diffnets.utils import get_fns CURR_DIR = os.getcwd() UP_DIR = CURR_DIR[:-len(CURR_DIR.split('/')[-1])] CLI_DIR = UP_DIR + 'cli' def test_preprocess_default_inds(): curr_dir = os.getcwd() try: td = tem...
a2646e390e2b3c49a9cdc28cc35684564654fdd5be0de57844a12d6c96adf426
Python
6,537
189
######################################################################## # 2D diffusion on an infinite strip from line "point source". # AIMS: to verify STEPS spatial-stochastic solver 'Tetexact' supports # local initial conditions and calculates surface diffusion rates correctly. # STEPS equivalent model: Stochas...
f0076c0f23316ffd2b94627b0f5977c4d8931c4b93b28d0d72c66a5ff3808028
Python
6,538
259
import click import sys import scaden import rich import rich.logging import logging import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" import tensorflow as tf from scaden.train import training from scaden.predict import prediction from scaden.process import processing from scaden.simulate import simulation from scade...
76d83fa099ed099a7ec1fec2e25c4b9b48a943fc147dabf9871aec17c0c4cb18
Python
6,539
217
import torch from models.cnn import cnn3d from models import (cnn, C3DNet, resnet, ResNetV2, ResNeXt, ResNeXtV2, WideResNet, PreActResNet, EfficientNet, DenseNet, ShuffleNet, ShuffleNetV2, SqueezeNet, MobileNet, MobileNetV2, vgg2) # from opts import parse_opts import argparse def getDNN(cnn_name, m...
f592cb2ca971719565e21d7b97764a25b7486b4c8f5bf311ef997cb994e27d5d
Python
6,539
201
#################################################################################### # # 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...
1447bb3e7ba872246defd42fa43d11329711c54f46aaecf246fe56d93b3e9760
Python
6,541
260
# -*- coding: utf-8 -*- """ Created on Thu Jul 30 21:13:03 2020 @author: nishe """ neuron_e_AD = ''' dv/dt = (1/C)*(-g_l*(v - v_l) + (-g_k)*(v - v_k) + I_inh + I_exi + I_extnl_spk + I_extnl_crt) : volt (unless refractory) g_l : siemens t_ref : second I_inh = (-g_I)*(v - v_rev_I) : amp I_exi = (-g_E - g_E_inter)*(v -...
55dec3ff79fc97718b2b22a1317478ffbf6c27126e2f94937e974d264cde55c6
Python
6,544
162
import rdkit import rdkit.Chem as Chem import numpy as np ''' This module is a duplicate of mol_graph.py in this same directory. It adds additional atom features, including some calculated electronic properties, which turn out to not actually help model performance ''' # Extra atom features import rdkit.Chem.rdMolDes...
723fce7f35ace4fe85d8d9809ed56f9a9fdaab6dc0bef3cb31cc958ef1343915
Python
6,548
170
#!/usr/bin/env python3 import logging from os import path from itertools import chain from collections import Counter from enrichm.databases import Databases # Local ############################################################################### class Writer: ''' A collection of functions to write files in vari...
8916875fa072546884e010bf35f93cfcb497023f40abbbd8e1497e6733ec9018
Python
6,549
147
import tensorflow as tf from rexgen_direct.core_wln_global.nn import linearND, linear from rexgen_direct.core_wln_global.models import * from rexgen_direct.core_wln_global.ioutils_direct import * import math, sys, random from collections import Counter from optparse import OptionParser from functools import partial imp...
9003b80f280cf0b94cb931fbd30f44ca48cece3cb80c9be5a3ceebf215dd7821
Python
6,549
156
import numpy as np from rdkit.Chem import AllChem from rdkit.Chem import Descriptors from rdkit.Chem import rdMolTransforms #from rdkit.Chem import AllChem, Draw, Descriptors, rdMolTransforms import rdkit.Chem as Chem import rdkit.Chem.rdMolDescriptors as rdMolDescriptors import rdkit.Chem.EState as EState import rdkit...
d2d2b697254f3e3f1b9fb18f8ae5b281b8be20e0c878aadfc003ff2f36dfdbe0
Python
6,551
43
from langchain_core.prompts import PromptTemplate template = """Given the following extracted parts of a long document and a question, create a final answer with references ("SOURCES"). If you don't know the answer, just say that you don't know. Don't try to make up an answer. ALWAYS return a "SOURCES" part in your an...
46a823a14c64a41d2213a7832829bcaa6fc7ac21ff0d5cf2da8b03b4d95df516
Python
6,556
204
import pandas as pd import pytest from cwas.binomial_test import BinomialTest import sys import cwas.cli import zarr class BinomialTestMock(BinomialTest): """This class do not make outputs""" def save_result(self): pass def update_env(self): pass @pytest.fixture(scope="module") def cat_p...
6bb76b61728f8f727779fa8621fe88afc09a6a95bdc7c0cf22a4d015700ecef2
Python
6,556
185
# Source: https://github.com/choosehappy/PytorchDigitalPathology/blob/ ... # master/segmentation_epistroma_unet/ # Adapted from https://discuss.pytorch.org/t/unet-implementation/426 import torch from torch import nn, Tensor import torch.nn.functional as F from typing import List class UNet(nn.Module): def __ini...
3a737c9bb951d488f283bc679ad5cf29f6ac3d45e3a2fc5e1d17ecc5e7c448f8
Python
6,558
193
import scanpy as sc, anndata as ad import numpy as np import pandas as pd from sklearn.cluster import KMeans from sklearn.metrics import adjusted_rand_score import matplotlib.pyplot as plt import re, seaborn as sns from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import ListedColormap if __name__ =...
cf07891fb7123744628882010f5eea2172f8b74b7c1979b1afbef379c445edec
Python
6,559
135
# main file for CNN classifier # Updated: 9/16/2023 # Status: OK # CUBLAS_WORKSPACE_CONFIG=:4096:8 python classifier_main.py # results in current setting: # ---------------------------------------------------------------------------------------------------- # Model Accuracy Precision (weighted avg)...
f53df1b1eed2690a81814ea1dd0628d5305f1b4cd9ea8b979dbd6b59f75a5129
Python
6,559
168
import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.layers import InputLayer, Dense, Lambda, LayerNormalization from typing import Union from .utils import fuse_batchnorm, remove_activation from ..layers import get_lrp_layer, PoolingLRPLayer, StandardLRPLayer from ..utils import infer_gr...
cb7a4811e12e534a5e62c72d9d7897f13b73a5ff2ee56a3e1f685a8907582019
Python
6,561
153
#!/usr/bin/env python3 # Adapted from http://revigo.irb.hr/CodeExamples/revigo_restful.py.txt (excessed 2022-06-09) # Python script for programtic access to Revigo. Run it with (last output file name is optional): # python3 revigo.py example.csv result.csv import requests import time import sys import pandas import ...
eec1ed8f4c89b9263084cbfd5c577ca0d6a093dc31827a5d53f4b2a6ced63f96
Python
6,562
219
# Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or mo...
2e598fd1574f0d6a418e6b5e67d5f1e1081ac796697519514927d7a9e792c7fc
Python
6,563
141
import torch import torch.nn as nn from rfdiffusion.Embeddings import MSA_emb, Extra_emb, Templ_emb, Recycling from rfdiffusion.Track_module import IterativeSimulator from rfdiffusion.AuxiliaryPredictor import DistanceNetwork, MaskedTokenNetwork, ExpResolvedNetwork, LDDTNetwork from opt_einsum import contract as einsum...
19bf038242f259b9c951e78ead662f6ee84b05c139f218db6615b4c150e3b255
Python
6,565
211
# !/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on: Thu 15 Sep 2022 17:08:06 Description: Create new fasta file with short unique ids and a csv file containing the mapping back to the original file Usage: python main.py @author: tsenoner """ import argparse from itertools import product...
26578c9f11d6cf8f0a8008cb3c0ca8ae95e1d30b018743f6c59ed6b20079c25d
Python
6,566
189
import ClusterModelNEST import defaultSimulate as default from analyse_nest import cut_trials, split_unit_spiketimes from copy import deepcopy import numpy as np import matplotlib.pyplot as plt import pylab from GeneralHelper import (Organiser, round_to_resolution, random_pick) def stimulus_protocol(condition,trials...
f82ec95f9b9ada059f9963b2cf6ef863fa9ca7eaeabedfe4e55ed59a6284c8f3
Python
6,568
221
import types import numpy as np import matplotlib.pyplot as plt from fastweights_numpy import FastWeights, FeedforwardNet from data_utils import generate_recognition_data from neural_net_utils import Sigmoid, Relu, Quadratic, CrossEntropy, plot_W, plot_B #%% Generate data d = 50 #length of input vector...
5469bc45f5a3743a5f24b3a167fbd7955a58125880de19858428e7870c211f91
Python
6,587
160
import logging import os import socket import sys from fcest.helpers.inference import run_adam_svwp, run_adam_vwp from fcest.models.wishart_process import SparseVariationalWishartProcess, VariationalWishartProcess import gpflow from gpflow.ci_utils import ci_niter from configs.configs import get_config_dict from help...
f68b1630d6822bf87d167ea37e659fddd81bc877fa00f6ccf8f374f369abf6b1
Python
6,588
200
import numpy as np from scipy.linalg import solve from typing import Tuple # Code from: https://github.com/smrfeld/Total-Variation-Regularization-Derivative-Python/blob/main/python/diff_tvr.py class DiffTVR: def __init__(self, t, alpha): """Differentiate with TVR. Args: n (int): Number...
5fad46476e4c435108bd8246adcc1b4bf6afce2b729cc8935c434e8627e8840a
Python
6,593
190
######################################################################## # 2D diffusion on an infinite strip from line "point source". # AIMS: to verify STEPS spatial-stochastic solver 'Tetexact' supports # local initial conditions and calculates surface diffusion rates correctly. # STEPS equivalent model: Stochas...
26ad7d610c5832386d962b28283a2ddf112b1e4e1151f254de06b1a62f089c60
Python
6,595
177
from collections.abc import Callable import networkx as nx import numpy as np import pandas as pd from pgmpy.base import DAG from pgmpy.causal_discovery._base import BaseCausalDiscovery from pgmpy.causal_discovery.bivariate_scores import BaseBivariateScore, get_bivariate_score from pgmpy.utils import get_dataset_type...
45e91cb9ed1f08c4c97fd74aa6f1fb2bfe1490e12a7a3cf9bb34df197aaaa5de
Python
6,596
184
import argparse import random import numpy as np import torch from torch import nn from modelling.model import CEEffNet, CEResNet from preparation import dataset_functions as dpr from preparation.datasets import BCN20k_Dataset from processing.train import train from processing.utils import obtain_transform # Make w...
61653376c3a221403572c56c1221505051c52a1c651cc2da310c5a3b09d371e7
Python
6,597
251
# 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...
7982c4f558fff9a48618c9787e12533a178a554a9b8d51ce6d517a4112ced221
Python
6,598
171
import types import random import numpy as np import matplotlib.pyplot as plt from fastweights_numpy import FastWeights, FeedforwardNet from dt_utils import Timer from data_utils import generate_recognition_data from neural_net_utils import Sigmoid, Relu, Quadratic, CrossEntropy #%% Generate data d = 50...
11a7c14c39b73083196c80b0d77467fb4dc3a552f132f785c9d49eaa549880dc
Python
6,601
169
""" Helper class for deep believe networks. :Version: 1.1.0 :Date: 06.04.2017 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2017 Jan Melchior This file is part of the Python library PyDeep. PyDeep is free so...
1f83365d53f3abdfb7f12f84ac0186de3970d4c2d14424f47ea36a14962e610d
Python
6,602
157
import copy import logging import os import socket import sys import numpy as np import pandas as pd import pingouin import scipy from configs.configs import get_config_dict from helpers.hcp import get_human_connectome_project_subjects, rename_variables_for_plots def _rename_models_for_plots(config_dict: dict, orig...
5a02a942529cb4e6102bd2a95816351ac82e7c1e169d059318e246091d9424e3
Python
6,607
164
# 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...
c72e9cd3cc50179f54e06f0dc1aedc9cf8f4d3d9b1fb9905ac38c452d9dc6f29
Python
6,607
216
"""Context management for tracers.""" from __future__ import annotations from contextlib import contextmanager from contextvars import ContextVar from typing import ( TYPE_CHECKING, Any, Literal, cast, ) from uuid import UUID from langsmith import run_helpers as ls_rh from langsmith import utils as l...
da61dbda55bc2e3178fdf03f8ebb0bb472ade879bd26fa38f12215578f846249
Python
6,608
218
"""Script for preprocessing PDB files. WARNING: NOT TESTED WITH SE(3) DIFFUSION. This is example code of how to preprocess PDB files. It does not process extra features that are used in process_pdb_dataset.py. One can use the logic here to create a version of process_pdb_dataset.py that works on PDB files. """ impor...
a7f7fe4b02b7b6e65093c1a15ae9bd25409e00e7768d0ed7b0ef11977eaa8fc5
Python
6,612
169
# 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...
95ee64421c30f7a6fbe49ac8b5278dfc5c5ead465b83cd4f86b3896de1918959
Python
6,625
183
import torch from bindsnet.learning import ( MSTDP, MSTDPET, Hebbian, NoOp, PostPre, Rmax, WeightDependentPostPre, ) from bindsnet.network import Network from bindsnet.network.nodes import Input, LIFNodes, SRM0Nodes from bindsnet.network.topology import * class TestConnection: """ ...
0ed75bbf46559e0c8433d0b5a58399c123bdda18bdbd642aa4cbb636038c0392
Python
6,628
139
import numpy as np import pandas as pd from sklearn.cluster import KMeans import random import seaborn as sns import torch import matplotlib.pyplot as plt import h5py from sklearn.preprocessing import MinMaxScaler, StandardScaler import shap import sys from modal_type_list import * import argparse def get_shap_pathw...
dbc6d9e56d9b40c66344a7ccd714867c955798e4d00b860533739ba0b5f88e2f
Python
6,630
175
import torch, os from copy import deepcopy from data import generate_recog_data from networks import HebbNetBatched, HebbNet from plotting import plot_train_perf, plot_W, plot_recog_generalization, plot_recog_positive_rates, plot_multi_hist, clean_up_w, sort_w, shuffle_w, left_justify_w, plot_w1_row_col_sums from...
08fc03c9dff3c8a1c8a87825e57335b81bbb46040ad55a750905141b940d51a5
Python
6,632
177
#################################################################################### # # 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...
1a8b27e118b2c02b01372c26ddc0ce42f3539f8634aefa89e3e9cad38c59dab5
Python
6,633
177
#################################################################################### # # 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...
03633e05b780f442562a15418126ec7b9f4c28e4c48fd3ef78bb2021268c9eed
Python
6,634
152
from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression from mimic3benchmark.readers import LengthOfStayReader from mimic3models import common_utils from mimic3models import metrics from mimic3models.length_of_stay.utils import save_r...
c015e3f71784d302b87b3814d4d09225b16ec461c2f41d78280068c4018bd12f
Python
6,640
178
import matplotlib.pyplot as plt import joblib import numpy as np from torch.utils.data import TensorDataset import torch.nn as nn import torch from data import generate_aug_recog_data_batch, generate_recog_data_batch, recog_chance from plotting import plot_train_perf from networks import HebbAugRecog #%% C...
83b1598c9f5ca3b70404df0eecf464c73ae0229e46ecbb5da2dc56edacd76f5f
Python
6,641
226
#################################################################################### # # 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...
3fa79092cdadaf4283e396e937b0410c709352272acd8b4111ab64a5bf901d8e
Python
6,645
226
#################################################################################### # # 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...
297beb2efa628d2ae48b75ac5b36d190224222cac9fed13b39d23969f055a484
Python
6,646
176
# 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...
76880f7d736a149209933d64540bc038938354ae034bf2ac1a6aafc61f7519f5
Python
6,646
181
import asyncio import json import argparse from datetime import datetime from pathlib import Path from typing import Dict from aiohttp import ClientSession from tqdm import tqdm async def get_status( workflow_id: str, session: ClientSession ) -> Dict[str, Dict[str, str]]: """ This function gets the statu...
ed2f3ecd56f0fbe15257b5ac7d91d2d5acc21a1d1eca8f6e4f8e0ec1d30a21d5
Python
6,653
187
from __future__ import print_function import tensorflow as tf from nn import linearND, linear from mol_graph_direct_useScores import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph, bond_types from models import * import math, sys, random from optparse import OptionParser import threading from multiprocessin...
2e92f68bc8bc1eab1ee4dc5e06b009e3947581c9e3ec46246c2172fe13dd0a8f
Python
6,659
157
# *========================================================================= # * # * 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...
3cfebcd455f19cbddecc48d7d96021b57dfe73fd262fb57ef20089bd532eaec7
Python
6,660
193
# 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...
a62f9e4978a0e19683ab70ced87dce04da745eb38ec187e45d596d43014f881c
Python
6,661
122
# 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" #...
8ee59555bb37e6c902b9c65d687fd393f04c82f872c4d7a4871da010616283dc
Python
6,666
157
# 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...
9f60e9b0f9b0758531afd12388bd7002218d06a571c171d70f408b3c0f239da4
Python
6,666
192
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: animalai/communicator_objects/arenas_configurations_proto.proto import sys _b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf import message as ...
927087b5c6c11fa4b66ac59cd7a125ed04d059598d86682df7907232aafbca74
Python
6,672
193
import numpy as np import networkx as nx import torch as pt #import torch_geometric as ptg import pytorch_lightning as ptl import torch from torch.nn import Sequential as Seq, Linear, ReLU #from torch_geometric.nn import MessagePassing from pytorch_lightning import LightningModule from torch.optim.adam import Adam from...
d291d725e63e71211e3d088e0900d6d8af97067ce7b202a6e2fc48ce1506926c
Python
6,675
209
import os import json import re import glob def compileRegexes(obj): # compile regexes loaded from JSON files objType = type(obj) if(objType is dict): for key in obj: if(type(obj[key]) is str): obj[key] = re.compile(obj[key]) else: compileRege...
ee21f11820f7fb4193f8a7cf4e67cf1f8073febf400544a82c1a1ecbbb690e17
Python
6,675
264
#!/usr/bin/env python3 """ Output volumes of each probabilistic label in an atlas in microliters. Accepts multiple 4D prob atlas files Usage ---- prob_label_volumes.py <atlas_file> prob_label_volumes.py -h Example ---- >>> prob_label_vol_info.py *_probs.nii.gz Authors ---- Mike Tyszka, Caltech Brain Imaging Center ...
cdef233ed581be137abcd1321e7aabc2896e157096c218d38ddf274a4c0dc0d5
Python
6,677
188
from util import * EPS = 1e-12 def augment_data( half1, half2, mask, box_size, voxel_size, do_smooth_solvent=True, augment_orientational_bias=False, augment_bfactor=False, augment_noise=False, device=torch.device("cpu"), verbose=False ): grids = np....
eae54e30716d1c1a8ca1c5c824b9b37bfe6a653c8e23d87b2507763497b91721
Python
6,678
185
import Bio.SeqIO as sio import tensorflow as tf import numpy as np from sklearn.preprocessing import LabelBinarizer from tensorflow.keras.utils import to_categorical import random import os os.environ['CUDA_VISIBLE_DEVICES'] = '0' import tqdm #strategy = tf.distribute.MirroredStrategy() #load model filterm = tf.keras....
877737155cbd94d4955a7d25407789c1863e7163d00e06dfd43e0a9db9837c42
Python
6,679
281
# -*- coding: utf-8 -*- from typing import Callable, Optional import torch from torch import nn from torch.nn.parameter import Parameter from torch.distributions import Normal from torch.distributions import kl_divergence as kl class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxi...
aff6a63abc3a6152650ad0aba074073b733d03438b0ff686e40764302a1e3ac0
Python
6,680
167
# coding=utf-8 import os import numpy as np import torch import sys # sys.path.append('..') from datautil.util import Nmax import datautil.imgdata.util as imgutil from datautil.imgdata.util import rgb_loader, l_loader from torchvision.datasets import ImageFolder from torchvision.datasets.folder import default_loader i...
5b7033eb75872bfd4e2504bf9432dd7b2fe522cd49f3ae9111389713427d9b8d
Python
6,682
230
import matplotlib.pyplot as plt import numpy as np import pandas as pd def add_identity(axes=None, *line_args, **line_kwargs): if axes is None: axes = plt.gca() identity, = axes.plot([], [], *line_args, **line_kwargs) def callback(axes): low_x, high_x = axes.get_xlim() low_y, high_...
57124184db2f60040ff949a54fa617d3ea15321365fae1d3339af6b44adeb0ff
Python
6,685
153
import gym import random from gym import spaces import numpy as np import logging from random import sample,choices,uniform, randint from math import ceil from DSS_Initialize import * from state_action_reward import * from gym.utils import seeding logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', le...
cc0875a062ec30dbe3fdb7f631e42d4454fe65aa86f85f4545f46269d3d96569
Python
6,685
182
import time from contextlib import contextmanager from typing import Optional, Tuple, Any, Union import torch from einops import rearrange # noqa from torch import Tensor from rde.utils.protein.protein_constants import INDEX_TO_AA_ONE get_eps = lambda x: torch.finfo(x.dtype).eps # noqa get_max_val = lambda x: torc...
f129358857f5c0615a0b3a0cb5f0413e1bc006ebc67a3b4a936eb75e3f170fd1
Python
6,685
193
# builtin modules import os import logging # third party modules import numpy as np # pnabind modules from .get_atom_kdtree import getAtomKDTree from .get_surface_residues import getSurfaceResidues class StructureData(object): def __init__(self, structure, name='structure', path='.', level='S', mid=0): ...
a37d25f17bf7c7070404a83e71456ae98c3a48ea10d9903dda5d6aa7876e2211
Python
6,688
155
import math import numpy as np from tqdm import tqdm from os.path import join from os import listdir import pandas as pd import sys import subprocess def get_read_data(all_data): ''' Given a line from an NGS file, return the name, sequence, and quality scores of the read Args: all_data: string cont...
706c6abe0f845e70de28531d028daba4fba633d0a1d9b558dddc602abf519fc9
Python
6,694
135
""" %Copyright (C) 2020, Manel Vila-Vidal, for the translation from Matlab to Python Contact details: m@vila-vidal.com %Copyright (C) 2019, Adria Tauste Campo, for the original Matlab code (https://github.com/AdTau/DI-Inference) %Contact details: adria.tauste@gmail.com %This program is free software; you can redistrib...
0e852a5fa544f602fa2b9874ef0168faca0e6c222bd2977967e7dc2eed84cee9
Python
6,695
198
import torch import torch.nn as nn import numpy as np import torch.nn.functional as F from collections import OrderedDict class ReactionDiffusionParamPDE(nn.Module): def __init__(self, dx, is_complete, real_params=None): super().__init__() self._dx = dx self._laplacian = nn.Parameter(...
1354bb56b04906b1900611fe6b8237ee930c4bb1a6d94d887925d7dc3459ae90
Python
6,695
191
from typing import Optional import torch def single( datum: torch.Tensor, time: int, dt: float = 1.0, sparsity: float = 0.5, device="cpu", **kwargs, ) -> torch.Tensor: # language=rst """ Generates timing based single-spike encoding. Spike occurs earlier if the intensity of the...