sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
81dc69fb23ab21aa07efed482b8ca5db673822ffac3f6cf9e07563380eb49bea | Python | 17,677 | 484 | """Tests for `BaseChatModel.stream_events(version="v3")` and its async equivalent."""
from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, Any, cast
import pytest
from pydantic import Field
from langchain_core.callbacks import AsyncCallbackHandler, BaseCallbackHandler
from langchain_c... |
09af2d581278159f5950b3bbe6f9679546fca264ce4f0549b432b1671d0a30f0 | Python | 17,695 | 474 | # Copyright (c) <2021> <University of Paderborn>
# Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/
# https://github.com/SSTGroup/independent_vector_analysis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated d... |
8aa329cc852bdee2ae55960de51092496479f96dd6692a72f07dcdbaf655ee41 | Python | 17,696 | 499 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 22 19:42:58 2021
@author: Bruno Canecco
Purpose: Module with core worker functions for the detection process
"""
# import standard libraries
import os
import glob
import logging
from pathlib import Path
# import installed/3rd-party modules
from PIL import Image
impor... |
eceab8a24227894b8777f2466456adb4585ebcc189fee1eae2c7e1196115a47f | Python | 17,702 | 435 | 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 ... |
a06c9e3c8ae7c1e8e58f220af6c80b9ce8201c4ce464b28378702fc73442848e | Python | 17,708 | 422 | """
This module generates videos comparing intact and headless flies behavioural respones
Author: jonas.braun@epfl.ch
"""
import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.backends.backend_pdf import PdfPages
import pickle
from tqdm imp... |
248db318688e245ce96804bd199d678dc780fdecee8773ad96488bf22740f3c8 | Python | 17,712 | 440 | import os
import os.path as osp
from typing import Any, Callable, Dict, List, Optional
import numpy as np
import torch
from tqdm import tqdm
from torch_geometric.data import Data, Dataset
QM9_GOOD_INDEX_FILENAME = 'QM9_abs_max_lt_1e-03.txt'
MDA_GOOD_INDEX_FILENAMES = {
'train': 'MDA_train_abs_max_lt_1e-03.txt'... |
ddd8554e8c2f75f0e56556e2dd29c9808b85ecb6cf6bed161a624e451020b2cc | Python | 17,724 | 411 | # vim: fdm=indent
# author: Joan Camunas
# date: 01/07/18
# content: Dataset functions to correlate gene expression and phenotypes
# Modules
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def predict_ephys(counts1, counts2, genelist, ephys2, k=10, method='sp... |
ac93b196d312bdeaf025657ee946d8861085e78de4ae0287da746a7fedc63f92 | Python | 17,745 | 507 | """Interfaces to be implemented by general evaluators."""
from __future__ import annotations
import logging
from abc import ABC, abstractmethod
from collections.abc import Sequence
from enum import Enum
from typing import Any
from warnings import warn
from langchain_core.agents import AgentAction
from langchain_core... |
05b9ceb484b4cce40796ba4e5001d60b88f8edbe7131f2aeb21906ec5a27f68c | Python | 17,748 | 493 | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import sys
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
import itertools
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from m... |
e75a077410487dc4fb985b3f950fbc0babd4d404cb0626a95882e3e31fcf8658 | Python | 17,750 | 503 | import json
import os
from tempfile import TemporaryDirectory
from typing import List, Optional, Tuple
from typing_extensions import Literal
import torch
from tap import Tap
import HMSA.data.utils
from HMSA.data import set_cache_mol, empty_cache
from HMSA.features import get_available_features_generators
Metric = Lite... |
52be0ea50d559e91c6a8e918229b2063a42b0f3f213604b92dcf03356f978189 | Python | 17,759 | 452 | ####################################################################################
#
# 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... |
fcb747371cd2525fe6b42614ad7f73653270f99b42a636fc6f164bf35248492d | Python | 17,763 | 497 | # Author: Katiana Kontolati
# Last update: Sept. 12, 2022
# Important: Make sure to: $conda activate latent_deeponet before running this script!!
import random
import tensorflow as tf
import keras
from keras import backend as K
from keras.datasets import mnist
from keras.models import Model
from keras.layers import In... |
89b76d1e5b27b3eab454e8afe17238977dbaea64baf70928211306c5251b8f59 | Python | 17,776 | 483 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.dom.minidom as dom
import xml.dom
import os
import socket
import re
import sys
import datetime
#Version 3
# Dokument erzeugen
implement = xml.dom.getDOMImplementation()
dbpedia_Server="http://greententacle.techfak.uni-bielefeld.de:5171/sparql?default-graph-uri... |
0ef0a9ca005080632a7ca3eca75a7643f5ac5a9fc4d36525bf013d69ea947e79 | Python | 17,781 | 495 | # Author: Katiana Kontolati
# Last update: Sept. 12, 2022
# Important: Make sure to: $conda activate latent_deeponet before running this script!!
import random
import tensorflow as tf
import keras
from keras import backend as K
from keras.datasets import mnist
from keras.models import Model
from keras.layers import In... |
7f25d261b6e0eefb10547fae4596d61846ff0fd7b41028cdcf7684c78a6cd5b6 | Python | 17,781 | 495 | ########################################################################
# Spatial chemical reactions.
# AIMS: to verify STEPS spatial deterministic solver 'TetODE' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# This model combines all validat... |
caf6c6de901383d113766b0f7b5641d9ef3c62c8918deb6e1299d5e0454c7707 | Python | 17,781 | 495 | # Author: Katiana Kontolati
# Last update: Sept. 12, 2022
# Important: Make sure to: $conda activate latent_deeponet before running this script!!
import random
import tensorflow as tf
import keras
from keras import backend as K
from keras.datasets import mnist
from keras.models import Model
from keras.layers import In... |
504cb70b11672f42f5caa0c7e8c04f31df0b2cdbb946d472a42e16cb8d805037 | Python | 17,786 | 305 | #!/usr/bin/env python3
#$ -cwd
#$ -V
#$ -N trpm_perm
#$ -e /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/permeation_identification/trpm_perm.err
#$ -o /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/permeation_identification/trpm_perm.out
#$ -pe smp 2
#$ -jc long
import os
import sys
import t... |
f51e03cf939bd127ec49bf873627b953d46f5a81f1c6e391cb4480307a3fff46 | Python | 17,789 | 495 | """
Methods to obtain a distribution for the water pockets which respresents
a combination of the water occupancy (binary variable) and the water polarisation (continuous variable).
For a water molecule to exist within a water pocket, just the oxygen must occupy the pocket.
If there is ever an instance where two water... |
93c8c22f7f8801ea9a0de8555dd83874ebaeed101db55124597f8a958a8459df | Python | 17,798 | 495 | ########################################################################
# Spatial chemical reactions.
# AIMS: to verify STEPS spatial deterministic solver 'TetODE' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# This model combines all validat... |
a6fbcee003161c5a2a8a5d5b965fccc6294cf50ca9d84ed7bf697c09539a3b5a | Python | 17,798 | 493 | import copy
import math
import re
from collections import namedtuple
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from flash_attn.modules.block import Block
from flash_attn.modules.embedding import GPT2Embeddings, ParallelGPT2Embeddings
f... |
7bc92f030e9f0cf17270c655e353f6a09196f598985f827583ca7bd51a4fdcd4 | Python | 17,802 | 390 | ''' Feed Forward Neural Network Model.
.. Note::
Due to computational benefits the common notation for the delta terms is
split in a delta term for the common layer and the error signal passed
to the layer below. See the following Latex code for details. This allows
to store... |
130eae749df11c9b3329b8c5bc8f66fa32d99c3a6af00305834e436377623b64 | Python | 17,816 | 304 | #!/usr/bin/env python3
#$ -cwd
#$ -V
#$ -N trpm_perm
#$ -e /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/permeation_identification/trpm_perm.err
#$ -o /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/permeation_identification/trpm_perm.out
#$ -pe smp 2
#$ -q c6100.q
import os
import sys
import... |
1bfbddce0a21b04798799ee8e7e097f6d83be29430f411ee742dff1810b45129 | Python | 17,822 | 449 | # -*- coding: utf-8 -*-
# @title Plot SNN emulation
# @file SnnPlotter.py
# @author Romain Beaubois
# @date 23 Oct 2023
# @copyright
# SPDX-FileCopyrightText: © 2023 Romain Beaubois <refbeaubois@yahoo.com>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# @brief
#
# @details
# > **23 Oct 2023** : fi... |
89f392d745253d8d209da12eba9eb91057f18c17c65085cb32ddc1818e806d2d | Python | 17,825 | 435 | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from argparse import ArgumentParser
import sys, os
import glob
import pandas as pd
import ntpath
import pickle
from download import download
from argparse import RawTextHelpFormatter
from mantis_ml.modules.pre_processing.data_compilation... |
ff2a1baeb7ae4b4d2ee3c5d32ab8e47ee29a3c5bb7ead0a35316f69cec6c10e8 | Python | 17,834 | 477 | import numpy as np
from mimic3models import metrics
import keras
import keras.backend as K
if K.backend() == 'tensorflow':
import tensorflow as tf
from keras.layers import Layer
# ===================== METRICS ===================== #
class DecompensationMetrics(keras.callbacks.Callback):
def __init__(sel... |
264c2b68e918fa8cb70e9d090583c34418b50fc881c0d424d29d6c546bcea3c4 | Python | 17,851 | 608 | """===========================
Ancestral repeats pipeline
===========================
:Author: Andreas Heger
:Release: $Id: pipeline_ancestral_repeats.py 2876 2010-03-27 17:42:11Z andreas $
:Date: |today|
:Tags: Python
The ancestral repeats pipeline defines ancestral repeats for a pair of genomes
and computes rates f... |
9883252f0f1b2368b88c477eb503330e1153e77f70fa15b7af4ea27fd62c5abf | Python | 17,856 | 313 | import tkinter as tk
import matplotlib
matplotlib.use('TkAgg')
import sys
import platform
if platform.system() == 'Windows':
print("Windows")
from ctypes import windll
windll.shcore.SetProcessDpiAwareness(1)
elif platform.system() == 'Linux':
print("Linux")
#These are the custom scrip... |
b917e3b7fa2756e013df775ae02e732ee68807fd7b673216388c50097fa8f24a | Python | 17,857 | 543 | """Test few shot prompt template."""
import re
from collections.abc import Sequence
from typing import Any
import pytest
from typing_extensions import override
from langchain_core.example_selectors import BaseExampleSelector
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
from langchain_co... |
24570cfeddeee571068e4749c903ad36f8a16712f7c9b6f9172d9dfda909613e | Python | 17,867 | 398 | 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_... |
0a48ce39ecf23d4c5ae9310ed52382b431882b7aa0f371edea5310fcba81cf17 | Python | 17,882 | 373 | """ Test module for activation functions.
:Version:
1.1.0
:Date:
13.03.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 f... |
295283d4a0809362b7d5048e283965bdac5ffc142ed55040d80bce53dff2a809 | Python | 17,899 | 494 | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from argparse import ArgumentParser
from scipy.stats import hypergeom
import pandas as pd
import numpy as np
import pickle
from argparse import RawTextHelpFormatter
pd.set_option('display.max_rows', 400)
pd.set_option('display.max_column... |
79cf1b3576da0d31cb6e6dedc27b5a52f373b808f34b6c62b67557f5855aa3a0 | Python | 17,903 | 433 | import argparse
from tensorflow.keras import optimizers
import numpy as np
import datetime
import glob
import os
from models import twostage_Unet
from utils.data_loader import DataLoader
from utils.loss import create_psf_loss,cal_psf_2d,psf_estimator_2d
from utils.utils import prctile_norm
from utils.augment_sim_img im... |
1fd853ef2967f0cd780bfd728991e677a1ccf693322954a8f4619f6967b680be | Python | 17,911 | 475 | import pycircstat
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import efel
from scipy.signal import hilbert
from matplotlib.backends.backend_pdf import PdfPages
import seaborn as sns
#pvalb
file_name = 'CellJ.json'
paths4 = ['PvalbA_8Hz_HOF0','PvalbA_30Hz_HOF0','PvalbA_140Hz_AllHOF... |
0e608a96ffedde92e79ac4835876dc1e91e883432861f495a64611c54012acd9 | Python | 17,947 | 341 | # -*- coding: utf-8 -*-
# @title Ionic channels states equations
# @file Ionrates.py
# @author Romain Beaubois
# @date 05 Dec 2022
# @copyright
# SPDX-FileCopyrightText: © 2022 Romain Beaubois <refbeaubois@yahoo.com>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# @brief Provide functions ... |
fe729fdb159182f9e94be1594c62abbf8961416353816e7fdb9bffef696a4abb | Python | 17,956 | 450 | import os
import glob
import argparse
import numpy as np
from tqdm import tqdm
DEFAULT_SCOPEDOM_FILEPATH = 'data/astral-scopedom-seqres-gd-sel-gs-bib-40-2.08.fa'
DEFAULT_SCOPE_PDB_DIR = 'data/pdbstyle-2.08'
DEFAULT_OUTPUT_DIR = 'data/scope'
SCOPE_CLASSES = ['a', 'b', 'c', 'd']
IGNORE_DOMAIN_IDS = [
'd6m9za_',
... |
ae2b7f0a8f3dbe0fbfb016e93841407276eff0151edaf6d435bd020f1769d7c4 | Python | 17,984 | 511 | import torch
import torch.nn as nn
import math
from typing import Optional, Tuple
from copy import deepcopy
from h3xsemble.model.primitives import Linear, ipa_point_weights_init_
import h3xsemble.utils.feats
from h3xsemble.utils.rigid_utils import Rotation, Rigid
from h3xsemble.utils.tensor_utils import (
dict_mu... |
07b1f7021e799dc6b0ad88b3b9192e39bd12e53333f8171e047fb9d79c031fbf | Python | 17,992 | 407 | """
Adapted from:
https://github.com/karpathy/nanoGPT/blob/eba36e84649f3c6d840a93092cb779a260544d08/train.py
"""
import sys
sys.path.append(".")
import os
from dataclasses import dataclass
from typing import Union
import math
import time
from tqdm import tqdm
from crystallm import parse_config
from omegaconf import Om... |
a30e37480b147e5856532912adc93d075ecc8ed66c1a4e75169094aa681fabfe | Python | 17,992 | 500 |
import numpy as np
import pandas as pd
import gif
from collections import OrderedDict
import matplotlib.pyplot as plt
from trajectory_reconstruction_tradeoff.opt import find_min_nc
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sns
from .plotting_configs import get_color_col
import networkx as nx
from sklea... |
684c52f89915b23297aea81716b8065b9655a0455946b1cac981a3f5b904e2dd | Python | 18,001 | 528 | import os
import pickle
import copy
import pandas as pd
import numpy as np
import torch
from torch.utils.data import DataLoader
from Bio.PDB.PDBParser import PDBParser
from Bio.PDB.Polypeptide import one_to_index, index_to_one
from tqdm.auto import tqdm
from rde.utils.protein.constants import num_chi_angles
from rde.u... |
117ffa2140ba1f70b64b05998df0a0b485b0496b0d3473af0fee26aba3813733 | Python | 18,017 | 460 | """
This file contains the methods and script to simulate distortions from a fieldmap and T2w image.
See __main__ below for details.
"""
from fsl.wrappers import flirt, fsl_prepare_fieldmap, bet, fslsplit
import sys
from EPI_MRI.EPIMRIDistortionCorrection import *
from optimization.GaussNewton import *
import math
d... |
ac197b7493efdadb61d74b177e975745b058152e261bdc3ec217db810ef24dc8 | Python | 18,030 | 430 | import argparse
from tensorflow.keras import optimizers
import numpy as np
import datetime
import glob
import os
from models import twostage_Unet
from utils.data_loader import DataLoader
from utils.loss import create_psf_loss,cal_psf_2d,psf_estimator_2d
from utils.utils import prctile_norm
import tensorflow as tf
impor... |
f1c0314be62e0878ff9a90e558e6d532a4df720d841b35fb38da9164c8be06f4 | Python | 18,042 | 395 | import os
import json
import numpy
import pandas
__all__ = ['Signal']
MSEC_TO_SEC = 1.0e-3
SEC_TO_MSEC = 1.0e+3
class Signal:
def __init__(self, freq, samples, *, label=None, unit=None, copy_data=False):
self._freq = round(float(freq), 2) # two decimals
if not self._freq > 0.0:
rai... |
297ca9f23dec458d0fce97994f76a4d0171d6c6cdfc62c23986a309b99ab14e4 | Python | 18,117 | 430 | # Copyright 2019 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
ba231f559723719a76da095c2220dd1b81e73e44e19ef17d5f1e7be2a9661cac | Python | 18,119 | 447 | import logging
import warnings
import numpy as np
import torch
from torch import nn
from torch.nn import Parameter
from torch.nn import functional as F
from .base import Readout
logger = logging.getLogger(__name__)
class PointPooled2d(Readout):
def __init__(
self,
in_shape,
outdims,
... |
00376022af9afa41179e9fff55cfd356f775a1b7bca312fb42e373e23c70a3a7 | Python | 18,123 | 406 | # -*- coding: utf-8 -*-
# Author: Xiangde Luo
# Date: 16 Dec. 2021
# Implementation for Semi-Supervised Medical Image Segmentation via Cross Teaching between CNN and Transformer.
# # Reference:
# @article{luo2021ctbct,
# title={Semi-Supervised Medical Image Segmentation via Cross Teaching between CNN and Transfor... |
6db167f5ffcb497582a11b3925b2eb54e6890cd330c312859e0da64a16a16d6d | Python | 18,130 | 263 | """Per-charge capacity labels and features for the Changan 300-EV field dataset (Liu et al. 2025, Nat. Commun. 16:1137).
Input
RAW_DATA.zip (last volume of the split archive) or explicit vinN.csv files. When RAW_DATA.z01 is absent only entries whose
data lie entirely inside RAW_DATA.zip are read: the zip64 central... |
e9fa0fcda2f42a100281e442acf5b4e674004cae5e8a5ad83b4fe4236f039846 | Python | 18,130 | 462 | import torch
import torch.nn as nn
import torch.nn.functional as F
from networks.networks_other import init_weights
class conv2DBatchNorm(nn.Module):
def __init__(self, in_channels, n_filters, k_size, stride, padding, bias=True):
super(conv2DBatchNorm, self).__init__()
self.cb_unit = nn.Sequent... |
7a9347a36f198f711478dac92d21e3ec90915920484ba6c2c3e391853aa8a741 | Python | 18,151 | 453 | from collections import OrderedDict
from typing import Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
class Bottleneck(nn.Module):
expansion = 4
def __init__(self, inplanes, planes, stride=1):
super().__init__()
# all conv layers have strid... |
76907c504a40b8e759fb663564ec92c3a05360587bf40033637785553891951c | Python | 18,156 | 302 | import pandas as pd
import os
def calc_image_numcells(image_grouped):
"""Calculate total number of cell nuclei identified in each image.
Function receives the data grouped by image(condition + timepoint + ImageNumber)."""
image_grouped['image_numnuc'] = image_grouped.shape[0]
return image_grou... |
1d973db6f9febbefb4eab9efcfa626779b30c1b518b13e8c2d22de5b53f731a8 | Python | 18,171 | 360 | import inspect
from collections.abc import Hashable
from numbers import Integral, Real
from typing import Any
import numpy as np
import pandas as pd
from numpy.typing import ArrayLike
from pandas.api.types import is_complex_dtype, is_float_dtype, is_numeric_dtype
from skbase.base import BaseEstimator, BaseObject
from ... |
a731ee7a412e411261f5a1481106e67c04028f01950d606b28bcbea20859b9c7 | Python | 18,171 | 472 | """Utility functions for working with pdbs
Adapted from Raptorx3DModelling/Common/PDBUtils.py
"""
import os
from typing import Dict, List, Tuple, Union, Optional
import numpy as np
import torch
import warnings
from Bio import BiopythonDeprecationWarning
with warnings.catch_warnings():
warnings.simplefilter("ignor... |
0802a64f16c1d55af81b066f0c61ca4f83e9fa27ed0f90d4a7f8fb2c88b9e755 | Python | 18,179 | 531 | """
Register of the skbase tags used by pgmpy objects.
Each tag is a subclass of ``_BaseTag``. The class name is the tag name with ``:`` replaced by ``__``, and the class
docstring is the tag's documentation. The ``_tags`` of a tag class describe the tag:
- ``tag_name`` (str): Name of the tag as used in the ``_tags``... |
1364a5cc550b0a171eb543fca930572586c2fd26101af90a6f50046843da47cc | Python | 18,198 | 492 | from typing import Union
import numpy as np
import pandas as pd
from coffeine.covariance_transformers import (
Diag,
LogDiag,
ExpandFeatures,
Riemann,
RiemannSnp,
NaiveVec)
from coffeine.spatial_filters import (
ProjIdentitySpace,
ProjCommonSpace,
ProjLWSpace,
ProjRandomSpace,
... |
14d05ccc75f91c53b5d93b3b147e269137e764b511f66c6990961151968fc1ed | Python | 18,211 | 362 | """This module implements custom :class:`tensorflow.python.keras.losses.Loss` objects that are useful for motor control.
.. note::
There are a couple naming conventions that this module employs:
- ``Regularizer`` indicates the penalization is applied to the *value* of the model's output, not the error
b... |
6b92dd07d522d0dda6d912555cfb531e0752b2a67d3fbb232536c195d969933d | Python | 18,217 | 497 | """Convert functions and runnables to tools."""
import inspect
from collections.abc import Callable
from typing import Any, Literal, cast, get_type_hints, overload
from pydantic import BaseModel, Field, RootModel, create_model
from langchain_core.callbacks import Callbacks
from langchain_core.runnables import Runnab... |
9943414b839c33be5fa1d2a32e22e3ba3d46d5843b470d5c5fb231017b571233 | Python | 18,233 | 486 | """ This module provides methods for estimating the model performance
(running on the CPU). Provided performance measures are for example
the reconstruction error (RE) and the log-likelihood (LL). For estimating
the LL we need to know the value of the partition function Z. If at least
one layer is ... |
8179d31b8816de0a4f365a2df0a5c74006069493f1387374ae3a12bf99a0b91b | Python | 18,239 | 507 | import logging
import os
import socket
import sys
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from configs.configs import get_config_dict
from helpers.data import load_data
from helpers.evaluation import leave_every_other_out_split
from helpers.figures import get_palette
from helpers.plot... |
7aa7efe9a39d69cb22debc007b855bd16ff69511dad3e96eaff6d8c4afacbab4 | Python | 18,252 | 475 | import torch
import numpy as np
from rfdiffusion.util import generate_Cbeta
class Potential:
'''
Interface class that defines the functions a potential must implement
'''
def compute(self, xyz):
'''
Given the current structure of the model prediction, return the current
... |
98c7e7ec9a20abba5a1f6dfa8eeba451b31a4fdebbeaa4f26ae6515575c3be53 | Python | 18,261 | 428 | """Classes for querying the specificity of guides against target sequences.
"""
from abc import ABCMeta, abstractmethod
from collections import defaultdict
import logging
from easyDesign.specificity import kmer_shard
from easyDesign.utils import guide
from easyDesign.utils import lsh
logger = logging.getLogger(__nam... |
44150e09ed7ee5a887a602dd1f74bee04bde507d58da3408c4ede6bbb77cb77f | Python | 18,262 | 417 | ''' Feed Forward Neural Network Layers.
.. Note::
Due to computational benefits the common notation for the delta terms is
split in a delta term for the common layer and the error signal passed
to the layer below. See the following Latex code for details. This allows
to stor... |
92edc2e389b4accc8233924e661c2175d173b7eb33ede262f8a5503dac5ef1a7 | Python | 18,271 | 465 | import shap
import argparse
import os
import shutil
import numpy as np
import matplotlib.pyplot as plt
import torch
from torch.utils.data import DataLoader
import torch.nn.functional as F
from matplotlib.colors import LinearSegmentedColormap
import alg
from alg import alg, modelopera
from utils.util import set_random... |
ebbde026e89ede54feb7c0913ccc31678b1c2459e7402977c550f4ae7109b31a | Python | 18,272 | 444 | import math
import torch
from lightning import LightningModule
from hydra.utils import instantiate
from torch_ema import ExponentialMovingAverage
from scdp.common.utils import scatter
from scdp.model.basis_set import build_transformed_basis_set, aug_etb_for_basis
from scdp.model.gtos import GTOs
from scdp.model.coeff... |
1641b07d5ba5cb70e2fa2783c9b3d80fccd1ce1f728c66f986c5c9793ae56ff3 | Python | 18,275 | 428 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test Context cache classes in cache.py.
"""
# =================================================================... |
4172fc1d730c9beafc09cd1bd93d7e668003d993d3f18d48614059c3bf33e9e4 | Python | 18,283 | 421 | from KineticAssembly_AD.vectorized_rxn_net_KinSim import VectorizedRxnNet_KinSim
from KineticAssembly_AD import ReactionNetwork
import numpy as np
from torch import DoubleTensor as Tensor
from torch.nn import functional as F
import torch
import pandas as pd
from matplotlib import pyplot as plt
import matplotlib.colors... |
13c5f0aa7830fb994892c6946165845a3fd1e5afb662b6e779e91e6832bb11a8 | Python | 18,300 | 457 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 18 16:54:08 2021
@author: shni2598
"""
import numpy as np
import matlab.engine
import mydata
from scipy.sparse import csc_matrix
# import warnings
# warnings.simplefilter("error", RuntimeWarning)
#%%
class MUA_findchangepts:
def __init__(... |
3cb905d8ae85c2c5eb1604c9b0661f357596e5b7f269ce10fa08ca24dde96009 | Python | 18,319 | 634 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import sys
from pathlib import Path
import yaml
from src.callbacks import get_callbacks, get_callbacks_pdb
from src.preprocessing import DataPreprocessor
from src.structurecontainer import StructureContainer
from src.visualization.visualizator import Vis... |
e9cbde3d6adffbb4af9bc389872215eb76d8a94a051bd5b7a123ad6d907b6e13 | Python | 18,321 | 398 | # Creation of the visual-semantic mapping (main expt) and related analyses
# Copyright (c) 2021 Laurent Caplette
import numpy as np
from sklearn.decomposition import PCA
import nltk
import csv, os, re
import torch
from torch import nn
from robustness.datasets import ImageNet
from robustness.model_utils import make_and... |
cc183de936689f212b3b2215f63392abb636b4130779678cf1a31b814792d9ab | Python | 18,335 | 456 | import torch
import torch.nn as nn
import math
import copy
from torch.nn import Linear
from .so3 import SO3_Embedding
from .radial_function import RadialFunction
class SO2_m_Convolution(torch.nn.Module):
"""
SO(2) Conv: Perform an SO(2) convolution on features corresponding to +- m
Args:
m (int)... |
1d31f2e6b1e8d29b3bebb0d0b5420c68c08735dc728285d181a7711fcbd074b7 | Python | 18,340 | 502 | # Source: https://github.com/pytorch/vision/blob/master/references/detection/transforms.py
# Also: https://pytorch.org/docs/stable/_modules/torchvision/transforms/transforms.html
import random
import torch
import numbers
from torchvision.transforms import functional as F
from copy import deepcopy
import numpy as np
fr... |
b9ae3894f64af528e336c1ff2d76d2c6b691cf2da669b0c8df4ca6af06f87415 | Python | 18,365 | 462 | # built-in modules
import heapq as hq
# third party modules
import numpy as np
import torch
import torch.nn.functional as F
from torch_geometric.nn import EdgePooling
from torch_geometric.data import Data
# pnabind modules
from pnabind.nn.utils import MLP
class Decimator(object):
@staticmethod
def computeErr... |
061d6482a0631f73cf8a712476ce158b854ec50c918f230e8cec81209eb3aaf8 | Python | 18,387 | 426 | import numpy as np
import scipy.sparse as ssp
import pandas as pd
import time, os
import json
import h5py
import hicstraw
import csv
from tqdm import tqdm
def get_hic_file(chromosome, hic_dir, allow_vc=True, hic_type="juicebox"):
if hic_type == "juicebox":
hic_file = os.path.join(hic_dir, chromosome, chro... |
265e3c09a103efc404955e846d50b13fa7b8e5bf07a6d5f579915b9fc16d0adc | Python | 18,415 | 477 | """Run evaluator wrapper for string evaluators."""
from __future__ import annotations
import logging
import uuid
from abc import abstractmethod
from typing import Any
from langchain_core.callbacks.manager import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
)
from langchain_core.load.dump im... |
b15f8f152ac2c7fdda95ecc7511f661a4e540e4e5bd4f77be48e7b3619852541 | Python | 18,417 | 490 | """
This module is an example of a barebones QWidget plugin for napari
It implements the Widget specification.
see: https://napari.org/plugins/guides.html?#widgets
Replace code below according to your needs.
"""
from typing import TYPE_CHECKING
from qtpy.QtWidgets import QWidget, QFileDialog
from qtpy.QtGui import QP... |
c7657335d3f4384fc60d4c0a618fb633e901bc1b156257b8dccba6cbdc7080c2 | Python | 18,422 | 443 | ####################################################################################
#
# 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... |
c7889880be7f77929620ab5b19d69d1b2e169f2fab9d2d05a51685ebd73c7de4 | Python | 18,425 | 387 | """frontal-angle / metopic shape analysis, computed on the 2D forehead
contour taken from the exact same HC-slice height cranial analysis uses -
see pipeline.hc_slice_height_facial_frame for how that height gets shared
between the cranial and facial pipelines, and craniometrics.py's module
docstring for why the HC slic... |
6824b418a631585ea01588c41df14b9f798f00ddecf642bbf4b1d6f9d03508f4 | Python | 18,430 | 510 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS well-mixed stochastic solver 'Tetexact' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# This model combines all we... |
f1ab00cd3bd292204ffd8a533bc431ddb0be9e9b7c2f4240fc830ddd56738286 | Python | 18,434 | 414 | import argparse
import linecache
import logging
import os
import random
import shutil
import subprocess
from functools import partial
from pathlib import Path
from typing import Dict, List, Optional
import numpy as np
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data ... |
3e272fd6dad9ba818432aa8912ba0544ece94b68bf5d9a92199c0902e357ea47 | Python | 18,438 | 443 | ####################################################################################
#
# 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... |
6a6181be14c7b9c6469c360beffa4b6b12a1e056911b6b9a0381fc3ab151cc5b | Python | 18,438 | 495 | import copy
import ml_collections as mlc
def set_inf(c, inf):
for k, v in c.items():
if isinstance(v, mlc.ConfigDict):
set_inf(v, inf)
elif k == "inf":
c[k] = inf
def model_config(name, train=False, low_prec=False):
c = copy.deepcopy(config)
if name == "initial_tr... |
7a24a5e9f5266773cda77a37dfa5acd695c7c484a8c991a591e6aa0ff275cb8c | Python | 18,447 | 510 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS well-mixed stochastic solver 'Tetexact' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# This model combines all we... |
e349f5bf2ac4db3e4cc8db050eef759cedf1533ad503dc1854a69daa570ee668 | Python | 18,448 | 520 |
# 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... |
0e4dae7adf9b1a0c4fa2f1df7ea9532970ec61469012718366a95136e7ebf87e | Python | 18,449 | 520 |
# 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... |
52c7c529c39d1857d1d63ff0b62fed0f366d1eceebf5928acf4b7eba7633e758 | Python | 18,453 | 496 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS spatial stochastic solver 'TetOpSplit' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# Note, while these are well-mi... |
fd53cd45daea8988c871076275272b6e6ef0fe79c3acf03af3d5107f71fdb466 | Python | 18,456 | 520 |
# 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... |
40b4f5eb3761c833b00a3f0373a024f059c823a56065596ebab49d31febaabe3 | Python | 18,458 | 513 | import warnings
warnings.filterwarnings("ignore",category=DeprecationWarning)
import sys
sys.path.append('../..')
import os
import copy
import random
import pandas as pd
import pickle
import math
import torch
import lmdb
import numpy as np
from torch.utils.data import Dataset
from tqdm.auto import tqdm
from Bio.PDB.PDB... |
87b8dc73b272ab95fe8db322f83996df127b552aa138c6fd1be6a9a17ca84604 | Python | 18,469 | 569 | #!/usr/bin/python
#############################################################################
#Package: stamp
#Updated By Yiqin Wang
#Usage:
#main
#retrieve variant information
#require .var file output from scan.py
#
##############################################################################
import sys
from ar... |
c69f5e498f3090b1f71d4f1ed96e8e159e8b360aeff8d8f83eeb0f99a71d362f | Python | 18,469 | 364 | import os.path
import numpy as np
import pandas as pd
from tqdm import tqdm
import pyfaidx
import json
import pickle
import gzip
import csv
import h5py
from src.dataloaders.utils.dna import dna_str_to_one_hot
class FastaStringExtractor:
def __init__(self, fasta_file):
self.fasta = pyfaidx.Fasta(fasta_fil... |
fb7a1ade743818b1cd5bf8c34a0a096e7395d40691852e55602f81d615408745 | Python | 18,470 | 496 | ########################################################################
# Well-mixed chemical reactions.
# AIMS: to verify STEPS spatial stochastic solver 'TetOpSplit' computes
# reaction rates correctly when many different chemical species and
# reactions are present in the model.
# Note, while these are well-mi... |
8ec35dca50cc9858da5c580359fea2e0b3fb89256e33bcecada56d1a6d9c9203 | Python | 18,483 | 432 | import itertools
import math
from collections import OrderedDict
import torch
from torch import nn
from neuralpredictors import regularizers
from neuralpredictors.layers.activations import AdaptiveELU
from neuralpredictors.utils import check_hyperparam_for_layers
from ...regularizers import DepthLaplaceL21d
from ..a... |
cf9b0a5a95bb2b2550580c5438b9ef5807f98146f0d59a44091720acd91d90c7 | Python | 18,496 | 394 | # Analyses of individual observer representations
# Copyright (c) 2021 Laurent Caplette
import numpy as np
from sklearn.decomposition import PCA
import nltk
import csv, os, re, json
import torch
from torch import nn
from robustness.datasets import ImageNet
from robustness.model_utils import make_and_restore_model
impo... |
658b0ff8be22d93dcd7273cec9ce2e98b7bf2ed59b97e729b19d87698b4f1399 | Python | 18,526 | 520 |
# 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... |
d1d6df1d5ccb4b74a25446e334b728a51b6f5320acad8c5212a6ec59f9232406 | Python | 18,564 | 400 | import rdkit
from rdkit import Chem
from optparse import OptionParser
from rdkit import RDLogger
lg = RDLogger.logger()
lg.setLevel(4)
'''
This script evaluates the quality of predictions from the rank_diff_wln model by applying the predicted
graph edits to the reactants, cleaning up the generated product, and compari... |
f635eb734387cfb9fc25695f272cb4197eec47fd206da165cb9be8abd0f193d7 | Python | 18,571 | 500 | # 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... |
f149bfd22802b549f29b5007fe1d140a37c36374a830790544adb940b657141b | Python | 18,591 | 473 | # 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... |
4375200877242b0ab66ca3850ac1594c3b17c08ca843e5a544797757e12b1814 | Python | 18,599 | 703 | #!/usr/bin/env python
import os
import time
import datetime
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.colors as colors
import scipy.misc as misc
from matplotlib import cm
from scipy import ndimage
from skimage import filters
assert "AN... |
db7728ef5fdca83337e7bf4caadfdc0a56798a0f16298f4841ffea2bed625b1b | Python | 18,603 | 486 | """
:AUTHOR: Jonas Scherer
:ORGANIZATION: Department of Neurobiology and Department of Cognitive Neuroscience, Bielefeld University, Germany
:CONTACT: jonas.scherer@uni-bielefeld.de
:SINCE: Mon Dec 12 11:08:00 2022
:VERSION: 0.1
This module contains data cleaning functions.
"""
import numpy as np
import pandas as pd
... |
8b1f41c1b41b23db1746b033fb7c29ffb70f887bb0884400af51c3db3a3ca5d4 | Python | 18,604 | 311 | import sys
import os
import shutil
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
sys.path.insert(1, os.path.join(sys.path[0], '../../../'))
from Articles.DMS_DLS.Code.FiguresDMS import *
ratio = 0.4
name = 'article'
name_dir = 'noise'
noise_stim_list = [0., 0.001, 0.005, 0.01, 0.05, 0.1]
P_st... |
21a121c9b3936800bded247509cb770af9adef3691507a54926c36e146c11025 | Python | 18,623 | 627 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Author: Yulia Rubanova
###########################
import os
import logging
import pickle
import torch
import torch.nn as nn
import numpy as np
import pandas as pd
import math
import glob
import re
from shutil import copyfile
import skle... |
97dc0d5f33f067e78b0a8472edb811141c5f15529460ffa02cbf3c5776470fed | Python | 18,637 | 358 | import torch.nn.functional as F
import torch
import escnn
import e2cnn
from utils import grid
# ----------------------------------------------------------------------------------------------------------------------
# Rotation Equivariant Unets
# --------------------------------------------------------------------------... |
575a360742a58c72cc8b75a52747e8e5bdb8569370fb850112fd2e5aea81258b | Python | 18,649 | 420 | #!/usr/bin/env python3
# coding: utf-8
"""
ABCD-BIDS Task fMRI Pipeline
Original: template_subject_specific_pipeline_DCAN_Public_Users_V2.py
Original Author: Anthony Juliano, PsyD, NERVE Lab, acjulian@uvm.edu
Original Created: 2020-10-27
Wrapper Author: Greg Conan, DCAN Lab, gconan@umn.edu
Wrapper Created: 2020-12-22
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.