sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2bb93af6cc378d8e439935e8489415b14b452102983d054e48926106e1afff21 | Python | 3,732 | 90 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... |
32a07c05aff57fa79bbccdea710c89bde1811fee01ec8cc93f012e39faa94e70 | Python | 3,732 | 91 | import os
import sys
import pyntbci
# -- Path setup --------------------------------------------------------------
sys.path.insert(0, os.path.abspath(".."))
# -- Project information -----------------------------------------------------
project = "PyntBCI"
copyright = "2021, Jordy Thielen"
author = pyntbci.__author... |
4619c75195aa10bde642c42097e53290660511096f15e297abdb98b4d41ca17a | Python | 3,732 | 105 | """Support utilities for hed_cache locking"""
import os
import time
import portalocker
TIMESTAMP_FILENAME = "last_update.txt"
CACHE_TIME_THRESHOLD = 300 * 6
class CacheError(Exception):
"""Exception for cache locking or threshold errors."""
pass
class CacheLock:
"""Class to lock the cache folder to ... |
6b4807fa8aca734ba1a1677985afba4a2f3cc7f3762d0be385e84349188fd8a1 | Python | 3,733 | 75 | import torch
import torch.nn.functional as F
from .dcs import DCS_multi_lay_resolution
from .attention import Gate_Attention
class Stream_integerator(torch.nn.Module):
def __init__(
self,
input_channels: int = 128*3,
kernel_size: int = 3,
embedding_dim: int = 96,
dcs_num_... |
ba25c771f1c2080c2ea3f253db73f69a0188e850eb3b14b1867c78d6a19997bd | Python | 3,734 | 157 | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from libs.layers import GraphConvolution
from libs.layers import GraphIsomorphism
from libs.layers import GraphIsomorphismEdge
from libs.layers import GraphAttention
from libs.layers import PMALayer
class MyModel(nn.Module):
def __init__... |
c8c9f9a8fb221302a980fbc809fef2d9515c7d38338884e8813d8bdf1e0cff80 | Python | 3,734 | 104 | import os
import numpy as np
import pytest
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
pytest.importorskip("PySide6")
pytest.importorskip("pyqtgraph")
@pytest.fixture(scope="module")
def qapp():
from PySide6.QtWidgets import QApplication
app = QApplication.instance() or QApplication... |
0536f109b4f760541c5d306623947abcfdd39fa1587c9959ba29cd28e2c0b668 | Python | 3,735 | 131 | import torch
import torch.nn as nn
try:
from inplace_abn import InPlaceABN
except ImportError:
InPlaceABN = None
class Conv2dReLU(nn.Sequential):
def __init__(
self,
in_channels,
out_channels,
kernel_size,
padding=0,
stride=1,
use_batchnorm=True,
... |
3d6616bebf6d0490b40baa3f86713e03561d1fd8855af4fb75d2f189486202c7 | Python | 3,736 | 106 | #!/usr/bin/python
# sbm version 1.1, release date 30/05/2012
# Copyright 2012 Aurelien Decelle, Florent Krzakala, Lenka Zdeborova and Pan Zhang
# sbm 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 vers... |
490e0a80cb14bfb7335c2f139479e5bc4ffee3a566213bdbbc4f51eb36f8699f | Python | 3,736 | 101 | """
This script checks for data missing patterns in the fMRI data
Input: path where all the preprocessed data is
Output: path where the figure will be saved
@author: trianaa1
"""
import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
import mat... |
a6702d47709f58b724386bfbea8e9d073c257ed3bcf2e69352554ddde9c2d55d | Python | 3,736 | 130 | ##
# \file evaluate_image_similarity.py
# \brief Evaluate similarity to a reference of one or more images
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date Feb 2018
#
import os
import numpy as np
import pandas as pd
import SimpleITK as sitk
import nsol.observer as obs
from nsol.similarity_... |
af6a8cd6430c944df400dd4a46b818a76ba84b4c85116f9d83a8b03c515f8238 | Python | 3,737 | 86 | """Kim DevCCF atlas: registry wiring (8 modalities) + downloader ontology logic.
The multi-hundred-MB P56 download is not exercised here; these cover the parts
that don't need the remote data - the ITK-SNAP label -> graph-mapping conversion
and the registry / config-menu wiring.
"""
import pytest
def _dl(... |
b3768f5d0177a257e77cf119b740cf5513ab790792c85281e4b876b8470e2185 | Python | 3,737 | 131 | # 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... |
a49dcc60fe6742ef5c91040b7e815dc74a476778a1a563ea808016052e196496 | Python | 3,738 | 99 | import torch
from torch.cuda.amp import autocast
from easydict import EasyDict as edict
import yaml
import pandas as pd
import argparse
from torch.utils.data import DataLoader
import numpy as np
import torchvision.transforms as T
from time import perf_counter
from sklearn.metrics import confusion_matrix, roc_auc_score
... |
cdb44feb5b840cee29fbe4919d12727d377c6d5ff72b194db85efcf833e4dff7 | Python | 3,739 | 105 | """
A simple example of Optuna Artifact Store.
In this example, we optimize coefficients (a, b) of a quadratic function:
f(x) = a * x**2 + b
The demo works as follows:
1. Create a dataset by ``create_dataset``,
2. For each trial, Optuna suggests a candidate of (a, b),
3. For each trial, plot the prediction,
4. Up... |
8c9d23d9a8116d43eca47f05405d25cf3ccdfe136efc86de0de5db7245bebc59 | Python | 3,740 | 108 | from unittest import TestCase
from codex.utils.graph_algos import pathways, reachable_node_counts
from tests import get_testing_neuron_db
class TestGraphAlgos(TestCase):
@classmethod
def setUpClass(cls):
cls.neuron_db = get_testing_neuron_db()
def test_reachable_node_counts(self):
num_ce... |
b3876f6e08e6d7a722eeef51eb63278d68ad610b6a99836f020fb4c1b9d6e5e2 | Python | 3,740 | 129 | import numpy as np
import pandas as pd
from cuppa.components.profile_similarity import cos_sim, ProfileSimilarityTransformer, NoiseProfileAdder, \
NonBestSimilarityScaler
class TestCosSim:
def test_array_vs_array_cos_sim_is_correct(self):
mut_counts = np.array([1, 0.5, 0.25, 0.1])
mut_profil... |
e3515af6346cddfa42d35b3287f91427b66db5e974094db2248ef44c03063736 | Python | 3,740 | 88 | # -*- coding: utf-8 -*-
#
# Ensure tooling functions shared across the package work as intended
#
# Builtin/3rd party package imports
import numpy as np
import pytest
# Local imports
from syncopy.shared.tools import best_match
from syncopy.shared.errors import SPYValueError
class TestBestMatch:
# Source-arrays... |
1afc00cebbb22d6c8d086837c3e4d4656955578818ba3a4da1f59e6d43d340a6 | Python | 3,741 | 93 | """Define report loader class."""
import warnings
import re
import bioc
import pandas as pd
from negbio.pipeline import text2bioc, ssplit, section_split
from constants import *
class Loader(object):
"""Report impression loader."""
def __init__(self, reports_path, sections_to_extract, extract_strict):
... |
3d2e2c2af0ec54293b7eef81e4a1e7943e7522a8ad85ca4dac7c17b27f626421 | Python | 3,741 | 137 | #!/usr/bin/env python
"""
Blanks (sets to a given value) those voxels of a tomogram that correspond to
given segments.
This script may be placed anywhere in the directory tree.
$Id$
Author: Vladan Lucic (Max Planck Institute for Biochemistry)
"""
from __future__ import unicode_literals
__version__ = "$Revision$"
... |
58a93aabce13b630b0f730e0a7153c5b3e48892bebf9aa655c934b3de797e5f5 | Python | 3,741 | 119 | """Convert point coordinate files to Neuroglancer precomputed point annotations.
Supports two input formats via :func:`regtools.utils.io.points_io.load_points_file`:
- **Legacy** (``inputpoints.txt``): two header lines (``index`` + count),
then ``z y x`` per line.
- **Napari CSV**: CSV with columns ``inde... |
bf793a38a3f34dc911d141e88ff142f8f166f389904590573b570368efdf6b6f | Python | 3,741 | 95 | # Copyright 2017 The Xron Authors. All Rights Reserved.
#
#This Source Code Form is subject to the terms of the Mozilla Public
#License, v. 2.0. If a copy of the MPL was not distributed with this
#file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#Created on Mon Aug 14 18:38:18 2017
import argparse
import sys
... |
80234175d2a4553c2e1d13f436144f21b1c0697fe57c545c36d5a3043cf7b5c3 | Python | 3,742 | 109 | from pathlib import Path
import numpy as np
import pytest
import scanpy as sc
from mudata import MuData
try:
import ete4
except ImportError:
pytest.skip("ete4 not available", allow_module_level=True)
import pertpy as pt
CWD = Path(__file__).parent.resolve()
tasccoda = pt.tl.Tasccoda()
@pytest.fixture
de... |
05dabf0b044f29c4a88d3816c5c276adca0b695e1d26e22e247bd3d66c1a0857 | Python | 3,743 | 76 | """
Created on Wed Jul 20 11:04:29 2022
@author: Haotian Teng
"""
import numpy as np
from xron.utils.fastIO import read_fast5
from xron.utils.seq_op import fast5_iter
from itertools import groupby
from tqdm import tqdm
import argparse
import sys
def softmax(logits,axis = -1):
return np.exp(logits)/np.sum(np.exp(l... |
116e1f6a894a6ea72b8a7591256445663701999c84df7278436d8589ca5a984c | Python | 3,743 | 120 | # Node-group asset "Nucleic Chi" (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... |
902689003cdf13cefb65cf4dd87d89349f5b25d33f577562eb3c23700e3c0d8a | Python | 3,744 | 102 | """Regression: _thread_register must not crash when there's no ParametersTab.
A RegistrationTab whose app has no `parameters_tab` (nor `tab_parameters`) is a
supported config (see test_registration_app_version.py's `_FakeApp`, issue
#125): every advanced knob falls back to a pre-declared default. The
affine_metho... |
67d5d5a02a83d9e6000d0a69e3c33ce5a5cef7aea4579dfd0af0f45d42ad019e | Python | 3,745 | 93 | import os.path
import zipfile
import pandas as pd
from collections import defaultdict
from ckg.graphdb_builder import builder_utils
#########################
# SMPDB database #
#########################
def parser(databases_directory, download=True):
config = builder_utils.get_config(config_name="smpdbConfi... |
9da3eb371c21bef71682afdcbccc07175cf7d12300271c5ed058fcf62388fadf | Python | 3,745 | 118 | import torch
import torch.nn as nn
import math
import csv
import numpy as np
class EncoderLayer(nn.Module):
def __init__(self, hid_dim, n_heads, pf_dim, dropout, device, feat_dim, learnable_q=False, pos_enc=None):
super().__init__()
self.learnable_q = learnable_q
self.self_attn_layer_norm... |
f5d2cc6b7fec16a8a6afebf8e75d6aa3d5c6175c3dbb08eda4e20a0ac55bf57a | Python | 3,745 | 102 | import sys
import unittest
from unittest.mock import patch
import pandas as pd
import os
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src")
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../scripts")
from prepare_inputs import args, prepare_inputs
class TestPrepa... |
35081d21d465f68551e6a46e14ac72f1a0e1de0c470d4bde60fde378e32e718b | Python | 3,746 | 120 | #
# 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,... |
e4794a56f706bf38a5efa2549bfdf13f19fd7b7f04970ef16a014b0b8149167b | Python | 3,746 | 153 | import imp
import numpy as np
import pandas
import axelrod
prepare_data = imp.load_source("prepare_data", "src/prepare_data.py")
parameters_df = prepare_data.get_parameters_data_frame(
directory="data/raw_data/"
)
def test_parameters_data_frame():
expected_columns = [
"index",
"noise",
... |
4fe20bbd1396bce3ce169659539c898d6853be8844466ba226e00f79c3192c38 | Python | 3,747 | 115 | import os
import os.path as op
import numpy as np
from tqdm import tqdm
import mne
import nibabel as nib
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from scipy import stats
from params import PLOT_DIR as plot_dir
from params import BIDS_ROOT as bids_root
from params import EXTENSIONS as e... |
93842cdffcd1d520a787260818dff3288996e9f16db3ae320a1c2b479e604c72 | Python | 3,747 | 90 | #! /usr/bin/env python3
import os
import subprocess
import logging
import APT_interface
class cd :
"""Context manager for changing the current working directory, and automagically changing back when done"""
def __init__(self, path):
self.path = path
def __enter__(self):
self.old_path = ... |
2c5c7b1582e853afd50a6c0e5b2cf921c282380af07e19047b43fdc330b48112 | Python | 3,748 | 91 | """Write a tilted intensity/annotation pair as same-grid 2D NIfTI files."""
import os
import numpy as np
from regtools.utils.io.volume_io import save_nifti
def format_tilt_descrip(ap_index, pitch_deg, yaw_deg, pitch_um):
"""The tilt parameters as a NIfTI ``descrip`` string (<=80 bytes).
Parsed bac... |
74d3e828fb075c02d14ef7a87ae37486cee7947cab26bb177fa39db96b576927 | Python | 3,748 | 94 | """
Classes for extracting filaments and processing from Graph
# Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry)
# Date: 14.10.14
"""
__author__ = 'martinez'
__version__ = "$Revision: 002 $"
try:
from graph import *
except:
from pyseg.graph import *
try:
from globals import *
exc... |
95fb744b9dee390dc2501231527f8bf3325204930114eb2f8148993b88d6c0d8 | Python | 3,748 | 130 | import os
import threading
import traceback
import importlib
import sys
from PyQt5.QtWidgets import QWidget, QFileDialog
from PyQt5.uic import loadUi
import globals.global_func as gf
FILE_PATH, FILE_FULL_NAME = os.path.split(os.path.realpath(__file__))
FILE_NAME, FILE_EXT = os.path.splitext(FILE_FULL_NAM... |
d987b4f0bed5e318dddaf90cef2fa7651886a92ead32ad0df9a3adc20434fb3b | Python | 3,748 | 101 | import sys
import json
from pathlib import Path
import pandas as pd
import os
from itertools import combinations
import random
def process_coannotation(go_df, out_dir):
all_genes = list(set(go_df['systematic_id']))
go_2_gene_dict = {go: [] for go in list(set(go_df['acc']))}
for index, row ... |
2b3b43e71feeda21953df1d5febc750061532547cf9be85824e80921f96fbc69 | Python | 3,749 | 130 | import matplotlib.pyplot as plt
import meep as mp
resolution = 25 # pixels/μm
w1 = 1.0 # width of waveguide 1
w2 = 2.0 # width of waveguide 2
Lw = 10.0 # length of waveguides 1 and 2
# lengths of waveguide taper
Lts = [2**m for m in range(4)]
dair = 3.0 # length of air region
dpml_x = 6.0 # length of PML in ... |
c4e870964d6708a3ffce9e48d16ed03b30b6c87f4b56fc78bc9442b230bc59b0 | Python | 3,749 | 97 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GINEConv, global_mean_pool, global_add_pool, global_max_pool
from torch_scatter import scatter
dtype = torch.float32
class SerGINE(nn.Module):
def __init__(self, num_atom_layers=3, num_fg_layers=2, latent_dim=128,
... |
0a6e5f69776ab6aea615e17df45485fe156fc094f50ea4eb0ce4b805fed821a0 | Python | 3,750 | 115 | # 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... |
265858c467a90d86bbebb94892c1cd37bc6bd76b79da9038a81540b14b9cc8a2 | Python | 3,750 | 105 | import torch
import torch.nn as nn
from elasticai.creator.nn.integer.encoderlayer import EncoderLayer
from elasticai.creator.nn.integer.quant_utils import (
AsymmetricSignedQParams,
GlobalMinMaxObserver,
)
from elasticai.creator.nn.integer.sequential import Sequential
from elasticai.creator.nn.integer.vhdl_tes... |
8f687d07503874fe389048ba279cb5d22833862760c60522e9a302e847bfa64e | Python | 3,750 | 115 | # Node-group asset "Offset Curve" (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
... |
d57c98df22acc5daeffed490e996b913c7f9d155202ed5f281601cc3befb2fbc | Python | 3,750 | 89 | #!/usr/bin/env python
## this script first generates a participant by participant matrix
## to incorporate distance in age and sex between the participants
## (absolute distance in age, and 0 if same sex, 1 if different sex)
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplo... |
fa62391a7769bff46a2b8931851a4b01070f3a7aa9dedee8d37232c224802d71 | Python | 3,750 | 94 | import unittest
from hed.errors.error_types import TagQualityErrors
from hed.models.hed_string import HedString
from hed.schema import load_schema_version
from hed.tools.analysis.event_checker import EventChecker
class TestEventChecker(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.hed_sch... |
e8851b2d1f774f25909d51884d8bcb2f9851a55186bd35e9e654a251bd6d3fff | Python | 3,751 | 109 | import copy
import logging
import unittest
import numpy as np
from neurolib.models.aln import ALNModel
class TestSubsampling(unittest.TestCase):
"""
Tests wheteher model outputs are subsampled as expected.
"""
def test_subsample_aln(self):
model = ALNModel()
model.params["duration"] ... |
9aad4d6021ac33d61636863e66eece856e37f714808c32c8a18bdf7c500103f4 | Python | 3,752 | 122 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... |
e0e5094abcec307dde7da73deeddd4634a2b0444826acb322a7a2d63ab8d2dee | Python | 3,752 | 93 | import shutil, tqdm
from pathlib import Path
import cv2
from skimage.transform import resize
from skimage import img_as_bool
from wsilearn.utils.cool_utils import ensure_dir_exists
from wsilearn.utils.path_utils import PathUtils, get_corresponding_pathes_dirs
from wsilearn.utils.flexparse import FlexArgumentParser
i... |
c5f2a90a46418f45b5e6d533c2ec3869adcafce75e357d3b9a5c3a2effd89d3a | Python | 3,753 | 135 | from __future__ import annotations
import pytest
dask = pytest.importorskip("dask")
pytest.importorskip("distributed")
from pathlib import Path
from dask.distributed import get_client
from quacc import flow, get_settings, job, redecorate, strip_decorator, subflow
from quacc.wflow_tools.customizers import customize... |
de131ed68dc3db5f8187dba59ed229d74b0211db359025d782e174674627428d | Python | 3,754 | 64 | """LLN2X03_WB.py 2026-09-29. Pre-registration: 04-NOTES/PREREG-2026-09-29i-LLN2X03-WHOLE-BRAIN.md
Whole-brain check of REAL_SIGN_SCAN's one strong call: laboratory prior at type level vs the same with lLN2X03 inhibitory.
usage: python LLN2X03_WB.py [run|analyse] (workers: LW_WORKERS, default 4)"""
import sys, os, tim... |
ebf17252b6ee5650448fafc63b388a60f33c2c86cfe606880b6c34fd65908a93 | Python | 3,754 | 117 | # this run in tf114-gpu envir
from modisco.visualization import viz_sequence
import modisco
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import h5py
from collections import OrderedDict
import click
import matplotlib
matplotlib.use('pdf')
######################################################... |
41c1ba2590970689d2e8e7bb41f9124ac147c2983417e276e744255020b4203d | Python | 3,755 | 116 | # Node-group asset "Geometry to Planar" (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_CHE... |
2e6c994cbde9bb8a6d2b509869e59893630308327d0400c68bdc39abcb77ad40 | Python | 3,756 | 100 | # 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... |
71392d89e077ee135a73320e6fb2002e16d3598e6ca07c7406b5ec5960c6238b | Python | 3,756 | 106 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Written by Valeria Kebets and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
"""
# This function averages a 419x419 correlation matrix
# between/within networks (18x18)
# Based on function written by Csaba Orban
# Inputs:
# The inpu... |
0a79175acc1118407cb06533797b2e188701bbd48b577c908c4befd94545b109 | Python | 3,758 | 91 | #! /usr/bin/env python3
import os
import subprocess
import logging
import APT_interface
class cd :
"""Context manager for changing the current working directory, and automagically changing back when done"""
def __init__(self, path):
self.path = path
def __enter__(self):
self.old_path = ... |
8b6f046b762acf0a8b01c876f39704e2ddec890741986d48726d36d9310b6e2b | Python | 3,758 | 90 | '''
Description:
scNODE performance improvements vs. distribution shifts.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
from plotting.__init__ import _removeTopRightBorders
from plotting.__init__ import *
import numpy as np
from scipy.stats import spearmanr
from benchmark.BenchmarkUtils import loadSCData, ... |
90771f3e47162653714506cb099cb04fab7adf10a6cc6476f7c7d31dfd7d6acc | Python | 3,758 | 118 | # 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 to in writing, software
# distributed under th... |
0d8ece9985b6618caf1872bf8a47715fb2cf3de389081ac2dbe8186210292ec1 | Python | 3,759 | 115 | """Both preview panes own a set of orientation labels.
The panel used to build one set, hardcoded onto the atlas view and keyed by
letter. The input pane needs its own set, and its letters vary, so the sets are
keyed by EDGE SLOT and their text is assigned separately.
"""
import numpy as np
import pytest
... |
3a71c5e6b345b4b1e1134963935431be2008eb0593dd59ba18c79d8eef290fd0 | Python | 3,759 | 98 | import torch
from torch import nn
import torch.nn
import torch.nn.functional as F
class GlobalAvgPool2d(nn.Module):
def forward(self, x):
return F.avg_pool2d(x, kernel_size=x.size()[-2:])
class GlobalMaxPool2d(nn.Module):
def forward(self, x):
return F.max_pool2d(x, kernel_size=x.size()[-2:])
... |
61ac07c9563a779a117137abd37b50a3029d3f37b8bc0eb9ee9fbddd5771c6a7 | Python | 3,760 | 103 | """A BIDS tabular file with sidecar."""
from __future__ import annotations
from typing import TYPE_CHECKING
from hed.models.base_input import BaseInput
from hed.models.column_mapper import ColumnMapper
from hed.models.sidecar import Sidecar
if TYPE_CHECKING:
from hed.models.definition_dict import DefinitionDict... |
aceb76dd809f22de3743accb64487e26870ce92b35e9335a6e0a3df13f678743 | Python | 3,760 | 99 | import json
import os
import imageio.v2 as imageio
import numpy as np
from regtools.geometry_registration import io as gio
from regtools.geometry_registration.types import RunResult
def _make_result():
return RunResult(
registered=np.full((6, 8, 3), 100, np.uint8),
field_x=np.ones((... |
c8920185fe1c185386938fd443bc9b210933acb19ce70abe6b1e14c08d35d152 | Python | 3,760 | 106 | """Post-detection rules: refractory merge, amplitude cap, outlier rejection."""
from __future__ import annotations
import numpy as np
from msfeature.events import (
Microsaccade,
cap_amplitude,
cap_duration,
merge_refractory,
recompute_amplitude_direction,
reject_amplitude_outliers,
)
def _... |
89b74b12bb3d608644e0f93e1c5094c7f828e525bd07d5230d79d56274f444fe | Python | 3,763 | 94 | import torch
import logging
import os
import Models.model_func as Model_Func
import pickle
from tqdm import tqdm
class MNISTBaseline_Model(torch.nn.Module):
def __init__(self, device:torch.device, input_dim:int, classes:int):
super().__init__()
assert isinstance(input_dim, int), "input_dim is not ... |
f5909275cf248044cce701d24822cfeaf57e6f4bd1370e6506a9839692ef55e1 | Python | 3,763 | 108 | import argparse
import os
import os.path
import subprocess
from tqdm import tqdm
from pathlib import Path
import numpy as np
import skimage.io
from skimage.util import img_as_ubyte
#################################### ARGPARSE ##################################
usage = 'Enter the directory name where the fi... |
4b2f4a597cc9df3f091da43f89b2af2bb70985059c9db4802db13cfc37f0ad8e | Python | 3,765 | 108 | from pathlib import Path
from morphoglia import PipelineConfig, run_pipeline
# ======================================================================
# MORPHOGLIA 2.0.0 — SCRIPT INTERFACE
# ======================================================================
# Run this file FROM THE MorphoGlia_2.0.0 FOLDER.
#
# mac... |
43eac46687cd8160f0c5f0da37a6a46ce44dc82042799510c38764d832b2d80c | Python | 3,766 | 115 | # 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]:... |
63626162697851870d812d03ff810b030032f88d354fbb3193c9a59dacff7e89 | Python | 3,766 | 118 | import json
import numpy as np
import pytest
import zarr
def test_run_image_job_writes_stores(tmp_path):
from regtools.ome_zarr_converter.cli import run_image_job
import nibabel as nib
data = (np.random.rand(4, 16, 16) * 255).astype(np.uint8)
nii = tmp_path / "brainX.nii.gz"
nib.save(... |
b51a0e842c62b7458e98d4b94ad88087b37702c06236de90d0dca7fbf64fdf24 | Python | 3,766 | 135 | from __future__ import annotations
import pytest
dask = pytest.importorskip("dask")
pytest.importorskip("distributed")
from pathlib import Path
from dask.distributed import get_client
from quacc import flow, get_settings, job, redecorate, strip_decorator, subflow
from quacc.wflow_tools.customizers import customize... |
b980515b2bb74d74e1a9c64bd7479028624c31d05a8e369325b6bc5dc14e9298 | Python | 3,767 | 98 | # Taku Ito
# 12/12/2018
# Luke Hearne
# Feb, 2020
# dilateParcels.py
# On rutgers HCP with 1 node/8 cores/32gb mem - this script takes about 4 hrs to run
import numpy as np
import nibabel as nib
import pkg_resources
import multiprocessing as mp
import os
import time
## global variables for directories and atlas infor... |
efbb23a35b7bb19d707ea626b691547b7431de3a1778ae93311c8d4a5719b1f9 | Python | 3,767 | 104 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use('seaborn')
# %matplotlib inline
import networkx as nx
import sys
import os
# import modules within repository
my_path = r'C:\Users\Cole S Baker\Desktop\Thesis\Thesis\hgcn\hyperbolic-learning-master\utils' # path... |
dbb3cde7ae73a71ad195c6e9a01b91665ab95431de2224ad6ca00e740ffdfdd9 | Python | 3,768 | 113 | # pylint: disable=invalid-name, too-few-public-methods
"""Models for experiments and functions for setting them up"""
from importlib import import_module
from torch import nn, optim
from omegaconf import DictConfig
def criterion_factory(cfg: DictConfig, model_cfg: DictConfig):
"""Criterion factory"""
if "cu... |
e73afcef4fc3e8b44d8c03650eab873b5e9083b8a1bd2e71b85fb7dc00623fbb | Python | 3,768 | 90 | '''
Description:
scNODE performance improveements vs. distribution shifts.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
from plotting.__init__ import _removeTopRightBorders
from plotting.__init__ import *
import numpy as np
from scipy.stats import spearmanr
from benchmark.BenchmarkUtils import loadSCData,... |
5fc1ecc3435cb6dfc3cee52ca7575f71e8712e497dfb644d446b801054b4285b | Python | 3,770 | 133 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
# Package meta-data.
PYPI_NAME = 'image_classifiers'
NAME = 'classific... |
64d347ffaf77edc89ffcae4fd745c49928e2a8d75dd4471ec3efb72bdb759e3a | Python | 3,771 | 109 | """
This script converts NeSys .xyz files with coordinates specified
in the local coordinate system for the pontine nuclei defined by
Leergaard et al. 2000 to Waxholm Space coordinates for the rat brain
(in voxels).
"""
# pylint: disable=C0103
import os
import random
random.seed()
# - - - - - - - - - - - - ... |
99604aeb11eee3527786bef65ca910704778e308c64fd749199c09be46043999 | Python | 3,771 | 128 | # 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... |
aa1ced51c8d39622b830581d9b09e54e8e710cf890f0451685f3fd2a97a84f2e | Python | 3,771 | 87 | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch_geometric.nn import TopKPooling
from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp
from torch_geometric.utils import (add_self_loops, sort_edge_index,
remove_self_loops)
from torc... |
f1474bbafa0de4756b070a1128ef0eb89c80969db6c14eb578ea8f766b2a2f4d | Python | 3,772 | 106 | import bpy
import numpy as np
import pytest
from mathutils import Euler, Matrix
import molecularnodes as mn
from .constants import data_dir
def _random_matrix(seed: int) -> Matrix:
rng = np.random.default_rng(seed)
rotation = Euler(rng.uniform(0, 2 * np.pi, 3)).to_matrix().to_4x4()
return Matrix.Translati... |
ab88e406b9a3d06151366706781bc63eaadda321daf183a79e64a7f6b42197e2 | Python | 3,773 | 76 | from collections import namedtuple, defaultdict
from heapq import heappop, heappush
from pddlstream.language.conversion import is_negated_atom, fact_from_evaluation, evaluation_from_fact
from pddlstream.language.statistics import check_effort
from pddlstream.utils import HeapElement, INF, implies
Node = namedtuple('N... |
dba09497c8d84566b847bd55a0d447f3855b3170d5da464561f58785d7c100a8 | Python | 3,773 | 144 | #!/usr/bin/env python
import cobra
import random
import os, sys
cobra_config = cobra.Configuration()
cobra_config.solver = 'glpk'
models_path = os.getcwd()
model_file = os.path.join(models_path, sys.argv[1])
bigg_model = cobra.io.read_sbml_model(model_file)
# COMPOUNDS PARTS
bigg_mets2seed = {}
for i in bi... |
60d52cfef6d797be6aaf403cc72bb873598ae87dabf50ef7af2b3aa3aa546d60 | Python | 3,774 | 99 |
# 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 ... |
d1b2e2e2bf795be805ea10b16c9c01907760168bb250ed4558c81c73cf5116ab | Python | 3,774 | 119 | import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
import numpy as np
import pandas as pd
from tokenization import Tokenizer
from language import Language
from data import Data
from collections import namedtuple
from config import Config, Raviv1
def sin_cos_angles(angles):
... |
a98fe45be52d3f56dafc5cbc2f0678ae06339c3586cd5240f9cb1ed3810c095f | Python | 3,775 | 99 | import yaml
import numpy as np
import torch
import torch.nn as nn
from BEBE.models.supervised_nn_utils import SupervisedBehaviorModel
class CRNN(SupervisedBehaviorModel):
def __init__(self, config):
super(CRNN, self).__init__(config)
self.unknown_label = config['metadata']['label_names'].index('unknown'... |
0923ed36b920c1523f9b97a789d6a1e60b3ab84fa000a5931b0f40e39c818b7f | Python | 3,776 | 115 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
from sklearn.decomposition import TruncatedSVD
import numpy as np
from tqdm import trange
from .utils import bin1d
def subsampled_mean(X, n_mean=1000):
n_frames = X.shape[0]
n_mean = min(n_mean, n_frame... |
494f3367f09b25c4eea010f149baacda46e89029d4d0da4646f3b54e267061f5 | Python | 3,776 | 143 | import numpy as np
import networkx as nx
import multiprocessing as mp
from functools import partial
import time
from multiprocessing import Array
def touch_z(masks_mat, z1, id1, z_dir):
#get list of unique identifiers of next plane z_dir that touch z1_id1
ind_xz,ind_yz = np.where( masks_mat[z1,:,:] == id1 )... |
6de9452688330345b41f2b1069b29a1ce7374561f6928ddf400261a0df8015da | Python | 3,777 | 115 | import configparser
from typing import Dict, List, IO, Mapping, Optional
from .default_styles import DEFAULT_STYLES
from .style import Style, StyleType
class Theme:
"""A container for style information, used by :class:`~rich.console.Console`.
Args:
styles (Dict[str, Style], optional): A mapping of s... |
b95469e270ad20d90543a7e54c98d17794dc149af0f091f2e2c6de5d64d44577 | Python | 3,777 | 140 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
def99a7ccbf26d1c16f7281c01a72f739e13fec61d9f47ddae034b6516e5e8b7 | Python | 3,777 | 128 | ##
# \file parameter_normalization.py
# \brief Class containing functions to normalize parameters. This can be
# used to normalize parameters used for optimization e.g.
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date Nov 2016
#
## Import libraries
import sys
# import SimpleIT... |
e794b532fbf076cd36ef7c32280a2a5dbe5c640d3faeeacb916666db5ff863a4 | Python | 3,778 | 97 | import argparse, sys, yaml
from pathlib import Path
from argparse import Namespace
from unittest.mock import patch
from wsilearn.utils.parse_utils import parse_string
from wsilearn.utils.cool_utils import dict_update_nested
def read_yaml(in_path):
with open(in_path) as file:
dict = yaml.load(file, Loader=y... |
1de17e91f2be91a973d1f283363ef4271301b19469dbd13bc9943e3300aee025 | Python | 3,779 | 94 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
from utilities.script_func import init, post, rs_init
import numpy as np
import pickle
import logging
logging.info("")
def main():
logging.info("Loading Data: "+args.data+"...")
from ut... |
30413cb00a0039ebdb8df63b30115b200783417b98dc5c5af36f4b62d4af60fa | Python | 3,779 | 118 | '''
Configs for training & testing
Written by Whalechen
'''
# --data_root '' --img_list '' --n_seg_classes 2 --learning_rate 0.001 --num_workers 4 --batch_size 1 --phase train --save_intervals 10 --n_epochs 200 --input_D 256 --input_H 256 --input_W 256 --resume_path "./trained_models" --pretrain_path pretrain/resnet_5... |
31edf6f62d2830c37adc1c446a916c106d6847e5e73a27c0d4327e1f387a6632 | Python | 3,781 | 100 | # 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... |
5f84682ca5ebdd81bf1248dda3d4c723279a869620f7d60a3b88493a0aa5b73e | Python | 3,781 | 67 | import copy
from pddlstream.algorithms.downward import fact_from_fd
from pddlstream.algorithms.reorder import get_partial_orders
from pddlstream.language.conversion import pddl_from_object
from pddlstream.language.object import OptimisticObject, UniqueOptValue
from pddlstream.utils import neighbors_from_orders, get_ma... |
343e40ee1d4de54460f7eec184a35cb9e6dc552e276d43151592be920e31894c | Python | 3,782 | 106 | import os
import torch
import pandas as pd
import numpy as np
from sklearn.metrics import accuracy_score, recall_score, precision_score, matthews_corrcoef, roc_auc_score, f1_score
from Bio import SeqIO
from torch.utils.data import DataLoader
from utils import set_seed, create_predict_dataset
from model import RNASeqCla... |
570a07fd16c3a52fbbe95b2b474f42c1236dc60450ee3b25aab6b7e2d87ae0bd | Python | 3,782 | 113 | # Node group ".MN_select_sec_struct_id" (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... |
752e8a8b97ef7bd45d830530d9bda5fc051c4cbdbe74da676bce3f31538b5c0b | Python | 3,782 | 125 | from __future__ import annotations
from pathlib import Path
from shutil import which
import pytest
from ase.build import bulk
from numpy.testing import assert_allclose
from quacc.recipes.espresso.dos import dos_flow, projwfc_flow
from quacc.utils.files import copy_decompress_files
pytestmark = pytest.mark.skipif(
... |
de17f077ae04887b193a1db67592188c9e826d5d9041bbb20f60ae333a0db2f6 | Python | 3,782 | 89 | # 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... |
e51897b15272cd992715289af104eac24e92560573643aa5d1c6460a0f94ee2e | Python | 3,782 | 90 | #! /usr/bin/env python3
import os
import subprocess
import logging
import APT_interface
class cd :
"""Context manager for changing the current working directory, and automagically changing back when done"""
def __init__(self, path):
self.path = path
def __enter__(self):
self.old_path = ... |
02fdc36c6ab4d0c7993a67b0f71a54ace5f522771c89d3334e2b3d45bf6d8ba5 | Python | 3,783 | 103 | import itertools
import matplotlib.pyplot as plt
from black_box_svi import black_box_variational_inference
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.misc.optimizers import adam
def make_nn_funs(layer_sizes, L2_reg, noise_variance, nonlinearity=np.tanh):
"""These functions imp... |
a9092d861d28cbc0495d37212756a3e262f6b71145e5c438a8b7424505ca06e4 | Python | 3,783 | 104 | print('Starting...', flush=True)
import os
from nilearn.glm.first_level.design_matrix import make_first_level_design_matrix
from nilearn.glm.first_level import first_level_from_bids
from nilearn import plotting
from nilearn import image
import numpy as np
data_dir = '/home/intoumanis/sugar/data_bids'
task_label = 'nar... |
b8e5ac5f6cec101ab11d47c9406873f2cd700c2d56f11b5948a3aa148979b99e | Python | 3,784 | 102 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import matplotlib.pyplot as plt
import mnist
import numpy as np
import skimage.transform
def rescale(data, sidelen=28):
scaled = []
for i in np.arange(data.shape[0]):
s = skimage.transform.resize(data[i], (sidelen, sidelen), anti_aliasing=False,... |
72f551bb4c2143d079c6e397fb151cf575ef6c9f1d4ce54ada2121c88e832908 | Python | 3,787 | 103 | import unittest
import numpy as np
import torch
from torcheeg.datasets.constants import DEAP_CHANNEL_LOCATION_DICT
from torcheeg.transforms import (BandDifferentialEntropy, BaselineCorrection,
BaselineRemoval, Binary, Compose, Lambda,
MeanStdNormalize,... |
a3195e980ff0751e5a0936945bf7a94e589cd007cb7beedfc580f53d2ce800ca | Python | 3,787 | 143 | import os
import json
import pickle
class FileHandler:
"""Class for handling all IO/file handling tasks."""
@staticmethod
def read_file(file_path):
"""Reads a specified file.
Args:
file_path (string): The path to the input file.
Raises:
FileNotFoundError... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.