sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7e64e77e43d99fabefbc684b677ef602e5f7108ab1c6cc0f82f07fa0291f2dab | Python | 15,131 | 335 | import os
import numpy as np
import pydrake
from pydrake.common import FindResourceOrThrow
from pydrake.examples.manipulation_station import ManipulationStation, IiwaCollisionModel
from pydrake.geometry import (SceneGraph)
from pydrake.multibody.multibody_tree.multibody_plant import MultibodyPlant
from pydrake.multibo... |
4b75dc22e90fbc64b54fb7b807b9db579f5899c0b07f7927ea9a751577331293 | Python | 15,134 | 354 | """Utilities for loading, merging, and normalizing HED schema DataFrames."""
import csv
import os
import pandas as pd
from hed.errors import HedExceptions, HedFileError
from hed.schema.hed_cache import get_library_data
from hed.schema.hed_schema_constants import HedKey
from hed.schema.schema_io import df_constants a... |
0e915fcd6b8c95b6d2e7aa288ab4697285b11642916c4ceecf67226d38ae283f | Python | 15,135 | 390 | """
Script for getting the graph of segmented membrane an the structures attached to it
Input: - Original tomogram (density map)
- Membrane segmentation tomogram
Output: - vtkPolyData with the membrane and the attached structures
- Segmentation of the graphs
"""
__author__ = 'A... |
0d8d7d162e73227a0d26ac32ed6b381d550cccbf19e440988939d577e76b86ff | Python | 15,143 | 373 | # trace generated using paraview version 5.5.1
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# create a new 'EnSight Reader'
heart_remeshed_3D_MAPSensicase = EnSightReader(CaseFileName='heart... |
81e0dcdf9adeef9917a067bebbd65b8ff33c65cd59854574410e64cbd3a143ab | Python | 15,146 | 326 | import torch
from torch_geometric.loader import DataLoader
from imports.ABIDEDataset import ABIDEDataset,MergedDataset
from imports.utils import train_val_test_split,train_val_split,GHMC
import torch.optim as optim
from torch.optim import lr_scheduler
import torch.nn.functional as F
from gnn import GNN
from torch.utils... |
4fdf865ccff0b4a247dcc568cf51b6b48b3047c4460d817937d980062196f171 | Python | 15,148 | 316 | """Top level validation of HED strings."""
import re
from hed.errors import error_reporter
from hed.errors.error_types import DefinitionErrors, ValidationErrors
from hed.validator.def_validator import DefValidator
from hed.validator.util import CharRexValidator, GroupValidator, StringValidator, TagValidator, UnitValu... |
70c90a7763eedc9dfd351b2108a9d1ead3b97e051644e08c2d8c9aa64baaaaf5 | Python | 15,148 | 531 | """Functions for dealing with files.
METHODS
-------
generate_raw_fpath
- Generates an mne_bids.BIDSPath object for loading an mne.io.Raw object.
generate_sessionwise_fpath
- Generates a filepath for an object that corresponds to an individual
recording session based on the MNE data-storage filepath structure... |
984317fb8cc15c852db0e41ac977757d897a05fb1d35b33c0acc0c6a479e8d42 | Python | 15,152 | 561 | # 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... |
35516a0808da5fa825391eb50ec91484a891ad6f65e22e9455729fd8e51a8ed5 | Python | 15,155 | 373 | # trace generated using paraview version 5.5.1
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# create a new 'EnSight Reader'
heart_remeshed_3D_MAPSensicase = EnSightReader(CaseFileName='heart... |
27ffbe6e0ba8233e5c79c1e260e0d6c8e3f692ce17e3886547f6b12379aa9bcd | Python | 15,157 | 373 | import logging
from itertools import chain
from typing import Any, List, Tuple
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchmetrics
from torch.utils.data import DataLoader
_log = logging.getLogger('torcheeg')
class SimCLRTrainer(pl.LightningModule):
... |
48ffb4668945c90d9148fae5eb635197a0d3d3f691c12c9e5b6d9f9f8dd8501f | Python | 15,160 | 437 | import numpy as np
from jitcdde import input as system_input
from symengine import exp
from ....utils.stimulus import OrnsteinUhlenbeckProcess
from ..builder.base.constants import EXC, INH, LAMBDA_SPEED
from ..builder.base.network import Network, Node, SingleCouplingExcitatoryInhibitoryNode
from ..builder.base.neural_... |
e9d3d35f466c7173a247b3284a762f65c581911a4230ccbaecc3fdb75dd670d1 | Python | 15,160 | 417 | """
Bonito Duplex consensus decoding.
https://www.biorxiv.org/content/10.1101/2020.02.25.956771v1
"""
import os
import sys
import json
from glob import glob
from pathlib import Path
from os.path import basename
from functools import partial
from time import perf_counter
from datetime import timedelta
from multiproces... |
e15929dc184374e71bc2288e53a4f7c8f005261df36e45fde966299765924318 | Python | 15,165 | 391 | import rdkit
import rdkit.Chem as Chem
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
from collections import defaultdict
from rdkit.Chem.EnumerateStereoisomers import EnumerateStereoisomers, StereoEnumerationOptions
MST_MAX_WEIGHT = 100
MAX_NCAND = 2000
def set_atommap(mo... |
5979471bf4c394a2da9d4362389cd54508cb37195fe335709056b4f4a4aeac8a | Python | 15,186 | 428 | #
# 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, copy, modify, merge,... |
3e6fd381ccb316454e80a8ebb95b0824f1e269b1b6d561fd232315766258c757 | Python | 15,188 | 582 | # 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... |
4c97ff43a30660afcf6057baecb9f8772476e9e7d670ed1f75f57a6c139ee719 | Python | 15,196 | 460 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 3 17:03:47 2022
@author: turnerp
"""
import serial.tools.list_ports
import serial
from uProcess import uProcess # Import LabSmith Commands
import matplotlib.pyplot as plt
import time as time # Loads system time library
import serial # Accesses USB terminals.
import os.p... |
203f00731ebfeb1836348b3a266bf865e59681be2c70d055f34a7049f7819b4a | Python | 15,197 | 476 | from __future__ import annotations
from shutil import which
import pytest
from quacc import get_settings
pytestmark = pytest.mark.skipif(
which(str(get_settings().ESPRESSO_BINARIES["pw"])) is None,
reason="QE not installed",
)
from pathlib import Path
from shutil import which
import pytest
from ase.build ... |
a3f83fe2ee25a1ae75f409710ff505d6a93ad983eabf0f6b153a7bd19fa8062a | Python | 15,204 | 449 | #!/usr/bin/env python3
# Plotting functions for output rootlets hPCA algorithm from hPCA.py,
# projection on Poincare Disk
# (if package 'hyperbolic' available from https://pypi.org/project/hyperbolic/),
# or projection onto Klein disk otherwise.
import os
import pickle
import numpy as np
import matplotlib.pypl... |
a0c5358c900f9dbd4d3e687003179ec2b306918a25a847ee3d05ec0773830489 | Python | 15,214 | 379 | # Copyright (c) OpenMMLab. All rights reserved.
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
class ContextualAttentionModule(nn.Module):
"""Contexture attention module.
The details of this module can be found in:
Generative Image Inpainting with Contex... |
145f7e7be0e06cb515cf3a2ff419e83ab1c959b3f12cbf1b3c169b3f8b7105a2 | Python | 15,216 | 348 | import torch
import torch.nn as nn
import torch.nn.functional as F
import einops
from chemprop.args import TrainArgs
from chemprop.nn_utils import get_activation_function
class MultiBondFastAttention(nn.Module):
"""
A :class:`MultiBondFastAttention` is the bond level self-attention block (Fastformer) in the ... |
7d1edd3ffaeb8f330b48b7833a49925f5ed2c0d2964bc508a66000b13c0d63e0 | Python | 15,218 | 379 | # ----------------------------------------------------------------------------
# Contributors: Thiago O. Bezerra
# Antonio C. Roque
# ----------------------------------------------------------------------------
# File description:
#
# Functions implementing the equations for of the simplified astrocyte mo... |
14ab65993b28167d7c423970201852c8c9aa4e06c36eba31e5460d40bd18745c | Python | 15,236 | 456 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 14:53:31 2025
@author: deeperthought
"""
import sys
sys.path.append('/home/deeperthought/Projects/Diagnosis_breast_cancer_MRI_github/develop/code/')
from utils import load_and_preprocess
import numpy as np
#%%
GPU = 3
import tensorflow as tf
... |
23012be000f5328ed31cde6744a205cdd6190fd893a1a41d52fc417c1308b2df | Python | 15,236 | 359 | # ------------------------------------------------------------------------
#
# 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
#
# Unle... |
9b932aa8938413a6cf9e86a1cb51a85a79f76e7e78e0eb36afa5d2ff811214d1 | Python | 15,238 | 348 | import argparse
import collections
import gzip
import math
import os
import random
import shutil
import subprocess
import sys
import time
import numpy as np
import pandas as pd
import utils
import tabix as tb
import tensorflow as tf
import pybedtools as pybt
import pyximport; pyximport.install()
from datetime import da... |
618591a7e6d3f2860b174037136b46e806034b38891751b45ce7fa1006f650e8 | Python | 15,240 | 326 | 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... |
127976792e0ad36f1c1a73a1e0f2e9633ba6ddabb0db1488227f31be00d59446 | Python | 15,246 | 336 |
# -*- coding: utf-8 -*-
import os
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import StratifiedKFold, GridSearchCV
from sklearn.metrics import precision_recall_fscore_support as score, confusion_mat... |
63107955e150a45b908bf8a5f5c30623cc8d755ea12c16ef12aef292bad40a78 | Python | 15,248 | 318 | from typing import Tuple
import torch
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from torch import nn
def pair(t):
return t if isinstance(t, tuple) else (t, t)
class PreNorm(nn.Module):
def __init__(self, in_channels: int, fn: nn.Module):
super(PreNorm, self).__i... |
f2062fa09d20b4190916cc9a48ed8cba53271661e76066a971c1ccc71a2b2279 | Python | 15,249 | 624 | # 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... |
cb3fcc0145de7635965a82b5e7606f26b6cf747f831155027a4012b3d571b85d | Python | 15,251 | 320 | # Node-group asset "Depth Outline" (CompositorNodeTree), 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.
from typing import TYPE_CHECKI... |
079e562a42aa22945a1136969bd573dfe41d357fce988795a71f703bbf6e9480 | Python | 15,262 | 295 | import os
from typing import Any, Callable, Dict, Tuple, Union
import scipy.io as scio
from ...constants.emotion_recognition.seed import (SEED_ADJACENCY_MATRIX,
SEED_CHANNEL_LOCATION_DICT)
from ..base_dataset import BaseDataset
class SEEDDataset(BaseDataset):
r... |
39f988021283aa1f71aacc2b4e22c5aa49f15cb5e3c62482b2ef631f3995174e | Python | 15,268 | 563 |
import numpy as np
import pandas as pd
# signal processing
from scipy.ndimage import gaussian_filter
from scipy.stats import zscore
from scipy.ndimage import uniform_filter1d
#############
# tiff stacks
def split_channels(stack, n_z, n_ch):
'''Split stack into 2 channels
Assumes that stack is ordered as f... |
1b975559d2ad14917924857580e988a6e107adeb0539ce5737fd33ec26f96cf1 | Python | 15,272 | 447 | # 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... |
5cf1c85cba53788d0446c6027fe3d2cf6a89c8c1cd196b1dc7608853582b25e5 | Python | 15,273 | 394 | import glob
import os
import subprocess
from pathlib import Path
from wsilearn.utils.cool_utils import is_string, is_iterable, list_not_in
from tqdm import tqdm
class PathUtils(object):
@staticmethod
def filter_containing_or(names, containing_or=None, split_commas=True):
selection = names
if c... |
8cf68614d2e98781eccd4231b0219c66eb4bf3c19c3c5c605a73fee4db5bf386 | Python | 15,277 | 364 | r"""Test OpenBabel executables from Python
Note: Python bindings not used
On Windows or Linux, you can run these tests at the commandline
in the build folder with:
"C:\Program Files\CMake 2.6\bin\ctest.exe" -C CTestTestfile.cmake
-R pytest -VV
You could also "chdir" into bu... |
ba904e38a80103665054bbc66135dd17be370d70482cf0ab3a5babddc60eef21 | Python | 15,287 | 405 | """
Script for extracting the graphs for analyzing quantitatively a GA network
Input: - Density map tomogram
- Segmentation tomogram of the synapse
Output: - A graph
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
import gc
import os
import time
import scipy... |
866da7b43399be7cab2b48b1966c0b1383c110a8806ac053f1665d6a998cc3a4 | Python | 15,288 | 451 | #!/usr/bin/python
import sys, getopt
import numpy as np
from scipy import optimize
import os
import matplotlib.pyplot as plt
import module_2Dplotter as plotter2D
import module_2Dplotter_PLK1 as plotter2DPLK1
from datetime import datetime
class eloG:
def __init__(self, filename):
self.log_... |
fa305f88bf9c6507dd923958550f901bd2511538ca718661b620536844bda3ea | Python | 15,291 | 374 | import sys
import pickle as pkl
import numpy as np
import scipy.sparse as sp
import torch
from sklearn.metrics.pairwise import cosine_similarity as cos
from sklearn.metrics import pairwise_distances as pair
from utils.gcn_utils import normalize
from dataloader_global import dataloader_g as dataloader
from opt ... |
87bfc16329dd736cfc5d4591d133d715216bd7b9d6cb1c9ec88b77f280abb876 | Python | 15,292 | 373 | # 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... |
8306c9b88f5db4b454b4738d1c7107ff7964c78cc4ad5b4827f1ba07c9a2c91f | Python | 15,296 | 325 | """
Script for extracting slices from a SynGraphMCF
Input: - List of paths to SynGraphMCF pickles
- Path to XML file with slices description
Output: - Slices segmentations
- UniStat object for every slice
"""
__author__ = 'Antonio Martinez-Sanchez'
import pyseg as ps
from pyseg... |
e58c18a3bbe80560450bdf0ca316f792f5e7d1226f34c181cc0480cc45424708 | Python | 15,296 | 310 | import sys
import os
# Get the current script directory
current_script_directory = os.path.dirname(os.path.realpath(__file__))
# Get the root directory of your repository
root_directory = os.path.abspath(os.path.join(current_script_directory, os.pardir, os.pardir))
# Add the root directory to sys.path
sys.path.appen... |
f5d2ef7dca625750eb6ac34d25ebab008cb5d94f0832349ef64608a9a4fc2eb2 | Python | 15,297 | 332 | import os
import re
from typing import Callable, Dict, Tuple, Union
import numpy as np
import scipy.io as scio
from ....utils import get_random_dir_path
from ..base_dataset import BaseDataset
class SEEDIVDataset(BaseDataset):
r'''
The SEED-IV dataset provided by the BCMI laboratory, which is led by Prof. Ba... |
2a0c3ccc83e99193021972eadf1e01947f20587df4ed2d7cdda2874d4c8f089f | Python | 15,302 | 349 | import copy
import unittest
from hed import load_schema_version
from hed.models import HedString
class TestHedStrings(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.schema = load_schema_version("8.4.0")
def validator_scalar(self, test_strings, expected_results, test_function):
... |
8c9d8f276c16dfb59855d0714c65d9a7e7ef62d93ff4d3020169d2bba6fe459d | Python | 15,308 | 358 | import argparse
import collections
import gzip
import math
import os
import random
import shutil
import subprocess
import sys
import time
import numpy as np
import pandas as pd
import utils
import tabix as tb
import tensorflow as tf
import pybedtools as pybt
import pyximport; pyximport.install()
import cython_fxn
f... |
3a728865e38de64b714c5ad841f6de27d41614e3e2272c80275332c2f288710d | Python | 15,316 | 272 | """
Preprocesses spike to be used for cell assembly analysis
a la (Sasaki et al. 2006 and) Carillo-Reid et al. 2015:
Bin spikes and threshold activity by population firing rate
+ SpikeMatrixGroup has some extra functionality to calculate
spike time reliability across seeds
authors: Thomas Delemontex and András Ecker; l... |
5bbe920b45feb64414792c9d285e665d59550d2d812925762a726a83128c645c | Python | 15,316 | 398 | #
# 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, copy, modify, merge,... |
7614678544a278eeda8fddc1e23f9d07418c0ffad209c1b8239eed0c434147f0 | Python | 15,316 | 422 | # 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... |
a6f0cc49a649ef0a40db780a17c092d85c96ef9b62ae2009569800ce8f792c3d | Python | 15,319 | 424 | import sqlite3
import re
import os
import pandas as pd
import logging
# Configure logger
workflow_logger = logging.getLogger('workflow_logger')
def _enable_foreign_keys(conn):
conn.execute("PRAGMA foreign_keys = ON;")
def create_database(database_name, database_sql ,wipe=False):
"""
This function creates... |
dca224d816b68d8565249b18ed07a0e09a017f98cb73aa94a73adb72bd8b2e7d | Python | 15,325 | 426 | """
GUI for viewing Neuroglancer data: OME-Zarr, NIfTI, TIFF directories,
and precomputed point annotations in a self-hosted browser viewer.
"""
import os
import sys
import glob
import traceback
from natsort import natsorted
from PySide6.QtWidgets import (
QWidget,
QVBoxLayout,
QHBoxLayout,
... |
8dc7c41f7c97c875064e3322196d59bd49983f4ce3fe60f3bc9a5f6ed353dc51 | Python | 15,327 | 358 | """
Unsupervised and deterministic (AP and HAC yes, Kmeans not) classification of membrane-bound particles
Input: - The STAR file with the particles to classify
- Classification parameters
- Clustering method
Output: - A set of STAR files with the new classes
- 2D rot... |
82a613e986be7e3876e650eb9f5b1c62ab0103c5097b7f2365e8458782832060 | Python | 15,329 | 480 | """Class to import ABF2.
Adapted from axonrawio.py in python-neo. Strongly simplified.
"""
from datetime import datetime, timedelta
from numpy import c_, empty, float64, nan, memmap, dtype, newaxis, array
from os import SEEK_SET
from struct import unpack, calcsize
from .utils import DEFAULT_DATETIME
BLOCKSIZE = 512
... |
dfa4f794058c8e93e9c35067edf93dd890fdc9818dced4079cfc6740c939ff61 | Python | 15,329 | 506 | # 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... |
c329b3d228d65e70b23dd786657bcb111e5e79d32de3945b8a864ad3d11ee6f8 | Python | 15,339 | 440 | from __future__ import division, print_function
import copy
import numpy as np
import operator
import matplotlib.pyplot as plt
try:
import spams
except:
print("Cannot import spams! You won't be able to optimize!")
try:
from cvxopt import matrix as cvxopt_matrix, solvers as cvxopt_solvers
except:
prin... |
b462dcdfaa906848963904aa65df3837a08ba52e2556425f96441b732aab2ee4 | Python | 15,345 | 509 | # 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... |
eafaf33a41611a5b15daed860e429b29741e54e18b4c2d299b4a0d9c10c09677 | Python | 15,350 | 340 | """Crop bounds, side masks, and per-point hemisphere assignment."""
import numpy as np
import pytest
def _g():
from regtools.hemisphere import geometry
return geometry
def _plane(**kwargs):
from regtools.hemisphere.plane import MidsagittalPlane
base = dict(ml_axis=2, ml_sign=1.0, o... |
0002b0872836aa574dfbe7667c3d552b5bfaf9751abb797c2ce81eadbbf81fd0 | Python | 15,353 | 339 | # -*- coding: utf-8 -*-
"""
Created on Jul 28 2023
@author: Jonas A. Thiele
"""
### Test if relevant links/edges (identified via stepwise LRP in training of main sample) are more related to confounds, more reliable than random edges, and if
### included nodes have higher/lower participation coefficient and wi... |
bdd05016f191c7ba343c0529c8f4e4b28555f057a722f420dd7faa30b7ac7ebc | Python | 15,353 | 344 | # 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
#
# ht... |
f9682bc4ec138c31536b777c40f8613b41b583ef719e9e90c35986f268765c54 | Python | 15,355 | 477 |
import time
import os
import re
import collections
import json
import numpy as np
import copy
"""class OrderedSet(collections.MutableSet):
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.map = {} ... |
a36d2e664a75b6cb58c974a83bb38ba5e4a0c593116266e84c7b26b1f3e2cada | Python | 15,360 | 440 | import unittest
import numpy as np
from neurolib.models.fhn import FHNModel
from neurolib.control.optimal_control import oc_fhn
import test_oc_utils as test_oc_utils
p = test_oc_utils.params
class TestFHN(unittest.TestCase):
"""
Test fhn in neurolib/optimal_control/
"""
# tests if the control from... |
af73b0448327dffec420e7b312310b2163b8c20d36b2bf92cfcc4a9b190eef90 | Python | 15,360 | 446 | import os, random, argparse, pandas as pd, numpy as np, seaborn as sns
from tqdm import tqdm
import torch, torch.nn as nn
# set random seed
os.environ['CUDA_LAUNCH_BLOCKING'] = '1'
SEED = 10
random.seed(SEED)
np.random.seed(SEED)
torch.random.manual_seed(SEED)
import sys
sys.path.append("../")
# sys.path.append("../... |
04c76085f272e4fb55ad2ca1aa5dae7dedbcb1b2c90cb53622b718ae3a0f576d | Python | 15,364 | 390 | import io
import os
from pathlib import Path
import databpy as db
import numpy as np
from syrupy.extensions.amber import AmberSnapshotExtension
from syrupy.extensions.single_file import SingleFileSnapshotExtension
# Number of significant digits that float values are rounded to before any summary
# statistic is derived... |
0e1f0b2561bc2d19432b82488fdb1f445f7a4d113313ef8dfc0225c7b4eaa1ee | Python | 15,365 | 467 | import functools
import logging
import os
import pathlib
import sys
import sysconfig
from typing import Any, Dict, Generator, Optional, Tuple
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.deprecation import deprecated
from pip._inter... |
5637abe7af87b6bae81790b9f5de6ff9b66c0fc5116f54e7d16375639dbe016b | Python | 15,368 | 385 | import os
import re
from typing import List
from typing import Tuple
import pandas
import numpy as np
import merlin
from merlin.core import dataset
def _parse_list(inputString: str, dtype=float):
if ',' in inputString:
return np.fromstring(inputString.strip('[] '), dtype=dtype, sep=',')
else:
... |
5dbee12bc0d167f0088187b12124841c806116fa488b588d43bf72bb90626733 | Python | 15,372 | 369 | import logging
import MDAnalysis as mda
import numpy as np
from MDAnalysis.analysis.dssp import DSSP, translate
from ..base import EntityType, MolecularEntity
logger = logging.getLogger(__name__)
class DSSPCalculation:
"""
Secondary structure calculated with DSSP, as the `sec_struct` calculation
Get it ... |
f354aba4d45b6a21b0c82ab95e6ce3e2df925784f546c728f7c9e085c2f1e819 | Python | 15,375 | 463 | # 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... |
6c53216088fbfe645d991147f0ac7eabd6e5caf38667cc785a5b7040bc4a4c7e | Python | 15,380 | 514 | #
# 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, copy, modify, merge,... |
69488ec2b8e2e7ec35b910bbbe39cacd09024cf904f218d3364777403d766cf8 | Python | 15,383 | 493 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:AUTHOR: Jens Petersen
:ORGANIZATION: Heidelberg University Hospital; German Cancer Research Center
:CONTACT: jens.petersen@dkfz.de
:SINCE: Wed May 17 14:29:20 2017
:VERSION: 0.1
DESCRIPTION
-----------
Preprocess all experiments under a given XNAT endpoint
REQUIRES... |
de9a4254470b72662e6b58b4bdd3eb752e13fb2a65fae28ca954bf53c0bdbdfd | Python | 15,385 | 380 | """Base model class."""
import numpy as np
from sklearn.metrics import roc_auc_score, average_precision_score
import torch
import torch as th
import torch.nn as nn
import torch.nn.functional as F
from layers.layers import FermiDiracDecoder
import layers.hyp_layers as hyp_layers
import manifolds
import models.encoders... |
3f93dc9f79e590ec6f6dc13a2dcad7a7593125f1b3ea1311786f4fccb1d27743 | Python | 15,387 | 394 | """Criteria for judging the dataset composition of a candidate cluster.
`extract_homogeneous_clusters` walks a dendrogram from the top down and asks a
criterion whether each candidate cluster contains an acceptable mix of neurons
from each dataset, stopping the split when it doesn't.
The built-in `is_good` compares t... |
eb5ecb2c8ee84d7a685ad4f1bea2ee3ff7c7b9a22f137e251db33144dd2eab72 | Python | 15,395 | 359 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 22 17:28:14 2021
@author: kalantaria
Description: This code will parse through every possible folder after a defined initial path,
looking for MR data files of any type. Then it will extract the wanted files
and eliminiate the duplicates.
"""
impor... |
afdc2dd845a878b907bbe4a573b6181e9cac2726f39b95a30bea3c36076024d3 | Python | 15,401 | 322 | """
Script for extracting particles from MbGraphMCF slices
Input: - STAR file with slices of MbGraphMCF objects
Output: - A STAR file and a list with the coordinates pickled
"""
__author__ = 'Antonio Martinez-Sanchez'
import operator
import pyseg as ps
from pyseg.globals.utils import coords_scale_sup... |
e7f8a7567addd12e704b711da78ef663eddbd903c51188c6fe0914526c1a3679 | Python | 15,404 | 456 | """
Define and train machine learning models that predict max interval parameters.
Input
----------
- "data/trainset.hdf5" : file containing 5-seconds slices with (signal, spikes, bursts)
- "data/training_indices.hdf5" : file contraining indices separating full training_dataset into training/validation/test se... |
dfede4f685ea3b5260fada2292cf2efdc0e4a69fd0adff4d2beabadde590952a | Python | 15,420 | 279 | #!/usr/bin/env python
"""
main() module -- MoCHI Command Line tool
"""
import argparse
import os
import pathlib
import sys
from pathlib import Path
import pandas as pd
from loguru import logger
from pymochi.project import MochiProject
BOOLEAN_OPTIONS = {
"--holdout_WT",
"--ensemble",
"--training_resamp... |
c8b9ab08c6cbd1ebe7e15e5859ac8b21ee67495ef6feb6693f5e785bd3c385ce | Python | 15,429 | 400 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
import numpy as np
from numba import njit, jit, float32, int32, boolean, int64, vectorize, prange
from numba.types import Tuple
def create_ND_basis(dims, nclust, K, flag=True):
# recursively call this functi... |
1ae67f152e507ab13af28242c00eaf8b94c8524d293e70eaeab1223c5c328e42 | Python | 15,437 | 353 | """Implementation of CLI repair command."""
import math
from itertools import chain
import numpy as np
from treem import Morph, SWC
from treem.utils.geom import repair_branch, sample, norm, rotation
def repair(args):
"""Corrects morphology reconstruction at the given nodes."""
# pylint: disable=invalid-na... |
c46ffbcb653bf365c1955269fd3bcd552c966a069700973386d75f53b8444143 | Python | 15,439 | 416 | # -*- coding: utf-8 -*-
from __future__ import annotations
from collections import Counter
from typing import Callable, Iterable, List, Optional, Union
import torch
from supar.utils.data import Dataset
from supar.utils.embed import Embedding
from supar.utils.fn import pad
from supar.utils.logging import progress_bar... |
c48acfefbaffe6cd40cf6f985257b2a2d26860f5a13c453b68f8f28629f68be5 | Python | 15,440 | 442 | """Module has information about the datasets, not data.
"""
from datetime import timedelta, datetime
from math import ceil
from logging import getLogger
from pathlib import Path
from numpy import arange, asarray, concatenate, empty, int64, zeros, ndarray
from .ioeeg import (Abf,
Edf,
... |
c5184eda69d5adc358902485c7da0d2bc6bcac34221ac90e8d9f2ab55872a407 | Python | 15,444 | 381 | # 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... |
0b3694fdfbbfbeb7efa00a8c74967c37a940bb5fa7a527de9053a17ba53b155e | Python | 15,449 | 305 | """Live external injection, external neural cue and runtime leak rate (random tiny weights).
These check token provenance, reservoir bookkeeping and reproducibility, not language.
"""
import threading
from pathlib import Path
from threading import Event
import numpy as np
import pandas as pd
import pytest
from conft... |
f76dc081eb8e21b26b431a6b5d842ae5a5a6f95bb5dab78494d02df1bd33b70e | Python | 15,459 | 336 | #### Edit ninfo file with given weight factors
#### Usage: $ python3 edit_ninfo.py [2,2,2,2,2,2,2] monomer.ninfo restraints.txt cg_pdb
#### list order of scale factors [bond, angle, dihedral_1, dihedral_2,long_range, basepair, basestack]
#### Value of each scale factor range (0:9)
#### a new ninfo file is produced wit... |
f1f303c56541e62520baf500777723953772356a1f1d29bfb0395e4c9c082240 | Python | 15,464 | 427 | # 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... |
f1898caedd459476f96305e89e0eaaa88b29df9433af7391d3afbda5dc0d4c1c | Python | 15,474 | 611 | import datetime
import numpy as np
from itertools import chain, combinations, cycle, islice
import copy
def getArgValue(name, nameList, valList):
return valList[nameList.index(name)]
class Hashable:
def __init__(self):
self.hashValue = None
self.descValue = None
def desc(self):
... |
d584042614588e7e29f8d3d96d7cafcb04abe2a8fe9e2834d3384bdc7f2d58fb | Python | 15,478 | 417 | # Copyright 2017 The Chiron Authors. All Rights Reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Created on Tue May 2 15:39:29 2017
from __future__ impo... |
2bf8eb1de916278919929e00852e6bb3c1f46463ca96f27255ee49e80df6619f | Python | 15,481 | 442 | import os
import sys
from traceHandler import Trace
import optimizerHandler
import importlib
try:
import copyreg
except:
import copyreg
from types import MethodType
class externalHandler():
"""
Handles models which are using a simulator other than Neuron.
:param command: the command string whi... |
d0b243888f3de8d477644b38149f7cb721afb32a3458fbd296004725668dc587 | Python | 15,481 | 357 | import linecache
import os
import sys
sys.path.append(os.path.dirname(__file__))
import time
from sdk import SDK
# from app import arrayexp
import copy
import numpy as np
import csv
# ARRAY info
class ARRAYs_4K():
def __init__(self, no_array=1):
self.CHIP_NUM = no_array
self.ID = [ch... |
d663ce0d4e220ee862eae62cef010c30867e0fd8088060237059349ef4c74f42 | Python | 15,481 | 337 | # Copyright (c) 2020, Ko Sugawara
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
0e3b847d7a9e712b88dd00fc0b7a012aa6b50185ec158131c83f5686ea8c3f48 | Python | 15,495 | 320 | from pyclbr import Function
from dolfin import *
import numpy as np
import matplotlib.pyplot as plt
import sys
import os
from IPython import embed
def read_xdmf(infile, mesh, order, tag, patient, comp):
V = FunctionSpace(mesh, "CG", order)
p = Function(V)
try:
p_xdmf = XDMFFile(MPI.comm_world... |
89eca853db111f5cdfd46c23ebb20ab7cbf1b7163e07935e40b94c52aabacd14 | Python | 15,496 | 425 | # 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... |
0a25623bfec399cede755fd1e8da9d6887175bcb05159aef35c68d2778b75f3a | Python | 15,501 | 435 | from functools import partial
import numpy as npo
try:
import scipy
except:
from warnings import warn
warn("Skipping scipy tests.")
else:
from numpy_utils import unary_ufunc_check
from scipy.signal import convolve as sp_convolve
import autograd.numpy as np
import autograd.numpy.random as... |
cac8a91528fd73f7a287aa6fa6a94b125f68b10c77b9e7b4e757a54ba56eea62 | Python | 15,502 | 370 | """Evaluation of survival probabilities at a single time."""
from __future__ import annotations
import matplotlib.pyplot as plt
import numpy as np
from SurvivalEVAL.evaluations.calibration import (
integrated_calibration_index,
one_calibration,
)
from SurvivalEVAL.evaluations.calibration.single_time.util imp... |
9862f1827ef58ca402105ac734221dc50421fcf1942b625ca562a2b81ed67c50 | Python | 15,512 | 380 | """
Set of tests for `Signal` class.
"""
import logging
import os
import unittest
from copy import deepcopy
from shutil import rmtree
import numpy as np
import pytest
import xarray as xr
from neurolib.models.aln import ALNModel
from neurolib.utils.loadData import Dataset
from neurolib.utils.signal import RatesSignal,... |
91319c92c169e0e636a39c21a8f39a39687608ec2f12127066256a942bb02a84 | Python | 15,513 | 480 | """ The convert click command """
from collections import defaultdict
import configparser
import glob
import os
import click
import numpy as np
import pandas as pd
from pathlib import Path
from layer_recognition.density import (
single_image_process_per_depth,
single_image_process_per_layer,
compute_a... |
29f14631eaeb90dff4574ae0b49571fbd747b77b56ee2fee272a63c0470bb42d | Python | 15,517 | 599 | import re
import itertools
import textwrap
import functools
try:
from importlib.resources import files # type: ignore
except ImportError: # pragma: nocover
from setuptools.extern.importlib_resources import files # type: ignore
from setuptools.extern.jaraco.functools import compose, method_cache
from setupt... |
ff3553c00caedeeaefdc14190f0d7cbd571a74611dec5ceab78a24d696f4f0c7 | Python | 15,518 | 494 | # -*- coding: utf-8 -*-
#
# Collection of utility classes/functions for Syncopy
#
# Builtin/3rd party package imports
import sys
import traceback
import logging
from collections import OrderedDict
# Local imports
from syncopy import __tbcount__
from syncopy.shared.log import get_logger, get_parallel_logger, loglevels... |
70de796c571c796e304c71b9aeebf922e10345aacffb8841617f3397de3f737d | Python | 15,526 | 599 | import re
import itertools
import textwrap
import functools
try:
from importlib.resources import files # type: ignore
except ImportError: # pragma: nocover
from pkg_resources.extern.importlib_resources import files # type: ignore
from pkg_resources.extern.jaraco.functools import compose, method_cache
from ... |
f2a11068100fc81f3726e2a6b70b19b450f6dd8a7ecdfc0b005d6653d1dfad01 | Python | 15,530 | 521 | # 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... |
4d33d45ea49b1c57484b647f77792195f25cd6a59ca173f84f69682157f007d0 | Python | 15,531 | 416 | import torch
from torch.utils.data import Dataset, DataLoader
import gpytorch
from gpytorch.kernels import Kernel
from gpytorch.likelihoods import Likelihood
from gpytorch.distributions import Distribution
from gpytorch.variational import CholeskyVariationalDistribution
from gpytorch.variational import VariationalStrat... |
053b92e16f21c0f037f210ec588c4e897829447a4f2b33ddcfa4153b5827c57e | Python | 15,532 | 478 | #!/usr/bin/env python
# coding: utf-8
# ## Exploration of domain adaptation algorithms
# In[1]:
import time
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from tqdm import tqdm
from transfertools.models import CORAL, TCA
get_ipython().run_line_magic('reload_ext', 'autoreload')
get_ipyth... |
b16df928ea95c3234c5c0a23acfe717fb7abfc063622e4a2a068500d00978a55 | Python | 15,538 | 304 | import os
from typing import Any, Callable, Dict, Tuple, Union
import pandas as pd
import scipy.io as scio
from torcheeg.io import EEGSignalIO, MetaInfoIO
from ..base_dataset import BaseDataset
class M3CVDataset(BaseDataset):
r'''
A reliable EEG-based biometric system should be able to withstand changes in... |
5ae39d7a6b959b9fb5322e8f24c4658b8a95d8f62997f82b25aaadd97db57999 | Python | 15,543 | 436 | import logging
import numpy as np
import pandas as pd
from config_path import *
data_path = DATA_PATH
processed_path = join(PROSTATE_DATA_PATH, 'processed')
# data
cnv_filename = 'train_cnv.csv'
response_filename = 'train_label.csv'
gene_important_mutations_only = 'train_mut.csv'
gene_final_no_silent_no_intron = '... |
16437a86dfcd6364535e432b1bc16d284f040ef930180aca5ffd6664a9440e1f | Python | 15,545 | 433 | from joblib import Parallel, delayed
from nltools.stats import fdr
import numpy as np
import pandas as pd
import scipy.stats as stats
from scipy.stats import zscore, norm, pearsonr
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.