sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
bc7f6ebc1aa2dade3aa6c78c25a603b8e42e364194b43d8e5b4b029b89ccdac0
Python
24,405
663
"""`Runnable` that can fallback to other `Runnable` objects if it fails.""" import asyncio import inspect import typing from collections.abc import AsyncIterator, Iterator, Sequence from functools import wraps from typing import TYPE_CHECKING, Any, cast from pydantic import ConfigDict from typing_extensions import ov...
9c52ab4b77d010a0acf1ed77c313bd55150301857b111674374eb47af4f5d227
Python
24,481
557
from PyQt5.QtWidgets import (QApplication, QComboBox, QGridLayout, QGroupBox, QLabel, QPushButton, QFileDialog, QMessageBox, QWidget, QSizePolicy, QCheckBox) from matplotlib.backends.backend_qt5agg import FigureCanvas from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar impo...
a31d01e7a20d6259087a43be39a689fc29d32e185b396a2a1ec4a1a644a477e2
Python
24,500
560
# -*- coding: utf-8 -*- import os from datetime import datetime import copy from tqdm import trange import numpy as np import pandas as pd import torch from torch.utils.data import TensorDataset, DataLoader from .model import ModuleUnit from .utils import DataReader, countdown class BTSTN: def __init__( ...
b9540b09810dd1f84c11f9bedc0bfdd1b4d338023691510c318cc87d066c0e6d
Python
24,501
683
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
69eb523d00839469d7bf314125a08f1e911a1942f70cfce5ecf7748fb9f17776
Python
24,502
673
import os os.environ["CUDA_VISIBLE_DEVICES"]="2" import sys sys.path.insert(0,"/examples") from modulusDL.models.arch import CustomModuleArch, SumMultiplicationArch, HypernetFullyConnectedFlexiLayerSizeArch, FullyConnectedFlexiLayerSizeArch, InheritedFullyConnectedFlexiLayerSizeArch, SingleInputInheritedFullyConnectedF...
5374b8a1ef26548d13a1e91db508d1bdda92e700f32ea5c92b7bfc2a406ef2d7
Python
24,520
690
"""Core benchmark runner: phantom → simulate → wo rec → metrics. Each synthetic case shells out to ``wo rec`` so the benchmark proves the exact CLI workflow. The ``cli_command.sh`` saved alongside each case can be copy-pasted for production use. """ from __future__ import annotations import json import logging impor...
b0c41ac2401a2e10b34a279fe7a81f72ede1e92da0137327cdc7a92fd9d30666
Python
24,544
455
"""DDSurfer dual-stream temporal attention network.""" from __future__ import annotations from functools import partial from typing import Sequence import torch from torch.utils.checkpoint import checkpoint import torch.nn as nn import torch.nn.functional as F from model.cmunext import (AttentionGate3D, CMUNeXtBloc...
a2ca9ae1203dd6db693ad9773d51b072804c994844ea5a80a8c48353391b94b0
Python
24,584
532
""" Module for generating a specific plot on one matplotlib axis. Author: jonas.braun@epfl.ch """ import os import sys import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from scipy.ndimage import gaussian_filter from scipy.stats import mannwhitneyu from twoppp import plot as myplt from twoppp...
2025b6e0f1e6d27d281c25cbae0e518b157d02a315c53259d04fafd509c61e7d
Python
24,589
820
# 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...
7be0036fda3c24f75db870195d4795b4b93b678faac4497bb235d99fc1750252
Python
24,589
798
import datetime import json import traceback import numpy as np class AcqEngMetadata: CHANNEL_GROUP = "ChannelGroup" CORE_AUTOFOCUS_DEVICE = "Core-Autofocus" CORE_CAMERA = "Core-Camera" CORE_GALVO = "Core-Galvo" CORE_IMAGE_PROCESSOR = "Core-ImageProcessor" CORE_SLM = "Core-SLM" CORE_SHUTTE...
be13575f63dd9f377a7a6519c880ede68d08dec24a8839e09e0184adf96454c4
Python
24,611
521
from typing import Optional, List import os import lmdb import random import torch import numpy as np import os.path as osp from argparse import Namespace import pickle import gdown from tqdm import tqdm from apsw import Connection import torch.nn.functional as F from torch_geometric.utils import scatt...
5d2127c95ac3026e05a57a0ee7640ea0e50520c115e8f487d5c8e0b4870365b7
Python
24,640
931
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import pingouin as pg seed = 100 np.random.seed(seed) get_ipython().run_line_magic('matplotlib', 'inline') # %config InlineBackend.figure_format = 'retina' from scipy import s...
85c3969b6cadd237a4425f62f3c73eb8195ab0982f9b3bc38be9464a4dc5f750
Python
24,640
608
import logging import cv2 import numpy as np import math import os from nowcasting.config import cfg logger = logging.getLogger(__name__) def load_mnist(training_num=50000): """Load the mnist dataset Parameters ---------- training_num Returns ------- """ data_path = os.path.join(cf...
0b92d75285d1741f2909502a323d0bf8fb536afcd33110686728cf5db2708cb5
Python
24,732
694
import numpy as np import pytest import time from pycromanager import Acquisition, Core, multi_d_acquisition_events from pycromanager.acquisition.acquisition_superclass import AcqAlreadyCompleteException def check_acq_sequenced(events, expected_num_events): return isinstance(events, list) and len(events) == expec...
8074244b174568124591047715a01e063c5f198466b2898e205a04c42899472d
Python
24,733
547
import numpy as np import scipy.sparse as sp import torch as th from sklearn.preprocessing import OneHotEncoder def encode_onehot(labels): labels = labels.reshape(-1, 1) enc = OneHotEncoder() enc.fit(labels) labels_onehot = enc.transform(labels).toarray() return labels_onehot def preprocess_feat...
8151fbf38c1e59a5d49ceb57ff34003b2600c045f6c992b73196866c749eaa9c
Python
24,741
691
""" Created by @author Shengze Cai """ import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" import tensorflow as tf if tf.__version__ >= "2.0.0": import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import numpy as np import time # ==================================================================== #...
8f77fbf1e34f6ab246b4ce398971d00149c5e07d0160f6eff9c6a19db2b8eb94
Python
24,761
392
import pandas as pd import numpy as np from sklearn.model_selection import StratifiedGroupKFold, StratifiedKFold from bernn.utils.utils import plot_confusion_matrix, scale_data, get_unique_labels, to_csv, scale_data_per_batch def get_harvard(args, path='data'): """ Args: path: Path where the csvs can...
ec163e4b6f3d24847c7cd256990d90d5ca474fff2bc2cc9797074ba3bcef4dcc
Python
24,785
631
"""`Runnable` that manages chat message history for another `Runnable`.""" from __future__ import annotations import inspect from collections.abc import Callable, Sequence from types import GenericAlias from typing import ( TYPE_CHECKING, Any, ) from pydantic import BaseModel from typing_extensions import ov...
688dca4c8f07ef480f117b8cae1b3fa692a1d2f3b299ef1217918db5a3dc6908
Python
24,800
743
import scipy.sparse from rfdiffusion.chemical import * from rfdiffusion.scoring import * def generate_Cbeta(N, Ca, C): # recreate Cb given N,Ca,C b = Ca - N c = C - Ca a = torch.cross(b, c, dim=-1) # These are the values used during training Cb = -0.58273431*a + 0.56802827*b - 0.54067466*c + C...
603c2de9c883b2c95df560fa18704b0dbae22f5b1e571e8f5033a268177a4875
Python
24,881
571
import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt from scipy import interp from sklearn.metrics import auc import pandas as pd import numpy as np import random import sys import os from pathlib import Path import pickle import json os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import wa...
6c5096ace8186873236483ac0f016471b184c9ed5be21917b02fb0ce781cd105
Python
24,891
579
"""Tests for motornet.environment — Environment base class and RandomTargetReach.""" import numpy as np import pytest import torch from motornet.effector import ReluPointMass24, RigidTendonArm26 from motornet.environment import Environment, RandomTargetReach from motornet.muscle import RigidTendonHillMuscleThelen #...
9810b0ead849a359468ec825ce7cbb67b3c8e2facbea838307c05a6ee11e6540
Python
24,895
751
from sklearn.model_selection import RepeatedKFold from sklearn.metrics import mean_squared_error from SMdRQA.RQA_functions import * from SMdRQA.RQA2 import * import ast import memory_profiler from scipy.interpolate import pchip_interpolate from functools import partial from p_tqdm import p_map import numpy as np from s...
0fa055c8c75e355449c23fa2a4c193dc4c006feb819d8ef501e6a6bac0d8ee28
Python
24,900
598
import numpy as np import glob import os import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(BASE_DIR) sys.path.append(BASE_DIR) DATA_PATH = os.path.join(ROOT_DIR, 'data','s3dis', 'Stanford3dDataset_v1.2_Aligned_Version') g_classes = [x.rstrip() for x in open(os.path.join(BASE_...
ae69195d61b8e94e47aab0082cb2bf7ffae4b3f98ab55a68bc52dc4fd8bba81b
Python
24,931
578
''' 1. Normalize features of shape (N, sphere_basis, C), with sphere_basis = (lmax + 1) ** 2. 2. The difference from `layer_norm.py` is that all type-L vectors have the same number of channels and input features are of shape (N, sphere_basis, C). ''' import torch import torch.nn as nn def get_...
ee9f69176f0db4fcee6f8652f70463ba8af5cde0a56e3739a07215dbdfea98de
Python
24,933
746
"""Test functionality related to prompts.""" import re from collections import ChainMap, UserDict from pathlib import Path from types import MappingProxyType from typing import Any, Literal from unittest import mock import pytest from packaging import version from syrupy.assertion import SnapshotAssertion from langc...
677aaefc3d4d6204ae8e52f7cca0504d6c2b9cd5c4b5fa9cdd15876adbe46af4
Python
24,969
538
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 10 11:43:50 2021 @author: shni2598 """ import frequency_analysis as fqa import firing_rate_analysis as fra import numpy as np #from get_onoff_cpts import get_onoff_cpts #%% def get_phase_sync(spk_mat_MUA_1, spk_mat_MUA_2, dura, \ ...
68a8e77542c35ba2ffaa624b230600289e7af9446438b1964a93b68c9b91b928
Python
24,985
748
# todo: 1. DeprecationWarning: an integer is required (got type numpy.float64). # Implicit conversion to integers using int is deprecated, and may be removed in # a future version of Python. y = torch.tensor([Y], dtype=torch.long) # todo: 2.Creating a tensor from a list of numpy.ndarrays is extremely slow. # Plea...
77735e35a9010be2b48503e841f8c0ed9d927c56f999d2817e7fd3d237ad689d
Python
25,046
693
import copy from functools import partial import json import logging import os import pickle from typing import Optional, Sequence, List, Any import ml_collections as mlc import numpy as np import pytorch_lightning as pl import torch from torch.utils.data import RandomSampler from openfold.data import ( data_pipe...
e261ba021142ab1e0f08e76e4de8166f0687511928d76ad6565ff19a1f403c7d
Python
25,049
569
# Imports import sys import os import argparse import inspect from datetime import datetime import numpy as np from tqdm import tqdm from math import ceil from time import perf_counter, process_time import torch import torch.optim as optim try: from torchdiffeq.__init__ import odeint_adjoint as odeint except Impo...
f56eeec55723edf4498af620b027baeb9780bb055c17cc67607280a671629ab5
Python
25,070
522
import argparse, os from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm import matplotlib.pyplot as plt from matplotlib.lines import Line2D import seaborn as sns from matplotlib.backends.backend_pdf import PdfPages import matplotlib.ticker as mticker import polars as pl import re from...
390b0e1ef1cf426c6fa370eec417f354b31cda80de39b1836a2d7421be9fccb3
Python
25,072
572
import unittest import gc import os import matplotlib.pyplot as plt import numpy as np from pensa.clusters import \ obtain_clusters, wss_over_number_of_clusters, \ obtain_combined_clusters, wss_over_number_of_combined_clusters, \ write_cluster_traj from pensa.statesinfo import \ get_discrete_states f...
6a0b4ecf854487a96717280fbd8961a4f513c2c5c396abacdd1142d223e8a0d8
Python
25,078
611
""" Analyze perses calculations for a benchmark set of ligands annotated with experimental data """ # SDF filename containing all ligands annotated with experimental data # Ligands should be annotated with experimental data using the SD tags # EXP_BINDING_AFFINITY_IN_KCAL_PER_MOL # EXP_BINDING_AFFINITY_IN_KCAL_PER_MO...
293a0dc6fe52203debf4136c4b113c6a295a0282d5d85ff7f893404c286e2db3
Python
25,089
610
"""Derivations of standard content blocks from Google (GenAI) content.""" import base64 import re from collections.abc import Iterator from typing import Any, cast from langchain_core.messages import AIMessage, AIMessageChunk from langchain_core.messages import content as types from langchain_core.messages.content im...
370d4c422a0f1e465b46354989fb18cb35f28f257b77d902e438c8d84644c796
Python
25,089
548
import warnings import numpy as np import torch import gymnasium as gym from typing import Any class Environment(gym.Env, torch.nn.Module): """Base class for environments. Args: effector: :class:`motornet.effector.Effector` object class or subclass. This is the effector that will evolve in the environm...
a7441996c0d3e687aad108f0a7409f8a72efc4f7f148b59d78cdd480355eba90
Python
25,103
665
import multiprocessing import re import warnings from abc import ABCMeta, abstractmethod from collections import OrderedDict from pathlib import Path from typing import Any, Callable, Dict, List, Sequence, Tuple, Union import arviz as az import cmdstanpy import matplotlib.pyplot as plt import numpy as np import pandas...
a25bfa026fd03ae4a7ae55e54eaf627fced3f20f0824ac0526d79737aa962b47
Python
25,109
535
"""cohort/batch-analysis endpoints: loading an accumulated cohort spreadsheet, running the one thing that genuinely needs a real numerical library (inferential statistical tests, via scipy.stats - everything else in the cohort workspace, descriptive stats and plotting, runs client-side in JS, see frontend/src/workspace...
52588b4b44773664fb665eabb02930e26ade3e6426952c792ec0354e1662e313
Python
25,112
715
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Interfaces to deal with the various types of fieldmap sources. .. testsetup:: >>> tmpdir = getfixture('tmpdir') >>> tmp = tmpdir.chdir() # changing to a temporary directory ...
69a161f814212148e3f920035621be1a6be6a8fd44be9d8e8d6ec1693c20ea0f
Python
25,130
591
#################################################################################### # # 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...
47e36f1131a351dcd014fa92e70f61e0fa7551addcc68aec191e26e86bba8ddc
Python
25,155
740
import torch, math import torch.nn as nn from typing import Optional, Tuple from h3xsemble.model.primitives import Linear, ipa_point_weights_init_, LayerNorm from h3xsemble.utils.rigid_utils import Rotation, Rigid from h3xsemble.utils.tensor_utils import ( dict_multimap, permute_final_dims, flatten_final_di...
08706ff6b29a269e40b6c1268642de8ae3f6f4fc6c0b28144a209b2ca92219cf
Python
25,184
690
from __future__ import annotations import logging import os import warnings from typing import TYPE_CHECKING import numpy as np import torch from scvi import REGISTRY_KEYS, settings from scvi.data import AnnDataManager from scvi.data._compat import registry_from_setup_dict from scvi.data._constants import _MODEL_NAM...
40cec874deae943b2ac57884d0f21c1bdb26245c92c4cbc4bbdf9ec381e59246
Python
25,197
749
########################################################################################### # Elementary Block for Building O(3) Equivariant Higher Order Message Passing Neural Network # Authors: Ilyes Batatia, Gregor Simm # This program is distributed under the MIT License (see MIT.md) ################################...
b9d27ff4307e233d127a86fd5d5e39365ade2f3ac75264f479ff8b7e76efbab7
Python
25,198
629
import os import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import networkx as nx from sklearn.metrics import confusion_matrix from sklearn.metrics import ConfusionMatrixDisplay import re from iteround import saferound from sklearn.utils import check_matplotlib_support from...
6c0f6a2896e78928e18a3764468fb89c3b1cab5a981665accb957f8b03c39d69
Python
25,246
693
from builtins import print import numpy as np import pandas as pd import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt # matplotlib.rcParams['font.family'] = 'sans-serif' # matplotlib.rcParams['font.sans-serif'] = 'Arial' import os import operator import utils from utils.constants import UNIVARIA...
9a598f4fd05c60c9a571664a7ba087765982b2a830d1cc24703a0826146ff1e8
Python
25,254
538
import os import matplotlib.pyplot as plt import numpy as np import torch from torch.utils.data import TensorDataset from data import generate_recog_data, generate_recog_data_batch, GenRecogClassifyData from net_utils import load_from_file import plotting, networks def choose_gen_data(net, chooseT=False...
1a922fca6a77276d820df9d04ae0e8472b71e38ae424907186893f4b579dd58e
Python
25,266
710
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is licensed under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with the # License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
983ce946009b48b98ec1261482c35f841fdbcfc97716d14f83bcea70b6680167
Python
25,281
652
from pathlib import Path from time import time import random from collections import defaultdict import argparse import warnings from tqdm import tqdm import numpy as np import torch from Bio.PDB import PDBParser from Bio.PDB.Polypeptide import three_to_one, is_aa from Bio.PDB import PDBIO, Select from openbabel impor...
d60279f8259dc8776afa08d9dfb067f70f8d557cc7c0348b7cfff49babc6dec9
Python
25,284
510
# Code from: https://github.com/PDillis/stylegan3-fun import os import re import json from typing import List, Tuple, Union, Optional from collections import OrderedDict from locale import atof import click import numpy as np import torch import torch.nn.functional as F import dnnlib # ----------------------------...
7e9392e8dc73ac9ed52b35ceb40f2ee62bc4b008d8db41e96bf659dab1362a20
Python
25,286
663
import torch from torch_geometric.data import Batch, Data from typing import Tuple, List from pdearena.pl_models.pdemodel import PDEModel from pdearena.configs.config import CFDConfig, PretrainedCFDConfig from pdearena.configs.registry import get_config from pdearena.utils.metrics import ErrorStats from pdeare...
d0d58ba89f9c5cc0b56c4bde70a503cfdca4c5644af120d6e51632b68ad6f8e7
Python
25,302
622
import pytest from qupkake.xtbp import XTBP, RunXTB from rdkit import Chem # Mock xtb output data xtb_output = """ ----------------------------------------------------------- | ===================== | | x T B ...
4e62de23bad29aa6dfab4ff870edfcac7a1a650621790e9a144c33217b03dd25
Python
25,325
863
import mxnet as mx from nowcasting.ops import \ conv3d, conv3d_act, conv3d_bn_act, \ conv2d, conv2d_act, conv2d_bn_act, \ deconv3d, deconv3d_act, deconv3d_bn_act, \ deconv2d, deconv2d_act, deconv2d_bn_act, \ fc_layer, fc_layer_act from nowcasting.config import cfg ### Network structure def encode_...
5724ea3c0858fa44cc7e02b077f59f3b826b0cb5b266aea03e828b08776f095c
Python
25,328
851
"""============== Motif pipeline ============== The motif pipeline runs a set of motif discovery and enrichment analysis on a set of intervals. * Motif discovery using MEME * Motif detection using MAST * requires a set of known motifs Usage ===== See :ref:`PipelineSettingUp` and :ref:`PipelineRunning`...
113f4ab0929e156a3249ac66438064add1219dbec92765ac53d447d39440474d
Python
25,341
691
import numpy as np import torch import torch.nn as nn import torchvision from torchvision import models from torch.nn import init import torch.nn.functional as F # convnet without the last layer class ContBatchNorm3d(nn.modules.batchnorm._BatchNorm): def _check_input_dim(self, input): if input.dim() != 5...
c0367da54a4310ddeecf97bec53ce7378e4c738e4c3f9433d1415334612d116e
Python
25,347
835
# 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...
d2407d2e485b25976c92f61bb69f83173f647765e9739a2f750943e032f69285
Python
25,348
534
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
42aa009a6f283704fadaba845b6a647204ecd0b95dafd9633178b512d1c84c86
Python
25,365
651
from re import sub import copy import os from .tokenizer import Tokenizer from .data_helper import DataHelper from .token_merger import ClassifierChunkParser class Normalizer(): def __init__(self, half_space_char='\u200c', statistical_space_correction=False, ...
ba63880480fd31a73c6b182a4b886c6251bf8822cebe29fc96aa071c16c6bd72
Python
25,410
506
import os import pathlib import time from typing import Union, List, Literal import equinox as eqx import numpy as np import torch import torch.nn.functional as F import wandb from einops import rearrange, repeat, pack, unpack, reduce from torch_scatter import scatter, scatter_std from torchdiffeq import odeint as nn_...
e2e0a7f1ec3e6d3086c3e748cb4b0894c1633f37bd717649a3d1a767fb98317d
Python
25,413
504
import os import pathlib import time from typing import Union, List, Literal import equinox as eqx import numpy as np import torch import torch.nn.functional as F import wandb from einops import rearrange, repeat, pack, unpack, reduce from torch_scatter import scatter, scatter_std from torchdiffeq import odeint as nn_...
40699331cbf63a3f50497692c4789cb016747bbb19a6780b92b0855486c0afb2
Python
25,425
653
import pandas as pd import numpy as np import random import sys import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import warnings warnings.filterwarnings("ignore", message="numpy.dtype size changed") warnings.filterwarnings("ignore", message="numpy.ufunc size changed") from multiprocessing import Process, M...
84ff372845db72c7d406d1eaeb5ce9aa7e3733b974222db0b3cd9033ea8a3020
Python
25,487
558
#!/usr/bin/env python # -*- coding: utf-8 -*- #Version 5.5 import xml.dom.minidom as dom import xml.dom from decimal import * import sys import os import datetime #from Numeric import * # Dokument erzeugen implement = xml.dom.getDOMImplementation() ###################Globale Variablen################### musicbrain...
d2fbf50da1196a336f95f3f18c26c2bc2d0a02b76346a4cd63c0c70ee68f933b
Python
25,509
617
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import pytorch_lightning as pl from torchmetrics import R2Score from pytorch_lightning.strategies import DDPStrategy import seaborn as sns import torch from lightning_lite.utilities.seed import seed_everything from torch.optim import SGD, Adam fro...
9bfc34f5d36f625671eb47f671f31538da6664d133c9b7094e44b1b09391ebb2
Python
25,510
508
#!/usr/bin/env python3 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1' import sys import json import keras from keras import layers from keras import backend as K import tensorflow as tf from talos.utils.exceptions import TalosParamsError from time import time import pandas as pd import numpy as np import logging i...
d93952ae338e365ed43300b83f7ee497fdaa56a1e8e98e82df79fb2b1c8cfd19
Python
25,529
728
""" 2023.08.30 author: femke.hurtak@epfl.ch Script to compute the connectivity statistics for specific neuron sets. """ import os import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes import seaborn as sns import numpy as np from scipy import stats, sparse i...
342b7a668aa3d688b413e588f9bbbd79452828726ba9d00d8adc73c742d2ae78
Python
25,554
664
# main file for CNN classifier # Created: 9/2/2021 # Status: in progress # CUBLAS_WORKSPACE_CONFIG=:4096:8 python inception.py from collections import namedtuple import warnings import torch from torch import nn, Tensor import torch.nn.functional as F from typing import Callable, Any, Optional, Tuple, List from sklear...
80c3c18af1928a70e9755dd4e515897fcc78c0efa59b6fddf8a0228a14b427ab
Python
25,555
615
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import functools from typing import Optional import os import h5py import torch import torchdata.datapipes as dp from torch_geometric.data import Data from pdearena.data.datapipes_common import build_datapipes from pdearena.configs.confi...
cc669467195c44443c8939f11a3c464d8268e917ecab3e7468c9e884713b03f0
Python
25,581
765
"""Tracer that streams run logs to a stream.""" from __future__ import annotations import asyncio import contextlib import copy import threading from collections import defaultdict from pprint import pformat from typing import ( TYPE_CHECKING, Any, Literal, TypeVar, overload, ) import jsonpatch ...
a52974116d7cfd2f324369504f1a923ee7e7e0176a19bf444cff924e1374a353
Python
25,593
616
# 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...
aad92cb520a18e4f17a8011be0c96bdd920cc13b9adb7a291341abb7e06dafde
Python
25,676
587
# Imports import sys import os import argparse import inspect from datetime import datetime import numpy as np from tqdm import tqdm from math import ceil from time import perf_counter, process_time import torch import torch.optim as optim try: from torchdiffeq.__init__ import odeint_adjoint as odeint except Impo...
c88c29f306b6cb28dc30760354d6c1c6dd11568af665b60a62848bca5600f472
Python
25,704
589
# Imports import sys import os import argparse import inspect from datetime import datetime import numpy as np from tqdm import tqdm from math import ceil from time import perf_counter, process_time import torch import torch.optim as optim try: from torchdiffeq.__init__ import odeint_adjoint as odeint except Impo...
5ed48a935c071724a6dba84bd474a75b424ab8a023efac0f58b9fcdd4d288516
Python
25,711
783
""" Tables for processing individual recordings """ """ Main tables for loading individual recordings and processing responses """ from glob import glob import os import warnings import numpy as np import pandas as pd import datajoint as dj from scipy.interpolate import interp1d from scipy.signal import savgol_filt...
9563d1ca9e991239a1b1547f581fcc32955b74669002cdc59bb11b926ce7ac63
Python
25,715
598
""" Defines model classes to store thumbnail data in text and/or image formats. """ import json from typing import Text import numpy as np import pandas as pd from io import BytesIO from PIL import Image import base64 import copy from .datasets import ColumnarData from .utils import Field, standardize_json class Thum...
e56a82b27a14436def0e17b6e13fe40ee5382c12c52a9c1c749bcc555bc22d39
Python
25,715
618
#!/usr/bin/env python import argparse arg_parser = argparse.ArgumentParser() arg_parser.add_argument("chain_file", help="list of PDB and chain ids and their corresponding assemblies") arg_parser.add_argument("structures_directory", help="directory where structures are stored") arg_parser.add_argument("output_directory...
cda12c606eb8a83fa1a3077302a18de0ac19bf131437d3513f60793a2ccd3e9d
Python
25,783
724
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import List, Optional, Tuple, Union import torch from torch import nn import math from pdearena.utils.activations import ( ACTIVATION_REGISTRY, SinusoidalEmbedding ) from pdearena.configs.config import Config from torch_geome...
447b882e1a722e3d61aac98ca1a899e52461962bb0dddc8e6b81ad7828d7a178
Python
25,850
710
import logging import platform import tempfile from pathlib import Path import dask.array as da import h5py import numpy as np import pytest import tiledb from tifffile import tifffile from astrocast.helper import SampleInput from astrocast.preparation import Delta, IO, Input, MotionCorrection class TestDelta: ...
ddd714b9de3582b7cdae315108c98e2a2cf94de1337a6f4feeff420128f20f33
Python
25,855
735
import ast import glob import logging import traceback from abc import ABC from typing import Any, Tuple, Union import numpy as np import torch from rdkit import Chem from rdkit.Chem import AllChem, Descriptors3D, Lipinski from rdkit.Chem.rdmolops import GetAdjacencyMatrix from torch_geometric.data import Data from ....
283aa6c58fa9c5d0f0e935e54eb0cec683b8c4d2aacea3f1f1f18dff07402632
Python
25,856
573
import copy import math import numpy as np import torch import torch.nn as nn import warnings class MLP(nn.Module): def __init__(self, input_size, hidden_size): super(MLP, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.fc1 = torch.nn.Linear(self.i...
cf0fcfc59cf136f7bdaa5ac83a39e2afba72ac8b711d25fb683f6ceeded6850b
Python
25,856
804
# This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it. import torch from torch.library import triton_op, wrap_triton import triton import triton.language as tl from nequip.nn import scatter from ._contract import Contracter from ._lexsort import lexsort ...
464b2cd7091564b2d4b7f27f93b0b196c8504ef511c044207f9f8e360afb7311
Python
25,859
482
from __future__ import print_function import numpy as np import logging import copy from openmmtools.alchemy import AlchemicalState _logger = logging.getLogger("lambda_protocol") _logger.setLevel(logging.INFO) class LambdaProtocol(object): """Protocols for perturbing each of the compent energy terms in alchemica...
991d0638944abbde7565fcea051221679668d617351118d041b39020727f3836
Python
25,860
670
import os os.environ["CUDA_VISIBLE_DEVICES"]="2" import sys sys.path.insert(0,"/examples") from modulusDL.models.arch import CustomModuleArch, InheritedFullyConnectedFlexiLayerSizeArch, FullyConnectedFlexiLayerSizeArch, SingleInputInheritedFullyConnectedFlexiLayerSizeArch, CaseIDtoFeatureArch from modulusDL.eq.pde impo...
00c8750966bb638cef68dfde3645dcaf0fce53cbb0feee1ea0c8d6d96725c7ee
Python
25,876
676
from collections import namedtuple from functools import partial from typing import Any try: from collections import Iterable except: from collections.abc import Iterable import numpy as np import torch from skimage.transform import rescale def transform_function(img, behavior, key): """ Function th...
c89fc8b759da364891d6ec0badb20810482605be10f7a6e7ce0e1b1d6e9d242d
Python
25,877
582
#!/usr/bin/env python import logging import pysam import json import argparse, sys, os.path import math, time from argparse import RawTextHelpFormatter import svtyper.version from svtyper.parsers import Vcf, Variant, Sample, confidence_interval from svtyper.utils import * from svtyper.statistics import bayes_gt # -...
57c1ac70174b647dd7c12059681ecc8d507d882e541d363476bcf71d2e3ec521
Python
25,898
636
import os.path import torch # from protein_learning.common.data.data_types.protein import safe_load_sequence from collections import defaultdict # from rde.utils.protein.pdb_utils import ( # extract_atom_coords_n_mask_tensors, # extract_pdb_seq_from_pdb_file, # ) from rde.utils.protein.helpers import disable_t...
5194534355064af0a8b2709554be52f25e0f65319baf97d70a31ba81f38b7638
Python
25,901
678
""" Classes for creating patient objects compatible with TWSTRS. """ import logging import numpy as np import pandas as pd #import simdkalman from scipy import ndimage from scipy.signal import medfilt from .structural_features import compute_distances from .utils import pre_high_pass_filter, pre_low_pass_filter from ....
ce1fa471c584b74635cbe5545d510178b6c278b4a58b33a57a66c602648fac78
Python
25,901
483
from __future__ import print_function import numpy as np import logging import copy from openmmtools.alchemy import AlchemicalState logging.basicConfig(level=logging.NOTSET) _logger = logging.getLogger("lambda_protocol") _logger.setLevel(logging.INFO) class LambdaProtocol(object): """Protocols for perturbing eac...
b74ecb35b56b3d95cc60c973b8c29738d88bac45fe5a48ccd2be234d960ca497
Python
25,904
668
import os os.environ["CUDA_VISIBLE_DEVICES"]="1" import sys sys.path.insert(0,"/examples") from modulusDL.models.arch import CustomModuleArch, InheritedFullyConnectedFlexiLayerSizeArch, SingleInputInheritedFullyConnectedFlexiLayerSizeArch, CaseIDtoFeatureArch from modulusDL.eq.pde import NavierStokes_CoordTransformed i...
b89f733269990d0b9630cf8cff5669f1e0b112a4de6ad1ed9a6d1e8d377ef556
Python
25,920
589
import Bio.PDB import Bio.PDB.vectors import torch from torch.utils import data import torch.nn.functional as F import json import numpy as np import os import re import glob import common.atoms import seq_des.util.canonicalize as canonicalize import seq_des.util.voxelize as voxelize CHI_BINS = np.linspace(-np.pi,...
27512f23140743211ca70281e779b3057a67c211682e7c3b6ba0851a7550bb84
Python
25,926
513
import torch import numpy as np from typing import Any, Union class Skeleton(torch.nn.Module): """Base class for `Skeleton` objects. Args: dof: `Integer`, number of degrees of freedom of the skeleton. Typically this is the number of joints. space_dim: `Integer`, the dimensionality of the space in which t...
a4f607691553dc36de9bd5619e44f5f4d7cfbfd3969820f36ce9915921c0e5cd
Python
25,967
679
# This file takes all available input data and trains the regressors # using the prescribed preprocess methods. # It displays time domain estimates for all data files as well as # sensitivity plots for sensor channels and estimates import time import os import numpy as np import pandas as pd import matplotlib.pyplot ...
3370f52580f8cc9458420f61cd36eb6fe6abde5cdd9cffcfc130bb7258a99608
Python
25,994
508
''' Test module for AE trainer. :Version: 1.0 :Date: 08.02.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 This program is free software: you can redistribute it and/or modify it under the terms o...
f3653b44da2b6b44037f5d7d5df4170f81906ebcdcdbeeb64cd184cfbbd719b4
Python
26,076
739
import logging import os from fcest.models.sliding_windows import SlidingWindows from fcest.models.wishart_process import VariationalWishartProcess, SparseVariationalWishartProcess from fcest.helpers.array_operations import to_correlation_structure from fcest.helpers.data import to_3d_format import gpflow import matpl...
f81c4458dae15a397546383197191a5956d4e245ce38e385490863ca4aed8ec9
Python
26,078
549
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test State classes in mcmc.py. """ # ==========================================================================...
a016daddf997bb56a5890f663d3e3f8b15f72378c8d4882833cd38457a9d3707
Python
26,099
545
import chrombpnet.parsers as parsers import os from chrombpnet.data import DefaultDataFile, get_default_data_path from chrombpnet.data import print_meme_motif_file import chrombpnet.pipelines as pipelines import copy import pandas as pd import logging logging.getLogger('matplotlib.font_manager').disabled = True # invo...
4a5fc589a344deedbc23a48e89480a876f1ad1e6f474f16d2dd5bb40dbf1a973
Python
26,102
633
#################################################################################### # # 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...
4a467ab87037a0fb9f6c29d1f3962e0b6560567ade57128438d95a34dd276b2f
Python
26,107
858
""" Different kind of non linear activation functions and their derivatives. :Implemented: # Unbounded # Linear - Identity # Piecewise-linear - Rectifier - RestrictedRectifier (hard bounded) - LeakyRectifier # Soft-linear - Ex...
e0ecdc558c248f471d08f492816c3b28fb06bc43b567853cde91406e2b46cd22
Python
26,131
771
from typing import Any from unittest.mock import MagicMock, patch from packaging import version from pydantic import BaseModel from syrupy.assertion import SnapshotAssertion from typing_extensions import override from langchain_core.language_models import FakeListLLM from langchain_core.messages import BaseMessage fr...
db07c1e4fcc7bbce5b9d68c1791dc5aa4d055dd8d7116530fe3485d46abf0e46
Python
26,162
619
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ train_ae_head.py ================ Train an AE encoder with domain adaptation (DANN / inverseTriplet / normae) **without** any neural-network classification head. Every epoch the training loop is: 1. Forward pass: enc, rec = AE(inputs) 2. Loss: reconstruction + gam...
235198132e756402a1b4b20dca36f12e316cb8f14ced5c0a151f02e169b84c5a
Python
26,166
737
import torch.nn.functional as F from torch_geometric.nn import GATConv, LayerNorm from torch_geometric.nn import TopKPooling import torch.nn as nn from torch.nn import Linear import torch """ Appling pyG lib """ ###################################################################################### # origi...
ccb961c3098b8a6dfb7546af346c0e5ad9c7fff0dc657a4679b3d0e2c178d8a2
Python
26,184
785
#!usr/bin/python ## Pairwise distance estimation for homologous and non-homologous TCR CDR3 sequences ## immuno-Similarity Measurement by Aligning Receptors of T cell (iSMART) ## Apr 14th, 2018, first version ## Ultra-fast alignment version for iSMART, based on motif finding, July 15th, 2018 ## Motif-guided iSMART (Mi...
0fc75d1482bcfc0f095afd27a7d12323a6474e0e714bdc6560a9ba5abb81cb15
Python
26,232
582
''' The MSN class defining the cell ''' from neuron import h import numpy as np import json # Distributions: ''' T-type Ca: g = 1.0/( 1 +np.exp{(x-70)/-4.5} ) naf (den): (0.1 + 0.9/(1 + np.exp((x-60.0)/10.0))) ''' def calculate_distribution(d3, dist, a4, a5, a6, a7, g8): ''' Used for setting the maximal c...
2d4ca8a053fe24062d6b945daf44e2cc1c65331e98fc474509a9b3b258607a9b
Python
26,257
601
#!/usr/bin/env python # -*- coding: utf-8 -*- import xml.dom.minidom as dom import xml.dom from decimal import * import sys import os import datetime #from Numeric import * # Dokument erzeugen implement = xml.dom.getDOMImplementation() ###################Globale Variablen################### task=None choosen_tag={}...
7d1d43d607b7d8f2d34da11bc4d476594029c5eab22face67ea2a6dd1f2a2068
Python
26,261
615
"""Caduceus model for Hugging Face. """ import math from functools import partial from typing import Optional, Tuple, Union import torch from mamba_ssm.modules.mamba_simple import Mamba, Block from torch import nn from torch.nn import functional as F from transformers import PreTrainedModel from transformers.modelin...