sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
5df401552b2102982634df4ca1acb048bc9dad388ce8638124a10618e60a1da8 | Python | 15,747 | 425 | # pytest unit tests for sct_apply_transfo
import sys
import numpy as np
import nibabel
import nibabel.orientations
import spinalcordtoolbox.image as msct_image
from spinalcordtoolbox.scripts import sct_apply_transfo
def fake_image_custom(data):
"""
:return: a Nifti1Image (3D) in RAS+ space
"""
aff... |
2d1d7815a25791274b2975ba1fa200388281f419b11a69754e460d306bbf3436 | Python | 15,750 | 403 | """
Eigenmode resampling on the cortex. Use fit.surface_fit() to determine how many
modes to use to capture the empirical variogram.
"""
from eigenstrapping import (
SurfaceEigenstrapping, VolumetricEigenstrapping, compute_psd, utils,
)
import matplotlib.pyplot as plt
import numpy as np
from netneurotools.stat... |
39e833ebc8e389eb726e431a7684ea7966662038a414e8013c6ad5ac61ddfa8b | Python | 15,777 | 355 | import os
import argparse
import scanpy as sc
import pandas as pd
import declust as dc
# -----------------------------------------
# Argument parser
# -----------------------------------------
parser = argparse.ArgumentParser()
parser.add_argument('--module', type=str, choices=['marker', 'cluster', 'pseudo_bulk', 'dec... |
f0ee2a5cc05931139ca6a6f8903888db40601ef3d3fcfd7a4ca0afc5d5e2128c | Python | 15,778 | 360 | import sys
from tqdm import tqdm
import random
import time
import argparse
import torch
import os
import pyarrow.parquet as pq
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
from torchsummary import summary
from nanopore_dataset import tune_signal, create_pred_sample_map, create_pred_sampl... |
34653cfec6182595bfb9bb988cf4ce181ee60a95cbb4459fa9c826bde744ea73 | Python | 15,787 | 389 | # coding=utf-8
# Copyright 2021 The IDEA Authors. 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 a... |
2e85d267a66921e85214e8c965522db0999dc5b3b5bc932a480259bf7e0b5715 | Python | 15,802 | 376 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
from fig_utils import *
import os
import seaborn as sns
from matplotlib import gridspec
def panela_images(fig, grid, dat, il, transl):
ax1 = plt.subplot(grid[0, 0])
ax1.axis('off')
il = plot_label(ltr, il, ax1, t... |
6235191ae0d3ff644f5d5923f0fea74fddde961357c74fd54bc68d99f0a61e4e | Python | 15,818 | 468 | """Evaluation utilities for SO3LR models."""
import jax
import jraph
import numpy as np
import jax.numpy as jnp
import time
import pprint
import logging
from typing import Dict, List, Tuple, Union, Optional, Any
from tqdm import tqdm
from ase.io import write
from mlff.utils import jraph_utils, evaluation_utils
from ml... |
3f737fb2a909595cadbef3c6442df21c078fff83331b01896f6a4a757c335452 | Python | 15,826 | 537 | import configparser
import logging
import os
from pathlib import Path
import click
DEFAULT_CFG = os.path.expanduser(os.path.join('~', '.config', 'pyalfe', 'config.ini'))
DEFAULT_MODALITIES = ['T1', 'T1Post', 'FLAIR', 'T2', 'ADC', 'SWI', 'CBF']
DEFAULT_TARGETS = ['FLAIR', 'T1Post']
DEFAUlT_DOMINANT_TISSUE = 'white_ma... |
acbacbee1410fb7e439cd4bfea6032c19cdf1adc5a480770a165709aab398bff | Python | 15,847 | 495 | """Functions for morphology modifications in evaluator."""
# Copyright (c) 2022 EPFL-BBP, All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICUL... |
3c0cbec297c479df122aa3b11a7a9f02751b11c0abd11c6d7b32f20efda39376 | Python | 15,857 | 474 | import logging
import json
import os
import sys
import time
import torch
import warnings
import gradio as gr
from dataclasses import dataclass, field
from transformers import HfArgumentParser
from typing import Optional, List
from lmflow.datasets.dataset import Dataset
from lmflow.pipeline.auto_pipeline import AutoPip... |
edcae8124e4c201bf05d74b406e90cf869df245f57496898dd2ede23fc53b897 | Python | 15,857 | 403 | """
Eigenmode resampling on the cortex. Use fit.surface_fit() to determine how many
modes to use to capture the empirical variogram.
"""
from eigenstrapping import (
SurfaceEigenstrapping, VolumetricEigenstrapping, compute_psd, utils,
)
import matplotlib.pyplot as plt
import numpy as np
from netneurotools.stat... |
291c8314af22b1893376ecd18ac6551409d451622504dc1a17b1a0b879c1477c | Python | 15,859 | 378 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-11-28 20:18
from collections import defaultdict
import re
import catmaid.fields
import django.contrib.postgres.fields.jsonb
from django.conf import settings
from django.db import connection, migrations, models
import django.db.models.deletion
forward_prepa... |
37c8b2d10bd7548d667fcb705ddf86ee5a8ebfec126b21291562621f05ea5057 | Python | 15,861 | 467 | import torch
import math
import torch.nn as nn
from .functional import stft, complex_norm, \
create_mel_filter, phase_vocoder, apply_filterbank, \
amplitude_to_db, db_to_amplitude, \
mu_law_encoding, mu_law_decoding
class _ModuleNoStateBuffers(nn.Module):
"""
Extension of nn.Module that removes b... |
fca1e5b8c563b86c7aa62cffd80ae1522e22f476f0731c1059800e5f691d8037 | Python | 15,864 | 476 | #!/usr/bin/env python
"""
MetaWIBELE: psortb_protein_family module
Summary the results of Psortb with Gram+, Gram- mode, Archaea mode
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (th... |
85a1b953a5e64682c810af55c15fd47e1fe54576f4c9fb00baf81affc3563107 | Python | 15,879 | 329 | #!/usr/bin/env python
"""Detect outlier from neurokit data
We'd like to detect spikes in the data that is not a signal
* Here, we first preprocess the data via `filter_physio`. This detrends and downsamples the data to the TR time.
* Then, the main point of this function is to identify residual outliers using the `sea... |
6b9971a6d5b65e7e13e727ccdc5857b067507eb966e3f4773fcce14fcfdaeded | Python | 15,885 | 420 | '''
Trains an MLP on t-SNE embeddings of flattened graph features.
Author: Hanna M. Tolle
Date: 2025-02-17
License: BSD 3-Clause
'''
import sys
sys.path.append('graphTRIP/')
from sacred import Experiment
from experiments.ingredients.data_ingredient import *
from experiments.ingredients.mlp_ingredient import *
imp... |
d16e8ddb46c10a6494d8fc9dda827129d70e96b5e97fcec398a5f8ed8d582ffe | Python | 15,895 | 430 | import os
import cv2
import glob
import PIL
import shutil
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from skimage import data
from skimage.util import montage
import skimage.transform as skTrans
from skimage.transform import rotate
from skimage.transform i... |
daffb030a339c745e4efdcabc226b5e9ec0f88f3565a7c97f49698da8c570a4a | Python | 15,897 | 371 | from dataclasses import dataclass
from logging import Logger
from typing import Optional
from jaxkineticmodel.utils import get_logger
import libsbml
import sympy
logger = get_logger(__name__)
LIBSBML_TIME_NAME = "time"
@dataclass
class Mapping:
# If a mapping has exactly one of sympy_op and libsbml_op set,
... |
e5f49b4cd3d49452b551fb99e6b57af2c01a77f3ac0ff33cc286ff7ff7a7081f | Python | 15,915 | 431 | import os
import cv2
import glob
import PIL
import shutil
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from skimage import data
from skimage.util import montage
import skimage.transform as skTrans
from skimage.transform import rotate
from skimage.transform i... |
3f4c8bf28560a92180bd839e2e93962d741b12c15f2915ee80294fa0cefae337 | Python | 15,916 | 432 | import os
import cv2
import glob
import PIL
import shutil
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from skimage import data
from skimage.util import montage
import skimage.transform as skTrans
from skimage.transform import rotate
from skimage.transform i... |
2bdafe803d7cbc3fcab7329dae1cc078e34d3ef8a0f3ed7747aafde3cb3bd46c | Python | 15,930 | 413 | """
GNODEVAE: Graph-based Neural ODE Variational Autoencoder
This module implements the core GNODEVAE model that combines:
- Graph neural networks for encoding cell-cell relationships
- Neural Ordinary Differential Equations (ODE) for modeling continuous dynamics
- Variational Autoencoders for learning latent represen... |
6e64a28b9536edb4429cb637bfd90628854d366ab3dea087db318cf7782e16a8 | Python | 15,948 | 349 | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Optional
import cv2
import mmcv
import numpy as np
import torch
from mmengine.dist import master_only
from mmengine.structures import PixelData
from mmengine.visualization import Visualizer
from mmseg.registry import VISUALIZERS
from mmseg... |
857397ff20fff4e412a18fc33758b916ceb617dd9df2decda8937511338adb5b | Python | 15,970 | 412 | import numpy as np
from scipy.stats import norm
class BayesianLinearRegression():
"""
Bayesian Linear Regression model with iterative hyperparameter optimization. Please attach 1 in the first column of your x to indicate bias
Parameters
----------
prior_mean : float or array-like, optional
... |
a56c602bb0af01ce90b75f8037999b8ea684cbe9609e99e88d7bca81d3765170 | Python | 15,974 | 379 | """Tests for Keras metrics correctness."""
import numpy as np
import keras
from keras import layers
from keras import losses
from keras import metrics
from keras import backend as K
def get_multi_io_model():
inp_1 = layers.Input(shape=(1,), name='input_1')
inp_2 = layers.Input(shape=(1,), name='input_2')
... |
dc7e0f4751235f16681f38c53e21c1353b34bc2f8ac9a50732fa2af2d1eac448 | Python | 15,993 | 453 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 8 11:04:24 2023
@author: schwab
"""
from pathlib import Path
from typing import Optional
import mrcfile
import numpy as np
import torch
from torch.utils.data import DataLoader
import torch.nn.functional as F
from scipy.spatial import KDTree
from d... |
ba5d98c26c7ba8d849906330ec35ce43f34364c87ba696e89423965dcdc6ed17 | Python | 16,024 | 333 | #!/usr/bin/env python
#
# Predict compression probability in a spinal cord MRI image using spinal cord shape metrics.
# The script process axial slices at the level of intervertebral discs C3/C4 (value: 4) to C6/C7 (value: 7).
# In other words, the script does *not* process all axial slices of the spinal cord segmentat... |
009afed89156c8b15d3b4b5894323bd69cca884e6fd1a5e68dd5baeb9b4aaa7f | Python | 16,030 | 439 | '''
These models perform the final regression task (i.e., predicting treatment outcome).
Author: Hanna M. Tolle
License: BSD-3-Clause
'''
import sys
sys.path.append('../../')
from sacred import Ingredient
from .data_ingredient import data_ingredient, get_context, get_treatment
import torch
import pandas as pd
impor... |
573115fb9bdc1dca5372f04e84251978e7dbfd77a0f0e009b9261177774bb0b3 | Python | 16,046 | 392 | # Copyright (c) OpenMMLab. All rights reserved.
import logging
from typing import List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmengine.logging import print_log
from mmengine.structures import PixelData
from torch import Tensor
from mmseg.registry import MODELS
from mmseg.str... |
94750fa07ea4e4e2d3da50133c881a8c15a4deb94630a505a58a89260e25ecd8 | Python | 16,047 | 422 | # Copyright (c) OpenMMLab. All rights reserved.
"""Modified from https://github.com/MichaelFan01/STDC-Seg."""
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmengine.model import BaseModule, ModuleList, Sequential
from mmseg.registry import MODELS
from ..utils i... |
05a783f049f8d0f3e2cbe6941ff42ce83b843b1e7af0c5cadc6709c2f00cb283 | Python | 16,050 | 446 | import numpy as np
from zetapy import ifr
from myphdlib.general.toolkit import psth2, smooth
from scipy.ndimage import gaussian_filter1d as smooth2
class BasicResponseCharacterizationAnalysisMixin():
"""
"""
def _measureVisualResponseLatencies(
self,
responseWindow=(0, 0.5),
binsiz... |
97ff9ed577f4ddc2f68c3eaaed6218553712384e692eab5070bd6cb34fd2c5b1 | Python | 16,058 | 383 | print("It works!")
import pandas as pd
import scanpy as sc
import numpy as np
import os
import json
import anndata as ad
import scipy
import h5py
### reading the data that we want to apply the clock to
adata = ad.read('./external_data/frohlich_control_lognorm_2024-12-19.h5ad', backed='r')
with h5py.File("external_da... |
602ea9b941f1db78ac4255b5778eb4e8b1678fc2b5402814a3398edcc7d5dd3d | Python | 16,068 | 435 | import time
import uuid
from collections.abc import Iterable
from typing import (Any, Callable, Dict, List, Optional, Sequence, Tuple, Type,
Union)
import numpy as np
import scipy
from filterpy.kalman import KalmanFilter
from motpy.core import Box, Detection, Track, Vector, setup_logger
from motpy... |
85b05150e0d45b00223449182510a4bac329408ae525460cffbc24cb74c5c3fe | Python | 16,080 | 346 | import logging
import os.path
import numpy as np
import torch.nn
import wandb
from dl_utils import *
from mr_utils.parameter_fitting import T2StarFit
from scipy.ndimage import binary_erosion
from core.DownstreamEvaluator import DownstreamEvaluator
from projects.moco_t2star.utils import *
class PDownstreamEvaluator(Do... |
c50ec075c286839f399fdd120660d0a57b1713e18fb9addc8d792245084e6416 | Python | 16,087 | 322 | #!/usr/bin/env python
# ----------------------------------------
# scikit-ribo
# ----------------------------------------
# a module for a-site prediction
# ----------------------------------------
# author: Han Fang
# contact: hanfang.cshl@gmail.com
# website: hanfang.github.io
# date: 10/28/2016
# ------------------... |
49bafe3157ea75e258d8f5857746c069ec97d418c7a5b60ac4c1d889b6ed5271 | Python | 16,093 | 374 | ##############################################################################
# 1. Combine the protein-ligand to complex PDB file'
# 2. Featurize the required PDB complexes
##############################################################################
import os
import sys
import time
import dask
import numpy as np
i... |
8188aa9e606bcfb429a85b6565f44b17f0b163d52cf55321bc1db59c5229d6cf | Python | 16,096 | 448 | """Morphology classes"""
"""
Copyright (c) 2016-2020, EPFL/Blue Brain Project
This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as published
by the Fr... |
ba1b4db40d2ba42bad1ca75a81bcc213631b8b2f7ca059319dbc0f4952646180 | Python | 16,114 | 366 | """
Loads a pre-trained VGAE and trains a new MLP on the same
dataset, using the same testfold indices.
Author: Hanna Tolle
Date: 2025-12-05
License: BSD-3-Clause
"""
import matplotlib
matplotlib.use('Agg') # Set non-interactive backend
import sys
sys.path.append('graphTRIP/')
from sacred import Experiment
from e... |
9f4c3855ad351ea3f4e54c8cd503fd358b557c993d02b69fb7fbaab819e9e5d9 | Python | 16,115 | 373 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
from fig_utils import *
import os
import seaborn as sns
from matplotlib import GridSpec
def panela_vary_images_mouse(fig, grid, dat, il, transl):
ax1 = plt.subplot(grid[0, 2])
ax1.axis('off')
il = plot_label(ltr,... |
c9dcdcf12550a8dfcf75675dd5da041c1b256dad440fa456ebc934ba4c0a55e8 | Python | 16,125 | 368 | import os
import numpy as np
import itertools
import freesurfer as fs
from .utilities import icv
from .io import kvlReadCompressionLookupTable, kvlReadSharedGMMParameters
from .figures import initVisualizer
from .utilities import requireNumpyArray
from . import gemsbindings as gems
def getModelSpecifications(atlasDi... |
c4118d355402db30d1fe96eb03d8bc13269947c326fb656a92619ea0909aa05b | Python | 16,128 | 406 | # Standard Library Imports
from math import pi
# Third Party Imports
import numpy as np
import tensorflow.compat.v1 as tf
# Local Folder Imports
from .autoencoder import Autoencoder
from .backmapping import (
chain_in_plane,
dihedrals_to_cartesian_tf,
guess_amide_H,
guess_amide_O,
merge_cartesians... |
bfd5969141b641c0d2ba612d8cda624f10efb1dbef6eeb7bbd88b61cc85bc4f8 | Python | 16,136 | 290 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
843e7792d41221458598211a7bfd518b837c0fc8da6b97394271ce856ce59ea3 | Python | 16,164 | 477 | """
1. Normalize features of shape (N, sphere_basis, C),
with sphere_basis = (lmax + 1) ** 2.
2. The difference from `layer_norm.py` is that all type-L vectors have
the same number of channels and input features are of shape (N, sphere_basis, C).
"""
import math
import torch
import torch.nn as nn
d... |
f138f206777233f187e403b3d35b690a5a84a5eb58829af7eeab4655c49ac8dc | Python | 16,171 | 414 | # -*- coding: utf-8 -*-
from typing import Any, DefaultDict, Dict, List, Optional, Set, Tuple, Union
from collections import namedtuple, defaultdict
from itertools import chain, islice
from functools import partial
from networkx import Graph, single_source_shortest_path
from django.db import connection
from django.h... |
e7ddc59c0b58148cf0e640baf85ef044d8f67993daab65f3a16a37eb2264680b | Python | 16,173 | 344 | """Unit tests for the upfront NWB-export prerequisite checks and the export batch loop.
`orchestrate_export_nwb` reads each selected run's recorded artifact provenance and aborts the
whole batch before writing anything if any run had its artifacts removed by the ``concatenate``
method, which re-times kept samples and ... |
57948c98111c6bfa1f315d990813c4ac47a93a4a6bbb13bea87b386c066203eb | Python | 16,187 | 414 | import itertools
from collections import OrderedDict
from multiprocessing import Pool
from tqdm import tqdm
import os
import json
import torch
import numpy as np
import torch.nn as nn
import igraph as ig
from dgl import shortest_dist
def find_pattern_labels(lst,size):
unique_combinations = set()
... |
182edcf4f300be5e6c1d4675f95748302860c33548935105eed60fcce48aa5ee | Python | 16,203 | 293 |
# This file is part of the Firmware project to interface with small Async or Neuromorphic chips
# Copyright (C) 2023 Ole Richter - University of Groningen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... |
d6bb9dc38f4eba72f9043789e54d8262ad8f117daeb6867b343cd797c62ac80d | Python | 16,203 | 471 | import io
import logging
import multiprocessing
import os
import sys
import traceback
from abc import ABC, abstractmethod
from contextlib import ExitStack
from multiprocessing.connection import Connection
from typing import Any, Optional, TYPE_CHECKING
from collections.abc import Sequence, Iterator
import dnaio
from ... |
28c3b62ace3253249ff0a9ffb8c7f779a33cb00cbba2d81d721e908dd84b7359 | Python | 16,242 | 445 | # Chunking image stacks
# Author: David Young, 2017, 2020
"""Divides a region into smaller chunks and reassembles it."""
import multiprocessing as mp
from multiprocessing import sharedctypes
from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Union
import numpy as np
from magmap.settings import config... |
515b03ca6a261d592ed2c14a9ab0384d1fee090855a6f90e990a15fa88eecb7a | Python | 16,258 | 451 | import os
import sys
import h5py
import numpy as np
import pytraj as pt
from .. import config, log, utils
__all__ = [
"MisatoTraj",
"Trajectory",
]
class Trajectory(pt.Trajectory):
"""
This class represents the base-class for trajectory handling in the Nearl package.
This class inherits from py... |
5adba7f55e8dd198eb00694ea3f67d6f45f3b28de31b35d8d45012cf9c905a35 | Python | 16,261 | 409 | import tensorflow as tf
from keras.layers import TimeDistributed, Flatten,Conv3D, MaxPooling3D, Layer, Multiply
from keras.models import Model
from keras import Sequential, layers, activations
import os
import numpy as np
import shutil
from keras.callbacks import CSVLogger, EarlyStopping
from keras.losses impo... |
e8088ceb6fb47fe680edb1c6420721d682878bbb9f80206cca240f7e011a66c5 | Python | 16,268 | 422 | """
Utilities for downloading
Copyright (c) 2020 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import os
import shutil
import logging
import cgi
import tempfile
import urllib.parse
import tarfile
import zipfile
import requests
from requests.adapters import HTTPAdapter
from urllib3.ut... |
ff8f5f8fc4ed1bfcea98284b32a1f6bd2e1defb5a279cc43ffce52903069799d | Python | 16,280 | 358 | #!/usr/bin/env python
"""convert behavioral file into event lists and singletrial format
- regressor of interest per task
- duration of epoch
- rating onset
- potential covariates?
"""
# %%
import numpy as np
import pandas as pd
import os, glob, re, json
from os.path import join
from pathlib import Path
import logging... |
200f7a21ac032ec3498fb59784109bd44e8e20afc2af46c1b634940ebd178cff | Python | 16,288 | 416 | # /// script
# requires-python = ">=3.10"
# dependencies = [
# "matplotlib",
# "numpy",
# ]
# ///
"""Generate SVG figures for the fiber-photometry explanation page.
Figure 1 (technique schematic) is hand-illustrated and lives at
docs/_static/images/fiber_photometry_explainer/fig1_technique_schematic.png;
it is... |
e606f5b0be3cf67f1b810c6e058c2ad8210014b2adf6d9a9837f520e584ea0f2 | Python | 16,300 | 383 | """Unit tests for src/model/source.py.
A Babel source can vary along three axes simultaneously (see src/model/source.py):
- **babel_pipeline** — which intermediate directory the source contributes to
(e.g. ``anatomy``, ``chemical``). MESH spans several; most sources span one.
- **biolink_type** — the Biolink class ... |
b71ff49a74eed1b32a414ff3d3e5b5d0d018204b3b716eca5e0adc6adde948bc | Python | 16,302 | 439 | import os
import cv2
import glob
import PIL
import shutil
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from skimage import data
from skimage.util import montage
import skimage.transform as skTrans
from skimage.transform import rotate
from skimage.transform i... |
525e4cc49a4263f821739e888512707de1e72fd4fa830693c88b200b0689ea06 | Python | 16,320 | 430 | import numpy as np
from guppy.analysis.compute_psth import baselineCorrection, compute_psth, rowFormation
# rowFormation is called from compute_psth with positive nTsPrev
# (the caller negates a negative nSecPrev back to positive before passing here).
# All tests use positive nTsPrev as the function expects.
def te... |
4a52838d58f93539656117deb33d60825f40933ac5c2617eaae90dfec9262313 | Python | 16,329 | 422 | import os
from markdown import markdown
from docs import autogen
import pytest
from keras import backend as K
if K.backend() != 'tensorflow':
pytestmark = pytest.mark.skip
test_doc1 = {
'doc': """Base class for recurrent layers.
# Arguments
cell: A RNN cell instance. A RNN cell is a class that ... |
65bb779500a27a36ee1eda64489637be95c2abc21df6db8365aad2b4b690c337 | Python | 16,341 | 482 | import os
import yaml
import munch
import torch
import ignite
import monai
import shutil
import pandas as pd
from typing import Union, List, Callable
from ignite.contrib.handlers.tqdm_logger import ProgressBar
from monai.handlers import (
CheckpointSaver,
StatsHandler,
TensorBoardStatsHandler,
TensorBo... |
4beee0b8d4b82f8831c410dc89ac6a1d608896d763d34fa6831565f3504661d3 | Python | 16,363 | 339 | import numpy as np
from collections import Counter, defaultdict
from sklearn.base import clone as CLONE
import sklearn.metrics as metrics
from glob import glob
# Imputation
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import IterativeImputer
from pickle import dump, load
# Models
from... |
db4312bccb894049667ae87ea2f5760e5973b7f31aefdf8a4fbc969046517f5a | Python | 16,366 | 397 | from collections import OrderedDict
from itertools import zip_longest
import numpy as np
import os
from torch.utils.data import DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
from nnfabrik.utility.nn_helpers import set_random_seed
from neuralpredictors.data.datasets import StaticImageSet, FileTreeD... |
059be9f5e4f2dab40463ccb5eefc2eeeab73d2a12008deced0ddaecec83fde14 | Python | 16,388 | 379 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
import numpy as np
from PIL import Image
from diffusers.utils import make_image_grid
from dataclasses import dataclass
from tqdm.auto import tqdm
from initialization import extract_material_parameter
class Generator_light(nn.Mo... |
2f37541c98b1b9fd6562f21f788794f6c4b0062fe3c3c7fd4fcc40bd13d95444 | Python | 16,400 | 433 | """iCNN reconstruction; gradient descent, with image generator."""
from typing import Dict, List, Optional, Union
from functools import partial
from glob import glob
from itertools import product
from pathlib import Path
import os
from bdpy.dataform import Features, DecodedFeatures
from bdpy.dl.torch.models import ... |
c53cb1eabf0f31d3eba36a75f20ce39a889631337bfcb06b52a4627d99e953ec | Python | 16,401 | 519 | import fnmatch
import logging
import re
from pathlib import Path
import numpy as np
from ..utils._hdf5_io import read_hdf5, write_hdf5 # noqa: F401 (re-exported)
from ..utils.stores_list import (
COMBINED_STORES_LIST_FILENAME,
read_stores_list,
write_stores_list,
)
logger = logging.getLogger(__name__)
... |
e09e2ff9f913cefcb9f0c70fd63b7133b6b5cba3501c9e8353512cb7429ca9a7 | Python | 16,404 | 492 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
---
This code borrows heavily from the DimeNet implementation as part of
pytorch-geometric: https://github.com/rusty1s/pytorch_geometric. Licens... |
87c68d4a806401901b5df274df55c0c448368d78b348d3c265783d7c0e60f069 | Python | 16,411 | 448 | import logging
import typing as t
import ase
import numpy as np
import requests
from pydantic import BaseModel, ConfigDict, Field
from zndraw import Extension, ZnDraw
from simgen.atoms_cleanup import (
remove_isolated_atoms_using_covalent_radii,
)
from simgen.generation_utils import (
calculate_path_length,
... |
2a0529cb6bb0400ca903d18656843ba9336ac9a3ea6d7fc99ecf7a2f61a91dda | Python | 16,417 | 414 | ###########################################################################################
# The ASE Calculator for MACE
# Authors: Ilyes Batatia, David Kovacs
# This program is distributed under the MIT License (see MIT.md)
###########################################################################################
... |
567837485dd67cf45a1b20d0cf8f85168fc5a5c69caad46491c2d0e37038ce67 | Python | 16,418 | 363 | # quantify transcript
# import pysam
import pysam as ps
import os
from collections import Counter
import gzip
import numpy as np
import editdistance
from parse_gene_anno import parse_gff_tree
from itertools import groupby
def umi_dedup(l, has_UMI):
if has_UMI:
l_cnt = sorted(Counter(l).most_common(), key=... |
0f306f82b550981a407cb6de956294eeaf663d3b5e2a8cc9c753fb7c91306da4 | Python | 16,430 | 447 | import gcnIO
from torch_geometric.utils import add_self_loops
from utils import *
import os
import numpy as np
from model import DGHNN
from FT_model import FTC
import torch
from troch import nn
from torch.optim import Adam
from sklearn.metrics import roc_auc_score, average_precision_score, precision_recall_cu... |
ec5a3695f98d901f2b1d0ebd78e31bfa4d1dc1b10d0dc9f5a4f1e82a544a8da5 | Python | 16,433 | 311 | #!/usr/bin/env python
## ----------------------------------------
## scikit-ribo
## ----------------------------------------
## a module for processing bam files
## ----------------------------------------
## author: Han Fang
## contact: hanfang.cshl@gmail.com
## website: hanfang.github.io
## date: 10/28/2016
## ---... |
e54ed133fbb56715a49267b2257aeaad4fed3c468205423301c7b4d467975baf | Python | 16,460 | 514 |
import tempfile
from collections import namedtuple
from pathlib import Path
import diffrax
import equinox as eqx
import jax
import jax.nn as jnn
import jax.numpy as jnp
import jax.random as jr
import libsbml
import matplotlib.pyplot as plt
import numpy as np
import optax
import pandas as pd
from jaxkineticmodel.lo... |
beb42f6613cda4aa3a6083d8c5732db71407e00c679342bac40b650a5dc1b207 | Python | 16,471 | 420 | """Unit tests for the Step 6 metadata orchestration (page builder + Save/Build callbacks).
``build_metadata_template`` wires the Build-preview and Save buttons to closures over a
``MetadataSelector``. The selector is driven in-process: values are set in Python and the
buttons are fired synchronously (``button.clicks +... |
f9cf2eafd7f93f8e6ba0be364c96e2bd9e909bf3f658c9cb2efd9f57c694dff0 | Python | 16,472 | 382 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import warnings
from typing import List, Optional, Sequence, Union
import mmcv
import mmengine
import numpy as np
import torch
import torch.nn as nn
from mmcv.transforms import Compose
from mmengine.infer.infer import BaseInferencer, ModelType
from ... |
97d248ee1119d7e3920f653da1760a1d41c388196a68b895173d2f24ddcf4917 | Python | 16,478 | 388 | #!/usr/bin/env python3
"""Download eggnog-mapper databases.
v3.0: refactored to fetch a `manifest.json` from the server first and
verify each artifact's sha256 against it before unpacking. Use
`--no-verify` to fall back to legacy unverified behaviour against
mirrors that don't carry a manifest (warns loudly).
The rec... |
4020567d9011bccadc8fe03b0e9913b25a2e992acf4e015a04ed27e992dded46 | Python | 16,486 | 475 | import pytest
from dnaio import SequenceRecord
from cutadapt.adapters import (
BackAdapter,
PrefixAdapter,
IndexedPrefixAdapters,
LinkedAdapter,
FrontAdapter,
Adapter,
RemoveBeforeMatch,
RemoveAfterMatch,
LinkedMatch,
)
from cutadapt.modifiers import (
UnconditionalCutter,
NE... |
99cde557e2d2213910bdf23753689c3f5cd4e8f86c3a03866a2f4d964208583d | Python | 16,490 | 342 | #
# prefix_comparison.py
#
# Compare the current build's combined prefix report against a previous release's committed prefix
# report (`releases/<release>/reports/duckdb/prefix_report.json`) and emit human-readable comparison
# tables. This replaces the manual step of loading two prefix reports into babel-validation's... |
bc1f2d0531639df6494dc7a89849c8044507b4904a401d4631bbf5423b3bcd3e | Python | 16,523 | 540 | import argparse
import os
import time
import h5py
import numpy as np
import open3d as o3d
from matplotlib import colormaps
try:
from siesta.scripts import view_obj
except ImportError:
view_obj = None
def _require_siesta():
if view_obj is None:
raise ImportError(
"SiESTA-Surf is requi... |
24ac0aa7667619936e9b7cc71384d1f33855d1b96e8b240475e1e424df1de19f | Python | 16,543 | 356 | import gzip
import hashlib
import json
import os
import time
import xml.etree.ElementTree as ET
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor, as_completed
from mmap import ACCESS_READ, mmap
from pathlib import Path
from src.babel_utils import WgetRecursionOptions, glom, pull_vi... |
b4588970a7901f2639935b1cb9fefb9ceeddf907b96fa81ac555f9a9eaee2ab2 | Python | 16,546 | 459 | """"Module to create exemplar morphologies from a morphological population."""
# Copyright (c) 2022 EPFL-BBP, All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FI... |
638f9d8bb15ff172d5e89e06bd24c2ec5ebe1bf43eb7ba436dbfc43d2a711b3e | Python | 16,568 | 383 | # We now have data that has been PCA'ed
# I may be missing import statements, so add if you find something I missed
import os
import pandas as pd
import numpy as np
from tqdm import tqdm
from scipy.stats import pearsonr
CURR_PATH = '/Users/karinsaltoun/dblabs/asymm_pat_age_progression'
os.chdir(CURR_PATH)
DATA_FOLDE... |
3aa772752b59fdcde668a50a5a563d8424aad358e6f15b9fbfff6055fe7c6d21 | Python | 16,569 | 441 | import collections
import copy
import re
import torch
# from ..utils.num_nodes import maybe_num_nodes
__num_nodes_warn_msg__ = (
"The number of nodes in your data object can only be inferred by its {} "
"indices, and hence may result in unexpected batch-wise behavior, e.g., "
"in case there exists isolat... |
1a662652f2fc8d6408a3411024190a271cd3f8c16bd036915f27ed5e8fcb58f7 | Python | 16,600 | 377 | # Author: Huaxu Yu
# A module to define and estimate the parameters
# import modules
import pandas as pd
import os
import json
from importlib.metadata import version
import numpy as np
PROJECT_CONTEXT_FIELDS = frozenset(
{
"sample_metadata",
"project_dir",
"sample_dir",
"single_f... |
5de6799c1b972e79cdf4f36664d77c91b2795815578b58e4eff91a330aa58cdd | Python | 16,601 | 430 | #!/usr/bin/env python3
from __future__ import annotations
import argparse
import csv
import math
from pathlib import Path
import shutil
import subprocess
import sys
import tempfile
import numpy as np
import cicada_smoothing_only_reclassification as csr
FWHM_PER_SIGMA = 2.354820045
CANDIDATE_FWHM_MM = 11.0
CANDIDATE_... |
70c754ca4525a41bc2069351a1fcd3a55a4d6e2d76f084cbf118cd2bb09e43ce | Python | 16,626 | 431 | # Standard library imports
import os
import random
from collections import defaultdict
from io import StringIO
from typing import Dict, List, Tuple
from pathlib import Path
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader
from torch import nn
from torch.nn import functional as F
# Bio... |
e09ecde3d95b93747a23c902d305a368c071f4854ff898351a8fab2f378975ea | Python | 16,637 | 475 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
import tempfile
import pytest
from mmseg.datasets import (ADE20KDataset, BaseSegDataset, BDD100KDataset,
CityscapesDataset, COCOStuffDataset,
DecathlonDataset, DSDLSegDataset, ISPRSD... |
79b73a5daab1a815f842b379d61334244b36a56966795bcb2ce580c7e61121a4 | Python | 16,648 | 435 | ##################################################################
# Test TrimNN-NSIC on independent simulated data for subgraph matching
# Reproducibility for Figure.2E
##################################################################
import torch
import os
import numpy as np
import dgl
import logging
impo... |
e59804a9b703f8aebdf3d23a7612a0bfbbca3a79d77d086da3ed77bcd5f0bb63 | Python | 16,658 | 496 |
import logging
try:
from src import config as cfg
except ImportError as E:
logging.warning('No custom config found, using default config instead')
from src import default_config as cfg
# should probably import this whole thing and use the namespace...
from read_roi import read_roi_file, read_roi_zip
imp... |
d80fe59fb13fa8300156acda8b50894d8484a0c08d18cd1cf199e5e53ef41eee | Python | 16,664 | 382 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
from fig_utils import *
import os
import seaborn as sns
from matplotlib import gridspec
def panela_model(fig, grid, dat, il, transl):
ax = plt.subplot(grid[0, 0])
ax.axis('off')
il = plot_label(ltr, il, ax, trans... |
6236f5ec9746fc7d34b3121939f780f8be5fcde51b60d1706deca6f3de109d9a | Python | 16,669 | 351 |
import numpy as np
from .base_dataset import BaseDataset, create_neural_dataset
from .base_metadata import create_neural_metadata
import auditory_cortex.io_utils.io as io
import logging
logger = logging.getLogger(__name__)
class NormalizerCalculator:
"""Computes the inter-trial correlations for stimuli having m... |
83cb08cafe80599ee86be103eb7ca207b1de4dae77cfe00220e24321c70e6472 | Python | 16,731 | 435 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 8 11:04:24 2023
@author: schwab
"""
from pathlib import Path
from typing import Optional
import mrcfile
import numpy as np
import torch
from torch.utils.data import DataLoader
import torch.nn.functional as F
from scipy.spatial import KDTree
from d... |
cc8de0e49b2db5f01414a12c762458820397eac5d584bc38919d9e42fd3b4c6e | Python | 16,731 | 435 | # import the necessary packages
from torch.utils.data import Dataset
import torch
from core.backend import open_minian
import numpy as np
from math import ceil
from ml_training import config
from torch.nn import ConstantPad2d
class TrainDataset(Dataset):
def __init__(self, paths: list[str], train_size=None, test_s... |
ab89410aa005bd16c52df4ee066e5877abd95f3dc6a5fa6d9b479a99e2dde0e9 | Python | 16,763 | 555 | """Utility objects and functions"""
import hashlib
import os
import tempfile
import json
import re
import sys
import shutil
import copy
import stat
import os.path as op
from pathlib import Path
from collections import namedtuple
from glob import glob
from subprocess import check_output
from datetime import datetime
fr... |
9ff9a0726bd8c4f1df5a4c98fd42619939a795197c8290e5204ef4b320690524 | Python | 16,767 | 529 | # pylint: disable=invalid-name
"""Tests for the ordinal re-coder."""
import os
import tempfile
from concurrent.futures import ThreadPoolExecutor
from typing import Any, Literal, Tuple, Type, TypeVar
import numpy as np
import pytest
from ..compat import import_cupy
from ..core import DMatrix, ExtMemQuantileDMatrix, Q... |
6a564d306e49c645995b21a1a51c365f3ca3a26f3c90bf9834a523e80e5117d1 | Python | 16,769 | 523 | """Built-in weight initializers.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import six
from . import backend as K
from .utils.generic_utils import serialize_keras_object
from .utils.generic_utils import deserialize_keras_object
... |
e2e677148d6b9cf9515fc26a53c9fc5051785c16e838f9fc45c96990384649a9 | Python | 16,789 | 438 | """PSTH significance testing over an output directory's PSTH results.
Runs inside step 4 for each session run folder and inside Group Analysis for each group
folder. Both hold PSTH files with the same layout, so the same code serves both; only the
meaning of a resampled column differs, a trial in a run folder and a se... |
da2d7f1758d7086cfdd254627eb26d28cfd7bb9080b73780b930cd818f46768e | Python | 16,798 | 455 | import numpy as np
import pandas as pd
import random
import re
import pickle
from rdkit import Chem
import sys
import time
import torch
from torch.utils.data import Dataset
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
from .utils import Variable
class Vocabulary(object):
"""A class for hand... |
986d06da0678206823b2e19f19054167aa456141ed5707901c271e974fa88bb5 | Python | 16,815 | 467 | # Copyright (c) OpenMMLab. All rights reserved.
# Originally from https://github.com/visual-attention-network/segnext
# Licensed under the Apache License, Version 2.0 (the "License")
import math
import warnings
import torch
import torch.nn as nn
from mmcv.cnn import build_activation_layer, build_norm_layer
from mmcv.c... |
f68a13f05cb7d529e6f9ca19a2cc51022bf1292631e39e29e5af5a72e1c6719c | Python | 16,820 | 321 | """
Debug plotting used by the `process_seg.py` script.
Copyright (c) 2025 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import os
import logging
import math
import numpy as np
import skimage
from spinalcordtoolbox.registration.algorithms import compute_pca
from spinalcordtoolbox.ut... |
c7111354fc8795c6a41147b3d01298546a070bc12c87d02f533d7678ab569570 | Python | 16,822 | 542 | from __future__ import annotations
import collections
from typing import TYPE_CHECKING
import numpy as np
import torch
from pymatgen.core import Structure
from torch import Tensor, nn
from chgnet.model.functions import GatedMLP, find_activation
if TYPE_CHECKING:
from collections.abc import Sequence
from pat... |
c0bfe0e8f854992b21ac7f918e1599ed8a9615fc51ff03591c58765ce0b31dfc | Python | 16,823 | 440 | from concurrent.futures import ThreadPoolExecutor
from typing import Optional, Union
import hydra
from torch.utils.data import Dataset
import torch
import os
import torch.utils.data
from torch.utils.data import DataLoader
import pytorch_lightning as pl
from datasets.utils.pad_tensors import PadTensors
from pathlib i... |
dc125b436fe47616a9e2d0e5ed9f18cf6e43e8be737675070a03c071276ddca7 | Python | 16,854 | 409 | import os
import numpy as np
import hickle as hkl
import copy
from skopt.space import Real
from skopt import gp_minimize
from sklearn.model_selection import KFold
import concurrent.futures
import tensorflow as tf
import tensorflow_probability as tfp
from grid_cell.manifold_fitter import GP_Fitter
from grid_cell.data_p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.