sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1220ea93efc0148ff756b03c85f106147e4f48399604f6116bcbd4cdc87c8b28 | Python | 10,296 | 323 | '''
There are some problems with the data (of course). So here, I am trying to
find out what is going wrong
'''
import pandas as pd
import glob
import os
import re
import math
import matplotlib.pyplot as plt
# Check whether triggers were timed correctly
subs = ['sub-06']
subs = ['sub-05','sub-06','sub-07','sub-08... |
2dbbe48aa0bf2585677e55f17cf4fcbb0e2deda4a298efd80538a427d1be708f | Python | 10,296 | 260 | import torch
import torch.nn as nn
import numpy as np
from torch.optim import AdamW
import torch.optim as optim
import itertools
from model.warplayer import warp
from torch.nn.parallel import DistributedDataParallel as DDP
from model.oldmodel.IFNet_HD import *
import torch.nn.functional as F
from model.loss import *
d... |
441e707ca987989b3c980e8f2129d51414bf1cf5385535932e95254d8c036fcb | Python | 10,296 | 373 | import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
from .utils import neighbor_smoothing_row
from .local_stats_pairs import create_centered_counts_row
from scipy.spatial.distance import squareform
from scipy.cluster.hierarchy import linkage
from scipy.stats import norm
def compute_scores(
... |
18fd1c4d2dc9724b6035ba9140de06734aa4ce9d119d739e08b94079c79d13ec | Python | 10,298 | 242 | import tempfile
import torch
from diffusers import PNDMScheduler
from .test_schedulers import SchedulerCommonTest
class PNDMSchedulerTest(SchedulerCommonTest):
scheduler_classes = (PNDMScheduler,)
forward_default_kwargs = (("num_inference_steps", 50),)
def get_scheduler_config(self, **kwargs):
... |
4ba6e32c86164f7c31e806973853bfe92db2be015d3d1b896f7020fded601794 | Python | 10,302 | 309 | from dipy.io.streamline import load_tck
from dipy.io.image import load_nifti
from fury import actor, window, colormap as cmap
from os.path import exists
import nibabel as nib
import numpy as np
def visualize_sub_bundles(
fsub_bundle,
ref_anat,
fname,
roi1,
orig_bundle=None,
roi2=None,
orig... |
6c0849382dfa8bdbfac434a869c5ac64daff1edb6af1d85062d3e72364175f29 | Python | 10,303 | 235 | import numpy as np
from scipy.spatial.distance import cdist
from scipy.ndimage import gaussian_filter
from ot.lp import emd
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
NAME_MAPPING = {
"PFI": "PFI",
"Integrated Gradients": "Int. Grad.",
"Saliency": "Saliency",
"DeepLift": "DeepLift",
"De... |
04a8f1172eb48d3e27b5e223e71b8999e9afd9e21168155dd16676248d0a4d2b | Python | 10,305 | 309 | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv1d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
def conv5x5(in... |
fa1c6cd1dab86835f246c9c3e9dd7b4b303aff184087ddb5756df88951d25850 | Python | 10,309 | 243 | import itertools
import numpy as np
from spinnaker2.neuron_models.application import BaseApplication
from spinnaker2.mapper import SynapseWordSize, SynapseWordSpec, APP_PATH
from spinnaker2.configuration import PEConfig, MemoryRegion
from spinnaker2.neuron_models.common import (add_log_memory_region,
N_WORDS_M... |
c2876caeb6ba4fe02c5b925c2bef9433f11251777a7f5ecdccd67dd7bc5180a1 | Python | 10,315 | 296 | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv1d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
def conv5x5(in... |
237a5c5dfe89df6ccf4d4ef5563018bbf8e2491a5f6f0d64ae2c011e62d7869a | Python | 10,316 | 220 | """
CNN-LSTM model function for local machine
Created date: 03/18/2022
Author: Xiaohui Zhang
"""
import os, json
import argparse
import numpy as np
import scipy.io as sio
import tensorflow as tf
from tensorflow.keras.layers import *
from tensorflow.keras.losses import *
import tensorflow_addons as tfa
from tensorflow.... |
c9c68efecda7be530fc3b350a7f3c7a19374062ebe51f3719a969ca9ac6fca3f | Python | 10,319 | 306 | # 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, ... |
f548d5481734272b2e8420312b2f5e7ed448fd6693d0a3b08d126a1092eea804 | Python | 10,319 | 249 | # -*- 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.
#... |
5911091579c566930d7ef1a14e2fa17c6e8339dc65af0e48c9dc718ce3675da2 | Python | 10,320 | 386 | """
Tests to ensure ray DAG can correctly mark its input(s) to take user
request, for all DAGNode types.
"""
from typing import Any, TypeVar
import pytest
import ray
from ray.dag.dag_node import DAGNode
from ray.dag.input_node import InputNode
RayHandleLike = TypeVar("RayHandleLike")
def test_no_args_to_input_nod... |
6d6c0ac50fc1682f90b1786e393b79b24b7bdf8952899e720e832a56474a08d8 | Python | 10,322 | 302 | """
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 math
import numpy as np
import numpy.typing as npt
import torch
import torch.nn as nn
from scip... |
f16deab021d757a2ad79374895f2d0673f2783818015054d18123e6ec1f40784 | Python | 10,322 | 270 | import asyncio
import random
import sys
import pytest
from google.protobuf.timestamp_pb2 import Timestamp
from ray.core.generated.events_base_event_pb2 import RayEvent
from ray.dashboard.modules.aggregator.multi_consumer_event_buffer import (
MultiConsumerEventBuffer,
)
def _create_test_event(
event_id: byt... |
a7e04480e9095732461822460d9847370ed192c5854b9c5fd1c866870edb35e3 | Python | 10,324 | 306 | # -*- coding: utf-8 -*-
#
# fmm3d documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 1 16:19:13 2017.
#
# 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... |
b0df00752c074dc1ccfebff2157b7b193cf78dd1a354e1ddd6c486db4755a518 | Python | 10,324 | 322 | """PRIDE proteomics database API client."""
import logging
from typing import Any, Dict, List, Optional
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class PRIDEClient(BaseAPIClient):
"""Client for PRIDE proteomics database API.
PRIDE (PRoteomics I... |
3762e1d49c553d5a57403e7ac0547191e99f1400c0594f4f133c4e48b4e40552 | Python | 10,325 | 290 | # Copyright 2021 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... |
979cec448b201765cd46fda3d3e18d593c039b2ec6a0353a7dad36c522e1ebf6 | Python | 10,325 | 319 | # Copyright 2021 Google Research. 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 applicable law... |
39978705766ab596f3005ce85f7de0b4fbd59e1e501c2c7972cfd2d9f17d236a | Python | 10,326 | 322 | """PRIDE proteomics database API client."""
import logging
from typing import Any, Dict, List, Optional
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class PRIDEClient(BaseAPIClient):
"""Client for PRIDE proteomics database API.
PRIDE (PRoteomics... |
6a5ca069a1e49977aef0d624c4466efc5553ce4eb1240c61b27e1e272b32728e | Python | 10,329 | 297 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 27 00:46:20 2023
@author: Leyang Xue
"""
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(packagepath... |
61431e059111d31fe6b68caa474d778a729a3c7eea9fae8ca2ec8de86ec9dee7 | Python | 10,333 | 283 | # -*- 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.
#... |
d4166937e05adbb90f975f2f939bd1806096ab6f8a93b2b9370bc3c03a7d5b17 | Python | 10,335 | 244 | # Please save the model predictions using the script `dev/generate_predictions.py` before running this script.
# %%
from sklearn.metrics import multilabel_confusion_matrix, classification_report, roc_curve, auc, confusion_matrix, \
RocCurveDisplay, precision_score, recall_score, average_precision_score, Precision... |
bfad858b361dcfae65ddc5f2299f5e9698e2e8a77aef6ba8c49fdfc7e0b4a5e5 | Python | 10,336 | 298 | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv1d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
def conv5x... |
6064e38c0d0c08c5fad6abf7c0e4355c86c60a1deeb57970b4a790dc86ff8d5d | Python | 10,338 | 262 | # 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... |
34daafe0466b750d7947f897647db024ba586de1ecce4b4862a7e7045474c093 | Python | 10,343 | 195 | """
The code for the research presented in the paper titled "Enabling inverse design of plasmon-based nonlinear square resonators with deep neural networks."
This code corresponds to the Forward Deep Neural Network (DNN) section of the article.
This code regenerates the Fig. S6 of the paper.
Please cite the paper... |
c5e41b3fa59e47c49f9e3bdaf58ef2ed6c2e4010fb837602dc858a556774eeb7 | Python | 10,343 | 165 | """
From https://github.com/ehoogeboom/e3_diffusion_for_molecules/
"""
from typing import Any, Dict
from torchtyping import patch_typeguard
from typeguard import typechecked
patch_typeguard() # use before @typechecked
@typechecked
def get_dataset_info(dataset_name: str, remove_h: bool) -> Dict[str, Any]:
if d... |
0ffd15a83862bf2e19b0895639077d8c04e049495f6c568703e90aaf82a15b23 | Python | 10,346 | 321 | """
General utility functions for pre-processing molecules
"""
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import numpy as np
import pandas as pd
import qcelemental as qcel
import tensorflow as tf
import logging
tf.get_logger().setLevel(logging.ERROR)
from apnet import constants
def qcel_to_dimerdata(dimer... |
5de9643e2e10902348d1a55c51982f775afbdf3eb34dae44658dec95c7495181 | Python | 10,348 | 266 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import glob
import sys
import bam_stats
import os
xor = lambda a, b: (a and not b) or (not a and b)
AVG_DEPTH_PARAM = "avg_depth"
MIN_DEPTH_PARAM = "min_depth"
def parse_args():
parser = argparse.ArgumentParser("Produces BED file of ba... |
0fc7167748f57f9a498d82dfbbcbd325145237013656ed819f0acd56cdf3232b | Python | 10,352 | 273 | """load annotations from the Siena dataset https://physionet.org/content/siena-scalp-eeg/1.0.0/ to a Annotations object."""
import os
import re
import time
from pathlib import Path
import pandas as pd
import pyedflib
from ..annotations import Annotation, Annotations, EventType, SeizureType
from ..eeg import Eeg
de... |
5d21ccf0b362606cd4a5393a30a663496f01129fbbee9a6b72b58ac531acb829 | Python | 10,355 | 281 | """
Data reading functions for OmicVerse.
This module provides functions for reading Visium (standard) spatial
transcriptomics data from Space Ranger output directories.
"""
from __future__ import annotations
import json
import warnings
from pathlib import Path
from typing import TYPE_CHECKING, Optional, Union
impo... |
db0a0a213b1099a599029368afb053f2f187027e73787275c1e71182021708fb | Python | 10,359 | 285 | """SessionService & ContextService — session lifecycle and filesystem context.
Extracted from ``smart_agent.py`` so that session reset/history access,
session-ID resolution, runtime working-directory tracking, and
filesystem/notebook context delegation live in focused service code
instead of being scattered across the... |
832303fca9fd4d803444a4f33c754d53ab924284f341f0af9cb3c8f9a78fd276 | Python | 10,361 | 282 |
import numpy as np
import torch
from torch_geometric.data import DataLoader, Data
import gc
import sys
import time
import logging
import socket
from datetime import datetime
from mpi4py import MPI
from e3nn.o3 import ReducedTensorProducts
from aptnn.aptnn import APTNN
from aptnn.parameters import ModelParameters
... |
80007283b8a3d69ba0117c571be261d6fff1278038acaf9311354599a60080c1 | Python | 10,363 | 304 | # built-in dependencies
from typing import List, Optional, Union, cast
# 3rd party dependencies
import torch
from torch import nn, Tensor
from torch.nn import functional as F
# project dependencies
from deepface.commons import weight_utils
from deepface.models.facial_recognition.pytorch.TorchFacialRecognition import ... |
8bdde5bcfc3aa48f80276b4c41dbcda852ea8b8c26488067ca582b5dff572451 | Python | 10,370 | 266 | # -*- 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.
#... |
cfdf3474bd68cc9062d05a15613deaa78f3d8e1952ed23599261df3fcf0f7e3a | Python | 10,374 | 303 | import os
import pdb
from matplotlib import pyplot as plt
import numpy as np
import yaml
from yaml.loader import SafeLoader
import torch
import ray
from latent_time_stepping.oracle import ObjectStorageClientWrapper
from latent_time_stepping.utils import create_directory
from latent_time_stepping.AE_models.VAE_encoder ... |
61f37bc2b87fb4fb44c70ac35520863f69b69011a3ccc6d185083da77197f2dd | Python | 10,375 | 271 | import os
import torch
import torch.nn as nn
import torchvision
import pytorch_lightning as pl
from networks.unet import Generator, Discriminator
from utils.batch_utils_dpm import Dataset_train, Dataset_test
from utils.loss import SSIM_loss, GANLoss, TVLoss
from PIL import Image
class GAN(pl.LightningModule):
def ... |
9d83a6daeaf065c3fe3cd467b1cee4c73f22420b8b604be233c146556adbdf31 | Python | 10,375 | 285 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""High level analog tiles (inference)."""
from typing import Optional, Any, Dict, Tuple, TYPE_CHECKING
from torch import Tensor, zeros_like, clamp
from torch.... |
33af1ad594468b0515c5db72860c62ee90e63daec5efb0e23a52d41aaf586003 | Python | 10,377 | 255 | import os
import numpy as np
import pandas as pd
from datetime import datetime as dt
import logging
from telemanom.helpers import Config
from telemanom.errors import Errors
import telemanom.helpers as helpers
from telemanom.channel import Channel
from telemanom.modeling import Model
logger = helpers.setup_logging()
... |
2ea7045dcba72e27b9c8d38e7eaa30909c164a358ee7513f36dc515959ca5a20 | Python | 10,378 | 268 | ####################################################################################################
# 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... |
740bb28da2bfcda1a7c8ba6d73017517e520ab410b63b0aed882c5d14f6f50c5 | Python | 10,378 | 214 | # coding: utf-8
"""
# # SCRIPT: THE RELATIONSHIP BETWEEN EEG AND FMRI-BASED REACTIVATION IN REST
# # PROJECT: FMRIREPLAY
# # WRITTEN BY QI HUANG 2023
# # CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY
"""
# In[1]: import relevant packages
import os
import numpy as np
im... |
7d02561fd8fc45bfba24d4f27c8972ee3b78a604354623fe2ab998eb0f185dd4 | Python | 10,379 | 280 | #!/bin/env python
import argparse
import pysam
import sys
import gzip
from math import floor
from typing import Any, List, Text, Dict, Optional, Set
GQ_FIELDS = ["GQ", "PE_GQ", "SR_GQ", "RD_GQ"]
def _parse_bnd_ends(vcf_path: Text) -> Dict[Text, int]:
"""
Since pysam automatically changes invalid END fields ... |
c186de27877869f45812de92142ba1104ead75b1e43441009db832b8b53f63be | Python | 10,383 | 321 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 30 11:31:21 2024
@author: mkazemzadeh
"""
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Activation, ReLU, ZeroPadding2D,Cropping2D, ELU, UpSampling2D
from tensorflow.keras.layers import B... |
b36bac634f96bea32787d91bb7d90b19c709f032925f0b70c576abfdf1e5d96d | Python | 10,384 | 246 | # 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... |
b19ae268d5e54ed53c25618300ec4f3ff4204f4f04a2a41e5bfadf3d410f4b5a | Python | 10,386 | 314 | # Copyright 2021 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... |
47576d231e5be9e0d87f48261da6501de1fab34b5c20242ea404100e43013039 | Python | 10,389 | 264 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 18:39:45 2016
@author: Andrea Giovannucci
For explanation consult at https://github.com/agiovann/Constrained_NMF/releases/download/v0.4-alpha/Patch_demo.zip
and https://github.com/agiovann/Constrained_NMF
"""
from __future__ import division
fr... |
f2ac98b68fce2a664c82731e2703933cd75482ffd619138de4ff8f782062d0f5 | Python | 10,390 | 249 | 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 pickle
import pandas as pd
import numpy as np
from model.model import Encoders, NN
from model.layers import Losse... |
974eb23bdc3996626696cd70015274fe21eb8421fd5b6a4b4380614eae55a0f5 | Python | 10,393 | 299 | # -*- 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.
#... |
16f469fdd0fefceacfac916c2f57bcb96accab03d4e18a5a8e0e3bd9e4ff931d | Python | 10,397 | 238 | """Methods for batch annotations of images stored as 3D tensors, such as MRIs, from within notebooks."""
import json
import os
import socket
import tempfile
from typing import Any, Dict, List, Tuple, Type, Union
from IPython.display import display
import numpy as np
import pandas as pd
import h5py
from ipyannotations... |
e1185862c8df54f7de92d29caab6415aa505b8758fe9cd02198f14c0c7aa9626 | Python | 10,401 | 237 | # Definition of several convolutional modules
# Normal convolution, Residual, ResNeXt, Inception, Amoeba...
# From [this link](https://towardsdatascience.com/history-of-convolutional-blocks-in-simple-code-96a7ddceac0c).
import numpy as np
import keras
import keras.layers
import keras.backend
import keras.backend as K
... |
6b98885664e4cf37ca9513fafd20959e46ce79bb5b61eb163e1c614bc6df2f34 | Python | 10,403 | 290 | #!/usr/bin/env python3
import argparse
import sys
import os
import pysam
import collections
import numpy as np
from multithread import *
HP_TAG = "HP"
UNCLASSIFIED = 'unclassified'
CORRECT = 'correct'
INCORRECT = 'incorrect'
UNKNOWN = 'unknown'
CORRECT_RATIO = 'correct_ratio'
UNCLASSIFIED_RATIO = 'unclassified_ratio'
... |
15f953ee5552d6e5ba21c7e8a51ecd0ce20e97dabe6850e122110f5a7c1ea680 | Python | 10,404 | 253 | # Modified from https://github.com/Jathurshan0330/Cross-Modal-Transformer/blob/master/models/epoch_cmt.py
import copy
from typing import Optional, Any
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn import functional as F
from torch.nn import Module
from torch.nn import MultiheadAttent... |
381c64eef88f8552b086a2ac7ed0bb4cecdb28b4b1b45e97345391071158c961 | Python | 10,404 | 260 | from __future__ import annotations
import warnings
from typing import TYPE_CHECKING
from datetime import datetime
import numpy as np
from anndata import AnnData
from .._settings import settings, EMOJI, Colors
from .._registry import register_function
if TYPE_CHECKING:
from typing import Literal
def _choose_r... |
6f7e77932a683de9a17ec3e0f9bfef5d3706a261745aec4ab784ac7a351b22ef | Python | 10,406 | 266 | 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
# See companion comment in model.py — defensive import to span the
# pre/post-v4.45 transformers rename, wit... |
36d9debf05f701c9463bf88f6a60741f14c9753bdc57a9b5ac2183969a231835 | Python | 10,407 | 280 | from __future__ import annotations
import logging
from pathlib import Path
import numpy as np
import pandas as pd
import scanpy as sc
from scipy.stats import norm
from ._config import DiagnosisConfig
from ._manhattan_plot import manhattan_plot
from ._regression_read import _read_chr_files
from ._style import Colors,... |
02510051046594d55d5a251b101cf7c437e72dbfbd87d8b1f93e5915a3c7e3fd | Python | 10,418 | 327 | """This should test cases of dynapcnn compatible networks with dvs input."""
from itertools import product
from typing import Optional, Tuple, Union
import pytest
import torch
from torch import nn
from sinabs.backend.dynapcnn import DynapcnnNetwork
from sinabs.backend.dynapcnn.dvs_layer import DVSLayer
from sinabs.b... |
4ebeb5d7c730a0acd35bb5eee641ab68791b795ee2115a34a4389d77318ea91c | Python | 10,420 | 283 | """Methods for integration of interactive DICOM plots within notebooks.
TODO:
* Continue to *pragmatically* improve this to make the visualization controls
and the information shown more similar to that in full-featured DICOM viewers.
"""
import collections
import os
import tempfile
from typing import Any, DefaultD... |
c5b98508eecf5fba9fc374ba6fa1ff7fcb94357f47df1aaf0f800facb78c9e92 | Python | 10,420 | 251 | r"""
Module containing the experiment API.
"""
import numpy
import resource
import mozaik
from collections import OrderedDict
from mozaik.stimuli import InternalStimulus
from parameters import ParameterSet
from mozaik.core import ParametrizedObject
from mozaik.tools.distribution_parametrization import ParameterWithUnit... |
22728a75954a4778ef1d6f356bbfddfff9c73837ce181c0a2ec58307f805b846 | Python | 10,421 | 259 | import torch
import torch.nn as nn
from collections import OrderedDict
from utils.kfac_utils import fetch_mat_weights
# from utils.common_utils import (tensor_to_list, PresetLRScheduler)
from utils.prune_utils import (filter_indices,
filter_indices_ni,
get_t... |
503d9b8a97a376cea83d758d4a8854ef64c45791df46a112aa8ffed7935a1964 | Python | 10,421 | 270 | """
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 for the isolated-atoms / empty-global-graph code path.
Covers:
1. ``add_n_empty_edges(..., fake_atom_idx=N)`` produces self-loops on... |
e82153b3837b49d264a319e6d86d8a340c34c93081af062a054e9e3c07f1cec5 | Python | 10,422 | 282 | """Pure NumPy CPU backend for Harmony.
Avoids PyTorch dispatch overhead on CPU — faster for small-to-medium
datasets. Uses the R package formulas (same as upstream harmonypy v0.2.0).
"""
import numpy as np
import logging
from datetime import datetime
from tqdm import tqdm
from sklearn.cluster import KMeans
logger =... |
6434e78f289e5b1e5123ea217dd378dea1570b8714de9d330bb30928c24b74c3 | Python | 10,429 | 236 | import numpy as np
import torch
import torch.nn.functional as F
import torch_cluster
from scipy.spatial.transform import Rotation as R
from biopandas.pdb import PandasPdb
int2AA = {0:'GLY', 1:'ALA', 2:'CYS', 3:'GLU', 4:'ASP', 5:'PHE', 6:'ILE', 7:'HIS',
8:'LYS', 9:'MET', 10:'LEU', 11:'ASN', 12:'GLN',... |
ebb9aba224ba2a7540d70002d9ccfd97bc606f10a0784b1cc574f6222e17faa5 | Python | 10,430 | 239 | import torch
import numpy as np
import scipy.sparse as sp
from sklearn.decomposition import PCA
from .utils import setup_seed, get_adj, preprocess_graph, cluster_post_process
from .model import PROST_NN, PROST_NN_sparse
from .calculate_PI import minmax_scaler, gau_filter, get_binary, get_sub, cal_prost_index
def ca... |
c55e01fc0594caf6cd32e87adfc8c9d1fd6ea823721f9da71a9b6dbbcc0663fa | Python | 10,437 | 255 | import logging
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Set
from ray.autoscaler._private.constants import (
DISABLE_LAUNCH_CONFIG_CHECK_KEY,
DISABLE_NODE_UPDATERS_KEY,
FOREGROUND_NODE_LAUNCH_KEY,
)
from ray.autoscaler._privat... |
ebf46fbe5e95e70d8bbc92e5f8cb3ba499f8583d522b1c6f50e69ebb17893f20 | Python | 10,442 | 247 | # built-in dependencies
from typing import Any, Dict, List, Union, IO, cast, Tuple
# 3rd party dependencies
import numpy as np
from numpy.typing import NDArray
from tqdm import tqdm
# project dependencies
from deepface.modules import modeling, detection, preprocessing
from deepface.models.demography.DemographyUtils i... |
e218e8a36b0ca8df6a32eb18f410a6aa7b7fa911eedbb4989892379e7e058371 | Python | 10,446 | 263 | """
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 heapq
import logging
from typing import TYPE_CHECKING, Any, Literal
import numba
import numpy a... |
f1573b0b6853d77ae98523d86af261b744a63801761cf1bab51dc5d54b718e75 | Python | 10,456 | 289 | # Modified from https://github.com/open-mmlab/mmediting/tree/1.x/
import torch
import torch.nn as nn
import torchvision.models.vgg as vgg
from mmengine import MMLogger
from mmengine.runner import load_checkpoint
from torch.nn import functional as F
from lqit.registry import MODELS
class PerceptualVGG(nn.Module):
... |
dfe5448c10d5642f7b1299b19d2338b4f42ad5229f75664e99954782ce19428c | Python | 10,462 | 267 | """
Train ridge regressors to regress joint angles from synthetic EMG data
1. Preprocess simulated data
2. Extract RMS features from the windows for each DoF
3. Train regressors on each synthetic dataset and save the regressor
4. Test on experimental dataset
"""
import argparse
import pickle
import os
import numpy a... |
ed62360fc3cafd228bd595c64c036f89b564ca271b7ba6088c8beca893ce9c91 | Python | 10,466 | 258 | # %%
import math
import os
from pathlib import Path
from typing import List, Optional
import torch
import tqdm
import typer
from torch.utils.data import DataLoader, TensorDataset
from typer_config import conf_callback_factory
from typing_extensions import Annotated
from .fit_model import LitUnet3D
from .utils.fourier... |
f8f61c7a1c6c568b09b7018a041595b9b77b807d7f0ac7aadd98c563d4545f75 | Python | 10,466 | 246 | import torch
import torch.nn as nn
import torch.utils.data as torch_data
from torch.utils.tensorboard import SummaryWriter
import torch.optim as torch_optim
import numpy as np
import matplotlib.pyplot as plt
import argparse
import os
from typing import List, Tuple, Callable
import pickle
from imagenet_dset.imagenet_d... |
9ef6181823a55e576edd5d6ea5d79152a189d8fe26f921c19895b012b452e378 | Python | 10,467 | 217 | '''
Calculate the max response of each ROI to each stimulus
INPUT: stimulus.csv and smoothed data in csv files, and badROIs (optional),
OUTPUT: csv with ROI names as horizontal headers. Contains max response of each ROI to each stimuli (only if an event occured)
without an event during the stimulus window, the ... |
a7b80753f6c9e81eb1cca70085cc614c4419ef2e7675eea16783dbfebe6003d0 | Python | 10,467 | 216 | from typing import List, Tuple, Optional
import numpy as np
import scanpy as sc
import squidpy as sq
import pandas as pd
def subset_for_flow_type(adata: sc.AnnData,
var_type: str = 'all',
flowsig_expr_key: str = 'X_flow',
flowsig_network_key: s... |
2af5004a73ff83dc9f6f08b5fed82baeb017963ff1ec3f6670256cbe56f28e2a | Python | 10,469 | 280 | """Receptor-chain quality control for single-cell AIRR data.
``chain_qc`` classifies every cell by the configuration of its TCR / BCR
chains — a clean reimplementation of scirpy's ``tl.chain_qc``. It is the
recommended first step after :func:`omicverse.airr.io.read_10x_vdj`: cells
with implausible chain configuration... |
892f2798bc6fea50588ec33266a0785eaf9ed44f35f48c25c7b0b0629c726fb3 | Python | 10,469 | 217 | from torch import nn
class BasicConvResBlock(nn.Module):
def __init__(self, input_dim, n_filters, kernel_size=3, padding=1, stride=1, shortcut=False, downsample=None):
super(BasicConvResBlock, self).__init__()
self.downsample = downsample
self.shortcut = shortcut
self.conv1 = nn.C... |
59234d744a711232a030e15b6d0eefac275a95fa8aedef77872ab364daa0f7fc | Python | 10,472 | 205 | import os
from lisa.core.lisa_core import LISA_Core
from lisa.core.lisa_core import CONFIG_PATH as base_config_path
from lisa.core.data_interface import PACKAGE_PATH, REQURED_DATASET_VERSION
import lisa.lisa_public_data.assays as assays
from lisa.lisa_public_data.models import LR_BinarySearch_SampleSelectionModel, LR_C... |
9ebbda2c6a2ff4d2316243a14f7228678ee396d4184451451c3f46154bab5bf3 | Python | 10,475 | 329 | import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
import os
import anndata as ad
import scanpy as sc
from typing import List
class Encoder(nn.Module):
"""A class that encapsulates the encoder."""
def __init__(
self,
n_genes: int,
latent_dim: int = 128... |
b82156d27146d05ea65108db443c919ca39fc1376c84b83e86df012112ad7146 | Python | 10,476 | 332 | #!/usr/bin/env python
"""Bootstrap setuptools installation
To use setuptools in your package's setup.py, include this
file in the same directory and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
To require a specific version of setuptools, set a download
mirror, ... |
83e93c9833e2da5a9396b2abc2b69a1f5fc226222c9279fad27d9dfd878116b9 | Python | 10,479 | 306 | # 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, ... |
21806524ede051e517ed2c587cd01554fd4b9caf9f9738fe887606494845a4df | Python | 10,480 | 342 | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 2 01:30:28 2023
@author: Leyang XUe
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(packagepath)
from utils impor... |
a1a57eeb1a4bf60945fb5dab7aa8f2818334d2090ae0c4a53ba30f0d503d4cde | Python | 10,480 | 323 | """This file is a fork from a MIT-licensed project named OpenAI Baselines:
https://github.com/openai/baselines/blob/master/baselines/common/atari_wrappers.py
"""
from collections import deque
import gym
import numpy as np
from gym import spaces
import pfrl
try:
import cv2
cv2.ocl.setUseOpenCL(False)
_i... |
1c0e06892b38bf07064322c9241b1ecaf3d41af495d1de7ac9d0e257b9195fc9 | Python | 10,481 | 204 | # coding: utf-8
"""
# # SCRIPT: THE RELATIONSHIP AMONG HIPPOCAMPUS ACTIVATION, REPLAY STRENGTH, AND TRIAL PROCESS
# # PROJECT: FMRIREPLAY
# # WRITTEN BY QI HUANG 2023
# # CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY
"""
# In[1]: import relevant packages
import os
impo... |
4c02d4ebf7b79d4045adbd77de7896d3e199b67e81d6e4f865da714c33b0b011 | Python | 10,481 | 328 | # -*- 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.
#... |
0d3dfd0a369d4179d5bdd09945ccb64aa9d318fc038a002dcadb7ea059007a69 | Python | 10,482 | 295 | import os
import sys
import tempfile
from unittest import mock
import pytest
from botocore.exceptions import ClientError
from ci.ray_ci.automation.ray_wheels_lib import (
ALL_PLATFORMS,
PYTHON_VERSIONS,
_check_downloaded_wheels,
_get_wheel_names,
add_build_tag_to_wheel,
add_build_tag_to_wheels... |
748733f11f534602ae4b16d359f956092086c3026350703219575cebfb74f03e | Python | 10,482 | 304 | r"""``ov.es`` — enrichment / gene-set scoring.
Vendored fork of `decoupler.mt
<https://decoupler-py.readthedocs.io/en/latest/api/mt.html>`_'s scoring
kernels (`aucell` / `gsea` / `gsva` / `mdt` / `mlm` / `ora` / `udt` /
`ulm` / `viper` / `waggr` / `zscore`), plus `decouple` / `consensus` /
`query_set`. The decoupler s... |
7923d42d77c98ab77a9677708a9ab0a1ec8862096d9849d6feabe93c89cbb7df | Python | 10,488 | 245 | import tempfile
import torch
from diffusers import (
DEISMultistepScheduler,
DPMSolverMultistepScheduler,
DPMSolverSinglestepScheduler,
UniPCMultistepScheduler,
)
from .test_schedulers import SchedulerCommonTest
class DPMSolverMultistepSchedulerTest(SchedulerCommonTest):
scheduler_classes = (DP... |
549632d68630e57558643bc12c552a5a187300813ed40c06295b165d0fe0476d | Python | 10,501 | 294 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
For the set of LE or dFC centroids across a range of k, print out the 2D images and
generate a table which sorts them. Then, visually sort them and edit the table.
Run this code again with the edited table to visualize the sorted plots.
Output:
subgroup+'_sortclass.c... |
5396bec5026f47a3ae772c6eb016a1db3b6e9f336b155ce9f3bfeb32d794f440 | Python | 10,502 | 269 | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 8 17:32:52 2023
@author: nlancaster
"""
#Supplemental Figure 2A
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
phospho_report = pd.read_csv('P:/Projects/NML_TPC_2023_ThermoFisher_Phosphoproteomics_q-OT-Astral/SpectronautSearchOutputs/20230523_0p... |
49142149fc5d4be933ee3d682779d8534062c27357f065922a057587ed2bf81c | Python | 10,505 | 274 | import json
import os
import platform
import random
import shutil
import string
import subprocess
from os import listdir, path
from typing import List, Optional, Tuple
from ci.ray_ci.container import Container
from ci.ray_ci.utils import chunk_into_n, logger, shard_tests
from ray_release.configs.global_config import ... |
77a7217d7b54206233249bb4c8332e428b53d3286d1023b31332c3e9ebabf90f | Python | 10,510 | 288 | """PDB data collector."""
import logging
from typing import Any, Dict, List, Optional
from datetime import datetime
from src.api.pdb_simple import SimplePDBClient
from src.models.structure import Structure, Chain, Ligand
from .base import BaseCollector
from config import settings
logger = logging.getLogger(__name__... |
6368a290a2fdcd455d1020eec29daa08f50392a8da1d573a4d11b6347b22af0a | Python | 10,519 | 330 | #%%
import torch
import torch.nn.functional as F
import numpy as np
from sklearn import cluster
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 14})
#%%
def save_model():
return
import math
import itertools
import scipy.stats
import scipy
import random
from src.encoders_decoders import *
from s... |
a8f0e0e2ca352e2b5836f816f7a238de6382439e8ca060e378e8a33a224d63cd | Python | 10,521 | 331 | # -*- 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.
#... |
75f0c22ad38e3dbd8cc620f7d3917f79b1cc27fa250af10871456d239718c65f | Python | 10,524 | 316 | # 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, ... |
3bb4b4fed1e91fb4f7e02ccd758ebcac79688511a879ba1e3479d0ca9f4daa0f | Python | 10,527 | 374 | """
This script performs the simulations for the data to plot Figure 5 of the
manuscript. Each hypothesis condition is simulated for each trajectory type.
This is done for both "realistic" and "ideal" parameter sets. Each hypothesis
condition is simulated for 300 trials.
"""
import numpy as np
from joblib import Parall... |
bd9a2ad0f26a70ba5f5691efabdbfceb7a50fd848877052b69f8194360522bda | Python | 10,528 | 272 | import os
import pickle
import pandas as pd
import numpy as np
import nibabel as nib
import pcntoolkit as ptk
from pcntoolkit.dataio.fileio import load as ptkload
from pcntoolkit.dataio.fileio import save as ptksave
from pcntoolkit.dataio.fileio import save_nifti, load_nifti
from pcntoolkit.normative import predict, e... |
0ec49bf37f76296466b671984e0e012c05b804a41cebf6ac8141737f29c564ed | Python | 10,532 | 259 | import logging
import struct
from typing import TYPE_CHECKING, Dict, Iterable, Iterator, List, Optional, Union
import pyarrow
from ray.data._internal.tensor_extensions.arrow import pyarrow_table_from_pydict
from ray.data.block import Block
from ray.data.datasource.file_based_datasource import FileBasedDatasource
if ... |
3a806f02302f4fdbccbd74a3cc419aa89eb2579143f1be809edb3a37603f68f0 | Python | 10,532 | 276 | """
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
import hashlib
import json
import logging
import os
import re
from dataclasses import datac... |
885be8ac99f2ae393471fc1801f2a866c8c0741e66912371ba117d331c4a4adf | Python | 10,532 | 351 | # -*- 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.
#... |
9e3a52fe0102283467d8417ea4e50612a164f5202f86ccd6aa1b4529872dfb68 | Python | 10,533 | 273 | # -*- coding: utf-8 -*-
"""
@author: Valeria Fascianelli, 2023
"""
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import numpy as np
import re
import seaborn as sns
import scipy
import pickle
if __name__ == "__main__":
colors = ['orange', 'blue', 'green', 'red'] ... |
e19914311fcd5038a0442c59764581538320593d7c37d6adcb5fad2b035b15cc | Python | 10,536 | 302 | # -*- 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.
#... |
3105797ad9c8502b8f5bab66463ea3ce4e280fa607d6c96aadde3c9430224d45 | Python | 10,537 | 342 | # -*- 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.
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.