sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7b8870d3cf331a8dba5a625a30846f0a788b94b9a83a3aa8946c9f1e3b029024 | Python | 5,335 | 147 | import logging
import os
from optparse import Values
from typing import List
from pip._internal.cli import cmdoptions
from pip._internal.cli.cmdoptions import make_target_python
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
from pip._internal.cli.status_codes import SUCCESS
from pip._inter... |
da368d2413ff7c34af717e63f2d993c0bef6f0094655152b9a3c0f57ea5545b1 | Python | 5,335 | 124 | #!/usr/bin/env python
# Copyright (c) 2019 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides access to a scenario configuration parser
"""
import glob
import os
import xml.etree.ElementTree as ET
from sru... |
f306b53c69f22d03053753f6d0c067b5582aa750b5db23406efa154320509103 | Python | 5,336 | 134 | # Step 4 of 4: Collect results created by runfiles executed in step 3
# Reads .txt files created by running TriDy, exports them in a pandas dataframe
# Will check if dataframe exists, so as to not overwrite anything
# Will collect incomplete results and export a dataframe. Row number will correspond to bin index in pa... |
a239f012fdf3029ce0aa5ae32b4d206afaf21448ca9f31cbd0c4fe9941215a48 | Python | 5,337 | 155 | from __future__ import annotations
import os
import tempfile
from functools import cached_property
from typing import Optional
import numpy as np
import pandas as pd
from cuppa.classifier.cuppa_prediction import CuppaPredSummary
from cuppa.constants import PAN_CANCER_CLASS_NAME, RSCRIPT_PLOT_CONFUSION_PATH
from cupp... |
0577fcf20d7dc2e47299a692e6901be89b3f96bce2a62e6a742c9a974d6ec5fa | Python | 5,339 | 161 | import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
from pandas import read_csv
import plotly.graph_objs as go
import plotly.offline
import plotly.express as px
directory = '/Volumes/Elements/spring2022/final/week4/Predictor/'
pred_NS = 'Pred_prediction_NS_250Hz.csv'
pre... |
05eef1a2fca2ce604ebdd32994405b05b0ba58c7b7f47d3d091a06f10d587886 | Python | 5,340 | 125 | import torch
from torch.utils.data import Dataset, random_split, DataLoader
from typing import List, Any, Type
from pytorch_lightning import LightningDataModule
# local imports:
from ..shapes import Pixel, Square
from ..colors import Color, RandomRed, RandomBlue, Grey
from ..stimuli import Stimulus
from ..textures impo... |
1c68f03e5abc36c8f59659d49c42fc5c2dd1dfa6eff757ffffaf17b1f43b8b45 | Python | 5,340 | 100 | #! /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 = ... |
afd3bac2512cfd460e881ecde0cfc59a9ea256665b3605f19b11813e4d6078cd | Python | 5,340 | 152 | # Libraries
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import numpy as np
import random
import torch
import argparse
from setting import *
from loader import *
from evaluate import *
from models import *
from XAI_method import *
from XAI_interpret import ... |
131b3843b2b61df39d174a28c1b2b4ec9ecab283c4657188221d218a1ed79cd0 | Python | 5,341 | 124 | import random
from ..utils import get_ik_limits, compute_forward_kinematics, compute_inverse_kinematics, select_solution, \
USE_ALL, USE_CURRENT
from ...pr2_utils import PR2_TOOL_FRAMES, get_torso_arm_joints, get_gripper_link, get_arm_joints, side_from_arm
from ...utils import multiply, get_link_pose, link_from_na... |
ad13963b849691a3f84316db006271b730fdb04978da9ee327d944c5f3df7e4d | Python | 5,341 | 101 | #! /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 = ... |
921933fd7c50df6e57489085f74ec50ee90065f75b9bc5945289d232375c3bd2 | Python | 5,344 | 125 | import torch
from torch.utils.data import Dataset, random_split, DataLoader
from typing import List, Any, Type
from pytorch_lightning import LightningDataModule
# local imports:
from ..old_shapes import Pixel, Square
from ..colors import Color, RandomRed, RandomBlue, Grey
from ..stimuli import Stimulus
from ..textures ... |
0eb59ee86b287642d563732b26da7f0da6ce77d335dfe46a81f61e140fa516b4 | Python | 5,345 | 212 | # -*- coding: utf-8 -*-
#
# Helpers to generate correct data, labels etc. for the plots
# from Syncopy dataypes
#
# Builtin/3rd party package imports
import numpy as np
from copy import deepcopy
import functools
def revert_selection(plotter):
"""
To extract 'meta-information' like time and freq axis
fo... |
3347bedac8d82ecf898ee6f545b0f3be8d7bcdf7d2665eb2cef352df23d36228 | Python | 5,345 | 90 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from utils import str2bool
import sys
def add_params(parser):
parser.add_argumen... |
a947b76ff5e2c2a849d366daf4da631c87ee5a70dc26ad646b26c768402d0d5a | Python | 5,345 | 137 | """
Create positional encoding embedder
"""
import torch
from glbSettings import *
import numpy as np
class Embedder:
@staticmethod
def get_by_name(embedder_type:str=None, *args, **kwargs):
if embedder_type is None or embedder_type == 'None':
embedder_type = "BasicEmbedder"
... |
23b1fc2340e12f270b858184c471fac811b14598db2da1fb0f536f2db35e5f76 | Python | 5,346 | 161 | import jax
import jax.numpy as jnp
import numpy as np
from functools import partial
import netket.jax as nkjax
from netket.utils import mpi
from netket.stats import mean as mpi_mean
from netket.stats import statistics, Stats
import scipy
import matplotlib.pyplot as plt
import itertools
@partial(jax.jit, static_argnam... |
8564606b065127c61855c3a75426a9be964ccea29df82ef66846504ff8648313 | Python | 5,346 | 145 | import sys, re, json, logging
import os.path
import argparse
sys.path.extend(["/Users/jkrys/src.git/bioshell/bin","/home/jkrys/src.git/bioshell/bin"])
sys.path.extend(["/Users/dgront/src.git/visualife/","/home/dgront/src.git/visualife/"])
from visualife.data import amino_acid_code3_to_code1
from pybioshell.std import... |
69d7cc0677c8f158c3d1b1d8e2938984b29a364299c553eb8077709087b756d2 | Python | 5,348 | 119 | #!/usr/bin/env python
from __future__ import print_function
from itertools import combinations
import numpy as np
from .ikfast.utils import IKFastInfo
from .utils import joints_from_names, has_joint, get_max_limits, get_min_limits, apply_alpha, \
pairwise_link_collision, get_all_links, get_link_name, are_links_... |
a7bd3a4f081bfa6794eef5b975625c55386b43543d508d318658ab2dc29bdb16 | Python | 5,348 | 167 | # Node-group asset "Curve Offset Dot" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
import math
from typing impor... |
9bb9d16927c52a09c7857adecdc42f26dce791b89308407a2e20de6586b24ac8 | Python | 5,349 | 126 | import numpy as np
from typing import Optional, Union
import numpy.typing as npt
def create_task_design_activation(onsets_list: list[list],
durations_list: Union[list[float], list[list]],
dt: float = 0.1,
first_rest:... |
abc73894c099c1c7090216ba314fc4ec36c9735042857e50ac7d4ca09576b994 | Python | 5,349 | 135 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
3c9054b63ea9308670475e6c5785d009ea24769b4aba31be04ceb170603074c3 | Python | 5,350 | 171 | from typing import Tuple
import torch
from torchmetrics import Metric
__all__ = ["PhaseMAE", "PhaseAtomisticMAE", "PhaseAtomisticMSE"]
class PhaseMAE(Metric):
"""
Metric to monitor the phaseless loss of bulk properties obtained by
means of the Mean Absolute Error (MAE).
"""
is_differentiable: b... |
3ed5252c4ce56d2adde77f7a17f1b749e553b4d8d639130d29d4fab9d5d0b5cc | Python | 5,350 | 186 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
e372d169dfea9485e6dc4a859311e7dcda94935947afc4b0c201e02109068150 | Python | 5,350 | 186 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
e8c1753dd3049b6534e058bc61c7d6d50eef2adc1cd0d6b52f9f059e36239cce | Python | 5,350 | 186 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
ea152b7966a53d0e9420826d564c307eab00568e294b79c4b4e0c2711e141bc1 | Python | 5,350 | 186 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
ff13f2edf34e03a2284da68ed260959f1dd8fe02072a94ae7ac2568791af728c | Python | 5,350 | 186 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
587e270fb0704ada9554b4335f135238c204cb18170aad957992cef27df5f701 | Python | 5,351 | 178 | """Plot decoding times."""
from __future__ import annotations
import csv
from enum import Enum
from pathlib import Path
from typing import Literal
import numpy as np
import pandas as pd
import pte_decode
import scipy.stats
from matplotlib import pyplot as plt
import motor_intention.plotting_settings
import motor_int... |
de1124eb0185a2ad570021725768fb605514aa0d7c590e9222f860ee44ca0810 | Python | 5,353 | 213 | import numpy as np
from moabb.datasets import (
Zhou2016,
BNCI2014004,
BNCI2014001,
MunichMI,
Weibo2014,
Cho2017,
)
from burst_space import BurstSpace
from burst_features import BurstFeatures
from preprocess import (
load_sub,
apply_preprocessing,
Dreyer2023,
)
from help_funcs impo... |
5d2a41310ec91a909e3ef7a5aad72e3ed9fd963cff97735c493bbe83b696e409 | Python | 5,354 | 157 | """
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free software: yo... |
f7044a7d69f5218572a06d274a8e8d9619e2e7ff6448909590d272d9f4ff83b8 | Python | 5,354 | 110 | import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sns
from typing import List, Tuple
from src.analyze.utils import init_mpl
init_mpl(sns_style='ticks', colorpalette='muted')
def get_predictions_model_comparison(results_dir_reg_v1, results_dir_mlc, results_dir_reg_v2)... |
a499c09dae9a08a842274d6b12cd11c0e0004a2cd4e7a86fad287398b02d08f3 | Python | 5,355 | 128 | import numpy as np
from typing import Optional, Union
import numpy.typing as npt
def generate_synaptic_weights_matrices(
num_regions: int,
num_modules: int,
num_regions_per_modules: Optional[list] = None,
factors: Optional[npt.NDArray] = None,
sigma: float = 0.01,
retur... |
214f0cc6a64112780d2820f6abed5daadca214ba2450a9bda9c245660aead416 | Python | 5,356 | 155 | import six
import numpy as np
import pandas as pd
import networkx as nx
from collections.abc import Iterable
def printv(*args, verbose=True, flush=True, **kwargs):
"""Thin wrapper around print function."""
if verbose:
print(*args, flush=flush, **kwargs)
def check_frame(x, required_cols=None, dtype... |
29c551204499dc7767886b8a71963020e13abf5c5296419cfb743dc9e5755fd7 | Python | 5,356 | 155 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import yaml, io
with open("./config/DryBean_config.yaml", 'r') as stream:
config= yaml.safe_load(stream)
config["default_path"]= str(config["default_path"])
config["split"]= float(confi... |
ce6cfac9b1a274054d7ada07e4c68c68e20006eb3caa00c17ad72f66ff3ee46b | Python | 5,357 | 139 | '''
CalciumDenoising/infer.py Copyright (C) 2022 Sharif Amit Kamran, Hussein Moghnieh
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later ver... |
e17312cad0d54804bf07b60ca05b62b42cc1877223e63e39f31caa3dad71d2bc | Python | 5,357 | 160 | #
# Output setup utilities for ACME
#
# Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Builtin/3rd party package imports
import os
import logging
import h5py
import numpy as np
from typing import Optional, List
# Fetch logger
log = logging.get... |
7396152ed38915eea4ec901cd85654dac51c78108245c162d40c12298d2afab4 | Python | 5,358 | 152 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import numpy as np
from examples.discrete_tamp.primitives import GRASP, collision_test, distance_fn, DiscreteTAMPState, \
get_shift_one_problem
from examples.discrete_tamp.viewer import DiscreteTAMPViewer, COLORS
from pddlstre... |
ec89e41e0d7fc43fa068c679df55faca572a4bc284263c6622aa616b7e3edee2 | Python | 5,360 | 136 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import torch
import numpy as np
class Swish(torch.nn.Module):
"""
Swish module
"""
def forward(self, x):
return x * torch.sigmoid(x)
class NeuralNet_General(torch.nn.M... |
f4e1337018054f6764285b27f09ba0a38993a5e53bc9d653c080ff231c379735 | Python | 5,360 | 110 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.reports import Attribute, arithmetic_mean, geometric_mean
import common_setup
from common_setup import IssueConfig, IssueExperiment
from rel... |
435aeb3b21aa9cd370d2d300f7715717e8a80582d80f70f90966614b69f6b9ba | Python | 5,361 | 124 | import numpy as np
import os
import pandas as pd
import torch
from tqdm import tqdm
from constants import REGRESSION_LABELS, N_ITEMS
from src.dataloaders.semantic_transforms_dataloader import get_dataloader
from src.utils import map_to_score_grid, score_to_class
class SemanticRegressionEvaluator:
def __init__(se... |
789cb62cdd07112058aeebd3788869e4fbc19ad2bab0e9a6bc3ef8a83a3acc10 | Python | 5,361 | 178 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 24 18:37:59 2023
@author: tomas.vega
"""
## Python 3.11.2
#--------------- Libraries -------------------
import numpy as np
import pandas as pd
from scHPL import learn, train, utils
from scHPL.utils import TreeNode, _print_node, _count_nodes
from ma... |
723d94366905e64f335bc08f1d378bcd5b14f6d86ea8ac85fcb88274d8805ea4 | Python | 5,363 | 121 | import os
import re
from typing import Iterator, Dict, Tuple, Union
import pandas as pd
from sklearn import model_selection
from torcheeg.datasets.module.base_dataset import BaseDataset
from .base_model_selection import BaseModelSelection
from .utils import create_subset, read_indices, write_indices
class KFold(Bas... |
894ad840ed3fa009c18d4b8d88253c43647ab123acac28d28a6728c39284a293 | Python | 5,363 | 164 | import numpy as np
from jitcdde import input as system_input
from ....utils.stimulus import OrnsteinUhlenbeckProcess
from ..builder.base.network import Network, Node
from ..builder.base.neural_mass import NeuralMass
HOPF_DEFAULT_PARAMS = {
"a": 0.25,
"w": 0.2,
"x_ext": 0.0,
"y_ext": 0.0,
}
class Hop... |
b3cd68f0ac60ac513c8a41325f070d80f36fce636b81cfac1eff7094abca1288 | Python | 5,363 | 158 | import logging
import os
import socket
import tempfile
import uuid
from typing import List
import hydra
import torch
import schnetpack as spk
from omegaconf import DictConfig, OmegaConf
from pytorch_lightning import Callback, LightningDataModule, Trainer, seed_everything
from pytorch_lightning.loggers.logger import Lo... |
3be01f449c031d7a3a639ba42715b18e04a5685e1e3a80e9373755c8dcb32faa | Python | 5,364 | 186 | """Headless tests for the rectangle-to-region-IDs resolver. The
resolver is pulled out of SelectionMixin so it can be tested without
Qt - no QApplication, no widget instantiation."""
import numpy as np
class TestResolveRectToRegionIds:
def _slice_4x6(self):
# Two regions, region 0 = background
... |
568b79f3ddc431ff8b9bb720c8384256a1d813b22509275e45b1a3280c9dc35e | Python | 5,364 | 76 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.reports import Attribute, geometric_mean
from lab.environments import LocalEnvironment, MaiaEnvironment
import common_setup
from common_setup import IssueConfig, IssueExperiment, get_algo_nick, get_repo_base
BENCHMARKS_DIR = os.environ["DOWNWARD_BENC... |
4b33d80fb7f59704cc341591bf301762977144e85a50abcd401ce3c78cf5fd9a | Python | 5,365 | 164 | import hyperparams
import argparse
import numpy as np
import simulations as sim
import os
import torch
# np.random.seed(42)
# torch.manual_seed(42)
parser = argparse.ArgumentParser()
#parameters for training
parser.add_argument('--nn', type=str, default='linear')
parser.add_argument('--layers', type=int, nargs='+', ... |
c39e698953d30081abe96e65c8fd1517231e48b85a54becf975c098fe47c6acd | Python | 5,366 | 130 | """
Optuna example that implements a user-defined relative sampler based on Simulated Annealing
algorithm. Please refer to https://en.wikipedia.org/wiki/Simulated_annealing for Simulated
Annealing itself.
Note that this implementation isn't intended to be used for production purposes and
has the following limitations:... |
d027aab33c31e7ef1f5576defadc1b4a0ab21309d59cbb076381741dd4b13165 | Python | 5,366 | 174 | # 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... |
7dd5d8b4c73017b75c41a5cf33644b903fdab9e6ef326c2b3809cbd94761818e | Python | 5,367 | 133 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import torch
from sklearn.metrics import balanced_accuracy_score
import time
import random
import numpy as np
import argparse
from setting import *
from utils import *
from loader import *
from evalu... |
4ee9ebb5f0dbda31c8150078a643a3c17fcec54130dfa6784bdf13894e8a0060 | Python | 5,369 | 159 | #!/usr/bin/env python
# Copyright (c) 2018-2019 Intel Labs.
# authors: German Ros (german.ros@intel.com), Felipe Codevilla (felipe.alcm@gmail.com)
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Module to manipulate the routes, by making then m... |
5f7d66a7699c079b3800ddcfb36323545aea2b66268f2afd662cb49cc049576a | Python | 5,369 | 131 | # 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 b... |
f44f3f08fd1a8cb0a4e8f2491ae9368ce14dda8f4ce91ac45a188d89f3fcb5c1 | Python | 5,369 | 163 | # 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... |
93f23f701d7145d203abcda8b7e8b1ce260f48b1334de71ff6317dab7bbc76c8 | Python | 5,370 | 146 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
import os, sys, glob, shutil # Python modules to do stuff
import sphinx... |
ecf7fc3438fcc001e17b7bd1f24cb4b4c8586fa5e99fc804cff38a67bf949c4c | Python | 5,370 | 132 | import numpy as np
import torch.utils.data as udata
from torch import from_numpy
from typing import Any, Dict
from dataloaders.utils import is_coordinate_in_padded_area
def create_torch_loader(img: np.array,
gt: np.array,
hyperparams: Dict,
shu... |
7cbb44bc1583cd22fe523f3cd31aa3cffa9fbb7fda1574dff7600d9b5099a31d | Python | 5,372 | 132 | import argparse
import os
import torch
import pyhocon
from collections import defaultdict
import multiprocessing
import numpy as np
import random
from functools import partial
from train import retrieve_clusters
from utils import load_snp, sig_score
if __name__ == "__main__":
parser = argparse.ArgumentParser(
... |
91149bc17a3a5b8f4c7241ed3b3b4d234182c086ca7ebe764c97ee99b6db956b | Python | 5,372 | 161 | import subprocess
import sys
import pytest
import pertpy as pt
from pertpy._jax import jax_import
JAX_STACK = ("jax", "jaxlib", "numpyro", "ott", "flax", "optax")
JAX_BACKED_TOOLS = ("Sccoda", "Tasccoda", "Cinemaot", "MLPClassifierSpace", "Scgen")
JAX_FREE_TOOLS = (
"Augur",
"Dialogue",
"Distance",
... |
21fb1356c724abafbde2e2ffcbb822f16699527aa271268316b38abcd96bba13 | Python | 5,373 | 198 | import numpy as np
from moabb.datasets import (
Zhou2016,
BNCI2014004,
BNCI2014001,
MunichMI,
Weibo2014,
Cho2017,
)
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from mne.decoding import CSP
from pyriemann.classification import MDM
from pyriemann.tangentspace impo... |
23994149f1652ad883c00584b7450da76ada100121f3ba2a079386c28e134f9e | Python | 5,373 | 157 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.nn.integer.vhdl_test_automation import flatten_params
fro... |
5b91e16d915d239df1fd1455d2ea28ae947defcf7d7201e9006f79422b0d1f0a | Python | 5,374 | 104 | #!/usr/bin/env python3
import argparse
import os
import subprocess
from glob import glob
import pandas as pd
__version__ = "1.0.1"
def run(command, env={}):
merged_env = os.environ.copy()
merged_env.update(env)
process = subprocess.Popen(command, stdout=subprocess.PIPE,
std... |
d4756bdf272ec4213b89e03f8ca7d6726972fc2e73624453bc33f5fc0fd124a8 | Python | 5,374 | 134 | """
This script checks for completeness of data. It requires all datasources and
plots a heatmap where the % of completeness in each data source is shown. It
also visualizes every Sunday, easing visual inspection.
Input: path where all the preprocessed data is
Output: path where the figure will be saved
@author: t... |
21503807fedd58d7329da76dc7e888ceb3d3abc5465f645c11bee5d7e208a90d | Python | 5,376 | 151 | import os
from schnarc.calculators import Queuer
import subprocess
import torch
class EnsembleTrainer:
def __init__(self, ensemble_size, dataset_path, ensemble_dir, executable, input_template, basename='model'):
self.ensemble_size = ensemble_size
self.dataset_path = dataset_path
self.ense... |
a0d50585b11a84479809e465377b08081525c73709d0e8d70d7339786e0f916e | Python | 5,376 | 117 | # import libraries
import numpy as np
import sys
# import modules within repository
sys.path.append('C:\\Users\\dreww\\Desktop\\hyperbolic-learning\\utils') # path to utils folder
sys.path.append('C:\\Users\\dreww\\Desktop\\hyperbolic-learning\\hyperbolic_gaussian')
from utils import *
from distributions import *
#--... |
d25b4f574c1f7676dbd044ce5322c44444e312aa36add32197810e2778768d83 | Python | 5,376 | 153 | """First-launch welcome dialog tests for the CCF Boundary Editor."""
import pytest
@pytest.fixture
def qapp():
from PySide6.QtWidgets import QApplication
app = QApplication.instance() or QApplication([])
yield app
class TestOnboardingSettings:
@pytest.mark.fresh_onboarding
def t... |
6a181ba55f9e75da10cdefecdffc2b32d3b5d66705309a049cb4ac57205f5d35 | Python | 5,377 | 141 | import pandas as pd
import numpy as np
from sklearn.metrics import ConfusionMatrixDisplay
import matplotlib.pyplot as plt
import builtins # To access the original built-in functions
# Define the message function and dictionaries
def message(binary_array):
merfish_msg = ' '.join(map(str, binary_array))
... |
c9d8a7f101bc047a9846c3d8e0e2fa7266f8e026ea5e5d53d31c52f7b5611e49 | Python | 5,377 | 165 | """Generate and work with PEP 425 Compatibility Tags.
"""
import re
from typing import List, Optional, Tuple
from pip._vendor.packaging.tags import (
PythonVersion,
Tag,
compatible_tags,
cpython_tags,
generic_tags,
interpreter_name,
interpreter_version,
mac_platforms,
)
_osx_arch_pat ... |
096902fc7c6abda757501b9ab4ec5ba9b8f25bd2876f7dc57706a15885d0d63c | Python | 5,378 | 140 | import shutil, os, sys
from tqdm import tqdm
import pandas as pd
from pathlib import Path
import pandas as pd
import os
import shutil
from wsilearn.utils.cool_utils import is_iterable, is_string, can_open_file, mkdir
from wsilearn.utils.path_utils import PathUtils
class FilesInfo(object):
name_col = 'name' #name... |
158b870e2e7f1d02250c0c3b3923bb9ae697b3337233ae6908eb4038e51f4e99 | Python | 5,379 | 144 | # 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... |
ab74809302f700f550146ff9f10d535fc95d3e4cdc8ae882008f87e00381bb75 | Python | 5,379 | 117 | # coding=utf-8
# Copyright 2021 Facebook AI Research (FAIR) and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... |
bd635dc0a754f73f58ee959f1f6fd9ec7470815f11a5c4635f2f84bddcdc98f2 | Python | 5,379 | 157 | import os
import numpy as np
from math import inf
from yacs.config import CfgNode
from .pointcloud import PointCloud
from scipy.spatial.distance import cdist
from scipy.interpolate import RBFInterpolator
def corrPts(cloud1: np.ndarray, cloud2: np.ndarray, cfg: CfgNode) -> list:
"""
Find corresponding point p... |
1a09e813a64f27031202e766c08b606abf0c8c724dddcdc5681c74d1abb487e6 | Python | 5,380 | 203 | import yaml
import numpy as np
from pathlib import Path
from scipy.signal import hilbert
import brian2 as b2
import brian2hears as b2h
import mne
def load_config(config_path: str) -> dict:
""" Load configuration from YAML file. """
with open(config_path, 'r') as file:
return yaml.safe_load(file)
de... |
a75e4412615b9905306ca2c2ee53895461c4670706e39b9b1196131aed352798 | Python | 5,380 | 147 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... |
383c872b6357bde5ff973e5e671465bf112372f16a93cffbe199178d586a1454 | Python | 5,382 | 125 | from datetime import datetime
import gzip
import json
import pandas as pd
#Defining JSON data loading function
def json_loading(f,g):
begin_time = datetime.now()
genes_df = pd.read_csv(g, sep='\t')
genes_list = genes_df['gene symbol'].tolist()
previous_chrom = ''
fyle = f.split... |
a8e0cc621c57d000e091a8dd44c884e7ecc95eb4120b99a6fecd445e9776cb99 | Python | 5,382 | 133 | #############################################################################################################################################################################################
# The script plots the emotional arousal ratings of all NeVRo participants in the same plot and the mean of all participants
# The... |
130a545ce872a5aa7111c1eb55c4d386d02dee0b1653c32175cd757f136e520b | Python | 5,383 | 154 | # 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... |
3fdbb095be1c3e044c208c30521221358790a5c3a8610e4d4f5725742905ab66 | Python | 5,384 | 152 | import sys
import os
# Get the current script directory
current_script_directory = os.path.dirname(os.path.realpath(__file__))
# Get the root directory of your repository
root_directory = os.path.abspath(os.path.join(current_script_directory, os.pardir, os.pardir))
# Add the root directory to sys.path
sys.path.appen... |
04dea0bd1d0c1f6274cd880269727366239089efde675d791424a28b48ad8d1c | Python | 5,385 | 144 | import numpy
import scipy.io
import glob
import warnings
import matplotlib.pyplot as plt
from modules.helper_func_class import structtype
#import os
def lnbin(x,nBins,normalize_by_sum=True):
x = numpy.asarray(x)
xx = x[x>0.0]
if xx.size == 0:
warnings.warn('WARNING: all x are less than zero, taking... |
b0f82fee15fffd7381dc01d2b40a7852a9a1c7a1df12df6409c0de62feacd420 | Python | 5,385 | 153 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import yaml, io
with open("./config/simul_study_config.yaml", 'r') as stream:
config= yaml.safe_load(stream)
config["default_path"]= str(config["default_path"])
config["split"]= float... |
2508cd603101ba0cfd2130619ed9d6aa087f7cb70d34e24a282e0d8b0c7bc9b8 | Python | 5,386 | 157 | import os, json, time, gc
from tqdm import tqdm
import random
import math
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit import DataStructs
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
SAMP_NUM = ... |
5ec1c7cb633bb15938c51cb18143679350fb18a034f9bd801c015fa5d10c87c0 | Python | 5,390 | 106 | '''
Description:
Model model_wrapper of scNODE models.
'''
import copy
import torch
from tqdm import tqdm
import numpy as np
import itertools
from optim.loss_func import SinkhornLoss, MSELoss
from benchmark.BenchmarkUtils import sampleGaussian
# =============================================
def scNODETrain4Adju... |
1f5950cc1e8541a488c40f7f18e96d4dcce842ffea2cb6e046c2961480694556 | Python | 5,391 | 154 | from enum import Enum
from dataclasses import dataclass, field, asdict
from typing import List, Type, Dict
def kind_to_dict(enum_class: Type[Enum]) -> Dict[str, Dict]:
"""Converts an enum class to a dictionary of its members and their metadata."""
d = {}
for kind in enum_class:
d[kind.name] = asd... |
38662bcabcf890f75f4de746b919096ebcfc8ffe0753db9011f00d626f519c1c | Python | 5,391 | 135 | from typing import Dict, Tuple, Union
from scipy.signal import hilbert
import numpy as np
from ..base_transform import EEGTransform
class CorrelationTransform(EEGTransform):
def __init__(self, apply_to_baseline: bool = False):
super(CorrelationTransform,
self).__init__(apply_to_baseline=a... |
81553006edf2a7301c46f47f3d7242bc611ac3a21f9e83429f628fcfd3df28ff | Python | 5,391 | 144 | import warnings
from elasticai.creator.arithmetic import FxpConverter, FxpParams
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.vhdl.design.ports import Port
class Skeleton:
... |
dc5821683035ef5d32f1a36a8a922796ae282d3e82abeb22b088e60cabf11c88 | Python | 5,392 | 94 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from downward.reports.compare import CompareConfigsReport
from common_setup import IssueConfig, IssueExperiment
import os
def main(revisions=None):
suite = suites.suite_optimal_with_ipc11()
conf... |
4eaafe49fbd18597ad03ef0bb80a07781fe982ba23f0facb6cd1a4ea42c08cf1 | Python | 5,393 | 127 | # Plot optimization errors and best solution distance for S1 Appendix Fig D
from os.path import join
from get_paths import *
import matplotlib.pyplot as plt
import numpy as np
from OptimizationFitness import OptimizationFitness
from colors_paultol import *
if __name__ == "__main__":
save_flag = 0
... |
909c2335e61150a5884f8e391995ed7c17c86b22f25d29909425f34fe2b5356f | Python | 5,393 | 168 | #
# 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,... |
27e4ce12768189d72026b6aaec1a460f4f40c3060e7a446332b5e198a654be6a | Python | 5,396 | 151 | from ase.neighborlist import neighbor_list
import torch
import numpy as np
import spglib
import ase
from ase import Atoms
from ase.cell import Cell
from phonopy.structure.atoms import PhonopyAtoms
from phonopy.phonon.band_structure import get_band_qpoints_and_path_connections
def read_force_constants(file):
with ... |
7dcd0ebb1d6b85967bc6d863269824bb17ef63506ff087ad3383f8f6116968c0 | Python | 5,396 | 205 | # 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... |
33b6835137f4a021dadfcad45c3d3bce3dae7c125db290ac3cfefba052cbe80a | Python | 5,397 | 156 | from collections import Mapping
from random import random
from .rrt import TreeNode, configs
from .utils import irange, argmin, get_pairs, randomize, take, enum
ts = enum('ALL', 'SUCCESS', 'PATH', 'NONE')
# TODO - resample and use nearest neighbors when the tree is large
# TODO - possible bug if a node is already in... |
5856400a286bdced7fe638e95a4b7455ea3542967a2ec6d054a85d5c74fa044b | Python | 5,397 | 215 | """ Calculate Moran's I in 3D"""
# import libraries
import math
import numpy as np
# Create adjacency matrix in 3D
def adjacencyMatrix3D(_data):
""" Create adjacency matrix from 3D data for Moran's I and Geary's C """
# Determine of 2D or 3D
if len(_data.shape) == 3:
_3D = True
else:
_3D = False
# Create... |
27e3c32830c9cd787e48729c8f402a44442faf44eef02ed53382d5319d35cb9a | Python | 5,401 | 154 | from __future__ import absolute_import, print_function, division
def generate_description(module_groups, linewidth=78, indent=' ', delim=' '):
"""
description = []
for group,module_list in module_groups:
description.append(group + ':')
for module in module_list:
description.a... |
33791fb6c836e00c99ecb2e630e6e454c3f1657e915f627adf81af56cc9db919 | Python | 5,401 | 213 | import numpy as np
import subprocess
from math import sqrt
from sklearn.metrics import average_precision_score
from scipy import stats
import random
import torch
import os
from tqdm import tqdm
device = torch.device('cuda:0')
def calculate_metrics_and_return(Y, P, dataset='kiba'):
# aupr = get_aupr(Y... |
b9a6bb86b8636a5e6bdf441138f111a039bf0b21c37fca2d2f75569dcfea0e52 | Python | 5,402 | 147 | from typing import Type, Union, List, Optional, Callable
import torch
from torch import Tensor
import torch.nn as nn
import torchvision
from torchvision.utils import _log_api_usage_once
from torchvision.models.resnet import BasicBlock, Bottleneck, ResNet
from cl_3d.models.components.layers import RunningNorm2D, PLIM... |
70e8411133a6e9497c24a17c957d260043207ecf315a1f9df16bcfc85251ecb6 | Python | 5,403 | 191 | from datetime import datetime
from logging import getLogger
from numpy import around, c_, empty, float64, nan
from scipy.io import loadmat, savemat
from .utils import read_hdf5_chan_name
from ..utils import MissingDependency
try:
from h5py import File
except ImportError as err:
File = MissingDependency(err)
... |
b7b35667207c19bba3b70c6e623d8c20d74ffb2bc8c41c50ebf1585a844e9901 | Python | 5,403 | 185 | # 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... |
03fe7300bd4b59de198b0271c08b9bf800cc62c456fce9a26ff8de06af134cdb | Python | 5,404 | 155 | import torch.nn as nn
import torch
import torch.nn.functional as F
class BalancedBCELoss:
def __init__(self, class_weights=None) -> None:
self.class_weights = class_weights
self.bce_fcn = F.binary_cross_entropy
def __call__(self, outputs, labels):
if self.class_weights is not None:
... |
5cde7f87b037700edbb9cc66f50d962225cd89e7ae58c404b92d8cd23fd1f236 | Python | 5,404 | 88 | import sys
fn=sys.argv[1]
dfh=open(fn,'r')
rfh=open('./'+fn.split('/')[-1]+'_no_less_2_contacts.txt','w')
stat_rfh=open('./'+fn.split('/')[-1]+'_2_contacts.stats.txt','w')
dfh.readline()
def foo(x, y):
return 0 if y == 0 else x / y
non_split_all=0
non_split_mapped_both=0
non_split_mapped_only=0
non_split_match=0... |
b5b85c5632bef60c10341868ea55f87ee059a30e1c841dbe4a5116256fc16809 | Python | 5,404 | 211 | # 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... |
149578de60e7574ef20563ad2de15fef4d5b272c7e87767a3c5e166fd9e63014 | Python | 5,405 | 99 | import os
import datetime
import argparse
import random
import numpy as np
import torch
import logging
import logging.config
class OptInit():
def __init__(self):
parser = argparse.ArgumentParser(description='PyTorch implementation of EV-GCN')
parser.add_argument('--train', default=1, type=int, help... |
9d7740f4a607d337dc044bf71f94a1e39c39836107b199f2e9a34aef1eef0651 | Python | 5,405 | 182 | # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/08_exp.ipynb.
# %% auto 0
__all__ = ['config_exp_logger', 'exp_log_filename', 'exp_param_filename', 'list_exps', 'gen_exp_name', 'load_exp_params',
'save_exp_params', 'setup_exp', 'is_config_subset', 'find_exps', 'test_exp']
# %% ../nbs/08_exp.ipynb 3
impo... |
c438d2b0f7dd88b6138cfc0e314aefc0a22697090f33818862a79825b9b49148 | Python | 5,405 | 167 | import subprocess
import time
import tomllib
from pathlib import Path
import numpy as np
import pytest
import serial # type: ignore
import torch
from elasticai.usbprotocol import UserRemoteControl, get_env5_port # type: ignore
from elasticai.creator.arithmetic import (
FxpArithmetic,
FxpParams,
)
from elast... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.