sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8d76455f3e5921d8f303f88cde3e91b3e206000de1d52d67be9d0be34160c088 | Python | 6,127 | 222 | import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
class AudioModel(nn.Module):
def __init__(self, num_classes: int = 5):
super().__init__()
self.features = nn.Sequential(
nn.Conv1d(1, 256... |
b5058eb9cc67f12bf5cc25d6c2b81ca034ae0f0e599339bef8cd99ab67cdadc3 | Python | 6,128 | 164 | ####################################################################################################
# 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... |
c45b6bf391142cc5fa869dc3fe41e9d9393e237195d9ca6f2002edadba8f704f | Python | 6,129 | 162 | # Modified from https://github.com/open-mmlab/mmediting/tree/1.x/
from typing import Sequence, Union
import torch
import torch.nn.functional as F
from mmengine.model import BaseDataPreprocessor
from lqit.common.models.data_preprocessor import stack_batch
from lqit.registry import MODELS
@MODELS.register_module()
cl... |
9c2fbea69c84e9e83ea01e6876728fb1c085f3feee399badf79b9d92f62119df | Python | 6,131 | 191 | import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmengine.model import BaseModule
from torch import Tensor
from lqit.registry import MODELS
from lqit.utils import ConfigType, OptConfigType
@MODELS.register_module()
class TIENetEnhanceModel(BaseModule):
"""The ... |
5dae0cd0edbdb7dfd2f6129e85a932848ba47681d84a5921b5b7d4eca239d662 | Python | 6,135 | 177 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""API client the AIHW Composer API."""
from typing import List
from aihwkit.cloud.client.entities import CloudExperiment, CloudJob
from aihwkit.cloud.client.e... |
d4833ce43318e08a3de7d4536745ee415cff4bfb7807c4d0cfa5d14d2b08bc29 | Python | 6,136 | 202 | import torch
import argparse
import json
from torch.utils.data import DataLoader
from models import PretrainModel, load_model_arch
from utils.Dataset import TransDataset, col_fn_pretrain
from utils.training import pretrain, preeval
from utils.data_utils import (
check_early_stop,
create_log_model,
dump_tok... |
2d415c5182b9b150249be777ec3729ec498ad64f080d30a7d41ae771c34cde88 | Python | 6,140 | 133 | from tkinter import Y
import numpy as np
import matplotlib.pyplot as plt
import pdb
import torch
import torch.nn.functional as F
import cv2
import scipy
from Datasets import MASK_SIZE
from utils import *
import torchvision.transforms as transforms
def get_crop(input_map, cali_M, flip = False, msize=400):
... |
31b26dd22ba868af586ccbd5b63ccdb2365fd1963f510161d5b2db6c98fe0ee9 | Python | 6,141 | 152 | # Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
a6533b9a336503adf33ccb2f227cdbda5bc894aca01f9fa302c513a1a0a60d02 | Python | 6,141 | 204 | # flake8: noqa
# isort: skip_file
import os
os.environ["RAY_TRAIN_V2_ENABLED"] = "1"
# __quickstart_start__
import random
import tempfile
import uuid
import ray.train
import ray.train.torch
import ray.tune
from ray.tune.integration.ray_train import TuneReportCallback
# [1] Define your Ray Train worker code.
def t... |
6f385dc3a385e8fe6a9aca53aba32d41cbc338fda38248f8cfe6eb5ace183f19 | Python | 6,142 | 176 | ####################################################################################################
# Copyright (c) 2020 - 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... |
2e85a769b5ff87a4d098a86bb26ad9d06d922c5c5e1616dc3452ecda246947f1 | Python | 6,143 | 187 | import numpy as np
import torch
import pdb
import matplotlib.pyplot as plt
from latent_time_stepping.oracle import ObjectStorageClientWrapper
from latent_time_stepping.preprocessor import Preprocessor
from scipy.signal import savgol_filter
class AEDataset(torch.utils.data.Dataset):
"""Dataset"""
def __init__... |
ba90b782bdef2812b4bf8cddacd5f80752e18d59e022b65ee1a6dbf7ceab615d | Python | 6,143 | 134 | 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
from lifelines.utils import concordance_index
import pandas as pd
i... |
c77658bf072a4be96bd329cfb9c1ee27164a4f13455e50b9452a9374738f3cf0 | Python | 6,143 | 145 | from sklearn.datasets import make_blobs
from sklearn.model_selection import train_test_split
from reval.best_nclust_cv import FindBestClustCV
from reval.visualization import plot_metrics
from sklearn.neighbors import KNeighborsClassifier
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics import ad... |
e98d88205631b8e2feb0d3f4871bbf13fee48608ae22bba0f5af7c83079c3d6f | Python | 6,143 | 155 | import requests
from .__config import base_url
from .__aux_funcs import process_response
def get_all_patients(projection="SUMMARY", direction="ASC", keyword=None, pageNumber=0, pageSize=10000000, sortBy=None):
"""
Get all patients. \n
:param projection: Level of detail of the response. \n
Possible ... |
3158648afeaab9fe7b9f0b72c084f576a5e67b58432ccba2dc96fdf321797120 | Python | 6,145 | 164 | import h5io
import pandas as pd
import numpy as np
import mne
from pathlib import Path
from tqdm import tqdm
from mne_bids import find_matching_paths
from pyriemann.utils.base import nearest_sym_pos_def
from braindecode.datasets import WindowsDataset, BaseConcatDataset
from skorch.helper import SliceDataset
class D... |
35de8aee95de8a922b88fce71c8b9fd264d5385df1b4882ee2c30132a07e6813 | Python | 6,145 | 138 | # Code adapted from chemprop to use our argument structure.
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import ReLU, Dropout
import numpy as np
from torch_pgn.data.dmpnn_utils import BatchProxGraph
from torch_pgn.models.nn_utils import index_select_ND
#TODO: Add references to cod... |
05a15d831ec1b7225b1eae3cf456da4d6822d9c95432679ebc176801999dd5fc | Python | 6,146 | 145 | 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... |
4dd4102e410d7496c2c7dee505bcdf8a1d564fdd3902a7c2ea6acbb98f2c6627 | Python | 6,148 | 208 | import unittest
import basetest_dqn_like as base
import pytest
import torch
from basetest_training import _TestActorLearnerTrainingMixin, _TestBatchTrainingMixin
import pfrl
from pfrl.agents.dqn import DQN, compute_value_loss, compute_weighted_value_loss
assertions = unittest.TestCase("__init__")
class TestDQNOnDi... |
1e5c4513d4f43cc28963182cfd4aab27d7fcfe45267335dad87b76072980f9ec | Python | 6,150 | 191 | import os
import tempfile
import unittest
from unittest import mock
import pytest
import torch.multiprocessing as mp
import pfrl
from pfrl.experiments.train_agent_async import train_loop
@pytest.mark.parametrize("num_envs", [1, 2])
@pytest.mark.parametrize("max_episode_len", [None, 2])
def test_train_agent_async(nu... |
d9a8b324bb6843e9df672ab056824636f54e5be6dc4288813ea1459364d134fe | Python | 6,150 | 145 | ####################################################################################################
# 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... |
6197dff59067ce99221d26fa3a693c860b765be573f59e640e55506caaabe784 | Python | 6,152 | 190 |
import pdb
import numpy as np
import torch
from data_assimilation.particle_filter.base import BaseParticleFilter
class MLBootstrapFilter(BaseParticleFilter):
def __init__(
self,
**kwargs
) -> None:
super().__init__(**kwargs)
self._update_weights(
likel... |
c58bed253991a46c1342d9770e37b2e817ea99aa3c7198552c41848e0d7e92ef | Python | 6,152 | 193 | """
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.
Tests: fairchem.core.components.benchmark.perf_check — the inference
performance regression-check harness (timing, OOM detection,
... |
3dbc11c5f26a1f70b169db4b3e436e749c6dd9226e34ed21c37a8163ffae14c9 | Python | 6,159 | 174 | # -*- coding: utf-8 -*-
"""
convert_timestamps_to_autosections
Copyright (C) 2022 Christopher Scott Ward
created as a component of Breathe Easy
***
Breathe Easy - an automated waveform analysis pipeline
Copyright (C) 2022
Savannah Lusk, Andersen Chang,
Avery Twitchell-Heyne, Shaun Fattig,
Christopher Scott Ward,... |
b9c3809eae949d0158a793fe2dc8e6d13674a053e45dfa03e6417b32813a538b | Python | 6,161 | 144 | import argparse
import pickle
from typing import List
import numpy as np
import torch
from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct
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_uti... |
485ccf644f81e317df74e0bff94408ea31f97e72060ce4b925c911d8681d01c3 | Python | 6,162 | 178 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as modelzoo
from torch.nn import BatchNorm2d
resnet18_url = '/media/ignored/resnet18-5c106cde.pth'
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_... |
1c607e8959feff66991d8ae21401c6fb27c3b2a2bdc057907c3fb0a14e099441 | Python | 6,163 | 213 | """
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 torch
from torch import Tensor
from torch.library import triton_op, wrap_triton
from fairchem.c... |
91ae17d73013b29e975ffe89aa2b98a2d348f13d2ec6a24908bd2fb47015bf6a | Python | 6,165 | 216 | import unittest
import math
from neuron_morphology.features import soma
from neuron_morphology.constants import (
SOMA, AXON, APICAL_DENDRITE)
from neuron_morphology.morphology import Morphology
from neuron_morphology.feature_extractor.data import Data
from neuron_morphology.morphology_builder import MorphologyBui... |
889d7c29b270223402e220ae66fb1eafc60090a8e1521d5f2db43691954f2ff7 | Python | 6,166 | 162 | """Synthetic bulk-proteomics data generator for ``ov.protein`` tutorials
and tests. Produces a realistic MaxQuant-style AnnData with planted
differential proteins, count-correlated variance, and MNAR dropouts.
"""
from __future__ import annotations
from typing import Optional
import numpy as np
import pandas as pd
f... |
073a5931992d8554080d9110f982df25cb37ae139d8b4a4f144e9db90b0a7828 | Python | 6,167 | 170 |
import torch.nn as nn
import models.basicblock as B
"""
# --------------------------------------------
# DnCNN (20 conv layers)
# FDnCNN (20 conv layers)
# --------------------------------------------
# References:
@article{zhang2017beyond,
title={Beyond a gaussian denoiser: Residual learning of deep cnn for image... |
181048425af1edce6755e16c554d7a9619f178d2c7b0fd3d5a4c2342f17e2a53 | Python | 6,168 | 116 | ####################################################################################################
# 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... |
f1b6b1f67509b82f630a0656138d8b15c21591d81d0079f40ad6fc50667995c4 | Python | 6,169 | 186 | from __future__ import annotations
import math
import numpy as np
import torch
import torch.nn.functional as nnf
from .augmentation import Augmentation
class Interpolate(Augmentation):
"""Interpolate a sequence to a target framerate.
Attributes:
original_framerate (int): The original framerate of ... |
0852a7ebd03a1d8fb53775d537683395587ecafbaf720a747e48585435d69b34 | Python | 6,172 | 174 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Stripped demo for running the CNMF source extraction algorithm with CaImAn and
evaluation the components. The analysis can be run either in the whole FOV
or in patches. For a complete pipeline (including motion correction)
check demo_pipeline.py
Data courtesy of W. Ya... |
c2921d02a20da5512f88d1a69c4c4cdc637783a53b5c9bc8217f9cf8568204cc | Python | 6,173 | 197 | import os
import json
import numpy as np
import mne
class EEGLoader():
""" Loads EEG data from a fif file and sets reference channels.
The EEG data is loaded from a fif file and bad as well as reference channels are set based on previous visual
data inspection. The reference channels are set to the mast... |
54461597ad68deca1ab5d77ff6c876712fdd77102f15f4603b13c21b79b666ae | Python | 6,176 | 165 | import os
import warnings
from pfrl.collections.persistent_collections import PersistentRandomAccessQueue
from .episodic import EpisodicReplayBuffer
from .replay_buffer import ReplayBuffer
class PersistentReplayBuffer(ReplayBuffer):
"""Experience replay buffer that are saved to disk storage
:py:class:`Repl... |
56dc467cb013ebdfdcb70adae56c44abdf7ebc71b73bbbb70ad4c70f93212dbb | Python | 6,176 | 186 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# tedana documentation build configuration file, created by
# sphinx-quickstart
#
# 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.
#
# All conf... |
4aaa3e19641c9ea92422d0dce23222c72a300be6b35a1665adeb20afbb7ee7e9 | Python | 6,181 | 118 | import torch
import torch.nn.functional as F
from torch.nn import ReLU, Sequential, Linear, BatchNorm1d, Dropout
from torch_geometric.nn import NNConv
from torch_pgn.args import TrainArgs
from torch_pgn.models.nn_utils import get_sparse_fnctn, get_pool_function
class PFPEncoder(torch.nn.Module):
"""Message passi... |
bbd746c607b751c89c9e9d3b425027ee4557ba59d2acdd814cf68de5fb146045 | Python | 6,181 | 150 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
pandas version: 1.5.0
seaborn version: 0.11.0
numpy version: 1.23.3
matplotlib version: 3.6.3
pingouin version: 0.5.3
"""
#%% Import Modules
import pandas as pd
import seaborn as sns
import numpy as np
from math import sqrt
import matplotlib.pyp... |
0704c534971dd2be335084c98c8d05116a1e6f1913acd0fe1eb4050a5a68e76a | Python | 6,182 | 151 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
pandas version: 1.5.0
seaborn version: 0.11.0
numpy version: 1.23.3
matplotlib version: 3.6.3
pingouin version: 0.5.3
"""
#%% Import Modules
import pandas as pd
import seaborn as sns
import numpy as np
from math import sqrt
import matplotlib.pyp... |
0e2884fbc038babe19db44fe5279797a21888294679a28058652af843f22dfb2 | Python | 6,184 | 152 | r"""Self-organizing map — the core of FlowSOM.
WHY THIS LIVES IN ``ov.flow``
-----------------------------
FlowSOM was invented for flow cytometry (Van Gassen et al., Cytometry A 2015)
and is the field's standard clustering for marker-panel data. omicverse already
had a complete, pure-numpy implementation — but inside... |
f8565573c25252493c4bf46883b3bb29402d8a0a1abb29e94f5acafefdd0008b | Python | 6,184 | 184 | # Modified from https://github.com/open-mmlab/mmdetection/blob/main/mmdet/utils/misc.py # noqa: E501
import glob
import os
import os.path as osp
import urllib
import warnings
from typing import Optional, Union
import numpy as np
import torch
from mmengine.config import Config, ConfigDict
from mmengine.logging import ... |
fddf9e00a12287ac478fd75e622fe6f2e5405b6fbee7f9b0e0c17ab0e101e1a6 | Python | 6,189 | 178 | from typing import Optional
import mmcv
import mmengine
import numpy as np
from mmcv.transforms import BaseTransform
from lqit.registry import TRANSFORMS
@TRANSFORMS.register_module()
class LoadGTImageFromFile(BaseTransform):
"""Load an image from file.
Required Keys:
- gt_img_path
Modified K... |
3a6e9883c397d661e71388c31b8f897be400368bb3dd9111d2205490ac32f3dc | Python | 6,192 | 203 | 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... |
a5c9cc6df48fbf819724acb94bc09ae3f8772bf4b8c576902a2a9648431f7940 | Python | 6,192 | 152 | import math
import torch
from torch import nn
# from torch.nn import TransformerEncoderLayer, TransformerEncoder
# from torch_cluster import knn_graph, radius_graph
# from torch_geometric.nn import MetaLayer, voxel_grid, global_max_pool, max_pool, avg_pool
# import torch.nn.functional as F
# from torch_geo... |
b7dc600cbb48992d7382d5c702d7457cf6b8bbf092e04eee580067d2fb2d7c4f | Python | 6,196 | 198 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import argparse
from collections import deque
import numpy as np
import scipy.stats as ss
import pandas as pd
import pysam
def process_rdtest(rdtest):
"""Standardize rdtest column names"""
# Drop metadata columns (available from VCF) and rename CNVID... |
02077ebdbedb5abb29e744871d68bb8d3ca985348506142323c9e33fa500ce44 | Python | 6,197 | 221 | """PDB API client."""
import logging
from typing import Any, Dict, List, Optional
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class PDBClient(BaseAPIClient):
"""Client for RCSB PDB REST API."""
def __init__(self, **kwargs):
rate_limit = k... |
1cd494c892f4844d34e6c70fe96bd63d20749ce7ff3a231bc07a49a52d167413 | Python | 6,199 | 221 | """PDB API client."""
import logging
from typing import Any, Dict, List, Optional
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class PDBClient(BaseAPIClient):
"""Client for RCSB PDB REST API."""
def __init__(self, **kwargs):
rate_limit =... |
40a4026f44ddf799cd8b7c7135c97789d77e65ce6d3fdbd61496a6b4ca8d89f8 | Python | 6,201 | 136 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# Credits: Ahmedt Bilgili
# Juan Hernando
# Stefan Eilemman
# ... |
588a742593697188d65a96b4675e43ae0b6ace614be902f7370379e157df5aae | Python | 6,201 | 203 | import torch
import torch.nn.functional as F
from torch import nn
from torch.autograd import Function
"""
Other possible implementations:
https://github.com/KrisKorrel/sparsemax-pytorch/blob/master/sparsemax.py
https://github.com/msobroza/SparsemaxPytorch/blob/master/mnist/sparsemax.py
https://github.com/vene/sparse-s... |
4dc5ea8b6053f9414e51c66385f6b5722b37d0faa6d9bc74361e5cab817f5c25 | Python | 6,203 | 154 | """Methods for Altair-based interactive plots for ECG data for use within notebooks."""
import os
import tempfile
from typing import Optional, Union
from IPython.display import HTML
import altair as alt # Interactive data visualization for plots.
from ml4h.TensorMap import TensorMap
from ml4h.visualization_tools.ecg... |
8e13daa90c0ffa842e8e504a19fa2e27ae89dd0fe45603d371386904d81fc3d1 | Python | 6,204 | 122 | import requests
from .__config import base_url
from .__aux_funcs import process_response
def fetch_generic_assay_data_in_molecular_profile(molecular_profile_id, generic_assay_stable_ids=None,
sample_ids=None, sample_list_id=None, projection="SUMMARY"):
"""
Fet... |
90cab2ce2081c51bc5b85eb03d9daa8f52b15344c069a56cd66ca99860a9f000 | Python | 6,209 | 148 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
pandas version: 1.5.0
seaborn version: 0.11.0
numpy version: 1.23.3
matplotlib version: 3.6.3
pingouin version: 0.5.3
"""
#%% Import Modules
import pandas as pd
import seaborn as sns
import numpy as np
from math import sqrt
import matplotlib.pyp... |
031980bf78055aecb782f68153eb6787cec11d1ef0d897e3c09de4f7c96d9743 | Python | 6,210 | 162 | # coding=utf-8
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
9a894a687e9fa5caa2b0a018849c279cc58133f8e26a086635d90854284fe8a7 | Python | 6,211 | 159 | import numpy as np
import struct
from spinnaker2.neuron_models.application import BaseApplication
from spinnaker2.configuration import PEConfig
from spinnaker2.neuron_models.common import (add_log_memory_region,
collect_routing_targets, format_routing_targets)
from spinnaker2.coordinates import ByteAddr, align... |
7018d65b75e9925ddd4ef279f85c5ddd0836143a30567b8883b547cac58f287c | Python | 6,213 | 168 | import numpy as np
import json
from spinnaker2 import snn, hardware
import helper
import copy
np.random.seed(45) # TODO: Not all random seeds work -> rounding issues
# global params
n_hidden_nrns = 50
n_output_nrns = 12
timesteps = 40
# parameters of convolution layer 1
in_width = 32
in_height = 32
in_channels = 1
... |
417bfc21afba8d15ff6d65a463a6b5a3b0012b313843be72f08a1a7adafeb382 | Python | 6,216 | 100 | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pandas as pd
import random
import os
def main():
# for TOOL in ["Splam", "SPLICEAI"]:
COLORS = ["green", "blue"]
TOOLS = ["Splam", "SpliceAI-10k-Ns"]#, "SpliceAI-10k-Ns"]
TARGETS = ["Donor", "Acceptor"]
output_files = [... |
c939180af00c48bcab43909cbcb7e6ac529bfaff2521f514d7b674461b31231e | Python | 6,216 | 118 | from argparse import ArgumentParser
import numpy as np
import time
from pathlib import Path
import os, sys, csv
import subprocess
# import tracemalloc
# tracemalloc.start()
from ..bonsai.bonsai_helpers import Run_Configs, remove_tree_folders, find_latest_tree_folder_new, \
convert_dict_to_named_tuple, str2bool
... |
7905afade54272f001232d69ba1aea82e6c98d63c88af198aab9dff8dc87fda5 | Python | 6,218 | 172 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# 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... |
38d805d741e98d5ae8dd8d0f502573a25cf63dcea02937189444fd003e177527 | Python | 6,219 | 160 | #!/usr/bin/env python
#!/usr/local/bin/python
from __future__ import print_function
import numpy as np
import tensorflow as tf
import speech_data
from speech_data import Source,Target
from tensorflow.python.ops import ctc_ops as ctc
# import layer
# from layer import net
import time
start=int(time.time())
display_step ... |
a0cfc8eef4c4d1260d57ebfc2c7a8a731c90b37e573229f5ae4c9a2b0b73978b | Python | 6,220 | 211 | """
This file serves as a documentation example and CI test for VLM batch inference with audio.
Structure:
1. Infrastructure setup: Dataset compatibility patches, dependency handling
2. Docs example (between __vlm_audio_example_start/end__): Embedded in Sphinx docs via literalinclude
3. Test validation and cleanup
"""... |
a30abb863aa563933baea31d84a4a1ad4e40c49dc866428fb9e1391ff2afa212 | Python | 6,221 | 172 | # -*- coding: utf-8 -*-
"""
function to convert timestams present in a signal file into a starting
template for autosections
***
built as part of the Russell Ray Lab Breathing And Physiology Analysis Pipeline
***
Breathe Easy - an automated waveform analysis pipeline
Copyright (C) 2022
Savannah Lusk, Andersen Chang,... |
decfafb1b537aee139d032dda80f78beae74bbca2b98d9a3e1cbe598006b7887 | Python | 6,222 | 157 | # -*- coding: utf-8 -*-
from sklearn.cluster import KMeans, DBSCAN
import numpy as np
from scipy.cluster.hierarchy import linkage, fcluster
from sklearn.neighbors import KDTree
def fhc_lpd(data, k, C):
"""
Performs clustering using a Fast Hierarchical Clustering with Local Peak Density (FHC_LPD).
... |
faf0c7c03bcadc997a4f4310a8d0c10b8ebe965ec9c3ee90c5f9b7f3b4347ca2 | Python | 6,222 | 166 | # -*- coding: utf-8 -*-
"""
Pairwise functional alignment on a ROI.
=======================================
In this tutorial, we focus here on a single Region of Interest (ROI). On this
ROI, we try to find a transformation from source to target subject that
captures the variability between their signal on data they s... |
619d0bef8ac9d70fcc323df040850dbeaeedabf2343918cb3581b1aa10079e44 | Python | 6,224 | 241 | """Utilities for converting between scipy sparse matrices and PyTorch tensors."""
# Copyright (c) 2024 Valentin Goldité. All Rights Reserved.
from typing import Union
import numpy as np
import torch
from torch import Tensor
from scipy import sparse as sp
def scipy_sparse_to_torch_sparse(
matrix: Union[sp.csr_mat... |
02d8a8af11be4706b19b3510d540f9b04e0068bf2fee4d9c3f5eb57e153a548c | Python | 6,225 | 176 | from PIL import Image
import numpy as np
from ctypes import *
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import matplotlib.pyplot as plt
from dataset import OCFlowerdata, NLOSdataMNIST_PCA
from tqdm import *
import matplotlib.pyplot as plt
from tensorboardX import SummaryWriter
## net... |
0d3bdef49f1dcd71a01bc0d5581241fac0cdacf36f22632e15643d4aa99ab93a | Python | 6,225 | 210 | import pdb
import numpy as np
from tqdm import tqdm
import torch
import matplotlib.pyplot as plt
from latent_time_stepping.datasets.AE_dataset import AEDataset
from latent_time_stepping.oracle import ObjectStorageClientWrapper
from latent_time_stepping.utils import create_directory, load_trained_AE_model
torch.set_def... |
3dfe4109153c658809a9e239435ad8f80e2ee5f48e1ea3276ed30837a49a75d9 | Python | 6,225 | 193 | """
Utilities for tedana package
"""
import logging
import os.path as op
import re
import numpy as np
import pandas as pd
from tedana.utils import get_resource_path
LGR = logging.getLogger("GENERAL")
RepLGR = logging.getLogger("REPORT")
def find_braces(string):
"""Search a string for matched braces.
This ... |
37099e9bae3c677b119f4f97faf9bc67cb745b1c0c57aede0b87e6ddd60c786f | Python | 6,226 | 155 | ####################################################################################################
# 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... |
572973a492a7bcf5f751e1389787075cb794a33fc25e9797623fcfe70fc6e210 | Python | 6,227 | 182 | # -*- coding: utf-8 -*-
from vtkplotlib._get_vtk import vtk
import numpy as np
from vtkplotlib.plots.BasePlot import SourcedPlot, _iter_colors, _iter_points, _iter_scalar
from vtkplotlib import geometry as geom
class Arrow(SourcedPlot):
"""Draw a single arrow from **start** to **end**."""
def __init__(self... |
874b4a38341cf1ae00cc13d25aa7a9c83dbf7dfc58f9c6774080d8f163983630 | Python | 6,228 | 199 | # !/usr/bin/python
# -----------------------------------------
# Extract the celltype read count matrices:
# -----------------------------------------
import glob
import h5py
from scipy import sparse
import re
import gzip
import pickle
import numpy as np
import pandas as pd
import time
import gc
import sys
# For plott... |
b1ac7884257409c9e1397e6dea0fc5a5b989cd1be90a882ae5fc6bd02b747139 | Python | 6,228 | 141 | import numpy as np
import multiprocessing as mp
# @profile
def frame_weight_blockwise_mm(fn_video, video_dtype, video_shape, fn_masks, masks_shape, ii, d, leng):
T, Ly, Lx = video_shape
# # N, Ly, Lx = masks_shape
fp_video = np.memmap(fn_video, dtype=video_dtype, mode='r', shape=video_shape)
fp_masks =... |
b64400dbf2ae99e6e3df7743445026dc107352b731e860b0cdd95994e1f86a16 | Python | 6,228 | 178 | import os
from datetime import datetime
import torch
from torch.utils.data.dataloader import DataLoader
from tqdm import tqdm
from datasets.HumanPoseEstimation import HumanPoseEstimationDataset
from losses.loss import JointsMSELoss, JointsOHKMMSELoss
from misc.checkpoint import load_checkpoint
from misc.utils import ... |
d982ec9040a663004bce63e089c5cf72654ece99c4c0a33cc8855cb1c09bbd94 | Python | 6,228 | 164 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
621bacc1ff4ad76baefa3aabb73f424075f55af73d89438e2055be6d13f003a6 | Python | 6,230 | 190 | import unittest
import pytest
import torch
import torch.nn.functional as F
from torch import nn
from pfrl.nn import Lambda, RecurrentSequential
from pfrl.testing import torch_assert_allclose
def _step_lstm(lstm, x, state):
assert isinstance(lstm, nn.LSTM)
lstm_cell = nn.LSTMCell(input_size=lstm.input_size, ... |
60661a53b010fc85c47ae440b7e475bff0109bbb3827f26696ff07c76cce9552 | Python | 6,231 | 181 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import argparse
import numpy as np
import pandas as pd
import pysam
def add_genotypes(samples, record, genotypes, varGQ):
"""
Update formats and add genotypes
"""
# tag varGQ
record.info['varGQ'] = int(np.round(varGQ['GQ']))
# clear ... |
e70464367a8816e2268e3b2b4263961a96f2ef4764af215565ebced05fbf2601 | Python | 6,231 | 155 | import abc
from typing import List, Optional
import ray
from ray.air.execution.resources.request import AcquiredResources, ResourceRequest
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class ResourceManager(abc.ABC):
"""Resource manager interface.
A resource manager can be used to request reso... |
90e9543e9c1dc2e140314c23b231907ecabe2f6cac169d8f3246fa804a731e9b | Python | 6,232 | 188 | def util_create_all_ones_snn(spike_threshold: float = 1.0):
import torch
from torch import nn
from sinabs.from_torch import from_model
input_shape = (1, 8, 8)
# initialize ann
ann = nn.Sequential(
# 8, 8
nn.Conv2d(
in_channels=1,
out_channels=2,
... |
34fc574b1431104e1bbc23e95cc0864c4e05aee8893621f07255bd547f165a77 | Python | 6,233 | 140 | # import logging
import numpy as np
import torch.utils.data
from vocab import *
from tqdm import tqdm
# logger = logging.getLogger()
DEBUG = False
class Dataset(torch.utils.data.Dataset):
def __init__(self, treated_patient_list, control_patient_list,
diag_code_threshold=None, diag_code_topk=None... |
310f16e0baa9e300f2d98d0e0a4227addb45c4dad1e2c94396c2d6edd9d9fe94 | Python | 6,234 | 135 | 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
from skimage import io
import numpy as np
from DWonder.RMBG.data_process import test_preprocess_lessMemoryNoTail_SubImg, testset, multibatch_test_save, si... |
3bc9aa9d34b21d02a26a7cf0acf740ce253dcc905642e0e0d474611308f75f1c | Python | 6,235 | 183 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 11:02:48 2020
@author: gweiss01
"""
import sys
import numpy as np
import pandas as pd
import cv2
from PyQt5 import QtCore, QtGui, QtWidgets
from .fsw import Ui_Dialog
#set up dialog window
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
a... |
7cda34038063e4bda951fa03a3a33b3d1a6c15f4d7fd8d0cc7269cdb2437a22a | Python | 6,235 | 201 | #!/usr/bin/env python
## HiC-Pro
## Copyright (c) 2015 Institut Curie
## Author(s): Nicolas Servant, Eric Viara
## Contact: nicolas.servant@curie.fr
## This software is distributed without any guarantee under the terms of the BSD-3 licence.
## See the LICENCE file for details
"""
Script... |
a7659176288a89ac93bad1b6eb2c40fd08271442618fc50fc0e13cc9bad4d59b | Python | 6,235 | 156 | ####################################################################################################
# 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... |
c178ef7f88a35b5c4739cf38a8979d14e1ba37f058259dc6d080273f6f57afc1 | Python | 6,237 | 212 |
from abc import ABC, abstractstaticmethod
import os
from pathlib import Path
from typing import List, Optional
from PyQt5.QtWidgets import QFileDialog
from util.ui.dialogs import ask_user_ok, notify_error
class Settings(ABC):
"""Abstract class used to implement read, write, and validation for different sets of Se... |
c88884d411767b0590563745f389b4652c7e9ac3ac3dc68f62971a7f6099748d | Python | 6,238 | 159 |
# Imports
import os
import time
import logging
import numpy as np
from enum import Enum, auto
from itertools import chain
from abc import ABC, abstractmethod
from collections import defaultdict, Counter
from typing import Dict, List, Tuple, Iterable, Union, Optional, Set, Sequence, Callable, DefaultDict, Any
import t... |
3bce5d70755dae1441d13ca4f14da1b48187e8adabec3fc23fa19a99d5def3ab | Python | 6,239 | 153 | import math
import matplotlib.pyplot as plt
import numpy
class SiteRecord:
def __init__(self, protein_groups: list[str], positions: list[int], genes: list[str], amino_acid: str,
flanking_region: str, expression: dict[str, float]):
self.protein_groups = protein_groups
se... |
c6364944966948c9c92fbfe6c682cb1a064f59de6e31c7163ad6fbe614c8b934 | Python | 6,239 | 157 | import os
import sys
import tempfile
import pytest
from ci.ray_ci.doc.api import API, AnnotationType, CodeType
from ci.ray_ci.doc.autodoc import Autodoc
from ci.ray_ci.doc.mock.mock_module import MockClass, mock_function, mock_w00t
def test_walk():
with tempfile.TemporaryDirectory() as tmp:
with open(os... |
578a32d229d16bd9df59930d9e1de72d8558c8357eb3a2e8496275c96c8d56c3 | Python | 6,240 | 172 | # model.py
# D. Thiebaut
# This is the model part of the Model-View-Controller
# The class holds the name of a text file and its contents.
# Both the name and the contents can be modified in the GUI
# and updated through methods of this model.
#
import os
from IsoNet.util.metadata import MetaData,Label,Item
f... |
fdf9f835e84bc390455d6ad2a79677811d2596dbad63b719f7dd712c9c29a372 | Python | 6,240 | 143 | # import the main libraries required for the preprocessing
import mne
from pathlib import Path
import matplotlib.pyplot as plt
import mne_connectivity
import pickle
# import homemade function
from technical_validation_utils import (subject_files, preprocess_raw_to_epochs,
plot... |
79c4d29fc4c7fbed92620365fd3c69e9c205c5c0f81188fe5b6451e8adff35c2 | Python | 6,241 | 173 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""TestCases for aihwkit tests."""
import math
import os
from functools import lru_cache
from typing import Type
from unittest import SkipTest, TestCase
from n... |
aae9f5afb46fc24de1be533c2f9ae69b22823708a98c646b07e4ab57c3283135 | Python | 6,243 | 151 | import matplotlib.pyplot as plt
import pandas as pd
import sys
import seaborn as sns
import numpy as np
from collections import Counter
def main(argv):
THRESHOLD = 0.2
num_ls_discard = []
num_ls_cleaned = []
for sample in argv:
print("sample: ", sample)
j_score_bed_f = "../sr... |
0a7bbffd77989a65e761acd37e90b0b1bc6906d650eaaa4ab95931d6c41a7cc1 | Python | 6,244 | 162 | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import os
import torch
import numpy as np
import torch.distributed as di... |
8dafee61607d9c6e3bab8a0148800e2af45a58d787b0c3ee0222ec151fe0d1f8 | Python | 6,249 | 166 | import enum
import json
from dataclasses import dataclass
from datetime import datetime
from importlib import resources as impresources
from typing import List, Tuple
import numpy as np
import pandas as pd
from timescoring.annotations import Annotation as MaskEvents
from . import bids
# Load Seizure types defined in... |
b52e27940eb613369b68838e85eeaca94529df53da78cbd2a5f59871aa84b267 | Python | 6,249 | 210 | from dataclasses import dataclass
from pathlib import Path
from typing import Any, Iterable, Optional, Sequence, Tuple
import h5py
import numpy as np
import numpy.typing as npt
import pandas as pd
import torch
from torch.utils.data import Dataset
from marugoto.data import EncodedDataset, MapDataset, SKLearnEncoder
_... |
c85fba5b6cdd4472a3b5c4b2e595d484aba6ed806eafcedbe85db57274f85e37 | Python | 6,249 | 184 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
class EEGNet(nn.Module):
"""
EEGNet: A Compact Convolutional Neural Network for EEG-based Brain-Computer Interfaces.
"""
def __init__(self, nb_classes, Chans=64, Samples=128, dropoutR... |
d0cb17d1e889fca56e4f9bbb696a783f29e9772afa85e23a74621af60c09a445 | Python | 6,249 | 173 | # %%
import numpy as np
import time
import os
import tifffile as tiff
from skimage import io
import matplotlib.pyplot as plt
from scipy.io import savemat, loadmat
# load modules
from PostProcessing.par3 import fastthreshold
from PostProcessing.combine import segs_results, unique_neurons2_simp, \
group_neurons, p... |
3373edd49a28ad393c6323f9b425c32ad0b0fe84fab4aa1c06afe402ecbcc613 | Python | 6,251 | 205 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 6 13:35:26 2021
@author: mmall
"""
CODE_DIR = 'C:/Users/mmall/Documents/github/'
SAVE_DIR = 'C:/Users/mmall/Documents/uni/columbia/assignment_errors/fits/'
import socket
import os
import sys
import pickle as pkl
import numpy as np
import scipy as sp
import matplotlib.p... |
840ad66b5037027a40730a4a2e55d3f1d86049ff892d9c0250b2bfb9c50f9052 | Python | 6,251 | 148 | """
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.
Tests: Name-vs-path checkpoint dispatch — pretrained_mlip.get_predict_unit
(registry lookup + YAML auto-fetch) versus load_predict_uni... |
66aafa0bbd14eeeeec49aff161f1aa379e4c50ae5cc20f0ade2a8f9b9b20789b | Python | 6,252 | 182 | """
Minimal localhost OAuth provider for Streamable HTTP MCP development.
This provider is intentionally simple:
- dynamic client registration is stored in memory
- /authorize auto-approves and redirects immediately
- access/refresh tokens are stored in memory only
It is suitable for local MCP development on 127.0.0.... |
ede5d77b97fedc4b9aaf18f40b20e5770000ed439705659c9158fc8b60c8d688 | Python | 6,252 | 158 | # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/01_tools.ipynb.
# %% auto 0
__all__ = ['plot_violins', 'cluster_small_multiples', 'plot_subgroups', 'msample']
# %% ../nbs/01_tools.ipynb 5
import numpy as np
import scanpy as sc
import math
import matplotlib.pyplot as plt
# %% ../nbs/01_tools.ipynb 7
def plot_violi... |
ee0ccc6e9eb2e558ee8df5675e9803c3789728b8815a5890aa391a308f8ce1d8 | Python | 6,253 | 158 | import json
import gffutils
def write_introns(fw, intron_dict, junc_count):
for id, intron_info in intron_dict.items():
eles = id.split("\t")
eles.insert(3, intron_info["count"])
eles.append(intron_info["trans"])
# print("\t".join(eles))
trans_ls = ",".join(eles[5])
... |
4a334ad0f202e21e1fa4220f88d774235fc1ae42d4a60f502b06fa47418a3179 | Python | 6,255 | 163 | '''
Create TFRecordDataset for FBN project
Use in NeoCortex
Author: Xiaohui Zhang
Date Created: 03/07/2022
Data Updated: 09/06/2022
'''
# label wake=0, nrem=1, artifacts=2, rem=3
import os, glob, re, h5py
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from functools import partial
import sc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.