sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
58d4767232395b5fe3b6e336c161b3dbb26d26c0496285c6dbf7af253826b0d3 | Python | 6,927 | 147 | #!/usr/bin/env python3
#$ -cwd
#$ -V
#$ -N C_7MBS_his
#$ -e /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/C_7MBS_his.err
#$ -o /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/C_7MBS_his.out
#$ -pe smp 2
#$ -jc long
import os
import sys
import time
import numpy as np
im... |
ccd89d0e438502a40a355c52dcee2b375875cd9154c3092843b6a2970dba2f39 | Python | 6,928 | 155 | '''
read channel info
8/31/2022 jz103
'''
import os
import gc
import warnings
from copy import deepcopy
from time import time
import re
import datetime
import json
import numpy as np
import matplotlib.pyplot as plt
# import pandas as pd
# from scipy.io import loadmat, savemat
from load_intan_rhd_format import read_d... |
8f5eee2b793f8f8098580f79c456005c743a50f97b59fc279280cdabfa7f6e4c | Python | 6,929 | 228 | from langchain_core.prompts import PromptTemplate
SONG_DATA_SOURCE = """\
```json
{{
"content": "Lyrics of a song",
"attributes": {{
"artist": {{
"type": "string",
"description": "Name of the song artist"
}},
"length": {{
"type": "integer",
... |
9f6c52f2427b82f0dfb77c6acbaae4aae708e7a7cadec06ecb41e61f108c7e3d | Python | 6,929 | 213 | # Adapted from OpenFold
# Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... |
69d9310e9ebfd2c90d38cc058fae3f56b27e6be88dde9789565f2512e44519a6 | Python | 6,930 | 181 | # -*- coding: utf-8 -*-
####################################################################################
#
# 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 t... |
e6e02ffa977f1ca524fe6120a62f8138ea443e59670307b21cb3e3a0c9617bef | Python | 6,933 | 182 | from datetime import datetime
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Dropout, Dense, LSTM, SimpleRNN, GRU, Conv1D
import matplotlib.pyplot as plt
import os
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error, m... |
41fda77a6933d9a1daa33318a086a205de376e51fd8a03e3e23e34af7f9e7e50 | Python | 6,935 | 183 | """LangSmith document loader."""
import datetime as dt
import json
import uuid
from collections.abc import Callable, Iterator, Mapping, Sequence
from typing import Any
from langsmith import Client as LangSmithClient
from typing_extensions import override
from langchain_core.document_loaders.base import BaseLoader
fr... |
ed37ad4854c10ae7eec05a7b11634e8e26e07b393025623b493625a266d40718 | Python | 6,935 | 176 | import numpy as np
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class FaceRotateConvolution(nn.Module):
def __init__(self):
super(FaceRotateConvolution, self).__init__()
self.rotate_mlp = nn.Sequential(
nn.Conv1d(6, 32, 1),
nn.BatchNorm1d(32)... |
cf87c10cd7c14181e487eb50cac066db384b98b0d64d517c095a00dcaaad2883 | Python | 6,936 | 192 | import sys;sys.path.append('../src/')
import pylab
import spiketools
import defaultSimulate as default
from copy import deepcopy
from bisect import bisect_right
import ClusterModelNEST
import defaultSimulate as default
import pickle
import pandas as pd
import numpy as np
from joblib import Parallel, delayed
from Genera... |
b865c53103dba8796a6d1c8f5be325b9e6eb8bb1165f6a443d615890d5d33fe1 | Python | 6,938 | 264 | # code in this file is adpated from rpmcruz/autoaugment
# https://github.com/rpmcruz/autoaugment/blob/master/transformations.py
import random
import PIL, PIL.ImageOps, PIL.ImageEnhance, PIL.ImageDraw
import numpy as np
import torch
from PIL import Image
def ShearX(img, v): # [-0.3, 0.3]
assert -0.3 <= v <= 0.3
... |
84704af7253eb2410f797f56d1a330183ce88fb0f10523b3e76a9eaa69220bd0 | Python | 6,945 | 214 | import argparse
import coeff_plots as cp
import kernel_plots as kp
from matplotlib import pyplot as plt
import seaborn as sns
import copy
import sys
sns.set_palette('colorblind')
plt.rcParams.update({
'axes.titlesize': 'small',
'axes.labelsize': 'x-small',
'xtick.labelsize': 'xx-small',
'ytick.lab... |
12dad67645bdaae32ed8a585e2a48bd94674d2b8a0d58256af1b00aebb79f48f | Python | 6,947 | 178 | """
Tests for callback utility classes and functions.
"""
import pytest
from openff.toolkit.utils.callback import Callbackable, callback_method
from openff.toolkit.utils.exceptions import CallbackRegistrationError
class CallHistory:
"""Used to keep track of the order in which callbacks and methods are called b... |
20302624a385fe0f590d4654cc3bf4e2079def82954ecc9f5a8ecc821dc61544 | Python | 6,954 | 54 | from langchain_core.prompts import PromptTemplate
question_prompt_template = """Use the following portion of a long document to see if any of the text is relevant to answer the question.
Return any relevant text verbatim.
{context}
Question: {question}
Relevant text, if any:""" # noqa: E501
QUESTION_PROMPT = PromptTe... |
2531e4968f26065f1437c93e69c0194ad8416fac12f557352b1fbc6546d8dd03 | Python | 6,959 | 159 | import os
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import random
from tqdm import tqdm
import h5py
from utils import Utils
import logging
import tensorflow as tf
import cv2
#Data source: https://figshare.com/articles/dataset/brain_tumor_dataset/1512427
class DataLoad:
"""
... |
d31a5f7cea5f6e83de809cfb90be68fb021a5dd3ce5a7e54d76ca30f4dad487f | Python | 6,961 | 180 | # Description: This script is used to test whether Combat, Covbat, and Relief Harmonization preserve the biological signal in the data (i.e., signal from the covariates)
# We deploy a simple Machine Learning Framework to predict covariates from raw, Combat, Covbat, and Relief data - and compare the performance of the t... |
99f1fad4e5996a76783842bcafe49770df06a60d39cd3d0844a554009d1d5616 | Python | 6,962 | 217 | import numpy as np
import matplotlib.pyplot as plt
from data import prob_repeat_to_frac_novel, generate_recog_data
from networks import DetHebb, DetHebbNoSplit
#%% Get generalization performance
Rtest = np.unique(np.logspace(0, 3, 20, dtype=int))
multiRep=False
P = 0.5
f = prob_repeat_to_frac_novel(P, m... |
9ac6ec4f385d753d0cac8acc7accca7c26e97e4e621ea0d3596b600f4575dcf3 | Python | 6,967 | 197 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
08c2f2add4f2d35fc34a46eb405d594bfb9384bff8f1f76a27f94e65cfa125de | Python | 6,970 | 158 | import os, glob, sys
import numpy as np
from skimage.io import imread, imsave
# from scipy.ndimage import label, binary_dilation
from scipy.ndimage import binary_dilation
from skimage import measure
from skimage.measure import label
if __name__ == '__main__':
import sys, os
filepath = os.path.dirname(os.path.... |
95a7e2eb2f8889381631c283325c16dd97b45c956ab8da8b20efb5abaf16076c | Python | 6,970 | 218 | import os
import subprocess
import argparse
# Color codes for printing
RED = "\033[31m"
GREEN = "\033[32m"
RESET = "\033[0m"
class FileCopier:
@staticmethod
def copy_test_slide(slide: str):
"""Copies a test slide to the input folder.
Parameters:
------------
slide (str):... |
4fb8d67a83f948d88980edd249278dd917a77271e550a068e812390b9ab37354 | Python | 6,971 | 203 | """Model profile types and utilities."""
import logging
import warnings
from typing import get_type_hints
from pydantic import ConfigDict
from typing_extensions import TypedDict
logger = logging.getLogger(__name__)
class ModelProfile(TypedDict, total=False):
"""Description of a chat model's capabilities, expos... |
002146c30eeb3eea7803b03e946695e7dd1774b64f8fca47b36b768086420fe4 | Python | 6,975 | 203 | ########################################################################
# 2D diffusion on an infinite surface from point source.
# AIMS: to verify STEPS spatial-deterministic solver 'TetODE' supports
# local initial conditions and calculates surface diffusion rates correctly.
# STEPS equivalent model: Determinist... |
5e76c0b40148ddab60fad909a72862a1eef871967eab99de654c54b0aff6c049 | Python | 6,990 | 219 | import torch
from torch.nn import functional as F
import numpy as np
import torch.nn as nn
from torch.autograd import Variable
def dice_loss(score, target):
target = target.float()
smooth = 1e-5
intersect = torch.sum(score * target)
y_sum = torch.sum(target * target)
z_sum = torch.sum(score * scor... |
6ba5fca621f9f97b18e99aa6c5036c54ed5a85ad5157fd7c3a30d2f1c2ade60c | Python | 6,991 | 176 | import tensorflow as tf
from rexgen_direct.rank_diff_wln.nn import linearND, linear
from rexgen_direct.rank_diff_wln.mol_graph_direct_useScores import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph, smiles2graph, bond_types
from rexgen_direct.rank_diff_wln.models import *
import math, sys, random
from optpa... |
5d7b1d68402360ec467ecccf4bc6703f884f9f92ba444344f47e0de67a667683 | Python | 6,992 | 203 | ########################################################################
# 2D diffusion on an infinite surface from point source.
# AIMS: to verify STEPS spatial-deterministic solver 'TetODE' supports
# local initial conditions and calculates surface diffusion rates correctly.
# STEPS equivalent model: Determinist... |
915ac2f3cdf443ecd11b7b951e5f5b7c737933b18f80f9900c2ecb58c57730d3 | Python | 6,992 | 113 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\main_window.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 imp... |
6ac8232e3b70ee6a0ed91090d2ffa3e39509c4733661d3221b9b8c8a0dc132e4 | Python | 6,995 | 200 | from skfeature.function.similarity_based import fisher_score
from sklearn.feature_selection import mutual_info_classif,VarianceThreshold
from sklearn.feature_selection import SequentialFeatureSelector
from mlxtend.feature_selection import SequentialFeatureSelector as SFS
from sklearn.linear_model import LogisticRegress... |
11bbd5ad3ad6d2c27e2e70be59339e65a7c663ddf516d941665e0de78bfaf9df | Python | 6,996 | 162 | # 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... |
f696f9f18b41b2fa9e3ee1067d7151292a9894251b930d32d8e1336a0196db01 | Python | 6,998 | 193 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
fcb974ab29eeeaaa980cc804f78c23e61861c96455a3071d9f6080aac5cd5301 | Python | 7,000 | 179 | import itertools
from collections import OrderedDict
from typing import Callable, Mapping, Union
import numpy as np
from sklearn.neighbors import KDTree
from utils.features.abc import ABCFeatures
from sklearn import neighbors
class KNNFeatures(ABCFeatures):
def __init__(
self,
unique_type... |
e44ef8d048e30ea8c8271f849556d0792da102f833da46d34fb039ea9d803362 | Python | 7,004 | 201 | import data_analysis_utils as dana
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
# Sizes
# Width in inches available for content (figure, text)
# in an A4, Nature-style paper
A4_PAPER_CONTENT_WIDTH = 7.1
DEFAULT_HEIGHT = 2.16 # default figure height, in inches
TWIN_AXIS_PAD = 30 / 300
... |
04691c5a4b1f247fc810968dc87e90441d6028df076ea9df1905c52ab8835ad1 | Python | 7,005 | 148 | #!/usr/bin/env python3
#$ -cwd
#$ -V
#$ -N m5_his_n
#$ -e /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/m5_his_none.err
#$ -o /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/m5_his_none.out
#$ -pe smp 2
#$ -jc long
import os
import sys
import time
import numpy as np
im... |
ff26ab1d659d477aa88662dcc783b405e3bb87df4e4f4ed1b67c201996bedeb8 | Python | 7,005 | 175 | # Script from https://github.com/flyyufelix/DenseNet-Keras/blob/master/densenet161.py
from keras.models import Model
from keras.layers import Input, concatenate, ZeroPadding2D
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import Average... |
b7059efb8881d93ed5c16aecdc38538afaee083c85984597fbec5e52d6c45e40 | Python | 7,015 | 172 | import glob
import os
import SimpleITK as sitk
import numpy as np
import argparse
from medpy.metric import binary
import GeodisTK
from scipy import ndimage
def dice(pred, label):
if (pred.sum() + label.sum()) == 0:
return 1
else:
return 2. * np.logical_and(pred, label).sum() / (pred.sum() + la... |
593d90a8d75e9a6ee51e0461e6ac417f847b8a5af3b78d6ae2c30fb9e83c4df2 | Python | 7,016 | 162 | # 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... |
a68e057b973e242ffe78e33e839c30c6ab2ebf72fea8550096d7980501cf6c0e | Python | 7,024 | 206 | #! /usr/local/bin/python
#'#################################################################################
#'#################################################################################
#' Train a neural network based on kegg pathways
#'##########################################################################... |
8182293a4bb68fd357e8aae5f7ec2a707db991a13679c575de1438430cd1a821 | Python | 7,028 | 161 | """Normalization and attention utilities for DDSurfer."""
from __future__ import annotations
import math
import torch
import torch.nn as nn
DEFAULT_REFINEMENT = {
"norm_type": "group",
"use_se": False,
"residual_gates": True,
"geometry_aware_lka": True,
"conditioned_attention": True,
"rk4_s... |
ee43fd5f1d28864e1569474bb2bf208891c07b9775094aa745707b76dd92ad00 | Python | 7,028 | 207 | # -*- coding: utf-8 -*-
"""
Methods to featurize a protein, based on PyEMMA.
More options are described here:
http://www.emma-project.org/latest/api/generated/pyemma.coordinates.featurizer.html
"""
import warnings
import numpy as np
import pyemma
from pyemma.util.contexts import settings
from pensa.features.processin... |
62a1983c01895b4ee94b47524574b09e21caa045afdfde5c485e27f675065f82 | Python | 7,031 | 171 | import re
from typing import Any
from langchain_core.exceptions import OutputParserException
from langchain_core.output_parsers.base import BaseOutputParser
from pydantic import field_validator
from typing_extensions import override
from langchain_classic.output_parsers.format_instructions import (
PANDAS_DATAFRA... |
720319fdb0bf0d463078a295e4a1d6cb480e56ccbf7d6a072373ad19ee8e5cec | Python | 7,031 | 155 | __version__ = '1.6.0'
from typing import List
from typing import Optional
from .EnrichmentAnalysis import Enrichmentscope
from .General.Omicscope import Omicscope
from .General.Snapshot import Omicscope_Snapshot
from .MultipleData.Nebula import nebula
if __name__ != "__main__":
print("OmicScope v " + __version__ ... |
8a4f20ed5dc4bbc85b6e395fa97e1c9a6fd68583c3822213953b0eb65e88e02b | Python | 7,031 | 217 | import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
class Preprocessing():
def __init__(self, k_size=6):
self.k_size = k_size
kmers = self.ref_kmers("", self.k_size)
self.vectorizer = CountVectorizer(vocabulary = kmers)
self.seqs = []
... |
16df5ef444e7b1c2ff75121755ad84d4879c098242093764570a6d09e0ab88eb | Python | 7,033 | 128 | # 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... |
334419eadcfb7b78b698b2886a65b1bfb990b3c64d9f63fb3a6b828e27c88600 | Python | 7,033 | 155 | import os
import random
import pandas as pd
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
import pandas as pd
import seaborn as sns
from sklearn.metrics import confusion_matrix
import logging
import pip
import importlib
import sys
import subprocess
import l... |
3a4f788425ab03013d32ec13bc58bd9b56db25ff16d26c1887f246a9d6a1446d | Python | 7,039 | 168 | """
This script assumes a 20-some-hour continuous recording is already sorted in one piece
Then it chops it into segments, and calculate unit metrics separately for each segment
"""
# (1) read filt.mda for how many samples there are
# (2) for each defined segment, create new filt_seg.mda and firings_seg.mda and calcula... |
b3c1dc2ae82b4f9ab8169a773e099bbd5eff017dd079ebb9c7e019fa1f6b0414 | Python | 7,040 | 162 | import math
import logging
from tqdm import tqdm
import numpy as np
import torch
import torch.optim as optim
from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data.dataloader import DataLoader
from torch.cuda.amp import GradScaler
import re
import pandas as pd
logger = logging.getLogger(__name__)
cl... |
230cca09ea0b9fd83038fd155d19275894dddc559ebd3d7c0491ba2287ac84bd | Python | 7,046 | 210 | '''ShuffleNetV2 in PyTorch.
See the paper "ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" for more details.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from collections import OrderedDict
from torch.nn import init
import math
... |
3fdfcaf24cabd178a0c64d969fa4e0105f6f7e0c618010cbb5746d47fffbc776 | Python | 7,050 | 199 | import math
import torch
from e3nn.math import soft_unit_step
def soft_one_hot_linspace(x: torch.Tensor, start, end, number, basis=None, cutoff=None):
r"""Projection on a basis of functions
Returns a set of :math:`\{y_i(x)\}_{i=1}^N`,
.. math::
y_i(x) = \frac{1}{Z} f_i(x)
where :math:`x` ... |
eb74e87cae8725bd1ddbd1f6f1db5aaf3a594c831a9ff3af0b4a3e12ce535fbf | Python | 7,054 | 182 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import scipy.stats
import numpy.ma
import Stats
import Histogram
from cgatReport.Tracker import *
from cpgReport import *
##########################################################################
class replica... |
1e04d66557644806d4ebbec2f8e7874081cccdb413dcda834670d17e52462bb5 | Python | 7,056 | 245 | # -*- coding: utf-8 -*-
from typing import Optional, Tuple
from anndata import AnnData
import torch
import numpy as np
import pandas as pd
from scipy.sparse import issparse, csr_matrix
import scipy.sparse as sp
from sklearn.neighbors import NearestNeighbors
from tqdm import trange
from module1 import VAE as VAE1
fr... |
d97b1a92542bc890d767f12729f0f8b82e0dbc37cc0365ca5c98c5bc4571469d | Python | 7,057 | 138 | # 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... |
c38406353b62f8137b284a32189bde8727bb3458f302915e99a733fccfd170c4 | Python | 7,061 | 201 | # 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 ... |
12c25223b53057912b1c68edebd2362fc6a4c7e9d26119b03c48c9d07273d779 | Python | 7,064 | 178 | import logging
import warnings
from typing import Tuple, Union
import numpy as np
from numpy.typing import ArrayLike
from ..utils import anscombe
logger = logging.getLogger(__name__)
def corr(
y1: ArrayLike, y2: ArrayLike, axis: Union[None, int, Tuple[int]] = -1, eps: int = 1e-8, **kwargs
) -> np.ndarray:
... |
63c7469430f4c7fc23b711b470042f173b0dbdd19da51d64b121524d7dec4e9e | Python | 7,064 | 206 | """Module Description
Copyright (c) 2014, Ying Jin <yjin@cshl.edu >
This code is free software; you can redistribute it and/or modify it
under the terms of the Artistic License (see the file COPYING included
with the distribution).
@author: Ying Jin
@contact: yjin@cshl.edu
"""
import sy... |
a9017ca035de5e3461776dd45c31500615513d8b774b2e9ece028c204a5fa44d | Python | 7,064 | 177 | import logging
import os
import socket
import sys
import numpy as np
from configs.configs import get_config_dict
from helpers.simulations import save_synthetic_dataset
from helpers.synthetic_covariance_structures import get_constant_covariances
from helpers.synthetic_covariance_structures import get_periodic_covarian... |
bb95fad8178032bec0134d4a0c6b7f936f3cd65c3bb4173f62f1f1dbad1d99e3 | Python | 7,065 | 177 | import numpy as np
from gym import spaces
from typing import Union, List
from gym_unity.envs import (
UnityToGymWrapper,
UnityGymException,
GymStepResult,
ActionFlattener,
logger,
)
from animalai.envs.environment import AnimalAIEnvironment
from animalai.envs.arena_config import ArenaConfig
class... |
4619f32155643897f9d2b09cb3c6dd5b4943e47ec876bdb7fb618d994eeeb48e | Python | 7,067 | 171 | # resnet model
# when tuning start with learning rate->mini_batch_size ->
# momentum-> #hidden_units -> # learning_rate_decay -> #layers
import tensorflow.keras as keras
import tensorflow as tf
import numpy as np
import time
import matplotlib
from utils.utils import save_test_duration
matplotlib.use('agg')
import ... |
54cc2b088c86856d2a2b469b72c793f7025291fb5f442137501866313863d4db | Python | 7,067 | 214 | """Structured prompt template for a language model."""
from collections.abc import (
AsyncIterator,
Awaitable,
Callable,
Iterator,
Mapping,
Sequence,
)
from typing import (
Any,
overload,
)
from pydantic import BaseModel, Field
from typing_extensions import override
from langchain_cor... |
5d7a26c332558dae320331d87774a5e799064068cf7b69516d9a75ab1678d3f0 | Python | 7,067 | 205 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import numpy.ma
import Stats
import Histogram
import cpgReport
from cgatReport.Tracker import *
from cgatReport.odict import OrderedDict as odict
from macs_annotations import *
###################################... |
2b4d31d58c034f1e2a501674797f6f6c49e5385cc34bf0242e0f2a70bae1cb3b | Python | 7,069 | 138 | # 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... |
301b121b3af59726049533662b4dc4bbd70c02fb864a34ed68190e9b6aef52b2 | Python | 7,070 | 169 | import numpy as np
from scipy.interpolate import NearestNDInterpolator
import mxnet as mx
import mxnet.ndarray as nd
import os
from varflow import VarFlowFactory
from nowcasting.config import cfg
from nowcasting.hko_evaluation import HKOEvaluation, pixel_to_dBZ, dBZ_to_pixel
from nowcasting.hko_benchmark import HKOBenc... |
5cf1abbbca8b695e14f98ac0291157d5d19e267556a794a03050480138453e8b | Python | 7,072 | 207 | """Tests for verifying that testing utility code works as expected."""
from itertools import cycle
from typing import Any
from uuid import UUID
from langchain_core.callbacks.base import AsyncCallbackHandler
from langchain_core.messages import AIMessage, AIMessageChunk, BaseMessage
from langchain_core.outputs import C... |
42149c3839a450547e7066efefca9787f22891be9cbeb98fbadc6e48c7291d19 | Python | 7,081 | 169 | import tensorflow as tf
from abc import ABC
from enum import Enum
from tensorflow.keras.layers import AveragePooling2D, AveragePooling3D, \
GlobalAveragePooling2D, \
GlobalAveragePooling3D, \
GlobalMaxPooling2D,... |
96bd5101d00877aa9074ae360f44ebb95077cdc7228af3cab4faaf7f329bee77 | Python | 7,081 | 176 | import uuid
from collections.abc import Sequence
from typing import Any
from langchain_core.documents import Document
from langchain_text_splitters import TextSplitter
from langchain_classic.retrievers import MultiVectorRetriever
class ParentDocumentRetriever(MultiVectorRetriever):
"""Retrieve small chunks then... |
2f308e0bdd4ee9596b32b0f7911381a0ae63379b4ac9bf5a69b8bc73a0bf598a | Python | 7,085 | 259 | """Test for some custom pydantic decorators."""
import sys
import warnings
from typing import Any
import pytest
from pydantic import BaseModel, ConfigDict, Field
from pydantic.v1 import BaseModel as BaseModelV1
from langchain_core.utils.pydantic import (
_create_subset_model_v2,
create_model_v2,
get_fiel... |
9649cd75da5e5c9f7a7ae3d4ae0f8873f73ff3c5370906209b68bc6066cbf938 | Python | 7,086 | 227 | import numpy as np
import pandas as pd
import scipy.stats as stats
import statsmodels.api as sm
from statsmodels.formula.api import ols
from statsmodels.regression.linear_model import RegressionResultsWrapper
from statsmodels.stats.multicomp import pairwise_tukeyhsd
from matplotlib.figure import Figure
import seaborn... |
da750bbd38c737b991b923a55ea9c0efd186186d29458a1775dba8b2a3e8798b | Python | 7,087 | 176 | # Creation of experimental stimuli
# Copyright (c) 2021 Laurent Caplette
import numpy as np
import torch
from torch import nn
import torchvision
import os, h5py
from robustness.datasets import RestrictedImageNet, ImageNet
from robustness.model_utils import make_and_restore_model
import scipy.stats as stats
from sklear... |
6f26a105b02609cfc97f2f509cd17cfa6ecfd4930d11cb0c3194f657d8fd2dad | Python | 7,089 | 206 | from unittest import TestCase
import numpy as np
import pytest
import torch
from chroma.layers.graph import (
MLP,
GraphLayer,
GraphNN,
collect_edges_transpose,
edge_mask_causal,
permute_graph_embeddings,
)
class Testcollect_edges_transpose(TestCase):
# Simple case of 3 noddes that are c... |
987a2ea7f70f80bd60fbf46d5e610fb89df91cbaa35fc887e65243e205eb8e58 | Python | 7,091 | 219 | import torch.nn as nn
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/resnet34-333f... |
74fcd1fa580380081f4fadffa213ce455e10c0d7b1fe4e91c9cad8488c42ef53 | Python | 7,093 | 174 | import collections
import torch
from .solvers import AdaptiveStepsizeODESolver
from .misc import (
_handle_unused_kwargs, _select_initial_step,
_optimal_step_size, _compute_error_ratio
)
_MIN_ORDER = 1
_MAX_ORDER = 12
gamma_star = [
1, -1 / 2, -1 / 12, -1 / 24, -19 / 720, -3 / 160, -863 / 60480, -275 / 24... |
ea317e4543e0aa39ef0eb29cca364a266dc1699b2abee996096cf820a1ad5a19 | Python | 7,095 | 200 | """Module implements a memory stream for communication between two co-routines.
This module provides a way to communicate between two co-routines using a memory
channel. The writer and reader can be in the same event loop or in different event
loops. When they're in different event loops, they will also be in differen... |
508500bd24c5da63af4473d9e6830cea56c348a6a9822f1f62c46bf1db56ef7f | Python | 7,099 | 216 | """Attempt to implement MRKL systems as described in arxiv.org/pdf/2205.00445.pdf."""
from __future__ import annotations
from collections.abc import Callable, Sequence
from typing import Any, NamedTuple
from langchain_core._api import deprecated
from langchain_core.callbacks import BaseCallbackManager
from langchain... |
b8ce265495b33ab187559689a839b1fe99c2fcc6ccc3eefc7770b3447aa6726f | Python | 7,099 | 193 | #!/usr/bin/env python
from forcebalance.molecule import Molecule
from forcebalance.nifty import which
from openeye import oechem
import openmoltools
import os, sys, time, argparse, subprocess
def CalculateMolecularWeight(mol):
"""
Calculate the molecular weight for an OpenEye molecule.
Parameters
---... |
30390da2f2769f2660732304102eb1fd2cfce23c16ca77aee4d8734161e2e182 | Python | 7,105 | 179 | import numpy as np
from tqdm import tqdm
import torch
from rdkit import Chem
from rdkit.Chem import rdDetermineBonds
def nan_to_num(vec, num=0.0):
idx = np.isnan(vec)
vec[idx] = num
return vec
def _normalize(vec, axis=-1):
return nan_to_num(
np.divide(vec, np.linalg.norm(vec, axis=axis, keepdi... |
972609be637e302887125524231db6d7b359ab1d913341cb4f3ac80d78825fc3 | Python | 7,105 | 176 | import torch
################################################################
# Dataset class
################################################################
class pde_data(torch.utils.data.Dataset):
def __init__(self, data, T_in, T_out=None, train=True, strategy="markov", std=0.0):
self.markov = strategy... |
fde1fe4440b790fe860bd13b1923c820c271126a58774325e4e28206adfe63f1 | Python | 7,107 | 171 | """tests for registration/nicp.py.
uses small synthetic icospheres rather than the real shipped templates -
the real ones have enough vertices that a full 20-step alpha schedule is
slow to run in a test suite; a small mesh with a short schedule is enough
to check the two properties that actually matter here (it conver... |
26487601c6e170232a76e2bc47385c5acd914c73fe1984f25912283643a72051 | Python | 7,109 | 159 | # 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... |
1f4e2dac8aad6d2ce1a4273599abde8391f2cbcf186053c960469c1818dff428 | Python | 7,112 | 180 | import numpy as np
import pandas as pd
from conftest import existing_expobj_nopredones2p_fixture
from imagingplus import Experiment, import_obj
from imagingplus._archive.TwoPhotonImagingMain import TwoPhotonImagingTrial
from imagingplus.processing import suite2p
from imagingplus.processing.suite2p import Suite2pExperi... |
779e5a81a231bf25c7870aef0874d6fb7d1ee08d3c731949b70c6a3ac7f77367 | Python | 7,112 | 180 | import torch
import torch.nn as nn
from torch.nn import functional as F
import numpy as np
#function for Variational
class VariationalModule(nn.Module):
"""
creates base class for VariationalNN, in order to enable specific behavior
"""
def init(self):
super().__init__()
'''
... |
509b6f4901666a0fe715e4134bd1f129389fc467d5895fa4ce8ebc7ab288ad59 | Python | 7,114 | 182 | """
Methods to obtain a timeseries distribution for the atom/ion pockets' occupancies.
Atom pockets are defined as radius 2.5 Angstroms (based off of bond lengths between Na and O, and Ca and O)
centered on the probability density maxima of the atoms.
The methods here are based on the following paper:
| Neil... |
f8d4a2315d69d6dc9651cbcc2cc7df6d69b5b458dded92007722d6459617d42d | Python | 7,114 | 152 | import unittest
import os
from optimization.LBFGS import *
from optimization.ADMM import *
from optimization.LinearSolvers import *
class TestOptimizers(unittest.TestCase):
def setUp(self):
""" Initialize any common data or setup needed for the tests. """
torch.manual_seed(117) # reproducibility ... |
fe821ffeff1e7e7154754719e01ca46a2f3f9c486791b8ee88db9d3400c87b8c | Python | 7,114 | 192 | import argparse
import os
from functools import partial
import pandas as pd
import rdkit
import scipy
import torch
import numpy as np
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
from scipy.stats import pearsonr, spearmanr
from torch.utils.data.dataloader import DataLoader
from tqdm.au... |
8e0a3766b026aca27081714789b55f7f189d4255794dfb381ff7bf47322e7f36 | Python | 7,116 | 208 | """
##############################################################################
#
# Filter design table based on the quality of RNA-Seq samples.
#
# AUTHOR: Maciej_Bak
# AFFILIATION: University_of_Basel
# AFFILIATION: Swiss_Institute_of_Bioinformatics
# CONTACT: wsciekly.maciek@gmail.com
# CREATED: 02-05... |
c16c3852ad4f39fe0d2f6111ea2b033327961b93ce838378162a879fcce692ce | Python | 7,126 | 158 | """
In this file the sectionalizing and tie switch details are specified.
The DER details are also specified (in particular the ones with and without grid forming capability).
Also the path for the DSS file containing the circuit information is specified.
The final DSS circuit which will be used by the environment is... |
5448688de9797b07ed00b7ec2a132fdae851b611982b99162730859cea9ebefd | Python | 7,130 | 213 | # 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,... |
e6f25637f2730b6c47b52ef3933b735a3e55d37ceddbc8c5933a892fac85f455 | Python | 7,135 | 195 | import Bio.SeqIO as sio
import tensorflow as tf
import numpy as np
from sklearn.preprocessing import LabelBinarizer
from tensorflow.keras.utils import to_categorical
import random
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import tqdm
#load model
filterm = tf.keras.models.load_model(os.path.join(os.path.dirnam... |
cbe382da65629c2423b8182445044a77f759368f4957b2445c2290c2d5820fa7 | Python | 7,136 | 199 | # 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... |
396e5ddb271858b04b13224e00a6b2ce81536f10ec41191f5299245eb173c33f | Python | 7,138 | 318 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 26 13:51:51 2022
@author: M. Agustina Frechou
"""
'''
Boostrapping code and preprocessing to analyze tuning data
'''
import os
import glob
import scipy.io
import numpy as np
import random
from random import choices
import csv
#%%
'''
Functions
'''
def get_r2(filel... |
e8bed9bb713d2c1de64fdf6f26354372763c1033864f358b18257f8a5131a2aa | Python | 7,139 | 238 | """
HyperGAT class
HGAT_sparse
HGNN_sg_attn
HGNN_fc
"""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.autograd import Variable
import numpy as np, scipy.sparse as sp
import cupy as cp
from torch.utils.dlpack import from_dlpack
i... |
6997a8b1cfcd37bea62dfb52f7c9f5c15fef38e5f753fe3fec375ba65e0907e2 | Python | 7,142 | 185 | import glob
import os
import SimpleITK as sitk
import numpy as np
import argparse
from medpy import metric
def read_nii(path):
return sitk.GetArrayFromImage(sitk.ReadImage(path))
def dice(pred, label):
if (pred.sum() + label.sum()) == 0:
return 1
else:
return 2. * np.logical_and(pred, labe... |
53d5598beac0593ac450747c26d8a647e71946bc6658bffd75be2fbf28a2520b | Python | 7,143 | 197 | # -*- coding: utf-8 -*-
from __future__ import print_function
import torch.utils.data as data
from PIL import Image
import os
import os.path
import errno
import torch
import codecs
import torchvision.transforms as transforms
import urllib
# FROM https://raw.githubusercontent.com/mayurbhangale/
# fashion-mnist-pytorc... |
a291a581434098e3149db504022c0469ec313b2a6ac3099d526388a475e395ef | Python | 7,145 | 189 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from scipy import interp
import os
from sklearn.metrics import confusion_matrix, roc_auc_score
from sklearn.metrics import roc_curve, auc, confusion_matrix
from glob import glob
from utils import read_txt
def read_score_label(file):
score, label ... |
7a160f4eafaa891a45f33edb37a45f4743f7a45803513549625844a4c6c40060 | Python | 7,150 | 218 | import cv2, os, imageio
import numpy as np
import pandas as pd
import json
from scipy.special import softmax
from scipy.special import expit
from sklearn.metrics import confusion_matrix
import warnings
warnings.filterwarnings("ignore", message="Lossy conversion from float64 to uint8")
imgs_path = './data/artworks/'
... |
cfb8f8fbaadf6f5e6526b03521adfbf1d69b6e8ecf1c8adb9d4fefcccb201cae | Python | 7,152 | 198 | import numpy as np
import os
from sklearn.preprocessing import minmax_scale
from ..read import data_reader as dr
from ..preprocess import permute as perm
from ..utils import path as pth
from ..forward import laplacian as fwd
class Brain:
"""A class containing data that represents a single brain.
Attributes:... |
68baaf4ea874f4c7b7f586d7bf573c8ae28f2ab2e9237a6a2234d502e2467940 | Python | 7,153 | 166 | import pandas as pd
import numpy as np
from numba import jit
import scipy.stats
import argparse
# @jit(nopython=False)
def get_entropy(x):
entropy_list=[]
for i in sample:
arr=np.array(x[i])
if len(set(arr))==1:
entropy=0
else:
entropy=scipy.stats.entropy(arr[arr... |
712b0aaf9c289ff7cd83819672575cf11a841a0bd0fc9d13226f8fef5ec9a3f0 | Python | 7,154 | 197 | from rdkit import Chem
import numpy as np
from qm9.bond_analyze import get_bond_order, geom_predictor
from . import dataset
import torch
from configs.datasets_config import get_dataset_info
import pickle
import os
def compute_qm9_smiles(dataset_name, remove_h):
'''
:param dataset_name: qm9 or qm9_second_half... |
8a8be39dad47c3505749fa4f8be0bdf31b39a7675590528214f639946b203cf6 | Python | 7,157 | 160 | """
In this file the sectionalizing and tie switch details are specified.
The DER details are also specified (in particular the ones with and without grid forming capability).
Also the path for the DSS file containing the circuit information is specified.
The final DSS circuit which will be used by the environment is... |
e5cd4a94206bf25ead5346da1c63e91066a3c3140877fe4d69a6b4357fb6ff48 | Python | 7,161 | 168 | # Import packages
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from os import listdir
from os.path import isfile, join
from collections import defaultdict
import csv
from SMdRQA.RP_maker import RP_computer
from SMdRQA.Extract_from_RP import windowed_RP
from SMdRQA.Extract_from_RP import First_... |
f65f200e1687baff9e389cc70ffba6b5f1f4f303229eeede6083637ac6303192 | Python | 7,161 | 222 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
if '../../../embeddings' not in sys.path:
sys.path.append('../../../embeddings')
from seq2tensor import s2t
import keras
from keras.models import Sequential, Model
from keras.layers import Den... |
9a03e76e6e06bed0855588b1fac56c17a050de1379aeea1184d748591555715e | Python | 7,163 | 293 | CompScalerMeans = [
21.194441759304013,
58.20212663122281,
37.0076848719188,
36.52738520455582,
13.350626389725019,
29.468922184630255,
28.71735137747704,
78.8868535524408,
50.16950217496375,
59.56764743604155,
19.020429484306277,
61.335572740454325,
47.14515893344343... |
b509a8dcf391d1faed59240a1431995524719d3727777633dbb974d2c9931c75 | Python | 7,163 | 163 | import os
import logging
import string
import random
import tensorflow as tf
import numpy as np
import pandas as pd
from datetime import datetime
from dipgnn.models.model_utils import swish
from dipgnn.utils.register import registers
from abc import ABC, abstractmethod
@registers.task.register("base_trai... |
06c4cf0e2152d18c253bc02d5b522d8f6ac6f1d87fe7008550f88f954117e222 | Python | 7,169 | 240 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 28 23:11:36 2022
@author: Agus
"""
'''
Imports
'''
#matplotlib.use('Qt5Agg')
import os
import numpy as np
import glob
import sklearn.decomposition
from sklearn import metrics
from sklearn.linear_model import LogisticRegression
'''
FUNCTIONS
'''
def neurons_per_file(fi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.