sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fc5af6816d87a6f9c616f3f6a63908526a6af30bfdbf2a7a5fa2683c308dc3b0 | Python | 5,745 | 183 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Extract trio allele counts & GQs for all variants in a vcf
"""
import argparse
import sys
import csv
import pysam
def read_ac_adj(infile, pro, fa, mo):
"""
Read --ac-adj tsv into dictionary
"""
ac_adj = {}
with open(infile) as tsvin:
... |
2f39d65da8fb004180e40b085386f08761d615a926f00fc4e3dec5356dec5fdd | Python | 5,748 | 136 | """
This script converts nnU-Netv2 datastructure to BIDS datastructure. It copies the predictions to the BIDS structure
and renames the label files to include the dataset name and fold number; it also copies raw images and ground truth
labels.
Usage: python nnUNetv2_results_structure.py -i /path/to/nnunetv2_results -o... |
df13000cac8ceb4924a1db5a90de174e0d6d91bfb054a51e3a02242a34ec811a | Python | 5,749 | 177 | """
This script calculates the path hexasymmetry T6 in random walks as a function
of the total number of time steps M, for different values of the tortuosity
parameter. It then saves the path hexasymmetries as a .pkl file
"data/outputs/trajectories/step_pathsyms.pkl". Also plots the path
hexasymmetries. The data is us... |
75e15d271fa530ddc05e265c2c9e3e95b751b8c0f450827bbe678fb5cac317b8 | Python | 5,750 | 126 | #!/usr/bin/python
from PIL import Image, ImageOps
import ntpath
####################################################################################################
# @compose_synaptic_pathway_frame
####################################################################################################
def compose_synap... |
cb9eb83b17240b1cd1975ed65107a7dfae08b5489b01610a30b495bc36123c39 | Python | 5,751 | 177 | import os
import subprocess
import spinnaker2.hardware
from spinnaker2.configuration import (
Experiment,
ExperimentConfig,
MemoryRegion,
PEConfig,
)
from spinnaker2.coordinates import (
PE,
QPE,
ByteAddr,
WordAddr,
align_addr_to_next_multiple_of_other,
)
from spinnaker2.helpers imp... |
7492032b6e04e99e47e3b2ef0b2c9540f2b8244841a6d93c7845bfd7f84ff870 | Python | 5,752 | 121 | import os, logging
import pandas as pd
from misc.dictionary_extension import DocumentTermDictionary
from misc.save_files import read_DocTermDict, write_DocTermDict
from misc.abb_med_disease import gen_abb_med_disease
def build_doc_term_dict(df: pd.DataFrame, config: dict, target_dir: str = None):
logger = logging... |
a739629e6366b2b530bdafcac310e64dadeb5e025a2ec4724cc8b65f5e9acbd7 | Python | 5,752 | 127 | import os
import pandas as pd
import matplotlib.pyplot as plt
from adjustText import adjust_text
annotations = ["chess", "gencode", "refseq_ucsc"]
colors = ['blue', 'red', 'green', 'cyan', 'magenta', 'olive', 'black', 'gray', 'orange', 'purple']
os.makedirs("novel_missed", exist_ok=True)
# for level in ["transcripts... |
06b17a66be22b870ee5da233da63f9aa5bbb907c44d972cdabcef9e3a2ea1c32 | Python | 5,753 | 164 | import asyncio
import sys
import uuid
import pytest
from google.protobuf.timestamp_pb2 import Timestamp
from ray._common.test_utils import async_wait_for_condition
from ray.core.generated import events_base_event_pb2
from ray.dashboard.modules.aggregator.multi_consumer_event_buffer import (
MultiConsumerEventBuff... |
25fb36a3e5f648543f337af5e1725cf7edd5a5b20f5d6435075373e4fd0c5bd6 | Python | 5,753 | 162 | import numpy as np
import json
from spinnaker2 import snn, hardware
import helper
import copy
np.random.seed(46) # TODO: Not all random seeds work
# global params
n_hidden_nrns = 20
n_output_nrns = 12
timesteps = 15
# parameters of convolution layer 1
in_width = 32
in_height = 32
in_channels = 1
out_channels = 4
fi... |
6d9bfebbb9950e2824dc25941aa40e898e0ec0d37163e19de3bc71c596e3c753 | Python | 5,754 | 197 |
import numpy as np
from data_assimilation.forward_model import BaseForwardModel
from data_assimilation.model_error import BaseModelError
from data_assimilation.observation_operator import BaseObservationOperator
import pdb
class ModelError(BaseModelError):
def __init__(self, params, state_dims=None, pars_dims=Non... |
2718c4f80bd45f8b91492ada2485b32ddf7da609b8ba19f6599cf56ed5fec231 | Python | 5,755 | 137 | import torch
import time
import shutil
import argparse
import sys
from config import *
from inputs import *
from utils_inference import *
from utils import get_cnn_arch_from_argin
import pickle
import os
from tqdm import tqdm
class ModelConfig(TrainConfig):
def __init__(self, inputs:dict) -> None:
super().... |
3cf15edd3868ef2d7ae568ad1a27545e516415757e62ddf781a0b9550bdd069d | Python | 5,755 | 129 |
#measure intensities and creates list of roi coordinates and time points
x = []
y = []
pix_val_ts = []
for i in range(im.shape[1]):
for j in range(im.shape[2]):
pix_val_ts.append(im[:, i,j])
y.append(i)
x.append(j)
xy = pd.concat([pd.DataFrame(x), pd.DataFrame(y)], axis = 1... |
e198bd633454790471784e0aa1b94a19b59172c5f76adc09d86fba2614de6f94 | Python | 5,757 | 177 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
1. Modify pyg2 data transformation:
Since S2EF dataset is generated with PyG2, there is no need to convert again
and the ori... |
06a8273e880a217e24ca3229071dbccfaa95a1328785e853054d7c6b7d0db37d | Python | 5,759 | 184 | import unittest
import numpy as np
from neuron_morphology.morphology import Morphology
from neuron_morphology.constants import (
AXON, APICAL_DENDRITE, BASAL_DENDRITE, SOMA
)
from neuron_morphology.feature_extractor.data import Data
from neuron_morphology.features.statistics.coordinates import COORD_TYPE_SPECIALI... |
60177d785d34afd2ff96899876cb20b4dc8d5b64ed62ae85d98b935434f7ec46 | Python | 5,759 | 205 | ################################################################################
# -- Default set of parameters
################################################################################
import numpy as np
import pylab as pl
import matplotlib
"""
'exc-only': fig 5, panel a
'inh-only': fig 5, panel b
'systemic-m... |
aca9e4a9cdb3eb412b7621c2c2680c869be09e6109ad55d5bec9eefc438dbc60 | Python | 5,759 | 152 | import sys
sys.path.append("../..")
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import random
import torch
from dynamic_models_sis_new import Simple_Spring_Model
use_cuda = torch.cuda.is_available()
device = torch.device('cuda:0') if use_cuda else torch.device('cpu')
def mesh(density):... |
7eb7d346fb190d6f4eaeec5e53e0f762dd49c6ed3d358abb767f747a36091ff4 | Python | 5,761 | 157 | """QC for proteomics AnnData: peptide-count / valid-value filtering and
missing-pattern statistics. ``ov.protein`` follows the omicverse
convention of mutating ``adata`` in place — same as ``ov.metabol.cv_filter``."""
from __future__ import annotations
from typing import Optional
import numpy as np
import pandas as p... |
cefede8f6c5edfa395e4d3d83d920c0b6b0f1dd6adbb006850b51f1cdc0a40c8 | Python | 5,763 | 113 | import argparse
from os import fspath
from pathlib import Path
import pandas as pd
import sys
from .cell_lineage_GRN import NetModel
from .cefcon_result_object import CefconResults
from .utils import data_preparation
def main():
parser = argparse.ArgumentParser(prog='CEFCON', formatter_class=argparse... |
0c26b9fadac383568270a66a352c5667f3ebd778646f6dd04404b844f005236e | Python | 5,764 | 171 | import torch
from torch import nn
import torch.nn.functional as F
from ..utils import create_activation, create_norm
class MeanAct(nn.Module):
"""Mean activation class."""
def __init__(self, softmax):
super().__init__()
self.softmax = softmax
def forward(self, x):
if not self.soft... |
77f0ab3358eea09d3e817ece16b8373ac695efbf83968f8648cd301116241470 | Python | 5,764 | 164 | """Methods for capturing and displaying annotations within notebooks."""
import os
import socket
from typing import Any, Dict, Union
from IPython.display import display
from IPython.display import HTML
import pandas as pd
import ipywidgets as widgets
from ml4h.visualization_tools.annotation_storage import AnnotationS... |
b41b3a00531c9b4bbc116f8f68fd200fcc6e23472a801f8d3ded5c7127e4ec8a | Python | 5,765 | 170 | import subprocess
import tarfile
import os
import time
import click
import requests
LAST_BUILD_CUTOFF = 3 # how many days ago to consider a build outdated
PENDING_FILES_PATH = "pending_files.txt"
ENVIRONMENT_PICKLE = "_build/doctrees/environment.pickle"
DOC_BUILD_CACHE_URL = "https://ci.ray.io/ray/doc/build-cache"
... |
d9b639eb6606608215ff8090e0de6f186626ded54616a5db304098f0babd00c8 | Python | 5,765 | 191 | # Copyright (C) 2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from enum import StrEnum
from django.conf import settings
from cvat.apps.iam.permissions import OpenPolicyAgentPermission
from .models import Membership
class OrganizationPermission(OpenPolicyAgentPermissio... |
b36f29487fcad02145389359a348caafba2e1d3faffd5e205541dccd3a99c765 | Python | 5,767 | 176 | # __begin_scheduled_batch_processing_policy__
from datetime import datetime, timezone
from typing import Any
from ray.serve.config import AutoscalingContext
def scheduled_batch_processing_policy(
ctx: AutoscalingContext,
) -> tuple[int, dict[str, Any]]:
current_time = datetime.now(tz=timezone.utc)
current... |
a0494074f95b59c5ea55fca388f1c81f4287254f47aafeffb655e57bd6c6c9ee | Python | 5,771 | 130 | import numpy as np
import matplotlib.pyplot as plt
from lgca import get_lgca
from itertools import product
from multiprocess import PATH
import pickle as pkl
from copy import deepcopy as copy
PATH = '.\\data\\gog\\nonlocaldensity_10reps\\'
parameters = np.load(PATH+'params.npz', allow_pickle=True)
constparams = parame... |
2c6a7a36ca51fb7009def9bf14dc265e9bb5950902fce38ccd2586bb1b729f85 | Python | 5,776 | 159 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Fixes alleles for multi-allelic CNVs. Optionally drops records with invalid coordinates.
"""
import argparse
import logging
import pysam
import sys
def get_new_header(header):
header_list = str(header).split('\n')
new_header_lines = list()
for line in ... |
fe356818fdda41c742508737f6e8f18424266c80e50edccb1f3e95637ce65fe9 | Python | 5,777 | 145 | from typing import Callable, Optional, Tuple, Type
from warnings import warn
import torch
from torch import nn
import sinabs
import sinabs.layers as sl
from sinabs.activation import MembraneSubtract, MultiSpike, SingleExponential
from sinabs.conversion import replace_module
def from_model(
model: nn.Module,
... |
8402f22b1954d04b5ab1b0ca85b8bf4aaeb83dbca56323a48398ae3a607c862e | Python | 5,778 | 209 | CONFIG_FILE_PATH = "config.yaml"
ROOT_LOGGER_ID = "agent_launchers"
BACKUPS_PATH = "data/backups/"
METAMAP_INPUT_PATH = "data/metamap_sent/"
UMLS_SEMANTIC_TYPES = "data/umls/SemanticTypes_2018AB.txt"
UMLS_SEMANTIC_GROUPS = "data/umls/SemGroups.txt"
DATA_CACHE_PATH = ".data_cache/"
MODELS_CACHE_PATH = ".models_cach... |
88272f76f72abf9b501d74c92ac3a7c37f1e977ef31343e2013cfcec5290d112 | Python | 5,781 | 164 | import multiprocessing as mp
import tkinter as tk
import PIL
from PIL import Image, ImageTk
import cv2
import numpy as np
import logging
import time
def get_latest(queue, timeout=0.1):
start_time = time.time()
try:
item = queue.get(timeout=timeout)
while True:
try:
... |
841f2940d0e511d57370797bd4ee4994cc7d6384a1d5a7756261fab423a27b05 | Python | 5,783 | 119 | import argparse
from collections import defaultdict
from clean_raw_behavior import clean_data
from glob import glob
import os
import pandas as pd
from create_event_utils import create_events
# some DVs are defined in utils if they deviate from normal expanalysis
from utils import get_name_map, get_timing_correction, ge... |
cfc1e02645d5cb6249715b83ec8d2151b25c163987853b36f84cd536d851e86e | Python | 5,783 | 144 | from __future__ import print_function
# Usage python train_with_labels_wholedata.py number_of_data_parts_divided
# command line in developer's linux machine :
# module load cuda-8.0 using GPU
#srun -p gpu --gres=gpu:1 -c 2 --mem=20Gb python train_with_labels_wholedatax.py 9 /home/yey3/cnn_project/code3/NEPDF_data ... |
4384cf8dbd7cd0b8cd79bf52330a5004e2b812e27705ce0210699d5c2277acb4 | Python | 5,784 | 150 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
9afe1ebd9c489f525e4c8c5d92b5db28b7f1ddb88cf6416f305532f6a96fdca5 | Python | 5,784 | 136 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
import sys
# from Step_7_util import *
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve
def main():
SPLICEAI_VERSION = sys.argv[1]
for MANE_OR_ALTS in ["pos_MANE", "pos... |
aeb97f91bb3ad29df7f53239ec456c2abad7ae423067a6bbd4e3102e460dbe2f | Python | 5,784 | 138 | # -*- coding: utf-8 -*-
####################################################################################################
# Copyright (c) 2020, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# Th... |
73778de8193f44b162ffa17bd24bd3fe3440cee1f570ce96fcd61ff389fc7d79 | Python | 5,786 | 201 | from typing import Optional, List, Dict
import numpy as np
from neuron_morphology.feature_extractor.marked_feature import marked
from neuron_morphology.feature_extractor.mark import (
RequiresRoot,
BifurcationFeatures,
Geometric,
)
from neuron_morphology.feature_extractor.data import (
MorphologyLike,... |
89353e704f68bdad1e5d8614d6407f22938b5ba2c6264f53d4faf6f181535544 | Python | 5,788 | 148 | from typing import Optional, Tuple, Union, Sequence
from functools import partial
import jax
import jax.numpy as jnp
import jax.random as jr
from .sampler import Sampler
from .status import SamplerStatus, Samples
from ..state import State
from ..global_defs import get_subkeys, get_sites, get_default_dtype
from ..utils ... |
1fa5d78f8359b9614a6ac47727721bbe02ada5359f7521e5fdda377113e1fb4c | Python | 5,789 | 185 | #!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, 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 a... |
8da0c4ae6b4c63007521f1a3b11ea6261ec4f0f349488ea02cf3f9ee2878533e | Python | 5,791 | 147 | import torch
import torch.nn as nn
from equivariant_diffusion.egnn_new import EGNN, GNN
from equivariant_diffusion.en_diffusion import EnVariationalDiffusion
remove_mean_batch = EnVariationalDiffusion.remove_mean_batch
import numpy as np
class EGNNDynamics(nn.Module):
def __init__(self, atom_nf, residue_nf,
... |
81f011f634a6a06b293b749e57d844d8e82c6ebaef4ae2ce49109f2fe1e1a5de | Python | 5,793 | 170 | import torch.nn as nn
import torch
import torchvision
import torch.nn.functional as F
class CBAM(nn.Module):
def __init__(self, channels, reduction=16, kernel_size=7):
super(CBAM, self).__init__()
self.channel_attention = nn.Sequential(
nn.AdaptiveAvgPool2d(1),
nn.Conv2d(cha... |
4c1b7d08a27ccfc7b66c59b84e3be694b80eb051e6f46c822f4e2798deb2cc0c | Python | 5,794 | 169 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
# from six.moves import range, zip, map, reduce, filter
from six import string_types
import numpy as np
from tifffile import imsave
import warnings
from ..utils import _raise, axes_check_and_normalize, axes_dict... |
337a89ca8f86229c40c4dd4318c50ceb9ae54b3008aa16fb4da7552245b893a2 | Python | 5,796 | 151 | from utils.tool import read_img, save_img
import time
import os
import argparse
def alpha(x):
return 0.8*(2**(x/6)-1)
def beta(x):
return 0.5*x-7
def clip(x,min,max):
if x < min:
x = min
if x > max:
x = max
return x
def judge_filter(p1,p0,q0,q1,index_a,index_b,thres):
if (p1+... |
521274b598f88ec61ee79507aeaed500e3d614c47bf898117f7146a45750f2dc | Python | 5,796 | 133 | import os
import json
import numpy as np
import matplotlib.pyplot as plt
import ivim
fig = plt.figure(constrained_layout=True,figsize=(10, 5))
gs = fig.add_gridspec(2, 2)
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[0, 1])
ax3 = fig.add_subplot(gs[1, :])
examcard_filess = [{'NC':os.path.join('protocol','I... |
f8ef647982be758f727f57594da37f05affe03608336af90e702cd7b7af8cf58 | Python | 5,796 | 166 | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
7dc6fc31f2e2ccd130cae6c4fa82d35df4758cff624af1c01dc384943a62274c | Python | 5,799 | 162 | import os
import shutil
import tempfile
from contextlib import contextmanager
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Optional
from ray._raylet import AuthenticationTokenLoader, Config
_AUTH_ENV_VARS = ("RAY_AUTH_MODE", "RAY_AUTH_TOKEN", "RAY_AUTH_TOKEN_PATH")
_DEFAULT_AUTH... |
f2d1a9368fa372bf1c6223e49b9bc8d6635600e08268f349b05691c034ce2e8d | Python | 5,799 | 140 | import scipy.io as sio
import os
import numpy as np
import h5py
import sys
# from skimage import filters
from scipy.ndimage import gaussian_filter
from scipy import sparse
from IoU_2 import IoU_2
import multiprocessing as mp
sys.path.insert(1, '../SUNS2') # the path containing "suns" folder
from suns.PreProcessing.pre... |
966da14c12a18e02a175404e12391a154d5e96c2a24c8448a50003e653e1c0fc | Python | 5,800 | 189 | from pathlib import Path
import pandas as pd
import numpy as np
from collections import defaultdict
import random
from scipy.stats import multivariate_normal
from scipy.stats import wasserstein_distance
from scipy.stats import pearsonr
import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mat... |
e9c3b4fac69e7fad24747927b2d28919bd9287ddf04a71577ae580a9468d9950 | Python | 5,802 | 182 | import torch
import math
import copy
from torch.autograd import Variable
import numpy as np
from progress.bar import Bar
import copy
import time
def group_product(xs, ys):
"""
the inner product of two lists of variables xs,ys
:param xs:
:param ys:
:return:
"""
return sum([torch.sum(x * y)... |
61b3a3c5038cc9ea86496ec040da1e583582b5638273c62b5cceae8ce05d94af | Python | 5,804 | 159 | import tensorflow as tf
from utils.nn import linearND, linear
from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph
from models import *
import math, sys, random
from optparse import OptionParser
import threading
parser = OptionParser()
parser.add_option("-t", "--train", dest="train_path")
p... |
6119c0ec01ce1a8ee6330406d348bbd7e12dd63b00e4bbcc597843cc323d0fcb | Python | 5,805 | 158 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import torch
from torch import nn
if TYPE_CHECKING:
from fairche... |
a0c192cd8fc06dceb1a773db74f3e4039d7688dc98ecd197c10c561bb975dac6 | Python | 5,805 | 154 | #
# CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables
# © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+)
# Source code:
# https://github.com/AdaptiveMotorControlLab/CEBRA
#
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/bl... |
0316e3f8fac34b794321ec29dbe56a3cc83e5f6eae7247c12b46daf1e3100138 | Python | 5,806 | 163 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import random
import numpy as np
import pytest
from fairchem.data.oc.core import Adsorbate, AdsorbateS... |
54861bf80eba67bfeca04e3c1ba8b6cc4eb607f4294a9d6aaecc2958dbfa22e2 | Python | 5,807 | 147 | import os, sys
import numpy as np
import scann
import argparse
import glob
from multiprocessing import cpu_count
from tqdm import tqdm
from ldm.util import parallel_data_prefetch
def search_bruteforce(searcher):
return searcher.score_brute_force().build()
def search_partioned_ah(searcher, dims_per_block, aiq_t... |
79e72332e6a0fb82995a3926ed59b5ec3b0fc5a858712e2df1d39806fd5b1f63 | Python | 5,808 | 158 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
b1ffea4f4ad770db285fe248dfb3b2f4da0893c826a791b2613a2d2b1c3f44b3 | Python | 5,809 | 176 | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
66f149c68d1e6085d9db49f4076ed5817e42a567f01f2f5e67594a8cf4db4e1a | Python | 5,811 | 195 | import torch
import math
import copy
from torch.autograd import Variable
import numpy as np
from progress.bar import Bar
import copy
import time
def group_product(xs, ys):
"""
the inner product of two lists of variables xs,ys
:param xs:
:param ys:
:return:
"""
return sum([torch.sum(x * y)... |
9c6178ecfcee7f4a6b7347229a9ef740ca298922651b1f3089e3f8d922865897 | Python | 5,811 | 190 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
3d20b0eca97e75ee2cc66816a16c73d2e9737212bd1a157a3739cc5282602be9 | Python | 5,812 | 127 | import requests
from .__config import base_url
from .__aux_funcs import process_response
def fetch_molecular_data(entrez_gene_ids=None, molecular_profile_ids=None, sample_molecular_identifiers=None, projection="SUMMARY"):
"""
Fetch molecular data. \n
:param entrez_gene_ids: List of Entrez Gene IDs (e.g., [... |
514cf56f840278b7d2b38fa011116ee738f0c8be41d10124e2f39de826c66439 | Python | 5,815 | 129 | import argparse
import pickle
from typing import List
import numpy as np
import lib.dataset_config_parser.dataset_config_parser as dcp
from lib.dataset_config_parser.dataset_config_parser import read_config_file
import lib.data_utils.data_util as du
import lib.data_utils.dynamic_data_util as ddu
if __name__ == '__ma... |
1cdd4b20d0f21d1fc840518b5f75b82b49545670dccfa93b7c5cd99411f6420e | Python | 5,817 | 142 | import argparse
import numpy as np
import pickle
from datetime import datetime
import general.utility as u
import swap_errors.auxiliary as swaux
import swap_errors.analysis as swan
def create_parser():
parser = argparse.ArgumentParser(description="fit several modularizers")
parser.add_argument(
"-o",... |
abc0c42ddbda5194961f4cd74d0b13d553a4f3a7560c8eb984d92b780a6c39ed | Python | 5,817 | 109 | class Config_Pretraining(object):
"""
Configuration class for the pretraining phase of machine learning models.
This class initializes and stores configuration parameters necessary for
the pretraining of machine learning models. It includes settings for data
preparation, model training, and cluster... |
b5e48f2c5ff7b0856f34ee0e0de71aa35dbd232214d57ea950fed182791f73b1 | Python | 5,818 | 162 | import functools
import logging
import random
import re
import time
import traceback
from collections.abc import Sequence
from typing import Callable, Optional, TypeVar
try:
from typing import ParamSpec
except ImportError:
from typing_extensions import ParamSpec
logger = logging.getLogger(__name__)
R = TypeV... |
fe026bbe98048cf90b1ec27c8d348805f526fc8c3c1638dd42c588202005fc9b | Python | 5,819 | 139 | import requests
from .__config import base_url
from .__aux_funcs import process_response
def get_all_molecular_profiles(direction="ASC", pageNumber=0, pageSize=10000000, projection="SUMMARY", sortBy=None):
"""
Get all molecular profiles. \n
:param direction: Direction of the sort. \n
Possible value... |
2304f122d9aba339c940aa829e1db9e7cb00ee8ddeb05b96f9b4dd716e5f63da | Python | 5,821 | 151 | """
Proteomics analysis for omicverse — AnnData-native bulk LC-MS/MS &
Olink workflows.
``ov.protein`` is the analogue of ``ov.metabol`` for protein-level
quantitative proteomics: it consumes search-engine output
(MaxQuant ``proteinGroups.txt``, DIA-NN ``report.pg_matrix.tsv``,
FragPipe ``combined_protein.tsv``, Olink... |
fbdc07e6f545640f8c90df3a96bdcbde22769ad36435fa5f89a386e2f23cadc1 | Python | 5,821 | 186 | import math
from typing import Callable, Sequence, Union
import torch
from rising.utils import check_scalar
from .abstract import AbstractTransform
__all__ = ["KernelTransform", "GaussianSmoothing"]
class KernelTransform(AbstractTransform):
"""
Baseclass for kernel based transformations (kernel is applied... |
875d4babbba3119a7e2d5e45d0384abdb6cf7031a04590aec9e5f29ee38610ab | Python | 5,823 | 221 | from typing import Any
import numpy as np
import torch
from torch.utils.data import Dataset
def mv_grt(rng, y_data, nb_inputs=14 * 14, density=0.88, coh=1, flkr=0.04):
if rng is None:
rng = np.random.default_rng()
data_size, nb_steps = y_data.shape[:2]
y_data = y_data.T
coh = np.full(data_... |
b113c387c145fab5b2fdc3edb815826afaad3497a87e1f404329d812667f4a4e | Python | 5,823 | 172 | from dataclasses import InitVar
from typing import Type, Any, Optional, Union, Collection, TypeVar, Dict, Callable, Mapping, List, Tuple
T = TypeVar("T", bound=Any)
def transform_value(
type_hooks: Dict[Type, Callable[[Any], Any]], cast: List[Type], target_type: Type, value: Any
) -> Any:
if target_type in t... |
f3a840b6e8ed0f788d740ba46b512cc8a78314c4112d6330500693b3d0009543 | Python | 5,823 | 135 | import numpy as np
from scipy import optimize
#from pyprind import prog_percent
import sys
import numba
from numba import jit
from luminance_analysis.plotting import *
@jit(nopython=True)
def resp_from_contributions(contribution_coefs, gc_resp, io_resp):
pc_resp = contribution_coefs[0]*gc_resp + contribution_co... |
ecb53e861b436464f64dcec4939336bed731734afa84a4192ce7f0fe007befcf | Python | 5,824 | 255 | from functools import partial
from pathlib import Path
from typing import Optional, Tuple, Union
import filetype
import imagehash
import pandas as pd
from PIL import ExifTags, Image
from data_profiling.config import Settings
from data_profiling.model.summary_algorithms import (
describe_image_1d,
named_aggreg... |
5d2eda70f39a8763cf62fb0ecbe3db520b1e26c0e1c9479921668437139df1d7 | Python | 5,830 | 156 | import torch
import torch_scatter
import torch.nn as nn
import torch.nn.functional as F
from beartype import beartype
from jaxtyping import Bool, Float, Int64, jaxtyped
from torch_geometric.data import Batch
from typing import Callable, Literal, Optional, Tuple, Union
ActivationType = Literal["relu", "elu", "leaky_re... |
8244b4744a9d998c2036b6a49be970cf6e395e97271628d37dc815387a638a50 | Python | 5,832 | 169 | import logging
from typing import Dict, List, Tuple, Sequence
import numpy as np
import tensorflow as tf
import keras
import tensorflow_hub as hub
from official.projects.movinet.modeling import movinet
from official.projects.movinet.modeling import movinet_model
from tensorflow.keras.layers import Dense, Flatten, Resh... |
a68a10df7762c0bbd70498832e68c3bb0114288e7046cb073b335f73b12a4b06 | Python | 5,833 | 139 | import pathlib
path = pathlib.Path.cwd()
if path.stem == 'tmb_survival':
cwd = path
else:
cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')]
import sys
sys.path.append(str(cwd))
import numpy as np
from lifelines import CoxPHFitter
import pandas as pd
import pickle
from model import utils
from matp... |
ce6d095af1264a43c596d3e4333551c9044c7e9a242bdf0afce2fe7f580991cc | Python | 5,836 | 113 | import os
import click
import torch
import numpy as np
import pandas as pd
from Bio import SeqIO
from scripts.model import SPIRED_Stab
from scripts.utils_train_valid import getStabDataTest
aa_dict = {"A": "ALA", "R": "ARG", "N": "ASN", "D": "ASP", "C": "CYS", "Q": "GLN", "E": "GLU", "G": "GLY", "H": "HIS", "I... |
9036e26adc8571ecaaed7bd07574099078d6538f4bd84c20aed4f8d2beabff2d | Python | 5,837 | 197 | from pathlib import Path
import pandas as pd
import numpy as np
from collections import defaultdict
import random
from scipy.stats import multivariate_normal
from scipy.stats import wasserstein_distance
from scipy.stats import pearsonr
import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mat... |
d67be70c23fd9dbd3f46b24b747170d3ae38fcf0ae2c82e5e1034685c9026340 | Python | 5,838 | 163 | """Reference implementations of previously hardcoded offset models before parametrization.
These models are used to verify that the parametrized versions produce identical outputs.
"""
import torch
from torch import nn
import cebra.data
import cebra.data.datatypes
import cebra.models.layers as cebra_layers
from cebr... |
d62f9756b6a176921a1c5b420283dc222f0bf08bdfefaf2017084c571a5993ca | Python | 5,839 | 189 | from typing import Tuple
import pandas as pd
from sklearn.experimental import enable_iterative_imputer # noqa
from sklearn.impute import IterativeImputer # noqa
from sklearn.linear_model import LinearRegression
from python.utils import (
custom_logger,
object_to_pickle,
to_parquet_per_case
)
from pytho... |
c2adeec5ff4446b5fea5588c020bb6f784a30b6476f98cb890cfe0b6d8c38b0b | Python | 5,840 | 134 | import os
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
import argparse
import time
import datetime
import sys
import math
import scipy.io as scio
from skimage import io
import numpy as np
import math
from DWonder.SEG.network import SEG_Network_3D_Unet
f... |
dc32599aa1fc4fb350fb70bcc66852dcb0d260f5948d1bcfcec20f67f5979bda | Python | 5,841 | 124 |
import argparse
import json
import os
import numpy as np
from tensorflow.python.keras import backend as k
from sklearn.model_selection import train_test_split
import tensorflow as tf
from utilities import DataSequence
from keras.optimizers import Adam
from keras.losses import mse
from base_models_v1 import ... |
61c680fa3b8b3894b98ad5da72374009f8d7ed5a96666017ce7d8d73994580ef | Python | 5,843 | 156 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
def init_weights(net, init_type='kaiming', gain=0.02):
def init_func(m):
classname = m.__class__.__name__
if hasattr(m, 'weight') and (classname.find('Conv') != -1 or classname.find('Linear') != -1):
... |
2e4e09cf9a22aa8f86b7ab11734831595fd963930391aa121b00fb89c8d60351 | Python | 5,847 | 160 | from abc import ABC, abstractmethod
from typing import Dict, List, Optional, Tuple
# https://github.com/ray-project/ray/issues/54868
# Ray no longer overrides accelerator ids environment variables when the number
# of accelerators is zero. For example, if a user sets `num_gpus=0` in
# `ray.init()`, the environment var... |
1a430a2ffd47f293516375e993abb5c5dc954ad2adc199f9cfa05e5696863bbd | Python | 5,849 | 148 | # rag_mcp_server.py — MCP server wrapping the two‑stage RAG system (OpenAI‑free edition)
# -----------------------------------------------------------------------------
# This version removes all **hard‑coded** references to OpenAI models so the
# service can run in environments where OpenAI endpoints are unreachable o... |
139c5b4a01e9d1c4857651227244b176c1cbe7d186e0c421bcf5207baa133ab7 | Python | 5,850 | 204 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 5 16:18:59 2023
@author: LeyangXue
"""
import sys
import networkx as nx
import random
from multiprocessing import Pool
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(packagepath)
from utils import kco... |
552c22e88d2ec6ee65bcdd272e3d5769a1df6fbb03e254eaab1b9dce65469b94 | Python | 5,850 | 158 | import torch
import torch.utils.data as data
import os
import random
import glob
from PIL import Image
from utils import preprocess, preprocess_image
import numpy as np
import cv2
class DMData(data.Dataset):
CLASSES = ['BG','DM','Canopy']
def __init__(self, root, train=True, test=False, inference=False,transf... |
7c04f119582efa6c3ac1268bb59d1524cad6e5e48a68c6addfd47a13a4e6b997 | Python | 5,850 | 176 | # -*- coding: utf-8 -*-
### ------------------- Imports ------------------- ###
import os
import tables
import numpy as np
### ----------------------------------------------- ###
def get_data(main_path, exp_path, ch_num=None, inner_path=[], load_y=True):
"""
Retrieve h5 data with their associated ground truth... |
b033e04071f2a06893ba21a1249abccc76dc540f146746d4d79f06b4a16cf6b0 | Python | 5,850 | 162 | # Copyright 2023 BioMap (Beijing) Intelligence Technology Limited
import math
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torch.cuda.amp import autocast
#from einops import rearrange, repeat
#from functools import partial
#from contextlib import contextmanager
def exist... |
cbfa86d918b863a0946d22b871cd5f96acc9c61112a81007ea3d4b7a1ffb3606 | Python | 5,851 | 204 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 5 16:18:59 2023
@author: LeyangXue
"""
import sys
import networkx as nx
import random
from multiprocessing import Pool
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(packagepath)
from utils import kco... |
c077bf9a5950571a4b5d7b02be71fc1110174dcbe2a20a41b1ee0eec3269e8c9 | Python | 5,853 | 144 | #!/usr/bin/env python3
"""Heatmap plotting: average expression and SVD vs covariates."""
import logging
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
# Plot given the calculated matrices and relevant attributes
def _plot_svd_corr(covariate_list, covariate_hratio, c... |
484294500e96e78ea4eec24de19abaddd7efeb8af002bda038c1655bb9e215d5 | Python | 5,854 | 185 | import os
try:
print('SlURM_JOB_ID',os.environ["SLURM_JOB_ID"])
except:
print("no slurm id")
import matplotlib
matplotlib.use('agg')
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import tables
import gc
import scipy
import sklearn.metrics as skm
import sklearn.linear_model as skl
impor... |
b20ad817f675c8107bef23424ac49c9f0a74408a6a2371ae2f7a12ee4efdf36f | Python | 5,854 | 135 | from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import pandas as pd
import torch
import torch.optim as optim
from utils import accuracy, get_adjs, model_loss
from models import GCN_plus
from preprocess import data_loader
import sys
from da... |
22341fc64136aa3ff4cf873bf80c8cc450127c72cf624f5389b9a48bc746a337 | Python | 5,858 | 151 | # -*- coding: utf-8 -*-
# Development work, e.g. for higher level functions.
# These functions are not intended to work on any machine or pass the tests.
# They are early drafts (e.g. of higher level workflows) intended to be shared among select collaborators or multiple machines of one collaborator.
# Please don't ed... |
9ba9965908a0083f13def35139477bdc4d4318e6c500ea7e74b578cb6fea2669 | Python | 5,858 | 163 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Visualize sample fMRI timeseries, dFC(t), and LE(t) for the methods description.
Output:
fMRI.jpg Contains two sample pre-selected fMRI timeseries.
dFC.jpg Contains sample dFC(t) for the given time point.
LE1D.jpg Contains sample LE(t) for the given time point.
LE2D.jp... |
9b0616cb503eb1eaa38e77f2a80582468ea54923a8a3e1b23629b1eadaa0f93f | Python | 5,860 | 130 | import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from siapy.datasets.schemas import RegressionTarget
from siapy.datasets.tabular import TabularDataset
from siapy.entities import Shape, SpectralImage, SpectralImageSet
from siapy.optimizers.configs import CreateStudyConfig, Optim... |
1d12342b87408f96ffdb0e053450fcb98836e296f8d9338779ee17b6e30a718a | Python | 5,862 | 150 | from bionlp.processors import Entities, DiseaseProcessor, ChemicalProcessor, GeneProcessor
import spacy
from spacy.tokens import Doc
from spacy import util
import re
from bionlp.processors.utils import check_existant_model
from spacy.language import Language
def paragraphs(document):
start = 0
for token in doc... |
4159fd52c9f6b92d219de7bd98a99bdd85015d7a4537fceb00e68cba757904f4 | Python | 5,862 | 165 | import threading
import time
from dataclasses import dataclass
from typing import Callable, Dict, Optional, Tuple
from ray.autoscaler._private.constants import (
AUTOSCALER_NODE_AVAILABILITY_MAX_STALENESS_S,
)
from ray.autoscaler.node_launch_exception import NodeLaunchException
@dataclass
class UnavailableNodeIn... |
d3c05bb7a23c348c5f9fb08b31f36a807d05c23491dd755767a23735c531cbf7 | Python | 5,862 | 92 | proj_dir = "/path/to/main_project_folder/" # edit this line
import numpy as np
import pandas as pd
import xarray as xr
import dask.array as da
import glob as glob
from functools import partial
import os
import sys
sys.path.append(proj_dir)
from project_fxns import load_region
from project_fxns import fxns
import impor... |
dec01495eb9ac251538bcbcaf761542e85060419328d907916a12c4f5b3bfdf8 | Python | 5,862 | 160 | #!/usr/bin/env python3
import argparse
from glob import glob
import sys
import numpy as np
import matplotlib.pyplot as plt
import pysam
import math
import pandas
import haplotagging_stats
import os
import collections
REF_LINEWIDTH=2
LINEWIDTH=1
REF_ALPHA=1.0
ALPHA=.33
def parse_args(args = None):
parser = argpars... |
b04499a9abe4b6a81b3fd6297639791683986a57384947d3363912f2da102757 | Python | 5,863 | 163 | import os
import re
import sys
from collections import defaultdict
from subprocess import check_output
from typing import List
import click
from tqdm import tqdm
from ray_release.github_client import GitHubClient, GitHubException
# Matches a well-formed "(#<digits>)" reference. Compiled once at module scope
# since ... |
6a082ae357e55c48ab2bed0ba74e2a3286fc6e320f5cd18fa20fb00ca5ae2b5d | Python | 5,864 | 178 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
For the selected k and subject ID, find the average idiosyncrasy of each LE(t)
from group LE(t) across runs and within run.
Output:
statesim.h5 Contains all idiosyncrasies for each subject, across runs and within run.
Usage:
LE_group_statesim.py <k> <subject>
... |
d0f99d882b743cd6b5908698680b74c3a9fd53207ed6c28d78423d9c36afbccd | Python | 5,864 | 123 | import numpy as np
from scipy.stats import ttest_ind, sem, t
import statistics
import mne
import pandas as pd
def find_nearest_ind(array, value):
return (np.abs(array - value)).argmin()
def create_epochs(data, ch_names, ch_types, sfreq, conditions, times, n_trials_per_cond):
"""
This function creates an... |
75b1737e4a4e0f3e1f4370dedba7a966cfd259dbed4a9a8ef4ce33b4a345913d | Python | 5,866 | 152 | # Modified from https://github.com/open-mmlab/mmsegmentation/tree/1.x
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, build_upsample_layer
def resize(input,
size=None,
scale_factor=None,
mode='nearest',
al... |
93ea50bad14cf7107433b501643027b1c1d8ea0d838324036c4ac5fed8f5dffa | Python | 5,868 | 162 |
import numpy
from .rewards import objectives
DATAMAP_PATH = [
"./data/datamap/actin",
"./data/datamap/psd95",
"./data/datamap/lifeact",
"./data/datamap/PSD95-Bassoon",
"./data/datamap/tubulin",
"./data/datamap/camkii"
]
P_STED = 150.0e-3
P_EX = 10.0e-6
PDT = 10.0e-6
LASER_EX... |
5318a79b4ec7df24f9ef85fdd13fbfab805a4d9ce32ec93c413f68570e579cdb | Python | 5,870 | 175 | import argparse
import random
import shutil
import uuid
from natsort import natsorted
from pathlib import Path
from types import SimpleNamespace
rd = random.Random()
rd.seed(0)
uuid.uuid4 = lambda: uuid.UUID(int=rd.getrandbits(128))
class Experiment:
def __init__(
self,
condition,
input_dir,
out... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.