sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2b5a91953e88b940db51666a39a4031bac2d18ffdec8f504f42b0f355ce1781b | Python | 1,012 | 40 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 16 11:07:22 2021
@author: athanasiadis
"""
import numpy as np
import time
def timer(start_time):
"""
timer
______________________
This is a function that prints the eclapsed time of the code compliation
Input:
... |
b9b00482113eecff7717fdeca6c0449c50573582ee73a3605cececa21bfb4e0f | Python | 1,012 | 27 | import numpy as np
from tensorflow.keras import Model
from tensorflow.keras.layers import Subtract, Input
from explainability.layers import SubtractLRP
def test_subtract():
i1 = Input((4,))
i2 = Input((4,))
a = Subtract()([i1, i2])
model = Model([i1, i2], a)
explainer = SubtractLRP(model.layers... |
3d1ddcc20105a7ae9e9e093ec8d1a2a86fb2e5789d2bdab8e03379ebabff433e | Python | 1,013 | 27 | from abc import abstractmethod
import torch.nn as nn
from core.loss.base import atom_loss_register
from core.loss import loss_register
from core.loss.utils import loss_dict_remake_wrapper, merge_loss_dict
from functools import partial
from utils.tensor_operator import tensor2array
class AtomLossCombinator(nn.Modul... |
b8ae35d407957ea719ca47cd5385aef7cf79483750028f446274a6fa12a92bfd | Python | 1,013 | 41 | from pathlib import Path
import click
import pandas
@click.command()
@click.argument(
"amber_frcmod_path",
type=click.Path(),
)
def main(amber_frcmod_path):
ion_nb_params = list()
nonbonded = False
with open(Path(amber_frcmod_path)) as amber_frcmod_file:
for line in amber_frcmod_file:
... |
b92a963e0d9a5e0481d9eceb78c392bc4b4f7e3d4ae8d43d7bc28e8043fec322 | Python | 1,013 | 36 | from typing import TYPE_CHECKING, Any
from langchain_core.document_loaders import Blob, BlobLoader
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.document_loaders import (
FileSystemBlobLoader,
YoutubeAudioLoader,
)
# Create a way to dynamically... |
d48f72f593389b606e78fa2165afb3e3c183782af58b7f963076ddc31c0e4803 | Python | 1,013 | 25 | import numpy as np
from pnabind.mesh import getClassSegmentations
from pnabind.mesh import getFaceArea
def getDistanceFromBoundary(V, F, Y, E=None, area_faces=None, skip_classes=[0]):
import gdist
# compute class segmentations
if E is None:
E = F[:, [0, 1, 1, 2, 2, 0]].reshape((-1, 2)) # edge ... |
d8994bb8778ce361fa1f590b3a5a3f5633f488a48954957ad155369ed5614eeb | Python | 1,013 | 53 |
infile=open("Recon3D_pathway_gene_symbol_tbl.csv", "r")
hcopfile=open("HCOP_mouse_human_15col.txt", "r")
outfile=open("Recon3D_pathway_Mm_gene_symbol_tbl.tab", "w")
tab="\t"
hcopdb={}
fs=hcopfile.readline()
while 1:
fs=hcopfile.readline()
if fs=="":
break
fsl=fs.split(tab)
hs=fsl[4]
mm=f... |
527a7d84147f2618b2b076736a068437f765da0c612c64d618bb3f077d63c266 | Python | 1,014 | 33 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.callbacks.labelstudio_callback import (
LabelStudioCallbackHandler,
LabelStudioMode,
get_default_label_configs,
)
# Create a way to dynamically look up d... |
88bf20a15426563bb8ac7385b2633612229efd9c61405581b6bf16b5e3d2af18 | Python | 1,014 | 33 | from typing import List, Tuple, TypedDict, Optional, Union, Callable, Dict
import numpy as np
class PfpData(TypedDict):
"""TypedDict containing the data for a single Polyfingerprint.
Args:
repeating_units (Dict[str: float]): Dictionary containing the
SMILES representation of each repeatin... |
07e78735061906849b133077087435cfc4bedc2bf41cd0880ea40d8ec4183d20 | Python | 1,016 | 42 | from ._warnings import ExperimentalWarning
from .check_functions import _check_1d_array_object, _check_length_equal
from .mathext import cartesian, sample_discrete
from .optimizer import optimize, pinverse
from .state_name import StateNameMixin
from .tabular import (
build_state_names,
collect_state_names,
... |
0a8c33f60c7784032c2872e3ba5695fbb532d31f5b19d17ef210bb2b00df22d2 | Python | 1,016 | 35 | # For image loading
from PIL import Image
from torch.utils.data import Dataset
import numpy as np
class BCN20k_Dataset(Dataset):
def __init__(self, df, settings, transform=None):
# Initialize the dataset from a dataframe and by default no transformations
self.df = df
self.transform = tran... |
50c166974f1f58e0c1292412bfc9e0a9b0de8ed1bf7d36ee592d50cbc479ae1d | Python | 1,019 | 34 | PREFIX = """Respond to the human as helpfully and accurately as possible. You have access to the following tools:""" # noqa: E501
FORMAT_INSTRUCTIONS = """Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).
Valid "action" values: "Final Answer" or {tool_names... |
d7c4c7821d6a3ffb7d1bd7fe6c3f03e29872dcd60da6bc1015885aa1a5b74b6b | Python | 1,019 | 31 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def draw_raster(dirpath, raster_list, save=False, delimiter=';'):
FONTSIZE = 12
fpath_list = [dirpath + "raster_" + e + ".csv" for e in raster_list]
x,y = ([] for _ in range(2))
for i in range(len(fpath_list)):
spikes =... |
de59b320c9e66def4cad148b898a324854954bb52fff62a19829c336c171fb32 | Python | 1,019 | 55 | import numpy as np
def alpha_n(x):
return (0.1 - 0.01 * (x + 65.)) / (np.exp(1. - 0.1 * (x + 65.)) - 1.)
def alpha_m(x):
return (2.5 - 0.1 * (x + 65.)) / (np.exp(2.5 - 0.1 * (x + 65.)) - 1.)
def alpha_h(x):
return 0.07 * np.exp(-(x + 65.) / 20.)
def beta_n(x):
return 0.125 * np.exp(-(x + 65.) / 8... |
0b8d20c331eadaea74511a18785b0b85b910bc1e3de6d1b98ba845a3126f46b0 | Python | 1,020 | 30 | """Predict micro-pKa of organic molecules"""
# Add imports here
from ._version import get_versions
from .qupkake import *
__version__ = get_versions()["version"]
import os
import subprocess
try:
check_package = subprocess.run(["conda", "list", "xtb"], stdout=subprocess.PIPE)
check_package_decoded = check_pa... |
30d7003e8f27ef32295ffb7c8e8854730c6b80188bf7a0ca8a445a71ad6a161c | Python | 1,022 | 27 | # Generated by Django 3.1.4 on 2021-03-07 11:04
import brain_render.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Scene',
fields=[
... |
453feb3625a9e2fcc666ca2de96a830608d8d700138e7bc70276dd04c57ca1b1 | Python | 1,023 | 29 | import numpy as np
#from scipy.linalg import toeplitz,
from scipy import linalg
from scipy import sparse
def TikhonovRegularizationMDSlow(x, DiffOrderOrFilterCoefs, Lambda):
x = np.array(x)
if(np.isscalar(DiffOrderOrFilterCoefs) == True):
l = np.zeros(DiffOrderOrFilterCoefs, dtype=int).tolist()
... |
8f8ed980d95bbd342d454c646f7ecadbf3a8b1f2427913c7a3c367dff16985de | Python | 1,023 | 32 | """Regression tests for release minimum dependency selection."""
from pathlib import Path
from unittest.mock import patch
import pytest
from get_min_versions import get_min_version_from_toml
@pytest.mark.parametrize(
("versions_for", "expected"),
[
("release", {"langchain-core": "1.4.7", "langchain-... |
d4c047b51c526eebb14a03b946ea9179517dfe28849bb2288952f1b35b411127 | Python | 1,023 | 37 | import time
from uuid import UUID
from langchain_core.utils.uuid import uuid7
def _uuid_v7_ms(uuid_obj: UUID | str) -> int:
"""Extract milliseconds since epoch from a UUIDv7 using string layout.
UUIDv7 stores Unix time in ms in the first 12 hex chars of the canonical
string representation (48 msb bits).... |
ce17f2f8e6c134ec599c5fea4c4fc1e132a6c004383f550f691f6317f2f9fdcd | Python | 1,024 | 46 | import torch
import torch.nn.functional as F
def euclidean_dist(x: torch.Tensor, y: torch.Tensor):
''' Compute euclidean distance between two tensors
params:
x: n x d
y: m x d
'''
n = x.size(0)
m = y.size(0)
d = x.size(1)
assert d == y.size(1)... |
4f38c1a6c5727f1b09a62a0077fefd449b40a7cf721415f2f683868710d13960 | Python | 1,025 | 38 | import numpy as np
import steps.interface
from steps.saving import *
from steps.sim import *
from steps.geom import *
from steps.model import *
from steps.rng import *
from . import DiffPoint
########################################################################
# Inject species in the whole mesh and let them diff... |
ecfccf0f94fc4d4fe64d3f01c5f082b6c697642e7e2757f25f1e8490520408ae | Python | 1,025 | 31 | # Authors: David Sabbagh <david@sabbagh.fr>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: MIT
"""M/EEG power regression pipelines in Python"""
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix relea... |
cecace021b22f720ce5f6467c6184afd6296e4a5fd3cf371b9833d45acfad429 | Python | 1,026 | 42 |
import pandas as pd
from PoET import POET
# =============================================================================
# Perform tracking of videos
# =============================================================================
# instantiate POET object with path to video folder
folder = './data/'
poet = POET(fo... |
7ec96103b76965e2d92576dbab5b907aaee2ed23e78d018fa154b937cd7c9755 | Python | 1,028 | 54 | import numpy as np
def alpha_n(x):
return 0.02 * (x - 25.) / (1. - np.exp(-(x - 25.) / 9.))
def alpha_m(x):
return 0.182 * (x + 35.) / (1. - np.exp(-(x + 35.) / 9.))
def alpha_h(x):
return 0.25 * np.exp(-(x + 90.) / 12.)
def beta_n(x):
return -0.002 * (x - 25.) / (1. - np.exp((x - 25.) / 9.))
d... |
b0d062a6fa3108f0eac39cbb906523032750a5463b69ab8f75a9b154e74a70c3 | Python | 1,028 | 43 | import matplotlib.pyplot as plt
from dival.measure import PSNR, SSIM
from dliplib.reconstructors import learnedpd_dip_reconstructor
from dliplib.utils.helper import load_standard_dataset, set_use_latex
set_use_latex()
# load data
dataset = load_standard_dataset('ellipses')
test_data = dataset.get_data_pairs('test'... |
ed6b0b2647845a88bba610604bec13fdb610986f71cb74564f2d888d30e5fc2b | Python | 1,030 | 35 | from langchain_core.prompts.prompt import PromptTemplate
API_URL_PROMPT_TEMPLATE = """You are given the below API Documentation:
{api_docs}
Using this documentation, generate the full API url to call for answering the user question.
You should build the API url in order to get a response that is as short as possible, ... |
82b610954f8b2cef3b52de9b10277f08ba875c1d151b7a5f0d946231cc8b5528 | Python | 1,031 | 33 | ''' Module initializer includes all sub-modules.
:Version:
3.0
:Date:
15.07.2014
:Author:
Jan Melchior
:Contact:
pydeep@gmail.com
:License:
Copyright (C) 2014 Jan Melchior
This program is free softwar... |
5a641f9b50bdc1a84a848aa08194338db8da413aa2a71d30eedcd18d07a64f4c | Python | 1,032 | 32 | #!/usr/bin/env python
import os
import tempfile
import requests
import bz2
class FormattedSummaryStatistics:
@staticmethod
def formatSummaryStatistics(raw, snps, prefix):
command = "munge_sumstats.py --sumstats {raw} --merge-alleles {snps} --out {out} --a1-inc".format(
snps = snps, raw = ... |
60bfd52f57d57f198b263b69f3f1a17f7315b1193d403f673ee99594fc208f06 | Python | 1,032 | 32 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import DuckDuckGoSearchResults, DuckDuckGoSearchRun
from langchain_community.tools.ddg_search.tool import DDGInput, DuckDuckGoSearchTool
# Create a way to dynamically look... |
9452a9e0dc6410d2ac1ea1da2a6cf9eb9e66bc34e67c5ef5940c262623e637a5 | Python | 1,034 | 34 | """Training and evaluation"""
import run_lib
from absl import app, flags
from ml_collections.config_flags import config_flags
import os
FLAGS = flags.FLAGS
config_flags.DEFINE_config_file(
'config', 'configs/inference_ribodiffusion.py', 'Training configuration.', lock_config=True
)
flags.DEFINE_enum('mode', 'in... |
3cf4c984f6519f3e8b2be8dca82221afb589d938d9cf06dfdf880f8d4516e9ad | Python | 1,035 | 38 | import torch
import torch.nn as nn
class Xtoy(nn.Module):
def __init__(self, dx, dy):
""" Map node features to global features """
super().__init__()
self.lin = nn.Linear(4 * dx, dy)
def forward(self, X):
""" X: bs, n, dx. """
m = X.mean(dim=1)
mi = X.min(dim=1... |
40fc0ac20984cb7bbc3f489f7b53f9a01dfd85cc4e0940383b908ba96c49f149 | Python | 1,036 | 45 | import sys
import gzip
# Warning: you need to download 'Homo_sapiens.GRCh37.87.gtf.gz' first in the current directory
input_file = 'Homo_sapiens.GRCh37.87.gtf.gz'
out_fh = gzip.open('hgnc_to_ens_gids.txt.gz', 'w')
hgnc_to_ens_ids = dict()
cnt = 0
with gzip.open(input_file) as fh:
for line in fh:
line = line.dec... |
732df5ec32bf9cadde659492de05739ec34bc9613bfc9f1ab21483247a5b061e | Python | 1,036 | 36 | """2D phase reconstruction using the waveorder API."""
from waveorder.api import phase
settings = phase.Settings(
transfer_function=phase.TransferFunctionSettings(
wavelength_illumination=0.532,
yx_pixel_size=0.1,
z_pixel_size=0.25,
z_focus_offset=0,
numerical_aperture_illu... |
fd011bf821a32a5e60ff7ffc734bd63abeb7eabfed2ed9463534a9d62b5ed5df | Python | 1,036 | 31 | """
2023.08.30
author: femke.hurtak@epfl.ch
File containing parameters for the project.
"""
from pathlib import Path
import os
# --- Initial data preparation --- #
RAW_DATA_DIR = os.path.join(Path(__file__).absolute().parent, "data")
CODEX_DUMP_DIR = os.path.join(RAW_DATA_DIR, "codex_dump", "v630-20230803")
GRAPHS_DIR... |
45456d35b746356e399db457b46deba69a607b1d8261f1a392419edf0749bfbe | Python | 1,037 | 54 | import numpy as np
def alpha_n(x):
return 0.02 * (x - 20.) / (1. - np.exp(-(x - 20.) / 9.))
def alpha_m(x):
return 0.182 * (x + 35.) / (1. - np.exp(-(x + 35.) / 9.))
def alpha_h(x):
return 0.024 * (x + 50.) / (1. - np.exp(-(x + 50.) / 5.))
def beta_n(x):
return -0.002 * (x - 20.) / (1. - np.exp((... |
85e9df499c0cf4bda0635b7e9469bb129b195feb0acf20c9ce8277ed6f3a6575 | Python | 1,037 | 33 | ''' Module initializer includes all sub-modules.
:Version:
3.0
:Date:
15.07.2014
:Author:
Jan Melchior
:Contact:
pydeep@gmail.com
:License:
Copyright (C) 2014 Jan Melchior
This program is free softwar... |
ac1e58831a69c475554306f22db6952a22178eb4a8e3d667855a0e981660a129 | Python | 1,037 | 33 | ''' Module initializer includes all sub-modules.
:Version:
3.0
:Date:
15.07.2014
:Author:
Jan Melchior
:Contact:
pydeep@gmail.com
:License:
Copyright (C) 2014 Jan Melchior
This program is free softwar... |
10061d777cca4b6e420f2dfa50a0b85846202ecaa83f03486562e95364bd750d | Python | 1,040 | 31 | import os
from subprocess import check_call
from funlib.run import run, run_singularity
import logging
from synister.read_config import read_worker_config
import sys
iteration = int(sys.argv[1])
worker_config = read_worker_config("worker_config.ini")
base_cmd = "python {} {}".format("train_pipeline.py", iteration)
... |
756477648ed2f052170a3ceee62ec0210f7ebfe4c4c3e5a8858207973b38938d | Python | 1,040 | 33 | #!/usr/bin/env python
import sys
import wget
from tqdm import tqdm
import os
import argparse
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("uniprot_mapping_file", help="map from chain id to uniprot id")
arg_parser.add_argument("-o", "--output_file", default="found.txt")
arg_parser.add_argument("-r",... |
a637f201b82c5175f6369b039eca008b508714d6455c0badfe7fa84fe55da8f7 | Python | 1,041 | 33 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.document_loaders import PlaywrightURLLoader
from langchain_community.document_loaders.url_playwright import (
PlaywrightEvaluator,
UnstructuredHtmlEvaluator,
... |
e7ea46fb448e2ab4cc1dc5190965bc769e15eb75e1ccbc23890de4c4fe324ea3 | Python | 1,041 | 33 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chat_message_histories import SQLChatMessageHistory
from langchain_community.chat_message_histories.sql import (
BaseMessageConverter,
DefaultMessageConverter,
... |
cadd44cd967e5ad12036d5f7468e43bfa651a546eabc216b4ce3b95987fea2db | Python | 1,042 | 30 | import langchain_core
from langchain_core.callbacks.manager import _get_debug
from langchain_core.globals import get_debug, set_debug
def test_debug_is_settable_via_setter() -> None:
previous_value = langchain_core.globals._debug
previous_fn_reading = _get_debug()
assert previous_value == previous_fn_read... |
012187164ffa6fb7b840934a8689688b94401015eac3e6b013d93533ab4bbc10 | Python | 1,046 | 27 | import os
import time
d='/jukebox/griffiths/bert-brains/'
with open("joblist.txt","w") as f:
for dataset in ['slumlordreach','black']:
#Slumlordreach
if dataset=='slumlordreach':
subs=['sub-145', 'sub-143', 'sub-016', 'sub-142', 'sub-141', 'sub-133', 'sub-140', 'sub-136',
'sub-084', 'sub-135', 's... |
f7f3d527917470784434c7a3257657c2209117f68064ad4c2982121cfde195ba | Python | 1,046 | 36 | """SSRF protection and security utilities.
This is an **internal** module (note the `_security` prefix). It is NOT part of
the public `langchain-core` API and may change or be removed at any time without
notice. External code should not import from or depend on anything in this
module. Any vulnerability reports should... |
19145b171c8586d1055982f2f9e0a80548122b09192eafc68c35ebe3b38af514 | Python | 1,048 | 33 | # third party modules
import numpy as np
# pnabind modules
from pnabind.utils import clipOutliers
def getMeshCurvature(mesh, gaussian_curvature=True, mean_curvature=True, shape_index=True, remove_outliers=True):
try:
import igl
except ModuleNotFoundError:
raise ModuleNotFoundError("The depende... |
2430e35cfafd663782cc60efabd0d991d73da5c4ef4da78d177dcd39f43bb466 | Python | 1,048 | 33 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.retrievers import (
GoogleCloudEnterpriseSearchRetriever,
GoogleVertexAIMultiTurnSearchRetriever,
GoogleVertexAISearchRetriever,
)
# Create a way to dyna... |
8c08ab1945503ea4a4dac84e011522f49c120125e38c452f27a3b9473c877887 | Python | 1,048 | 51 | from langchain_core.messages import (
AIMessage,
AIMessageChunk,
AnyMessage,
BaseMessage,
BaseMessageChunk,
ChatMessage,
ChatMessageChunk,
FunctionMessage,
FunctionMessageChunk,
HumanMessage,
HumanMessageChunk,
SystemMessage,
SystemMessageChunk,
ToolMessage,
T... |
428f1a94c09e58fd4cfa3a4acb3ebd8d84137641fcaaf3bb1629ef404d977de5 | Python | 1,049 | 37 | from qtpy.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QPushButton
from qtpy.QtCore import Qt
class CustomDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.case = 0
self.setWindowTitle("Choose the image type")
b1 = QPushButton("2D ... |
c5381109b265946c3fb433f8f8dfa07eac408252413b35408d1fcf342e17fced | Python | 1,049 | 33 | #-*- encoding:utf8 -*-
class DefaultConfig(object):
acid_one_hot = [0 for i in range(20)]
acid_idex = {j:i for i,j in enumerate("ACDEFGHIKLMNPQRSTVWY")}
BASE_PATH = "../"
#... |
73a168c048bfb9e8315282d3c9d57e45418be2e41a2a403a4816f946d33ce2ba | Python | 1,050 | 36 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.vectorstores import PGEmbedding
from langchain_community.vectorstores.pgembedding import (
CollectionStore,
EmbeddingStore,
QueryResult,
)
# Create a... |
c9c611638012cd61b261065ec6fb938cabde627b002b3c2b4a2bde8f3a6a961d | Python | 1,050 | 36 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.graphs import NetworkxEntityGraph
from langchain_community.graphs.networkx_graph import (
KnowledgeTriple,
get_entities,
parse_triples,
)
# Create a ... |
60ad09fc5a560c18af92f20b50b9c53bd283602b34945ff099bdc40a48094717 | Python | 1,051 | 34 | # Run this script after...
## Extracting NIfTI datasets from 'flat_map_data_10um_v2.mat' with 'extract_flatmap.m'
## Removing one-voxel padding all around in xgrid3d (or similar)
## Expanding X to cover both hemispheres in xgrid3d (or similar)
## Converting to NRRD in xgrid3d (or similar)
## Transposing and Z flipping ... |
2f4d539107de878641fbef6676cafe4683d4752b046c313bf7910ecd8fe01962 | Python | 1,054 | 35 | import os
import cv2
from glob import glob,iglob
from tqdm import tqdm
from joblib import Parallel,delayed
from engine import utils
from constants import BASE_DATA_DIR,CXRAY_SZ,CHEXPERT_DIR
def resize_cxp_images(split):
dst_folder = utils.get_prepared_path('%schexpert_320/%s/'%(BASE_DATA_DIR,CHEXPERT_DIR.split(... |
a3457efc9e3f5c32246b743ad482b20832f5a0adab8106443a85726f50fc5ac2 | Python | 1,054 | 27 | from scaden.simulation import BulkSimulator
"""
Simulation of artificial bulk RNA-seq samples from scRNA-seq data
and subsequenbt formatting in .h5ad file for training with Scaden
"""
def simulation(simulate_dir, data_dir, sample_size, num_samples, pattern,
unknown_celltypes, out_prefix, fmt):
un... |
b4c3507754705a322b7d1084c9e88a1988e6e0844baa73d17fa086e76f31721f | Python | 1,054 | 35 | """ Module initializer includes all sub-modules.
:Version:
1.1.0
:Date:
19.03.2017
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
:License:
Copyright (C) 2017 Jan Melchior
This file is part of the Python library PyDeep.
PyD... |
0bb1ca88745bb38dacc82dae4686001f68426a4e9035a182142e2c0fb51bee47 | Python | 1,055 | 33 | """Contains tests for the Conv2D-layer LRP implementations"""
import numpy as np
from tensorflow.keras import Model
from tensorflow.keras.layers import Activation, Input, ReLU
from explainability.layers import ReLULRP
# def test_relu_lrp():
# input = Input((4,))
# layer = ReLU()(input)
# model = Model(... |
0d057bb6949c5d5adbb1959c748348054e6689f8241fc3e09cc0b5c6bf23279f | Python | 1,055 | 29 | clmns = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39"]
threads = len(clmns)
import pandas as pd
import sys,os
file_name = 'Cell'
idf =... |
164b21c25bd62fae160dc4d1536890da719ce1dd2d015c51cebedf07539d9cdc | Python | 1,055 | 29 | clmns = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39"]
threads = len(clmns)
import pandas as pd
import sys,os
file_name = 'Cell'
idf =... |
2a244d8345dd2e26b32bd64c56fa912bbec9ff2e09c570476fc639aa2dbbad6f | Python | 1,056 | 27 | import torch
from network import common_network
from alg.algs import ERM
class ARM(ERM):
"""Adaptive Risk Minimization (ARM)"""
def __init__(self, input_shape, args):
original_input_shape = input_shape
input_shape = (1 + original_input_shape[0],) + original_input_shape[1:]
super(ARM, s... |
22c30428c539d88ae97e4549929c5bd1c91e27a710f60ee81c3a92b1ef68c8d4 | Python | 1,057 | 61 | # -*- coding: utf-8 -*-
import scanpy as sc
import matplotlib.pyplot as plt
from run_stMDA import run_stMDA
if __name__ == "__main__":
adata = sc.read_visium('../../spatial/10X/1.2.0_Fluorescent/Invasive Ductal Carcinoma Stained With Fluorescent CD3 Antibody/')
sc.pp.highly_variable_genes(adata, n... |
14534119ba794881139686ad7183937309fb163c60efe7008ead28f2d0e93b17 | Python | 1,059 | 45 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import numpy as np
import os
DESCRIPTION = """
Round bval files to the nearest thousand. Required for b-shell extraction.
Cornelius Eichner 2020
"""
np.set_printoptions(precision=2)
def buildArgsParser():
p = argparse.ArgumentParser(description=... |
c13464ed7d605aa671368d92f7b4aba51e6e32603095a1ef48cb00b47521c1c2 | Python | 1,059 | 43 | import torch
import torch.nn as nn
import torch.nn.functional as F
from core.network.head import head_register
from utils.tensor_operator import tensor2array
@head_register
class SimAggregationHead(nn.Module):
"""
Args:
dim (int): The embeddings dims.
"""
def __init__(self, cfg):
supe... |
f61a1f7f2fdb5bab7f659f06b99e7dcbf269882b41285b9c58930224cc8f450e | Python | 1,059 | 25 | import pandas as pd
tpm_stanford = pd.read_csv("rsem_genes_tpm_merged.txt", sep="\t", header=0)
tpm_bic = pd.read_csv(
"/Users/archanaraja/work/repo/motrpac-rna-seq-pipeline/pass1a_results/Stanford/Nicole/bic/rsem_genes_tpm_pass1a_batch1_Stanford.tab.csv",
sep="\t", header=0
)
print(tpm_stanford.shape)
# ... |
1fe97687ffecb24789f131a5781977bd9c1b576779941b1bf6895feb5a9effc4 | Python | 1,060 | 27 | # Generated by Django 3.1.4 on 2021-03-14 19:36
import clustering.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Cluster',
fields=[
... |
5f9312e54559e2eca6c4d0541c5bc0d65a152354657e9744bea9cb59d75d8c83 | Python | 1,060 | 38 | from langchain_core.agents import AgentAction, AgentFinish
from langchain_classic.agents.output_parsers.react_json_single_input import (
ReActJsonSingleInputOutputParser,
)
def test_action() -> None:
"""Test standard parsing of action/action input."""
parser = ReActJsonSingleInputOutputParser()
_inpu... |
05ac707758913153ca511a093fe61f8a2b0dd9679bb4325a548a6bbe3439e5f2 | Python | 1,061 | 28 | import pandas as pd
import os
df_artemis = pd.read_csv(os.path.join('./data', 'artemis_dataset_release_v0.csv'))
df_apolo = pd.read_json(os.path.join('./data', 'apolo.json'))
emotions = []
utterances = []
for i in range(df_apolo.shape[0]):
utterance = []
artemis_idx = df_apolo['artemis_id'].iloc[i]
for ... |
90f35c95fe9549f4bb9f3248b7fb952d41aabb463d34ab4b477b302ec817326e | Python | 1,061 | 42 | import torch
import torch.nn as nn
import torch.nn.functional as F
from core.network.head import head_register
from utils.tensor_operator import tensor2array
@head_register
class MaxAggregationHead(nn.Module):
"""
Args:
dim (int): The embeddings dims.
"""
def __init__(self, cfg):
supe... |
ccd85f4b9f6bdbd6a471d210a2c6a704e441166e129977835540dfcd2b010c17 | Python | 1,062 | 31 | import numpy as np
import torch
from torch.distributions import Distribution, Normal
class ExponentialMixture(Distribution):
def __init__(self, fraction_on, considered_zero=1e-2):
super().__init__()
self.fraction_on = fraction_on
self.rate = -np.log(considered_zero) / considered_zero
... |
da3d2ef967ddf2c9cf9b693dee63d1d560da1e49e9e3fed79b5406258611a66e | Python | 1,062 | 39 | '''Trackers for analysing chromatin tracks.'''
from ChipseqReport import *
class TrackerTracks(TrackerSQL):
mPattern = "_tracks$"
def getTracks(self, subset=None):
return [x for x in TrackerSQL.getTracks(self, subset) if "annotator" not in x]
def getSlices(self, subset):
return self.ge... |
75f203841d7a475cbb59da994dfcfb98b9be89cc99bcac3281dc510bc413da73 | Python | 1,063 | 41 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 29 15:28:47 2021
@author: nicol
"""
from skimage.io import imread
from sklearn.metrics import jaccard_score, recall_score, precision_score, accuracy_score
import os, glob, tqdm
import numpy as np
from skimage import color
import pandas as pd
import seaborn as sns
import ... |
c3626f7017d8c65184170e3f6e8014230ddf6ba10fa9c7748eb3d12f6a82499c | Python | 1,063 | 25 | import tensorflow.compat.v1 as tf
from tensorflow.keras import layers
from tensorflow.keras.models import Sequential
class Atom2BondBlock(layers.Layer):
def __init__(
self,
hidden_size,
name='atom2bond_block',
activation=None,
kernel_initializer="glorot_uniform"
):
... |
8c7eb2534dac0acb67988f67026fbfb1e82ec29f138694e3d87a15ea57262f98 | Python | 1,064 | 36 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.utilities.vertexai import (
create_retry_decorator,
get_client_info,
init_vertexai,
raise_vertex_import_error,
)
# Create a way to dynamically lo... |
9d1807fc74fc6eb7d742d928c336db38c512dbcc444168f422aa28082931c03c | Python | 1,064 | 42 | from typing import Any
from typing import List
import torch
import torchvision
from torch import nn
from .cifar10 import *
from .cifar10 import __all__ as __all__cifar10
from .cornet import *
from .cornet import __all__ as __all__cornet
from .robust import *
from .robust import __all__ as __all__robust
from .shape_bi... |
b3a65994ff3065cfdba71bb122fc60dae3870cc31c0e90c5493f3676cf52d674 | Python | 1,064 | 26 | import sys
import os
sys.path.append(os.path.abspath('../source'))
import tinaui
import tinanet
import os
folder = '../test/sampledata/ocn'
t1 = tinaui.load_status(folder, load_imagedata=True)
t1.networkdict['filtered'] = t1.networkdict['initial'].copy()
tinanet.filter_short_branches(
t1.networkdict['filtered'],... |
dfcf1596f08830dc9088f7f3e120d3354cc34c413f104b12131e59dbbf6994e3 | Python | 1,064 | 50 | import numpy as np
def filter(b,a,x):
# creates a filter through rational transfer function with numerator b, denominator a, and input x
# normalize a[0] to 1
b = np.divide(b,a[0])
a = np.divide(a,a[0])
# create loop to run through transfer function
y = []
for n in range(len(x)):
... |
0d8a7ad75e3db059b17ecda6fc335355f7bdeb91cd4a9a0dfa08f3469b2cf424 | Python | 1,065 | 41 | """Gmail tools."""
from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import (
GmailCreateDraft,
GmailGetMessage,
GmailGetThread,
GmailSearch,
GmailSendMessage,
)
# Create a way to ... |
1b065ab78650507588291ffdc4aebfbcbdc5d90bc08ee76e62200b150670af60 | Python | 1,065 | 40 | from ._base import BaseCITest, get_ci_test
from .chi_square import ChiSquare
from .fisher_z import FisherZ
from .g_sq import GSq
from .gcm import GCM
from .generalized_cov import GeneralizedCov
from .hotelling_lawley import HotellingLawley
from .hsic import HSIC
from .independence_match import IndependenceMatch
from .k... |
4b58394df6569a07fa085e310f69db97bc56b9a43cb13b1f307e4a56a249afff | Python | 1,065 | 36 | """Tracers that record execution of LangChain runs."""
from typing import TYPE_CHECKING, Any
from langchain_core.tracers.langchain import LangChainTracer
from langchain_core.tracers.stdout import (
ConsoleCallbackHandler,
FunctionCallbackHandler,
)
from langchain_classic._api import create_importer
from lang... |
764bef559873e8e0d798ec2f4074ee1c03b20fcc10b49fa1e41a9788118c17dd | Python | 1,065 | 33 | #! /bin/env python
#
# Michael Gibson 27 April 2015
# modified by jz103 Dec 20 2021
import numpy as np
import scipy.signal as signal
def notch_filter(input, fSample, fNotch, Bandwidth=None, Q=20):
"""Implements a notch filter (e.g., for 50 or 60 Hz) on vector 'input'.
fSample = sample rate of data (input Hz... |
9292c5596979dae8b9abb1f8eb00038f8a5e6d58cec8f9dac6c19e5e76cfb344 | Python | 1,065 | 22 | from .base_options import BaseOptions
class TestOptions(BaseOptions):
"""This class includes test options.
It also includes shared options defined in BaseOptions.
"""
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser) # define shared options
parser.add_argum... |
b6010e58b8f112bef3527b798444e91f3b836f6a267974f670fc407fea68fbb5 | Python | 1,065 | 40 | from langchain_core.agents import AgentAction
from langchain_classic.agents.conversational.output_parser import ConvoOutputParser
def test_normal_output_parsing() -> None:
_test_convo_output(
"""
Action: my_action
Action Input: my action input
""",
"my_action",
"my action input",
)
... |
3a9ea082a1e77c3ac9ce17877697474eeb2524f139f0475d463724c549afbce2 | Python | 1,067 | 40 | import torch
def sum_except_batch(x):
return x.view(x.size(0), -1).sum(dim=-1)
def assert_correctly_masked(variable, node_mask):
assert (variable * (1 - node_mask)).abs().sum().item() < 1e-8
def compute_loss_and_nll(args, generative_model, nodes_dist, x, h, node_mask, edge_mask, context):
bs, n_nodes,... |
110b5ed4046ad91c9e1a2db501b1d06599933465067a0cde7306fe1dad9ad1ed | Python | 1,069 | 36 | # third party modules
import numpy as np
def balancedClassIndices(y, classes, max_percentage=1.0, shuffle=True, return_mask=True, dtype=bool, masks=None):
""" create a balanced index set from a vector of labels """
if masks is not None:
# mask y before getting class counts
y = y.copy()
... |
c98a73b1cd1471af6ad8544588f4c30d13d6ee9560a82adafb6301b8524c165e | Python | 1,069 | 37 | import numpy as np
class s2t(object):
def __init__(self, filename):
self.t2v = {}
self.dim = None
for line in open(filename):
line = line.strip().split('\t')
t = line[0]
v = np.array([float(x) for x in line[1].split()])
if self... |
3421d59402b0c52510ef902685d333e14c4c68ec7737b329e0c6d89e6609c0b7 | Python | 1,070 | 33 | import re
from pathlib import Path
def fix_language_codes(bbl_file_path: Path, output_file_path: Path = None):
"""Replace 'en' and 'eng' with 'english' in .bbl files.
Args:
bbl_file_path: Path to the original .bbl file.
output_file_path: Path to save the modified .bbl file. If None, overwrite the... |
3a6e03038646e6895f04ef478f0a858c62605807737bbe1f79adff8561172301 | Python | 1,070 | 38 | """Schema for Blobs and Blob Loaders.
The goal is to facilitate decoupling of content loading from content parsing code. In
addition, content loading code should provide a lazy loading interface by default.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
#... |
a580e7ecbeee4a63bb7e7a55801b3922526802431b8902c55731d646007795eb | Python | 1,071 | 35 | import threading
import serial
from queue import Queue
import time
def _monitor_port(port, queue):
serial_port = serial.Serial(port)
while True:
if serial_port.inWaiting():
b = serial_port.read_all()
trigger_length = int.from_bytes(b, byteorder="big")
print('Received... |
ee6cf93aa946369ba6265f698a33a3ff85d87b4a3e0e3f6b91a3a5d4bee40bd7 | Python | 1,071 | 26 | import os
import pandas as pd
from django.db import models
from django.conf import settings
def get_brain_regions_from_atlas(atlas_filename='brain_render/allen_mouse_25um_v1_2_structures.csv'):
brain_regions = pd.read_csv(atlas_filename, header=0, index_col=1)
brain_regions = brain_regions[['acronym', 'name'... |
56ece88f8a299bcb853d0e7096e8b53bcbc5ae9dad4a4f871d2e12456fa135ec | Python | 1,072 | 28 | import numpy as np
from nowcasting.utils import logging_config
from nowcasting.hko_benchmark import HKOBenchmarkEnv
from nowcasting.config import cfg
import os
def run(pd_path=cfg.HKO_PD.RAINY_TEST, mode="fixed"):
base_dir = os.path.join('hko7_benchmark', 'last_frame')
logging_config(base_dir)
batch_size =... |
76536d73fe59bde12022bc28b7896fecb0180124eae195fe5c3a7c43edc921cc | Python | 1,072 | 39 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import (
BaseSparkSQLTool,
InfoSparkSQLTool,
ListSparkSQLTool,
QueryCheckerTool,
QuerySparkSQLTool,
)
# Create a way to dynamically... |
71d9b99371a72e0dcdf282b65eb1ba44a804e6228c5c4ccd665b1df6b531dd20 | Python | 1,074 | 38 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="matformer",
version="2022.09.15",
author="Keqiang Yan, Yi Liu, Yuchao Lin, Shuiwang Ji",
author_email="keqiangyan@tamu.edu",
description="matformer",
install_requires... |
ad9058410e824dced76e7e974ed5a6d70c2e80dce51e8a5fdd0026e0edb0bf1c | Python | 1,074 | 44 | # coding=utf-8
from alg.algs.ERM import ERM
from alg.algs.MMD import MMD
from alg.algs.CORAL import CORAL
from alg.algs.DANN import DANN
from alg.algs.RSC import RSC
from alg.algs.Mixup import Mixup, OrgMixup
from alg.algs.MLDG import MLDG
from alg.algs.GroupDRO import GroupDRO
from alg.algs.ANDMask import ANDMask
from... |
af443179e88f1f86a3a68857aa448a3d4e1a00e235b952a90a5ec42255e10e2a | Python | 1,076 | 36 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
c39fd37d84f30199fd6a30a789412fd87db311a7906dd162d4451554813fff5a | Python | 1,076 | 38 | from logging import Logger
from pathlib import Path
from typing import List
from ..data import (AnnotationTable, WorldlineTable,
cleanup_worldlines, color_worldlines)
def renumber_worldlines(dataset: Path, annotations: AnnotationTable,
worldlines: WorldlineTable, window_st... |
e8a46bbf91e10d5babe37b19f222ed4d5aee84163cca912d5de609b1ab06eaa5 | Python | 1,076 | 42 | # For this you need matlab and the new requirements.txt
import argparse
import matlab
import matlab.engine
import numpy as np
import scipy.io
from oset.generic.lp_filter.lp_filter_zero_phase import lp_filter_zero_phase
import unit_test as testing
mat = scipy.io.loadmat("../../../datasets/sample-data/SampleECG1.mat")... |
f78dfc890f9dd1771a69295c557f57fe2b9e2bfd8ea0232a85c4dd5149370311 | Python | 1,076 | 30 | from e3nn import o3
from .pace.pace import PACE as PACE_official
def get_model(args, statistics, device):
model_config = dict(
r_max=args.cutoff,
num_bessel=args.num_bessel,
num_elements=len(statistics["z_table"]),
average_energy=statistics["average_energy"],
hidden_irreps... |
863db1d678caaf8a84fe3612ed2987ff05d10f82693cf7054bbd9fecc6cab445 | Python | 1,077 | 39 | from langchain_classic import callbacks
EXPECTED_ALL = [
"AimCallbackHandler",
"ArgillaCallbackHandler",
"ArizeCallbackHandler",
"PromptLayerCallbackHandler",
"ArthurCallbackHandler",
"ClearMLCallbackHandler",
"CometCallbackHandler",
"ContextCallbackHandler",
"FileCallbackHandler",
... |
be8a52a0d72ffed8b9d63419afb309add744067de6f77e91bd3bbab59c47762b | Python | 1,077 | 41 | 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
##################################################################... |
cb9cec31c86942086c30ce4113accc537c6872ee88488738dace25370fbf4b75 | Python | 1,077 | 33 | import numpy as np
import os
from skimage.io import imsave
"""
Generation of groundtruth from onehot-encoding to label-encoding for Panuke dataset
"""
# Supposons que vous avez un tableau masks de forme (nombre_images, x, y, 6)
masks = np.load("/home/cazorla/Images/Panuke/Part 1/Masks/masks.npy")
masks_reordered = ... |
cc0702bccec3015a14c2911c9482e57a73a2647b5afb57424e53c1d13e402ee8 | Python | 1,078 | 38 | import numpy as np
from dival import TaskTable
from dival.measure import PSNR, SSIM
from dliplib.utils import Params
from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset
from dliplib.reconstructors.tv import TVReconstructor
from dliplib.utils.reports import save_results_table
# load ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.