sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
224feacfac42c6b9524489ce4d6cf74bf99a0073b2c3b89b7159b96abc697d9d | Python | 9,180 | 252 | # coding=utf-8
# Copyright 2023 HuggingFace 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 ag... |
b1f9f2ead0084f20fc50cc826b1635d2b5171ad743b764a4ac4f570101ea9c77 | Python | 9,180 | 263 | # A incremental sticky CRP
#
# Note:
# This is modified based on John McDonnell's Anderson model
# https://github.com/johnmcdonnell/Rational-Models-of-Categorization/blob/master/rational.py
# References: Anderson (1990) and Anderson (1991)
#
# Implementation of Anderson's venerable "rational" model of categorization.
#... |
944dca14ce607785c9890f0c0e89804610870f5678f152438f8d1655fad7e221 | Python | 9,181 | 243 | """Pure-NumPy/SciPy over-representation analysis (ORA) — a single-process,
offline replacement for ``gseapy.enrichr``'s *local* mode.
Why this exists
---------------
``gseapy.enrichr`` either (a) POSTs the gene list to the Enrichr web service
(needs network, non-deterministic, fails on outages) or (b) runs a local
hyp... |
cb18fdd71af352d09575e1152b7608ee7d21dec9dcfa0611ccebe4df8ae31b68 | Python | 9,181 | 293 | """make variations of input image"""
import argparse, os, sys, glob
import PIL
import torch
import numpy as np
from omegaconf import OmegaConf
from PIL import Image
from tqdm import tqdm, trange
from itertools import islice
from einops import rearrange, repeat
from torchvision.utils import make_grid
from torch import ... |
5570c4c293e453248e0ac6d18ba6cda72e1f009a5aa1e2d98ae2a172385880da | Python | 9,186 | 283 | import json
import tempdir
from imports import *
from test_bqd import Base as Base_
class Base(Base_):
modulepath = 'ngs_mapper.coverage'
class TestFilterRefs(Base):
functionname = 'filter_refs'
def setUp(self):
super(TestFilterRefs,self).setUp()
# Tests
self.refs = ['aa','... |
680a5eef22940a9ca0d27178a3e911de662120392dff8b46a1b767b16e9a016f | Python | 9,198 | 234 | import numpy as np
import torch
import torch.fft
import torch.nn.functional as F
from collections.abc import Iterable
from functools import wraps, lru_cache
import cv2
from copy import deepcopy
def meta_to_tuple(meta):
for key in meta:
if isinstance(meta[key], Iterable):
meta[key] =... |
0eeecf5936a7b1f467fdf266dd9c7bc84df400f3b63b79f84a199b41e9a5c128 | Python | 9,199 | 248 | #crop random dataset
import glob
import sys
sys.path.append("/home/b.weinstein/DeepTreeAttention")
from src.data import read_config
import os
from src import neon_paths
from src.start_cluster import start
import rasterio
import random
import re
import numpy as np
from rasterio.windows import Window
from distributed im... |
e2e2f3acc37eb74b76a1477d4500c8d967b12c74896b895c0663793820744896 | Python | 9,199 | 216 | import torch as th
import torch.nn as nn
from tqdm.auto import tqdm
from .dataloader import Dataset
from .utils import normalize, sparse_mx_to_torch_sparse_tensor, as_float_ndarray
import os
import numpy as np
import matplotlib.pyplot as plt
from .utils import batch_func
# Detect device - use CUDA if available, otherw... |
ee7aae7b8ac347d6436061e7aff74597719bc950096b3076294f58dfcd025793 | Python | 9,200 | 292 | from typing import Dict, List
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, LSTM, Concatenate, Flatten
from ml4h.models.Block import Block
from ml4h.TensorMap import TensorMap
from ml4h.models.layer_wrappers import _activation_layer, _... |
e49fa209a214d2ffabaf3e0abe6de9a402b3ef92ccfe38b6d03c0c10a1f504ab | Python | 9,201 | 236 | from typing import Optional, Callable, Tuple, List, Any
from functools import partial
import numpy as np
import jax
import jax.numpy as jnp
import equinox as eqx
from .tdvp import TDVP
from .solver import minsr_pinv_eig
from ..state import Variational
from ..nn import Sequential, filter_vjp
from ..sampler import Sampl... |
2bbd41006a8be4e4446a08259b0b02422d531bcefeb72cd5927a0ab6dc7725b1 | Python | 9,202 | 268 | import math
import pytest, torch
import ecg_augmentations as ea
from tests.common import FS, PEAKS, detector
def snr_db(x, y):
noise = y - x
return 10 * torch.log10(x.var(-1, unbiased=False) / noise.var(-1, unbiased=False))
def spectrum(x):
window = torch.hann_window(x.shape[-1], dtype=x.dtype)
ret... |
92f1bbc2b67427a4881516de9e3f39fe31e52fc1b1298320c7df24a7bf0464f4 | Python | 9,203 | 250 | import numpy as np
from . import conv2d as c2d
def pack_int8_into_int32(data_to_pack): # data_to_pack should be a 1D np.array
packed_list = list()
for i in range(0, len(data_to_pack) - 3, 4):
packed_list.append(
(data_to_pack[i] | data_to_pack[i + 1] << 8 | data_to_pack[i + 2] << 16 | data... |
0dbeea8695a432d5cbc283568246953281bee969d2c6828a4c0ef08c038a0ccf | Python | 9,206 | 280 | # 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, ... |
4e6b359b95bb5e779fe47e12b6c04aacaad2db37569b5928908317dddee8d7b0 | Python | 9,206 | 195 | from utils.Typing import NormalizeOpt,CropOpt, TransformOpt
from tqdm import tqdm
import math
from typing import Callable, List, Tuple,Dict
import torch
import torch.optim
import random
from einops import rearrange,repeat
from utils.io import *
from utils.transform import *
def create_coords(coords_shape:Tuple,mode='n1... |
b831fd0b20ec2f3b2c4b26e4fbfb56e418446b4065803608943281ceeab323dc | Python | 9,207 | 233 | # CODE_DIR = '/home/kelarion/github/assignment_errors/'
# SAVE_DIR = '/mnt/c/Users/mmall/Documents/uni/columbia/assignment_errors/'
CODE_DIR = 'C:/Users/mmall/Documents//github/assignment_errors/'
SAVE_DIR = 'C:/Users/mmall/Documents/uni/columbia/assignment_errors/'
import socket
import os
import sys
import pickle as... |
ddb244b758eaf1867b42855182471704a4a413b6acaa03b83f04a794f2a48e22 | Python | 9,209 | 249 | """Tests for extract_wanda_artifact."""
import tempfile
from pathlib import Path
from unittest import mock
from click.testing import CliRunner
from ci.ray_ci.automation.crane_lib import CraneError
from ci.ray_ci.automation.extract_wanda_artifact import main
# crane requires a real container registry, so we mock it ... |
4e6fb2bcefeb464efae1b1a99588f4d174f22aca591961c4b5302ffa133c65ed | Python | 9,210 | 232 | ####################################################################################################
# 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>
#
# This program is free softw... |
04e114674a802f606b9728cb685ab5076ac4a692d6dab37d34ef92d5f7a65e49 | Python | 9,218 | 269 | from moabb.paradigms.base import BaseParadigm
from moabb.datasets import PhysionetMI
import numpy as np
import mne
import pandas as pd
import copy
# The event data is stacked in MOABB and so they must all be equal in length
# which is not the case for the inbetween "rest" data, only physionet contains
# the actual res... |
29e7950e253930141e6434725d58e98ae928fe68b0cadd2d4cf1d4850aaef6a7 | Python | 9,218 | 305 | """An example of training a Deep Recurrent Q-Network (DRQN).
DRQN is a DQN with a recurrent Q-network, described in
https://arxiv.org/abs/1507.06527.
To train DRQN for 50M timesteps on Breakout, run:
python train_drqn_ale.py --recurrent
To train DQRN using a recurrent model on flickering 1-frame Breakout, run:
... |
8efa2df56fb604d97924d70d30968c00b27da8a42dc4c22ad3c707c9c8902d57 | Python | 9,222 | 248 | # -*- coding: UTF-8 -*-
from datetime import datetime
import argparse
import logging
import os
import sys
root_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(root_dir)
sys.path.append(os.path.join(root_dir, "models"))
from models.FCN import FCNs,VGGNet
from models.UNet_5 import UNet
from models.segn... |
c9ea5ebfaa41b65804853d31e73f0ed39fbc95fff954cad86fa1a5f51d36ab8f | Python | 9,223 | 245 | #!usr/bin/python
"""Compute co-expression modules for multiRegion data using scdemon."""
# -------------------------------------------------------------
# Compute co-expression modules within python scanpy framework,
# Using data loader + modules + graph handlers
# Created: 06/16/21 // Last updated: 11/27/21
# python $... |
46496e975c8944b34110968c80c7ac98c3902a27214c5a5f6e688b837748a01a | Python | 9,225 | 283 | import argparse
import functools
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import pfrl
from pfrl import agents, experiments, explorers
from pfrl import nn as pnn
from pfrl import replay_buffers, utils
from pfrl.initializers import init_chainer_default
from pfrl.q_functions impo... |
f684b61419102c705aed186b339615e652864762d1affddd331b662c7adc7014 | Python | 9,228 | 317 | cd /mnt/d/Brain_region_project/SCENIC/
conda activate scenic_protocol
python
import scanpy as sc
import numpy as np
import pandas as pd
adata=sc.read_csv("Inh_counts_matrix_1000.csv")
sc.pp.filter_genes(adata,min_cells=100)
import loompy as lp
row_attrs = {
"Gene": np.array(adata.var_names),
}
col_attrs =... |
4a532a263ff3b0ef07645fc6d728d438010b58c2ad8ddef42b6802685dd62593 | Python | 9,232 | 195 | # -*- coding: utf-8 -*-
"""
Module for pairwise functional alignment where data are in numpy arrays (nsamples,nvertices)
Unlike pairwise_alignment.py, this module does not do any smoothing, masking, or preprocessing
"""
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from joblib import (del... |
61f652994cb59a55d01506e988727e2cb9004f55ff73d4eb37918446a97fe533 | Python | 9,235 | 170 | import os
import wandb
from utils_grading import *
import torch
import json
import numpy as np
import argparse
def main(args):
# Get WSI/patients for each of the sets
train_subfloder_list = os.path.join(args.dir_images, 'training/')
val_subfolder_list = os.path.join(args.dir_images, 'validat... |
8f8ac74e9246719ffba9b756fada8b9b7e6ae2a31f790ab50613f7e97ba4e64a | Python | 9,242 | 248 | import numpy as np
import pandas as pd
import scanpy as sc
from typing import Union, Sequence
from importlib import resources
def get_top_nmf_genes(adata: sc.AnnData,
gems: Union[str, Sequence[str]],
n_genes: int,
gene_type: str = 'all',
... |
fec3b3efcf00e1908b09a30dbc65a216650d5d7770f935f1f27afcd5075b70f1 | Python | 9,243 | 266 | import torch
import torch.nn as nn
import torch.nn.functional as F
import model.common as common
import math
from einops import repeat
from functools import partial
from contextlib import contextmanager
class ENLCA(nn.Module):
def __init__(self, channel=128, reduction=2, ksize=3, scale=3, stride=1, softmax_scale=... |
5bd66d5555e44554e52ee0b790d76293f0be104c68bb359ff5b3a3f7dfa69381 | Python | 9,245 | 222 | import numpy as np
import torch
from torch import nn
from torch.autograd.functional import jacobian
from sklearn.neighbors import KernelDensity
import ei.entropy_estimators as ee
use_cuda = torch.cuda.is_available()
device = torch.device('cuda:0') if use_cuda else torch.device('cpu')
def kde_density(X):
kde = Ke... |
3559a5e0a62bfd46d3f892f0f321019f641b9d5f62e1e524aea31ec366f71bac | Python | 9,248 | 243 | ####################################################################################################
# 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... |
535318d6068fc5eb3bcc80a13343bbab67824a2c4a58c0600b7d274b10ff062d | Python | 9,248 | 164 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'fsw.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(... |
ea5469322eaa70126add54b405e1619d98679cbc35d2e0247ca0e4ab0964b106 | Python | 9,252 | 282 | # 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, ... |
d38e922d7dd856c83cc719e7d37e68719b91faee96f0eb543717c1963217b2a6 | Python | 9,253 | 217 | import pandas as pd
import numpy as np
def ElementaryFunctions_Matrix(xi, xj, coupledPolyOrder = 1, CoupledPolynomialIndex = True, \
CoupledTrigonometricIndex = True, CoupledExponentialIndex = True, CoupledFractionalIndex = True, \
CoupledActivationIndex = True):
ElementaryMatrix = pd.Data... |
57c18fedb6414238635ffb3ef16f9061267c8fa495508209aac29108768ce726 | Python | 9,256 | 258 | import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from math import ceil
import numpy as np
from sklearn.metrics import average_precision_score
JUNC_START = 150
JUNC_END = 450
CL_MAX = 10000
def ceil_div(x, y):
return int(ceil(float(x)/y))
###############################... |
01edc8ee121645ba9e7f9c965643ae288e541c9cd24e81edfe3436386e754e25 | Python | 9,258 | 206 | from lisa.core.lisa_core import LISA_Core
from lisa.lisa_public_data.genes_test import FromGenes
from lisa.core.data_interface import PACKAGE_PATH, REQURED_DATASET_VERSION, INSTALL_PATH
from lisa.core.lisa_core import CONFIG_PATH as base_config_path
import numpy as np
from scipy import sparse
from lisa.core import geno... |
fa6ac469318bccc81a51cb5dcea2c3ef6cfdb816f0fa29060a6285034366668b | Python | 9,259 | 225 | import torch
from torch.utils.data import Dataset, DataLoader, random_split
from pathlib import Path
import json
import random
import os
import math
from splam_utils import *
# MODEL_VERSION
SEQ_LEN = "800"
def split_seq_name(seq):
return seq[1:]
class myDataset(Dataset):
def __init__(self, type, segment_len... |
d858c7b672f974c0e2bb8434480d4ebfc01a930a55fe77172996f6558081132f | Python | 9,271 | 305 | import sys
from enum import Enum, auto
from typing import Any
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.axes import Axes
from matplotlib.lines import Line2D
from matplotlib.path import Path
from matplotlib.widgets import Button, LassoSelector
from numpy.typing import NDArray
from siapy.core.e... |
b41a6b73048d6ad0bbb4c68c08267bb37efec670bc3301804e605b5f697e073a | Python | 9,281 | 261 | import json
import logging
import os
import subprocess
import time
import pandas as pd
import requests
from requests.adapters import HTTPAdapter, Retry
from src.utils import dump_to_json
# Default settings to have correct requests to external servors (no DDOS)
POLLING_INTERVAL = 5
API_URL = "https://re... |
6028bbaf004e67173becf63f3d17111630310004dd9ef379fcafcec129cf7f6f | Python | 9,282 | 181 | import anndata
import pandas as pd
from .simulation import generate_simulated_data
from .utils import ProcessInputData
from .train import train_model, predict, reproducibility
from .model import scaden, AutoEncoder
def Deconvolution(necessary_data, real_bulk, sep='\t', variance_threshold=0.98,
scaler... |
e8261bb558ee4bf7168c046f60cc6aeecc95b03e27ad08d058f81485c8a88274 | Python | 9,282 | 282 | """UCSC Genome Browser data collector."""
import logging
from typing import Any, Dict, List, Optional
from src.api.ucsc import UCSCClient
from src.models.genomic import Gene, Variant
from .base import BaseCollector
from config.config import settings
logger = logging.getLogger(__name__)
class UCSCCollector(BaseCol... |
4042605e1564fc43a193249996da97d4fee0fd4f89713b09bdd7af634f1d84d7 | Python | 9,283 | 273 | from typing import Optional, List, Dict
from neuron_morphology.constants import (
SOMA, AXON, APICAL_DENDRITE, BASAL_DENDRITE)
from neuron_morphology.feature_extractor.mark import RequiresRoot, Geometric
from neuron_morphology.feature_extractor.marked_feature import marked
from neuron_morphology.feature_extractor... |
a64e9214012679fd582513652aa46ca27ae426474d03df5058bb6944acd76319 | Python | 9,285 | 267 | import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.common_utils import try_contiguous
def _extract_patches(x, kernel_size, stride, padding):
"""
:param x: The input feature maps. (batch_size, in_c, h, w)
:param kernel_size: the kernel size of the conv filter (tuple of two elem... |
162e1573f358804c33f275d7176f1337e837d9d015c0a43d0c38eb7fcce8c731 | Python | 9,286 | 234 | import exputils as eu
import numpy as np
import scipy.stats
from tabulate import tabulate as original_tabulate
import IPython
def mannwhitneyu_pvalue(data_1, data_2):
if np.array_equal(data_1, data_2):
return 1.0
_, pvalue = scipy.stats.mannwhitneyu(
data_1,
data_2,
alternativ... |
dc77aacb1731f7be979f10a9f25c79486ef8f407878683029cf366ec3b33fe36 | Python | 9,286 | 247 | import pytest
from siapy.core.exceptions import InvalidInputError
from siapy.entities.shapes import GeometricShapes, Shape
@pytest.fixture(scope="module")
def rectangle_shape():
x_min = 10
y_min = 15
x_max = 60
y_max = 66
return Shape.from_rectangle(x_min=x_min, y_min=y_min, x_max=x_max, y_max=y_... |
d24af5318e40fd7c00c7b732bfc91eb7380e70cd56ef7cb47e51e18574ed8cee | Python | 9,287 | 227 | import math
import numpy as np
import torch
def extract_subtomos(
tomo,
subtomo_size,
subtomo_extraction_strides=None,
enlarge_subtomos_for_rotating=False,
pad_before_subtomo_extraction=False,
):
"""
Extracts sub-tomograms of size 'subtomo_size' using a 3D sliding window approach. The thr... |
e839177d004f9d9e345d49b6839bd49d3e7bf61f6cde433e5050794b1cb822cf | Python | 9,288 | 239 | # 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, ... |
6065149c9c8d3357ebad3683bf6b3990db02fd9f69b78d16e8a97d099ae1ccc7 | Python | 9,290 | 273 | # Copyright 2024 The bayesnf Authors.
#
# 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 ... |
329f7f133e0955d8473a63d133a32b01ab6953da70d2c0b2bfb3857fe25515cc | Python | 9,294 | 252 | import logging
import sys
from threading import RLock
from typing import Any, Dict, Optional
import requests
from ray._common.network_utils import build_address
from ray.autoscaler.node_launch_exception import NodeLaunchException
from ray.autoscaler.node_provider import NodeProvider
from ray.autoscaler.tags import (
... |
39cbfd3e1c1c55166b1699500a827630d44bdd22ae7e7b9e79bf1a73107dbfe7 | Python | 9,294 | 248 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import glob
import sys
import numpy as np
import pysam
import time
import tempfile
import os
from subprocess import run
from contextlib import closing
from multithread import *
FORWARD="FORWARD"
BACKWARD="BACKWARD"
FILE_LOCATION = 'file_locati... |
b23e82cc3b5ebd5a3577496a05cfab19a356920f30f98d60dd63f41df11c40d0 | Python | 9,294 | 234 | import logging
from queue import Queue
from typing import List, Optional
from urllib.parse import urlsplit
from ray._raylet import GcsClient
from ray.autoscaler._private.providers import _get_node_provider
from ray.autoscaler.v2.event_logger import AutoscalerEventLogger
from ray.autoscaler.v2.instance_manager.cloud_pr... |
7d56f3820d3e6a906bea387217cf85209627840fc5bf83b191a9b3c05f0cf185 | Python | 9,295 | 266 | import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib.animation import FuncAnimation
import time
def show_experiment(experiment, merge_stimuli=True, frame_delay=None, grid=None):
"""
Shows visual experiment stimuli either as a single animation or as a series
of a... |
8b76528fa149b81db9a1a3b952d9bb4a1a3c9a0674674cc26b1fe437717035df | Python | 9,295 | 185 | import torch
from funasr.losses.label_smoothing_loss import LabelSmoothingLoss
from funasr.modules.embedding import SinusoidalPositionEncoder
from ..utils.model_utils import Feature_extract, Embeddings, PositionalEncoding
from ..utils.mask_utils import generate_lower_triangular_mask, reverse_pad_list, make_pad_mask, ad... |
c664dd99defe5ce9ed7174411c0ee43bc7218938478e254855707fd1d708bbed | Python | 9,295 | 229 | r"""Tree layout for Bonsai results.
Two routes to 2-D coordinates:
``scout_layout`` — upstream's own. It runs Bonsai-scout's equal-angle pass
followed by **equal-daylight** refinement, then maps the result into the
**Poincaré disk** with Bonsai's own transform. That is the arrangement the
Bonsai-scout app shows: bran... |
dc76c335733f7c547b0e09db82a596ff2b428d73691cb94c5e35448738321d27 | Python | 9,295 | 277 | import collections
import json
import os
from enum import Enum
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Union
from ray._common.usage.usage_lib import TagKey, record_extra_usage_tag
if TYPE_CHECKING:
from ray.train._internal.storage import StorageContext
from ray.train.trainer import BaseTr... |
622c1212f598f22bef6b1636e5617e053fd5a1b61b7cc1a5adfc8854328dfb85 | Python | 9,297 | 236 | ####################################################################################################
# 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>
#
# This program is free softw... |
fedcf1f4777b446dc5f4c4fc93e5a9cac3fdf00c4dedaded978d0f14a7de2ede | Python | 9,297 | 203 | ####################################################################################################
# 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... |
018f2696ee6b11675d4d3062a796fa62a28e4bd00d20fc16993dca59b7d94c1c | Python | 9,300 | 269 | """
_*_ coding: utf-8 _*_
@ Author: Yu Hou
@File: progression_representation_learning.py
@Time: 1/13/21 9:59 PM
"""
import torch
from torch import nn
from torch import optim
from torch.autograd import Variable
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle as pkl
import time
class Prepare... |
80be79f2891f452e4ad47d6b06f82037a6331db0cebedd0d8a6a2fd553142dbe | Python | 9,300 | 331 | #!/usr/local/bin/python
"""
***********************************************
- PROGRAM: findTADs.py
- CONTACT: Bryan lajoie (bryan.lajoie@umassmed.edu)
***********************************************
"""
from __future__ import print_function
# Built in modules
import argparse
import os.path
import sys
import gzip
impo... |
ffd1de4ea5865ebdd864e6819ea7798e802802d59a01c11ae4e5675ce81a2730 | Python | 9,300 | 261 | import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from math import ceil
import numpy as np
from sklearn.metrics import average_precision_score
import re
JUNC_START = 150
JUNC_END = 450
CL_MAX = 10000
def ceil_div(x, y):
return int(ceil(float(x)/y))
#####################... |
e6477f954d9203e607458906d3f8539343bac3e12de7e0f90dadee975ac5fa93 | Python | 9,301 | 249 | """
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 copy
from typing import TYPE_CHECKING, Literal
import torch
import torch.nn as nn
from .radial... |
4b1ff1e3f41ab193c0f07ed19e64825b901b49e2ad92562301c870dbb9e4a9f1 | Python | 9,305 | 235 | import logging
from ctypes import c_uint32
from math import ceil
from multiprocessing import Array, Process, cpu_count
from multiprocessing.sharedctypes import RawArray
from operator import attrgetter, mul
from typing import Sequence, Type
import numpy as np
import pandas as pd
from tqdm import tqdm
from .genesig im... |
5c0658c6e70073e7ea877c549727f78e5d7106532d6f67e4245116a70acb6d14 | Python | 9,307 | 272 |
import pdb
from scipy.io import loadmat
import numpy as np
import torch
from data_assimilation.oracle import ObjectStorageClientWrapper
from data_assimilation.particle_filter.base import BaseForwardModel
from latent_time_stepping.utils import (
load_trained_AE_model,
load_trained_time_stepping_model
)
fro... |
24f40c8d06a80567125e4b6fd4ac1df5ebeb7c59a4878ba14f86f617b5ad20fa | Python | 9,310 | 274 | ####################################################################################################
# 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 library is fre... |
3790bebe65729ebd265dfce97912eb581079e0c4e283ae165938abcafcb6a0fb | Python | 9,315 | 287 | # -*- coding: utf-8 -*-
#
"""
genomeslink.py
Implementation of single-linkage clustering for genomic coordinates.
Not actually an implementation of the SLINK algorithm.
"""
from collections import deque
from itertools import combinations
from operator import itemgetter
import numpy as np
from scipy import sparse
fro... |
dc3b1c5bbc565f1d122ccadc47abaa07fe239035f8164703d9b98762f043a1e7 | Python | 9,316 | 305 | import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
log = logging.getLogger(__name__)
class EfficientMaskedConv1d(nn.Module):
"""
1D Convolutional layer with masking.
"""
def __init__(
self,
in_channels,
... |
f985d03ef909ceab99d8546a52eda7eb45521815789a8109cf9e5f4293c71ec4 | Python | 9,317 | 342 | # coding=utf-8
# Copyright 2023 Optuna, Hugging Face
#
# 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 o... |
b331a89425e01d1c148619302be035c9cdb9b4fb25a0b4d77471e69100971a6c | Python | 9,318 | 199 | import torch
import numpy as np
import pandas as pd
from loss import spearman_loss
from metrics import spearman_corr
def convert_batch_data(data, batch_size, seed):
for name in data.index.unique():
remainder = len(data.loc[name]) % batch_size
if remainder != 0:
data = pd.concat((da... |
6ea950d6823609055031991ecfc16f862917ce528ee5fc4d463e0a78f039cdc6 | Python | 9,320 | 234 | # -*- coding: utf-8 -*-
import logging
from ctypes import c_uint32
from math import ceil
from multiprocessing import Array, Process, cpu_count
from multiprocessing.sharedctypes import RawArray
from operator import attrgetter, mul
from typing import Sequence, Type
import numpy as np
import pandas as pd
from tqdm impor... |
7251d1c1d13b9c0043d6cb1045c1b4d553eb28799cb99a321c14765c3e041e29 | Python | 9,320 | 237 | import struct
from typing import TYPE_CHECKING, Dict, Iterable, Optional, Union
import numpy as np
from .tfrecords_datasource import _get_single_true_type
from ray.data._internal.tensor_extensions.arrow import (
get_arrow_extension_tensor_types,
)
from ray.data._internal.util import _check_import
from ray.data.bl... |
c901deb812a23a9572aa203ba73485e1cbfb7f9af6de0a46bc8648677774880c | Python | 9,321 | 244 | # 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, sof... |
0930c9ce2084bd8867f790913025c5cd6637dd1da0343968091cc1c8dda3698b | Python | 9,323 | 277 | """A training script of Soft Actor-Critic on OpenAI Gym Mujoco environments.
This script follows the settings of https://arxiv.org/abs/1812.05905 as much
as possible.
"""
import argparse
import functools
import logging
import sys
from distutils.version import LooseVersion
import gym
import gym.wrappers
import numpy a... |
d9216e220675adf947428938e3c8f8fd6b8e832bf0f5d6eea0f22cbf37efc9f8 | Python | 9,323 | 266 | # 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 applicable law or agreed... |
d3d4bfffd9075bfe02ab7edf22b1fa460a5391ad00f842c098beeb4d8327caab | Python | 9,325 | 310 | import numpy as np
import warnings
def init_pca(X, no_dims, contri, use_gpu=True, verbose=False):
"""
This function preprocesses data with excessive size and dimensions.
Now supports GPU acceleration via MLX (Apple Silicon) or torch_pca (CUDA).
Parameters
----------
X : array-like
... |
afddbfc4aa39b1bfc216b7a4d8fe4c4fa30a44f6475bf4a21401dd0900eff4ac | Python | 9,326 | 204 | def _paras(**kwargs):
"""
Return hyperparameters for training.
Accepts keyword arguments to override default values.
"""
para = {
# Internal gain module
"Int_in": 3, "Int_h": 8, "Int_out": 1,
# External disturbance module
"Ext_in": 2, "Ext_h": 16, "Ext_out": 1,
... |
10bd8ad2a71a99927d7918a368694c902c8d4f50bcd91086b8561cca99c08311 | Python | 9,327 | 261 | import base64
import logging
import os
import traceback
from typing import Any, Callable, Dict, Optional, Union
import ray
import ray._private.ray_constants as ray_constants
import ray.cloudpickle as pickle
from ray._common.utils import load_class
from ray._private.function_manager import build_setup_hook_export_entry... |
f9c0bd9951276d130230c9577b50eaffdbb7fbc79ec85e73e4a771726ea0de8c | Python | 9,332 | 292 | from abc import abstractmethod
from discontinuous_galerkin.base.base_model import BaseModel
import numpy as np
from attr import dataclass
import pdb
import matplotlib.pyplot as plt
from tqdm import tqdm
import ray
from scipy.stats import norm
from data_assimilation.model_error import BaseModelError
from data_assimilat... |
696947abf4e578c19fbc61d8bd047d6ed239fd672afe7205ff668298d23339e9 | Python | 9,337 | 248 | """Plotting the process from raw data to equalization and normalization"""
import os
import glob
import nibabel as nb
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
data = pd.read_csv(f'/Users/sebastiandresbach/github/neurovascularCouplingVASO/results/ERAs_rawPlusZscored.... |
a79f8c5b51b2c93896b3545c9f7dff8e3348c853446008c60b717d9429685220 | Python | 9,337 | 272 | """
Extracting QA metrics from data
"""
import nibabel as nb
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import glob
DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti/derivatives'
voxelList = []
modalityList = []
metricList = []
valList = []
... |
c0312966155ddab130bf1acf5d70b0c17cc7056371f70d494f48750b3e51f7c4 | Python | 9,338 | 292 | # -*- coding: utf-8 -*-
#
# ngs_mapper documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 1 09:31:06 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... |
e455b6ae88d679dfa135da2aab76920e3faeeed2c494fd5a18b2a85c28ade376 | Python | 9,338 | 259 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Created By : Kangjoo Lee (kangjoo.lee@yale.edu)
# Last Updated: 08/06/2024
# -------------------------------------------------------------------------
# =========================================... |
b73c56bada66e6956d32237ec2dc646775cb97fb7a12a8254da836b199305711 | Python | 9,339 | 287 | # Copyright 2024 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, ... |
316e4b489aaf8a9c7fa362c80a9f4731cf8871e12239feb7c52e1f514b24a768 | Python | 9,347 | 211 | """
Explanation of Key Components
Embedding Layer: Maps each (phase,magnitude)(phase,magnitude) pair to a higher-dimensional space.
Positional Encoding: Provides positional information to the model.
Multi-Head Attention: Captures relationships across the sequence.
Feed-Forward Network: Enhances the cap... |
5958ba165651b631e2250d77a231832a2439504de28e935a03dff6c1740aea28 | Python | 9,350 | 236 | ####################################################################################################
# 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>
#
# This program is free softw... |
bc161ad51d6ce25536664afb3a4056f5a08d3720380f67002fb020444a2e7ecc | Python | 9,352 | 247 | # adapted from commit
# b700b7c30338d8351b35428a887854ba214d73b8
import functools
import warnings
from abc import ABC, abstractmethod
from pathlib import Path
from typing import List
import ase
import numpy as np
import torch
from torch import tensor
from torch.utils.data import Dataset
import pickle
from ocpmodels.c... |
8bf2a880669a12caf1461322ccb3bcdbbd8c6ba53969af5dc1241e66ad92ebbe | Python | 9,354 | 276 | import asyncio
import sys
from unittest.mock import AsyncMock
import pytest
from ray._common.test_utils import async_wait_for_condition
from ray._raylet import JobID
from ray.core.generated import gcs_pb2
from ray.core.generated.common_pb2 import TaskStatus, TaskType
from ray.dashboard.modules.task_events.task_event_... |
9186923008e1b63e259467d270cf7d47422fed0f44992913c8e5e0864011bdd2 | Python | 9,356 | 192 | # compute HR
import os
import pandas as pd
from scipy import stats
from scipy.stats import bootstrap
import numpy as np
from lifelines import AalenJohansenFitter
import matplotlib.pyplot as plt
from lifelines.plotting import add_at_risk_counts
# ################################################# for all dr... |
004dd003d4d6420409c269fdfc52eb9fb20ded4facc6549206e463074537d02d | Python | 9,360 | 299 | """
Tests for tedana.io
"""
import json
import os
import nibabel as nib
import numpy as np
import pandas as pd
import pytest
from tedana import io as me
from tedana.tests.test_utils import fnames, tes
from tedana.tests.utils import get_test_data_path
data_dir = get_test_data_path()
def test_new_nii_like():
da... |
944b471c838b4c06db59d1381934df2a5a9664cf7cb87ead0183348aef6be415 | Python | 9,361 | 228 | """
Global signal control methods
"""
import logging
import numpy as np
import pandas as pd
from scipy import stats
from scipy.special import lpmv
from tedana import utils
LGR = logging.getLogger("GENERAL")
RepLGR = logging.getLogger("REPORT")
def gscontrol_raw(catd, optcom, n_echos, io_generator, dtrank=4):
"... |
3f678c9a564c1b312be469f1d7fd70c361c93bee8fa41d430abdce46d5bb232b | Python | 9,366 | 227 | r"""
This module contains code interfacing parameters package, and pyNN distribution interface.
In future pyNN plans to make an comprehensive merge between the parameters parametrization system and pyNN,
in which case this code should become obsolete and mozaik should fully switch to such new system.
"""
from future.... |
f95f5ed055bcf01579112802b4d98d2a81d2627657223ced69d6a052a6bd50a4 | Python | 9,370 | 199 | ####################################################################################################
# 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... |
80d2d84a6e8fb33d9ffb224116021e060a67342fd3d2eb9997a6d3f8f1b4dbee | Python | 9,372 | 225 | from os import path, listdir, getcwd, remove
import inspect
import json
import re
import shutil
from copy import deepcopy
from itertools import product
import argh
import nipype.interfaces.ants as ants
import nipype.interfaces.io as nio
import nipype.interfaces.utility as util
import nipype.pipeline.engine as pe
impo... |
268401e90dc2c531161d2863155450570f24061121df064461e47340d6c4b369 | Python | 9,374 | 216 | import torch as th
import torch.nn as nn
from tqdm.auto import tqdm
from .anvi_dataloader import ANVIDataset
from .utils import normalize, sparse_mx_to_torch_sparse_tensor, as_float_ndarray
import os
import numpy as np
import matplotlib.pyplot as plt
from .utils import batch_func
# Detect device - use CUDA if availabl... |
31e15eeabd78a7ca73d688d1c7d3dd9112a9d38e949fae7afc466f74df97c23d | Python | 9,374 | 208 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
from util import *
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve, PrecisionRecallDisplay
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
def plo... |
b6304a44edd1225936a465b020f186a317a8eaad41691634dc72e4ba2f3af228 | Python | 9,377 | 236 | #
# 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... |
1691eaa423f4fd863adcd441772507b1e0df2c6448dc3a327e9bfadd0bdb3075 | Python | 9,378 | 189 | import logging
import json
import unicodedata
import spacy
from agent.data.entities.config import BACKUPS_PATH, ROOT_LOGGER_ID
from agent.data.sql.sql_mgmt import execute_query, update_non_text_field, get_connection
from agent.data.sql.sql_mgmt import select_fields_where, select_one, exist_where
from agent.nlp.tokeniz... |
9b36960a49e4884e8b909e4281fad1b32f0e39c0f6c08305ce2b85c58523c291 | Python | 9,383 | 207 | # Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
# and Applied Computer Vision Lab, Helmholtz Imaging Platform
#
# 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 L... |
ae136471a04816cd83f2eb58905f6f3a87130641e7884e4d2037af71e0e46d3c | Python | 9,383 | 254 | import numpy as np
from scipy.spatial.distance import cdist
from tqdm import tqdm
from rdkit import Chem, DataStructs
from rdkit.Chem import Descriptors, Crippen, Lipinski, QED
from analysis.SA_Score.sascorer import calculateScore
from analysis.molecule_builder import get_bond_order_batch, build_molecule
from constant... |
b1f4a6b7562d4cf2292f60e2cdf2144bc34219133f3c22208d5aa995f76d4d6f | Python | 9,383 | 242 | #!/usr/bin/env python3
import argparse
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 seaborn as sns
import collections
FILE_NAME = "file_name"
BLOCK_N50 = "block_n50"
ALL_SWITCH_RATE = "all_switch_rate"
ALL_HA... |
631473c3c7a69d76f038b6e02680bc5810fbd11adb787d4df535333fbd11097a | Python | 9,385 | 251 | """
Optional utils module contains utility methods
that require optional dependencies.
"""
import asyncio
import collections
import functools
import inspect
import logging
import os
import time
import traceback
from collections import namedtuple
from types import ModuleType
from typing import Callable, List, Optional,... |
cd6ff9415af225c14e9972ba4e023f2480b19da7876e82b47e72f4fe5b6a16ea | Python | 9,388 | 262 | # ruff: noqa: E501
from ray.dashboard.modules.metrics.dashboards.common import (
DashboardConfig,
GridPos,
Panel,
Target,
)
SERVE_DEPLOYMENT_GRAFANA_PANELS = [
Panel(
id=1,
title="Replicas per deployment",
description='Number of replicas per deployment. Ignores "Route" vari... |
ac28bb3794baef90da9f2a8f600510fffbbf441e0a150c33e13b51505bd90273 | Python | 9,389 | 248 | from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
import math
import os
import torch
import torch.nn as nn
from torch.nn import functional as F
# Transformers renamed SampleDecoderOnlyOutput → GenerateDecoderOnlyOutput
# around v4.45; older versions on... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.