sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
288b59f320d47dc42feb0dd2b7917e0cef2f906966c0bfc3ec80b1eae1a9cf2f | Python | 10,049 | 242 | """
Getting started
===============
This getting started tutorial shows an example of how to use the PyntBCI library for analysing code-modulated responses
[1]_. This tutorial makes use of a small synthetic dataset of EEG data. In this notebook, the reconvolution CCA (rCCA)
method for decoding EEG is demonstrated (see... |
fc2fcca65197efd4ddadaaf5d4cce170766547ec0ae2a324ba0097d8806975c3 | Python | 10,050 | 256 | # Node-group asset "Find HBonds" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
import math
from typing import TYP... |
9e08939802be6804dcb2d2c347dabc385f157ec88ac77054ec505c127f7d870d | Python | 10,053 | 252 | from lxml import etree as ET
top = ET.Element('modes')
def generate_default_configuration(filename):
mode_1 = ET.SubElement(top,'mode')
mode_1.set('ID','1')
mode_1.set('Name','BF LED matrix full')
mode_1.set('ExposureTime','12')
mode_1.set('AnalogGain','0')
mode_1.set('IlluminationSource','0')... |
a25115ed6ca28fb678d5d0163e1b90dbff692dfbef4d72ba75857328d8d558ff | Python | 10,053 | 263 | # 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... |
dc7681c391095c7ebbd96e1c5d6f4374e36da1eaf6179861eb834ea3033fafef | Python | 10,054 | 313 | from os import SEEK_CUR, SEEK_SET, SEEK_END
from re import search, finditer, match
from datetime import datetime
from numpy import (fromfile,
frombuffer,
asmatrix,
array,
arange,
c_,
diff,
... |
5cdca79517f8a5ec5291eaa1609c3e254929277f01589cdb0c6e89b317285952 | Python | 10,055 | 328 |
import tensorflow as tf
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
######################################################################################################
#
# PART #2: UTILITY
#
#######... |
8b25c0c79f175bb404e8ddd49d9bcf015e25d71d7e829348394df43209484024 | Python | 10,055 | 260 | """ Embeddings module """
import math
import warnings
import torch
import torch.nn as nn
from onmt.modules.util_class import Elementwise
class SequenceTooLongError(Exception):
pass
class PositionalEncoding(nn.Module):
"""Sinusoidal positional encoding for non-recurrent neural networks.
Implementation... |
c8e20467bb725f73fd32bc6cc2ad857fb2fa4a8277ef33dd8b8b835d9b24ac37 | Python | 10,057 | 266 | """
Introduction to the models Module
====================================
Welcome to the guide on TorchEEG's ``models`` Module! This module provides you with a variety of both discriminative and generative models. Each model has been meticulously replicated from its respective research studies, offering a toolkit for... |
a2bd2486dcc32dc21d6b4b4f8e0e04c998b60565948de1e10a7229605160fa01 | Python | 10,060 | 235 | # Script to actually run CCA on the data
# Using the meet package https://github.com/neurophysics/meet.git to run the CCA
import os
import mne
import numpy as np
from meet import spatfilt
from scipy.io import loadmat
from Functions.get_channels import get_channels
from Functions.IsopotentialFunctions_CbarLabel import... |
de2f23c6dd5152ba1385f18d6005b709d2414522f49b5a3e13d2e3298643d718 | Python | 10,061 | 302 | # 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... |
24d74120b3eb15eeb5757f43ef98003579e2e2cbd569cbc7c374ba8a4da10677 | Python | 10,065 | 162 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
444655af23152a34c428093927b514907a7c930e6111d9bfdc26fb04639e59ca | Python | 10,068 | 281 | #! /usr/bin/env python
# ==============================================================================
# Copyright (c) 2021, 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. Re... |
fc5443daa806334589283e5c0c22057f8431efa9fa6ca2d413c574814d6298e2 | Python | 10,070 | 211 | from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port
from elasticai.creator.vhdl.design.design import Design
from elasticai.c... |
62d43db70ca306c89ff2426c4e91dc240364370b6b696d17b182c5729db0a036 | Python | 10,072 | 258 | from unicodedata import category
class Circuit:
"""
Class for neuronal circuit, keep and maintain all the neuron cells, connects, segments in it.
Notice that cell index < 0 means fake input neuron, and cell index > 1000 means fake output muscle
"""
def __init__(self):
"""
... |
535b2b25d1d8695699d8fdbbb89a9dae05da2dc31327627820a5dc879600ba80 | Python | 10,074 | 325 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
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, either version 3 of the License, or
(at you... |
cda0b5f5c97041a76779a7d046a848117c0a019d7a661578d0413dc21267128b | Python | 10,075 | 274 | # -*- coding: utf-8 -*-
"""
Tests for abagen.probes module
"""
import numpy as np
import pandas as pd
import pytest
import abagen
from abagen import probes_
from abagen.utils import first_entry, flatten_dict
def test_reannotate_probes(testfiles):
# set up a few useful variables
probe_file = first_entry(test... |
6d39a6a18a1dacf4bd777d7ced4c9bfe9b991321e711c84235bbdc35b71cf59d | Python | 10,076 | 255 | import torch
import argparse
import numpy as np
import dill
import time
from torch.nn import CrossEntropyLoss
from torch.optim import Adam
import os
# os.environ["CUDA_VISIBLE_DEVICES"] = "2"
import torch.nn.functional as F
from collections import defaultdict
from models import GAMENet
from util import llprint, mult... |
68e1dd112ecdc85bc30d0f3580a4a655985c2110b64711fa34fe19987f8c3836 | Python | 10,079 | 347 | # 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... |
d875c5c11823179369ae272567e2a750de8e591ba8cc825656b2388e904bb499 | Python | 10,080 | 356 | """
QMOF-compatible recipes.
This set of recipes is meant to be compatible with the QMOF Database workflow.
Reference: https://doi.org/10.1016/j.matt.2021.02.015
"""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from ase.optimize import BFGSLineSearch
from quacc import change_s... |
3a524b9223403c68e29d0fa4fbcddae10efb4dc28a5e52a6f2ebfb91916c27b9 | Python | 10,081 | 293 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
54c44219958b0219c9436d7deec0043ad4a9b0f1b47154c9d70933d4f2062f2a | Python | 10,082 | 253 | # Script to run TVAT analysis using identified models as fixed points
try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
nhost = comm.Get_size()
except ModuleNotFoundError:
rank = 0
nhost = 1
from os.path import join
from get_paths import *
import h5py
import numpy as np... |
c4424cb36216ef4582545a49cc4ebd2c20f565f71d9c1f652c90bebe5f3d741c | Python | 10,084 | 299 | """Centralized GPU helpers for Sella.
Provides numpy-in / numpy-out wrappers for eigh and QR that route through
torch+CUDA when a usable GPU is present, with a single shared `_has_torch`
state and a size threshold that gates upload overhead.
GPU usage is opt-out via SELLA_DISABLE_GPU=1 and the size threshold is
tunab... |
afe163b288588d742b4ce5610281d46df3f79f28d251cecd6ce6b7d3638c3353 | Python | 10,086 | 263 | #!/usr/bin/env python3
# Compatible with Python 3.7+ (uses contextlib.ExitStack for the
# four-handle gzip ContextManager rather than the parenthesized
# `with (a, b, c, d):` syntax that requires 3.10). Tested against the
# Python 3.7 in oxy's bismark-test micromamba env.
"""Synthesize UMI-bearing FASTQs from a stock p... |
51e303f0d77deece748fbff1a4c25758f2015088a678b77884c167e59d2f24f2 | Python | 10,088 | 296 | import torch
import torch.nn as nn
import os
import numpy as np
from omegaconf import OmegaConf, DictConfig
import math
import torch.nn.functional as F
def default_HPs(cfg: DictConfig):
model_cfg = {
"dropout": 0.49,
"hidden_size": 160,
"num_layers": 0,
"lr": 0.005,
"input... |
9837cbe47edfe004ae8e02ab5cf5db786c500523be25dc00c1605d31ba471fee | Python | 10,088 | 292 | import warnings
from dataclasses import dataclass
from typing import Any, TypeVar, cast, overload
from ._int_arith_protocol import IntArithmetic
from .fxp_params import (
ConvertableToFixedPointValues,
FxpParams,
)
T = TypeVar("T", bound="ConvertableToFixedPointValues")
@dataclass
class FxpArithmetic(IntAri... |
d01b8b07e97580f30b44c9cbf5e208e886f9f56f21e67ce2fd120b1ff204ae48 | Python | 10,088 | 312 | # 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... |
f28297635a60812b2d8ddd59fa4562412edc15740ac62d8bdec6e040aeef82f3 | Python | 10,088 | 244 | """Named colours of PyMOL and VMD, for `color.parse_color`.
The values are copied from each program's source and are display (sRGB) values
from 0 to 1, as the programs apply them without a linear conversion. CSS colour
names, which ChimeraX and MolViewSpec use, come from matplotlib instead.
"""
# PyMOL's named colour... |
39a929b72e1c02b8919789c7ef4e355b723b54722c6c097e0f96301b27d67b0c | Python | 10,089 | 351 | #!/usr/bin/python
# Gogulan Karunanithy, UCL, 2023
import copy
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import nmrglue as ng
import numpy as np
import tensorflow as tf
from tensorflow import keras
from fidnet import config
C13_MODEL = config.weights_13c_methyl
H1_MODEL = config.weights_1h_methyl
def r... |
8358f873b69743475ac393db8c7a37fe374b40a91a99cefed072e4aebbe3e455 | Python | 10,090 | 291 | # 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... |
b3731aa2db324e7f7dcc72602fce491fdaedcf0a4c263df6b61fed3a3c46d842 | Python | 10,090 | 296 | # 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... |
79cfcffb75e72b695bb00dbc89514cb732eade03e82f8f3a934abb39b1d51894 | Python | 10,092 | 269 | import numpy as np
from itertools import product
from .pr2_utils import set_arm_conf, REST_LEFT_ARM, open_arm, \
close_arm, get_carry_conf, arm_conf, get_other_arm, set_group_conf, PR2_URDF, DRAKE_PR2_URDF, create_gripper
from .utils import create_box, set_base_values, set_point, set_pose, get_pose, \
get_bodi... |
c5bd09a2d88539b5fc34c9859a19f6a677e5297f97a7b7404800d55a3f4e168d | Python | 10,093 | 309 | from itertools import batched
from random import randint
import cocotb
import numpy as np
import pytest
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, Timer
from cocotb.types import LogicArray
from cocotb.utils import get_sim_time
import elasticai.creator_plugins.mac_delta as mac_delta
import ... |
26d9d7f9b7b458629a77768c6ceff53a87451907d989eb1c95f04372c508211b | Python | 10,095 | 281 | #! /usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
from six.moves import xrange
__all__ = [
'minibatches',
'seq_minibatches',
'seq_minibatches2',
'ptb_iterator',
]
def minibatches(inputs=None, targets=None, batch_size=None, shuffle=False):
"""Generate a generator that input a group of... |
508a90413c990d938b0fe27240595bb493c20a28b9333178d62a44b235ba9b6a | Python | 10,095 | 304 | #!/usr/bin/env python3
"""
Command-line script for validating BIDS datasets with HED annotations.
This script validates HED annotations in BIDS-formatted datasets, checking for compliance
with HED schema rules and proper annotation structure. It processes TSV files with their
associated JSON sidecars, following BIDS i... |
3059aba57ccad4848b7df4f8941889034079ba24fb00099b63566baca0716ba4 | Python | 10,096 | 538 | from __future__ import annotations
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# ======================================================================
# SELECTION
# ======================================================================
def select_qc_examples(
... |
da7e048898b75fdb2a22ad0ed7a91467fcf2e9460c777c457c286529f9d6d477 | Python | 10,096 | 451 | # Auto generated by make_terminal_widths.py
CELL_WIDTHS = [
(0, 0, 0),
(1, 31, -1),
(127, 159, -1),
(768, 879, 0),
(1155, 1161, 0),
(1425, 1469, 0),
(1471, 1471, 0),
(1473, 1474, 0),
(1476, 1477, 0),
(1479, 1479, 0),
(1552, 1562, 0),
(1611, 1631, 0),
(1648, 1648, 0),... |
7ae0207147e77044a3b0b87b9deb6e231bdcf8c95ac2d9911b40f9ff282e6638 | Python | 10,099 | 220 | """Allows output of HedSchema objects as .xml format"""
from xml.etree.ElementTree import Element, SubElement
import pandas as pd
from hed.schema.hed_schema_constants import HedSectionKey
from hed.schema.schema_io import df_constants, xml_constants
from hed.schema.schema_io.schema2base import Schema2Base
class Sch... |
bae15e4b4c654546912802d521cde4f047e826ec47a9c8f9c6fd73460bccb2d3 | Python | 10,101 | 210 | from collections import defaultdict
from pddlstream.algorithms.downward import get_literals, apply_action, \
get_derived_predicates, literal_holds, GOAL_NAME, get_precondition
from pddlstream.algorithms.instantiate_task import get_goal_instance, filter_negated, get_achieving_axioms
from pddlstream.language.constan... |
1c681cee54f9c7a4acf7be7be6a3c5fcaa16cf45ee27d2c72a637914a03aa387 | Python | 10,102 | 321 | from pathlib import Path
from string import Template
import json
import numpy as np
from nilearn import plotting, datasets, image
from neuroquery_image_search._datasets import fetch_data
def studies_to_html_table(studies):
"""Transform DataFrame of similar studies to an HTML table.
Parameters
---------... |
21f0b4cc4668e268a10be8008b5dba43f447b7156300142fc47caaa1eafe3a92 | Python | 10,105 | 257 | #!/home/jm/Softwares/anaconda3/envs/tf/bin/python3
# OWNER : SUBINOY ADHIKARI
# EMAIL : subinoyadhikari@tifrh.res.in
import os, sys, stat
import gc
import pickle
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.optimizers import Adam
from denoising_variational_convolutional_... |
adbb433bb3aa8c5e451931a3c260cf53cf4fbf1cba9ff431f81662239f28c25b | Python | 10,108 | 219 | # coding=utf-8
# Copyright 2021 The HuggingFace Inc. team.
#
# 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 applicable... |
19dbab4d223da35e2d5c4d693f155b9ca76da022aa1bbf8bc80f6868bfb70f5f | Python | 10,112 | 225 | """Validates of Def, Def-expand and Temporal groups."""
from __future__ import annotations
from hed.errors.error_reporter import ErrorHandler
from hed.errors.error_types import TemporalErrors, ValidationErrors
from hed.models.definition_dict import DefinitionDict
from hed.models.hed_group import HedGroup
from hed.mod... |
1a2ba26fa5282468c6a8f465dfc71974678edb1d773f2b0128a988b1e8d9b47d | Python | 10,112 | 297 | import numpy as np
from scipy.stats import gamma, norm, multivariate_normal
from scipy.stats import beta as beta_rv
import sys
sys.path.append("../../lib_c/")
from smc2 import smc_c
import matplotlib.pyplot as plt
import time
from numpy.random import multivariate_normal as multi_norm
from scipy.misc import logsumexp
sy... |
cb718216b4dd7dd1f338ff8ee02325bf6f68b08b583c75baadf6d43ea3e8ccf9 | Python | 10,119 | 263 | """
Utilities to support HED searches based on strings.
"""
import re
from collections import defaultdict
from itertools import combinations, product
import pandas as pd
def find_matching(series, search_string, regex=False):
"""Find lines in the series that match the search string and returns a mask.
Synta... |
e5aadfa3ce7b56f57888c4a99b84fd72d27995f125e53e09f288fa4436b7ddd8 | Python | 10,120 | 257 | # 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... |
18ab345fc8fd8095b1d9c9703c755eabda574bce620529754cc1ae509fb34d6c | Python | 10,122 | 320 | import io
import json
import os
import sys
from contextlib import ExitStack
from typing import List, cast
import bpy
import numpy as np
_INCREASED_CLIP_END = 1e4
_DEFAULT_CAMERA_CLIP_END = 1e2
_DEFAULT_VIEWPORT_CLIP_END = 1e3
class Unset:
"""Sentinel for an argument that was not passed (``None`` is a meaningful ... |
75a09ffcf2ed9e19037dcb0639cc18033498e888611cbd42f83b5c2adc5f5dd8 | Python | 10,122 | 190 | """
COUNT_NOISE_VS_STEP8.py - written 2026-09-16. Closes OPEN C.
WHY THIS EXISTS. `THESIS.md` Step 8's table has two rows and needs three. The third is
Pospisil's own count-noise arm - the error type he DID test for - and Step 8 currently
says of it:
"Pospisil's own count-noise comparator has not been ... |
3bbc1bf081d3b173b6e659cac3d2ee06fa5f463176d01d3e77c7ef37ceff2169 | Python | 10,123 | 287 | from __future__ import print_function, division
import os
import glob
from typing import Any, Dict, List, Tuple, Union
import numpy as np
from PIL import Image
import torch
import topaz.mrc as mrc
class ImageDirectoryLoader:
def __init__(self, rootdir, pathspec=os.path.join('{source}', '{image_name}'), format=... |
1809375ef56eca64080046575a14a1f7b38bba6683aad5542d1383e9d07d1513 | Python | 10,124 | 375 | import numpy as np
import os.path
import json
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from construct import *
import requests
import base64
import png
from io import BytesIO
import itertools
import Image
#Path hack.
import sys; import os
sys.path.insert(0, os.path.abspath('..'))
from mysql impor... |
21715122f63d16471ae010ba386e1a0d27bb781640a66d5d2413bb5f4ed60011 | Python | 10,126 | 272 | from ast import Dict
import os, logging
from typing import Union, List, Tuple, Dict
from . import *
import numpy as np
from ase.io import read
import torch
from torch.utils.data import DataLoader, BatchSampler, RandomSampler, SequentialSampler
from torch.utils.data.distributed import DistributedSampler
from .utils impo... |
e3192d7f8e7d64271604cb12d1acf793278d5a5cc7577fb028eb8f3679f13d89 | Python | 10,127 | 273 | """Age group prediction using M/EEG RSN features
"""
# Set up dependencies
import os
import copy
import numpy as np
from sys import argv
from sklearn.linear_model import LogisticRegression
from osl_dynamics.analysis import static
from osl_dynamics.data import Data
from osl_dynamics.inference import modes
from osl_dyn... |
be7cb9cfc0ce008f8da17df35de144fe083c8505fac5e9c7df73fcb9b12a61d1 | Python | 10,128 | 269 | import numpy as np
import warnings
from os.path import join as pjoin
import pandas as pd
import scipy
import requests
import io
import glob
from scipy.stats import zscore
from sklearn.linear_model import LinearRegression
def df_from_url(url: str, sep: str, header):
s = requests.get(url).content
return pd.read... |
79167c67780dfcb19f4859922f0f1a4d04cdbcb6940ccd166419a74b616ae3d1 | Python | 10,130 | 155 | import os
import glob
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.AlphaFoldDB")
@utils.copy_args(data.ProteinDataset.load_pdbs)
class AlphaFoldDB(data.ProteinDataset):
"""
3D protein structures predicted by AlphaFold.
This dataset covers proteomes of 4... |
aba4938cad82544c6e7e4e29895966a2df99c21ac26732af1b415a0883c7bf80 | Python | 10,131 | 277 | # -*- coding: utf-8 -*-
import numpy as np
import os
import h5py
rec_header_dtd = \
[
("nx", "i4"), # Number of columns
("ny", "i4"), # Number of rows
("nz", "i4"), # Number of sections
("mode", "i4"), # Types of pixels in the image. Values used by IMOD:
# 0 = unsigned... |
e823534d4020083f4cfa58912660a39697cd10278b0448dd703b68a97cb53ad2 | Python | 10,132 | 272 | import torch
import torch.nn as nn
def simple_autoencoder_loss(input_data, encoder, decoder, **kwargs):
"""
data: feature
"""
# Pass the input through the encoder and decoder
encoded_data = encoder(input_data)
reconstructed_data = decoder(encoded_data)
# Calculate the reconstruction loss ... |
39d9f6d8421a8e169e5528391403a8e6675723e9b38330f252ec369df65f862a | Python | 10,133 | 297 | # 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... |
464bafd3f81c3c45e84382325e186112a84c44fde000059d0e57f6800a4cc532 | Python | 10,135 | 285 | # 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... |
ec0f09e3de7a7f434e1c979817ac5033feb8315c9bbbc28afa3383ec5334707a | Python | 10,138 | 226 | """
Created on Wed Apr 13 02:41:15 2022
@author: Haotian Teng
"""
import os
import sys
import toml
import argparse
import itertools
import numpy as np
from tqdm import tqdm
from typing import List, Union
from xron.utils.seq_op import fast5_iter,med_normalization,dwell_normalization,combine_normalization,norm_by_noisie... |
4a6598aa754d046fbaf984a96bc4a17e6556b43d0176e9e31a85f69eee1aefd7 | Python | 10,139 | 227 | # 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... |
77a4402c04681409c74c02844b962856a43bd6785bb4280d3651aa9c7430a53f | Python | 10,140 | 121 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
c71c0fd57d4e176f5412056e2186d28e0c9f9b643df036a4d7cd966f6f92a23d | Python | 10,140 | 121 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
d19a0ec3726ab5d6f6a3a52171f9bd4c460ba521770193fe0ab94cccc04cb963 | Python | 10,142 | 290 | import site
from typing import Callable, List, Dict, Optional, Literal, Tuple
import torch
from torch import nn
from hotpp.layer.radial import ChebyshevPoly
from .base import AtomicModule
from ..layer import EmbeddingLayer, RadialLayer, ReadoutLayer
from ..layer.utils import ElementLinear
from ..layer.equivalent impor... |
25b21065fbf19ce8198daa1851f2a1680f1d5138df048903d60a9b9e68acc898 | Python | 10,143 | 277 | # -*- coding: utf-8 -*-
#
# syncopy.specest fooof backend tests
#
import numpy as np
import pytest
from syncopy.specest.fooofspy import fooofspy
from syncopy.tests.backend.test_resampling import trl_av_power
from syncopy import synthdata as sd
from fooof.sim.gen import gen_power_spectrum
import matplotlib.pyplot as ... |
33bef057b043bcef10566a0776d8c03526e6e67a951b2ec08df419b2ec4a2012 | Python | 10,146 | 277 | import torch
from torch import nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import MathOperations
from elasticai.creator.nn.integer.MPQ.batchnorm1d.design import (
BatchNorm1d as BatchNorm1dDesign,
)
from elasticai.creator.n... |
bcf689b5ed4858878616829759d5fa751a5ee6520a7269a12a84fc469ffe3b77 | Python | 10,148 | 285 | from __future__ import annotations
import numpy as np
import torch
from dgl import batch
from sklearn.model_selection import StratifiedKFold, train_test_split
from base import BaseDatasetsManager
from dataset import TCGA_Program_Dataset, TCGA_Project_Dataset
from utils.logger import get_logger
from .sampler import Bo... |
b30b39b7a195eab471874892d09420d0157dbe4e956f5d478e1dfcd00e6daead | Python | 10,151 | 292 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
60f82c5b420450f74c3de0f704edbf564ddda53ab328ac7d4267340a47d31805 | Python | 10,153 | 288 | """
Author: David Kappel
Copyright (C) 2024, by the author.
See the LICENSE.txt file for more information.
Code snoopies:
implementation of network model for Synaptic Predictive Processing (SPP) learner.
"""
import numpy as np
import progressbar
import signal
import sys
from copy import copy
fr... |
ca678ef1c48d0bd801f258e320788de5f9491e6638259d5ae4c36eb4555d05bf | Python | 10,155 | 273 | # -*- coding: utf8 -*-
import numpy as np
from pydrake.all import (
BasicVector,
LeafSystem,
PortDataType,
MathematicalProgram,
AbstractValue,
)
from pydrake.multibody.multibody_tree import MultibodyForces
from examples.drake.utils import get_model_actuators
plan_types = [
"JointSpacePlan",
... |
84dfff7505e62a3f477d4011dd8f97e0b4bbd04e04e8ac0dbb4705f836ec29b9 | Python | 10,156 | 309 | """Radiation pattern of an off-axis dipole in cylindrical coordinates.
Tutorial Reference:
https://meep.readthedocs.io/en/latest/Python_Tutorials/Near_to_Far_Field_Spectra/#radiation-pattern-of-an-antenna-in-cylindrical-coordinates
"""
import argparse
import cmath
import math
from typing import Tuple
import matplot... |
06dfd93792eb45e4476e6f37d5088f43aa390609b667782a321433226dbf883c | Python | 10,160 | 121 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
86c1fe15ebb6aacdcf4c56cf2505175dbc179673c76db690311440ee5ae1d938 | Python | 10,160 | 121 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
13f2a27bbe56b3f152496c10da268a689de60abca29cacb6cfde439d99c953c4 | Python | 10,165 | 247 | """Blue Brain CCFv3a atlas: registry wiring + downloader conversion/ontology logic.
The multi-GB template download itself is not exercised here; these cover the parts
that don't need the remote data - the ontology flatten, the PIR affine convention,
the structure-id -> parcellation-index remap, and the registry/co... |
e45b5d2f6b7b11dea066e799d87cded9e5b8a22a4223571c86bce046a3e1f676 | Python | 10,165 | 333 | import cocotb
import numpy as np
import pytest
import torch
from cocotb.clock import Clock
from cocotb.triggers import ClockCycles, FallingEdge, ReadOnly, RisingEdge
from cocotb.types import LogicArray
from cocotb.utils import get_sim_time
from elasticai.creator.arithmetic import FxpArithmetic, FxpParams, int_converte... |
fbcc9b56d6f7aec1d433f960ede4324fa20ea95e06320af904edbf89231c142b | Python | 10,170 | 246 | import subprocess
import pandas
import io
import requests
import time
import json
from matplotlib import pyplot as plt
import numpy as np
from merlin.core import analysistask
class SlurmReport(analysistask.AnalysisTask):
"""
An analysis task that generates reports on previously completed analysis
tasks ... |
343a6f2e4abdd0c57bc9e3476b44e5518b68487e3a05d7e8cbf218f55ea0f4fa | Python | 10,174 | 246 | """Atlas-selection / load-dispatch mixin for the CCF boundary editor.
Carries the Atlas Selector entry point (``_on_pick_atlas``) and the
dispatch into the right loader based on the resolved ``AtlasChoice``:
3D-volume editing (``_dispatch_3d_atlas`` -> ``load``), 2D section-browse
(``_dispatch_2d_atlas`` -> ``loa... |
87d85914df1181b1c3f96e95510a22a0aa072e7e7a91640029b790df9f03461c | Python | 10,177 | 195 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
29eac2ffec032f319b2946c7d6b771e518476573fc8eef117256ef8335eb522e | Python | 10,178 | 276 | # 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... |
4ada469a335ba66ab16d37b3dcc97139a0c18ed05b6e362384950c5014c373a1 | Python | 10,183 | 349 | # 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... |
47cd819ebe99e6908cd7ba02280e30deff01fabe263be562bc462f33a910500e | Python | 10,184 | 226 | """Tests for per-tile gain compensation (stitching seam removal).
See docs/superpowers/specs/2026-08-12-tile-seam-gain-compensation-design.md.
The solver estimates one multiplicative gain per tile so that overlapping tiles
(same physical tissue) agree; a cross-section median builds a per-tile-position
gain field.... |
7041843da76584a3db3b8a059bfc16b37418299d74b25b006231896fdf621b2e | Python | 10,184 | 205 | import os
import re
from typing import Callable, Dict, Tuple, Union
import numpy as np
from scipy.io import loadmat
from ....utils import get_random_dir_path
from ..base_dataset import BaseDataset
class SanDiegoSSVEPDataset(BaseDataset):
'''
San Diego Square Joint Frequnecy-Phase Modulation SSVEP Dataset: l... |
87e1cb955c7d8fcaca57985f480c9c3f60293928254f3efb474b73eea09b6c41 | Python | 10,187 | 315 | """
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
"""
import hashlib
import os
import re
import threading
import time
import warnings
from base64 import b64encode
from ._internal_utils import to_native_string
from .compat import basestring, str, urlparse
from .cookies imp... |
c9c2925f9af6c5b61498160976239e08fb08153ba57e5117824fadf19696d2f2 | Python | 10,189 | 260 | import numpy as np
import tiffile
import SimpleITK as sitk
import h5py
import tqdm
outputs = []
f_vol_fix = '/mp/nas3/Margaret_mouse/round001_HIPV_ROI14_pp.tif'
f_vol_move = '/mp/nas3/Margaret_mouse/round002_HIPV_ROI14_pp.tif'
f_vol_out = '/home/ckapoor/margarets_data/round002_HIPV_ROI14_pp_warped.h5'
fixed_img = ti... |
3eeda883606344e62d4bfef49b765c4abcfa2df63827414c62eebb91f48c1e32 | Python | 10,190 | 278 | import functools
from typing import Callable, Optional, List
import torch.nn as nn
from torch import Tensor
from .modules import BasicBlock, Bottleneck, InvertedResidual, Conv2dNormActivation
from .modules import get_attention_module
from .backbones import model_dict
resnet_arch_block_dict = {
"resnet18": BasicBl... |
96e13399c632a1bb159db4590b1e58c38e337aa2684b4238bf14476d1cb952ec | Python | 10,192 | 102 |
from argparse import ArgumentParser,FileType
def parse_train_args():
# General arguments
parser = ArgumentParser()
parser.add_argument('--config', type=FileType(mode='r'), default=None)
parser.add_argument('--log_dir', type=str, default='workdir', help='Folder in which to save model and logs')
pa... |
289424061fd76df6feaac079eb4608108b6b4e909968e878fd831f06d7795c86 | Python | 10,194 | 353 | """Handwritten parser of dependency specifiers.
The docstring for each __parse_* function contains ENBF-inspired grammar representing
the implementation.
"""
import ast
from typing import Any, List, NamedTuple, Optional, Tuple, Union
from ._tokenizer import DEFAULT_RULES, Tokenizer
class Node:
def __init__(sel... |
6edf3285a0fa4cb081123d6d9c6547d9bae0f89066af6b0dd3c1fc7570e4c8e2 | Python | 10,195 | 275 | import struct as st
import numpy as np
import os
class CustomError(Exception):
pass
def f_GetTRCHeader(pstr_File):
s_fileID = open(pstr_File, 'rb');
s_Status = s_fileID.seek(175, 0)
s_HeaderType = s_fileID.read(1)
s_HeaderType = int(st.unpack('B' * int(len(s_HeaderType)), s_HeaderTy... |
83cffd513efa3eb8abd9634e312c048876e4fc2c3650ce0bfafe883707b6e82f | Python | 10,195 | 277 | import os
import shutil
import tempfile
import argparse
import datetime
import json
import time
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from monai import transforms
from monai.apps import DecathlonDataset
from monai.config import print_config
from monai.data import DataLoader
from ... |
d154beabe3f6ebbf2fb8b80bc6eead3025a549e1ca9e6d6f49e644d7f16bbec3 | Python | 10,195 | 259 | from dataclasses import field
from itertools import product
from typing import List, Tuple
import numpy as np
import asyncio
import time
from pylsl import local_clock
from psychopy import monitors, visual, core
from ._gratings import make_gratings
from ._instructions import (
show_opening_instructions,
show_br... |
615403e58b335f6bfd71571f9699c64e741df42f1b3663997e0e45d81c93a884 | Python | 10,196 | 269 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sb
from itertools import combinations
import timeit
def proj_dist(candidates, sampled):
"""
Computes projected distance from each candidate point to the set of already sampled points.
For the candidate point c, its projected distance to s... |
84a09167ea5c6f33cf0f97d38c64ad5c473b2e1f2640869bbd7d7e006901fbd4 | Python | 10,197 | 297 | import os
import glob
import pickle
import random
import numpy as np
from scipy.optimize import linear_sum_assignment
import tensorflow as tf
import ramanspy as rp
import autoencoders
def set_seeds(seed: int):
"""
A function that sets relevant seeds for reproducibility.
Parameters
----------
se... |
b6b6981aa2fd866708b1c26126f2fc4c8d5c69a63fb9f76363eedf3d3cd1ba10 | Python | 10,198 | 206 |
# Transform log files into csv files
import os
import argparse
import pandas as pd
def get_proba_per_axis_repartition_of_predictions(table, axis, slices):
axis_proba = (table[(table.axis == axis) & (table.pred > 0) & ([x in slices for x in table.slice])].shape[0]) / float(len(slices))
axis_proba = round(ax... |
475f38a58d0b154913f30abd2f1df8addba29ffd9fa9a75884ef78365769fd67 | Python | 10,199 | 324 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Fit non-probabilistic LDS model
Cross-validation
Created on Thu Jun 13 2019
@author: jmagraner
"""
#%% SLURM custer scheduler specs
# As we are submitting a large number of jobs, add these lines before importing
# anything to enforce SLURM resource allocation, sinc... |
1fc1df67f44764613dcfe7d96e3886ed514d7346a08913b7133ee91ca2086e19 | Python | 10,203 | 316 | #!/usr/bin/env python2
#
# Manta - Structural Variant and Indel Caller
# Copyright (c) 2013-2019 Illumina, Inc.
#
# script modified in 2025 to also support DRAGEN structural varaint calls
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... |
3925b1861546e584cdfa6cc7b1abfaf69b7b7bd6f0587702588903f8590d0532 | Python | 10,207 | 237 | """
Script for extracting particles randomly within a segmented membrane
Input: - Directory with the _imod.csv files with reference picked particles for each microsome
- Directory with offsets for each microsome in a tomogram
Output: - A STAR file and a list with the coordinates pickled per ... |
f9fc828de166903a1dd6fbbb0812f76695ce17062e4e01215bde383f8adfdc24 | Python | 10,207 | 265 | ##
# \file register_image.py
# \brief Script to register the obtained reconstruction to a template
# space.
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date October 2017
#
import re
import os
import numpy as np
import SimpleITK as sitk
import pysitk.python_helper as ph
import ... |
af48809386b14c10c56e79eb42bef6b6ebe7e2fe9a7943f038bbe0f56c53dbce | Python | 10,208 | 313 | #!/usr/bin/env python
"""Utility functions for statistical analysis."""
# =============================================================================
# GLOBAL IMPORTS
# =============================================================================
import numpy as np
import scipy.stats
import scipy.special
from skl... |
4dfa644b5dae391d3212771f13d74544dbfa4433e156b5f88c94b6fe633074a6 | Python | 10,209 | 218 | # Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
8c1098955d41caa0cb7778ddf115803c3a3193e6467fd06ad962fc4ee37eac94 | Python | 10,212 | 258 | from __future__ import division
from __future__ import print_function
# coding: utf-8
# In[13]:
#!/usr/bin/python
from builtins import range
from past.utils import old_div
import os
import re
import glob
import sys
import argparse
from subprocess import call
import stat
def main(argv):
print(argv)
defaultt... |
0b01d046969d3b718630a7b5490fa94861fe007916b09826a82960a859fa8abe | Python | 10,213 | 246 | from itertools import chain
import numpy as np
from .utils import tqdm_mpi_tofile
from .matlcao import MatLCAO
'''
This module implements the integration of a real-space function between two atomic orbitals on a real space grid.
'''
def gridintg_two_center(structure, lcaodata, FFTgrid, pairs_ij, func):
'''
... |
288a249ed5756d7248a821e36f288c974816a324304bcccabe919f92ce33dc3e | Python | 10,213 | 371 | """
This code was taken from: https://github.com/aaren/wavelets
"""
from __future__ import division
import numpy as np
import scipy
import scipy.signal
import scipy.optimize
import scipy.special
from scipy.misc import factorial
__all__ = ['Morlet', 'Paul', 'DOG', 'Ricker', 'Marr', 'Mexican_hat']
class Morlet(objec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.