sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d451bc725e42a4b4d66fd2fdeb586fe298f0679ee8ab250180c07e370399b380 | Python | 10,989 | 252 | import argparse
import csv
import h5py
import numpy as np
MOVIE_CONFIGS = {
'Marvelous': {
# mamut file containing lineage graph vertices
'vertices_file': '/home/common/Datasets/Marion/2017-08-02_17.49.34_stPVB003-2-2xDR5v2_F3_nb25_Marvelous/paintera_final/2017-08-02_17.49.34_stPVB003-2-2xDR5v2_F3... |
91e7d511d59039f28c9944883c1768bdd580882d7e51c5c7c8d95bf44e4d65ae | Python | 10,990 | 180 | import sys, os, h5py
import numpy.random as npr
import numpy as np
from optparse import OptionParser
import pandas as pd
from sklearn import preprocessing
from sklearn.model_selection import KFold
def main():
usage = 'usage: %prog [options] <data_file> <out_dir>'
parser = OptionParser(usage)
parser.add_opt... |
f16ee9f85d61b6a2f5edb140daa148ec13162af01f353c65e3ed56b0d87c41bd | Python | 10,991 | 218 | """Instrument genuine decoder-layer activations with a state-dependent residual."""
from __future__ import annotations
import time
from typing import Any
import numpy as np
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from .reservoir import Reservoir
class Coupling:
def __init__(se... |
ce3696cdb1e2f11890507e2a4d9ef861eaf4dd3b8aa07f6066261457f6299ad8 | Python | 10,993 | 266 | # -*- coding: utf-8 -*-
#
# Test resampledata
#
# 3rd party imports
import pytest
import numpy as np
# Local imports
import dask.distributed as dd
from syncopy import redefinetrial
from syncopy.shared.errors import SPYValueError, SPYError, SPYTypeError
from syncopy.datatype import CrossSpectralData
class TestRedef... |
da7d1b449acfe0d50f16a498c819dd7310f8b7e38072e09648e2206469c0ad17 | Python | 10,993 | 298 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : distance_vs_correlation.py
# Author : Yufeng Liu
# Date : 2023-02-15
# Description :
#
#=======... |
fa882fdc4947a5298fcce83e443cbc14857531cc2bc3627c7d15a3b79e829dc1 | Python | 10,993 | 330 | from collections import OrderedDict
from typing import Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torch.utils.checkpoint import checkpoint_sequential
from . import utils
class LayerNorm(nn.LayerNorm):
"""Subclass torch's LayerNorm to handl... |
06cdef0d6ab73df57acfac9a59d984a56c596cf201e1c1bd354fd74f1c68f95b | Python | 10,994 | 284 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import TensorDataset, DataLoader
from torch import Tensor
from torch.utils.tensorboard import SummaryWriter
from torchsummary import summary
import numpy as np
import datetime
import os
import pickle
from tqdm import tqdm
f... |
6bb3be7cca7647e37b887d9674faadb8fb5ee283f51a6c791adaa820bbc22ced | Python | 10,996 | 250 | import os
class GlobalConfig:
""" base architecture configurations """
# Data
seq_len = 1 # input timesteps
# use different seq len for image and lidar
img_seq_len = 1
lidar_seq_len = 1
pred_len = 4 # future waypoints predicted
scale = 1 # image pre-processing
img_resolution = (160, 7... |
6ccb9f066b9bbc6d638b0d26b84d16df8b5c3eba9eec46b98b769724aa338b64 | Python | 11,006 | 285 | """
Apply CNMF to sima datasets
Adopted from
https://github.com/agiovann/Constrained_NMF/blob/master/demoCNMF.ipynb
by Andrea Giovannucci
(c) 2016 C. Schmidt-Hieber
GPLv3
"""
from __future__ import print_function
import sys
import os
import time
import subprocess
import multiprocessing as mp
import tempfile
import g... |
68f99ba80ae220263309a2704a15d309a95145644e84c0c680eae8f14edbaefb | Python | 11,010 | 222 | import utils
import torch
import argparse
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
from sklearn.preprocessing import MinMaxScaler
from GlobalModel import MSTSDNModel
de... |
18cca27984d53caa3f6c515c32b700cf3846aa8d573167e50de5a2089d8efe70 | Python | 11,011 | 363 | from __future__ import annotations
from dataclasses import dataclass
from typing import Callable
import numpy as np
from . import filters
from .filter_parameters import parameters_for
@dataclass(frozen=True)
class OperationSpec:
function: Callable
framewise: bool = True
FILTER_REGISTRY: dict[str, Operati... |
2f50f50a6ddb68114914e36dc7e703f1a87cba3ff70e8ab06ce416643d748b73 | Python | 11,011 | 280 | #!/bin/env python3
'''
Convert particle pools and reactions to Feynman diagrams encoded in NetworkX MultiDiGraphs.
'''
from re import L
import matplotlib.pyplot as plt
import networkx
from networkx.drawing.nx_agraph import graphviz_layout
from typing import Callable
from enum import Enum
from dataclasses import datacla... |
bb8ca39fd683470a0aa4e1e13312fbdc8b02650cad885a4bcfcb4d7db9de3e40 | Python | 11,020 | 233 | # -*- coding: utf-8 -*-
import itertools
import torch
from supar.models.dep.biaffine.transform import CoNLL
from supar.structs import (ConstituencyCRF, Dependency2oCRF, DependencyCRF,
LinearChainCRF, SemiMarkovCRF)
from supar.structs.semiring import LogSemiring, MaxSemiring, Semiring
from t... |
5e8b5b7ce6b671c8081686df90eb2d7bfecbfeae2d62e28833acc4c2355b20cf | Python | 11,026 | 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... |
08ab0f12f558752946d1ed9bb25cd3591586a61ac4936b3a4957bbf60819b71e | Python | 11,027 | 203 | """Value characters follow the schema and the specification's character_sets.json.
The value-text set (from HED 8.5.0 a textClass value may not contain (, ), # or ~), the declaration-wins gate
(decisions D2 and D5, 2026-09-30), the value-text rule for a placeholder without a value class (D3), the
double-quote rule, an... |
4f135bd7da62a9dddd703bc7a558e790085f6a0268efa2cf9baf3df06b20033b | Python | 11,028 | 220 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from connalysis.network import topology, local
from scipy import stats
import numpy as np
import pandas as pd
from scipy.special import comb
import pickle
from connalysis import randomization
import os.path
# Me... |
0315c66f7645ba1fa3be5335edfd5bd66561c9deaf222f6207e19f031166074e | Python | 11,030 | 366 | """
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
from logging import getLogger
from typing import TYPE_CHECKING, cast
from ase.optimize import BFGSLineSearch
from ... |
5c2c142ee645de998c81872896950783207b3d43692cc1d98e163f3969fff389 | Python | 11,032 | 271 | """Download the Blue Brain Project's extended & improved CCFv3 atlas (Nissl + annotation).
Source: Bjerke et al., "An extended and improved CCFv3 annotation and Nissl atlas of
the entire mouse brain" (Imaging Neuroscience 2025), Zenodo record 14034334, CC-BY 4.0.
https://zenodo.org/records/14034334
Why a SE... |
103a577bd87cd289377fe645ea9e2aa2b79c5c101c8fa3d2b78e3fc01f4357d6 | Python | 11,035 | 240 | # ********************************************
# *** REAL TIME PUPILLOMETRY FIXATION TASK ***
# ********************************************
# This script can be run in PsychoPy to present a fixation task embedded with
# the rtPupilPhase real time monitoring of pupil size fluctuations method.
# Written by: Sharif I.... |
f9753d11e622b93fa3cd4992bb6b84f36c1ec227578c2da95e94074d8f09302c | Python | 11,035 | 284 | # 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... |
81b1ddfddc03b87319b16d01d94dbc7eb0471bd8e9b84be5cac54d1997256b15 | Python | 11,039 | 302 | ### Modules
# basic
import os, glob, h5py, random, itertools
import numpy as np
from Bio.Seq import Seq
from Bio import SeqUtils
from sklearn import preprocessing
from scipy.interpolate import interp1d
from collections import OrderedDict
from npy_append_array import NpyAppendArray
# dask
import dask
import dask.bag as... |
f36eab587353327a1383987b9a8fe239a654242a4af0a899d1c2d40e5f3be958 | Python | 11,039 | 246 | from torch.utils.data import Dataset, DataLoader
import numpy as np
import pandas as pd
import os
from torch.utils.data import DataLoader, ConcatDataset
class BrainTumorDataset(Dataset):
def __init__(self, csv_file='biopsies69_neighbors_3marker_all5_threshold0.5.csv', if_label=0, neun_label="high"): #biopsies_sca... |
2c40e98bf82b3366962bce14f6a6d41838953851c7f1767ba7fcc08949cbd367 | Python | 11,040 | 309 | # General
from pathlib import Path
import numpy as np
import statistics as stats
import matplotlib.pyplot as plt
import pickle
import json
# File IO
import pickle
import scipy.io as sio
# Pytorch
import torch
from torch.utils.data import Dataset, DataLoader
from torch.utils.data import random_split
import torch.optim... |
f01263d90c10429aed1087c7161ee4ef07c355b45a2bec904fb89f4cc99fbcbd | Python | 11,040 | 316 | # Copyright 2020 by Gongfan Fang, Zhejiang University.
# All rights reserved.
"""
https://github.com/VainF/pytorch-msssim/blob/234e52884851798a5b99c4dec07ad12d409d1a3a/pytorch_msssim/ssim.py#L57
"""
import warnings
import torch
import torch.nn.functional as F
def _fspecial_gauss_1d(size, sigma):
r"""Create 1-D... |
af3020862aeeac9f492f1d052dbcd7f04c2c2ce2f3f247143b4ea114d8227c35 | Python | 11,042 | 294 | import numpy as np
import os, gc
import torch
import pickle as pkl
import scanpy as sc
import pandas as pd
from sklearn import preprocessing
from utils.data_utils import rand_train_test_idx
from sklearn.neighbors import kneighbors_graph
class NCDataset(object):
def __init__(self, name):
"""
based ... |
cb36cab9ee2ce7545b08adc64908d233aa08af23a0f8a4d5beceaa25ed561ff7 | Python | 11,042 | 306 | # Node-group asset "Density Style ISO Surface" (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 T... |
c8e346150ebfd5ce1e812eb29791c0c45f198d92fade51ff2d425166e3318607 | Python | 11,056 | 311 | from sklearn.metrics import average_precision_score, accuracy_score, f1_score,roc_auc_score
from sklearn import metrics
from sklearn.calibration import CalibratedClassifierCV
from sklearn.linear_model import LogisticRegression
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches... |
76db7556250679b62c70a3ed5f5edbaa8285064ddc7029e1d81f84ef523e9d73 | Python | 11,057 | 303 | """Smoke tests for the seven CCF Boundary Editor quick-win features.
One test class per feature. Each feature gets at least one smoke test
that the new attribute / method exists and produces the expected
observable state. Follows the canonical ``qapp`` + shared-conftest
autouse fixture pattern.
"""
import num... |
e8b8859616ffdf33a006b586de93ef5e9825f209f70a990ce6f7b52b1d862fea | Python | 11,058 | 258 | import time
import sys
from OnlineDetectors.online_nab_detector import OnlineAnomalyDetector
from OnlineDetectors.earthgeckoSkyline.algorithms import (
histogram_bins, first_hour_average, stddev_from_average, mean_subtraction_cumulation,
median_absolute_deviation, stddev_from_moving_average, least_squares)
#... |
547beb904402ce22001c5817dd8a7fd0643ee52a7a9651de7b5bd05b5fb4cf1a | Python | 11,059 | 294 | """Tests for cellpose_sam.metrics - match_points edges, load_points, compute_metrics."""
import os
import numpy as np
import pandas as pd
import pytest
# ---------------------------------------------------------------------------
# match_points tests
# ----------------------------------------------------... |
7ea85a38096d466955b4d061b894379d1ead8b96f24a6b4fa35ebe9b7913fe45 | Python | 11,062 | 268 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 2 11:38:48 2023
@author: felipe
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 22 12:39:05 2023
@author: felipe
"""
import sys
import os
sys.path.append(os.path.abspath('../../'))
sys.path.append(os.path.abspath('../'))... |
411d141fd7ea0deca75f1dc9a24e90a966a05bb5247e39bd6e9d03754a6bed03 | Python | 11,064 | 275 | """
Script for extracting an analyzing a GraphMCF from Chlamy tomos and analyze a specific membrane attached
protein according to its dimension
22.05.16
Input: - Input GraphMCF generated with mb_graph_batch.py script
Output: - Output GraphMCF with the pre-segmentation of the protein specified
"... |
3b3d2f7f258a9c24f36ef9685cfe6d34800f740e6fb4c13549f71b954de87c42 | Python | 11,067 | 260 | """Implementation of the python API for the flagser C++ library."""
import numpy as np
from ._utils import _extract_unweighted_graph, _extract_weighted_graph
from .modules.flagser_pybind import compute_homology, AVAILABLE_FILTRATIONS
from .modules.flagser_coeff_pybind import compute_homology as \
compute_homology... |
2890694e189a57829cc1c5ece0d94c7de77e54576afa207a1dedfdfb6c89b913 | Python | 11,069 | 304 | # Importing core packages
import numpy as np
import matplotlib.pyplot as plt
import os
from Library import Characterize2 as ch
import sys
import time
import datetime
import shutil
import pathlib
from PIL import Image
import cv2
import screeninfo
import h5py
def points2pos(img,points,box_size):
pts = np.array([*poi... |
4c2051bfa3ec986944ac250ccefdcc7f743cad62a1ba233adaf951f8bcaa2852 | Python | 11,072 | 332 | # 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... |
f2e5b92971f48b2e4d9d79fc6eae431e28ff0566fe30054c02b7d9875330c5f9 | Python | 11,074 | 212 | from __future__ import print_function
import time
from itertools import product
from copy import deepcopy, copy
from pddlstream.algorithms.instantiation import Instantiator
from pddlstream.algorithms.scheduling.plan_streams import plan_streams, OptSolution
from pddlstream.algorithms.scheduling.recover_streams import... |
c8d80f2b64717e7be80cc00f881be7c45a3a757c1ca9523db2d6d96710f0b5fd | Python | 11,076 | 269 | '''
Source code for crispAI module
'''
import argparse
import pandas as pd
import numpy as np
import pickle
import os
import pdb
import subprocess
import datetime
def message(msg):
#print(f'{datetime.datetime.now()}: {msg}')
# h-m-s format
print(f'{datetime.datetime.now().strftime("%H:%M:%S")}: {msg}')
... |
4e55c10b020e82a30a648ebd26494e6969c85907d1e57552620bd6059b4f4f08 | Python | 11,077 | 208 | import argparse
import os
import time
from scipy.io import loadmat, savemat
import numpy as np
import logging
import datetime
import torch
from torch import optim
from torch.utils.data import DataLoader
import network
import loaders
# Update: add loading trained generic model as an option. The file lo... |
435b6485145b2e1c317c648f341afde677a809c08a16fe41cff3bb9a2599d5c7 | Python | 11,080 | 264 | import time
import sys
from NAB.nab.detectors.base import AnomalyDetector
from NAB.nab.detectors.earthgecko_skyline.algorithms import (
histogram_bins,
first_hour_average,
stddev_from_average,
mean_subtraction_cumulation,
median_absolute_deviation,
stddev_from_moving_average,
least_squares)... |
e9a684e6a162011a8a31fe297d8613623af8815a9f0715eb26d1953ec38b8226 | Python | 11,081 | 333 | import torch
import torch.nn as nn
from einops import rearrange
class MultiscaleTemporalLayer(nn.Module):
"""Multi-scale temporal convolution layer.
Args:
seq_len (int): The sequence length.
kernel_size (int): The kernel size for convolution.
"""
def __init__(self, seq_len: int, kern... |
80ace497a8e0cf655d7bc2766f047969ec3066f307276d0452b66b19ef595b32 | Python | 11,082 | 178 | import json
import os
import unittest
from hed.models.sidecar import Sidecar
from hed.tools.bids.bids_file import BidsFile
from hed.tools.bids.bids_sidecar_file import BidsSidecarFile
from hed.tools.bids.bids_tabular_file import BidsTabularFile
class Test(unittest.TestCase):
@classmethod
def setUpClass(cls):... |
7b9dbb8e47906faac510d9278d68b1d95cb11403fb505951b7d0ec66359ffcfa | Python | 11,087 | 388 | # 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... |
e37f4594b1c2f4921ea543f2f68707976ac1da857190c5fac6f8b60d49b2b451 | Python | 11,089 | 300 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import subprocess
import sys
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.experiment import ARGPARSER
from lab.steps import Step
from downward.experiments.fast_downward_experiment import FastDownwardExperiment
from downward... |
a042f7aab44a4f2cb70af86a2f022f95194ecd1e31268b19b91fc003c48c6772 | Python | 11,092 | 294 | """
oxasl.gui.structure_tab.py
Copyright (c) 2008 University of Nottingham
"""
import os
import wx
import wx.grid
from oxasl.image import AslImage
from oxasl.gui.widgets import TabPage, NumberChooser, NumberList
class AslInputOptions(TabPage):
"""
Tab page for specifying the ASL input data
"""
def ... |
166b01ca8a64ed8e541a4ade35485c2a6aff000096936789409a0ac76864efff | Python | 11,096 | 250 | import torch
from torch import nn
import numpy as np
import torch.utils.checkpoint as cp
import torch.nn.functional as F
from wsilearn.utils.cool_utils import is_iterable
from wsilearn.dl.torch_utils import print_model_summary
from wsilearn.dl.models.model_utils import *
import warnings
# warnings.filterwarnings("err... |
445bfd6466529e361de9f29e654842e43bb1c6392a5d90dfac900d23194396f2 | Python | 11,096 | 412 | XLRDVERSION = 0.
USEOPENPYXL = False
NOTANUMBER = -1.7976931348623157e308
try:
import cpickle as pickl
except ImportError:
import pickle as pickl
try:
import odf.opendocument as opendocument
from odf.table import Table as opendocumentTable
from odf.table import TableRow as opendocumentTableRow
from odf.ta... |
bf51f17e1a880665e841ccb7ed4f8679c829327bf28a701ee8faf9fc73100fa3 | Python | 11,096 | 349 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:AUTHOR: Jens Petersen
:ORGANIZATION: Heidelberg University Hospital; German Cancer Research Center
:CONTACT: jens.petersen@dkfz.de
:SINCE: Wed May 17 14:29:20 2017
:VERSION: 0.1
DESCRIPTION
-----------
Create segmentations for all experiments under a given XNAT endp... |
02c8ea5320d84927c235b9690ab3cb57f505bbd39ffa7ed1ff9b1d66f6deea0b | Python | 11,097 | 307 |
import numpy as np
import tensorflow as tf
slim = tf.contrib.slim
_BATCH_NORM_DECAY = 0.9
_BATCH_NORM_EPSILON = 1e-05
_LEAKY_RELU = 0.1
_ANCHORS = [(12, 16), (19, 36), (40, 28),
(36, 75), (76, 55), (72, 146),
(142, 110), (192, 243), (459, 401)]
@tf.contrib.framework.add_arg_scope
def _fixed_... |
6c6f9df094ddc1fe756baea6e1ca6d1cf72366091801269e61ceca9ed861de64 | Python | 11,099 | 272 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : morphology_features.py
# Author : Yufeng Liu
# Date : 2022-04-15
# Description :
#
#===========... |
fff7d949a4ebdfd933101809adc424314ac78c2801a7c114906e0d7dadd8e83e | Python | 11,099 | 309 | import torch
import torch.nn as nn
import numpy as np
from torchvision import transforms as T
import scipy.io as sio
# All data parameters import
from utils.params import ParamsPack
param_pack = ParamsPack()
from backbone_nets import resnet_backbone
from backbone_nets import mobilenetv1_backbone
from backbone_nets im... |
f5e7364cceb3c5505b8f86e596bbaf6c523d43ceb5e14d8bda533829e4f02fec | Python | 11,103 | 335 | #
# 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,... |
0775dcaae659849d6438d47410c34a36260b8957aa43f7b02dc56dbaeb82c7ba | Python | 11,108 | 320 | # -*- coding: utf-8 -*-
#
# The singlepanel plotting functions for Syncopy
# data types
# 1st argument **must** be `spy_data`
#
# Builtin/3rd party package imports
import numpy as np
from numbers import Number
# Syncopy imports
from syncopy import __plt__
from syncopy.shared.errors import SPYWarning, SPYValueError
fr... |
46f4d7d14f8ce0e8d2fe7c748d66acd7a4b9a098c8d239f0dee0dbb6d9ba9c54 | Python | 11,108 | 275 | # -*- coding: utf-8 -*-
"""
Created on ***
@author: ***
"""
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Training script for full-precision VGG-Net (CNN 1) on CIFAR10.
Links
-------
.. https://www.tensorflow.org/versions/r0.9/tutorials/deep_cnn/index.html
.. https://github.com/tensorflow/tensorflow/tree/r0.9/tensor... |
4b14961706e8ff2ec06b4abb0f528d9e3bc095bc673acfb5eede46886d11f348 | Python | 11,109 | 264 | """
Per-tile gain compensation for stitching seams.
After flat-field (vignetting) correction a faint tile-boundary seam remains inside
the tissue: a per-tile brightness difference that no single global vignetting field
can remove. On this data the difference is a *systematic* per-tile-position bias
(the same pa... |
9f00c81353356a58f3c935a4bdbf00964ae50aa6c880e398c0d348352894c7be | Python | 11,114 | 347 | 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 ClockCycles, ReadOnly, RisingEdge
from cocotb.types import LogicArray
from cocotb.utils import get_sim_time
import elasticai.creator_plugins.adders as adde... |
9ac1bf1b15edfc844e7be2a5ee185cd0370ea066f432bfdf2626bb828d45c905 | Python | 11,116 | 299 | # 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... |
8699add2c2519db162fe7a691a36069661d33185e61698724292079d184b9a4a | Python | 11,121 | 276 | import json
import logging
import math
import bpy
import databpy as db
import MDAnalysis as mda
import numpy as np
from MDAnalysis.analysis.hydrogenbonds import HydrogenBondAnalysis
from ...blender import coll
from ...nodes import handlers as node_handlers
from ...nodes.geometry import StyleHBonds
from ..base import En... |
aa6d8a1e1beda821c6609259adbc12a435b056fc91d768c8c0ceabd8e2bdc0ac | Python | 11,121 | 330 | # 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... |
57bf04c4806855b70583a206b294ee570ff85cde625e85894f217faa86695d6b | Python | 11,122 | 220 | #!/usr/bin/env python
import os
import json
import pickle
import prepping_data
import building_model
import pandas as pd
import numpy as np
import nibabel as nib
from nilearn.masking import unmask
from sklearn.linear_model import Lasso, Ridge, LinearRegression, HuberRegressor
from sklearn.svm import SVR
f... |
3a5abd0640e9bafb976f96c844018fa0505ece7cf0494a2f268335a9392cba3d | Python | 11,124 | 247 |
import random
import numpy as np
import datetime
import argparse
import sys
sys.path.append("/media/benelot/SPACE/loci/IDSC/Physiology/projects/lagrangian-learning-the-final-nla/")
from model.network_params import ArchType, ActivationFunction, NetworkParams, IntegrationMethod
# plotting
import matplotlib
matplot... |
fab59f0e7245c26ac1ba6ddda750dec3be7cb9e4d72989c7e50d6ecfccf6f9b1 | Python | 11,124 | 296 | import csv
import xml.etree.ElementTree as ET
import fnmatch
import math
# process boundary points coordinate from XML file
def D3ParseXMLROI(xmlfile, slicenum):
tree = ET.parse(xmlfile)
root = tree.getroot()
xcoordlist = list()
ycoordlist = list()
xycoordlist = list()
for a1 in r... |
01595f684899f3148e086f47c5c5bcdce2817eb0ae6d2ef588fca9d9f3d221ed | Python | 11,125 | 261 | # -*- coding: utf-8 -*-
from __future__ import annotations
from typing import List, Tuple
import torch
import torch.nn as nn
from supar.utils.fn import pad
from supar.utils.tokenizer import TransformerTokenizer
class TransformerEmbedding(nn.Module):
r"""
Bidirectional transformer embeddings of words from v... |
544a8a803be13a320db78d2e4dc001becf20c1e533502902b3941939a6cd654b | Python | 11,125 | 247 | # -*- coding: utf-8 -*-
"""
Created on Jun 21 2023
@author: Jonas A. Thiele
"""
###Visualizing differences between results from: models trained with functional links (functional connections) between random nodes vs. random links,
###models trained with random links vs. most relevant links,
###models traine... |
9c1608459afee012b714178fc99bef5b3c0cb7dba73b9c709db27287d4c6d78a | Python | 11,125 | 198 | # This code was taken from: https://github.com/assafshocher/resizer by Assaf Shocher
import numpy as np
import torch
from math import pi
from torch import nn
class Resizer(nn.Module):
def __init__(self, in_shape, scale_factor=None, output_shape=None, kernel=None, antialiasing=True):
super(Resizer, self)._... |
e43aac2f56e9b3e94b35a08f5d81b197553bed03ebe88d0c7f150dcd2aec36af | Python | 11,125 | 298 | """Tests for hed.models.schema_lookup.
Tests cover:
- generate_schema_lookup builds a valid dict from a real schema
- save_schema_lookup / load_schema_lookup round-trip
- Both individual HedSchema and HedSchemaGroup inputs are handled
"""
import json
import os
import tempfile
import unittest
from hed.models.schema_l... |
b37aea5204568248e922c69c4e52e05078876791adb537cf1506e583bcd0443c | Python | 11,128 | 251 | from __future__ import print_function
import argparse
import random
import numpy as np
import time
import math
from collections import OrderedDict, defaultdict
from pybullet_tools.utils import load_model, TURTLEBOT_URDF, joints_from_names, \
set_joint_positions, HideOutput, get_bodies, sample_placement, pairwise_... |
bcf3586b73996f18dbb85c9a568d139a19b2d4567594a3160a74fba1d5e922d9 | Python | 11,128 | 277 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import re
import sys
import os
from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style, BEL
from .winterm import enable_vt_processing, WinTerm, WinColor, WinStyle
from .win32 import windll, winapi_test
winterm = None
if windll is not None:
... |
98fa781910347b1d9af584b090c5156fdde3f647d2c96a873f478b981006897e | Python | 11,129 | 274 | import argparse
from cProfile import label
import pathlib
from pathlib import Path
import json
import os
import shutil
from collections import OrderedDict
import sys
import nibabel as nib
import numpy as np
from tqdm import tqdm
import re
# this script is employed to generate the nn-Unet based dataset format
# as desc... |
ce23416b3002c0d13cc3e0b01287af7764637eae694a466716332e7c42152390 | Python | 11,129 | 283 | import os
import pickle
import numpy as np
from numpy.linalg import norm
from neuromaps import nulls
from neuromaps.stats import compare_images
from nilearn.image import math_img, resample_to_img
from nilearn.masking import unmask
from nilearn import datasets
from nilearn.maskers import NiftiMasker
import pickle
from a... |
5e85956c6f6b5f6389217bb486dc9cdb021512e539439955b0cbfba45aed41ac | Python | 11,131 | 293 | # Node group ".MN_utils_style_sticks" (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 r... |
7c19a4d65c544fd72d5aca8629ebb30e087dd7d35abf07861446beb4196845b5 | Python | 11,131 | 274 | import os
import pickle
import numpy as np
from typing import List, Tuple, Dict
from PIL import Image, ImageDraw
from allensdk.core.swc import Morphology
from allensdk.core.nwb_data_set import NwbDataSet
from allensdk.ephys.ephys_extractor import EphysSweepFeatureExtractor
def get_bounding_box(
morph: Morph... |
b6eca97667214a064a5fda74d5ad8d97ebb75515acb06b1341257e8a425d1de5 | Python | 11,131 | 255 | '''
Description:
Compare scNODE predictions with different hyperparameter settings..
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import torch
import numpy as np
from plotting.__init__ import *
from benchmark.BenchmarkUtils import loadSCData
from plotting.PlottingUtils import umapWithoutPCA
from plotting i... |
1d8308467625c6e04e6a7c3d9e8c3d928e765ed3fdeb36571b69409ee06396aa | Python | 11,138 | 349 | """Computes the adjoint derivative with respect to shape parameters.
This is a 2D example for computing the derivative of the diffraction efficiency
of the first transmitted order of a 1D grating with respect to the grating
height. The accuracy of the adjoint derivative is validated using the
brute-force finite-differ... |
ecc8b46aa3f59dfb81d4aa3a7563fb1e2a06b08747fb281ed5d6a4f86f351bcd | Python | 11,143 | 257 | """
Classes to resolve ambiguities, gather, expand definitions.
"""
import pandas as pd
from hed.models.definition_dict import DefinitionDict
from hed.models.definition_entry import DefinitionEntry
from hed.models.hed_string import HedString
class AmbiguousDef:
"""Determine whether expanded definitions are cons... |
6b9b2a721c889833babbcae1ad0f888a90d66f85f78abd45102d139d69b96f54 | Python | 11,145 | 224 | """Random-weight tiny-transformer software tests, not scientific evidence."""
from threading import Event
import numpy as np
import pytest
import torch
from conftest import assert_no_hooks
from liquidaion_fly.observatory_engine import ContextOverflowError, ObservatoryEngine
def test_single_model_separate_cache_hist... |
a9d57d7d136e6bb35c0206926d53883c0d0a99aba39e890507c0791e3e9d14fe | Python | 11,152 | 267 | from typing import Tuple
import numpy as np
import torch
from einops import rearrange
from einops.layers.torch import Rearrange
from torch import nn
def pair(t):
return t if isinstance(t, tuple) else (t, t)
def get_emb(sin_inp):
emb = torch.stack((sin_inp.sin(), sin_inp.cos()), dim=-1)
return torch.fla... |
f09abdf82020b8648fa390f185e90497abf10df0dc1bddd362eec9b9034a8eef | Python | 11,152 | 229 | # Transformer adopted from https://github.com/keras-team/keras-io/blob/master/examples/nlp/text_classification_with_transformer.py
# UNet adopted from https://github.com/VidushiBhatia/U-Net-Implementation
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import Input
from tensorflow.keras.mode... |
a733b3bfda2d35aef117616a9b6ffe71aa5b5263407f9746d7a0b663e07a695f | Python | 11,153 | 193 | import torch, pickle
import h5py
from torchvision import datasets,transforms
from utils.dataset_utils import SpiralDataset, SpiralPlusDataset, SpiralDataset10, GMMDataset10, NonlinearFunction, BasisDataset, MNIST_custom
def dataset_loader(dataset,trans,num_workers,pin_memory,batch_size):
if(dataset=="f... |
98b4542dae9a3c5c3da00f0225944ae9d48e781d5e7af7776936c614002c5952 | Python | 11,154 | 295 | from __future__ import print_function
# Conditions (of any type) are immutable, because they need to
# be hashed occasionally. Immutability also allows more efficient comparison
# based on a precomputed hash value.
#
# Careful: Most other classes (e.g. Effects, Axioms, Actions) are not!
class Condition(object):
... |
83466ac7332217fac2f3678c01c931fc72ed3ddf78a1d42f8a69d0e21a7c5512 | Python | 11,158 | 404 | # Copyright (c) 2023-2024 Blue Brain Project/EPFL
# 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 law or agreed ... |
cd180d390a0870f9bc578b68113ea1feb556a979f4ec74d3ba709c53b3370970 | Python | 11,160 | 274 | import re
import os
import glob
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
import mne
from mpl_toolkits.axes_grid1 import make_axes_locatable
# Directory where the files are located
directory = "Results_files/KMER... |
c7f9f86c88e901d1c6e0e32dd0a0b6d011417de5f9895be2415fdf1b1a9ec273 | Python | 11,162 | 355 | # IMPORTS
from argparse import ArgumentParser
from copy import deepcopy
from typing import Any
import pytorch_lightning as pl
import torch
from pl_bolts.callbacks.byol_updates import BYOLMAWeightUpdate
from pl_bolts.optimizers.lars_scheduling import LARSWrapper
from pl_bolts.optimizers.lr_scheduler import LinearWarmupC... |
fbd4fa5f323ff675a0044c6696ab18eeff8c5f17bb0531359d94b46f5db5a29f | Python | 11,163 | 327 | import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import meep as mp
import meep.adjoint as mpa
import numpy as np
from autograd import numpy as npa
from tqdm import tqdm
from model import *
from data.dataset import CategoricalStructureAdjointDataset
import argparse
from utils import *
import os... |
831dbc5ee45d3d8a4ef182b264d455f5a6d4948d99c547b43b97a30e55c89bd9 | Python | 11,165 | 355 | #
# Auxiliaries needed across the entire package
#
# Copyright © 2020-2025 Ernst Strüngmann Institute (ESI) for Neuroscience
# in Cooperation with Max Planck Society
# Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Builtin/3rd party package imp... |
f92f3511998c4302ee413b0146a400c3cb6ef8387be36209708ae63d66b04563 | Python | 11,165 | 278 | # -*- coding: utf-8 -*-
"""
Copyright 2018 Jacob M. Graving <jgraving@gmail.com>
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... |
99d8fa13b824310d389407d1e10474dd22879073a40f89b41484a7b9b7c54d6a | Python | 11,167 | 349 | """Utilities for generating and handling file names."""
import os
import re
from datetime import datetime
TIME_FORMAT = "%Y_%m_%d_T_%H_%M_%S_%f"
def check_filename(test_file, name_prefix=None, name_suffix=None, extensions=None):
"""Return True if correct extension, suffix, and prefix.
Parameters:
t... |
e7e797c63a705797dcdccc4116bc2e1701e3ead306739a31e1ccd31c25a277b9 | Python | 11,169 | 406 | # levenshtein.py
import sys
from itertools import combinations
import dnaio
from polyleven import levenshtein
from fba.utils import get_logger, open_by_suffix
logger = get_logger(logger_name=__name__)
# In-memory implementation of TinyFastSS
# https://github.com/fujimotos/TinyFastSS
def indexkeys(word, max_dist)... |
0448145a18aef72c047e27bedf8c99fdf08fe3dcf3bc92582635a8f048d09a1f | Python | 11,173 | 321 | #!/usr/bin/env python
# coding: utf-8
# ### LASSO parameter range experiments, single gene
#
# `scikit-learn` has two different implementations of logistic regression: [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) (using the `liblinear` coordinate... |
ee26e4d1a502c5c598f4a6a891f8e7723e06931b93a505034226c3ee56849eaa | Python | 11,175 | 306 | import tensorflow as tf
import tensorflow.experimental.numpy as tnp
def pearsons(y_true, y_pred):
'''
Helper function to compute r2 for tensors of shape (batch, length)
'''
y_true.shape.assert_is_compatible_with(y_pred.shape)
y_true = tf.cast(y_true, 'float32')
y_pred = tf.cast(y_pred, 'float32... |
ae2763e5abcb9d7f11492f0566068ba83f3441094584a16c91680591a15f5686 | Python | 11,179 | 283 | import os
import sys
import datetime
import numpy as np
import SimpleITK as sitk
from PIL import Image
from shutil import copyfile
from functools import cmp_to_key
from src.utils import sitk_utils as sutils
from src.utils import file_utils as futils
from src.utils import evaluation_utils as eutils
from... |
683aa20ef684c0528ab91206de3e9bba043b00c89c08cb314301b27a25869b32 | Python | 11,183 | 194 | import torch
from torch import nn
from torchdrug import core, data
from torchdrug.layers import functional
from torchdrug.core import Registry as R
# from torchdrug.data import CG22_PackedProtein
from cg_steps.cg_protein import CG22_PackedProtein
@R.register("layers.CG22_GraphConstruction")
class CG22_Graph... |
bea86ce275771caddf240d1c7c488a810d3464d741094aa8f7a14ebc68bfb62e | Python | 11,184 | 317 | """"""
"""
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free softw... |
06e6a4b06551364317e1667af2dd156bfbc53fa4b3fc9f4331462bd6f90062c3 | Python | 11,188 | 297 | from matplotlib import pyplot as plt
import numpy as np
import pandas
from merlin.plots._base import AbstractPlot, PlotMetadata
from merlin.analysis import filterbarcodes
class MinimumDistanceDistributionPlot(AbstractPlot):
def __init__(self, analysisTask):
super().__init__(analysisTask)
def get_re... |
252381a92eab56973b56e09ad7c816e2e813006fabc008532e85148b95736ff4 | Python | 11,193 | 150 | """SIGN_WORLDS_ANALYSE.py 2026-10-07. Analysis of SIGN_WORLDS.py, written before any result was read, exactly as
pre-registered in 04-NOTES/PREREG-2026-10-07a-SIGN-WORLDS.md (S0, S1, H1-H6). Output: 06-OUTPUT/sign_worlds.txt and
06-OUTPUT/sign_worlds_predictions.csv. usage: python SIGN_WORLDS.py analyse"""
import os, ... |
622616bc72c57ae9406b785fd133d76bc7e20e16315baf1ad525f59eb2a4cb8b | Python | 11,198 | 468 | from __future__ import annotations
from dataclasses import dataclass, field
# ======================================================================
# CANONICAL MORPHOGLIA VISUAL STYLE
# ======================================================================
DEFAULT_DPI = 300
DEFAULT_MORPHOLOGY_STATE_PALETTE = "MG1"... |
57858e83de0fcae359551e277ff27f12132977c90956bf750a4771fb42e18f82 | Python | 11,202 | 286 | from glob import glob
import json
import numpy as np
import os
import csv
from rich.traceback import install
install()#(show_locals=True)
from rich import print
from rich.panel import Panel
from rich.table import Table
from rich.text import Text
def idx2chr(idx):
return chr(idx + 65)
def fmt_grid(grid, colour=T... |
7224c738e278c4b7bee9b5f0a27d49c4a0c5a8f79bc80cdc8a900f9c84a84aee | Python | 11,206 | 291 | """
Generates a ListTomoParticle object from a input STAR file
Input: - STAR file for pairing STAR files with particles and particles shapes
Output: - A ListTomoPaticles pickled object for every STAR file row
"""
################# Package import
import os
import numpy as np
import scipy as sp
import ... |
3a39f5bdce9b8b78c481d528891370b6f6929f85cd19c729a5df0d1b0eecd90c | Python | 11,210 | 294 | """
Author: David Kappel
Copyright (C) 2024, by the author.
See the LICENSE.txt file for more information.
"""
import numpy as np
from scipy.stats import poisson, norm
from .stdp_rule import gen_stdp_rule
from .utils import get_parameters, collect_history, kl_div
def make_connectivity_matrix(model_spe... |
df387b0310bce3c33943eb966c5fe69d068e3fa547c8fe9297f9b5824ca30dfa | Python | 11,212 | 239 | import warnings
from collections.abc import Sequence
import numpy as np
import pandas as pd
import statsmodels.api as sm
from anndata import AnnData
from fast_array_utils.conv import to_dense
from joblib import delayed, effective_n_jobs
from scipy import stats
from scipy.sparse import issparse
from statsmodels.tools.s... |
c1d7f0750922a85154ae10a65d2502cfad2d9bc9fd0f5732e5e196071f787fec | Python | 11,213 | 284 | import datetime
import json
import os
import pickle
import subprocess
import sys
from dreamcoder.fragmentGrammar import FragmentGrammar
from dreamcoder.frontier import Frontier, FrontierEntry
from dreamcoder.grammar import Grammar
from dreamcoder.task import Task
from dreamcoder.program import Program, Invented
from d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.