sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
22a14c9253fc721f6d3491ce100c0188ce16fce0bc0db80922e68ff62c4f77db | Python | 14,497 | 374 | # Copyright (c) OpenMMLab. All rights reserved.
# By Shuran Liu, 2023
import torch
import torch.nn as nn
from mmcv.cnn import constant_init
# from mmcv.ops import ModulatedDeformConv2d, modulated_deform_conv2d
from mmedit.models.backbones.sr_backbones.basicvsr_net import (
ResidualBlocksWithInputConv, SPyNet)
from... |
aa072508ed4f6faf97e5bb61a22442e1ad80c8b00b1afd26dc1c8c6f58ca770f | Python | 14,497 | 338 | import numpy as np
import pandas as pd
import sys
import math
import collections
import tensorflow as tf
import argparse
import timeit
run_time = timeit.default_timer()
from tensorflow.python.framework import ops
def get_parser(parser=None):
if parser == None:
parser = argparse.ArgumentParser()
parser... |
0e531f69521a2db8281ee1570ec3d19c0571afed8968cd684cf2c5cda99a06ba | Python | 14,502 | 265 | from typing import Tuple, List
from functools import partial
import random
import numpy as np
import torch
torch.manual_seed(422442)
from torch import nn
from torch.utils.data import DataLoader
import dgl
from dgl.dataloading import GraphCollator
import lightning as L
from dgl.nn.pytorch.conv import GATv2Conv
from dgl... |
31bda35163ae9a7448388a6461f72bb1e51c8a01bde1951b390acebf93781197 | Python | 14,505 | 444 | """"""
import abc
import time
from collections import deque
import signal
import logging
from time import monotonic
import numpy as np
from pupil_recording_interface.base import BaseConfigurable
from pupil_recording_interface.decorators import stream
from pupil_recording_interface.device import BaseDevice
from pupil_... |
a0a42ea3a5d6d0be8821650af587cfff45805907d0ec3c3e6d6a6d6deba7866e | Python | 14,508 | 427 | """Manuscript figures
---------------------
Figures showing parameters and network activity of the spiking network models.
"""
import mesocircuit.plotting.plotting as plot
from mesocircuit.parameterization import helpers_analysis as helpana
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import... |
0c90cc6661edb679b5759e1368d89b53b5ddecef925d5180e4fa5791f10946b7 | Python | 14,525 | 333 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 9 13:28:54 2023
@author: emma
"""
import numpy as np
import pandas as pd
import argparse
from pathlib import Path
from numpy.random import Generator, PCG64
from scipy.stats import truncnorm
from sklearn.model_selection import train_test_split
from... |
74600bc478480c9a60604f04a05f3083eff41282a0ea4f9de8cd12d7f7447213 | Python | 14,532 | 383 | """
Script for extracting the graphs for analyzing quantitatively a GA network
Input: - Density map tomogram
- Segmentation tomogram of the synapse
Output: - A graph
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
import os
import time
import scipy
import op... |
1eb03cad1b3875904111077c93b2c464071161ae002f62cf21b6184279f639a3 | Python | 14,533 | 335 | from optparse import OptionParser
from math import factorial
import sympy
import os
### help and usage ###
usage = "usage: %prog [options] args"
description = '''Function: calculate window Fst (Reynolds' modification to Wright's original formulation) between two populations '''
version = '%prog 09.05.2021'
parser = O... |
f7a4ff2e3fce996f9f2bb26b487a23623c86ddfb0681bce4a13365799de47d81 | Python | 14,537 | 316 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Shy Shalom
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#... |
5d0ef26ed6bc3088643cdaf79a1d940947f99d86a291c1f218085fb9f790a10d | Python | 14,538 | 367 | import sys
from dreamcoder.program import Primitive
from dreamcoder.grammar import Grammar
from dreamcoder.type import arrow, tpregex
from string import printable
try:
from pregex import pregex
except:
print("Failure to load pregex. This is only acceptable if using pypy",file=sys.stderr)
# evaluation to regu... |
83b07f0461a8b17bf6ffd0ffc7eaee03fba110b4a0d73f1918342803005bd909 | Python | 14,539 | 424 | """Conformer generation.
Author: Seth Axen
E-mail: seth.axen@gmail.com
"""
import logging
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import PropertyMol
from .util import add_conformer_energies_to_mol
# Heavily modified by Seth Axen from code under the following license
... |
0b6acaf444cf27cd95d8fdada792464f2dcc49f2890ea23908f48b910a7e9962 | Python | 14,540 | 432 | import numpy as np
import pandas as pd
import pd
import torch
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import scipy.sparse as sp
from embedding_utils import load_embedding, load_model,to_embedding_dict
from hyperbolic_learning_master.utils import *
def edges_from_thresh(scan,thresh):
... |
45f519b10be16122be3cb37eab02c7094a507e84d07b3fb029a571f0cb08a246 | Python | 14,540 | 395 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 12 18:57:38 2020
@author: usingh
"""
import argparse
import sys
import os
import orfipy.translation_tables
import orfipy.findorfs
import orfipy.version
import orfipy.utils as ut
import json
import logging
from orfipy import _max_mem
from orfipy impo... |
8cb3cc9d7689674e75c9b549f62da6794e3cc974c961c247f708c6cb386ab6f2 | Python | 14,542 | 373 | # 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... |
2564fea176e7a4ccec9551bce60a825289ba0ad4c38f1ddbac0105e9ac0c02e1 | Python | 14,546 | 320 | """
Downstream task: BACE: Quantitative (IC50) and qualitative (binary label) binding results for a set of inhibitors of human β-secretase 1(BACE-1)
Dataset source: DeepChem
"""
import os, sys, argparse, time
import json
import pandas as pd
from tqdm import tqdm
from rdkit import Chem
#import deepchem as d... |
3801411e7d9313f5f07a4c5cc7143f1fc8d4039c16a86994b3fc333b8390ace6 | Python | 14,547 | 416 |
import numpy as np
from bonito.nn import Permute, layers
import torch
from torch.nn.functional import log_softmax, ctc_loss
from torch.nn import Module, ModuleList, Sequential, Conv1d, BatchNorm1d, Dropout
from fast_ctc_decode import beam_search, viterbi_search
class ModelTinyNoSkipX0111(Module):
"""
Model t... |
847ad051c703cebb310a0ce97acd963e2d70cd20ffc9a8d7587d546aa4a0c399 | Python | 14,549 | 373 | """
OXASL - Workspace to store images and data associated with a processing pipeline
This class is conceptually simple - you can store pretty much any data by setting
an attribute on the workspace and retrieve the resulting data as the same attribute.
The workspace is backed by a directory and image data is save to fi... |
cde07049347bb738b12e519642563c2ac4e05ad1f2e624b0cdcde7a767d47679 | Python | 14,549 | 395 | # 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... |
d5e60c3bcbbbb40473f6fcb19936b9451cc03a2a010bd306aa1a9b58875c8179 | Python | 14,554 | 298 | import os
import sys
import numpy as np
import pandas as pd
import torch
import torchvision
from topaz.mrc import parse_header, get_mode_from_header
from typing import List, Literal
from sklearn.neighbors import KDTree
from topaz.stats import calculate_pi
from topaz.utils.printing import report
from topaz.utils.data.lo... |
3ba0cd33bd823f8fdccb98a152dd462cb8b79f81258b08a1a8d63571a520ffe9 | Python | 14,567 | 381 | import os
from pathlib import Path
import einops
import numpy as np
import pandas as pd
import pytorch_lightning as pl
from pytorch_lightning import LightningDataModule, LightningModule
import torch
from torch.distributions.multivariate_normal import MultivariateNormal
import torch.nn as nn
from torch.utils.data impor... |
abc63b90b7bb8a6d42e268c1c33b31b1d1957b6ccb797667db5f1259bb725d1d | Python | 14,575 | 402 | from pathlib import Path
import functools
from wsilearn.utils.df_utils import print_df
print = functools.partial(print, flush=True)
from wsilearn.utils.cool_utils import is_ndarray, CaptureOut, is_list_or_tuple, set_seed, is_string, is_callable, \
is_iterable, write_lines, write_text
import torch
from torch imp... |
e049c603aad479af1f160650af857ac911373ccb85ad2c021464c069f93c1a2b | Python | 14,575 | 419 | # 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... |
0b43d999fbd4d6cddeeaa2a2b479fb0efc2755472d2959bf2a3027d142ffbbd8 | Python | 14,577 | 264 | import lightning.pytorch as pl
import torch.nn as nn
import torch.nn.functional as F
import torch
from lightning.pytorch.utilities import grad_norm
import matplotlib.pyplot as plt
import matplotlib
from torchmetrics.regression import MeanAbsoluteError, MeanAbsolutePercentageError, MeanSquaredError, R2Score, PearsonCorr... |
f8d5b0cb9646381d97d45ecc248fb6394430a5ba6b0a689f59d6be353b4da702 | Python | 14,578 | 336 | """Preparing the LEMON EEG Data
[STEP 5] Match age distributions of LEMON and CamCAN datasets and visualize their summary
"""
# Set up dependencies
import os
import glob
import pickle
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
... |
699111cd8cb9e23fc5bd1d290a6c6787ae590efcc0a93e9e85f4859fb226ba82 | Python | 14,583 | 389 | #!/bin/env python3
'''
Create figures for PDL topology paper introducing Feynman diagrams.
'''
import numpy as np
import matplotlib.pyplot as plt
import ithildin as ith
import yaml
import sys
import pdlfeynman as fy
import zeus
from typing import Tuple
from matplotlib.gridspec import GridSpecFromSubplotSpec
from matplo... |
00eda1a684ce8cc10fae401e50cc766ac7161c75947b769a9dc552b057f7902c | Python | 14,586 | 439 | import platform
import serial
import serial.tools.list_ports
import time
import numpy as np
from control._def import *
# add user to the dialout group to avoid the need to use sudo
class Microcontroller():
def __init__(self,parent=None):
self.serial = None
self.platform_name = platform.system()
... |
6f960b7197caa3ca08299a67610a08b4b5f8e93a1bf84ece261ae79e119fcefd | Python | 14,587 | 291 | import os
from typing import Any, Callable, Dict, Tuple, Union
import numpy as np
import scipy.io as scio
from ..base_dataset import BaseDataset
from ....utils import get_random_dir_path
class MPEDFeatureDataset(BaseDataset):
r'''
The Multi-Modal Physiological Emotion Database for Discrete Emotion (MPED), a ... |
fb6ae03b44ce215bddd91fbf19cebff0e8b27dd951c98fbb2babcd680a92a668 | Python | 14,593 | 360 | # Small networks with pre-specified weights that "solve" the datasets with pre-specified strategies.
import numpy as np
import torch
from skimage.filters import gabor_kernel
from collections import OrderedDict
class FixedSequential(torch.nn.Sequential):
"""Sequential model that has a fixed structure (constructor d... |
2c941593bbf02b5709f5a48747ab682f9a9f4b5b2ff36f1afefde8de69ad1e51 | Python | 14,594 | 428 | #!/usr/bin/env python
# Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Support class of the MetricsManager to query the information available
to... |
b5f57756e955432aa7e05f66d4f8fa71f6e8426064243de4257cc13e25c3a256 | Python | 14,599 | 358 | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
pd.options.mode.chained_assignment = None
import pyabf
import sys
import os
import datetime
from scipy.signal import find_peaks
from scipy.signal import peak_widths
from scipy import optimize
from... |
56908ac80fe62133ea8823397d35db1fb16018fe2eae388308c07c67734212a0 | Python | 14,605 | 417 | # 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... |
0d3c7be5cbfc647854a36ea1bf66bbb23c45db079248ccf05b10340cc67202d4 | Python | 14,610 | 363 | import argparse
import json
import multiprocessing as mp
import numpy as np
import os
import pandas as pd
import random
from tabulate import tabulate
import time
from tqdm import tqdm
from src.utils import timestamp_human
from src.preprocessing.preprocess import preprocess_image, simulate_augment_image
from src.prepr... |
6d106de9e4d0f840f5729a2818c37db29134651b0c4481f53065df3b5a913b25 | Python | 14,611 | 474 | """
General tests for core Sella functionality.
These tests exercise key functionality including:
- Hessian operations and arithmetic
- Internal coordinate calculations
- Trust region optimization steps
- Eigensolvers
"""
import pytest
import numpy as np
from ase import Atoms
from ase.build import molecule
from ase.c... |
8b8e9e9f09eb8e55bd6791ed500edc637dd7be8b876964594beace2ef1baf637 | Python | 14,617 | 375 | """Testing CLI command repair."""
import subprocess
import os
def test_transpose():
"""Tests for changing location."""
os.chdir(os.path.dirname(__file__) + '/data')
proc = subprocess.Popen(['swc', 'repair', 'pass_simple_branch.swc',
'-t', '2', '2', '2',
... |
291bb3d8d37c104bd9911fef02930de7e707f4352f6b336ac0b9b16b3e72d7c2 | Python | 14,619 | 362 | """Definition handler class."""
from __future__ import annotations
from hed.errors.error_reporter import ErrorHandler, check_for_any_errors
from hed.errors.error_types import DefinitionErrors
from hed.models.definition_entry import DefinitionEntry
from hed.models.hed_string import HedString
from hed.models.model_cons... |
6423d53d29be3cb249816efa84b684c69d523eeccb6de167987afc4600ac62a8 | Python | 14,619 | 416 | import numpy as np
from tqdm import tqdm
from scipy.stats import multivariate_normal as mvnorm
from scipy.special import logsumexp
from .utils import fast_mvnorm_diagonal_logprob
np.seterr(divide = 'ignore')
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
def sample_pmf(pmf):
return np.sum(np.cumsum(pmf) < np.... |
5ecd75939fb88991babf0960da4eaf0d9cdb26236589588288ac302180e40140 | Python | 14,621 | 436 | # -*- coding: utf-8 -*-
#
# Processing of user submitted frontend arguments like foi, taper, etc.
# The processors return values needed directly for the
# downstream method calls.
# Input args are the parameters to check for validity + auxiliary parameters
# needed for the checks. Processors raise exceptions in case of... |
f06510defb3732777caeba3d4cf0a4bff4ba7ed7c87518f0b8d20ca60398c3b1 | Python | 14,623 | 338 | """
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 ... |
fd9f35dcd91e3d733c5f7d72f7920ddaba89511ec28664b4b3352f7926bd1d7c | Python | 14,624 | 434 | import os
import random
import re
import numpy as np
from collections import namedtuple
import torch
from control_tools.common import PR2_JOINT_SAFETY_LIMITS
from dimensions.common import load_cup_bowl_obj
from dimensions.cups.dimensions import OLIVE_CUPS
from perception_tools.common import get_type, get_body_urdf,... |
005abc6732cc24919d86f4d18a296a14eed258813906ce84eea1479181e2bcf4 | Python | 14,625 | 468 | # demulitplex.py
import re
import sys
import hdbscan
import numpy as np
import pandas as pd
import scipy.sparse
import statsmodels.api as sm
import matplotlib.pyplot as plt
import seaborn as sns
from pyclustering.cluster.kmedoids import kmedoids
from sklearn.preprocessing import StandardScaler
from pathlib import Path... |
85e627e00a5483b86b83bc14722208a31816208c557bedc83892f945f661e74f | Python | 14,632 | 434 | import copy
import itertools
import numpy as np
import sklearn.model_selection
from typing import Literal, Optional, Tuple
from sklearn.decomposition import PCA
from sklearn.model_selection import train_test_split
ScaleType = Literal['band', 'pixel']
SamplerMod = Literal['random', 'fixed', 'disjoint']
def get_data... |
53c20690d9f639a93b2cf6410f31878cfb2b5643fdf5f4cf42c6a18c31939231 | Python | 14,634 | 285 | import os
import argparse
import numpy as np
import pandas as pd
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, average_precision_s... |
ac3c8e7121cf4909ef574d6971c077bdb303ca2bd820b4cea7418b975a562266 | Python | 14,635 | 294 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
def select_cropping_area(config, videos=None):
""... |
da7783e6259a56fb852c7fb822a542fc6c554f5ac47e997bdd0b5401b73729e7 | Python | 14,639 | 363 | from movies import Movie
from ufmf import UfmfSaver
import os
import tqdm
import argparse
import ast
import numpy as np
ufmf_ver = 3
def rotate_region(x,y,w,h,maxwidth,maxheight,rot90):
"""
rotate_region(x,y,w,h,maxwidth,maxheight,rot90)
Rotate a region by rot90*90 degree counter-clockwise
x,y: top-le... |
ec4b9ee4d9246391afc951f49b245b6472d49c1e2daa3563fd8dbe372bd7bbfa | Python | 14,642 | 402 | """ICI regression checks against independent R Cox and Fine-Gray calculations."""
import importlib
import json
from collections.abc import Callable
from pathlib import Path
from types import SimpleNamespace
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import pytest
fro... |
b4f6f006d05d2a6fbec379961cbb21a2833846ae7d815391a582077dd73dd63f | Python | 14,643 | 238 | """
KNIFE_OR_CELL_AL.py written 2026-09-24.
Pre-registration: 04-NOTES/PREREG-2026-09-24b-KNIFE-OR-CELL-AL.md (written before this ran).
Is the antennal lobe's misread "serotonin" the knife (section), the tissue (neighbours), or the cell?
Output: 06-OUTPUT/knife_or_cell_al.txt
"""
import os
import numpy as np,... |
386674eed8dca2dc7887c43941517600ccbd875b01d35966103a34e4d4afedb7 | Python | 14,652 | 417 | """Utility functions for running ASE calculators with ASE-based methods."""
from __future__ import annotations
import logging
import sys
from importlib.util import find_spec
from shutil import copy, copytree
from typing import TYPE_CHECKING, Callable
import numpy as np
from ase.calculators import calculator
from ase... |
5d0d70e4b38966184ec6e15777355d504b5ad5aecf7d0855418ec0b55d43c973 | Python | 14,654 | 338 | """
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 ... |
26a5d313e141418dd9e66b373d60ff56ea8f1c463d771391756194bbde70e28d | Python | 14,661 | 417 | import tensorflow as tf
from tensorflow import keras
import tensorflow_addons as tfa
import h5py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import quantile_transform
class RevCompConv1D(tf.keras.layers.Conv1D):
"""
Implement forward and reverse-complement ... |
365269995fe8f0bf7cc724bc74b1e4be1aade1a720c444c39993a3edfe2042ac | Python | 14,661 | 344 | """
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 ... |
3aebb36593773a5b6e493d925b25984fda43ded4a879c6feed7af10eae18888e | Python | 14,662 | 380 | import numpy as np
import h5py, time
import scipy.ndimage
def create_custom_mask(cell_size, weight_size, pos_mat, all_masks, invimg=True):
# Create a numpy array of zeros with dimensions 1024-by-768
image = np.zeros((768, 1024))
pos_mat[0]
# Calculate the starting coordinates for the top-left c... |
5fa41a221eb732a53c78461b4ce13d38f47a28e9e639fa3492946de18665e651 | Python | 14,662 | 416 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 22 11:39
@author: Nathaniel.Delaney-Busch
"""
# %% Imports
import os
import random
import warnings
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import StandardScaler, LabelBinarizer
from sklearn... |
09c1ab1ce7ff42d068928c3176c942593ae04a89d749e180ef2177a5a9739380 | Python | 14,664 | 500 | # 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... |
5528a57aed32e6e8327bd450da396ce8bcac7c4235b885ee4152f545ea03d531 | Python | 14,669 | 380 | #
# 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,... |
625acbdcdb2872473a402a5418d3f41f3ef9ac42be8e94554294c19db532eb3c | Python | 14,669 | 414 | import cv2
import matplotlib
import matplotlib.pyplot as plt
from pathlib import Path
import glob
import os
import numpy as np
import pandas as pd
import sys
sys.path.append(r"C:\Users\schafferlab\github\SNLab_ephys\preprocessing\behavior")
from DLC_preprocessing import update_config_cropping
def _raise_window_to_fr... |
8e0e9677d6a44913363cfa16cf9fdf7a37c727ef949a0466f271653a9637df9c | Python | 14,670 | 462 | import os
import h5py
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.optim as optim
from skimage import io
from torch.utils.data import DataLoader
from torch.utils.data.sampler import RandomSampler, SubsetRandomSampler
from tqdm import tqdm
import source.callback_collection as cc
im... |
79da2765c48408052debee50cfedbc824f417a6a7c772b06e805858dd3a15330 | Python | 14,680 | 294 | import os
import re
from typing import Any, Callable, Dict, Tuple, Union
import scipy.io as scio
from torcheeg.io import EEGSignalIO, MetaInfoIO
from ...constants.ssvep.tsu_benchmark import (TSUBENCHMARK_ADJACENCY_MATRIX,
TSUBENCHMARK_CHANNEL_LOCATION_DICT
... |
f0a1af7b5c60473204afa64489e1646b3c5762623f26f04f17908e8a467cafc8 | Python | 14,681 | 382 | import numpy as np
def label_encoder(label, num_class):
"""
function: on-hot encoding
label: 0,1,2, ..., num_class-1
num_class: number of class
return: one-hot vector of m samples, shape=(m, num_class)
"""
tmp = np.eye(num_class)
return tmp[label]
class Conv2d():
count = 0
... |
dab9ffc058c152d5ef9a5f4eecc126bd74208c23293524352e06b3ce7d85fb3f | Python | 14,682 | 519 | """
Logger copied from OpenAI baselines to avoid extra RL-based dependencies:
https://github.com/openai/baselines/blob/ea25b9e8b234e6ee1bca43083f8f3cf974143998/baselines/logger.py
"""
import os
import sys
import shutil
import os.path as osp
import json
import time
import datetime
import tempfile
import warnings
from c... |
d1acb989b06501bb8d0ffb233bab03819b3a00dd6fde264fe2f24f962841bf01 | Python | 14,685 | 272 | import os
import re
from typing import Any, Callable, Dict, Tuple, Union
import numpy as np
import scipy.io as scio
from torcheeg.io import EEGSignalIO, MetaInfoIO
from ...constants.emotion_recognition.seed import (SEED_ADJACENCY_MATRIX,
SEED_CHANNEL_LOCATION_DICT)
... |
986e34202002f7f3e9c951911d400874c3d80c435d6be9628492c3479f3a2a43 | Python | 14,686 | 271 | # 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... |
6b6a8acd308fff6e0e89e7b7ddd963fc94ac3d644aa946248e613b6d39d5bb4c | Python | 14,691 | 248 | """ Set of common abbreviations in molecular images"""
from typing import List
import re
ORGANIC_SET = {'B', 'C', 'N', 'O', 'P', 'S', 'F', 'Cl', 'Br', 'I'}
RGROUP_SYMBOLS = ['R', 'R1', 'R2', 'R3', 'R4', 'R5', 'R6', 'R7', 'R8', 'R9', 'R10', 'R11', 'R12',
'Ra', 'Rb', 'Rc', 'Rd', 'Rf', 'X', 'Y', 'Z', ... |
141640336a337699a081176d527a212ea8e60ef3adac153f0f5daf559b408bec | Python | 14,693 | 459 | # 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... |
67ccd35d1de67ad7d919b64904b507ebd55ffa70e48611075671b58ea50ce192 | Python | 14,695 | 404 | import pickle
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
CM = 1/2.54
RT_COLOR = "#ffd343"
OTHER_COLOR1 = "#426eff"
OTHER_COLOR2 = ["#7542ff", "#42ccff"]
OTHER_COLOR3 = ["#816fd5", "#d5b46f", "#6fc3d5"]
MARKERS = ["o", "*", 'v', '^']
def plot_hist(load_paths, LOG_Y, CO... |
6cc78aace3176d01f1cae60c3225916fed879d06586a2afcc8cd3faa00f05c6b | Python | 14,698 | 429 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''plotting script for figure 7 and 8 in manuscript preprint for parallel
performance of LFPy
Copyright (C) 2018 Computational Neuroscience Group, NMBU.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public Licen... |
1d5c109c1de1473b891c5d0fe918dbdfcd89be9083cd61a3a3e6d4f301b1da11 | Python | 14,699 | 466 | # coding=utf-8
# Copyright 2020-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
4ba4ddb051f53396c1ba97dfef12b2e4904ab13e288d0df260cc0068e9728944 | Python | 14,700 | 414 | import xml.etree.ElementTree as ET
from math import pi
import numpy as np
from scipy.integrate import simpson
from scipy.interpolate import CubicSpline
import scipy.special as sp
from .structure import Structure
from .from_gpaw.gaunt import gaunt
from .mathutils import r_to_xyz, spbessel_transfrorm, spharm_xyz
# == r... |
76f1f8875dfadd27a1329e8b484a6477eecad3142b9129a61af80854a350f8ae | Python | 14,700 | 362 | # 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... |
7c8d98d4e3e361d5820b214a81791abbdea3ac9b89525de0cad0a2cb52496507 | Python | 14,706 | 344 | """
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 ... |
598bed182b3c3c029edf3b776f64d38815d97b3ae30c4afe263d42a5316b2bd6 | Python | 14,709 | 491 | import ray
import torch
import pprint
import copy
import os
import yaml
import numpy as np
from scipy import stats
import matplotlib
import matplotlib.pyplot as plt
import warnings
import seaborn as sns
import utils as u
from utils import concatenate_dicts, fig_to_pil, report_via_email
import analysis_utils as au
impor... |
34f39818b510d6d011ca16b5736892ebee3644dca74badcc886a9812d60bcf04 | Python | 14,711 | 411 | # -*- coding: utf-8 -*-
#
# Syncopy preprocessing frontend
#
# Builtin/3rd party package imports
import numpy as np
# Syncopy imports
from syncopy import AnalogData
from syncopy.shared.parsers import data_parser, scalar_parser, array_parser
from syncopy.shared.tools import get_defaults, get_frontend_cfg
from syncopy.... |
c372a9d80d24921b34b609a17761707a84b53e5e8e253621f3001a83c44771fc | Python | 14,712 | 293 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
import pyqtgraph as pg
import pyqtgraph.dockarea as dock
from pyqtgraph.dockarea.Dock import DockLabel
import control.utils.dockareaStyle as dstyle
import numpy as np
from collections import deque
# qt libraries
from qtpy.QtCore ... |
e2909a1454320703a8fe175e03ec0bcd36be1165af7ae3019b365d60120673d9 | Python | 14,717 | 357 | import warnings
from typing import Literal
import anndata as ad
import numpy as np
import torch
from torch import nn
from torch.distributions import Poisson
from scconfluence.distributions import ZeroInflatedNegativeBinomial, NegativeBinomial
from scconfluence.base_module import BaseModule
from scconfluence.nn import... |
20015bb7f985deadd014184718a1c0ebc2b5b8d7d4e0cae4868009d3303d4bf9 | Python | 14,721 | 401 | """distutils.bcppcompiler
Contains BorlandCCompiler, an implementation of the abstract CCompiler class
for the Borland C++ compiler.
"""
# This implementation by Lyle Johnson, based on the original msvccompiler.py
# module and using the directions originally published by Gordon Williams.
# XXX looks like there's a L... |
37b57ad8e8fcad5e372e84cc6fb8a2f7317d0c129b177fd9af6bec48a669acc9 | Python | 14,723 | 287 | import os
import argparse
import numpy as np
import pandas as pd
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, average_precision_s... |
ee3999df73e0b2f8ef70b1a0b5d60cd3302c4b2d412a7aa9b620941a06ef7b65 | Python | 14,723 | 482 | """Parameter-related utilities for the Vasp calculator."""
from __future__ import annotations
import logging
from importlib.util import find_spec
from typing import TYPE_CHECKING
import numpy as np
from ase.calculators.vasp import Vasp as Vasp_
from monty.dev import requires
from pymatgen.io.ase import AseAtomsAdapt... |
c42747214488caad7c2bb94999ca6190facf56f5d9a37a93a93bb5b81794d525 | Python | 14,724 | 340 | import data.ABIDEParser as Reader
import numpy as np
import torch
import torch.utils.data as utils
from utils.gcn_utils import preprocess_features
from sklearn.model_selection import StratifiedKFold,KFold
import yaml
import pandas as pd
from scipy.spatial.distance import pdist, squareform
import warnings
warn... |
fbe6b99321fc98a742b1632c1209161d8f7abfc06ec7bd3ec15c9ed2dcf7a15e | Python | 14,725 | 277 | import os
from typing import Any, Callable, Dict, Tuple, Union
import numpy as np
import scipy.io as scio
from torcheeg.io import EEGSignalIO, MetaInfoIO
from ...constants.emotion_recognition.mped import (MPED_ADJACENCY_MATRIX,
MPED_CHANNEL_LOCATION_DICT)
from ..bas... |
0fd08fd8f1a4a7f0062e7deda2c90a0530b4ba9c54cffbc8251deeaeecbb1e85 | Python | 14,726 | 366 | """functions of referencing part of PREP."""
import logging
import numpy as np
from mne.utils import check_random_state
from pyprep.find_noisy_channels import NoisyChannels
from pyprep.removeTrend import removeTrend
from pyprep.utils import _eeglab_interpolate_bads, _set_diff, _union
logging.basicConfig(
level=l... |
ea8bd2ef762d476f0b8b5fc5cb08375a8f650a0dc89ed346513687dd2e72b30e | Python | 14,726 | 455 | # 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... |
1f1dc8a64596ab963e59b918d80521cf0fa7d7b376de7f7d17910104c722ea33 | Python | 14,728 | 436 | # 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... |
0148d36f39c4b93f6750e11a5813c68b74ad43d76e84e340e17127e87b2d3dbb | Python | 14,734 | 433 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import load_checkpoint
from model_3D.models.common import (PixelShufflePack, ResidualBlockNoBN,
flow_warp, make_layer)
fr... |
320acbae149ee93555854fa865b3cecff3e29dca8cc7474fab4bb74dec63da82 | Python | 14,738 | 367 | """A plane's axis index is meaningless without its frame; this pins the transform."""
import numpy as np
import pytest
nib = pytest.importorskip("nibabel")
def _p():
from regtools.hemisphere import plane
return plane
def _ras_plane(**kw):
"""A plane fitted in an RAS frame: medio-latera... |
cc5517451af9ca3d0e03e4464e9ab9e32a35dbb1edd7ac28b2d6d0904526b44e | Python | 14,738 | 344 | """
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 ... |
819f14c3ebc676b046228ba33961d509a0800a6d478f87a01f52aed08ae80b10 | Python | 14,741 | 385 | import datetime
import os
from bson import ObjectId
from pymongo import MongoClient
from cirrocumulus.abstract_db import AbstractDB
from cirrocumulus.util import dumps, get_email_domain, get_fs
from .envir import (
CIRRO_AUTH_CLIENT_ID,
CIRRO_DB_URI,
CIRRO_JOB_RESULTS,
CIRRO_TEST,
SERVER_CAPABILI... |
56891c3595aadbe5d4f0c83394ab1352f32d4ae2c56e9f1546a9e950ec99ac33 | Python | 14,749 | 449 | # 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... |
087193918f713054cd7804d39905561244d21499ab7bd095ebd149d7615062ab | Python | 14,760 | 329 | import os
import shutil
import tempfile
from typing import Any, Callable, Dict, List, Tuple, Union
import mne
import numpy as np
from mne.io import read_raw_edf
from ....utils import get_random_dir_path
from ..base_dataset import BaseDataset
def _interpolate(raw: mne.io.BaseRaw, channels: List = ['F3-M2', 'C3-M2', ... |
1add2d6cbbcb45bd181f76fc33b8d7b05e389c4243becea0736ade13b0d1f4e5 | Python | 14,765 | 408 | # 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... |
0e28adcfa54dcc167e993b984155e2afa4d0eb65e13eac020ab93710464ae9af | Python | 14,767 | 375 | """
Metric tables and hemisphere sections for the registration report.
Flattens metadata into label/value rows, renders
``registration_metrics.csv`` and ``cell_count_hemisphere.csv`` as HTML
tables (single-run and batch-aggregated), and ranks batch sections by MI.
Stdlib only; never raises.
"""
import csv
i... |
83eb1d533447c247fbfa3420a04ed82fdf2733cb8ebd074e73f520baa27b33d6 | Python | 14,767 | 407 | # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/07_datasets.ipynb.
# %% auto 0
__all__ = ['construct_diamond', 'make_diamonds', 'make_swiss_roll', 'make_tree', 'make_worm_data', 'make_eb_data',
'make_dyngen_data', 'relabel_data', 'rings', 'make_rings', 'make_jacks']
# %% ../nbs/07_datasets.ipynb 3
impor... |
e3cc9bfabad9aca3105a3621dc5ec86728c49a42269221b48cb49f1d8080ccaf | Python | 14,770 | 463 | # -*- coding: utf-8 -*-
# @Author: Sadamori Kojaku
# @Date: 2022-08-26 09:51:23
# @Last Modified by: Sadamori Kojaku
# @Last Modified time: 2023-02-19 15:33:48
"""Module for embedding."""
# %%
import gensim
import networkx as nx
import numpy as np
from scipy import sparse
from sklearn.decomposition import Truncated... |
a05b31758c1cee941d2bcf79abb58ff1234a4f8d9452c91004d192f47e5ac665 | Python | 14,779 | 398 | import math
import numpy as np
import torch
import torch.optim as optim
from einops import rearrange
from torch import nn
from typing import Any, Dict, Optional
from dataloaders.torch_dataloader import create_torch_loader
from dataloaders.utils import get_dataset, sample_gt
from models.model import train, save_train_... |
c2bc9432c765e2027d61f7705c8ed18368291afee37585012b0d7dac25da9cc9 | Python | 14,786 | 394 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import subprocess
import sys
from lab.experiment import ARGPARSER
from lab import tools
from downward.experiment import FastDownwardExperiment
from downward.reports.absolute import AbsoluteReport
from downward.reports.compare import ComparativeReport... |
e3f29fd049b9ccc0357a32d92100543be6d38e35fbeb18d1b45517ff11522e93 | Python | 14,788 | 382 | import torch
import torch.nn as nn
import torch.nn.functional as F
import pickle
import random
import numpy as np
from tqdm import tqdm
from torch import Tensor
from torch.utils.data import DataLoader, Dataset
from torch.nn.parallel import DistributedDataParallel as DDP
from utils import *
torch.set_defaul... |
4e73016e0bf4c07dc431d8349d963548ca4021c516cbff258ed22716db64a4f2 | Python | 14,793 | 476 | # 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... |
54e5b2158983bbf9c3a80c0faea034fff25f971f892b5785d150a91c8cc88580 | Python | 14,794 | 359 | # import libraries
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
from sklearn.svm import LinearSVC
from sklearn.preprocessing import label_binarize
from sklearn.model_selection import StratifiedShuffleSplit, KFold, StratifiedKFold
from sklearn.metrics import roc_auc_score, precision_recall_curve... |
697a219a2aba25a27d970b6fa8143437b4265d39313f146db4671168f0376bff | Python | 14,794 | 358 | import pickle
import numpy as np
from tqdm import tqdm
from uptake.model_posttreatment.phase_analysis import Files
def get_list_of_testcase_id_in_folder(testcase, folder):
files = Files(testcase)
files_from_sensitivity_analysis = files.import_files(folder)
indexofunderscore_list = [
... |
f10b7343cea0c6cb3398b2c0f0c054fd52f90dfc0332cc5c5bf3f2507bd1ee5d | Python | 14,797 | 450 | """
Renders template copies in a tomogram from a STAR file (GA 26s adaptation)
Input: - STAR file
- Reference tomogram
- Template pre-processing parameters
- Rigid transformations parameters
Output: - A set of VTK poly data for rendering the templates on the reference... |
5e2d7b65c8238365c1a038a3786f24b8df2255c030f59dd5346aa3df2388727d | Python | 14,798 | 327 | import numpy as np
import pandas as pd
import sys
import pickle
import os
import time as tm
from functools import partial
import scipy.stats as st
from scipy.stats import wasserstein_distance
import scipy.stats
import copy
from sklearn.model_selection import KFold
import pandas as pd
import multiprocessing
import matpl... |
5444cddd59d56c6e9a9b215a630cf4ee66125d5790d2bf18406bc9886fa97450 | Python | 14,801 | 355 | from typing import List, Tuple, Union
from itertools import zip_longest
from rdkit import Chem
import torch
import numpy as np
# Atom feature sizes (atom_fdim: 127)
MAX_ATOMIC_NUM = 100
ATOM_FEATURES = {
# type of atom (ex. C,N,O), by atomic number, size = 100
'atomic_num': list(range(MAX_ATOMIC_NUM)),
# n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.