sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3b1b867b87db8c9c677a326994994ae114d4c358aecf534d1095b18cf7a1323f | Python | 3,629 | 141 | #!/usr/bin/env python
import sys
import numpy as np
import pandas as pd
import time
from functools import partial # , reduce
from joblib import Parallel, delayed
from pathlib import Path
from arboreto.algo import _prepare_input
from arboreto.core import (
EARLY_STOP_WINDOW_LENGTH,
SGBM_KWARGS,
infer_part... |
427fa59e7000e318696d15885d24fabd1244977e58ed6d4218513ad4772a0136 | Python | 3,629 | 141 | #!/usr/bin/env python
import sys
import numpy as np
import pandas as pd
import time
from functools import partial # , reduce
from joblib import Parallel, delayed
from pathlib import Path
from arboreto.algo import _prepare_input
from arboreto.core import (
EARLY_STOP_WINDOW_LENGTH,
SGBM_KWARGS,
infer_part... |
c546e43e2f014215730c4b2f220c520861f13a19a041016921de776337f88792 | Python | 3,630 | 90 | """Tests for the h5ad cell-points loader and load_points_file dispatch."""
import numpy as np
import pytest
import anndata as ad
import pandas as pd
from regtools.utils.io.loaders.h5ad_points import (
read_h5ad_points,
list_h5ad_fields,
)
from regtools.utils.io.points_io import load_points_file
... |
57eacd8d5d861382796f3420e9f1f7901e0243e05d8b3dd1e527b3c1b06eb553 | Python | 3,631 | 109 | # Node-group asset "Offset Boolean" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKIN... |
e8afc464d74a4d8e9ca53f1cbc557ae8246dcd266acf886ad137df842655f3fd | Python | 3,631 | 99 | #!/usr/bin/env python
#
# Copyright 2019 Murdoch Children's Research Institute,
# Melbourne, Australia
#
# 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/LI... |
e1e4b144863bbd157088857533403a212533a62c5ae8d91b6bbba62a83e1abcf | Python | 3,632 | 111 | """
Quick python script to generate slicetimes.txt for milan
acquired in descending order (“from head to foot”) and using a simultaneous multi-slice factor (multi-band)=2
So, slices were acquired in this order:
1 & 25
2 & 26
3 & 27
.. and so on till
24 & 48
1
25
2
26
3
27
4
28
From: [https://en.wikibooks.org/wiki/... |
134022d7dc3765754ef91a2a76ed2e060fffa821442ae3ced77403f27dfaedc6 | Python | 3,633 | 104 | import numpy as np
import torch
import scipy
import torch.nn.functional as F
from torch import nn
from torch.autograd import Variable
import matplotlib.pyplot as plt
def normalize(img, s=0.95):
scaling = torch.quantile(img.abs(), s)
return img * scaling
def dynamic_thresholding(img, s=0.95):
img = normali... |
d21583b0528fa526e88725acc43e7a6776fc3ace5d86dfa3501e9b4198f1dcfd | Python | 3,633 | 143 | import math
import matplotlib.pyplot as plt
import numpy as np
import meep as mp
resolution = 60 # pixels/μm
dpml = 1.0 # PML thickness
dsub = 3.0 # substrate thickness
dpad = 3.0 # padding between grating and PML
gp = 10.0 # grating period
gh = 0.5 # grating height
gdc = 0.5 # grating duty cycle
sx = dpml ... |
1ca9b4c6ef47238e030c6ed4fc52925a639daa36601b0ced473a35d9f3ffe492 | Python | 3,634 | 75 | import os
import glob
from tqdm import tqdm
import numpy as np
from .fit_pca import fit_trafo_pca
from .fit_umap import fit_trafo_umap
from .fit_autoencoder import fit_trafo_autoencoder
# from mle_toolbox.utils import save_pkl_object
from sklearn.preprocessing import StandardScaler
def do_dim_reduction_and_save(acti... |
299ed23d4344bcf5d841c3dae7b6d592385407f1dd2a5b75d79b59550aaad01d | Python | 3,634 | 117 | """Defect recipes for EMT."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import flow
from quacc.recipes.common.defects import bulk_to_defects_subflow
from quacc.recipes.emt.core import relax_job, static_job
from ... |
7c1dd2016af3868669bfc45b8e6f8c57afe00f2e0e489e6bea1c81e2365fcd45 | Python | 3,634 | 114 | """Base jobs for Q-Chem."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc.calculators.qchem import QChem
from quacc.runners.ase import Runner
from quacc.schemas.ase import Summarize
from quacc.utils.dicts import recursive_dict_merge
if TYPE_CHECKING:
from typing import Any
... |
e54c7185ea3e8822c7eab450305e5fdfc8bec8f05bf8823eb46ab45ccf4fe3e2 | Python | 3,635 | 103 | # 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... |
9160d197bffdd7efd192293c39a7fab15b1896756f17a60bfb59801e792fbf73 | Python | 3,636 | 79 | from nibabel import nifti1
import numpy as np
from .config import Paths
import subprocess
import os.path as osp
def map_coords(coordinates,nifti_file):
"""
Apply the RAS+ transform in a nifti file to a set of coordinates in voxel space
:param coordinates: Array-like with shape (3,N) or (4,N)
:param nif... |
c779923fa0e254988306a1cffc1c7021151cc00699f3a57cfe1922a989db5c6a | Python | 3,636 | 120 | # Node-group asset "3 Index Angle" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING... |
d99ca9d1827357ace90ae6e9e1cae17d552c460fc4d213a0f2402a7f333e2b7b | Python | 3,637 | 115 | # 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... |
d902294457d9c45861d7435e743c214d3b1a4cfdf656e92e39ab0bbed957fd64 | Python | 3,638 | 87 | import numpy as np
from torch.utils.data import DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
import torchvision.transforms as transforms
from data_aug.gaussian_blur import GaussianBlur
from torchvision import datasets
import pandas as pd
from PIL import Image
from skimage import io, img_as_ubyte
... |
cbc72da52abeb7aa8057052dda82b0077e53981b53168742d77a6fc9168b447e | Python | 3,639 | 113 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv3x3GNReLU(nn.Module):
def __init__(self, in_channels, out_channels, upsample=False):
super().__init__()
self.upsample = upsample
self.block = nn.Sequential(
nn.Conv2d(in_channels, out_channels, (3, 3),... |
4b463524e28840ff6a2619981991a98082ded96528bd56a07500d8a943b560e4 | Python | 3,640 | 115 | # Node-group asset "Value to Mask" (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... |
bb443ca414cd8a6daa0e0666012d1b0ce7d7e914dba87b4587b878ddace3e993 | Python | 3,640 | 122 | # Node-group asset "Rotation from ZYZ" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHEC... |
c425cda1599109c36cce5d86a5a1b639b356fc9b4d0911a7c021a972c64b3ff4 | Python | 3,640 | 103 | # https://github.com/albumentations-team/albumentations/blob/master/albumentations/core/transforms_interface.py
from typing import Callable, Dict, Union, List
class BaseTransform:
def __init__(self):
self._additional_targets: Dict[str, str] = {}
def __call__(self, *args, **kwargs) -> Dict[str, any]:... |
bcde415b4208c801b65d883fb65be10afd435799f1fcce469c2673e90c2cfb51 | Python | 3,642 | 126 | """
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2020 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
------------------------------------... |
e17107ebe832f1995021c21c88530a3b40220e9e8a55f87e658ed7fef3e4ea0e | Python | 3,642 | 91 | import numpy as np
import torch
import random
import pickle
from torch.utils.data import Dataset
from sklearn.neighbors import KernelDensity
from matplotlib.legend_handler import HandlerBase
import matplotlib.pyplot as plt
class NetDataset(Dataset):
def __init__(self):
super(NetDataset, self).__init_... |
fe3df7d9d20c7dfae9d7ff8bf53afdfec178a68f99ae0527e8ba406ad3d8ebce | Python | 3,642 | 92 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Plotting basic features of neighbourhoods
author: András Ecker, last update: 02.2024
"""
import os
import pandas as pd
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import seaborn as s... |
9e31b5fab7922636117d65dda20205ad87bc7a554d11e43842970448b7d74918 | Python | 3,643 | 125 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from protonets.models import register_model
from .utils import euclidean_dist
class Flatten(nn.Module):
def __init__(self):
super(Flatten, self).__init__()
def forward(self, x):
return x.v... |
a948cb8e75b6e479ce2449ee4fd51af4a7225466d638f65130606f6b0b8f90ab | Python | 3,643 | 112 | """code for collecting basic video data and storing it locally on the raspberry pi"""
import picamera
import numpy as np
import datetime
import cv2
import logging
logger = logging.getLogger(__name__)
from time import sleep
class DataCollector:
def __init__(self, video_dir, picamera_kwargs=None):
logger.... |
af7b9af357070182048b751b25b737ecfc627b5789fa59680b637757cc5f1dcd | Python | 3,643 | 97 | import numpy as np
import pytest
from merlin.core import dataset
def test_codebook_get_barcode_count(simple_merfish_data):
assert simple_merfish_data.get_codebook().get_barcode_count() == 140
def test_codebook_get_bit_count(simple_merfish_data):
assert simple_merfish_data.get_codebook().get_bit_count() == ... |
b9b1f84e529a28bd7178c19dc55e2ea27ae8e1a3e74490fabd9d2f789ec224d3 | Python | 3,643 | 103 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 31 15:58:36 2023
@author: daltonm
"""
from importlib import reload, sys
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
from scipy.stats import binomtest, ttest_rel, ttest_ind
import h5py
from scipy.io import loadmat
sy... |
0079788e24758f2b7d93a3dc6821827047536faf5191d4ccaa39d316a585cef3 | Python | 3,644 | 115 | """Perform and save time frequency analysis of given files."""
from __future__ import annotations
from pathlib import Path
import numpy as np
import pandas as pd
import pte
from matplotlib import pyplot as plt
import motor_intention.plotting_settings
import motor_intention.project_constants as constants
BASENAME = ... |
1b19f8c56c3ef2be814a8b51161a0be22a982feca4c7f17a5e2539ecb81e87a0 | Python | 3,644 | 144 | from scipy.signal import hilbert
import unittest
import numpy as np
import matplotlib.pyplot as plt
from soundsig.hht import HHT
class TestHHT(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_sifting(self):
#create a sine wave as a test signal
... |
57fe802740188a6da20c63681e9dd26de3bbd81bbb661f9919368b9f2ff6ef8f | Python | 3,644 | 118 | """Functions for dynamic post-hoc analysis
"""
import numpy as np
from scipy.spatial.distance import jensenshannon
from osl_dynamics.inference import metrics, modes
def between_state_rv_coefs(matrix1, matrix2):
"""
Computes between-state RV coefficients.
Parameters
----------
matrix1 : np.ndarra... |
fc2d0d28e7edcaa55b27671707ba4202df45021e2aa9852a78938526b6f357f3 | Python | 3,644 | 109 | # Node-group asset "Boolean Run Fill" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECK... |
03ebe1e8bc1d866d8409f300e070ebc83ed2e529735be8a028545adf3b00b726 | Python | 3,645 | 99 | from itertools import chain
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import... |
169a5ad55c44a7ada76002601d1ca712431f7a27ff1a760fe56b73fde4cc95f1 | Python | 3,645 | 82 | #!/usr/bin/env python
from __future__ import print_function
from pybullet_tools.pr2_utils import PR2_GROUPS
from pybullet_tools.utils import HideOutput, disconnect, set_base_values, joint_from_name, connect, wait_if_gui, \
dump_world, get_link_name, wait_if_gui, clone_body, get_link_parent, get_link_descendants, ... |
70f723185c6544b2819c01543174654cd57c1c73865608573890b86c9817296e | Python | 3,646 | 116 | # Node group ".Cleanup" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated fro... |
8493a10c1ece654ac3aae594231a1208129bcffd883441e6be5597d34143da8d | Python | 3,646 | 94 | # 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... |
17b471db7be5d1e3d130108bf3b8d125b60d5e02baf8fa685a1737e351fadf2b | Python | 3,647 | 105 | import torch
from elasticai.creator.nn.integer.quant_utils import scaling_M, simulate_bitshifting
class MPQSupport:
def _init_mpq_attributes(self, **kwargs):
self.MPQ_strategy = kwargs.get("MPQ_strategy") # ["inheritance", "requantizer"]
self.MPQ_elements = [
element
for ... |
54e02c37600a25cabd6af8d19e51ddb44ae8eed442c47fc4ef0fb9f0dba860af | Python | 3,647 | 106 | # 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... |
b77c78f3e753822f371023400af56479156fd4c23b01c8f2f999f812eb882353 | Python | 3,647 | 106 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations.math_operations import MathOperations
from elasticai.creator.nn.integer.maxpooling.design import (
MaxPooling1d... |
21fcac773ee06a6b6ef24432841058c6ff8bf983b73946513fe3efb78731997e | Python | 3,648 | 83 | """Intensity preprocessing for ANTs registration inputs.
Dimension-agnostic (works on 2D slices and 3D volumes). These steps make a
moving image and a same-modality template statistically comparable so ANTs'
metric and - more importantly - its moments-based initialization behave well:
* ``clip_normalize`` - pe... |
59e5b81ccca84fbd5e0004cd02368e43104af1875f4cc8928715be970e706324 | Python | 3,648 | 96 | """Testing CLI command view."""
import os
import subprocess
def test_png(tmp_path):
"""Tests for common plot."""
os.chdir(os.path.dirname(__file__) + '/data')
proc = subprocess.Popen(['swc', 'view', 'pass_simple_branch.swc',
'-o', tmp_path / 'test_treem.png'],
... |
d56f98270fa045a57053bc7bdba0692fde05c57b423a290900cc9ef8c60419f1 | Python | 3,648 | 53 | """SIGNCHECK.py 2026-09-30. A check to run before simulating a connectome model with predicted signs.
For every cell class: how many neurons carry a sign without a transmitter call (UNCALLED; in Shiu et al.'s file these
signs are inherited from an earlier release), the excitatory share of the class's output synapses ... |
4c0f0a2e54a1f3380a103bf9f5a1518be364df7d968f10a252c4c9f894f43041 | Python | 3,649 | 88 | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.cnn import ConvModule
class MaskConvModule(ConvModule):
"""Mask convolution module.
This is a simple wrapper for mask convolution like: 'partial conv'.
Convolutions in this module always need a mask as extra input.
Args:
in_channels (... |
62317cf0f75563b51d553fd164b29ef1a12966bd3945af3afdb926d475b17ac8 | Python | 3,649 | 80 | import os, sys
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
from regtools.hub.registry import REGISTRY, ModuleEntry, pipeline_entries, tool_groups
def test_every_entry_well_formed():
for e in REGISTRY:... |
69708c5be5e4c6fcd5ade70d3bbb93a0ad11e6be822959a11bfb1b18c0f9f355 | Python | 3,651 | 105 | import numpy as np
import pandas as pd
from typing import Literal
from sklearn.base import BaseEstimator
from cuppa.constants import DEFAULT_FEATURE_PREFIX_SEPERATOR, META_CLF_NAMES
from cuppa.logger import LoggerMixin
class ProbCombiner(BaseEstimator, LoggerMixin):
def __init__(
self,
combine_mo... |
87a2957c5f5e3ab48115f65f22c947fedeaed1232bfcf4ca9d5419909f4ae902 | Python | 3,651 | 93 | import numpy as np
import torch
import pytorch_lightning as pl
import logging
from typing import Union
from cellmincer.util.ws import OptopatchDenoisingWorkspace
class DenoisingModel(pl.LightningModule):
'''
The base class for a CellMincer denoising model, extended from the standard PyTorch Lightning module... |
3820353f510636bc7716deb6a2d31653199c26c7b91e710b05e403f48e279d18 | Python | 3,652 | 118 | """CLI invocation and subparser tests."""
import subprocess
import sys
def test_colabmda_help():
res = subprocess.run(
[sys.executable, "-m", "colabmda.cli", "--help"], capture_output=True, text=True
)
assert res.returncode == 0
assert "openmm" in res.stdout
assert "modeller" in res.stdou... |
8f80473e889eb303fff1a4ad82e00bb904d2b25d182fb071d0e5dfa78e922c99 | Python | 3,652 | 81 |
# Collect predictions
from glob import glob
from pathlib import Path
import sys
import pandas as pd
import numpy as np
# sample used
#beh = 'grip'
beh = sys.argv[1]
opts = '-source_Schaefer400x17_nodenoise_UKB_5000_z-beh_'
# paths
wd = Path('/data/project/ukb_reliability_in_prediction/prediction_UKB/res')
in_path ... |
df5d8687927c54cfad5eb2a7e324d96b1cd22395d5beee4bcc38d2e167ed9fff | Python | 3,652 | 116 | from elasticai.creator import ir
from elasticai.creator.ir2vhdl import DataGraph, Edge, Shape, factory
from elasticai.creator_plugins.grouped_filter import (
FilterParameters,
)
from elasticai.creator_plugins.grouped_filter import (
grouped_filter as grouped_filter,
)
def high_level_ir(groups: int) -> DataGra... |
14b332752e1288b8b19ae40c7f827042e05eafa17381e69af064bda1061c5d90 | Python | 3,654 | 124 | import torch
import torch.nn as nn
from diff_frech_mean.frechetmean.utils import d2arcosh, darcosh
def grad_var(X, y, w, K):
"""
Args
----
X (tensor): point of shape [..., points, dim]
y (tensor): mean point of shape [..., dim]
w (tensor): weight tensor of shape [..., points]
... |
259ff2bc355e89ad0d51a4f2b508b1d1e4c71825801de7c4c5fd9d6b3c1ed337 | Python | 3,654 | 93 | """code for reading and writing project parameters"""
import yaml
from types import SimpleNamespace
import logging
import pathlib
logger = logging.getLogger(__name__)
class ConfigManager:
def __init__(self, config_path: pathlib.Path):
"""
class for reading and writing project configuration files
... |
55ae06ea85597c8905958ff57b1e63e3907a670f52662dd47590075fc5d7cf20 | Python | 3,654 | 96 | from typing import Optional, Callable, Tuple
import torch
import torch.nn as nn
from src.models.utils import conv_block, fc_layer
__all__ = ['get_reyregressor']
class ReyRegressor(nn.Module):
"""
regression model, designed to predict item scores and final score for a rey figure
"""
def __init__(se... |
6b02116ac06bde17ea5ef2417f7cd7f272780a67459ddfd250ebc1a3ab7b63f0 | Python | 3,654 | 108 | import pytest
import numpy as np
import pandas as pd
import seaborn as sns
import statsmodels.formula.api as lme
from pyrelimri.tetrachoric_correlation import tetrachoric_corr
from pyrelimri.icc import sumsq_icc
from hypothesis import given, strategies as st
from hypothesis.extra.numpy import arrays
@pytest.mark.para... |
74c26f9ab029346da93bff33857e2e821167d192b5d032b36c3e93e93926bf45 | Python | 3,655 | 88 | ## modules to generate simulated data
import numpy as np
import pandas as pd
from Bio import Seq
def generate_motif(motif_name, motif_dict):
'''
Randomly generate DNA sequence matching the PWM of any given motif
'''
nucleotide = ['A', 'C', 'G', 'T']
motif_object = motif_dict[motif_name]
lengt... |
86b32292acc047597caad07a8c082d5b40d6185427421dfc154a27dec400fdfc | Python | 3,656 | 120 |
# coding: utf-8
# In[36]:
import pandas
import os
import sys
import datetime
from nda_aws_token_generator import *
from pathlib import Path
# In[37]:
def update_aws_config(username,password,web_service_url='https://nda.nih.gov/DataManager/dataManager'):
generator = NDATokenGenerator(web_service_url)
... |
aceea8c871f7eac36afbd457fde625e36a9e12763cdcfb0addd661bcc937982a | Python | 3,656 | 116 | import numba
from neurolib.control.optimal_control.oc import OC
from neurolib.models.hopf.timeIntegration import compute_hx, compute_hx_nw, Dxdoth, Duh
class OcHopf(OC):
"""Class for optimal control specific to neurolib's implementation of the Stuart-Landau model with Hopf
bifurcation ("Hopf model").
... |
7177054b0ad7f6da9ee0794e60dfee74374a28a9cc33a856c85e809ebc0cbc70 | Python | 3,658 | 140 | """Score a directory of PDBs with BERTScore"""
import argparse
from eudockscore.equiformer_v2_resi.model_v2_new_afscores import EuBERT
from torch_geometric.loader import DataLoader
# from eudockscore.utils.pdb import get_chain_sequence
# from eudockscore.utils.interface import get_target
from transformers import BertT... |
a2f76372482fe55953c7df947a47e9e4156b665cc0440f51fd95abd893037a84 | Python | 3,658 | 95 | import os
import re
import csv
from tqdm import tqdm
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.PubMed")
class PubMed(data.NodeClassificationDataset):
"""
A citation network of scientific publications with TF-IDF word features.
Statistics:
-... |
a83adf5ed554707844ff43eafb8a871876bb224c570b9a0b2fbb73a252cbd81a | Python | 3,659 | 87 | """
This script creates the needed files in a folder to make it BIDS-complaint.
Requirements:
- Folder with NIFTI and JSON files in pseudo-BIDS format.
- known sequence of images taken in the scanner. There are 2 fields that are needed,
sequences: this refers to the type of se... |
fe2bedde56349c491ce1e1abb44b6f8cd542664aebf2d3f47f467c9990dcf3b7 | Python | 3,659 | 114 | import pytest
import numpy as np
from simulations.EventCollector import EventCollector
@pytest.mark.parametrize("input_test, expected", [([1,1,1], [1,1,1,0] ), ([1,1,1,1], [1,1,1,1])])
def test_update_data(input_test, expected):
e = EventCollector("test")
e.update_data(*input_test)
assert len(e._idx)==expe... |
91cb90a278ab7e6701acfab2ab55ba800bdf8971abd6e3dac437cabfc8c00922 | Python | 3,661 | 113 | # Node-group asset "Is Backbone" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING
f... |
f188b2579e5fb7913da70ad57626b481873b383e22b52fd7cd72cd55c073d9b2 | Python | 3,662 | 114 | # Node-group asset "Select Attribute" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECK... |
69a27fbeb47e0f7597e4a945e110069dd359d8093c088e3c818ba9d7d7717a0a | Python | 3,663 | 73 | 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... |
44ecaca4c446eeab42260f207a12075e76645417090c9bd91260a49247d37802 | Python | 3,664 | 115 | import matplotlib.cm as cm
from PyQt5 import QtGui, QtWidgets
import globals.global_font as gFont
from colorbar_slice import ColorbarSlice
class ColorbarRuler(QtWidgets.QWidget):
def __init__(self, minScale=0, maxScale=6):
if minScale > maxScale:
raise ValueError('The minScale is gr... |
46555e1760da6d17f769aa34a8562459821bb9efaf2f77ece5b6661d45a4b5a1 | Python | 3,664 | 96 | import torch
import os
from tqdm import tqdm
import pickle
import Models.model_func as Model_Func
import logging
class DryBeanBaseline_Model(torch.nn.Module):
def __init__(self, device:torch.device, input_dim=16, classes=7, lr=0.001):
super().__init__()
assert isinstance(input_dim, int), "input_d... |
819f0595b74dc8aa4d08ecc1366d53687e54e447f8131bfff1b6584db30d54a0 | Python | 3,664 | 106 | #!/usr/bin/env python
from __future__ import print_function
# Run this file from this directory with the following command:
# python setup_pr2_ik_basic.py build
# I'm not sure that the build argument is necessary, but include it anyway.
# Ignore any the warning messages about unused variables or variables being set b... |
81fd2176688ddde9953021704f237561d28e5d58dcc4273fc9a54d52eaf3498f | Python | 3,664 | 112 | """
Rates for network icon
"""
import os
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from src.simulation import network
from src.constants import blue, pink
from src.constants import kappa_pre, alpha_pre, kappa_w, alpha_w, n_pre, n_stim
from src.constants import figdir, ... |
ba2815913a3940797f42330a5521e504f6835b4e68c6b0ba658a3820cb197728 | Python | 3,664 | 139 | # 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... |
e2352b78c7fb78d5a9fcce4113866ce57c7326712768c2166e91f5f946cb9bfb | Python | 3,664 | 97 | import sys
import scanpy as sc
import anndata
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import cell2location
import scvi
from matplotlib import rcParams
rcParams['pdf.fonttype'] = 42 # enables correct plotting of text
import seaborn as sns
fpath = "/scratch/mshru... |
9a63c828a921028978f483fe0b539b7130793056b78ab7ac358918b844cba347 | Python | 3,666 | 113 | from __future__ import print_function,division
import pandas as pd
import sys
X_COLUMN_NAME = 'CoordinateX'
Y_COLUMN_NAME = 'CoordinateY'
SCORE_COLUMN_NAME = 'AutopickFigureOfMerit'
OLD_SCORE_COLUMN_NAME = 'ParticleScore'
VOLTAGE = 'Voltage'
DETECTOR_PIXEL_SIZE = 'DetectorPixelSize'
MAGNIFICATION = 'Magnification'
A... |
c4544463ea2afb0df512cce5510369759cefb73000e64c3a6a3da10dae2e1ef8 | Python | 3,666 | 113 | """Feature extraction: binned rate and trial descriptors."""
from __future__ import annotations
import numpy as np
from msfeature.events import Microsaccade
from msfeature.features import (
NOURI_RATE_BINS,
RateBinSpec,
binned_rate,
shift_to_onset,
stack_trial_features,
trial_descriptors,
)
... |
1638453bf61296ea222bc121a9e46fa309f5d7a3ddcb2657861dfc1d00d1766d | Python | 3,667 | 104 | # 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... |
9f279ea30d3b5e97583b29a929cd1bd33b9a8a2947d4696cd7a6e6566fd6f33f | Python | 3,667 | 91 | from __future__ import print_function
import math
COST_SCALE = 1
class FunctionalExpression(object):
def __init__(self, parts):
self.parts = tuple(parts)
def dump(self, indent=" "):
print("%s%s" % (indent, self._dump()))
for part in self.parts:
part.dump(indent + " ")
... |
cc4966dcfadf488be339c7b6f331131cc2147fda45612500e68d007e58143fae | Python | 3,667 | 113 | import sys
from typing import Optional, Tuple
if sys.version_info >= (3, 8):
from typing import Literal
else:
from pip._vendor.typing_extensions import Literal # pragma: no cover
from ._loop import loop_last
from .console import Console, ConsoleOptions, RenderableType, RenderResult
from .control import Cont... |
320b1136d53965957b3236e5563b6fcbe1b995db168f4bf627873bef868456f9 | Python | 3,668 | 122 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 28
@author: tomas.vega
"""
## Python 3.11.2
#--------------- Libraries -------------------
import pandas as pd
import scarches as sca
from scarches.dataset.trvae.data_handling import remove_sparsity
import anndata as ad
import sys
import os
import s... |
607bdd00badd3366453748a4df37a0223b1117b9deb45f987b3c88710652cdeb | Python | 3,668 | 114 | from typing import cast
import pytest
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
from elasticai.creator.nn.fixed_point.conv1d.design import Conv1dDesign
@pytest.fixture
def conv1d_design() -> Conv1dDesign:
return Conv1dDesign(
name="conv1d",
total_bit... |
b08c62fc0a5864c20958f31a4e83d20bcae27e9b993152d47aa594d397c1dffe | Python | 3,668 | 104 | # USAGE
# python detect_mask_image.py --image images/pic1.jpeg
# import the necessary packages
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
import numpy as np
import argparse
import c... |
cedcbaf3cea08001c4601542d8e3b72dfa160a7ca3c68b06fbf54b84d4705cf6 | Python | 3,668 | 123 | """Core recipes for DFTB+"""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import job
from quacc.recipes.dftb._base import run_and_summarize
if TYPE_CHECKING:
from typing import Literal
from ase.atoms import Atoms
from quacc.types import Filenames, RunSchema, SourceDir... |
25653a603fa9441c21811107cdddeccaea42039f8906ea3d7758914ebb5e236a | Python | 3,669 | 120 | """Base jobs for GULP."""
from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING
from ase.calculators.gulp import GULP
from quacc import get_settings
from quacc.runners.ase import Runner
from quacc.schemas.ase import Summarize
from quacc.utils.lists import merge_list_params
if... |
893d9d1f4f0725211d2ed12b1d811100af203841aca63fc4940ad478adb5c293 | Python | 3,669 | 99 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
from qtpy import QtGui, QtCore, QtWidgets
from qtpy.QtWidgets import QAction
import pyqtgraph as pg
import numpy as np
from . import io, run, gui, views
# ------ MENU BAR -----------------
def mainmenu(parent):... |
8b87d3162741327e11c452ffea059ae79a8c6e63378faf9ebc4a6ec2ae0c4cc7 | Python | 3,669 | 104 | # Node group ".MN_select_nucleic" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regen... |
a01a14bc18ced96584b4aed9b9475baf75b743db44f4c9a63d93b8e631b6a4a4 | Python | 3,669 | 91 | from collections.abc import Sequence
import torch
from torch import nn
from torchdrug import core, layers
from torchdrug.core import Registry as R
@R.register("models.GIN")
class GraphIsomorphismNetwork(nn.Module, core.Configurable):
"""
Graph Ismorphism Network proposed in `How Powerful are Graph Neural Ne... |
a9197c95dde9d4bbf27977e01bcdc0e00b49e3fe422c70001bbc919f3294ff24 | Python | 3,669 | 116 | # 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... |
b14d89e3296898696eaec31b72aadc578936b299072358af9e9f9e6b0899aa93 | Python | 3,669 | 106 | # -*- coding: utf-8 -*-
#
# Time-frequency analysis with wavelets
#
# Builtin/3rd party package imports
import numpy as np
import logging
import platform
# Local imports
from syncopy.specest.wavelets import cwt
def wavelet(data_arr, samplerate, scales, wavelet):
"""
Perform time-frequency analysis on multi... |
dbd25e67abad51b4d68c889dcb855024117772979d680af519a9089ff88db97f | Python | 3,670 | 94 | # Copyright 2022 HYBRID Team INCIA, UMR5287, CNRS, Université de Bordeaux
# 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 b... |
46fc7634dc3357684f08328c69e6d6156fd2b570e65c25cbfbc8ec7dd357cf07 | Python | 3,671 | 109 | # Node-group asset "Offset Rotation" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKI... |
7455e6ba0dc0ad5d095e27a40c728227e2583429b3bcd74ed1107949230836a8 | Python | 3,671 | 90 | from __future__ import annotations
from pathlib import Path
import pytest
pytest.importorskip("phonopy")
pytest.importorskip("seekpath")
from ase.build import bulk, molecule
from quacc.recipes.emt.phonons import phonon_flow
def test_phonon_flow(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
atoms = ... |
d11f04b1f2973cd2ff5683f7bb1fbff31b64830ed6de0c2a1c0cf6fdf1c53954 | Python | 3,671 | 110 | """
This script checks for data missing patterns in the aggregated behavioral data,
i.e. smartring, smartwatch, and smartphone
Input: path where all the preprocessed data is
Output: path where the figure will be saved
@author: trianaa1
"""
import sys
sys.path.insert(0, "/m/cs/scratch/networks-pm/effects_externalf... |
de3e112ad31bc1fa2fedb94bec597563cc7e7967a738ce3f2467d1bcfa1f219b | Python | 3,672 | 107 | from .utils import AtomsDataset, register_dataset
from typing import List, Optional
import glob, os
import numpy as np
from ase import Atoms
def expand_path(path_list: List[str]):
all_path = []
for path in path_list:
for p in glob.glob(path):
if p not in all_path:
all_path.... |
fdebd9eefe1db85a6887fe4e1674d1f3c926f6c4e09655b9e8939ddd591f29c9 | Python | 3,672 | 86 | import pandas as pd
import seaborn as sns
from script.paper_plots import plot_bars
import sys
#********************************** PLOT Utils******************************************
PALETTE = sns.cubehelix_palette(start=0.3, hue=1,
gamma=0.4,dark=0.1, light=0.9,
rot=-0.6,reverse=True... |
d5974772cbfbcece144e870f69bc9dad88effd3375d75aaf203812ffb9d005c1 | Python | 3,673 | 126 | # 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... |
d600f1e2eac13423ecf13b250a6422d0e40c9ac0f60f1277bb587e12f053955d | Python | 3,673 | 110 | # coding: utf-8
import numpy as np
import pandas as pd
import umap
from bokeh.resources import INLINE, CDN
from bokeh.embed import file_html
#https://umap-learn.readthedocs.io/en/latest/basic_usage.html
def embeddable_image(image_path):
from io import BytesIO
from PIL import Image
import base64
i... |
d63ea6bcd8302715b468dbdee5bf9a94b265c578f8c899b31c38ae4df26c1c59 | Python | 3,673 | 121 | import numpy as np
from autograd.builtins import NamedTupleVSpace
from autograd.extend import VSpace
class ArrayVSpace(VSpace):
def __init__(self, value):
value = np.asarray(value)
self.shape = value.shape
self.dtype = value.dtype
@property
def size(self):
return np.prod(... |
1e13197a785bd0f5ac08050b5e6a439a9e309680b40d58d0ad2f28bcbecf2a38 | Python | 3,674 | 150 | # 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... |
60569b4528797c7eeff4b901f2fbc50bef6e0b489699c2a43d3fb92fe18eabd3 | Python | 3,674 | 134 | # -*- coding: utf-8 -*-
#
# Synthetic spike data generators for testing and tutorials
#
# Builtin/3rd party package imports
import numpy as np
# syncopy imports
from syncopy import SpikeData
from syncopy.shared.kwarg_decorators import unwrap_cfg
# ---- Synthetic SpikeData ----
@unwrap_cfg
def poisson_noise(
nT... |
b1d7dc2db3535826d53f9297303d9b90243d906e9f2f4af5c63873a612ed6ee4 | Python | 3,674 | 116 | # 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... |
54ee6edb34759c7f047c9e8a320383a22e59af6176837f82359257a348819041 | Python | 3,675 | 112 | #!/usr/bin/env python
from __future__ import print_function
from lxml import etree # pip install lxml
import os
def find_insensitive(elem, pattern):
result1 = elem.find(pattern)
if result1 is not None:
return result1
return elem.find(pattern.lower())
# https://github.mit.edu/mtoussai/KOMO-stream... |
4e8b47bfa623cdf05387f9a8632addd3bd9eaa5d28248eeecf62989732cbfc11 | Python | 3,676 | 119 | #!/usr/bin/env python3
import os
import pandas as pd
import matplotlib.pyplot as plt
from nltools.data import Brain_Data
from nltools.mask import expand_mask, roi_to_brain
from nltools.stats import threshold
from nilearn import plotting as nplot
# ------------------------------------------------------------------
# ... |
894324dfbf5f566acd269f3797e5ba55612f8351df33ee3b1d8267b224d9c1ce | Python | 3,676 | 138 | """Basic tree data structure."""
from collections import deque
class Tree():
"""Recursive tree data structure."""
def __init__(self):
"""Constructor of empty tree."""
self.parent = None
self.siblings = []
def add(self, tree):
"""Appends tree as continuation."""
t... |
ecc05fd383288f65ef5b84a0f1f1e437a7c827c1f788007a0b4a14040185a092 | Python | 3,676 | 95 | import os
import random
from time import time
import pandas as pd
import numpy as np
import networkx as nx
import argparse
import pickle
import math
from utils.utils import *
from utils.graph_creation import *
from utils.motif_counts import *
from utils.visualization import *
import graph_tool.all as gt
sns.set_conte... |
8b10cf434d683fc4b77e27af4cf58f007d57a3090f4a38d418ecd44d692b86c8 | Python | 3,677 | 116 | import os
import numpy as np
import nibabel as nib
import hcp_utils as hcp
import pandas as pd
import matplotlib.colors as color
import scipy.stats as ss
import pycircstat as circ
def v_rgba2hue(rgba):
rgbv = rgba[:3,:]
H = np.zeros(rgbv.shape[1])
delta = np.max(rgbv, axis=0) - np.min(rgbv, axis=0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.