sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0ca952bba2e33bd06c2f36b69d304118af37df20809923d83b05847519222cf4 | Python | 9,045 | 279 | """Load question answering chains."""
from collections.abc import Mapping
from typing import Any, Protocol
from langchain_core._api import deprecated
from langchain_core.callbacks import BaseCallbackManager, Callbacks
from langchain_core.language_models import BaseLanguageModel
from langchain_core.prompts import Base... |
b13d854ee19b3bb92c196b49270a00b4ec2d7470284aa6ac5d92e01bc83a0e8d | Python | 9,046 | 264 | import logging
import os
import subprocess
import pytest
import simtk.openmm.app as app
import yaml
from openmmtools import mcmc
from openmmtools.multistate import MultiStateReporter
from pkg_resources import resource_filename
from simtk import unit
from perses.annihilation.lambda_protocol import LambdaProtocol
from ... |
abc515f6b6a9099d4c3f15a571e92b36ac830d67d0eb81f0e8f3f6f742f1efb8 | Python | 9,048 | 209 | # 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... |
deca229536ececace4adc4cf7f74e996cd071afb677c83ac13d6602fb2580405 | Python | 9,049 | 258 | ########################################################################
# 1D diffusion in a finite tube with fully-reflective boundary.
# Circular "point source" from one face.
# AIMS: to verify STEPS spatial-deterministic solver 'TetODE' supports
# local initial condition on boundary, calculates volume diffusion ... |
02efbeaba63e3633ae87d7b628564cbc4d68b21c5f1d3f0ce7de6046fe53959e | Python | 9,052 | 234 | """
Diagnostics printed when flow training loss spikes abnormally.
Used by ``FlowLossSpikeCallback``.
"""
from __future__ import annotations
import sys
from pathlib import Path
from typing import IO, Optional, TextIO, Union
import torch
from scdp.model.coeff_flow_matching import (
coeff_norm_denominator,
p... |
b4ee6d3b85fb1307e1faebab236a741de060d559ea079bdbd20eb1f7c2cf4965 | Python | 9,053 | 180 | import tensorflow as tf
from dipgnn.models.model_utils import swish
from dipgnn.models.initializers import GlorotOrthogonal
from dipgnn.models.layers.embedding_layer import EmbeddingLayer
from dipgnn.models.layers.gaussian_expansion import GaussianExpansion
from dipgnn.models.layers.bessel_basis_layer import BesselBasi... |
71ff9e2a275cad9478cc162746c620916fa82f247ae94fe0ce0c98a200dc3213 | Python | 9,059 | 273 | # -*- coding: utf-8 -*-
"""
Created on Wed May 5 20:08:52 2021
@author: Xingyan Liu
"""
import came
from came import pipeline, pp, pl
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt # optional
import seaborn as sns # optional... |
fae73071e3af2206968fb4432d3f3efb8a7ba7e050498072130a44d24eb2a80a | Python | 9,059 | 273 | # -*- coding: utf-8 -*-
"""
Created on Wed May 5 20:08:52 2021
@author: Xingyan Liu
"""
import came
from came import pipeline, pp, pl
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt # optional
import seaborn as sns # optional... |
194ae1eb3ca53f5a4fd9e1fb3bae12c101d7621c8953446661b6cf7b52c70e43 | Python | 9,062 | 302 | '''
code is adjusted from the Wang et al 2025 "Foundation model of neural activity predicts response to new stimulus types" implementation
Specifically
* https://github.com/cajal/fnn/blob/main/fnn/model/pixels.py
* https://github.com/cajal/fnn/blob/main/fnn/model/perspectives.py
'''
import torch
from torch import nn
d... |
37d8a871178027699ce48f3d1b2649722610c2c669724d0da68c938fb1ce5a72 | Python | 9,063 | 204 | # -*- coding: utf-8 -*-
# @title Sweep organoid modeling
# @file sweep_org_modeling.py
# @author Romain Beaubois
# @date 01 May 2023
# @copyright
# SPDX-FileCopyrightText: © 2023 Romain Beaubois <refbeaubois@yahoo.com>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# @brief
#
# @details ... |
acf9cde387c94c53607c5239a64798e11798b6061d7e78f5b87c06efe95fcea1 | Python | 9,063 | 263 | """Tests for verifying that testing utility code works as expected."""
import time
from itertools import cycle
from typing import Any, cast
from uuid import UUID
import pytest
from typing_extensions import override
from langchain_core.callbacks.base import AsyncCallbackHandler
from langchain_core.language_models imp... |
f7c1c59172a17426d7ea57676db2209fda2f39635e452bc955e6a245d88a3c65 | Python | 9,063 | 274 | '''
runSPP.py - wrap spp peak caller
========================================
:Tags: Python
Purpose
-------
Runs the spp peak caller.
The workflow follows the tutorial at:
http://compbio.med.harvard.edu/Supplements/ChIP-seq/tutorial.html
Usage
-----
Documentation
-------------
Requirements:
* spp >= ?
* snow >... |
a628adbe76107d336e4530361ee1e214bd45b1c25ccde2dd546a921e5634a96c | Python | 9,066 | 258 | ########################################################################
# 1D diffusion in a finite tube with fully-reflective boundary.
# Circular "point source" from one face.
# AIMS: to verify STEPS spatial-deterministic solver 'TetODE' supports
# local initial condition on boundary, calculates volume diffusion ... |
31606b82c5d2169d5ddaeb9791f78f9fc11a6df25e2e399dddc985f398b4afd4 | Python | 9,067 | 211 | __authors__ = ["srhmm", "Nimish-4", "ankurankan"]
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
from pgmpy import config
from pgmpy.base import DAG
from pgmpy.causal_discovery._base import BaseCausalDiscovery
from pgmpy.structure_score import BaseStructureScore, get_scoring_method
class TOPIC(Ba... |
604476e7fe20e076ca0dafa5baf7fc47d29b8c47324cfee1f4e62e61a86a3be0 | Python | 9,070 | 278 | import argparse
import os
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
from torchvision import transforms
from tqdm import tqdm
from bindsnet.analysis.plotting import (
plot_input,
plot_spikes,
plot_voltages,
plot_weights,
)
from bindsnet.datasets import MNIST
... |
7bb131738347e87c8d9a4734adc06cd8ff4fb425e90a60d88550d7e4e203a519 | Python | 9,075 | 206 | # coding=utf-8
import os
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
from torch.cuda.amp import autocast
import torch.autograd as autograd
from torch.autograd import Variable
from torchmetrics import PeakSignalNoiseRatio as PSNR
from skimage.transform import resize
from alg.p... |
ec14c1d997d02305b2e0222e1c7c6fc8bf56a94fa8cb893e0c3f8488c19c7caf | Python | 9,075 | 222 | import os
from config import (
CONDITION, SUBJECT_ID, DATA_DIR, ROI_DIR, TEMPLATE_PATH,
OUTPUT_DIR, DEFAULT_REST_RUNS, CONDITION, DEFAULT_ROIS,
DEFAULT_MOTION_CONFOUNDS
)
from utils.process_roi import (
initialize_roi_dict,
process_roi_mask,
threshold_roi_mask,
dilate_binary_roi_mask,
)
... |
6bcc0fdddbfc70e1c9f4a69e58c5be4c8798e32ad0617123a2eb7e93991e3b2c | Python | 9,077 | 273 | # -*- coding: utf-8 -*-
"""
Created on Wed May 5 20:08:52 2021
@author: Xingyan Liu
"""
import came
from came import pipeline, pp, pl
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt # optional
import seaborn as sns # optional... |
7bc46a81921f8f5e1075b48cee5861212578bc0b4c8c779e68676fa9292886c4 | Python | 9,077 | 272 | """test_scripts.py
==================
nose test script for cgat scripts
This script builds test cases from directories in the :file:`tests`
subdirectories. Test data for scripts are contained in a directory
with the name of the script and described in a :file:`tests.yaml`
within that directory.
To permit the paralle... |
d0d7a29241eada0d0e2a31fbe0179a18ca833e4a92bf8f78eea34e87e05e9a6c | Python | 9,077 | 273 | # -*- coding: utf-8 -*-
"""
Created on Wed May 5 20:08:52 2021
@author: Xingyan Liu
"""
import came
from came import pipeline, pp, pl
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt # optional
import seaborn as sns # optional... |
c9ccc872cf84d73f3c80b42fecda98d6ca64c5f32ef9ab5196deb4779cda1db2 | Python | 9,084 | 352 | # 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... |
c191327b9a8904bb74eff51099a77641e8c29a1f12735a8b5ca30a8a3dc024e1 | Python | 9,088 | 273 | # -*- coding: utf-8 -*-
"""
Created on Wed May 5 20:08:52 2021
@author: Xingyan Liu
"""
import came
from came import pipeline, pp, pl
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt # optional
import seaborn as sns # optional... |
237c8ae278f136c1d9aa8e419b1fa0383194841d63f5501f1340fe64d1e07cda | Python | 9,093 | 273 | # -*- coding: utf-8 -*-
"""
Created on Wed May 5 20:08:52 2021
@author: Xingyan Liu
"""
import came
from came import pipeline, pp, pl
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt # optional
import seaborn as sns # optional... |
d8ba692ca5400503d9d81e19967803866c8fd2e379bb9814f33b116e34d146d1 | Python | 9,097 | 273 | ####################################################################################
#
# 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... |
12cdd4d0f10a31aa79b6430621ececd3111117b47719b316607cbdf3f1b338fd | Python | 9,098 | 273 | ####################################################################################
#
# 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... |
671daf5613bec0e3eb6af47515cc451ed25726eb15f5aa61c9edcc18682e140e | Python | 9,098 | 273 | # -*- coding: utf-8 -*-
"""
Created on Wed May 5 20:08:52 2021
@author: Xingyan Liu
"""
import came
from came import pipeline, pp, pl
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt # optional
import seaborn as sns # optional... |
3bf1ea4920bb7c355e633a45471d2b86bd181dea9f3d0534605eabc82c015e04 | Python | 9,102 | 247 | ####################################################################################
#
# 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... |
01e7b8a9996ffc59f810b8735270e7e92deff982a5ab891853d46471cc09df25 | Python | 9,105 | 239 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 8 15:38:23 2022
@author: biener
"""
import os
from typing import Optional
import torch
from torch.nn import functional as F
import torch.nn as nn
from torch.autograd import Variable
from torch import Tensor
import numpy as np
import copy
import tk... |
cb0dd16729c3f57e9e3315af4a054066f28979a6ad57d29b2593717f336ac755 | Python | 9,106 | 218 | import torch
from torch import nn
from torch.nn import functional as F
from .utils import (
round_filters,
round_repeats,
drop_connect,
get_same_padding_conv3d,
get_model_params,
efficientnet_params,
Swish,
MemoryEfficientSwish,
)
class MBConvBlock3D(nn.Module):
"""
Mobile Inve... |
00b0937ed89500d2e1e559face6cb5659439de65b5795d2790247a744b690b2a | Python | 9,111 | 265 | #!/usr/bin/env python
"""
Generate protomers using Epik.
"""
from __future__ import print_function
import os
import re
import traceback
import numpy as np
from openmoltools import schrodinger
from perses.utils.openeye import smiles_to_oemol
MAX_ENERGY_PENALTY = 10.0 # kT
def read_molecules(filename):
"""Read a... |
83705eb18fa4b511dece2318058f7c44d46212450d00782097c2fe4eca2ffddf | Python | 9,119 | 185 | ####################################################################################
#
# 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... |
2764041fb86ec3c73511e8d00537a53c9d010d9e34e4202fbc25c7c3c1927db4 | Python | 9,123 | 213 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Description: :
@Date : 2022/07/15 16:43:38
@Author : Zilan Yu
@version : 1.0
'''
import os, sys
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import keras_metrics as km
import numpy as np
import pandas as pd
import keras
from ke... |
a6a67f61e0c2c8c6f450db606c01a52ddfd06a4884652ff34c46c315e02fcb09 | Python | 9,123 | 243 | # 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... |
c73671b962bf9779a85bb1adf312e99fd2567a783dfe1d286c147abe52316304 | Python | 9,133 | 156 | from importlib.util import find_spec
import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies, _safe_import
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import OneHo... |
5260ef49aeb98118d4e6a2371729f02d1b96ee9d5f2c291333deeb77a64999f0 | Python | 9,136 | 234 | ###########################################################################################
# Implementation of the symmetric contraction algorithm presented in the MACE paper
# (Batatia et al, MACE: Higher Order Equivariant Message Passing Neural Networks for Fast and Accurate Force Fields , Eq.10 and 11)
# Authors: I... |
d87b5e37cbba1858b594630f3de4173f6ac143aa8c538029626d4c996368575f | Python | 9,139 | 248 | import os
import pandas as pd
import torch
import numpy as np
from torch_geometric.data import Data
import warnings
warnings.filterwarnings("ignore")
import pickle
from tqdm import tqdm
from torch_geometric.data import DataLoader
import random
import torch.nn as nn
import torch.optim as optim
from torch_geometric.nn im... |
ce6966047ec67a96c32cb73751c1eab730228a904bc2c869de39fc8b536b135d | Python | 9,140 | 222 | """
Script to perform analysis of perses simulations executed using run_benchmarks.py script.
Intended to be used on systems from https://github.com/openforcefield/protein-ligand-benchmark
"""
import argparse
import glob
import itertools
import re
import warnings
import numpy as np
import urllib.request
import yaml
... |
92973008850098be7424c9269a68ba6bf1d4a381ea3ba674f0d3161964961051 | Python | 9,142 | 224 | from tqdm.notebook import tqdm
from ..models.zephir import ZephIR
from ..models.losses import *
from ..utils.utils import *
def plot_loss_maps(
keypoint_to_visualize,
frame_to_visualize,
reference,
map_resolution,
map_size,
trajectory,
container,
dimmer_ratio,
grid_shape,
fove... |
1e6041f01cf8d3ae774fe7b7540451a0575595dc92bec3df42569f6e6ab2cf6e | Python | 9,147 | 267 | """Chat message history stores a history of the message interactions in a chat."""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any
from pydantic import BaseModel, Field
from langchain_core._api import deprecated
from langchain_core.messages import (
A... |
586a53fad242400af8e0719ac1e0d453254742098c277ada3a2786a9594220ad | Python | 9,148 | 224 | import torch
from math import pi as PI
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
import sys
sys.path.append("..")
from utils import xyz_to_d
class ... |
920af94d9e6d16484ea8fa6ae96ac1f53f43c40e2dda200cb95ebf9e7fe14b9a | Python | 9,149 | 302 | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import json
import logging
import os
import random
from io import open
import numpy as np
import yaml
from easydict import Eas... |
ce097b352c2bc1fc1f0148ab4eedb1c269d0cee6c5555a2067a99ba5184ad75f | Python | 9,149 | 266 | # Python SPRiNT
# Author: Luc Wilson (2023)
from math import floor
from statistics import median
from itertools import compress
import numpy as np
import os
import csv
import matplotlib
import fooof
from fooof.data import FOOOFResults
from fooof.sim.gen import gen_periodic
from fooof.sim.gen import gen_aperiodic
from ... |
f01b27461f69acb1dfbce9aa0bca3346f916da33680f2b2543ba08e99ef24fbd | Python | 9,152 | 277 | """
:AUTHORS: Martin M. Müller
:ORGANIZATION: Department of Neurobiology, Bielefeld University
:CONTACT: martin.mueller@uni-bielefeld.de
:SINCE: Mon Dec 13 15:34:40 2021
"""
import numpy as np
import pandas as pd
from utilities import mle_models as models
from utilities import mle_model_eval as mleval
def evaluate_... |
a8a112c56a75fce06cd6e118adf5f69ca7d0b79075b696558b99aa6b480cb5db | Python | 9,153 | 223 | import torch
import torch.nn as nn
from torch.hub import load_state_dict_from_url
__all__ = [
'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn',
'vgg19_bn', 'vgg19',
]
model_urls = {
'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth',
'vgg13': 'https://download.pyto... |
df5b1e29c325fa3e590cf2e47fde8e90b2edc890030335eeb6a37b4230644ac4 | Python | 9,154 | 228 |
from KineticAssembly_AD.vec_sim import VecSim
from KineticAssembly_AD import ReactionNetwork
import numpy as np
from torch import DoubleTensor as Tensor
import torch
import pandas as pd
from matplotlib import pyplot as plt
import matplotlib.colors as mcolors
import random
from scipy import signal
import sys
from matp... |
287c23e3190e4fb8a44737c9ad29e81684e6ba7ecb049693da84d3b17ab3e0f9 | Python | 9,155 | 230 | import os.path
import numpy as np
import pandas as pd
import pytest
from imagingplus.utils.io import import_obj
from pynwb.file import Subject
LOCAL_DATA_PATH = '/Users/prajayshah/data/oxford-data-to-process/'
REMOTE_DATA_PATH = '/home/pshah/mnt/qnap/Data/'
BASE_PATH = LOCAL_DATA_PATH
SUITE2P_FRAMES_SPONT_t005t006... |
183c68be8f3b56526209e0f767609affaf6dd07e0f364b123d3055f5d813804c | Python | 9,157 | 273 | from typing import Any
import pytest
from pydantic import ConfigDict, Field, model_validator
from typing_extensions import Self, override
from langchain_core.runnables import (
ConfigurableField,
RunnableConfig,
RunnableSerializable,
)
class MyRunnable(RunnableSerializable[str, str]):
my_property: s... |
1e22c9c288c474a035676c5de5f86d01bc75f06c4fb306e1313c07b5b1125601 | Python | 9,162 | 273 | ########################################################################
# Stochastic degradation-diffusion process.
# AIMS: to verify STEPS spatial stochastic solver 'Tetexact'
# supports spatially-separated initial conditions and computes
# diffusion and reaction rates correctly when applied to a
# degradation-di... |
6ef0fce68f3cea0c5c48ab3fd40ce5eb6e45a35d35bec88dedd74015b861c5bb | Python | 9,162 | 205 | import argparse
import sys
import time
import warnings
sys.path.append('./') # to run '$ python *.py' files in subdirectories
import torch
import torch.nn as nn
from torch.utils.mobile_optimizer import optimize_for_mobile
import models
from models.experimental import attempt_load, End2End
from utils.activations imp... |
cc3f55cc1087d8cb3b540c9c1eadffedb093344c02720d6848cac7d89cfceda7 | Python | 9,163 | 264 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Author: Yulia Rubanova
###########################
import gc
import numpy as np
import sklearn as sk
import numpy as np
#import gc
import torch
import torch.nn as nn
from torch.nn.functional import relu
import lib.utils as utils
from lib.... |
68cb099590e5b0d759afef94e85d195bc9cb2ba308a59790a70d305c1c3f20cd | Python | 9,164 | 205 | file_name = 'CellJ.json'
Step = 0.1 #ms
Edel = 100 #ms
stopTime = [10000] #ms
rangesL = [10000] #phase calculation crop limit low
rangesH = [-10000] #phase calculation crop limit high
signalInd = 0
import pandas as pd
import matplotlib.pyplot as plt
import efel
from matplotlib.backends.backend_pdf import Pd... |
c6552e662ad398e4ed2659b7fa190f98ffa0838436355b4877470c05d7c094a0 | Python | 9,169 | 199 | import os
import glob
import numpy as np
import matplotlib.pyplot as plt
from utils.constants import ALL_MODELS
from paths import TRAINING_DATA_PATH, TEST_DATA_PATH
from utils.distribution_distance import compute_jsd
from utils.compute_ensemble_average import compute_ensemble_average
RECOMPUTE = True
def compile_dist... |
c577900a9f357f37da676afa5128a8700254abadc286dc267231bfdf0e8f06c4 | Python | 9,173 | 298 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Authors: Yulia Rubanova and Ricky Chen
###########################
import os
import lib.utils as utils
import numpy as np
import tarfile
import torch
from torch.utils.data import DataLoader
from torchvision.datasets.utils import download_... |
4bab01d4276d311d0da4a6d62aef8965c56e14e09a50b2e928cd79f6f573d40a | Python | 9,175 | 272 | import time
import pytest
from blockbuster import BlockBuster
from langchain_core.caches import InMemoryCache
from langchain_core.language_models import GenericFakeChatModel
from langchain_core.load import dumps
from langchain_core.rate_limiters import InMemoryRateLimiter
@pytest.fixture(autouse=True)
def deactivat... |
4ec4919a97c356efe33b0e181219c3365268ed99ab11e5dd7f5e17967672aa99 | Python | 9,179 | 273 | ########################################################################
# Stochastic degradation-diffusion process.
# AIMS: to verify STEPS spatial stochastic solver 'Tetexact'
# supports spatially-separated initial conditions and computes
# diffusion and reaction rates correctly when applied to a
# degradation-di... |
2decf3040838c0567e2ba60f15b9522816db88f31d8cc17e69250091c1bdf8b8 | Python | 9,182 | 259 | # Import libraries
import numpy as np
import pandas as pd
import random
from numpy.random import seed
# Import machine learning libraries
import tensorflow as tf
import keras
from keras.models import model_from_json
from keras.layers import BatchNormalization
from keras.callbacks import ModelCheckpoint
from keras.op... |
98161f81c3bd05ae1445715f9d6a7bf888f930bf0e0d1037ebd2ee1090712bdc | Python | 9,188 | 209 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# :noTabs=true:
# (c) Copyright Rosetta Commons Member Institutions.
# (c) This file is part of the Rosetta software suite and is made available under license.
# (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
# (c) For more inform... |
58bcbeb1691e3b2afe154219749da5430720b573348b1d460db77a262d484c6d | Python | 9,191 | 248 | import inspect
from typing import List
import torch.nn as nn
from einops import rearrange
import src.models.nn.utils as U
import src.tasks.metrics as M
import torchmetrics as tm
from src.models.nn.adaptive_softmax import AdaptiveEmbedding, ProjectedAdaptiveLogSoftmax
from src.tasks.custom_torchmetrics import torchmet... |
fdae9ae45f9ea8d7ba6bb0300cf71a0f19648f13f8baf3281654fbd91a8365d6 | Python | 9,192 | 248 | import rdkit, rdkit.Chem, rdkit.Chem.rdDepictor, rdkit.Chem.Draw
import networkx as nx
from rdkit import Chem
import pandas as pd
import numpy as np
from sklearn.model_selection import KFold
from sklearn.model_selection import train_test_split
def filterValidSmiles(dataset):
"""
Function used to remove invalid... |
9cc83b209c9a5fb21eafdf6e11d6a1cf7fc3b40d8a14ea72e515d53b02fbd390 | Python | 9,196 | 238 | import numpy as np
import itertools
import smact
import torch
from tqdm import tqdm
from smact.screening import pauling_test
from scipy.spatial.distance import pdist, cdist
from scipy.stats import wasserstein_distance
from pymatgen.core.structure import Structure
from pymatgen.core.composition import Composition
from p... |
2ab5b5780e1cf48f4a0012278b50298ed8aa80793509f632f4b6d05a70e7dd2e | Python | 9,200 | 277 | """
This script converts counts to RPKM, row normalizes, and maps gene symbols for
a recount compendium
"""
from typing import Dict, Set
import argparse
import numpy as np
import tqdm
from utils import get_ensembl_mappings
def parse_gene_lengths(file_path: str) -> Dict[str, int]:
"""Parses a tsv file containin... |
662172c05e02c3de2be3d53e21488cac57902456744486e75a6bfee620c920a9 | Python | 9,201 | 272 | from .redirect_stdout import stdout_redirected
import pylp
class ImpossibleSplit(RuntimeError):
def __init__(self, optimal_fraction, target_fraction, nt):
self.optimal_fraction = optimal_fraction
self.target_fraction = target_fraction
self.nt = nt
super().__init__(
f... |
0054dadc1a47d98703eadb58faeae95e01160fac14cfb34d0ea5cab31c1af997 | Python | 9,204 | 281 | # -*- coding: utf-8 -*-
"""
Created on Wed May 5 20:08:52 2021
@author: Xingyan Liu
"""
import came
from came import pipeline, pp, pl
import logging
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt # optional
import seaborn as sns # optional... |
39c700178219cd0b3a8d961d69de3852e4bade08d8ab3645c7571672b9a8e95e | Python | 9,205 | 299 | import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch_geometric.nn import BatchNorm, Linear, TransformerConv
from torch_geometric.nn import global_mean_pool as gap
class Transformer4(torch.nn.Module):
def... |
88ab3edfc5d779b94240ffa6700ac4a21e83e894b3f90406996fc97159e84541 | Python | 9,206 | 234 | import os
import re
import random
import math
import numpy as np
from sklearn.metrics import accuracy_score, f1_score, roc_auc_score
import torch
from torch.optim.lr_scheduler import _LRScheduler
from torch import nn
import torch.nn.functional as F
from torch.nn.modules.loss import _WeightedLoss
from torch.utils.data i... |
c22b1da26fabbeedd096445c830383d66f4308b69e574a8d69aa4514479528f1 | Python | 9,209 | 258 | """Linear algebra utilities for numpy implementation."""
import numpy as np
from scipy.linalg import cho_factor, cho_solve
def matrix_block_indexing(A, rows):
"""Get blocks in a matrix, A[rows,:][:,rows]."""
return A[rows[:, None], rows]
def matrix_add_to_diagonal(A, B):
"""Add vector B to diagonal ele... |
367185563cb0c00abf7afaa40ca63c59f7da1319f453baa9701b847e11c9250c | Python | 9,210 | 208 | """
utilities for charge-changing procedure
"""
from simtk import unit
from simtk.openmm import app
import simtk.unit as unit
import numpy as np
def modify_atom_classes(water_atoms, topology_proposal):
"""
Modifies:
- topology proposal._core_new_to_old_atom_map - add the ion(s) to neutralize
- topology... |
352f4e12c95a8e08c79276653f0531cc91b2d7bfcc06e1d9da538e47b0142049 | Python | 9,211 | 316 | import numpy as np
from data import utils as du
from analysis import utils as au
from matplotlib.animation import FuncAnimation
from matplotlib import animation
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import matplotlib.pyplot as plt
from typing import List
import geomstats.visualiza... |
77f87fe094f550ff6102c485487f23a5fea4fe3cea03854d26a69cfd2382be88 | Python | 9,212 | 264 | # MIT License
# Copyright (c) 2021 Yuyang Wang
# 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 without limitation the rights
# to use, copy, modify, merge, pu... |
1c0c106a234e0c5c9dc0d767cf9a48c2bc81a45c6a1da7c99df84544ede31576 | Python | 9,213 | 301 | import os
from csv import DictWriter
from typing import List, Tuple
import cv2
import numpy as np
import segmentation_models_pytorch as smp
import torchvision
import wandb
from PIL import Image
from src.data.utils import CLASS_COLOR, CLASS_ID, CLASS_ID_REVERSED
def get_img_mask_union(
img_0: np.ndarray,
alp... |
8da8ec747bdf5f35dd70098a2c0bb1d47349670be1d74f18244b61f1effdd559 | Python | 9,214 | 291 | """**Store** implements the key-value stores and storage helpers.
Module provides implementations of various key-value stores that conform
to a simple key-value interface.
The primary goal of these storages is to support implementation of caching.
"""
from abc import ABC, abstractmethod
from collections.abc import A... |
eadb41363d2abf3f1142724b0ec49808f60678210eae4a4abedcc9db41b64276 | Python | 9,216 | 210 | import numpy as np
import uncertainpy as un
from scipy.integrate import solve_ivp
from edNEGmodel.edNEGmodel_params import *
from functions.initial_values import *
import time
def model_setup(t,k, g_Na, g_DR, g_Ca, g_AHP, g_C):
Na_sn, Na_se, Na_sg, Na_dn, Na_de, Na_dg, K_sn, K_se, K_sg, K_dn, K_de, K_dg, Cl_sn... |
62cfa199ec73a3c86d9073ae9a57bee47210456e9236a3c459745eb8123d4c96 | Python | 9,217 | 218 | import argparse
import logging
import os
import random
import shutil
import sys
import time
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tensorboardX import SummaryWriter
from torch.nn import B... |
e7ecf1097f42d69815db534ec061b646241c09e08703d4befaf49ada36499b63 | Python | 9,223 | 277 | import logging
import os
import socket
import sys
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from configs.configs import get_config_dict
from helpers.data import reorder_ica_components
def plot_edgewise_imputation_benchmark_scores_joint(
config_dict: dict,
d... |
6c8dabe66cd32154cd8447aaafcdd59bb5bcf20f4edeef2ed5010d883cc7ca10 | Python | 9,227 | 251 | # Copyright Generate Biomedicines, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
fd35dea45dde20dbdc8cdf0a242ece302e5ead68e6878b59ebf35ba2870eab0e | Python | 9,227 | 216 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Estimating the susceptibility distortions without fieldmaps.
.. _sdc_fieldmapless :
Fieldmap-less estimation (experimental)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the absence of direct measurement... |
429ffb290d07bf4faf95ac9f7a9e263fd770d49d3838fcedce39e708d06790d8 | Python | 9,230 | 244 | # MIT License
# Copyright (c) 2021 Yuyang Wang
# 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 without limitation the rights
# to use, copy, modify, merge, pu... |
c46b8f71e94c4b58d1e132749ea69c5134ca021d66043e387c7d8759e1ce56d3 | Python | 9,234 | 193 | import os
import pandas as pd
import requests
import web.options.options as opt
from bin.design import reverse_complement
from web.model.model import Adaptor
mypath = opt.WORK_OUT_DIR
work_space_path = opt.WORK_SPACE
from fastapi import HTTPException
# Populate parameters and run
def runAdaptCmd(para: Adaptor) -> ... |
5f3da46626eb0e5f7431eb3c4d9918d3b1e7ee3fba4bb6f9850ae323e50c4e99 | Python | 9,235 | 174 | """Deep SOH estimators on the per-cycle feature tables, trained on the GPU under protocols P3 (cell-disjoint)
and P4 (leave-one-dataset-out).
Input per sample: a window of the last W cycles' features (cell-relative + absolute, sanitised) -> SOH at the
current cycle. Models: MLP (current cycle only), CNN-LSTM, Tran... |
623a14ee3beda06440ddb0ccf5998ac7eb16a2f43cd4eda017da88e418bcaee7 | Python | 9,235 | 242 | from typing import List, Tuple
import numpy as np
from rdkit import Chem
from rdkit.Chem.AtomPairs import Pairs
from .utils import polymol_fom_smiles
from .logger import PFPLOGGER
def create_AtomicPairFingerprint(
smiles_s: List[str], fp_size: int = 2048, complement: bool = False
) -> List[np.ndarray]:
"""
... |
704c3ddeec02c6b6fc94409149a6ff272bc76bde94ed783f376f4742d872cb80 | Python | 9,236 | 240 | """Console script for mrQA."""
import argparse
import sys
from datetime import datetime, timedelta
from pathlib import Path
from typing import Union, List
from MRdataset import import_dataset, load_mr_dataset
from mrQA import logger
from mrQA.config import PATH_CONFIG, THIS_DIR, DATETIME_FORMAT
from mrQA.project impor... |
8456820118258a5d1b1b616bf9e045f7b2ef9f3d68a1be25b83fb93cf767661b | Python | 9,236 | 256 | import ccg
from ccg.dependencies import DepLink
from ccg.evaluation import sufficient_stats_from_deps, combine_stats, prf_score_from_stats
import tempfile
import subprocess
from os.path import realpath, dirname, join
from os import getcwd
import os
import re
from pathlib import Path
from sys import stderr
import gdown
... |
35f23d2d21dd21f48a9d4856f709fca8a6127b9bf3b377dc39863a89c5fe115f | Python | 9,241 | 261 | ####################################################################################
#
# 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... |
3db5337fd9c1488886dda8f023145cbb4d81e2bba124c05ff76b14a0e499af32 | Python | 9,242 | 261 | ####################################################################################
#
# 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... |
d5b6c20be9198e1bdb9a2f8b9f47093468069535b2ceb5724c20e67e28206553 | Python | 9,245 | 288 | import sys
import os
from dataclasses import dataclass
import xml.etree.ElementTree as ET
import numpy as np
import copy
# Parameters
# 1. RML file to edit (XML format)
# 2. Number of RZPs
# 3. Angle of rotation (gamma, in radians)
@dataclass
class RMLParams:
file: str
numRZPs: int
gamma: float
def get... |
00751d6328ade83019129071baa020f2fc526651958b5da4a254fd6caf909946 | Python | 9,246 | 301 | from pathlib import Path
import typer
from click import Context
from rich import print
from typer.core import TyperGroup
from fidnet import config
class OrderCommands(TyperGroup):
def list_commands(self, ctx: Context):
"""Return list of commands in the order
they should appear."""
return... |
1b8f12a128d8f99531a709c6c0543e4476e1af9da527ea66c7cf08b39035adc1 | Python | 9,247 | 251 | """Tool emulator middleware for testing."""
from __future__ import annotations
import warnings
from typing import TYPE_CHECKING, Any, Generic
from langchain_core.language_models.chat_models import BaseChatModel
from langchain_core.messages import HumanMessage, ToolMessage
from langchain.agents.middleware.internal_c... |
fff716a2dcf28820e22b0591c23a62dc47b4aae5370ca71f5701a385d2b7a1af | Python | 9,247 | 239 | import pickle as pk
import spglib
import numpy as np
from tqdm import tqdm
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
from e3nn import o3
from e3nn.io import CartesianTensor
import torch
import json
from pymatgen.io.vasp import Poscar
import pdb
from pymatgen.io.jarvis impor... |
03e527d95182a445290cbf9aaca49b3662ddef3f051cbcab8b39a1bc9796b633 | Python | 9,256 | 239 | import os
from pensa.preprocessing import \
download_from_gpcrmd, \
extract_coordinates, \
extract_aligned_coordinates, \
extract_combined_grid
from pensa.features import \
read_structure_features, \
read_water_features, \
get_multivar_res_timeseries
from pensa.statesinfo import \
get_di... |
d182aee1d7f8270c80fa064405ae3df4b1a898ff6c2f5733f7a5145882527e6e | Python | 9,256 | 282 | # coding: utf-8
""" MIT License """
'''
Project: Parenchymal Attention Network
Authors: Axel Masquelin
Description: Utility functions to plot metrics
'''
# Libraries
# ---------------------------------------------------------------------------- #
from sklearn.metrics import roc_curve, auc, confusion_matrix
... |
812b0d8dc56c9936381e55e5751b6258bead934094aaa678f854958b7bc2dd8d | Python | 9,257 | 211 | 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... |
9910702c5aba4c7f936321d4034b5d7f97dc64f3be3bbbb5e55cbdadaeec4095 | Python | 9,259 | 253 | from itertools import product
from typing import Dict, Optional, Tuple
import torch
from sklearn.linear_model import LogisticRegression
def assign_labels(
spikes: torch.Tensor,
labels: torch.Tensor,
n_labels: int,
rates: Optional[torch.Tensor] = None,
alpha: float = 1.0,
) -> Tuple[torch.Tensor, ... |
048b9fd8e0151628b16005d24fda866d2d0a594d46952933090aee726398b751 | Python | 9,273 | 252 | # 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... |
78b35208f56efa9ef8d308b5aceb854b7438905522a2d8818a2ea18cc6018630 | Python | 9,275 | 207 | import os
from copy import deepcopy
from collections import OrderedDict
from itertools import groupby
import warnings
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import matplotlib.patches as patches
print("- matplotlib version:", matplotlib.__version__)
# matplotlib.font_manager.get_font_name... |
1fb487ad282bb2525b45f89e1a7b36147e9bacdb1b176c0de103c975307e9525 | Python | 9,278 | 213 | from typing import List, Optional
import torch
from torch import nn
from transformers import T5Config, T5ForConditionalGeneration
from transformers.modeling_outputs import Seq2SeqLMOutput
class T5ForProperty(T5ForConditionalGeneration):
r"""
T5Chem Model with a `language modeling` head on top.
Args:
... |
f09a4e4021567fc1c9047f308aed3d5201889599f80fb6fab379be5814437ccd | Python | 9,279 | 253 | # Copyright 2024 Eelke Spaak, Donders Institute.
# See https://github.com/Spaak/rift-phase-and-visibility for readme/license.
# Belongs with:
# Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension
# to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscience,... |
f79fb346118462bc979c80a83dec80425471bc8019295759532cf8921612a9c4 | Python | 9,279 | 240 | # 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... |
a419fe6fb08b8b154c64e290ddba3a851b57edfb78c5bc313b4e2b6985c70731 | Python | 9,281 | 244 | import msgpack
import os
import numpy as np
import torch
from torch.utils.data import BatchSampler, DataLoader, Dataset, SequentialSampler
import argparse
from qm9.data import collate as qm9_collate
def extract_conformers(args):
drugs_file = os.path.join(args.data_dir, args.data_file)
save_file = f"geom_drugs... |
6c72fb64b4a543d159b37aa6cfc68af92a41e58514401f94518f3b3bb977aee8 | Python | 9,288 | 278 | from typing import Dict
import openmm
import openmm.unit
import pytest
from openff.interchange.interop.openmm import to_openmm_topology
from openff.toolkit import ForceField, Molecule, Topology
from openmm.app import ForceField as OpenMMForceField
from openmm.app import HAngles
from openmm.app import Topology as OpenM... |
d712ccb8dc924c882cffb78bfd8f61d2f0609207154050517faa3a0e6eb2ea65 | Python | 9,293 | 238 | from collections.abc import Hashable
import numpy as np
import pandas as pd
from scipy.stats import multivariate_normal
from pgmpy.structure_score._base import BaseStructureScore
class LogLikelihoodCondGauss(BaseStructureScore):
r"""
Log-likelihood score for Bayesian networks with mixed discrete and continu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.