sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7de815986edca49cc2ed91326497a0feebab8d2724792bed0023e78a235671e5 | Python | 14,807 | 476 | # -*- coding: utf-8 -*-
from __future__ import annotations
import os
import tempfile
from collections import Counter
from typing import Dict, List, Optional, Tuple, Union
import torch
from supar.utils.fn import pad
class Metric(object):
def __init__(self, reverse: Optional[bool] = None, eps: float = 1e-12) -... |
2744721c75bb2c5ee5b1a289cdf1e7928d31f3f222be14e365986ddf00b49434 | Python | 14,808 | 320 | from typing import Any, Callable, Dict, Optional, Text, Union, Iterable
import tensorflow.experimental.numpy as tnp
import tensorflow as tf
from tensorflow.keras import layers as kl
from src.layers.layers import *
import tensorflow_addons as tfa
from tensorflow.keras import regularizers
from tensorflow.keras.layers.exp... |
4cc2330600fc5f06cdc1d066eacd56237761bad25a218e66c06132faaba2569b | Python | 14,808 | 358 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, constant_init, xavier_init
from torch.nn import functional as F
class GCAModule(nn.Module):
"""Guided Contextual Attention Module.
From https://arxiv.org/pdf/2001.04069.pdf.
Based on https:... |
c8bb74a12b1d7ac07ac798832bfa19ccf442405bb0f357c675ae2ca53778bdd5 | Python | 14,810 | 392 | # -*- coding: utf-8 -*-
#
# Set/update trial settings of Syncopy data objects
#
# Builtin/3rd party package imports
import sys
import numpy as np
# Local imports
from syncopy.shared.parsers import data_parser, array_parser, scalar_parser
from syncopy.shared.errors import SPYTypeError, SPYValueError
from ...datatype.u... |
4b4c9e344933920659e466862edd9d7e5077d9b98ddbf03b93cfe407e8523fb1 | Python | 14,815 | 399 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is an example scripts using LFPy with a passive cell model adapted from
Mainen and Sejnowski, Nature 1996, for the original files, see
http://senselab.med.yale.edu/modeldb/ShowModel.asp?model=2488
Illustration of simultaneous Electrocorticography (ECoG) and LFP me... |
f89f027bb072c2e056fcd37e8549394544fb00647419191739f8631e7fe7739e | Python | 14,817 | 352 | # 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.
#
# Portions of this file were adapted from the open source code for the following
# two papers:
#
# Ingraham, J., Garg, V., Barzilay, R., &... |
af89aca11ddcad3364cf23a180bf3208327e56ca3cd6a6124cb9e4aa36e6e0df | Python | 14,823 | 320 | from typing import Any, Callable, Dict, Optional, Text, Union, Iterable
import tensorflow.experimental.numpy as tnp
import tensorflow as tf
from tensorflow.keras import layers as kl
from src.layers.layers import *
import tensorflow_addons as tfa
from tensorflow.keras import regularizers
from tensorflow.keras.layers.exp... |
7c6191eac1d6f297a1a919c157ad8759cab0af2b5af1444459097b2ad2f05752 | Python | 14,827 | 393 | """
Defines class Layers that holds data from one or more observations
(experiments) divided (classified) in groups.
The observations are expected to be generated by scripts/layers.py.
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from __future__ ... |
905f6e721fe04ea98ea1d0d80e450419c58afbd040132885a6bcd9aa7de4ab81 | Python | 14,827 | 312 | import os
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 SEEDDataset(BaseDataset):
r'''
The SJTU Emotion EEG Dataset (SEED), is a collection of EEG datasets provided by the BCMI... |
8cbc38c50f5a36842c483de9fee0b67028d59eaacb1cd20ffac0c1d6fc796fec | Python | 14,828 | 356 | # \file simulator_slice_acquisition_test.py
# \brief Class containing unit tests for module SimulatorSliceAcqusition
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date May 2016
import os
import itk
import unittest
import numpy as np
import SimpleITK as sitk
import pysitk.simple_itk_helper as sitkh
... |
f72d097e599d0f49db3815f4dd16f29886eea22a66c05f34dc64f0ece4c5d265 | Python | 14,829 | 451 | import os
import pickle
import matplotlib.pyplot as plt
import torch
import numpy as np
import utilities.metric_func as func
import math
import logging
def process_cov(array, threshold, channels, dictionary={}, transpose=True):
for i in channels:
dictionary[i]=0
i=0; j=0;
print("Threshold: ", thr... |
53239dc17f349c0df32399c8cec48e59e1e57c3ed7897365a3ed35faaa99de76 | Python | 14,830 | 422 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.nn.modules.module import Module
from layers.att_layers import DenseAtt
from Norm.norm import Norm,RiemannianGroupNorm ## added by Cole
from diff_frech_mean.frechetmean import Poincare as Frechet_Poin... |
38ecaaaa05d190e01a8a7ef5f42d260b765c27c825cd4ab8b8b37e88b48c53b5 | Python | 14,831 | 434 | """Unit tests for shape inference rules."""
from collections.abc import Callable
import pytest
from elasticai.creator_plugins.lutron_filter import (
AttachFilterParametersRule as AttachFilterParameters,
)
from elasticai.creator_plugins.lutron_filter import (
InferMaxPool1dInChannelsRule as InferMaxPool1dInCha... |
7d1be8781d7e204b11d2cc88fe39680869dc6ce14ada2990cd19679f9f8af204 | Python | 14,835 | 375 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 23 13:19:47 2020
@author: hugwei
"""
import os
from copy import deepcopy
import fire
import numpy as np
import mne
import time
from .utils import DATA_PATH, CH_TYPES, subjects, data_folders, read_head_position
def load_raw_data(subject):
"""
... |
dc4138fbdf2e89cdff463193344b57553f1e78bf84e8b7bf6d84aa232b35706e | Python | 14,836 | 345 | """Tests for regtools.atlas.contours."""
import sys
from pathlib import Path
# Make `regtools` importable from the repo root (it is not pip-installed).
_REPO_ROOT = Path(__file__).resolve().parents[2]
if str(_REPO_ROOT) not in sys.path:
sys.path.insert(0, str(_REPO_ROOT))
import numpy as np
import pyt... |
f068471849d40e341153c096d3e5e3d89458813c0d2fcd6d8e939e55a66ef7fc | Python | 14,837 | 293 | """
This script summarizes the significant results for H4 organizing them and
matching the results with the node coordinates and different scrubbing schemes
"""
import os
import json
import glob
import pandas as pd
from nltools.stats import fdr
from statsmodels.stats.multitest import fdrcorrection
#################... |
25a31a1881f6b4683faca5f81082fafb57ebd82f65ad32309e9b327c43e787bd | Python | 14,846 | 320 | # 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... |
c5806b838c7475df569d3f2a7257c00d50fda2776b50d92a3e6bed7b5a5ae76d | Python | 14,848 | 362 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... |
db40b1f22530103dc1ea696ee5a8be9e2343c7e220dd23ab3a43c5fc37fd7779 | Python | 14,849 | 324 | """
Downstream task: BACE: Quantitative (IC50) and qualitative (binary label) binding results for a set of inhibitors of human β-secretase 1(BACE-1)
Dataset source: DeepChem
"""
import os, sys, argparse, time
import json
import pandas as pd
from tqdm import tqdm
from rdkit import Chem
#import deepchem as d... |
bfacf14a3e24daaffb8a4366ea62683b9d97b0bdf2b2bf280d1f808db64cb5bd | Python | 14,856 | 340 | """Result-GIF embedding + selection for the registration report."""
import os
from regtools.registration.report.assets import _img_data_uri, _MIME_BY_EXT
from regtools.registration.report.figures import (
_collect_result_gifs,
_render_result_gifs,
)
def _tiny_gif_bytes():
"""Bytes of a minim... |
50673d46f4dc0798f5688212ab4c81047eefb1a3780e6b71536405c3b0d08193 | Python | 14,859 | 323 | """
@author: Haotian Teng
"""
import os
import sys
import torch
import argparse
import numpy as np
from typing import Union,List
from itertools import chain
from torchvision import transforms
import torch.utils.data as data
from torch.utils.data.dataloader import DataLoader
from xron.xron_input import Dataset, ToTenso... |
fa88f1ef00d109d2f1c81bb5e9385776141c8f41d76e7b751edc13dca76ff595 | Python | 14,862 | 346 | import os
import pickle as pkl
from typing import Any, Callable, Dict, Tuple, Union
import numpy as np
from ....utils import get_random_dir_path
from ..base_dataset import BaseDataset
_VALENCE_DICT = {
1: -1, # negative
2: -1,
3: -1,
4: -1,
5: -1,
6: -1,
7: -1,
8: -1,
9: -1,
... |
e4302b8dbce1b9348cdd24100b60cfde6d50e35e08edffaab537dda1fccac9de | Python | 14,881 | 325 | """
NEIGHBOUR_CONTAMINATION.py - written 2026-09-17.
THE MECHANISM TEST. IT DECIDES WHAT CHAPTER 3 IS ALLOWED TO SAY.
The classifier reads a 640 nm cube around each synapse. If that cube contains a DIFFERENT
neuron's synapse, the prediction is partly a readout of the neighbourhood. Eckstein raised
this for one ... |
1fc905f6797f3afdc49fe549c1a457e8b63358d5aeed7b6407cd0dbb2447b9bb | Python | 14,884 | 402 | """Stacked napari viewer for a whole 2-D registration batch.
The batch tab gives every row its own ``napari`` button, and each opens a
separate viewer for that one section. Reviewing a 42-section batch therefore
meant 42 windows, with no way to scroll through the batch or compare
neighbouring sections.
This m... |
c41347e7e544f4d9c9af2459530d03e7eeaadb72581539febee2800565c8d622 | Python | 14,885 | 398 | import os
import PoseTools
import tensorflow as tf
import numpy as np
from scipy import stats
from keras.models import Model
from keras.layers.merge import Concatenate
from keras.layers import Activation, Input, Lambda
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import MaxPooling2D, AverageP... |
2957411f7c09401c98980e0d44ae5c7f75b34ea200f3df4f301d2ccf65c38b4d | Python | 14,887 | 448 | """This module computes the baseline results by applying various classifiers.
The classifiers used here are nearest neighbors, linear SVM, RBF SVM, decision
tree, random forest, logistic regression, naive bayes, and LDA.
"""
__author__ = "Sergey Plis"
__copyright__ = "Copyright 2015, Mind Research Network"
__credits__... |
6d7c9893b947f3fd0636d579cf55173b4a1a8520ec2dfd66cc5379f309365bf5 | Python | 14,887 | 336 | """Module for PREP pipeline."""
# Authors: The PyPREP developers
# SPDX-License-Identifier: MIT
import warnings
import mne
from mne.utils import check_random_state
from pyprep.reference import Reference
from pyprep.removeTrend import removeTrend
class PrepPipeline:
"""Early stage preprocessing (PREP) of EEG d... |
a45fe41ddf8ff5c590b022b846a86b9d5ca4a54e04d5927ff2c7efd9fa526b22 | Python | 14,888 | 454 | # 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... |
310f086290bd21acd5f180fa4d4447c1ca61756b6972087cb462473b37e38ed0 | Python | 14,890 | 426 | import numpy as NP
"""
A module which implements the continuous wavelet transform
---------------------------------------------------------
Code released under the BSD 3-clause licence.
Copyright (c) 2012, R W Fearick, University of Cape Town
All rights reserved.
Redistribution and use in source and binary forms, w... |
727f850c0260fde4637ab99c37dac100cf44d50152b5a32e22128d6eae8903b2 | Python | 14,891 | 336 | doc = dict(
__class__="""
The naive Bayes classifier assumes independence between predictor variables
conditional on the response, and a Gaussian distribution of numeric predictors with
mean and standard deviation computed from the training dataset. When building a naive
Bayes classifier, every row in the training ... |
9c6531c243b5b6d5332f386d3d556d2cbcb9f754dff2f45586dfd2ec6d3335de | Python | 14,891 | 296 | from typing import Union, Dict, Tuple, List
import os
import time
import tqdm
from pymatgen.core.structure import Structure
import numpy as np
import torch
from torch_geometric.data import InMemoryDataset
from pathos.multiprocessing import ProcessingPool as Pool
from .graph import get_graph, load_orbital_types
from .... |
8e2f329177b3f993cbdc51eadd014a8fffcc90981e3ebe07a8d366fe223a9664 | Python | 14,894 | 336 |
from PyQt5 import QtCore, QtGui, QtWidgets
import pyqtgraph
class Ui_MainWindow(object):
"""Sequence Selector GUI design:"""
def __init__(self, screen_height=None, screen_width=None):
# Get screen dimensions if not provided
if screen_height is None or screen_width is None:
screen ... |
bb451c878f870c3a28268640af817916cf0f11269b320c7445c2ec787bc80db7 | Python | 14,897 | 440 | # 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... |
cf7ef2de99d556ba7466446aef04c9f231759aa59fae327478a5121187035d3c | Python | 14,898 | 410 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : arbor_analyzer.py
# Author : Yufeng Liu
# Date : 2022-10-13
# Description :
#
#================... |
d269e3bf567b2afdf6387f881dd0cb11de1c7a4eb1bdd669affa2b117871c183 | Python | 14,902 | 388 | import torch
from torch import nn
from torch.nn import functional as F
import functools
import torch.nn.functional as F
from torch_geometric.nn import MessagePassing
from torch_scatter import scatter_add
def tuple_sum(*args):
'''
Sums any number of tuples (s, V) elementwise.
'''
return tuple(map(sum,... |
3ce27ab7c33009fabc556c805f604c4e4ec470fe03f1ee533ade64af65ee27ec | Python | 14,903 | 247 | from __future__ import print_function
import time
from pddlstream.algorithms.algorithm import parse_problem
from pddlstream.algorithms.common import SolutionStore
from pddlstream.algorithms.constraints import PlanConstraints
from pddlstream.algorithms.disabled import push_disabled, reenable_disabled, process_stream_p... |
2104beefc2eec254fb01143b14b89856d03cecf1fb698d1951e0c5c0cbf4a59f | Python | 14,905 | 420 | # 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.
import re
import urllib
import warnings
from argparse import Namespace
from pathlib import Path
import torch
import esm
from esm.model.esm2 ... |
376bc87fcbcbc8a030be6b7c0d3b08b8aead7164d9816fe90b311238b14d08c4 | Python | 14,905 | 320 | """
Unlike train_xgb.py, which trains xgb models for Subsections 3.2.1-3.2.4,
this file serves to train a selection of xgb_lr0.1 models for Subsection 3.2.5
with 8 inputs and sample sizes 12, 25, 50, 100.
The general structure of both files is relatively similar,
with small differences in model variants and iterated pa... |
f321cb7d4c1b531ea4146a524d5e05ca1afbdb95ee29d68c1e60c48be843ab4e | Python | 14,906 | 382 | import re
import math
import collections
from functools import partial
import torch
from torch import nn
from torch.nn import functional as F
from torch.utils import model_zoo
GlobalParams = collections.namedtuple('GlobalParams', [
'batch_norm_momentum', 'batch_norm_epsilon', 'dropout_rate',
'num_classes', '... |
aa26584bf64c379ef4faef003ca9feb2c119e80fc3e2ddf917ed04eed390b723 | Python | 14,911 | 404 | """Inception V3 model for Keras.
Note that the input image format for this model is different than for
the VGG16 and ResNet models (299x299 instead of 224x224),
and that the input preprocessing function is also different (same as Xception).
# Reference
- [Rethinking the Inception Architecture for Computer Vision](
... |
41e9aff826f39a6191949e614ba18e7bef8d4f4cb820a5ed3033533470591e72 | Python | 14,914 | 263 | """Model profiles, substrate switching and adjustable coupling layers (random tiny weights)."""
import gc
import json
import weakref
from types import SimpleNamespace
import numpy as np
import pytest
import torch
from transformers import Qwen3Config, Qwen3ForCausalLM
from conftest import TestTokenizer, assert_no_hook... |
8edc92619d181c50856e06460519f16c5e07369dcf060702923985a05966d9fd | Python | 14,919 | 362 | import matplotlib
matplotlib.rcParams['figure.facecolor'] = '1.'
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import nibabel as nib
import re
import os
import ants
import argparse
import pandas as pd
import skimage.transform as skTrans
import csv
from skimage.morphology import dilation, ero... |
582f439949ae27b1bfd74e7336cad8fa715e62458802fb6a67a37d153a5c351b | Python | 14,920 | 399 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import sys
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.experiment import ARGPARSER
from lab.reports import Table
from lab.steps import Step
from downward.experiments import DownwardExperiment, _get_rev_nick
from downward.c... |
60b7d5e655b05cdd7aaa8497e77af40448742065bcc97a3fb69383a5ee796b8d | Python | 14,921 | 321 | """
toposampling - Topology-assisted sampling and analysis of activity data
Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation... |
2095075e4a39b474998535c789c632ee7aefc17a376e5128be64b2f1698ddc0e | Python | 14,923 | 427 | import random
import numpy as np
from dreamcoder.domains.arc.arcPrimitives import ArcExample
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
def make_map_task2(num_colors=7):
def sample(i, j, k):
return np.array([[i,j,k],[i,j,k],[i,j,k]])
def sample_easy... |
8f7d5522565f852b3b8a480e373853a99c390072ca5524f7d9bfdaa0fe4389ce | Python | 14,924 | 421 | # 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... |
9202f6beb0ea5c956828ec1367c4141ad1ccd341dfc8a898fe503d56964496a6 | Python | 14,926 | 346 | """Models to estimate cumulative event models."""
from typing import Any
from warnings import warn
import numpy as np
import xarray as xr
from hmp.basedata import BaseData
from hmp.crossvalidation.pseudo_kfold import KFoldCV
from hmp.models.base import BaseModel
from hmp.models.event import EventModel
from hmp.patte... |
853881b538ab3f6f8ed692c5935f06780459d174396c6335c89fb47827154cd3 | Python | 14,929 | 431 | """Analysis and export convenience functions.
"""
from logging import getLogger
from itertools import compress
from csv import writer
from numpy import (amax, amin, asarray, concatenate, in1d, mean, negative, ptp,
reshape, sqrt, square)
try:
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets... |
c5c2305dccee7e4432b5fee848dbe8111422d9cab3e2e034fe60c39ec96dea44 | Python | 14,931 | 325 | """Headless lifecycle and signal checks; fixtures never enter user anatomy caches."""
from __future__ import annotations
import os
import hashlib
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import sys
import types
from pathlib import Path
from types import SimpleNamespace
import numpy as np
import pandas as... |
bd8335dd607afe535c2347f2e4c0bf6b7a0a12bd43a28104b4b19c2da0e3ce50 | Python | 14,933 | 534 | ### Modules
import pysam, numba
import pandas as pd, numpy as np, ruptures as rpt
### Config
TraceThres = 5 # adhoc threshold to restrict change point
TraceThresDiff = 1 # adhoc threshold to restrict change point
penalty_value = 100 # beta
SEGMENT_FROM_BASECALLER = 1
SEGMENT_FROM_CHANGE_POINT = 2
SEGMENT_ALL = 3
L... |
1a73570dce4cadb8c261432ad4e9575f6d5be42b2bbd325c122dd979a17805ec | Python | 14,934 | 433 | # regex.py
import regex
import dnaio
from itertools import islice, repeat
from multiprocessing import Pool, cpu_count
from fba.utils import open_by_suffix, get_logger
logger = get_logger(logger_name=__name__)
def compile_regex_ref_barcodes_exact(barcodes):
"""Compiles a regular expression pattern, returning a ... |
2bb3956660cb5fd6e1a1c33c861a42a01e2095b6d9dfe72e155fe70fa6f9d0fb | Python | 14,936 | 435 | """
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Atchuth Naveen
Code developed at UC Irvine.
Optimized Laplacian matrix construction for 1D, 2D, and 3D spaces
with Dirichlet boundary conditions.
Uses boolean masking instead of np.delete, arithmetic index computation
instead of meshgrid, and scipy.sparse.di... |
6132cdf0644d482e69d2a0a73002ba4b2ca9299eb4e541a11f35eb63c71bcbf5 | Python | 14,944 | 387 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Test case for pyparser."""
import os
import re
import textwrap
import tokenize
import pyparser
def _make_tuple(op):
return lambda x: (op, x)
NL = tokenize.NL
NEWLINE = tokenize.NEWLINE
NAME = _make_tuple(tokenize.NAME)
OP = _make_tuple(tokenize.OP)
INDENT = toke... |
96ea6d86d328d92cd81f5d90e9a7a08c9221bd92a5893d10f569f09ceb5e1256 | Python | 14,947 | 494 | """
Combinators and related utilities for operating on CCG syntactic types and
semantic forms.
"""
from abc import ABCMeta, abstractmethod
from copy import deepcopy
import itertools
from nltk.ccg.api import FunctionalCategory, PrimitiveCategory
from six import add_metaclass
from pyccg import logic as l
@add_metacl... |
0816d2de05f47561480ded7bfa7f0f9e00fae3938219b8b5763e0f8ae860d160 | Python | 14,949 | 352 | import torch
import random
import numpy as np
from itertools import compress
from rdkit.Chem.Scaffolds import MurckoScaffold
from collections import defaultdict
from sklearn.model_selection import StratifiedKFold
# splitter function
def generate_scaffold(smiles, include_chirality=False):
"""
Obtain Bemis-Murc... |
f0caef3406c76ed0c5a44b3c7f054e48566f5c41d37ec883d76e2eea412affb3 | Python | 14,950 | 333 | import networkx as nx
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import torch
import os
import random
import gzip
from sklearn.decomposition import PCA
def getSTRING( cutoff = 700 ):
"""
Create network from STRING using a prespecified cutoff.
"""
# Read raw STRING PPI data
... |
1e2a7114d4fb219d74bd1b644778d98fe3215b2551c19bf0bb3eea6db4431556 | Python | 14,953 | 375 | """Testing CLI command repair."""
import os
import subprocess
def test_transpose(tmp_path):
"""Tests for changing location."""
os.chdir(os.path.dirname(__file__) + '/data')
proc = subprocess.Popen(['swc', 'repair', 'pass_simple_branch.swc',
'-t', '2', '2', '2',
... |
6d01a3ed0bcc5d62bf7293dc83dd12b55cbcf4e012ea1d967e9a63d98f6c9fd5 | Python | 14,957 | 427 | import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib import animation
import numpy as np
from scipy import optimize
import os
import ROOT
point1 = [5, 20]
point2 = [45, 20]
x_values = [point1[0], point2[0]]
y_values = [point1[1], point2[1]]
class Plot2D:
def __init__... |
a901fd3071985c7c3c50926e56feffc3dd644bd99c0b0da703dcb79cc74ebb17 | Python | 14,957 | 409 | """PyQt5 launch dialog for the Manual Contour Registration tool.
Provides a file-picker GUI for selecting volumes and parameters, then
launches the matplotlib-based contour correspondence viewer.
"""
import os
import sys
# Ensure project root is on sys.path
from regtools import get_project_root
_PROJECT... |
d944ebaaee0bf54512227fe5244a9a979dba1f6d040cfc581e45bfcb95f4bbe6 | Python | 14,960 | 367 | """Inception-ResNet V2 model for Keras.
Model naming and structure follows TF-slim implementation
(which has some additional layers and different number of
filters from the original arXiv paper):
https://github.com/tensorflow/models/blob/master/research/slim/nets/inception_resnet_v2.py
Pre-trained ImageNet weights ar... |
e744983a70b010cab8fdd6da2806714e4a139cad65f277e2a88be1abce0eda6d | Python | 14,960 | 281 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
import sys
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.camera as camera
import control.core as core
impor... |
f9a7f3d9bc6906edf319deb3d5ca149f9d73c53e010093ef5a715ac4a0defeb2 | Python | 14,967 | 334 | #### 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... |
ae72a943f6e9778a3adde43b8a6860244ff063ed56626e7738e129fc42c53a71 | Python | 14,970 | 335 | from matplotlib.cm import get_cmap
from IPython import embed
import sys
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
from clean_data import clean_transfer_data
import os
from os.path import exists
connected = np.array([[0,1,0,1,0,0,0],
[1,0,1,0,1,0,0],
... |
7cc288c38de7c912c78eca103cca2797382957e1d3fb14b3f7df632aa705201b | Python | 14,974 | 310 | import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
import warnings
warnings.simplefilter("ignore")
import time
import tqdm
import util
import pprint
import random
import torch
import scipy.stats
import numpy as np
import pandas as pd
from datetime import datetime
from torc... |
fa18c911d5ec161a16777ecde65862e3a0e77f77357740e146b5cb2150901672 | Python | 14,974 | 490 | import pandas as pd
import datetime
import os
import sys
import subprocess
version = '1.0'
sample = snakemake.wildcards.sample
folder = snakemake.wildcards.folder
sys.stdout = open("{}/{}/Console_outputs/SV_VCF_harmonization.{}.log".format(folder, sample, sample), 'w')
sys.stderr = sys.stdout
currentDat... |
611314c9a646160ea0376ff89f5810c3c5d2feaa23e45366803fd59607c74332 | Python | 14,978 | 426 | import os
import os.path as op
from functools import reduce
import numpy as np
import mne
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.decomposition import PCA
from utils import load_raw, load_df, bipolar_reference, compute_tfr
from pa... |
b2220aa40ff611df9683b7296642bf06830130ca3d545599c26191e4182ddb38 | Python | 14,979 | 384 | """
Script for reconstructing particles RELION compatible from full reconstructed tomograms
Input: - STAR file with next columns:
'_rlnMicrographName': tomogram that will be used for reconstruction
'_rlnImageName': tomograms used for picking
'_rlnCtfImage': (op... |
8eeec20c23cd2fc1fe4126864b54eb57644447e3d6d3c7f8318872e533a64288 | Python | 14,980 | 356 | # Copyright (c) 2019 Mwiza Kunda
# Copyright (C) 2017 Sarah Parisot <s.parisot@imperial.ac.uk>, Sofia Ira Ktena <ira.ktena@imperial.ac.uk>
#
# 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 Free Software Foundation, eithe... |
18d2e12a628968844c77084e54543001fd83cdd742e122416f347a89aea8fd2f | Python | 14,982 | 364 |
"""
MoCHI report module
"""
from loguru import logger
import os
import torch
from torch import Tensor
from pymochi.data import *
import shutil
from matplotlib import pyplot as plt
import seaborn as sns
from matplotlib.colors import LinearSegmentedColormap
class MochiReport:
"""
A class for generating reports... |
e0a72941995af1425a00bdb3f55f4ffd5c96d748bab6040db3ff380874105d07 | Python | 14,987 | 390 | from typing import Optional
from netket.stats import Stats
from netket.driver.abstract_variational_driver import AbstractVariationalDriver
from netket.callbacks import ConvergenceStopping
import numpy as np
from netket.optimizer import (
identity_preconditioner,
PreconditionerT,
)
import copy
from typing impor... |
8175408ddd77beddb17abe25983e36f4b02ab54ac1299fe3210193157740846f | Python | 14,994 | 303 | 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 SEEDFeatureDataset(BaseDataset):
r'''
The SJTU Emotion EEG Dataset (SEED), is a collection of EEG datasets pro... |
35a2afd8aed79522949484a1a61fecc0218114c787b22259d0ea7e4a86abb2f1 | Python | 14,995 | 571 | from __future__ import annotations
from math import ceil
from pathlib import Path
from typing import Sequence
import matplotlib.patheffects as path_effects
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
from matplotlib.path import Path as MplPath
from matplo... |
e0a73189fd5d5bc558411c143d9bcb60d979f0f8ac24980dd6ca501c6d76a226 | Python | 14,997 | 389 | from functools import partial
from glob import glob
from distutils.util import convert_path
import distutils.command.build_py as orig
import os
import fnmatch
import textwrap
import io
import distutils.errors
import itertools
import stat
from pathlib import Path
from typing import Dict, Iterable, Iterator, List, Option... |
b08151c92a108c00146f4adffc0fc06694f6815cee532cbeed08a30c4ce8ed09 | Python | 15,001 | 293 | import os
import re
from typing import Any, Callable, Dict, Tuple, Union
import numpy as np
import scipy.io as scio
from torcheeg.io import EEGSignalIO, MetaInfoIO
from ...constants.emotion_recognition.seed_iv import (
SEED_IV_ADJACENCY_MATRIX, SEED_IV_CHANNEL_LOCATION_DICT)
from ..base_dataset import BaseDatase... |
5d82442a0a5d7774d161a9ca4ec263d5edcf31efdf49b5f25a206fa0598ab6ec | Python | 15,005 | 379 | import os
import sys
import copy
import numpy as np
import matplotlib.pyplot
import matplotlib.ticker
import matplotlib.cm
import matplotlib.colors
import util_stimuli
def get_color_list(num_colors, cmap_name='Accent'):
'''
Helper function returns list of colors for plotting.
'''
if isinstance(cmap_n... |
2b834ef0e848cced481d7e760f31404079b2aa89e521462738db57d409ef9dcc | Python | 15,010 | 352 | # 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... |
be116cb9e0d28413713e1d2f83e2ff4acdc8a523dc3e593063e8d5d05a4d8acf | Python | 15,014 | 385 | """
Script for reconstructing particles RELION compatible from full reconstructed tomograms
Input: - STAR file with next columns:
'_rlnMicrographName': tomogram that will be used for reconstruction
'_rlnImageName': tomograms used for picking
'_rlnCtfImage': (op... |
cf4dae3df1188644aa8b46990d2b3a63ddab7728303b12ad62af7a5be7327189 | Python | 15,014 | 426 | from typing import Optional, Tuple, Type, List
import logging
import numpy as np
from scipy.linalg import eigh
from scipy.optimize import brentq
logger = logging.getLogger(__name__)
from sella.linalg import ApproximateHessian
def _eigh_symmetric(
A: np.ndarray,
sym_rtol: float = 1e-10,
) -> Tuple[np.ndarra... |
507701ec7065b95163d60dda02a3c12a15dc51742d576d9863d22b7f3a0c9f28 | Python | 15,032 | 658 | import sys
import json
from textwrap import dedent
from pathlib import Path
import subprocess as sp
ex3_template = dedent(
"""#!/bin/bash
#SBATCH --job-name="{job_name}"
#SBATCH --partition={partition}
#SBATCH --time=6-00:00:00
#SBATCH --ntasks={ntasks}
#SBATCH --output=%j-%x-stdout.txt
#SBATCH --error=%j-%x-stder... |
7a32b7161644ff2cfc274ce7157d175e52a6f550edb734a8200720d7cf7b2794 | Python | 15,036 | 367 | """Utility functions for HED ID assignment and validation.
This module handles HED ID ranges, validation, and assignment for schema elements.
For ontology/OMN conversion functionality, see the hed-ontology repository.
"""
import pandas as pd
from hed.errors.exceptions import HedExceptions, HedFileError
from hed.sche... |
ff552488ea2a525792a5955158d0ecfde554ac98eb1427dfd36c6c9bae130377 | Python | 15,041 | 184 | import keras
from keras.preprocessing import sequence
import numpy as np
from matplotlib import pyplot as plt
import sys
import json
from random import shuffle
from gzip import GzipFile as gz
from sklearn.neighbors import NearestNeighbors
#model magic below. just a json string that specifies model structure
json_str ... |
aa50636f25800a1f0bba68b219d21224503caa1f769521417eec79e7869394e1 | Python | 15,042 | 377 | """Generate the node documentation: GUI pages and the quartodoc API structure.
The .blend asset file is the source of truth: every node group marked as an
asset in `molecularnodes/assets/nodes.blend` (built from the sources in
`molecularnodes/nodes/`) is documented, grouped
by its asset catalog (the same grouping the ... |
a388676bbc543fb8b6f7510aa706c66563562450db70dd3d99ea88c5d2117765 | Python | 15,043 | 450 | import math
from collections import defaultdict
from flask import url_for
from codex.blueprints.base import render_template
from codex.data.brain_regions import neuropil_description, lookup_neuropil_set
from codex.utils.formatting import shorten_and_concat_labels, display
INPUT_NEUROPIL_COLOR = "#97c2fc"
OUTPUT_NEU... |
8590d25b274eeb0aa3f99daae4b5ed4d95e46b242d026dc3cde89cfec6f629b0 | Python | 15,044 | 428 | """Whole slide transformer model.
Copyright (c) 2024 University of Michigan. All rights reserved.
Licensed under the MIT License. See LICENSE for license information.
"""
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
from functools import partial
from typing import List, Optiona... |
3054f01718274050dacafc032a636702956d0d9b794167ed07e391d38028ca2d | Python | 15,052 | 312 | import time
import numpy as np
from .structure import Structure, load_structure
from .lcaodata import LCAOData
from .hrdata import read_hrr, read_vloc, constructH
from .deephio import save_structure_deeph, save_mat_deeph, get_mat0
from .utils import mpi_watch, simple_timer, is_master, comm, slice_same
from .twocenter ... |
d2b509c6926f3754cd94149c7d807635b1463b53efec178c270cefaa456a9db6 | Python | 15,053 | 556 | import functools
import time
import inspect
import collections
import types
import itertools
import warnings
import setuptools.extern.more_itertools
from typing import Callable, TypeVar
CallableT = TypeVar("CallableT", bound=Callable[..., object])
def compose(*funcs):
"""
Compose any number of unary funct... |
820ba97e3ced2f246d364e294b626a56b1f7956517f906c4df0cf93f220a6561 | Python | 15,056 | 556 | import functools
import time
import inspect
import collections
import types
import itertools
import warnings
import pkg_resources.extern.more_itertools
from typing import Callable, TypeVar
CallableT = TypeVar("CallableT", bound=Callable[..., object])
def compose(*funcs):
"""
Compose any number of unary fu... |
c504a2db6a9c23377293eb7ab8975d4194b383e7a8d44992a503adfdc28b4a1c | Python | 15,063 | 493 | """Core recipes for VASP."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Literal
import numpy as np
from monty.os.path import zpath
from pymatgen.io.vasp import Vasprun
from quacc import flow, job
from quacc.recipes.vasp._base import (
run_and_summarize,
run... |
2dad573d62023b461d492e9ba40b7b03153fe9bc0e9dce3d811a2618a6a5801f | Python | 15,076 | 474 | 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
from subprocess import CalledP... |
c355761faadd97262cc42c0487154d5c359885b129e02fdcbef2b2eb9f60a28c | Python | 15,078 | 422 | """
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 torch
import torch.nn as nn
def get_... |
8f30d43aeb3eb597d3073a0c80cfe693cbd1ad2a1f899226759f1011868cc8ae | Python | 15,082 | 445 | from __future__ import annotations
import glob
import os
from logging import WARNING, getLogger
from pathlib import Path
from shutil import rmtree
import numpy as np
import pytest
@pytest.fixture(scope="module", autouse=True)
def set_seed():
np.random.seed(42) # noqa: NPY002
from ase import Atoms
from ase.bu... |
963ed64fa6e6b118fdcdc11224f4dfe7c40f703cd3df635edf4c7858f1cd35c4 | Python | 15,097 | 407 | from dreamcoder.task import Task, EvaluationTimeout
import gc
from dreamcoder.utilities import *
from collections import Counter
import math
from dreamcoder.domains.regex.groundtruthRegexes import gt_dict
gt_dict = {"Data column no. "+str(num): r_str for num, r_str in gt_dict.items()}
class AllOrNothingLikelihoodMod... |
259936233aab5c2b66ab00d553aa7fb49fc1b87746f7e6b8d38c48f45744f9a8 | Python | 15,100 | 421 | import json
import logging
from abc import ABCMeta
from io import BytesIO
from pathlib import Path
import numpy as np
from biotite.file import File, InvalidFileError
from biotite.structure import AtomArray, AtomArrayStack, BondType, filter
from ... import color
from ...assets import data
from ...utils import count_valu... |
3c254ec03be1050ce87a8df95fa195bd8c57022b2c379dfcd94f776ed5dc7d55 | Python | 15,107 | 412 | import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import loadmat
def get_data(sub_dir, recorded_eye=1):
"""
Find and load eye-tracking data
Parameters
----------
sub_dir : str
directory where .mat file is located
recorded_eye : int
column of data t... |
f48af6b417be886b90ed3cbca0eebe189ce1cca3eb04764d9aa185049d72d371 | Python | 15,108 | 442 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 26 13:05:23 2021
@author: joaquin
"""
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import scipy.io
import pandas as pd
import os
import h5py
import mat73
from scipy import signal
from scipy import stats
from sklearn.dec... |
03a0f0aff8f4b423b2758fd390b1638e0414ba0aae5bbedf98dd04843f6bfed5 | Python | 15,111 | 391 | # from dataset.SyntheticDataset import SyntheticDataset
from dataset.GraphDataset import GraphDataset
# from dataset.LinkNodeDataset import LinkNodeDataset
from data.MEG.get_data import preprocess, get_average_data
# from data.MEG.get_data_linknode import preprocess as preprocess_linknode
from torch.utils.data import D... |
5728292b22d9171edc0881f0d7c86fba2a108d450ed0f6f67c6f8f6693e9c586 | Python | 15,111 | 385 | """
Class Ball provides methods for crating and manipulating n-dimensional balls
(filled spheres), in addition to methods defined in its base class Segment.
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from __fu... |
dcbcc6348418d4c87e2904c4c8f1dccbf17afe222d77bb2b5435e5782ebb17d9 | Python | 15,115 | 321 | """
Script for extracting particles from a filament network in a single membrane graph
Input: - A STAR file with a list of graphs (MbGraphMCF) as it is returned by
by mb_fils_network.py script:
+ Density map tomogram
+ Segmentation tomogram
+ MbGraphMCF... |
337d3d8de9cf6a47305ccf9327abfc479df30adc8ccd60e41d221a3f200ed684 | Python | 15,122 | 321 | """
Script for extracting particles from a filament network in a single membrane graph
Input: - A STAR file with a list of graphs (MbGraphMCF) as it is returned by
by mb_fils_network.py script:
+ Density map tomogram
+ Segmentation tomogram
+ MbGraphMCF... |
681ceebdecd28c9d095ac0191652c80e76d9be58e915c8346fac236c0103ff3c | Python | 15,128 | 450 | import os
import numpy as np
import torch
import h5py
from PIL import Image
from torchvision import transforms
from torch.utils.data import Dataset, DataLoader
from utils.output_region_utils import make_circ
from utils.optics_utils import gaussian_beamlets
def get_input_mask(mask_params,N):
if(mask_para... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.