sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0bd8faaee920408d67fc97902e8646b8375f530cc25d287221d3d3a7a79d6cc4
Python
3,064
102
import logging import os.path from typing import List, Optional from pip._internal.cli.spinners import open_spinner from pip._internal.utils.setuptools_build import make_setuptools_bdist_wheel_args from pip._internal.utils.subprocess import call_subprocess, format_command_args logger = logging.getLogger(__name__) d...
146d826cc92dd3c24899747217c2797a2d5b55033ac61b0d1cb62907459e3300
Python
3,064
86
"""The Laplacian solver's output field: float32, and axis solves are independent. Two changes are pinned here: 1. The returned deformation field is float32 (the solve itself stays float64), matching the sibling sliceToSlice3DLaplacian. It holds per-voxel displacements in VOXELS, so float32's ~7 significan...
3fec2c5d9e1747ce9740f1435a967ec3ed39e27b9352d8caeef5bab721fa3919
Python
3,064
119
""" Dynamic of the buffer Shows how the buffer gets values closer to the median when time increases """ import time from pathlib import Path import numpy as np import ray from median.distributions import Distribution from median.median import run_new_median_full from median.utils.utils import pretty_time def gener...
60466194b53c7e1721c2346c68164b5edbed1ad42a435e970db04f951d3e4b33
Python
3,064
96
from __future__ import division from functools import partial import logging import numpy as np import pandas as pd """ Created on Mon Aug 20 20:30:31 2018 @author: Hannah Choi """ """ This code contains functions needed for mapping TC clusters to FF/FB by maximizing the global hierarchy score of the ...
62584b4d1976a07040baa85cfb398bed4492ebb4cf5951c89a3780407ade6534
Python
3,064
84
import itertools import os import shutil import sys from typing import List, Optional from pip._internal.cli.main import main from pip._internal.utils.compat import WINDOWS _EXECUTABLE_NAMES = [ "pip", f"pip{sys.version_info.major}", f"pip{sys.version_info.major}.{sys.version_info.minor}", ] if WINDOWS: ...
76f9b3100df12adb7321259ea5617df1dee3d1705d9a5666d47b19ef396d642e
Python
3,064
79
# 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...
89f46f37cd171f02625afbd1ad2c0245529397b9738bf1a64b7888d6e1a3825b
Python
3,064
100
import argparse import collections from typing import Any class dotdict(dict): """ From user derek73 at https://stackoverflow.com/questions/2352181/how-to-use-a-dot-to-access-members-of-dictionary and user Trevor Gross in the comments. dot.notation access to dictionary attributes. """ ...
c860b1b1fbb8eae304587b437f33ba8b3cecfe601690b6bf802f714a1257916c
Python
3,064
113
# 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...
e66332eaa9a86842362f84438f25af233625de2ab40a0c6f76c4958412ceb2c2
Python
3,064
73
import numpy as np def list_of_dicts_to_dataframe(lst_results, st_key): # expects lists of results, returns a long-form dataframe of one # extra result keys are retained in the dataframe import pandas as pd dfs = [] for result in lst_results: df = pd.DataFrame(result[st_key]) ...
20a373512a77eb48135c7422c33afda4e29c86065c4b10e0815ad36e6fca1f70
Python
3,065
89
''' Part of the code modified from https://github.com/andabi/music-source-separation ''' import librosa import numpy as np from config import SE_Config import soundfile as sf from mir_eval.separation import bss_eval_sources def to_spec_torchaudio(audio, config): return def get_chunks(spec, dur = 64, height = ...
63d70ec28a1960663a719e9506f951d74a37c8a1ed64755e09a7891127eadbd3
Python
3,065
109
"""Converts an MNE Epochs object to a Signal object.""" import os import sys from pathlib import Path cd_path = Path(__file__).absolute().parent.parent sys.path.append(os.path.join(cd_path, "coherence")) from coh_handle_files import generate_sessionwise_fpath from coh_handle_files import load_file from coh_loading i...
7f5201c0486826a1369a23a37bb05f78754b553d3f6d41ff695f1ca0a067fc6b
Python
3,065
101
# -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import print_function from HDPGPHSMM_segmentaion import GPSegmentation import time import matplotlib.pyplot as plt import os import numpy as np import pandas as pd import glob def learn( savedir, dim, gamma, eta, initial_class, avelen, max...
91fc4665bbbed5b9d8b58e06434670a3de79054fdaa06f98dc9fe8c2acf4681e
Python
3,065
103
# Import libraries import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import Dataset, DataLoader import torch.nn.functional as F import matplotlib.pyplot as plt import os import pickle import numpy as np from sklearn import metrics from sklearn.model_...
188973b56b6d4a3640f5db6e71de3288897a4c89e4eedd8bdd9b10d19f91d1df
Python
3,066
84
"""The standalone TIFF read helpers must default to NO reorientation (opt-in). Companion to test_tiff_load_no_auto_orient.py (which covers load_volume). Here we cover read_tif_section / read_multipage_tif / load_tiff_volume - the primitives used by cell-counting, nii-creation, OME-Zarr, and the NG viewer. """ ...
a0a7291448026e28cb28bf49caa0f965b1167c82f2334c77693e8fbdd5088b3f
Python
3,067
62
import json import os import unittest from hed.tools.bids.bids_file import BidsFile class Test(unittest.TestCase): @classmethod def setUpClass(cls): events_file = "../../data/bids_tests/eeg_ds003645s_hed/sub-002/eeg/sub-002_task-FacePerception_run-1_events.tsv" sidecar_file = "../../data/bids...
e9fca7f82f2b20fcb286b16d37d995b77504d3103c085613f0f648a204eae82a
Python
3,067
80
import numpy as np from scipy.stats import ortho_group def simulate_csd(n_domains, n_per_domain, p, k, corr_noise=True, noise_scale=1., corr_top=1., diag=None): """Simulate data from the CSD ('com...
7ff70edf18342dbed6052433f2ef6b0e1f9e51f996392e32fc6fd226cf814a32
Python
3,068
84
import numpy import pickle import struct import sys t_start = float(sys.argv[1]) t_end = float(sys.argv[2]) f = open('heart_remeshed_3D.ensi.case', 'r') line = f.readline() while line != 'TIME\n': line = f.readline() line = f.readline() time_set = line.split()[-1] line = f.readline() number_of_steps = float(line.s...
b67253d671fc918d820bfe1b69e34755a1c66e5a5e22fa2898e977d06e3ea98a
Python
3,068
77
import os import unittest from hed.models.definition_entry import DefinitionEntry from hed.models.hed_string import HedString from hed.schema import load_schema_version class Test(unittest.TestCase): @classmethod def setUpClass(cls): cls.base_data_dir = os.path.join(os.path.dirname(os.path.realpath(_...
c6aaec3dd4aaedd17c99ccb877e397bfd52753358efd78ca76c81d02f8ea5336
Python
3,068
92
"""Originally by @rhizhiy https://github.com/bayesian-optimization/BayesianOptimization/issues/347#issuecomment-1273465096 """ import time from typing import Callable import matplotlib.pyplot as plt import numpy as np from bayes_opt import BayesianOptimization from bayes_opt import acquisition from scipy.optimize impo...
282ea5ff55ef650aae4450c73a64060adba7df0d37d8ef567f44eee88930aa20
Python
3,069
86
# MEGIT model inference related functions # Refer to OptiFlex package (https://github.com/saptera/OptiFlex) for more information import os import numpy as np import cv2 as cv import h5py as h5 import keras from ..utils import prog_print """Constant list: default_model: MEGIT default pose estimation mod...
56bff5c1eb89bc01e2d6883accf4a3b8f423ffb25182cb53457e05cacc20377e
Python
3,069
85
""" Created on 25/05/2020 :author: Chinchien Lin :summary: Adds padding to the files contained in source field of the configuration field. Then save in the destination folder """ import os import sys import numpy as np from src.commands.abstract_preprocessing_command import AbstractPreprocess...
616b8c0a86eb88eb4423c1e88d9207b9fd47ce0cb78ca1e5ab49df1e2f9bf580
Python
3,069
103
# Import libraries import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import Dataset, DataLoader import torch.nn.functional as F import matplotlib.pyplot as plt import os import pickle import numpy as np from sklearn import metrics from sklearn.model_...
d16f44b9c9b49f489f5609c8c3063583dd504875a9d2e62fef10d16b0eb13154
Python
3,069
92
import os from argparse import FileType, ArgumentParser import numpy as np import pandas as pd from Bio.PDB import PDBParser, MMCIFParser from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from tqdm import tqdm from Bio import SeqIO parser = ArgumentParser() parser.add_argument('--out_file', type=str, defaul...
45ec3e427841bea9e6414b472f88bf2c076379d47ac014d611e648cbbce3a630
Python
3,070
92
import torch import torch.nn as nn from elasticai.creator.nn.integer.MPQ.encoderlayer import EncoderLayer from elasticai.creator.nn.integer.MPQ.sequential import Sequential from elasticai.creator.nn.integer.vhdl_test_automation.file_save_utils import ( save_quant_data, ) class Encoder(nn.Module): def __init_...
ee1cf0cc9f7423218e82144bd6034804129ffdb0e69e78efa925d0c92875bb59
Python
3,070
91
# Node group "Ease Switch" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated ...
ad97ada90245c3e716608094727bbc7d1c12ff055466ca10d38d2a7d3b740792
Python
3,071
98
# Node-group asset "Offset Color Attribute" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE...
42c2747f2d7d955349107237dc0123fdf23d9ff15f64314ea20bc19e4da8cdd5
Python
3,072
102
""" Created on 04/06/2020 :author: Chinchien Lin :summary: Extract mask images from the source field in the configuration file. Then, save the extracted masks in the directory specified in the destination field. """ import os import sys import numpy as np from PIL import Image from src.command...
54c447571dd924e0a556faa84bbe5dcaa186d3156c159d31147a3c37f730dec7
Python
3,072
80
"""Regression guards for review fixes to CCF section-browse mode.""" import os os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") import numpy as np import pytest pytest.importorskip("PySide6") import nibabel as nib import tifffile from PySide6.QtWidgets import QApplication from regtools.ccf_boundary_...
8e0d402e881c60653de93412f62b0197a742aefc39cb9fbe04ffcafae164ffcb
Python
3,072
91
""" pygments.regexopt ~~~~~~~~~~~~~~~~~ An algorithm that generates optimized regexes for matching long lists of literal strings. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from re import escape from os.path import ...
31eabd70567e30c056ad1192102ad0268de3e0a1c3a2ca9708d27b00854db459
Python
3,073
100
# Node-group asset "Between Integer" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKI...
7a9653d86e9f89057a9741fefb17e6dbfb3c10ecfd1fdc6fd9c790a00c97d99e
Python
3,073
103
import os from distutils import log import itertools flatten = itertools.chain.from_iterable class Installer: nspkg_ext = '-nspkg.pth' def install_namespaces(self): nsp = self._get_all_ns_packages() if not nsp: return filename = self._get_nspkg_file() self.output...
8a1d91098a11ce4c2b6a8419aa3762ab168fa04b48626e21a671fb98986c31e8
Python
3,074
72
#! /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...
9220cb0fb50a2db84bb4aee20c444908c7962f8755b243cb38a62b1bdadd6764
Python
3,074
81
#! /usr/bin/env python from lab.parser import Parser parser = Parser() parser.add_pattern('ms_final_size', 'Final transition system size: (\d+)', required=False, type=int) parser.add_pattern('ms_construction_time', 'Done initializing merge-and-shrink heuristic \[(.+)s\]', required=False, type=float) parser.add_patter...
93816c335370e63f272f742335b987739570463c439e8896d519b7f5a31361bd
Python
3,074
104
#! /usr/bin/env python3 # FutureWarnings from import corrupting fspoll output/parse # alternatively, could eg prefix each 'real' output line with # a sentinel or keyword import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import sys import os import string import re import glob #import nump...
e33ee4b2371540a7041d3ac62ef9614b1292897bdc3b9ee457ebc5ee9de8ba1f
Python
3,074
95
import random import string import sys import unittest import neurolib.optimize.exploration.explorationUtils as eu import numpy as np import pytest from neurolib.models.aln import ALNModel from neurolib.optimize.exploration import BoxSearch from neurolib.utils.loadData import Dataset from neurolib.utils.parameterSpace...
e9d7a63903ffbc65db92c4e3b5341d896f3b1b360113dbc3bd035bc5bc19ab28
Python
3,074
83
# 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...
20d43a285bb057eabe0aa52a44a11fb27877fb2b54a25a31cc12bbdc158bcfa0
Python
3,075
64
#!/usr/bin/env python ## this script creates dataframes from the full similarity matrices for each movie and parcel ## and saves them to a new CSV file ## The dataframes contain the correlation values for each pair of subjects. import pandas as pd from pathlib import Path # Define the range for nodes num_nodes = 210 ...
2cf663e07d5949b0d01e8c5c03cbcc6dfe8d783659400ebf3153aa3be5040408
Python
3,075
96
import torch from torch import nn from typing import Dict, Optional __all__ = ["RadialLayer", "EmbeddingLayer", "CutoffLayer", "TensorActivateLayer", ] class EmbeddingLayer(nn.Module): def __init__(self) -> None: super().__init__() def forward(self, ...
48034084f677b3f908c3266289c10b393b6a9724b46c5ac28618dab3b0f524d9
Python
3,075
101
# -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import print_function from HDPGPHSMM_segmentaion import GPSegmentation import time import matplotlib.pyplot as plt import os import numpy as np import pandas as pd import glob def learn( savedir, dim, gamma, eta, initial_class, avelen, max...
fedb8333f40c5c34b13932fd66b382d70b48b258f85ff3fe51efb3e0719b4731
Python
3,075
87
""" ALGORITHM FUNCTIONS These functions implement the necessary calculations of the AARE and thd values. """ import numpy as np # calculating AARE_t def aare(self, time, predicted): # calculating aare sum_ = 0.0 for y in range(self.window_beginning, time + 1, 1): # calculating coefficient for a...
8e243ea7ebaeeed3e6e4bb5fc39d97322a5cb86803d27334fcef208a15e5d75d
Python
3,076
98
# This code calculates the intermediate scattering funtion ISF #from the cage relative displacements for a dense colloidal suspension. import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.spatial import KDTree import time # load data af = '60' dia_big=3.34 path = '/media/hdd2/P2-Entr...
7e968679d0103419a9be9daa6b8817bf5b08f761453e9f590c0ddd908e6a703c
Python
3,077
64
"""code for automating data uploads via rclone""" import subprocess as sp import os from pathlib import Path, PurePosixPath import logging logger = logging.getLogger(__name__) class Uploader: def __init__(self, local_project_dir, cloud_data_dir=None, video_framerate=30): logger.debug('Beginning Uploader i...
f4a01c2669a25bf64e642600ba156cc88510f8f93e71e0ae3df24cc55dfc9d73
Python
3,077
76
# 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...
0ca235260ef10aeffc9d561c7c59243f77cac618f52b6ab6d5f8682bd034f605
Python
3,078
88
#!/usr/bin/env python #================================================================ # Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : calc_glob_features.py # Author : Yufeng Liu # Date : 2023-01-24 # Description : # #============...
7f861c5ff49df6111215defb6d09afd625232c0d7013a24e4e010615a87eb725
Python
3,078
107
from .laplacian import solveLaplacianFromCorrespondences # Configuration and diagnostics from .config import ( HAS_ANTS, DEFAULT_REGISTRATION_METHOD, check_ants_environment, estimate_registration_memory, ) # Image I/O and axis alignment from .io_utils import ( extractMetadata, ext...
9e80c8854d1c59cde3d877415984f56776aaaeeaa8b9bfbceb5bf2a15605995a
Python
3,078
68
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 21 11:22:56 2023 This script computes the lists of subjects to include and exclude based on the different exclusion criteria : X is a threshold used in erratic answers - more than X% of erratic answers (answers against the prior and the likel...
c816c2dd37f9cdd57c0a8b33989b13286f85644cb677052369277438b99c5834
Python
3,078
79
"""Pure data types for the CCF boundary editor. Extracted from ``contour_edit.py`` so the dataclasses live separately from the deformation-application algorithm. Anything that *describes* an edit goes here; anything that *applies* an edit stays in ``contour_edit.py``. These types are deliberately framework-free...
00e81f87e6b4cf38463a52305602abe380e4409d0ca28c2665c018cd7152a297
Python
3,079
93
import pytorch_lightning as pl import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from models.common import create_decoder, create_encoder class BetaVAE(pl.LightningModule): def __init__(self, height, width, input_channels, latent_dim, beta=1.0): super().__init...
0bb1edae0102bca5137d511afa9a6a6ca7f20bd812c894bc2180a04d607e83be
Python
3,079
81
import ast import csv import os import sys from pickle import dump import numpy as np from tfsnippet.utils import makedirs output_folder = 'processed' makedirs(output_folder, exist_ok=True) def load_and_save(category, filename, dataset, dataset_folder): temp = np.genfromtxt(os.path.join(dataset_folder, category...
0ccc378c8c88a03a5af21233e77bae83f63d5ffe26fd3269e5f45ad6b88d4d30
Python
3,079
103
# Import libraries import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import Dataset, DataLoader import torch.nn.functional as F import matplotlib.pyplot as plt import os import pickle import numpy as np from sklearn import metrics from sklearn.model_...
4cff813707420024870065c532fabb1f9ebc73e866803a0c703096702e65e4f8
Python
3,079
90
# 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...
7d13eb327ee5c7d817fb6a78c6c7ab7744138af72562640b9eb1132445320956
Python
3,079
65
#!/usr/bin/env python ## this script creates dataframes from the similarity matrices ## (upper triangle) for each movie and parcel ## and saves them to a new CSV file ## The dataframes contain the correlation values for each pair of subjects. import pandas as pd from pathlib import Path # Define the range for nodes ...
ae0870adb5c6c75cb0cfda393e204bb1949c126d14485a1a7561dd34521c5be8
Python
3,079
86
""" RERE ALGORITHM FUNCTIONS These functions implement the necessary calculations of the AARE and thd values. """ import numpy as np # calculating AARE_t def aare(self, time, predicted): # calculating aare sum_ = 0.0 for y in range(self.window_beginning, time + 1, 1): # calculating coefficient f...
2cbdecfafa1eebbe2f7c998afae8fc90a5cb315c53770ffe14e482527ec97230
Python
3,081
125
from numpy import * from pylab import * nu = ['7','10','20','40','60','80'] norders = ['3','5','7'] tf = zeros((6,3)) ts = zeros((6,3)) np = zeros((6,3)) tq = zeros((6,3)) mf = zeros((6,3)) errs = zeros((6,3)) for inu in range(6): for ino in range(3): fname = 'data_nov15_2021/diary_ik1_np'+str(nu[i...
3e000a81e33db85b9ef27925ce6210ecae4a0cc6548a8229229c3887cf03fb1e
Python
3,081
112
#!/usr/bin/env python2.7 from __future__ import print_function import argparse from pddlstream.algorithms.focused import solve_focused from pddlstream.algorithms.incremental import solve_incremental from pddlstream.language.constants import PDDLProblem, Or, Exists, print_solution from pddlstream.language.stream impo...
749e1ec9a94531ef80ad12030915ffb3af8c54db4e5c1301a595afdc1ea210e0
Python
3,081
46
# C. Cocuzza, 2021 # Function to identify outlier participants in category selectivity (MAF project). # Using a very conservative number of deviations above or below the median: 5 # See here for more: Leys, C., Ley, C., Klein, O., Bernard, P., & Licata, L. (2013). Detecting outliers: Do not use standard deviation arou...
b5a3f647b9b8f0677217d2c4af30d6067cdd5651db47f379058ab311bc0dc3ed
Python
3,081
102
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import constant_init, kaiming_init from mmcv.utils.parrots_wrapper import _BatchNorm def default_init_weights(module, scale=1): """Initialize network weights. Args: modules (nn.Module): Modules to be initialized. ...
f4952d7c59d45583f7585953386bdc278bbd31afdcb3bf30412ab6edb5e1799f
Python
3,081
77
# import libraries import numpy as np from scipy.stats import multivariate_normal import matplotlib.pyplot as plt import sys import os # import modules within repository sys.path.append('C:\\Users\\dreww\\Desktop\\hyperbolic-learning\\utils') # path to utils folder from utils import * #-------------------------------...
09325393fe3a6a156640f2c99ce17a5d7e4d27b9ee1439f756d18a1de2172612
Python
3,082
89
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...
53a4926c5b53b305e1801f84feb3c66b673671075b791b7070b8d2f806bab506
Python
3,082
110
from __future__ import division import logging import numpy as np import matplotlib.pyplot as plt import pandas as pd """ Created on Fri Aug 09 16:19:11 2019 @author: Hannah Choi """ """ This code takes previously generated hierachy scores & global hierarchy score data from the "Results" folder, and make figures. ""...
671e541da36e219f40d0efa22c2c072cc794639f42b551483df93595c998960c
Python
3,082
71
import sys from os.path import join, dirname, realpath current_dir = dirname(realpath(__file__)) sys.path.insert(0, dirname(current_dir)) import os import imp import logging import random import timeit import datetime import numpy as np import tensorflow as tf from utils.logs import set_logging, DebugFolder from config...
96f01370c08e5699aebd7bd96e38142ac838eed2cdf3004c6a71e52dc6f4db34
Python
3,082
96
"""Plotting parameters ---------------------- A dictionary with parameters defining the plotting. """ import numpy as np # conversion factor from cm to inch cm2inch = 1. / 2.54 # used by plotting.py rcParams = { # dpi for typical journal printing 'figure.dpi': 300, # line width 'lines.linewidth': 1....
e58bf4acf93074b62055763566c42287c4d5e0ef722c257c97e079e83bb4650e
Python
3,082
93
# Node group ".MN_init_tmp_attributes" (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 ...
f5e5a33d493967e9d9cce993d7b01d975988791ca9091e0600bd8785d55b27d2
Python
3,082
85
# 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...
6118771f0d15ed506b89be9ef8b68e8fb36bd58ac0638c4da58624557212b808
Python
3,083
90
'''Preprocess events from the presentation logs to the BIDS events file for the nback task. Parameters ---------- path : str path where the raw data is stored savepath : str BIDS folder ''' import os, sys import re import pandas as pd from glob import glob path = '/m/cs/...
a37f708ff15b46a9941fe5932947db82ce4115627e871a0db43a642511dd4046
Python
3,083
102
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import constant_init, kaiming_init from mmcv.utils.parrots_wrapper import _BatchNorm def default_init_weights(module, scale=1): """Initialize network weights. Args: modules (nn.Module): Modules to be initialized. ...
4779395e26a6d940a9c669560868a9a657bef83c7fc994d747f37c19b24fd0db
Python
3,084
86
import cocotb import pytest from cocotb.triggers import Timer import elasticai.creator_plugins.adders as adders from elasticai.creator.arithmetic import int_arithmetic from elasticai.creator.testing import CocotbTestFixture, eai_testbench from elasticai.creator_plugins.multipliers.utils import ( generate_mult_test...
2622d18a53a95fbdacc25a6bc1028e189a76bdd45c97e3314d339a85d92bda0f
Python
3,085
72
from typing import List import torch from tqdm import tqdm import numpy as np from chemprop.data import MoleculeDataLoader, MoleculeDataset, StandardScaler from chemprop.models import MoleculeModel def predict(model: MoleculeModel, data_loader: MoleculeDataLoader, data_right_loader: MoleculeD...
50e0526af23a7d3448818528daedcd5108563482192c83b956e08a6fac71191d
Python
3,085
96
import os import zipfile import io import numpy as np from PIL import Image from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True def is_zip_path(img_or_path): """judge if this is a zip path""" return '.zip@' in img_or_path class ZipReader(object): """A class to read zipped files""" zip_...
e1cd003e4632b34e022a16ae33540c0b4e3486faf8591e570fc760b82434b282
Python
3,085
87
import torch import torch.nn as nn import torch.nn.functional as F from ..initializer import create_initializer class Network(nn.Module): def __init__(self, config): super().__init__() model_config = config.model.vgg self.use_bn = model_config.use_bn n_channels = model_config.n_c...
2dcc27e1983be26adf7216ee249b83a6cccf9028af48443301818f0e1bfa8847
Python
3,086
94
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
60c26ced98197cd0fae4f44baa5181fda8297c65e57a6c7fe479b83ca9c1aa94
Python
3,086
103
# Copyright 2016–2021 Julien Danjou # Copyright 2016 Joshua Harlow # Copyright 2013-2014 Ray Holder # # 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-...
b24fb2027a5345b1a5f8dbcc1dcd2385a7772b16a633a3c7ec6f956b72ab9f97
Python
3,086
77
""" Optuna example that optimizes a classifier configuration for cancer dataset using XGBoost. In this example, we optimize the validation accuracy of cancer detection using XGBoost. We optimize both the choice of booster model and its hyperparameters. """ import numpy as np import optuna import sklearn.datasets im...
e544449d81abae9d10bbbfb8b077e0db3002a611efd23d825abe153765df0cd6
Python
3,086
80
#import scanpy as sc from sklearn.neighbors import NearestNeighbors import anndata as ad from scipy.sparse import csr_matrix import numpy as np import scanpy as sc def UnfilteredAdataAdata(filteredPath, rawPath, outdir, nHKgenes=50, raw_to_filt_ratio=1, n_neighbors=20): """ RawFilt ratio is the number of raw cells...
94ebf7933cabd0dd026d6b32975af0179beed34837ca72d7b7c0e31dffdee8af
Python
3,087
86
"""Fixtures to test the spectrum devices without driver and cards.""" import ctypes import importlib.util from pathlib import Path from types import ModuleType, SimpleNamespace from unittest.mock import MagicMock, Mock import pytest import console.spcm_control.abstract_device as abstract_device CARD_HANDLE = 1 def...
0d278ed15115112fb901141df0f876581584319c9177db67019c87fd7daf395e
Python
3,088
78
# Copyright 2015 gRPC 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 applicable law or agreed to in writing...
563006937832f52b343dfed02a30f17c7c25127fd09e8117864e90fb74c49278
Python
3,088
82
import re import math from pddlstream.language.constants import AND, OR, OBJECT, TOTAL_COST, TOTAL_TIME, is_cost, get_prefix, \ CONNECTIVES, QUANTIFIERS from pddlstream.language.conversion import pddl_from_object, is_atom, is_negated_atom, objects_from_evaluations from pddlstream.language.object import Object, Opt...
26ffb8af63c2ab1af2f0f154653360c454923530d2d385982d49a0cd219358aa
Python
3,089
114
# Node-group asset "MN Typed Bundles" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECK...
301324cccb0759fdcae7258808c5f1062dbff052d72132892316e8a3f11bd152
Python
3,089
87
import numpy as np from basicsr.archs.rrdbnet_arch import RRDBNet from realesrgan.utils import RealESRGANer def test_realesrganer(): # initialize with default model restorer = RealESRGANer( scale=4, model_path='experiments/pretrained_models/RealESRGAN_x4plus.pth', model=None, ...
638e0c35ae76baaabee048aceaf2d727e8cc82bce06dae42c34d6a942bb25d42
Python
3,089
79
# 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...
8c856976e89047ef8b48f38c00ba56b73dadc11023b0db4b59ce55bb7acc2cce
Python
3,089
64
"""Diagnostic pilot: the steering_dynamics_probe.py plugin outside the GUI, plus one legacy run. The plugin's settings can be overridden from the command line (e.g. when the GPU only fits a smaller model). Example: CUBLAS_WORKSPACE_CONFIG=:4096:8 PYTHONPATH=src python scripts/steering_probe_pilot.py \\ --prof...
923bda1e7e336b0370ef53fd500e8b050f58d78b75bca05ca2a253d1c9fe9dc8
Python
3,089
64
from lavaset_new import LAVASET import numpy as np import pandas as pd from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split import time import csv import sys import os from sklearn.mode...
c5368e974df95e429106a4936b3111ee3532aa8815825216ca9b8b69bf389163
Python
3,090
76
import os from typing import Dict, Iterator, List, Tuple, Union import pandas as pd from torcheeg.datasets.module.base_dataset import BaseDataset from .base_model_selection import BaseModelSelection from .utils import create_subset, read_indices, validate_partitions, write_partitions class TrainValTestSplitCrossTria...
9b8378df70907bd7132dc2c9da963d689e331fa0ce428e21557d54c914b0f083
Python
3,091
95
import os import pandas as pd from ckg import ckg_utils from ckg.graphdb_connector import connector def read_knowledge_queries(dataset_type='proteomics'): queries_dir = os.path.abspath(os.path.dirname(__file__)) query_file = dataset_type+"_knowledge_cypher.yml" queries_file_path = os.path.join(queries_dir...
6ff9eee7f7f71c2812769e52fda351050d4c4829b86630f079cd8e993462724c
Python
3,092
104
""" pygments.scanner ~~~~~~~~~~~~~~~~ This library implements a regex based scanner. Some languages like Pascal are easy to parse but have some keywords that depend on the context. Because of this it's impossible to lex that just by using a regular expression lexer like the `RegexLexer`. ...
9ee3251d03c2d39b2d3815c8de6a728e400ef68e10517d61e16a21b1b93d07df
Python
3,092
51
"""POST HOC (8 Oct 2026, after the TWIN tuning). The tuned twin fits Seki's fly worse (best r 0.55) than the plain model with the laboratory prior did (r 0.741, REAL_SCAN_OFFICIAL). Which added mechanism costs the fit? Same code (TWIN.run), F4 signs, Seki's 17 odours, 3 trials: A plain model: no resting firing, no d...
2b66d3ec5b4e2eb5df27fe5fe881e2a10573c6d45575e9b14837b2156eb88848
Python
3,093
104
"""""" import cv2 from pupil_recording_interface.decorators import process from pupil_recording_interface.process import BaseProcess from pupil_recording_interface.externals.circle_detector import CircleTracker @process("circle_detector") class CircleDetector(BaseProcess): """ Circle detector for the world video...
e5de2da15424944785dccd19d0a354bbe57b4ea11c9d35cf85df8e823ebdf4e5
Python
3,093
119
# Node-group asset "Force Brownian" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKIN...
fee3a971686b3b7dbf2a95a91e8010503c7510d4471c6b3253ca6dfa01f8e254
Python
3,093
101
"""Core recipes for universal machine-learned interatomic potentials.""" from __future__ import annotations from typing import TYPE_CHECKING from quacc import job from quacc.recipes.mlp._base import pick_calculator from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize from quacc.utils.dicts im...
a9819bf1025685cf5f64c79ad21780cb83e94e646c65ba94b1015d90e7376e8e
Python
3,094
92
import argparse from cv2 import imread import cv2 import matplotlib.pyplot as plt import numpy as np from constants import DEFAULT_CANVAS_SIZE from src.preprocessing.helpers import cutdown, resize_padded parser = argparse.ArgumentParser() parser.add_argument('--image', type=str, required=False) parser.add_argument('-...
4f47f8073bde7fc6751e9e39563bbd10929e783add9c28abcf84c88e80f107ec
Python
3,095
81
''' Original Author: Nate Zuniga Modified by Yi Jie(Josh) Tseng on 11/1/2023 This script is to convert the PEAKS11 output to PEAKS10 format which is compatible to deuterater. Requirement: Make sure to have the features.csv, protein.csv and peptide.csv from PEAKS11 output Usage: python Files_to_Deut.py ...
0477628aa5033e671a4283d3b14653f3eb1aa238138b24476be90887f6b3b769
Python
3,096
101
# -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import print_function from HDPGPHSMM_segmentaion import GPSegmentation import time import matplotlib.pyplot as plt import os import numpy as np import pandas as pd import glob def learn( savedir, dim, gamma, eta, initial_class, avelen, max...
7d9a5cfb765f6cb1a2e8550d90b6426821a6518461d67a0505022b6e81102aa7
Python
3,096
91
"""Loading the .mat files shipped with the repo. The monkey sample is a Matlab v5 file containing a single struct `sess` with fields: EyeX (n_trials, n_samples) float64, degrees of arc EyeY (n_trials, n_samples) float64, degrees of arc trial_isface (n_trials...
7b8f7402fd49c8b93b4b1275064533f995f239b64042ee2eb81897d33cd8567f
Python
3,097
101
import cocotb as ctb import pytest from cocotb.clock import Clock from cocotb.triggers import RisingEdge from cocotb.types import LogicArray, Range from elasticai.creator.testing import eai_testbench from .helpers import _reset_dut, _write_current_d_in pytest_plugins = "elasticai.creator.testing.cocotb_pytest" # Cl...
e69eed5e290e090220ecedf4aafc47161ec806f7c96126e4195de19a5a5ddae5
Python
3,098
95
"""Plotting utilities.""" import numpy as np from treem.io import SWC def plot_tree(ax, tree, data, **kwargs): """Plots entire branch. Args: ax: matplotlib axes object. tree (treem.Node): branch start node. data (NumPy ndarray): raw data of morphology Morph. kwargs: argument...
f885b6c4556085e3a16108f9222c2516bc915a224b2ea6d47728ebd236294f1e
Python
3,099
80
#!/usr/bin/env python """ Code provided by Allen Institute """ import logging import numpy as np class Tile(object): def __init__(self, index, image, is_missing, bounds, channel, size, margins, *args, **kwargs): # identifier self.index = index # actual image data ...
1705b5b48c5cc610dda10713b09b5759a289457e74d7b3fea82a0479a1ffdd84
Python
3,100
85
from __future__ import annotations import re from typing import Any from wikibaseintegrator.datatypes.basedatatype import BaseDataType from wikibaseintegrator.wbi_config import config from wikibaseintegrator.wbi_enums import WikibaseSnakType class MonolingualText(BaseDataType): """ Implements th...
6059bd850bf3e031426e365e153439ea14f3dc073e9830671e478d455bcc1cb6
Python
3,100
80
from collections import defaultdict from logging import getLogger from typing import Any, DefaultDict from pip._vendor.resolvelib.reporters import BaseReporter from .base import Candidate, Requirement logger = getLogger(__name__) class PipReporter(BaseReporter): def __init__(self) -> None: self.reject_...
69f2b842198eb5233c63e0c45ec533c5682d013b6a16456b417928e060d0f285
Python
3,100
95
#!/usr/bin/env python #================================================================ # Copyright (C) 2021 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : image_io.py # Author : Yufeng Liu # Date : 2021-05-17 # Description : # #======================...
8986af4c9e45cc2c2794f000ae3856141148b384bc14560f76711c22c0d32114
Python
3,100
80
import numpy as np import pytest import nibabel as nib def _write_mask(tmp_path, arr): p = str(tmp_path / "edit_mask.nii.gz") nib.save(nib.Nifti1Image(arr.astype(np.uint8), np.eye(4)), p) return p def test_apply_edit_zeros_template_and_annotation(tmp_path): from regtools.registration.reg...