sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
573c2562b24fbe647398f58e17cba39a7d74cac2a69aa17a267a23f253773e74 | Python | 8,078 | 195 | import os
import numpy as np
import tiffile
import SimpleITK as sitk
import h5py
import tqdm
import matplotlib.pyplot as plt
outputs = []
def channel_tf(f_vol_fix: str, f_vol_mov: str, f_vol_out: str,
fixed_img: np.ndarray, moving_img: np.ndarray):
for i in range(2, 3):
m_transform_type =... |
e541387c13b956698041af7a6d45ab9259797d8c5030b86ded5476f5f8ae5463 | Python | 8,079 | 215 | #! /usr/bin/env python
# Time-stamp: <2021-03-23 22:02:10 christophe@pallier.org>
# License: Creative Commons BY-SA-NC
"""Implementation of Posner's endogeneous attention cueing task (see https://en.wikipedia.org/wiki/Posner_cueing_task). One difference with the ANT-R task (Fan et a. 2009) is that the boxe appear abov... |
6d73fc75a0bad1ec850dd88b4e7b536dc4e70e8a355e12653f638e31768417ba | Python | 8,080 | 213 |
import librosa
import torch
import torch.nn as nn
import torchaudio
import torchvision
import matplotlib.pyplot as plt
import numpy as np
from models import *
# file_name = 'sivas_ses_data/1. köpek 5. hafta .wav'
file_name = 'combine9.wav'
audio_data, sr = librosa.load(file_name)
device = tor... |
fa9e2843b17671daad34bdba8d81289aea01ebe56ed1b108bea2d59e2c95fc14 | Python | 8,080 | 280 | #!/usr/bin/env python
# coding: utf-8
# ## Analysis of stratified drug response regression
#
# In these experiments train and test sets are stratified by cancer type. We're trying to predict continuous $\log($IC50$)$ values here, as opposed to the classification experiments where we were trying to predict resistant o... |
5c7fc587cae1cc32fd5efa671d5417ad0e18d7c4cc19847f25fdcf5ef5bc4992 | Python | 8,082 | 216 | #!/usr/bin/env python
"""Utility classes to parse SAMPL submissions."""
# =============================================================================
# GLOBAL IMPORTS
# =============================================================================
import os
import io
import glob
import numpy as np
import pandas a... |
f857b7d7c90c548fc8c1c88ae4f3a94e170ed3ef43609ebb4d900de839669663 | Python | 8,082 | 190 | from typing import Dict
from .style import Style
DEFAULT_STYLES: Dict[str, Style] = {
"none": Style.null(),
"reset": Style(
color="default",
bgcolor="default",
dim=False,
bold=False,
italic=False,
underline=False,
blink=False,
blink2=False,
... |
0ec7f5a818bb3facbd064ecc8bd1160aa4cbe2eed5b676d600601ab52db8258c | Python | 8,083 | 168 | # coding=utf-8
# Copyright 2021 The Marian Team Authors and The HuggingFace Inc. 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/licen... |
19827b5ecb35596a7b6193d803a44ab3de0c624a4818fa9795589b5fed748bbd | Python | 8,087 | 218 | from __future__ import annotations
import os
from functools import cached_property
from pprint import pformat
from typing import Optional
import pandas as pd
from cuppa.classifier.cuppa_classifier import CuppaClassifier
from cuppa.classifier.cuppa_prediction import CuppaPrediction, CuppaPredSummary
from cuppa.consta... |
30716c1ff6c08d49d1c81afb496b5dbe65e7fbca9728f8fa6ce964eb7bf6bd7b | Python | 8,087 | 178 | from typing import List, Union
import numpy as np
from ..file_utils import add_end_docstrings
from ..tokenization_utils import TruncationStrategy
from ..utils import logging
from .base import PIPELINE_INIT_ARGS, ArgumentHandler, Pipeline
logger = logging.get_logger(__name__)
class ZeroShotClassificationArgumentHa... |
8797bc8e500645a070ed7354c656cbb91e065b7d90e39bcbb3096a6077911217 | Python | 8,088 | 208 | import numpy as np
from abc import ABC, abstractmethod
from typing import List, Dict, Tuple
from matplotlib import pyplot as plt
from merlin.core import analysistask
class AbstractPlot(ABC):
"""
A base class for generating a plot of the analysis results. Each plot
should inherit from this class.
"""... |
1c717d36d1db78702d622cc50a2bdb3c3aced11787c8995a60a1bf44952a9d0b | Python | 8,089 | 237 | # -*- coding: utf-8 -*-
#
# Syncopy down-/resampling frontend
#
# Builtin/3rd party package imports
import numpy as np
# Syncopy imports
from syncopy import AnalogData
from syncopy.shared.parsers import data_parser, scalar_parser
from syncopy.shared.tools import get_defaults, get_frontend_cfg
from syncopy.shared.err... |
b99c3b1c1c393298e61bc5012937db3eab3c7a5cc794271dde1a0e7abcf3f302 | Python | 8,091 | 153 | #!/usr/bin/env python
import os
import numpy as np
import pandas as pd
from scipy import io as sio
## where are matrices located?
projpath = os.path.join('/project', '3011157.03', 'Simon', 'proj_2022_CABB_movie', 'DistanceMatrices')
## where should new matrices be stored?
dir_out = os.path.join('/project', '3011157.03... |
283fecc82be35cc3789b56326337845173180f0eed04328a7ff0c81211fcc387 | Python | 8,092 | 191 | import numbers
from typing import Optional, List, Tuple
import torch as _torch
import torchvision.transforms.functional as _F # noqa
__all__ = [
'Identity',
'NormalizeImage',
'ResizePadded',
'RandomRotation',
'AdjustContrast',
'AdjustBrightness',
'ColorJitter'
]
class Identity:
def ... |
1cd054d173754f0a4f64751dd875ad152c3e7ddaaeba5fa275969a445407c42d | Python | 8,093 | 225 | import control.utils_.image_processing as image_processing
import numpy as np
from os.path import realpath, dirname, join
try:
import torch
from control.DaSiamRPN.code.net import SiamRPNvot
print(1)
from control.DaSiamRPN.code import vot
print(2)
from control.DaSiamRPN.code.utils import get_axis_aligned_bbox, c... |
2f59febf6552f0412831cb928dd8c58eaf9df7e037cc543cf5f379715257b91e | Python | 8,095 | 223 | import numpy as np
def generate_hierarchical_data(alpha, beta, n_sample, proportion=None):
# Parameters
n_class = len(alpha.keys())
n_pathway = len(beta.keys())
n_gene = len(beta[list(beta.keys())[0]])
n_read = 1500000
# Generate data
X = np.zeros((n_sample, n_gene))
y = np.zeros(... |
cffa98b635c0691db882c0844fb6e9bc84c13acb355416aeb13b20a8b0895f18 | Python | 8,096 | 248 | from collections.abc import Callable, Iterator
from functools import wraps
from typing import TypeVar
from .._types import NodeConstraintFn
from .graph import Graph
from .state import State
T = TypeVar("T")
TP = TypeVar("TP")
class MatchError(Exception):
def __init__(self):
super().__init__("No match fo... |
f85e30f64179ce701a8f52cadfdb60f2fe514dd8814a0292466d4e57c3554551 | Python | 8,096 | 125 | """WORM_REAL.py 2026-10-05. Pre-registered: 04-NOTES/PREREG-2026-10-05-WORM-REAL.md (sha in .sha256 next to it).
Do the fly rules hold in C. elegans, where every neuron was stimulated and every other recorded (Randi et al. 2023) and
synapse signs come from receptor expression, not a classifier? W1 inhibition on domina... |
00ce504f4a3be90974b9aaa3c4203f8e3e77bd97be2702b774f884f7dbb65ad6 | Python | 8,098 | 213 | """Functions that can be used to preprocess SMILES sequnces in the form used in the publication."""
import numpy as np
import pandas as pd
import tensorflow as tf
from rdkit.Chem.SaltRemover import SaltRemover
from rdkit import Chem
from rdkit.Chem import Descriptors
REMOVER = SaltRemover()
ORGANIC_ATOM_SET = set([5, 6... |
5173436281c7abd6732177963988e044a0e1ccb2effabae927d02957877b8c3c | Python | 8,098 | 238 | ####################################################################################################
# Copyright (c) 2021-, NVIDIA CORPORATION. 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... |
0a4c2003f13d7ad5dd95d91b1a248ab7041017427ef0f2a2f75f0dc62f2b624a | Python | 8,099 | 182 | # Class to load and analyze data
from os.path import join
import h5py
import pickle
import numpy as np
from scipy.ndimage import gaussian_filter
class OptimizationData:
def __init__(self, dir_data, fname_data, fname_settings, load=True):
# Load data and parameters
self.dir_data = dir_da... |
131dabd9a7cb8eb7d32080f4388d27a44fea2d0aa7e244c138834c33e969c871 | Python | 8,100 | 228 | """Manager a type variable and its associated context."""
import pandas as pd
from hed.models.hed_group import HedGroup
from hed.models.hed_tag import HedTag
from hed.models.model_constants import DefTagNames
from hed.tools.analysis.hed_type_defs import HedTypeDefs
from hed.tools.analysis.hed_type_factors import HedT... |
0811e34aff8d61680da23761b120b097793422a1c6788a01de71f0a4d2a4cec4 | Python | 8,101 | 241 | """Affine transformations on 3D volumes using CUDA."""
from typing import Optional, Tuple
import numpy as np
from . import lib
def deskewGPU(
im: np.ndarray,
dxdata: float = 0.1,
dzdata: float = 0.5,
angle: float = 31.5,
width: int = 0,
shift: int = 0,
pad_val: Optional[int] = None,
) -... |
cbd60815f5b94cea60e9d112d943b2fff42f27bcbedbaa4189f5f3b888e1afab | Python | 8,101 | 250 | import os
import operator
import sys
import contextlib
import itertools
import unittest
from distutils.errors import DistutilsError, DistutilsOptionError
from distutils import log
from unittest import TestLoader
from pkg_resources import (
resource_listdir,
resource_exists,
normalize_path,
working_set,... |
e13391ef64c3bcb9e319c75a997924174c7a8509bb676a80abc7e35abe2d6e9f | Python | 8,101 | 270 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scanpy as sc
from sklearn.preprocessing import normalize
from sklearn.metrics import pairwise_distances
import torch
import scipy.sparse as sp
from numba import jit
def rank_genes_conf(adata, power=1, power_low=1):
"""
Rank genes b... |
042b492f20290f04cc98efebf0efb38ba4123ca54dbae8210b0441e30096c2a6 | Python | 8,104 | 217 | import torch
from torch import nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import MathOperations
from elasticai.creator.nn.integer.MPQ.matrixmulti.design import (
MatrixMulti as MatrixMultiDesign,
)
from elasticai.creator.n... |
d20730d20eaa459c6c9eaae2f78362f1c1fa2be482166cda800ca93a666195fc | Python | 8,105 | 141 | """BANC_TEST.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30g-SECOND-FLY.md
Does the excitatory-share rule, learned on FlyWire, predict the antennal lobe of a second fly (BANC v888)?
Antennal-lobe cut-out of BANC (BANC.py; FlyWire's AL_SUBNET classes), Shiu et al.'s parameters (0.275 mV per synapse,
unscale... |
5462dcfbacc0ca14cce13a238867686a6e0fada6b13f4d9d0ee6a1c839d84f18 | Python | 8,107 | 255 | """Testing for the python bindings of the C++ flagser library."""
import os
import numpy as np
import pytest
from multiprocessing import Pool
from numpy.testing import assert_almost_equal
from pyflagser import load_unweighted_flag, load_weighted_flag, \
flagser_unweighted, flagser_weighted
betti = {
'a.flag... |
1634d87bf924b424fa050c1467c1e3fd6f4f1a6fe486c93520de0bbf100da8a5 | Python | 8,108 | 208 | import numpy as np
from scipy.io import FortranFile
from ..matao.matao import PairsInfo, MatAO
from ..matao.findpairs import pairs_within_cutoff
# from ..v2h.vkb import get_nloc_pairs
from .aodata import AOData
from .struio import from_siesta
from .hrloader import read_vnloc
from .deephio import save_structure_deeph, ... |
173c5c8b8b7fa483f478ccdd9b90c956f65922e3514ba706b55c30a88be58f22 | Python | 8,108 | 255 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
7eaf4528e460a09cc4234864783548a9847ccbc4b0b5634586d0c048e080c5fc | Python | 8,108 | 203 | '''
Created by Yi Jie(Josh) Tseng on 11/14/2023
This script was created to convert the PD output to deuterater compatible. Because I was in a hurry,
so this script is not fully optimized.
To use this script, simply pass the PD peptide output to this script:
python PD_2_Duet.py <file_name>
It will output a ... |
4a58889b7e4ebe5b3a039fbaf5ff0967cc3d34a7de4cd75a1e8e53c20a01a5e6 | Python | 8,109 | 171 | """
End-to-end tests against a real Wikibase instance: they validate that the
library speaks the actual API correctly (entity creation, edition, search,
deletion), which the offline unit tests can only simulate.
The tests create their own properties and items, so they can run against any
empty or non-empty instance yo... |
08ca6acb9654e9fc20477758b023d9196b68f3f6fc1c933ecdb7516b068b2c33 | Python | 8,112 | 178 | #!/usr/bin/env python
from __future__ import print_function
import json
import os
from pybullet_tools.parse_json import parse_pose, parse_robot, parse_region, parse_body
from pybullet_tools.utils import connect, \
disconnect, wait_for_interrupt, point_from_pose, set_camera_pose, \
reset_simulation, wait_if_g... |
4bc90b5c6b9d9975ccc2097caccf27c836b0ac7c42f75130f081bb8ce5f2c3a9 | Python | 8,113 | 255 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
622326149235ac1fea2878497ff96b153d5178b4f9ba83cc9e2e1b449cc57c79 | Python | 8,113 | 235 | from __future__ import annotations
import os
from pathlib import Path
import pytest
from ase.build import bulk
from quacc import change_settings, flow, get_settings, job, subflow
from quacc.wflow_tools.context import get_context_path, get_directory_context
def test_nested_bulk_slabs_results(tmp_path):
"""
... |
0e242c974b03ba0aa4c27f5b1d97527c86b859b68bad9778022e6b743538c9e5 | Python | 8,119 | 246 | # shared functions and classes, including the model and `run`
# which implements the main pre-training and training loop
import os
import torch
import torch.nn.functional as F
from torch import nn, optim
import numpy as np
import copy
import tqdm
from time import strftime, localtime
from .model import *
from .util ... |
7cfbd238fbfbf1c7593cecdda6cb4a62efd66338a1ae0fe7863e19a4d8514d88 | Python | 8,120 | 225 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
4a75a616c983d15cd0524306e2b56b0a88ae0f142c691e8766fe3dab4babcbe0 | Python | 8,121 | 213 |
import napari
import numpy as np
import cryovesnet
from napari.settings import get_settings
from magicgui import magicgui
get_settings().application.ipy_interactive = False
def viz_labels(image,list_of_labels,list_of_names):
with napari.gui_qt():
view = napari.Viewer(ndisplay=2)
# view.add_image... |
7ca3d0597a5925824f2416f58b0c800e60d39689917e762ccbc3a10e66c31895 | Python | 8,121 | 196 | """
Pure-Python helpers for stitching GUI subprocess/command building.
Owns:
- ``get_python_exe()`` - resolves python.exe from the running interpreter
- ``validate_mosaic_folder()`` - checks a folder contains exactly one Mosaic*.txt
- ``build_batch_script()`` - produces the Windows .bat file co... |
40505f48af6219364685c38ec1ab373c53a01e0128a6405657050e7d52b226fc | Python | 8,123 | 203 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ... |
aa87a7354967ce07b1b1ad23ca0f4b2f53b4617efc72e403049bfe37bce18ab9 | Python | 8,123 | 48 | import os
import random
import math
import sys
# Check if the required arguments are passed
if len(sys.argv) != 3:
print("Usage: python script.py [sweep|neutral] <num_replicates>")
sys.exit(1)
replicate_type = sys.argv[1]
num_replicates = int(sys.argv[2]) # Ensure num_replicates is an integer
... |
643b3af266f019f21232147dfedda5501184736b863c0660bb276b590f408017 | Python | 8,126 | 346 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
d9048d699583e72a8c04a942c554ca9ee613d5f0039bec4ad933af15398061f0 | Python | 8,126 | 213 | # -*- coding: utf-8 -*-
import os
from typing import Iterable, Union
import torch
from supar.config import Config
from supar.models.dep.biaffine.model import BiaffineDependencyModel
from supar.models.dep.biaffine.transform import CoNLL
from supar.parser import Parser
from supar.utils import Dataset, Embedding
from su... |
a50af0b9279e5ee210f4862b19966c98fd2b995d3a34ccfa6e0e6134c07fc828 | Python | 8,127 | 207 | import torch
import torch.nn as nn
class Conv2dWithConstraint(nn.Conv2d):
def __init__(self, *args, weight_norm=True, max_norm=1, **kwargs):
self.max_norm = max_norm
self.weight_norm = weight_norm
super(Conv2dWithConstraint, self).__init__(*args, **kwargs)
def forward(self, x):
... |
f96e56c70f9e61e3b0e2fe1b6534e049a934f7a3c870654fcb55c1ad8eee5327 | Python | 8,129 | 173 | import os
import itertools
from typing import Any, Callable, Dict, Tuple, Union
from ..module.base_dataset import BaseDataset
from moabb.datasets.base import BaseDataset as _MOABBDataset
from moabb.paradigms.base import BaseParadigm as _MOABBParadigm
class MOABBDataset(BaseDataset):
'''
Mother of all BCI Be... |
00b9bc3dffa81100b711e4669c5313e4657324094a8047c49e800cab3422b1ee | Python | 8,132 | 177 | import ants
import numpy as np
import cv2
import os, sys, glob, json, shutil
from tqdm import tqdm
def main(initial_vol, label_vol, reference_vol, num_iterations, padding):
assert padding is None or padding % 2 == 0, 'ValueError: padding should be divisible by 2'
# set up
outpath = os.path.dirname(os.p... |
4427eab09f22cc26bee2e536eeda8f68c28414e990c924d798f0df88bbd7f237 | Python | 8,132 | 230 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
7ce6dc7d1ff89fb6c12856ce3e4d3c003978b90fb1fec1fa292a65cf12a59545 | Python | 8,132 | 264 | """
Contains class Table for read (write in the future?) or results in the
table form.
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import range
from builtins import object
__version__ = "$Revisi... |
445eed26441d42c4f24a7f748256abf41c6e1999ab8ec593adbc16bff8e7c38b | Python | 8,135 | 262 | import torch
from torch import nn
from .decoder import DotDecoder, MLP_Decoder
class MLP(nn.Module):
def __init__(self,
feats_dim=64,
drop_out=0.1):
"""Light Graph Convolution
Paramters
---------
drop_out : float
dropout rate (neighbor... |
02440ca65d7ac84a02db1db956b6773ca88ee15ee74625749cc22b8f64e54460 | Python | 8,141 | 159 | import os
import unittest
from pandas import DataFrame
from hed.models import DefinitionDict
from hed.models.hed_string import HedString
from hed.models.hed_tag import HedTag
from hed.models.sidecar import Sidecar
from hed.models.tabular_input import TabularInput
from hed.schema.hed_schema_io import load_schema_versi... |
0a6b8ac6df97b5c6930979aefec0a5c59e56ef75aeb673d18aef9769c7c62396 | Python | 8,141 | 205 | # -*- coding: utf-8 -*-
import os
from typing import Dict, Iterable, Set, Union
import torch
from supar.config import Config
from supar.models.const.crf.model import CRFConstituencyModel
from supar.models.const.crf.transform import Tree
from supar.parser import Parser
from supar.structs import ConstituencyCRF
from su... |
1cc2ed10066e9409d566d7f15ad7b574edf158bf09c2a20a0ce12cae5d6d3d7e | Python | 8,141 | 195 | import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings(action='ignore')
import pandas as pd
from sklearn import metrics
from sklearn.preprocessing import StandardScaler
from sklearn.utils import class_weight
import matplotlib.pyplot as plt
from itertools import product
from tqdm import tqdm
imp... |
9a6c26a97f8a82ebff8e0a0ededd80a65e6dddc740fac8df3569948edbb0e3f7 | Python | 8,142 | 208 | import pandas as pd
import numpy as np
from tqdm import tqdm
import os
from pathlib import Path
import argparse
from scipy.spatial import distance
from math import factorial, atan2, degrees, acos, sqrt, pi
from deeplabcut.utils import auxiliaryfunctions
# utility functions
def calc_distance_between_points_two_vectors... |
b4223e530c30eedbb3400eab95a83efc6c0c90407896f3b66c584384d7669da3 | Python | 8,146 | 230 | """
Script for resizing (upsizing) already reconstructed particles, the resizing can be selective so its allow to mix
particles with different pixel sizes.
Input: - STAR file with next columns:
'_rlnMicrographName': tomogram that will be used for reconstruction
'_rlnImageN... |
3bf5f9d8fec09471b159132cc162975d077b26f7181db91d16c31b9252a0ba19 | Python | 8,147 | 249 | """
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2020 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
------------------------------------... |
d3acb4127c9d26cb988af541d946bd901e8c7503bc6e86a97ed8e85b40e96b95 | Python | 8,148 | 224 | """Testing module morph."""
import numpy as np
from treem import SWC, DGram, Morph, Node, get_segdata
def test_node_str():
"""Tests for Node string representation."""
node = Node(value=1)
assert str(node) == '1'
def test_node_stem_leaf():
"""Tests for Node stem and leaf attributes."""
morph = ... |
2937e1b03af6910a6b5623b0aaeb05b6765e4a458cabb0055ee0a1174ec9ebe4 | Python | 8,149 | 221 | import sys
sys.path.append(sys.path[0] + "/..")
import os
from file_io import load_image, save_markers
import swc_handler
from neuron_quality.find_break_crossing import CrossingFinder
from morph_topo.morphology import Morphology
import numpy as np
from scipy.interpolate import CubicSpline
import math
from neuron_qualit... |
cb6af7b9ee6ba24eb008a0df3c29bbf8e2f8949d7015d9b8453cb5ddf44c9824 | Python | 8,149 | 260 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
11f3989a4cc0819d7eb7d4d6402e389d0692aae386b50d4287e9e481d8a83540 | Python | 8,150 | 176 | import os
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.collections as mcoll
import matplotlib.path as mpath
import matplotlib.colors as mcolors
from matplotlib.patches import Rectangle
from utils import pickle_load, make_dir, save_plot
direc = os.pat... |
6d64d40cd9b8c40796191c253c37ad6369bab3e1b110a4b3a245fd8f97405df7 | Python | 8,153 | 258 | ##
# \file target_stack_estimator.py
# \brief Class to estimate target stack automatically
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date January 2018
#
import os
import re
import numpy as np
import SimpleITK as sitk
import pysitk.python_helper as ph
import pysitk.simple_itk_helper as ... |
bb1a45dae24377f73ca70140797679497f4ca8debd3ee85fb495bffad1f64356 | Python | 8,155 | 192 | import os
import json
import argparse
import numpy as np
import carla
from utils import interpolate_trajectory, gen_skeleton_dict, gen_scenarios
PRECISION = 2
SAMPLING_DISTANCE = 30
def generate_scenario_10(carla_map, world=None):
carla_topology = carla_map.get_topology()
topology = [x[0] for x in carla_to... |
fedabd338a79da8c5c3aec22deec212903c5cd216376eb2f9646306e659bbdd8 | Python | 8,155 | 213 | import time
import os
import subprocess
import sys
import re
import argparse
import collections
import gzip
import math
import shutil
import matplotlib.pyplot as plt
import wandb
import numpy as np
import time
import pandas as pd
from datetime import datetime
import random
#import logging
#from silence_tensorflow impo... |
252d8d9439672ab82f6b908b148d55c11a73e8b9745f1162468fae32d2484b79 | Python | 8,158 | 195 | import sys
cg_itp_type = ['[ atoms ]', '[ bonds ]', '; Backbone bonds', '; Sidechain bonds', '; Short elastic bonds for extended regions', '; Long elastic bonds for extended regions', '[ constraints ]', '[ angles ]', '; Backbone angles', '; Backbone-sidechain angles', '; Sidechain angles', '[ dihedrals ]', '; Backbo... |
8f18064f45fad56055bc52ad07cb2601662bb887ee04e3aa951a44a1d58dccfd | Python | 8,159 | 251 | """Fit a complex refractive index profile to a sum of Lorentzian (and,
optionally, Drude) susceptibility terms and build a `Medium` from the result.
The complex permittivity is modeled as
ε(f) = ε_inf + Σ_n A_n / (ω_n² − f² − i f γ_n)
and the parameters (A_n, ω_n, γ_n) are found by nonlinear least-squares fitti... |
1c33d7134fcc3c14b0b30ffdba97b3f2df2676ba941ab822386feac90cbe5b7d | Python | 8,161 | 245 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import operator
import os
import platform
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from ._parser im... |
704a017e473794bc2a6dae172ac529cb8bd240a0e1d9043927627de3e002168a | Python | 8,165 | 224 | import math
from functools import lru_cache
from time import monotonic
from typing import Iterable, List, Optional
from .color import Color, blend_rgb
from .color_triplet import ColorTriplet
from .console import Console, ConsoleOptions, RenderResult
from .jupyter import JupyterMixin
from .measure import Measurement
fr... |
767ef38cf9be76a4a70e74f1137f173f3750c91849c3ebb5242649a1540a2281 | Python | 8,165 | 236 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Additional interfaces required for workflow. To be upstreamed into Nipype.
Shamelessly taken from https://github.com/poldracklab/ds003-post-fMRIPrep-analysi... |
61131bb7229bb3be8b3d4434ad9cb5ec91a5d98eadba824a3c7766994c7ea4df | Python | 8,166 | 252 | import torch
from torch.utils.data import Dataset
import torch.nn.functional as F
import numpy as np
import pandas as pd
from tqdm import tqdm
import csv
import os
import pickle
from random import sample
class MicroDataset(Dataset):
def __init__(self, data_path, metadata_path, species_dict, output):
"""
... |
a9dd5de8b71fc5a989242d0abd46e5ec1a78a8c3f07a6a3e4ff3abbf3f3d6a96 | Python | 8,166 | 252 | import torch
from torch.utils.data import Dataset
import torch.nn.functional as F
import numpy as np
import pandas as pd
from tqdm import tqdm
import csv
import os
import pickle
from random import sample
class MicroDataset(Dataset):
def __init__(self, data_path, metadata_path, species_dict, output):
"""
... |
d0e7922b0fe5ed9e6200090dcccfaa7871581a6c0269168c3be3ad0e6660c691 | Python | 8,166 | 208 | """
INITIALIZATION PARAMETERS
These variables contain the hyperparameters for AnDePeD operation.
"""
import numpy as np
import pandas as pd
import multiprocessing
class ReRe:
# class variables for multiprocessing
class_lock = multiprocessing.Lock()
progress_for_executions = {}
executions_max = {}
... |
a67a81b8a29943c3b128fd0c6945220c797702dca83091c71b8acc43b61c6176 | Python | 8,167 | 242 | import datetime
import functools
import hashlib
import json
import logging
import optparse
import os.path
import sys
from dataclasses import dataclass
from typing import Any, Callable, Dict, Optional
from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.rich.console import Group
from pip._v... |
2105fa6e7c066bc84614fbf477801a0243b6feb7294a7352fdd90711c808a0a7 | Python | 8,169 | 223 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use... |
3c3d4020417fd40ca19c3164176da5bf045d30ccb2446daa7bf405524273fdae | Python | 8,169 | 221 | from __future__ import print_function
import getpass
import json
import logging
import os
import pathlib
import shutil
import sys
__version__ = '0.5.0'
import threading
from pkg_resources import resource_filename
from typing import Tuple
pypi_version = None
initialization_complete = False
print('Running NDATools ... |
f974807a94c554acb87e41706668510195e7d5024eca75669a6dee76dc130544 | Python | 8,169 | 148 | """
Created on Mon Aug 30 15:27:21 2021
@author: Haotian Teng
"""
import os
from typing import List
import seaborn as sns
import numpy as np
from matplotlib import pyplot as plt
def watch_errors(fs):
errors = []
for f in fs:
error_file = os.path.join(f,"errors.csv")
e = []
with open(er... |
4f8010e969524ee135a0fa6bf36ac100dce97aa744c47b2517aeb7426370e98d | Python | 8,171 | 208 | '''MIT License
Copyright (c) 2020 Duncan Forster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... |
4d99300fc0bbece680da3b38678a3432a69a09a7241c2166343b19bedb742585 | Python | 8,174 | 228 | """
Script for clustering vertices of MCF graph
Input: - GraphMCF (pickle file)
Output: - Clusters stored as GraphMCF property
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
import sys
import time
import getopt
from globals import *
from factory import unpickle_obj
fro... |
7d68c0a8d8a10e397734fe50f55cbbf43a8a3a4127486a74c00288f9dc9404ed | Python | 8,175 | 190 | from typing import List, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from .mmd_like import _MMDLikeTrainer
class WalkerLoss(nn.Module):
def forward(self, P_aba, y):
equality_matrix = torch.eq(y.reshape(-1, 1), y).float()
p_target = equality_matrix / equality_matrix.s... |
01ad985e1d79cd02401565bea7ac78c483f3a981fa0a40bb688105c671d0e8d2 | Python | 8,176 | 205 | # Node-group asset "Symmetry Cubic" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
import math
from typing import ... |
847ec14277855d4ee027f1ba578689cce15d0010fb234cfec9b5b3897835b4af | Python | 8,176 | 193 | # ----------------------------------------------------------------------
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or mo... |
02e295214b3143fa025c681042e334d37f5bba1ed906a854691857ef3d888d51 | Python | 8,178 | 202 | from typing import Union, Tuple, Optional
from torch_geometric.typing import (OptPairTensor, Adj, Size, NoneType,
OptTensor)
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Parameter, Linear
from torch_sparse import SparseTensor, se... |
0ef5f6ba84450a93aa2a92d07f024d9c7903588ec57496fbb29f257e968a428b | Python | 8,180 | 214 | """Common utility functions for universal machine-learned interatomic potentials."""
from __future__ import annotations
from functools import lru_cache, wraps
from importlib.util import find_spec
from logging import getLogger
from typing import TYPE_CHECKING, cast
from monty.dev import requires
has_frozen = bool(fi... |
05457ccba0f43de3d9ac4377bdf24bfa6d450ea67a60f46002205e0629c784d8 | Python | 8,181 | 224 | import email.message
import importlib.metadata
import os
import pathlib
import zipfile
from typing import (
Collection,
Dict,
Iterable,
Iterator,
Mapping,
Optional,
Sequence,
cast,
)
from pip._vendor.packaging.requirements import Requirement
from pip._vendor.packaging.utils import Norma... |
256c6d3be90a009124814fa192cff619208b74b52085ebf0a17257b572ada8ff | Python | 8,182 | 239 | #!/usr/bin/env python3
"""Run the ColabMDA bootstrap inside an existing Colab session via colab exec.
This is a local helper. It generates a temporary Python file that `colab exec`
sends to the remote Colab kernel. The remote Python code then launches the
shell bootstrap and streams stdout/stderr back through `colab e... |
10df4327e30006dcf94b0b47b2f30af35fea3a39231d7e4392381ff10953af18 | Python | 8,183 | 216 | import itertools
import biotite.structure as struc
import numpy as np
import pytest
import molecularnodes as mn
from molecularnodes import download
from molecularnodes.converters import universe_from_atoms
from molecularnodes.entities.molecule.reader import read_structure
from .constants import codes, data_dir
# multi... |
0eddc85421be279d638f3daf316cbe514efee34b8f6d737d31f0d370d7143fff | Python | 8,184 | 221 | from mercurial import cmdutil
from mercurial import util
try:
# Mercurial >= 1.8
# Due to mercurial's lazy importing we need to import the match function
# directly to raise an ImportError if the scmutil module is not present.
from mercurial.scmutil import match
def match_func(repo, ctx, patterns, o... |
9a69e6db1fd158ff1383ccd6c36816ed3351593f42c0077fc9ca58b35fb360f5 | Python | 8,186 | 240 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
c3f028f5eb0129f79e73377c43a1e9910029074afb65750f221836f71bb206cd | Python | 8,187 | 199 | from __future__ import print_function
from . import conditions
def cartesian_product(*sequences):
# TODO: Also exists in tools.py outside the pddl package (defined slightly
# differently). Not good. Need proper import paths.
if not sequences:
yield ()
else:
for tup in cartesian_p... |
4eeab7e740f1e1ddae28b08df41cda274a574bc7ba80e722d9d01c9c77db377b | Python | 8,188 | 220 | # Copyright 2018 The TensorFlow 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 applica... |
a9783e8d49b889f7758cb2d786facd9216e2fbf24ae404328ebe34dbaaaab951 | Python | 8,190 | 286 | from __future__ import annotations
# built-in
import codecs
import math
from collections import Counter
from fractions import Fraction
from itertools import groupby, permutations
from typing import Any, Sequence, TypeVar
# app
from .base import Base as _Base
try:
# built-in
import lzma
except ImportError:
... |
fc7d5a9066aea84589fcf9deabefe5da25e93d0edcf3ba7a6878a37537cca047 | Python | 8,195 | 243 | from typing import Union, Tuple
import torch
import torch.nn as nn
class Benchmark_RNN(nn.Module):
"""
Parent class to create various RNNs based on Elman, GRU and LSTM cells.
Additionally, the forecast methods direct, recursive and
sequence to sequence (S2S) are possible.
For all approaches the p... |
a445a3e811399ef90ca09ef3a85cb0f06be863b5606f6818e8f0d242b8933407 | Python | 8,196 | 300 | #!/usr/bin/python
# Gogulan Karunanithy, UCL, 2021
# Python code for decoupling 2D 'in-phase' CON spectra
import copy
import sys
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import matplotlib.pyplot as plt
import nmrglue as ng
import numpy as np
import tensorflow as tf
from tensorflow import keras
def read... |
f40695bd848ba2d28718837feb3c99056f8b7b7cb1d8c79856f8b906a93d589c | Python | 8,196 | 300 | #!/usr/bin/python
# Gogulan Karunanithy, UCL, 2021
# Python code for decoupling 2D 'in-phase' CON spectra
import copy
import sys
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import matplotlib.pyplot as plt
import nmrglue as ng
import numpy as np
import tensorflow as tf
from tensorflow import keras
def read... |
ad11c53b703be7b9c42647147acb70c6c9c59a7b9928b11fe96c36f083cebb69 | Python | 8,197 | 263 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial
__all__ = [
'ResNet', 'resnet10', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnet200'
]
def conv3x3x3(in_planes, out_planes, stride=1, dilatio... |
c73178b8069f884784603258b7fbd49c9386a1353c46b1fe3c7ed67166178c28 | Python | 8,198 | 246 | import re
from ast import literal_eval
from operator import attrgetter
from typing import Callable, Iterable, List, Match, NamedTuple, Optional, Tuple, Union
from ._emoji_replace import _emoji_replace
from .emoji import EmojiVariant
from .errors import MarkupError
from .style import Style
from .text import Span, Text
... |
624ed8859202f4d81a889c9fd2874b1edce4faa542f49f21f9e76a27a9737af9 | Python | 8,199 | 246 | """
Optuna example that optimizes multi-layer perceptrons using PyTorch distributed.
In this example, we optimize the validation accuracy of fashion product recognition using
PyTorch distributed data parallel and FashionMNIST.
This example is dedicated to a use case of using one machine with multiple GPUs
where no MPI... |
a5e2cd319a44b074eb1ad0e5d4a719b6fad0f3d688601974f9de01e5e135fc69 | Python | 8,200 | 191 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
d695d3095bd44aa094779cc7e987dc5c8aff9e321d2844b5a94f9e32478cbf22 | Python | 8,202 | 244 | from typing import Optional, Callable, Union
from functools import partial
import numpy as np
import jax
import jax.numpy as jnp
import netket as nk
from netket.utils.types import DType, PyTree, Array
import netket.jax as nkjax
from netket.hilbert import AbstractHilbert
from netket.operator import ContinuousOperator... |
7aff1a69aa146b890532de6c864f86e017f7cb6a5cde12bf3086a2a18f7b5945 | Python | 8,203 | 243 | """
Training Models Using Vanilla PyTorch
======================================
For those who prefer working directly with PyTorch's native functionalities instead of using third-party trainers, this tutorial provides a complete guide on how to train models using standard PyTorch features.
"""
####################... |
eaa395598c0025110d97c1ca36f67ae7912520d1ff645b431a1ac28e358d26e5 | Python | 8,204 | 138 | #---------------------------------------------------------------------------------------------------------
# Author: Brandon Coventry, PhD Wisconsin Institute for Translational Neuroengineering
# Date: 02/16/2023
# Purpose: This is an implementation of PyMCs implementation of Krusckes Bayesian Estimation Su... |
07d9ef4c66ad6bcc6cd6baa1b4fac5145c3a970f03fa87e1dc9dbfcea6a78402 | Python | 8,206 | 245 | import sys
import os
import re
class SubjectID:
exercise_pattern = r"^AA(_[3-9]?R)?[0-9]{3}(_L)?$"
longitudinal_pattern = r"^AAL_([3-9]?R)?[0-9]{3}$"
new_participant_pattern = r"^COV(_[3-9]?R)?[0-9]{3}$"
def is_valid(subjectid):
return re.match(SubjectID.exercise_pattern, subjectid) or re.matc... |
787fadc52db3ab51dd3694ddf4b71951c548c1ec0088d53482b9aae708ca9ce9 | Python | 8,208 | 252 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import operator
import os
import platform
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from ._parser im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.