sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1f63ef5a65ad3538fb13feee38e048d159c978453220b351f14de710d9b1fcfa | Python | 723 | 19 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
46bdd7db2947d9f8f33e5b941ff391d80bf40910366492bedfc0f4e1c45d9cd8 | Python | 724 | 23 | """
Set the threshold between Up and Down states to a fixed value.
"""
import numpy as np
import argparse
from utils.io_utils import load_neo
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?', type=str, required=True,
help="path to input data in neo format")
CLI.add_argument("--... |
dd0592f011cbf335edf48755a7b07956e69477c2aa789c53811c7e3734dadc58 | Python | 724 | 23 | import geomstats.backend as gs
from geomstats.geometry.matrices import Matrices
from geomstats.test.data import TestData
rand = gs.random.rand
class AgainstScipyTestData(TestData):
def _logm_expm_data(self, func_name="linalg.logm"):
arrays = [
Matrices.to_diagonal(rand(3, 3)),
# T... |
f76a4638a5a634101e30f8e86eafa7af9b1dcf090f038dd27eca20f2d6cc9fba | Python | 725 | 25 |
from PyQt5.QtCore import pyqtRemoveInputHook, pyqtRestoreInputHook
class SleepyDebug:
"""Due to issues with debugging with pdb in PyQt5 (https://stackoverflow.com/questions/1736015/debugging-a-pyqt4-app),
this class provides a tool to debug the sleepy application. The idea is to
open the application... |
bbdaaa747d736dc81dc3fb7a9c6c80702b27849b929fdc921fc00fb93cddcaab | Python | 726 | 27 | import os
from pathlib import Path
from setuptools import setup
from setuptools.command.build import build
class Build(build):
"""Custom build for setuptools to compile C++ shared libraries."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def run(self):
self.bu... |
35ee0e7a95ecfd58d7a67901b3202546744719fe7307d017288b99ab4ba4a363 | Python | 727 | 26 | """A dataclass to hold results from a scoring component calculation."""
__all__ = ["TransformResults", "ScoreResults"]
from dataclasses import dataclass
from typing import List, Dict
import numpy as np
from reinvent_plugins.components.component_results import ComponentResults
@dataclass(frozen=True)
class Transfor... |
84b78eebedbf1c2abd5852de3fe5da0dc50946bc0f4f3a4294914addd8c236d3 | Python | 727 | 22 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from typing import List
import torch
def get_accelerators() -> List[str]:
"""Return available accelerator device types in priority order."""
accelerators: List[str] = []
if torch.cuda.is_... |
a76d9d253ec46c552f40643f4f7f84152456d53f4d0f1abed6031215e765df89 | Python | 727 | 19 | # Copyright (c) 2023 PaddlePaddle 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
#
# Un... |
c2d98a7bed18fd9534ddcdfd78e078521adf69d6fb85f6e4a19e658d0aab77cc | Python | 727 | 27 | """Defines a work package for staged learning
Stores parameters that change for each stage,
"""
from __future__ import annotations
__all__ = ["WorkPackage"]
from dataclasses import dataclass
from typing import Callable, TYPE_CHECKING
if TYPE_CHECKING:
from reinvent.runmodes.RL.reward import RLReward
from re... |
4f60a8cfc1bca434953aef08c1299a55b6a881028a90f7f866a217a2c24dc8f9 | Python | 728 | 20 | from PymoNNto.Exploration.Evolution.Evolution import *
if __name__ == '__main__':
genome = {'a': 1, 'b': 2, 'c': 2, 'd': 2, 'e':3}
evo = Evolution(name='my_test_evo',
slave_file='example_slave.py', #Exploration/Evolution/
individual_count=10,
mutatio... |
2a3fd034eef6137ba45247788bf21fca29ae0314bd4941c1ca79162e4d7a7882 | Python | 730 | 27 | #!/usr/bin/env python3
import os
text = """<!--- DO NOT EDIT THIS FILE. Generated by [[GEN]]-->
# Poisson
```
./run
```
"""
outdir = "out_poisson"
text += "Output directory `[[OUTDIR]]`:\n"
text += "* [`train.log`]([[EXAMPLES]]/[[OUTDIR]]/train.log)\n"
text += "* [`train.csv`]([[EXAMPLES]]/[[OUTDIR]]/train.csv)\n"
... |
17050d0163c5d690717fef5e1cec9a88ff1e27813b398092380fc45379aab0f7 | Python | 733 | 19 | import unittest
from reinvent.models import Mol2MolAdapter, SampledSequencesDTO
from tests.test_data import ETHANE, HEXANE, PROPANE, BUTANE
from tests.models.unit_tests.mol2mol.fixtures import mocked_mol2mol_model
class TestLikelihoodSMILES(unittest.TestCase):
def setUp(self):
dto1 = SampledSequencesDTO(... |
30fbca532a0aa0067bddb20d7933f878de502a1bc40837b35323f1b6a57b7284 | Python | 733 | 26 | import setuptools
from pathlib import Path
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="MENDER",
version="1.0",
author="Zhiyuan Yuan",
author_email="zhiyuan@fudan.edu.cn",
description="TBD",
long_description=long_description,
long_description_... |
1da08981d8f69e495e98c937d4d8bbaed21008ef99752741ff4820612ea8cea0 | Python | 736 | 29 | from .run_multiPatKOP import run_multiPatKOP
from .run_multiPatLEiDA import run_multiPatLEiDA
from .doKuramoto import doKuramoto
from .get_LEiDA import get_LEiDA
from .butter_bandpass_filter import butter_bandpass_filter
from .butter_design import butter_design
from .doEuclid import doEuclid
from .doHilbert import doHi... |
2ce812be97eb81586dddf81ee5b7d68edf5952b58b41135d19e4226e48f18cc7 | Python | 741 | 27 | from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Embedding
from keras.layers import Conv1D, GlobalMaxPooling1D
from keras import optimizers
max_features = 32
embedding_size = 64
filters = 330
kernel_size = 16
hidden_dims = 128
... |
b2446a67d255bee69d7f102041e3f26317695ebf7a7139e6fed3796ab29064fd | Python | 742 | 31 | import torch
import predictive_coding as pc
class StudentNet(torch.nn.Module):
def __init__(self, predictive_coding, student_net_hidden_size):
super(StudentNet, self).__init__()
self.predictive_coding = predictive_coding
self.fc1 = torch.nn.Linear(2, student_ne... |
afe137a82db9607115031707e934a76164f2271b8fa65bd80f3cad468e6427ed | Python | 743 | 30 | ## IMPORT BASIC LIBS FOR SCRIPT
import scipy as sc
import scipy.io
import numpy as np
import dynfc as dyn
import pickle
from sys import argv
## LOADING MATLAB FILE AND BOLD SIGNAL + PMA FOR ALL SUBS
mat = sc.io.loadmat('../data/2020_07_MASTER_connectomes90_All_select.mat',
squeeze_me = True)
RSsig = mat['meanBOL... |
a210bb7af84a03833de44b373451e8d1f2e835166598f87cc54923cb617a4501 | Python | 744 | 24 | """
Set the threshold between Up and Down states to a fixed value.
"""
import numpy as np
import argparse
from utils.io_utils import load_neo
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?', type=str, required=True,
help="path to input data in neo format")
CLI.add_argument("--out... |
58e34e66195e06cf6362b39704fdf087770dd6c500a8d852b6138e820da4c79f | Python | 745 | 24 | # -*- coding: utf-8 -*-
import numpy as np
import scipy.io as io
from neuron import h
def vec_inject(dt,tstop,peak_injection,steps,plot=0):
steps =np.cumsum(np.array(steps))
time_vec = np.arange(0,tstop,dt)
v_inj = np.zeros(time_vec.shape)
time_rise = time_vec[np.bitwise_and(time_vec>steps[0],time_v... |
910bf668b68b6bfb6913e85b6e7173970d96bbd4c79ac1c94ea84a2958bf3c4d | Python | 745 | 31 | ## IMPORT BASIC LIBS FOR SCRIPT
import scipy as sc
import scipy.io
import numpy as np
import dynfc as dyn
import pickle
from sys import argv
## LOADING MATLAB FILE AND BOLD SIGNAL + PMA FOR ALL SUBS
mat = sc.io.loadmat('../data/2020_07_MASTER_connectomes90_All_select.mat',
squeeze_me = True)
RSsig = mat['meanBOL... |
33f7095e8437224f7dadbf97630738c79b0411d3b505b6744266489bfb47cdef | Python | 746 | 19 | from geomstats.test_cases.geometry.base import ComplexMatrixVectorSpaceTestCase
class ComplexMatricesTestCase(ComplexMatrixVectorSpaceTestCase):
def test_transconjugate(self, mat, expected, atol):
res = self.space.transconjugate(mat)
self.assertAllClose(res, expected, atol=atol)
def test_is_h... |
895257ca71b59e1763897d741a6e4801c3de67b82d622a58e815675c9f897a1a | Python | 747 | 22 | import os, sys
#from smithers.dataset.abstract_dataset import AbstractDataset
import smithers.dataset.abstract_dataset
class DatasetCollector(object):
def search(self):
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'datasets')
for py in [f[:-3] for f in os.listdir(path) if f.en... |
f74f8178ffab4c357946c10a13e0c3753069685151ecd4e7dab7519ccc4027b3 | Python | 748 | 23 | from mysql.connector import connection
import pandas as pd
def query_sql(rna_types):
conn = connection.MySQLConnection(user='rfamro',
host='mysql-rfam-public.ebi.ac.uk',
database='Rfam', port = 4497)
for rna in rna_types:
df = pd.... |
50ecb53e032c2e671231405f49f37b544e387ebaaa0071aecc3168639fbf5f9d | Python | 749 | 37 | #!/usr/bin/env python3
"""Helper script used to remove the bundled examples from the DocBook files
that are used to generate the PDF documentation.
This file is part of the documentation build process. You do not need to call
it manually.
"""
import sys
from xml.etree.ElementTree import ElementTree
def usage():
... |
e2c0ca72baadcd5f5c297fcae798305b0ed4dfd900167c4a19877ed5ada73e83 | Python | 750 | 21 | from setuptools import setup
setup(
name="pycircstat",
version="0.0.2",
author="Fabian Sinz, Philipp Berens, Matthias Kuemmerer, Tom Wallis",
author_email="philipp.berens@uni-tuebingen.de",
description=("Toolbox for circular statistics with Python"),
# license="MIT",
keywords="statistics",
... |
eda9cd88f728247cd3c7c9ef0dee0f3f92557bf5ffd7e953d2d9040fa71a7af3 | Python | 750 | 22 | """References for the published checkpoints that have to be downloaded.
Not part of ``--target all``: regenerating these fetches the published
releases, and a regeneration that silently reaches the network is one that
behaves differently on a machine that cannot. Ask for it by name when you
mean to refresh a downloade... |
70beff8a9ff0fc30597bd42f59c71c4e1f08215d7ce95af0dcf7e13df7f94b82 | Python | 752 | 24 | from unittest import TestCase
import torch
import torch.nn as nn
from smithers.ml.models.fnn import FNN, training_fnn
class Testfnn(TestCase):
def test_constructor(self):
fnn = FNN(50, 10, 20)
assert isinstance(fnn.model[0], nn.Linear)
self.assertEqual(fnn.n_input, 50)
self.assertEq... |
214e5f11b2dd2c0bd3fb0dbcfcec7f6e1d921f3f4602d66b2768b7b8aafac63c | Python | 753 | 30 | import numpy as np
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
#X = np.array([np.random.rand(1000) for i in range(1000)])
def get_PCA(act, num_sv=100):
num_sv = min([num_sv, len(act)])
pca = PCA(n_components=num_sv)
pca.fit(act)
return pca
def get_activity_singular_values(a... |
8ff62b4dac113ba60fadef68cf36419c05ea480c3ea3f50a5549f617b64463c3 | Python | 753 | 23 | #!/usr/bin/env python3
import sys
# Try using setuptools first, if it's installed
from setuptools import setup, find_packages
if not sys.version_info[0] == 3:
sys.exit("Sorry, Python 3 is required")
# Need to add all dependencies to setup as we go!
setup(name='PyCmdMessenger',
packages=['PyCmdMessenger'],... |
30f8ed4deae84d4213e077753eb89e561fe1884d260cc4b3c0796d4d3275637c | Python | 754 | 37 | """Simple cache for RDKit molecules
Implemented as a decorator.
"""
__all__ = ["molcache"]
from typing import List, Callable
import logging
from rdkit import Chem
logger = logging.getLogger("reinvent")
cache = {}
def molcache(func: Callable):
"""A simple decorator to tag a class"""
def wrapper(self, smi... |
a1298f212c719e7a6073b30f8bd9768544b35883ed33695b5222d83ba5735279 | Python | 754 | 32 |
import unittest
import h5py
import os
from deeprank_gnn.tools.BioWrappers import get_bio_model, get_depth_res, get_depth_contact_res, get_hse
CWD = os.path.dirname(os.path.realpath(__file__))
class TestBioWrappers(unittest.TestCase):
def setUp(self):
self.pdb = f'{CWD}/data/pdb/1ATN/1ATN_1w.pdb'
... |
adcfbda7e20ad7ff3fb6ba66a94b4c3f962c2713f4fdac050119f80843ad1486 | Python | 754 | 30 | #!/usr/bin/env python3
import os
text = """<!--- DO NOT EDIT THIS FILE. Generated by [[GEN]]-->
# Basic
## Fields
```
./fields.py
```
"""
outdir = "out_fields"
text += "Output directory `[[OUTDIR]]`:\n"
text += "* [`train.log`]([[EXAMPLES]]/[[OUTDIR]]/train.log)\n"
text += "* [`train.csv`]([[EXAMPLES]]/[[OUTDIR]]/... |
1df0e9116053d8a6bcd141fe965158adaf7a21add94e77bcc3514c00e37e45c1 | Python | 755 | 23 | from .fileLoader_abf import fileLoader_abf
from .fileLoader_atf import fileLoader_atf
from .fileLoader_sanpy import fileLoader_sanpy
from .fileLoader_nwb import fileLoader_nwb
# from sanpy.config import DO_KYMOGRAPH_ANALYSIS
# if DO_KYMOGRAPH_ANALYSIS:
# from .fileLoader_tif import fileLoader_tif
# from .fil... |
51ff31dc622068ab25f15651551690f303abdf31c00266d64b9cf6edb4dc6593 | Python | 756 | 20 | from abc import ABC, abstractmethod
from reinvent.runmodes.RL.memories.bucket_counter import BucketCounter
class ScaffoldPenalty(ABC):
def __init__(self, scaffold_memory: BucketCounter):
"""Initialize the Penalty class with a specified soft function.
:param soft_function: The type of soft functio... |
606deaf3df11f4809679f91658ea5d0b424c3f0bb77f1ca6888a119040c086a7 | Python | 756 | 29 | import SAUCIE
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
import sklearn.decomposition
import scprep
import sys
data_raw=pd.read_csv('Adult-Brain_Lake_dge.txt',sep=",",header=0,index_col=0)
#pca_op = sklearn.decomposition.PCA(100)
#data = pca_op.fit_transform(data_ra... |
dbface7a87b58c8318a439414518315c936037c587f5b1b2af54942e77b2c523 | Python | 756 | 35 | from PymoNNto import *
import sys
import matplotlib.pyplot as plt
from PyQt5 import QtCore, QtGui, QtWidgets, uic
from PyQt5 import QtCore
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import pyqtgraph as pg
import numpy as np
from PyQt5 import QtCore, QtGui, QtWidgets, uic
from PyQt5.QtCore import Qt
from P... |
4a837cd97bf7926f9b4785ade3ad8abb8d9b417ab7cd310064d8ca24b2999f44 | Python | 757 | 23 | class FilterTypesEnum:
DEFAULT = "default"
NEUTRALIZE_CHARGES = "neutralise_charges"
GET_LARGEST_FRAGMENT = "get_largest_fragment"
REMOVE_HYDROGENS = "remove_hydrogens"
REMOVE_SALTS = "remove_salts"
GENERAL_CLEANUP = "general_cleanup"
UNWANTED_PATTERNS = "unwanted_patterns"
VOCABULARY_FI... |
c73d340b14024e8f8d6bf212449b2f5ddbcc2bc166b7186225710e0e44e9a4fd | Python | 757 | 25 | from argparse import ArgumentParser
from models.lightning_rnn import LITGRU
from models.model_runner import ModelRunner
def main(hparams):
model_runner = ModelRunner(hparams)
model_runner.run_rnn()
if __name__ == '__main__':
# project-wide training arguments, eg
parent_parser = ArgumentParser()
... |
da72c740d7e357c515146a713c17159509f682b3b1e3e8d5955c0fcedf04d90a | Python | 757 | 29 | # flake8: noqa
__submodules__ = ["construct_bids", "filtering", "input_generation", "datasets"]
__ignore__ = ["T_co"]
# <AUTOGEN_INIT>
from snakebids.core.construct_bids import bids, print_boilerplate
from snakebids.core.datasets import BidsComponent, BidsDataset, BidsDatasetDict
from snakebids.core.filtering import ... |
b82c3b0f337e775974bba4657120e3686e1d92098816dfbc2799aa9c972b41fd | Python | 759 | 21 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""OpenFL Component Module."""
from importlib import util
from openfl.component.aggregator.aggregator import Aggregator
from openfl.component.aggregator.straggler_handling import (
CutoffTimePolicy,
PercentagePolicy,
StragglerP... |
c5028fe3f79863b197f935a3ba8e46ef916417f44c8495716162c7a2d392844d | Python | 760 | 31 | """Plot a geodesic on the sphere S2."""
import matplotlib.pyplot as plt
import geomstats.backend as gs
import geomstats.visualization as visualization
from geomstats.geometry.hypersphere import Hypersphere
def main():
"""Plot a geodesic on the sphere."""
space = Hypersphere(dim=2)
initial_point = gs.ar... |
5a01752520a6932dc753684cadb1ed8ae5843b15fe3a5c696b54e940ee6e965c | Python | 761 | 28 | #!/usr/bin/env python
import numpy as np
def get_synb0_phase_encode(in_fname: str, out_fname: str) -> None:
# Read concatenated file
with open(in_fname, "r", encoding="utf-8") as f:
phenc_concat = np.loadtxt(f)
# Update file for synb0 expected input
# If multidimensional, just grab first row
... |
e26d9590e82c79755b8b301e276e7a4f56b4e8a0ff600d48fd283e7225bc1f61 | Python | 761 | 35 | """Convert to kekulized SMILES for the Lilly tools"""
__all__ = ["normalize"]
from typing import List
import logging
from rdkit import Chem
logger = logging.getLogger("reinvent")
def normalize(smilies: List[str]) -> List:
"""Remove annotations from SMILES
:param smilies: list of SMILES strings
"""
... |
e303c54fd66458c2268406abbbfe218646ed5b6eeb35cb2b23e70729d64c4d87 | Python | 761 | 31 | """Shared fixtures for SanPy Zarr export tests."""
from pathlib import Path
import pytest
@pytest.fixture
def small_abf(test_data_dir: Path) -> Path:
"""Return the repository's small multi-sweep, multi-channel ABF fixture.
Args:
test_data_dir: Stable test-only data directory.
Returns:
... |
f4df9e4d038781812069f3689e1007f6d602f441b3cd3abf5a3987674b50edea | Python | 762 | 30 | from .dataframes import *
from .files import *
if __name__ == "__main__":
import os
from pathlib import Path
import numpy as np
from src.data.dataframes import get_cached_df
try:
from src.cells.pv_nrn import get_pv
except ImportError:
print("must be run from `pv-scn1a` direct... |
3ed5b1175baa309519a7b59fd6ddf28034fac848b240999bfe52fb701139783f | Python | 766 | 31 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torch import nn, Tensor
import argparse
from typing import Any, Tuple
class BaseLayer(nn.Module):
"""
Base class for neural network layers
"""
def __init__(self, *args, **kwargs) -> None:
... |
b8a77696ff31553d58d8b4d4ee0834ac9f13ed2aef8dce383190ddfa178480e2 | Python | 766 | 26 | import cv2
from overlay import ObserverOverlay
class BarPlot(ObserverOverlay):
default_params = {
**ObserverOverlay.default_params,
"max_len": 80,
"scale": 2,
}
def obs_apply(self, img, _1, obs_out, _2):
max_len = self.get_config("max_len")
scale = self.get_config(... |
b7002c93ffe2aa7ebfa27645de5233bcfb039e2e969a8fdcec76a17bf86c1f3a | Python | 767 | 35 | """Extract poses by RMSD and CNN affinityo
Finds poses below Gnina's RMSD and keeps the one with the highest CNNaffinity
"""
import sys
from collections import defaultdict
from rdkit import Chem
filename = sys.argv[1]
mols = defaultdict(list)
suppl = Chem.SDMolSupplier(filename)
for mol in suppl:
if mol:
... |
72a0e39236621c91d5e9b9fac8d2823f917cf7d30c09e2e79249057d406c88cc | Python | 770 | 27 | # Generated by Django 4.1.1 on 2022-10-20 12:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('celsus', '0012_remove_author_first_author'),
]
operations = [
migrations.RemoveField(
model_name='author',
name='pro... |
be241c33a6d0bb6cd5d9b2f4a4d583c83f4e1c3fa1b2f2534aba93591c2023c1 | Python | 770 | 26 | import pytest
import os
from bigfeta import jsongz
import shutil
import json
import itertools
dname = os.path.dirname(os.path.abspath(__file__))
TILES = os.path.join(
dname, 'test_files', 'rough_input_tiles.json')
MATCHES = os.path.join(
dname, 'test_files', 'rough_input_matches.json')
@pytest.mark.p... |
bff736bd7693e630b2ad2626de8faa0a7bfd91f40df5e9d84c78742c2f7660d1 | Python | 771 | 25 | """
Set the threshold between Up and Down states to a fixed value.
"""
import numpy as np
import argparse
from pathlib import Path
from utils.io_utils import load_neo
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?', type=Path, required=True,
help="path to input data in neo format... |
afe4bcd7320a1777435e23e39fce3c6b40fb08f0a40940dc4c7c02df2f5a9a53 | Python | 772 | 26 |
from skimage.transform import iradon, iradon_sart
from bm3d import bm3d
from .base import Reconstructor
class IRadonReconstructor(Reconstructor):
def __init__(self, name):
super(IRadonReconstructor, self).__init__(name)
def calc(self, projs, theta):
self.image_r = iradon(projs, theta=theta)... |
5a001015b399f16a32dd232122d1e9ab155a89494edbe44f10fd0c1e0c271346 | Python | 773 | 21 | """Multi-subject functional alignment algorithms.
Algorithms for aligning functional data across subjects:
- **SRM** / **DetSRM**: Shared Response Model (Chen et al. 2015)
- **align**: whole-brain alignment of a group of subjects, by SRM or by
Procrustes-based hyperalignment (Haxby et al. 2011)
- **procrustes** / *... |
8148324829672d2829a0d8e3970713cb54a89820c035bdc5dea6b5e9ce3a6ed9 | Python | 773 | 26 | from __future__ import annotations
import argparse
import warnings
from typing import Any, Mapping
from snakebids.types import InputsConfig
def add_dynamic_args(
parser: argparse.ArgumentParser,
parse_args: Mapping[str, Any],
pybids_inputs: InputsConfig,
) -> None:
"""Do nothing.
Originally add... |
ab824f0e71e1c554ca69347d02bb50bcd36b496b1d33d5e569c7c2e946a58130 | Python | 774 | 31 | from argparse import ArgumentParser
import torch
def main():
parser = ArgumentParser()
parser.add_argument(
"--target_device",
"-t",
help="device to convert to, usually 'cpu' or 'cuda'",
default="cpu",
)
parser.add_argument(
"--output_file",
"-o",
... |
f639247bce679496a4f44e73273c35f39f4a11c9e67c2a106ed85058deae21d1 | Python | 774 | 27 | #%%
from deeperwin.model.ml_orbitals.ml_orbitals import E3PhisNetMatrixBlock
if __name__ == "__main__":
irreps_row = "2x0e+1x1o"
irreps_col = "2x0e+1x1o"
irreps_in = e3nn.tensor_product(irreps_row, irreps_col)
rng, rng1, rng2 = jax.random.split(jax.random.PRNGKey(0), 3)
x = jax.random.normal(rng1,... |
460d072d281f640966af05d38f66cb11f77e184d24c98ba232b54cea127d6fbc | Python | 777 | 19 | from PymoNNto.Exploration.Evolution.Devices.Evolution_Device import *
class Evolution_Device_Single_Thread(Evolution_Device):
def main_loop_update(self):
current_individual = self.parent.get_next_individual()
if current_individual is not None:
#if os.path.isfile(self.parent.slave_fil... |
0686ab8e4738e58824c1d37ea0b345eb8ad38825935cd5c26f38a60e72605666 | Python | 778 | 21 | # Copyright (c) 2019 PaddlePaddle 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
#
# Un... |
299b248c612b829f76d1af95bb3e2503fa94545d913b6537965600e46e4b6903 | Python | 778 | 30 | from infomap import infomap
infomapWrapper = infomap.Infomap("--two-level")
# Add weight as an optional third argument
infomapWrapper.addLink(0, 1)
infomapWrapper.addLink(0, 2)
infomapWrapper.addLink(0, 3)
infomapWrapper.addLink(1, 0)
infomapWrapper.addLink(1, 2)
infomapWrapper.addLink(2, 1)
infomapWrapper.addLink(2,... |
8ed8c345d2d50986ef6a0e2a42ed0164e75ec4298dc88b0f03d2bae8266d80b4 | Python | 778 | 27 | import mazepa
wait_until_done = mazepa.Barrier
Task = mazepa.Task
Executor = mazepa.Executor
scheduler_click_options = mazepa.click_options
parse_scheduler_from_kwargs = mazepa.parse_scheduler_from_kwargs
parse_executor_from_kwargs = mazepa.parse_executor_from_kwargs
class Job(mazepa.Job):
def __init__(self, *kar... |
b3c579b1257f1a350e983f159cb6f3db00aa7f62b36cca0e52628273cd2260f4 | Python | 778 | 31 | from geomstats.test.data import TestData
from ...test_geometry.data.mixins import DistMixinsTestData, GeodesicBVPMixinsTestData
class PointTestData(TestData):
def point_is_equal_to_itself_test_data(self):
return self.generate_random_data()
class PointSetTestData(TestData):
def random_point_belongs_... |
38d965f0461ffda61e2fcb942ae9040bb37c0e2c7ae3b1b20095509c61d59be5 | Python | 779 | 28 | #!/usr/bin/env python3
import os
text = """<!--- DO NOT EDIT THIS FILE. Generated by [[GEN]]-->
# Inferring velocity from tracer
```
./veltracer.py
```
"""
outdir = "out_veltracer"
text += "Output directory `[[OUTDIR]]`:\n"
text += "* [`train.log`]([[EXAMPLES]]/[[OUTDIR]]/train.log)\n"
text += "* [`train.csv`]([[EX... |
3c1eb09098b0ae25fb09ae42e9c1b112d217fbd5cc523bf0188168b0887ce350 | Python | 780 | 16 | from PymoNNto.Exploration.Network_UI.Advanced_Tabs.stdp_buffer_tab import *
from PymoNNto.Exploration.Network_UI.Advanced_Tabs.criticality_tab import *
from PymoNNto.Exploration.Network_UI.Advanced_Tabs.buffer_tab import *
from PymoNNto.Exploration.Network_UI.Advanced_Tabs.scatter_tab import *
from PymoNNto.Exploration... |
6a6c8df6a0809ce47ce8491e48a1996b83e8e6225bc0fba0771dfae834092f6b | Python | 783 | 27 | import tensorflow as tf
import numpy as np
from PIL import Image
from os import sys, path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from crf_rnn_layer import crf_rnn_layer
unaries = tf.expand_dims(tf.Variable(np.array(Image.open('permutohedral_lattice/Images/input.bmp'))/255.0, dtype=tf.flo... |
4f2d61e1325ee909ced9a164d80451a5df9076b1e7beab6e1047929328fb1518 | Python | 784 | 27 | # Generated by Django 2.1 on 2019-07-08 06:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('imagelist', '0002_auto_20180822_1707'),
]
operations = [
migrations.CreateModel(
name='ihclist',
fields=[
... |
8eba5ff2df9a0638ac601134e39caecf8e8b7475788b51f0a7d44947298a85b4 | Python | 786 | 28 | #!/usr/bin/env python3
import os
text = """<!--- DO NOT EDIT THIS FILE. Generated by [[GEN]]-->
# Advection-diffusion with parameters
```
./infer_constant.py
```
"""
outdir = "out_infer_constant"
text += "Output directory `[[OUTDIR]]`:\n"
text += "* [`train.log`]([[EXAMPLES]]/[[OUTDIR]]/train.log)\n"
text += "* [`t... |
921f1ce495fa321a0af24d3e12d55b7e9f65ff3ac6fe0ebdf469dd8d88f9d9d9 | Python | 786 | 28 | # This file is used by test_create_http_client.py to test the initialization
# of an HttpClient class with auth settings.
#
# See https://github.com/chroma-core/chroma/issues/1554
import chromadb
from chromadb.config import Settings
import sys
def main() -> None:
try:
chromadb.HttpClient(
hos... |
54340f8747c0f5fc35fb0de665f4aa5d77f01a7521244142230e02b4298cf849 | Python | 787 | 26 | # Generated by Django 4.1.5 on 2023-02-17 12:13
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('celsus', '0054_datafilte... |
82e909afbc06b0a948efb064be76e6025cd9fadb15b6370b1b709ede895e16af | Python | 787 | 38 | """RDKit SMILES normalizer"""
__all__ = ["normalize"]
from typing import List
import logging
from rdkit import Chem
logger = logging.getLogger("reinvent")
def normalize(smilies: List[str], keep_all: bool=False) -> List:
"""Remove annotations from SMILES
:param smilies: list of SMILES strings
"""
... |
ece9a53c4a015fe330808f8cd137ec9ba765b3049fc1eef0758df57d3a9e2bdf | Python | 787 | 22 | from Bio import SeqIO
import re
import os
def merge(genomeseqs_folder):
alphabets = {'nt': re.compile('^[acgtu]*$', re.I)}
for genome in os.listdir(genomeseqs_folder):
genome_folder = os.path.join(genomeseqs_folder, genome)
for file in os.listdir(genome_folder):
if file.endswith(".... |
90acb29cc8461b78db84bbc3a69b4a817b4e083c3be43fbb54f5666b9a9071ae | Python | 789 | 33 | """Plot a geodesic of SO(3).
SO(3) is equipped with its bi-invariant canonical metric.
"""
import matplotlib.pyplot as plt
import geomstats.backend as gs
import geomstats.visualization as visualization
from geomstats.geometry.special_orthogonal import SpecialOrthogonal
def main():
"""Plot a geodesic on SO(3)."... |
1fa8d2cc415259dcd7e3df8395eebf1070d363d1f1cfb34ef88a130878c4f8d2 | Python | 790 | 24 | # Generated by Django 4.1.1 on 2022-11-04 10:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('celsus', '0020_alter_differentialanalysisdata_comparison_and_more'),
]
operations = [
migrations.AlterField... |
a9367eb701fccb1b771f5102bc88aeec4d68d926698192188933bf58947b3485 | Python | 790 | 25 | from setuptools import Command, find_packages, setup
__lib_name__ = "SGAE"
__lib_version__ = "1.0.0"
__description__ = "Spatial domain deciphering with SGAE"
__url__ = "https://github.com/STOmics/SGAE.git"
__author__ = "Chao Yang"
__author_email__ = "yangchao4@genomics.cn"
__license__ = "MIT"
__keywords__ = [... |
44e626df3fe6b65f4b2b35e4ede4c8ad006619ac990ad3b24e103acd4cb0ea72 | Python | 791 | 37 | from dataclasses import dataclass
from typing import Dict, List
@dataclass
class QueryRelevance:
doc_relevances: Dict[str, Dict[str, int]]
@dataclass
class QueryResultItem:
query_embedding: List[float]
retrieved_corpus_ids: List[str]
retrieved_corpus_text: List[str]
all_scores: List[float]
@datac... |
96eebc57e1ca9beb53c13bd0a482834c77a51ba1e81275769c50711b2f9cc726 | Python | 791 | 24 | """Tests for the read-only file-metadata plugin."""
from typing import Any
import sanpy
from sanpy.interface.plugins.fileMetadataView import FileMetadataView
def test_file_metadata_view_displays_complete_values(qtbot: Any) -> None:
"""Render each metadata field without field-specific formatting.
Args:
... |
1e5b6bd19f11d7f8e9b995b56bfda1252995648f7109b764306393f29801cdbc | Python | 793 | 29 |
from .sanpy_window import SanPyWindow
from .sanpy_app import SanPyApp
from .sanpy_app import main
from .bDetectionWidget import bDetectionWidget
from .bScatterPlotWidget2 import bScatterPlotMainWindow
from .bScatterPlotWidget2 import myTableView as myTableView_tmp # used by fi plugin
from .bExportWidget import bExpo... |
e932571e2959932f06cc3457189d84343bd8b668112ba468d61e13fc92aca9d1 | Python | 793 | 21 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
1ee8b2f2b9f1c51e577c908b2a918c0fb04d34f6cabcfbbaf06da3689beb705f | Python | 794 | 43 | import numpy as _np
from numpy import (
array,
eye,
zeros,
)
atol = 1e-8
rtol = 1e-5
def is_array(x):
return type(x) is _np.ndarray
def to_ndarray(x, to_ndim, axis=0, dtype=None):
x = _np.asarray(x, dtype=dtype)
if x.ndim > to_ndim:
raise ValueError("The ndim cannot be adapted prop... |
aa826c48c41fb6ccb1dfc7c653b62a29bd7eb103b7e536feef1d732619768ad9 | Python | 795 | 29 | # Generated by Django 2.1 on 2018-08-22 07:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('imagelist', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='menu_selection',
fields=[
... |
2ac251fa60cf846a6f075272b312eaedff819ed8519ad9215c40e10df7ee936f | Python | 796 | 20 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
109e27a20412aa556b33b6b4e2f0e3f71deafa1677e19d46695e4a13af78ae6c | Python | 797 | 23 | """Import main modules."""
__version__ = "2.8.0"
import geomstats._backend
import geomstats._logging
import geomstats.geometry.discrete_curves
import geomstats.geometry.euclidean
import geomstats.geometry.hyperbolic
import geomstats.geometry.hypersphere
import geomstats.geometry.invariant_metric
import geomstats.geom... |
3b53898ba5f4470f1c2fcd9dea2e56ea57a1ec891e6e0c9d40038156d5fd54a5 | Python | 797 | 27 | # Generated by Django 4.1.1 on 2022-10-18 10:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('celsus', '0006_author_project_alter_author_created_and_more'),
]
operations = [
migrations.RemoveField(
model_name='differential... |
9a179a29970876683cb3209408a95329a11ca7bac5dd0a6e3aa6dc6c2214a7ae | Python | 797 | 28 | from scipy.signal import hilbert
from numpy import zeros, angle
def doHilbert(N, Tmax, timeseries):
"""Hilbert transform of BOLD signal form all parcels/voxels.
This fuction returns the phase time series for all parcels/voxels
of the input.
Args:
N (int): Number of parcels/voxels of the inpu... |
be34f2805d198b148c91fb4432844da99768bb16fede361330494b4aea09485b | Python | 798 | 20 | import unittest
from reinvent.models.linkinvent.dataset.dataset import Dataset
from reinvent.models.linkinvent.model_vocabulary.model_vocabulary import ModelVocabulary
from tests.test_data import ETHANE, HEXANE, PROPANE, BUTANE
class TestDataset(unittest.TestCase):
def setUp(self) -> None:
self.smiles = ... |
e32a8f61424866d37ef6d4bc615f3771fe913c9e72da6cc5aa9ef2d3ca5ac700 | Python | 799 | 37 | #usage: python find_circular_fast.py contigs.fasta 150 2 contigs
## the last argument is either 'ids' or 'contigs'
import sys
from Bio import SeqIO
try:
import edlib
except:
print("ERROR: PLEASE RUN pip install edlib")
sys.exit(1)
#read_length is 2nd argument; default 150 bp
try:
read_length = int(sys.argv[2]... |
e4870bf5367e0746b7fd1f27bccdd532e4fdeefbb769551ca79d838baba133e3 | Python | 800 | 36 | from numpy import cos
def phDiff(a, b):
"""Cosine of phase difference.
This function estimates the phase difference of the two entries and its cosine.
$$PL = \cos{(a - b)}$$
Args:
a (double): Phase 1 in $\pi$ rad.
b (double): Phase 2 in $\pi$ rad.
Returns:
double: Cosine... |
6719b268c11bc91da46c206835eb9726adbf979029cf5c2799a8bad8d6dcc2cd | Python | 801 | 34 | """Plot a geodesic of SE(3).
SE3 is equipped with its left-invariant canonical metric.
"""
import matplotlib.pyplot as plt
import geomstats.backend as gs
import geomstats.visualization as visualization
from geomstats.geometry.special_euclidean import SpecialEuclidean
def main():
"""Plot a geodesic on SE3."""
... |
a12889f43d893a71ca994d927016d73cbc5056d40e976bf619678f98ca553687 | Python | 801 | 59 | import time as time_p
import sys
sys.path.append('../../')
start_time=time_p.time()
from PymoNNto import *
from matplotlib.pyplot import *
from NetworkBehavior.EulerEquationModules.VariableInitializer import *
from NetworkBehavior.EulerEquationModules.Equation import *
from NetworkBehavior.EulerEquationModules.EulerClo... |
f75fd926c20c679e301c3b2937b60bf673c7d5bd420f8d38bb8763fe6162c47f | Python | 801 | 29 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from .utils import model_builder, override_model_compile_mode
from .modify_utils import modify
from .saved_models import (
ModelFromCheckpoint,
ModelFromPackage,
ModelTypeNamesFromPackage,
)... |
7c05d0655a90ce59368f2b06020d9ea39e8e77e70ec38e90ff6d0987ff578f20 | Python | 803 | 29 | # ==============================================================================
# Copyright 2025 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
import argparse
... |
61eddcb7f78cf54fa36228b8e748e992fab2264041051083ac1e17670549d593 | Python | 804 | 27 | from dival.util.odl_utility import uniform_discr_element
from dival.data import DataPairs
from dival.evaluation import TaskTable
from dival.measure import L2
from dival import Reconstructor
import numpy as np
np.random.seed(1)
ground_truth = uniform_discr_element([0, 1, 2, 3, 4, 5, 6])
observation = ground_truth + 1
... |
84c9d5c3edf8a483abe7f15270d8aa7a594560a1b5ab10d8c941256cef2c8780 | Python | 804 | 32 | from __future__ import absolute_import
import sys
import torch
# -------------------------------- VERSION --------------------------------- #
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix releases
#
# Admissible p... |
a7e3a44c92b440b2415d7dbce66edeff55ec57b271fda045a557d473d7bcd57b | Python | 804 | 24 | import sys
import os
from make_local_connectivity_scorr import *
from binfile_parcellation import *
from make_image_from_bin import *
from make_image_from_bin_renum import *
from time import time
path_fmriproc = sys.argv[1]
path_outmaps = sys.argv[2]
subject = sys.argv[3]
mask = sys.argv[4]
# the name of the maskfile... |
2fa732642088994bc1c4199c51cfcb5a468245e51b5af534ecfb7ec6997c450f | Python | 805 | 29 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="dynfc",
version="0.0.4a1",
author="Lucas G. S. França, Dafnis Batalle",
author_email="lucas.franca@kcl.ac.uk, dafnis.batalle@kcl.ac.uk",
description="",
long_descrip... |
34a3a71c93d9d5077f197688cf809b26eb2fc2f2bb98858ddcbd863d6683f58a | Python | 806 | 30 |
import torch
import torch.nn as nn
class EncoderHead(nn.Module):
"""
Re-implementation of EncoderHead with added noise from DeepPCM model (Kim, P. T., et al., 2021),
https://www.mdpi.com/1422-0067/22/23/12882.
Author: Emma Svensson
"""
def __init__(self, embedding_dim):
super(Encoder... |
7b3c679ff5d49d0e2d1716003967f4fb3b08a6b461abff9e6cca9db3ac84d854 | Python | 807 | 24 | # Generated by Django 4.1.1 on 2022-11-04 09:29
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('celsus', '0019_alter_file_file'),
]
operations = [
migrations.AlterField(
model_name='different... |
5a811fdb03ccf9c17b33e1feff09ea7ef414203b9b661d34f9a0a2eb5da5a950 | Python | 808 | 27 | import experiment as exp
import data_log
import video_system
class HistogramLoggerExperiment(exp.Experiment):
default_params = {
"obs_id": "hist",
}
def run(self):
self.obs_id = exp.get_params()["obs_id"]
self.obs = video_system.image_observers[self.obs_id]
bin_count = sel... |
e2fc9c864887675e07e1d5cdd292d1eedba0145d5bdc5ab2f3bb7a93d9092dfa | Python | 809 | 16 | """
Module for simple MNE data preprocessing.
The preprocessing can be applied to entire directories/projects at once.
"""
from .current_source_density import (current_source_density,
dir_current_source_density)
from .filter import (spectral_filter, dir_spectral_filter,
... |
7bf80a1a8ae0ac37697474622122a951e9e63278c013d803b658aeec48abb6bc | Python | 811 | 28 | import numpy as np
import matplotlib.pyplot as plt
from smithers.signal import HigherOrderSpectrum as HOS
signal = np.load(
'tests/test_datasets/duffing_10000.0_10000000.0_5000000000.0.signal.npy')
time = np.load(
'tests/test_datasets/duffing_10000.0_10000000.0_5000000000.0.time.npy')
def test_init():
h... |
d44611a5ee12eff1372c67263c824785e5e69f9e9896ef1bdf0d0649769ae7da | Python | 811 | 26 | from pathlib import Path
class project_paths_class:
"""
Define the custom paths in this project.
"""
working_dir = Path.home() / 'Projects' / 'cobrawap_publication_code'
def __init__(self):
"""
Optionally set alternative paths for the execution on a compute cluster.
"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.