sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
001c506584a8518ca7e614920ec2fbd2ed8d5b10749074d30d51c3ddf36c40a1 | Python | 12,773 | 298 | '''
Description:
Author: voicebeer
Date: 2020-09-14 01:01:51
LastEditTime: 2021-03-10 07:46:38
'''
# standard
import models
import utils
import argparse
import torch
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import copy
import random
import time
import math
from torch.utils.tensorboard i... |
8d97739a71b5226c82f3a46a3d55be4e5d1e1873aab78c6bbf0a129a1e0a0821 | Python | 12,782 | 265 | import numpy as np
import torch
from torch.utils.data import DataLoader
from metric import *
from models import *
import csv
import random
from data import *
from evaluate import Tester
import argparse
import os
import sys
from libauc.losses import APLoss_SH, AUCMLoss
from libauc.optimizers import SOAP_ADAM, SOAP_SGD, ... |
710ef85b2e58033bd99cbc3a7ffc8cdb5f1f63a770d3c73afaaa5da6ccac9ba1 | Python | 12,793 | 371 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator
from openfl.experimental.workflow.runtime import LocalRuntime
from openfl.experimental.workflow.placement import aggregator, collaborator
import sys
imp... |
127bd9d2389beec1897007b994bf6bdfb38b501f6031dd4e9b5c14d0079be149 | Python | 12,795 | 262 | """The legacy export: a join and a pivot off the definitive tables.
Nothing here assembles anything. ``records`` and ``chains`` (:mod:`vdjdb.assemble.tables`) are the
database; this module projects them back into the three shapes ``vdjdb-web`` and standalone clients
have always read, and it is the only place that know... |
4e56e4d30c6c80b46ad6a0aa9af4828e896da3847132d4c219ede354352c8567 | Python | 12,801 | 369 | import pytest
import geomstats.backend as gs
from geomstats.geometry.matrices import Matrices
from geomstats.test.test_case import TestCase
from geomstats.test.vectorization import generate_vectorization_data
from geomstats.test_cases.geometry.base import MatrixVectorSpaceTestCase
from geomstats.test_cases.geometry.eu... |
de2e98eb536e41f46dff11f37e9cb0ee94cee855ac4f75fe5bd311e80eba3b31 | Python | 12,803 | 263 | import math
import numpy as np
from common.common import safe_make_dir
BEST_VALUE_INITIALISER = dict()
MONITOR_FUNCTION = dict()
for M in ["accuracy",
"au_roc",
"au_pr",
"pos_precision",
"macro_precision",
"micro_precision",
"pos_recall",
"macro... |
f306a321ea09b871f66f1a8c9257a79cbd1e72d5d64425a6fd0994ecfb5c86a3 | Python | 12,804 | 377 | import json
import os
import re
from django.contrib.auth.models import User
from rest_flex_fields import FlexFieldsModelSerializer
from rest_framework import serializers
from celsus.models import CellType, TissueType, ExperimentType, Instrument, Organism, OrganismPart, \
QuantificationMethod, Project, Author, Fil... |
d738f151292867552ac5b4b6dc679e8cf594a1b42ab30a28dcdf85c492ca9aad | Python | 12,807 | 297 | import pickle
import torch
import io
import numpy as np
import seaborn as sns
import pandas as pd
from collections import Counter
import matplotlib.pyplot as plt
from data.names import names
from sklearn.preprocessing import LabelBinarizer
from sklearn.metrics import auc, \
confusion_matrix, \
classification... |
31ab5d123fc2aa1612b8d422adecf59611ea88735353a03eac2d1e1f4d27495e | Python | 12,831 | 350 | """Shared helpers for DesignMatrix submodules.
These are internal utilities used by the facade and submodules — not part of the
public API.
"""
from __future__ import annotations
import functools
from copy import deepcopy
import re
from typing import TYPE_CHECKING
import polars as pl
from nltools.data.ownership im... |
f7df4094327974b3bbeedd1d8f26adfe0cfb68a72a7dd40714f03eb596c8200c | Python | 12,835 | 232 | """The spellings the model ``forward`` methods use for their outputs.
The sibling of ``calculator_keys``, for the other door. It exists because the
calculator is not the whole surface and never was: ``edge_forces`` and
``hessian`` are returned by every energy model and appear in no calculator's
``results`` at all, so ... |
c16f03f23d2f18c1b87f72cc46592859284b33f4fc242f73b69b324c89930e68 | Python | 12,836 | 285 | """The field registry against its three sources of truth.
``attic/BuildDatabase.groovy`` is parsed **at test time**, never copied: it is the one correct
specification for the metadata and for the header-from-metadata derivation, and a copy would drift
exactly the way the nine duplicated column lists did.
"""
from __fu... |
ea810fb9791bc7f7149de061d80d756364d53b54717aa85f699461f932f046f5 | Python | 12,841 | 345 | import argparse
import json
import os
import warnings
import numpy as np
from pydfc import data_loader, task_utils
# warnings.simplefilter("ignore")
################################# FUNCTIONS #################################
def run_roi_signal_extraction(
subj,
task,
bids_root,
fmriprep_root,
... |
3fc8f5930619f747c8ad779215ca32c68cb4294f9ea7d995667ac8e82306960a | Python | 12,842 | 305 | from openpyxl import load_workbook
import numpy as np
# import matplotlib.pyplot as plt
from safe_msmt.time_intervals import find_overlaps, find_overlaps_v2
def identify_classes_to_use(xlsx_filepath,
threshold,
verbose):
print("Reading the XLSX file.")
f... |
e2ebd511c3c4e721fca9a710901fb0bfd293613580c960189abb8d27f55edce3 | Python | 12,849 | 358 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Memory Stimulation and Phase-Amplitude Coupling
# Copyright 2021 Nikolaos Vardlakis & Nicolas P. Rougier
# Released under the BSD 3-clauses license
# -----------------------------------------... |
084c4130eeb70ab73fd0255683d4c1cf3f611c8c0430305e1601f30bfc2690ed | Python | 12,883 | 335 | import os
import sys
import time
import shutil
import zipfile
from glob import glob
from collections import defaultdict
from urllib.request import urlretrieve
import torch
import numpy as np
from PIL import Image
from tqdm import tqdm
class Davis(torch.utils.data.Dataset):
SUBSET_OPTIONS = ["train", "val", "test... |
8464dc8baa8811429ba8a34444e68e0017ec144d0559fcc9a0d9252ea6e2c56a | Python | 12,883 | 347 | from __future__ import annotations
import operator as op
import re
import string
import sys
from typing import Any
import more_itertools as itx
import pytest
from hypothesis import assume, given
from hypothesis import strategies as st
import snakebids.tests.strategies as sb_st
from snakebids.utils.containers import ... |
2bd8c1cdb838247ac5ca509e4d70cc3f4315684c4252eff8a857c623003812a7 | Python | 12,887 | 341 | import torch
import numpy as np
import pytorch_lightning as pl
from collections import defaultdict
from torch.nn import functional as F
from torch import nn
# Imports from this project
from multifidelity_gnn.src.reporting import get_metrics_qm7
from .schnet_high_fidelity import SchNet
class ShiftedSoftplus(torch.nn... |
34a2ee6b6a587b04b031ed0c9aacd7b77e92c83582d16d6b4dd4367d6df89128 | Python | 12,887 | 274 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... |
024a6deebaf85d3cd3d9e69c2d44791cb08ce4cb8aea9567007acb3aff04dfa8 | Python | 12,890 | 248 | import os
import re
import json
import itertools
import pickle
import numpy as np
from scipy.io import loadmat
from scipy.stats import gamma
import torch
from utils import set_random_seed, minmaxnorm
defined_acquisitions = ['ucb']
defined_algorithms = ['greedy', 'extensive', 'gpbo']
class Config(object):
def __... |
477b4bc1128f22c07c1ecb6cbf145aab935d3b069738937093df2dda9849aa88 | Python | 12,890 | 339 | # Copyright 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
This file contains the Setup class used on the server side for secure
aggregation setup.
"""
import json
import logging
import struct
from importlib import util
from openfl.utilities import TensorKey
# Check if pycryptodome is installe... |
27f886a21c94d3f4888c7ce341c3c2f7d0002ea43a7cdc8a004ecd3de711e97d | Python | 12,894 | 140 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
05791f41eb5a4f33ec6019594a0314a604e35eaff613ba89e5ba60f5ba5cff29 | Python | 12,897 | 240 | r"""
Python-Based Model Definitions
==============================
In this tutorial, you will learn how to implement a neurodynamic model with multiple
interconnected neural populations using Python only (i.e. without YAML definition files).
Throughout the tutorial, we will make use of the Jansen-Rit neural mass mode... |
15b598a57673d028fc7bc8db8634a9f6b948cd8254b5c781af5f31a949a0ff16 | Python | 12,898 | 240 | r"""
Python-Based Model Definitions
==============================
In this tutorial, you will learn how to implement a neurodynamic model with multiple
interconnected neural populations using Python only (i.e. without YAML definition files).
Throughout the tutorial, we will make use of the Jansen-Rit neural mass mode... |
b4168bd76f9c7d999217173453a230c17013418eaa6539fd64dd292b210e351f | Python | 12,902 | 351 | """
Unit tests for NERF conversion of internal coordinates to cartesian coordinates
"""
import os
import tempfile
import unittest
import numpy as np
import torch
from biotite.structure import dihedral
from foldingdiff import nerf
from foldingdiff import angles_and_coords as ac
from foldingdiff import tmalign
class... |
3d14a5a839401f1144ceda331d26a776daf5c522fc4bf549fe69c2851c6b7c80 | Python | 12,903 | 401 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from collections import Counter
from multiprocessing import Pool
import torch
from fairseq import utils
from fairseq.data import da... |
267aba8b21d385bface49f7f03c7622a839ca12b4cbbbe8e27c6c48fb9c88ab6 | Python | 12,913 | 361 | # -*- coding: utf-8 -*-
"""Provides utilities related to ODL."""
import warnings
import copy
from dival.util.odl_noise_random_state import (white_noise, uniform_noise,
poisson_noise,
salt_pepper_noise)
from odl import uniform_... |
793fa0d463f5467640c683c0d82cee672d4e42f2064f56fedddd07c34cebcba7 | Python | 12,925 | 309 | # -*- coding: utf-8 -*-
# OS stuff
import os
import sys
import warnings
from pathlib import Path
from tqdm import tqdm
# Computational stuff
import numpy as np
import matplotlib as mplb
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpecFromSubplotSpec
# TensorPAC
from tensorpac import Pac
from ... |
3e55155a7b6c3b41de8ef42267b88b1c93016477ec62d109e6bec4906ec736bc | Python | 12,937 | 329 | import os
import pandas as pd
import numpy as np
import gzip
from torchvision.datasets import VisionDataset
from scipy.io import wavfile
class AudioSet(VisionDataset):
def __init__(self, root, transform = None, target_transform = None, train=True):
super(AudioSet, self).__init__(root, transform=transform,... |
a243ccf93b4e897957f45c1886411e82f78bb608f421f99a13a8b6f616d6149d | Python | 12,985 | 378 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
ba64edfece5e5990a54febe8b77b358ada95ada9c76763c0099a2ad76f26a83d | Python | 12,990 | 303 | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as optim
import time
import numpy as np
from dig.auggraph.method.SMixup.model.GCN import GCN
from dig.auggraph.method.SMixup.model.GIN import GIN
from dig.auggraph.method.SMixup.model.GraphMatching import GraphMatching
from dig.auggr... |
4713543471c1a430b778e2c080426af145af21b3ba769205219110691fec589d | Python | 13,000 | 284 | import os
import torch
import pickle
import numpy as np
import os.path as osp
import tqdm
from torch_geometric.utils import dense_to_sparse
from torch_geometric.data import Data, InMemoryDataset, download_url, extract_zip
from torch_geometric.data.dataset import files_exist
import shutil
def read_ba2mot... |
18bf55dbd0e72c842c2eab78649e8d10e29ca0e79fbcf935af930779ee32547b | Python | 13,010 | 319 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
PATH_THIS_DIR = os.path.dirname(__file__)
PATH_RESOURCES = os.path.join(PATH_THIS_DIR, "..", "..", "resources")
import numpy as np
import tensorflow as tf
from sleeprnn.nn import layers
from sleepr... |
83e75e198797816acaa09c02de5cde05d521f40fc26b24a7772f816575b5a7f8 | Python | 13,012 | 356 | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "marimo",
# "nltools>=0.6.0",
# ]
# ///
# Multivariate prediction — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py.
import marimo
__generated_with = "0.24.0"
app = marimo.App(width="m... |
4a6a816453d19f7b0030c188940578abd520b62aac8fef9cd40908dd79dd8188 | Python | 13,023 | 337 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
46e87f0c0b0bf34a38a3dacb15ebfaee89688bffb6a266c3de6f6c8b6b5eebfa | Python | 13,034 | 365 | """Approved Adjacency shape, metadata, and ownership contracts."""
from copy import copy, deepcopy
import numpy as np
import polars as pl
import pytest
from nltools.data import Adjacency
@pytest.mark.parametrize("data", [None])
def test_empty_constructor(data):
adj = Adjacency(data)
assert (adj.shape, adj.... |
030095fbc4175b5a3a2d3d346f44a437799ce8a23df7d87b13e00a9b072ea565 | Python | 13,036 | 276 | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import confusion_matrix, classification_report
from sklearn import preprocessing, linear_model, model_selection, svm, tree, ensemble, neighbors
import pick... |
a4c36474df712be7b521b184149952667a8b889fd189bd604f2f70dfae6e1ed6 | Python | 13,036 | 345 | """ utils for the Izhikevic-network training task """
from SHIP import synapsegroup,neurongroup,TensorHauler
from SHIP.component_utils import get_alphas, quick_activator
from torch import (rand,
is_tensor,
tensor,
zeros,
cat,
... |
3785e6e85d28aa0182addfdd1978c3470feaa56483c03364cdd2ea29f7aaa112 | Python | 13,041 | 334 | import math
from pathlib import Path
from configparser import RawConfigParser
from PyQt5 import QtCore
from PyQt5.QtWidgets import (QMainWindow, QHeaderView,
QTableWidgetItem, QFileDialog)
try:
from .backends import _BackendVispy, _BackendPyQt5
except Exception:
from .backends impo... |
e7520be20f254083e96842b582d2a032c7aed39c469250466cf9b2847323fe5b | Python | 13,051 | 400 | #!/usr/bin/env python
"""
This module stores methods required for analysis of the MP Gold CyCIF data
Authors: Nhan Huynh & Veronika Pister
"""
import math
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import cv2
import tifffile as tiff
from skimage import io, filters, ex... |
5a2f5f80857e07205defceb6bdc561ae6b79138ce0e71d2ca593b1a8c2c8b339 | Python | 13,056 | 301 | '''
Description:
Author: voicebeer
Date: 2020-09-14 01:01:51
LastEditTime: 2021-03-03 08:39:41
'''
# standard
import models
import utils
import argparse
import torch
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import copy
import random
import time
import math
from torch.utils.tensorboard i... |
e279a5e3a0e31d88efd50b356a527fb2ea5c41b24b4368bd2ee744d34fd7d315 | Python | 13,059 | 323 | """Contract tests for `BrainData.resample`, `BrainData.apply_mask`, and the
row-metadata policy that both share.
The spec sections under test are "Spatial transformations" and "Row metadata"
in `development/specs/braindata.md`.
"""
import nibabel as nib
import numpy as np
import polars as pl
import pytest
from nilear... |
5c76d922758fd2a9f92011511d710c923bf601c65b35c98568a90181973777e4 | Python | 13,064 | 344 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
5fda873351a03b5748920c6cce22b2085865f84b5878c4080aa69e84568e0ffb | Python | 13,077 | 363 | """Adjacency matrix visualization — label distance and silhouette."""
import matplotlib.pyplot as plt
import numpy as np
import polars as pl
import seaborn as sns
from nltools.algorithms.inference import (
one_sample_permutation_test,
two_sample_permutation_test,
)
def _polars_to_pandas(df):
"""Convert ... |
92db25b8c5835c7dc7106c9ba3764b8dfac7a7aa3093625dc7841a5b29bdd94c | Python | 13,078 | 306 | import tensorflow.keras.backend as K
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Conv2D, PReLU, UpSampling2D, concatenate , Reshape, Dense, Permute, MaxPool2D
from tensorflow.keras.layers import GlobalAveragePooling2D, Activation, add, GaussianNoise, BatchNormalization, multiply
from t... |
cdaff14aecef2e0c6a3045bc1ed95da8401b4a1eb53a88c26656d5240757384c | Python | 13,080 | 381 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
e5fb3bdc581fe0ac9806ab0395886bf7e7c53409c402bdb9c98be7b70fe617e3 | Python | 13,084 | 359 | """Persistent preferences for the SanPy desktop interface."""
import os
import pathlib
import json
from json.decoder import JSONDecodeError
import sanpy
import sanpy.interface
# import sanpy.interface.sanpy_app as sanpy_app
from sanpy.sanpyLogger import get_logger
logger = get_logger(__name__)
def _normalize_hidd... |
a8c193e1dcd8f91c7154c38b9b0b483df91788552d4cdb5ea0a8c4c6962f112d | Python | 13,091 | 312 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import math
def get_e2e_autoencoder(cfg):
# initialize encoder and decoder
encoder = E2E_Encoder(in_channels=cfg['in_channels'],
n_electrodes=cfg['n_electrodes'],
out_scali... |
6f581f7518f5ee661b9c98e4d4b3a9c6985b93bb22ebe39896113b0903fbcc1b | Python | 13,092 | 366 | """Launcher window for opening recent or new SanPy recordings."""
import os
from functools import partial
from typing import List
from qtpy import QtCore, QtWidgets, QtGui
import qtawesome as qta
import sanpy
# from sanpy.interface.plugins import myStatListWidget
from sanpy.sanpyLogger import get_logger
logger = g... |
3b668ce57c70687155767388979780f675d7dbec7f4d7deef7f98d5e94ce68fb | Python | 13,094 | 363 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""AggregatorGRPCServer module."""
import logging
from random import random
from time import sleep
import grpc
from openfl.protocols import aggregator_pb2, aggregator_pb2_grpc, utils
from openfl.transport.grpc.common import create_grpc_s... |
9b3b2361c6ae88d62a993ebf09e3d269f37df69e7ed90a482765c76ece41f841 | Python | 13,094 | 348 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
9b3757bf3decd0915fd60ec3ae4a1fa96a0932f425a1eb7fed4650ea86ed795e | Python | 13,095 | 351 | # Authors: Nick Tolley <nicholas_tolley@brown.edu>
# Christopher Bailey <cjb@cfin.au.dk>
from copy import deepcopy
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
import pytest
from hnn_core import simulate_dipole
from hnn_core.extracellular import (
ExtracellularArray,
... |
7cd552750a884bd2cc79d38d84bac557729d73ee332e7b969975754c6cc9be3b | Python | 13,105 | 283 | import argparse
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib as mpl
from types import SimpleNamespace
import sys
from pathlib import Path
sys.path.append(str(Path.cwd().parent))
from plotting_utils import filter_velocity_local, load_df
from plotting_utils import df_dtypes,... |
05eb393e128dc629a976bd2bf19e46289bd0f55c9d6b0cd3b6b774e004c6cfcf | Python | 13,114 | 352 | #================================================================================
#= Import
#================================================================================
import os
import time
tic = time.perf_counter()
from os.path import join
import sys
import zipfile
import matplotlib
import matplotlib.pyplot as p... |
ae83ecde060d45347669177937b057440c9144bd32abe8c6dd9501ee68a331a9 | Python | 13,122 | 388 | import torch
from torch.autograd import Variable
import torch.nn.functional as F
from torch.utils import data
from torch.utils.data import SequentialSampler
from torch import nn
from tqdm import tqdm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from time import time
from sklearn.metrics impo... |
00063b725137c5086e2997c76e1cddd3d3673c8d642aa9113c44f71745bce46d | Python | 13,127 | 289 | '''
Description:
Author: voicebeer
Date: 2020-12-10 08:47:27
LastEditTime: 2020-12-16 05:14:33
'''
# standard
import torch
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import copy
import random
import time
import math
from torch.utils.tensorboard import SummaryWriter
#
import utils
import... |
e6735ceff6d1fceb315fcee3e91bed11004bb7cdf794e5226a94d18097c20fb2 | Python | 13,129 | 433 | import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
import itertools
# number of available gpu
ngpu = 1
batch_size = 4
###################################################
## Loading the data
dataRoot = "../../data"
# labelFiles = "labels... |
5000c001e3ec90dcdca315b5f28601f7fec0d59e871669ec2a17c22dcbbae698 | Python | 13,143 | 300 | #!/usr/bin/python3
###
# Master controller for the TreeMaze. It communicates with the arduino through serial port.
# Receives data through GPIO inputs and serial.
###
import threading
from MazeHeader_PyCMD import *
PythonControlSet = ['T2','T3a','T3b','T3c','T3d','T3e','T3f','T3g','T3h','T3i','T3j',
... |
f8e997872402f909d3b7b84529b26edd7e56abd1d11987fcdc4f2d20a1a7bc1e | Python | 13,153 | 352 | import os
import pickle
import numpy as np
import pyedflib
from sleeprnn.common import checks, constants
from sleeprnn.data.inta_ss import IntaSS
from sleeprnn.data.mass_kc import MassKC
from sleeprnn.data.mass_ss import MassSS
from sleeprnn.data.moda_ss import ModaSS
from sleeprnn.data.cap_ss import CapSS
from sleep... |
40b6d63f645d4b383ec0ca0acf8ee550b8e56d809f8a0fbf59a7b4ddfc45fa0d | Python | 13,164 | 267 | #########################################################################
# SlumberNet: Sleep Stage Classification using Residual Neural Networks #
#########################################################################
# This Python script implements SlumberNet, a deep learning model for classifying
# sleep stages ... |
e246901baefccbb0d6b70954df55c92eeffe9b7e6e1786c228fa95a00160f412 | Python | 13,166 | 387 | import os
import torch
import argparse
import numpy as np
import matplotlib.pyplot as plt
from torchvision import transforms
from tqdm import tqdm
from time import time as t
from bindsnet.datasets import MNIST
from bindsnet.encoding import PoissonEncoder, poisson
from bindsnet.models import IncreasingInhibitionNetwo... |
60e84f08bdb1513f7b5d43596592e191302d1c4007b4ae5c1716b79370395433 | Python | 13,177 | 310 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
"""Train a network."""
import torch
from ._workflow_utils import set_workflow_state
from nequip.utils import get_current_code_versions, RankedLogger
from nequip.utils.global_state import set_global_st... |
0feb0fbd14c5783bde554ea2ee689979600c500d548b820d739fc5e7801925d0 | Python | 13,179 | 354 | #================================================================================
#= Import
#================================================================================
import os
import time
tic = time.perf_counter()
from os.path import join
import sys
import zipfile
import matplotlib
import matplotlib.pyplot as p... |
5b419024d3d746c970674e3c2b757afdebc79b403fd71f8a6ca1059194f5a608 | Python | 13,185 | 329 | """Coefficient back-projection for MVPA decoding pipelines.
A decoding pipeline preprocesses voxels before it fits, so the coefficients it
learns live on the preprocessed feature axis, not on the voxel axis a brain map
needs. These functions walk a *fitted* scikit-learn estimator or `Pipeline`
backwards and return coe... |
17b67761b04cb6e29d877ea5e86f6aaf39dcce719e9193b2f26312215ca2da56 | Python | 13,189 | 338 | #based on https://github.com/AustinDoolittle/Pytorch-Gain
import torch
import torch.nn.functional as F
import numpy as np
import os
import re
import io
import json
import math
import cv2
from collections import OrderedDict
from typing import Dict, Callable
import copy
def scalar(tensor):
return tensor.data.cpu().... |
26784520f4163e8c2d69e9cae436f02f060340868f6913a935b846ab3c862cf2 | Python | 13,191 | 326 | """The LAMMPS export produces the committed numbers. Contract tier, no binary.
``mace_create_lammps_model`` turns a checkpoint into the artefact a LAMMPS
pair style loads. The plain TorchScript format is on its way out, but what
replaces it has to produce the same physics, so the numbers are frozen here
and the replac... |
8c4208e95a8f4527021acf5ce200a76f4b449e842dd4d66208246f880a5e843c | Python | 13,205 | 387 | #cript containing the modular version of the code
# so far we have only implemented the non_linear_embedding layer
# for simplicity we can just use dense layers for the merge operations
import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
im... |
cc2df85469b52698316fe8f9c124e46014b94123b5a2047f83b9f1f165f9e583 | Python | 13,213 | 293 | import logging
import pyfizi
import numpy as np
import pandas as pd
__all__ = ['create_output', 'impute_gwas']
def create_output(obs_snps, imp_snps=None, gwas_n=None, impZs=None, r2blup=None, pvals=None, start=None, stop=None):
"""
Create an output pandas.DataFrame containing the original GWAS results and ... |
84ff2897fd30b45cb20d1124a1a2667727db9d25d884ce37093bad2ed0ce9c7a | Python | 13,216 | 402 | from torch_cluster import radius_graph
from torch_geometric.nn import GraphConv, GraphNorm
from torch_geometric.nn import inits
from .features import angle_emb, torsion_emb
from torch_scatter import scatter, scatter_min
from torch.nn import Embedding
import torch
from torch import nn
from torch import Tensor
import... |
7ff4116b43dc620a54cf8a47f21b0b5563e0ee2d3d6da25000ec929f1ea7e4d3 | Python | 13,218 | 329 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""REST server tests module."""
import pytest
import ssl
from unittest import mock
from cryptography import x509
from cryptography.x509.oid import NameOID
from cryptography.hazmat.primitives import hashes, serialization
from cr... |
9c02d56d76704d58cc0a3637c89cb07b75c3fdb9abcde140f91859f56ce50d1b | Python | 13,232 | 378 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""PyTorch FedProx optimizer module."""
import math
import torch
from torch.optim import Optimizer
from torch.optim.optimizer import required
class FedProxOptimizer(Optimizer):
"""FedProx optimizer.
Implements the FedProx optim... |
63d10f9876944e4504b2d46e84e11317d3de8fede460fe3fb6004040f7aeaa6e | Python | 13,238 | 359 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import namedtuple
import numpy as np
import torch
from fairseq import utils
DecoderOut = namedtuple(
"IterativeRefinem... |
7b29c9b6d07237c452c029b4cc0d15b3cbdd8b990a399d19428fef60e7462915 | Python | 13,242 | 305 | import os, torch, json, ast, glob
import os.path as osp
import ssl
from itertools import repeat
import numpy as np
from rdkit import Chem
from six.moves import urllib
from torch_geometric.data import Data, InMemoryDataset, download_url
from features import atom_to_feature_vector, bond_to_feature_vector
from tqdm import... |
7c7201956c03bc739c77176a1bab802fec609a5375dba4bb3e98d6f21dce8ec5 | Python | 13,245 | 324 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from copy import deepcopy
import warnings
import numpy as np
import torch
import ase
import ase.geometry
from ase.calculators.singlepoint import SinglePointCalculator, SinglePointDFTCalculator
from ase... |
0ae25156bd0d11266af5510fe8221c40043ae12f8e673ec2421faa4e1f16fede | Python | 13,278 | 380 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import click
import numpy as np
import torch
from fvcore.nn import FlopCountAnalysis
from fairseq.models.transformer import Transf... |
a5cca92b936ce0f6ff8fefdb643c86e6456c2da09304e87050454349dcb6e78a | Python | 13,280 | 319 | import numpy as np
import torch
import torch.nn as nn
from .rgcn import *
from .st_net import *
class MaskedGraphAF(nn.Module):
def __init__(self, mask_node, mask_edge, index_select_edge, st_type='sigmoid', num_flow_layer=12, graph_size=38,
num_node_type=9, num_edge_type=4, use_bn=True, num_rgcn... |
139cf325fe3c834a5173787225bf80123f79f975b165f3eea83c4368c38f1194 | Python | 13,289 | 365 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
2716f7bedb2430e654457f85d90f34403782d4668bb2dc228ed15d0e0b2df0eb | Python | 13,305 | 326 | """
NeuroLearn Analysis Tools
=========================
These tools provide the ability to quickly run
machine-learning analyses on imaging data
"""
__all__ = ["Roc"]
__author__ = ["Luke Chang"]
__license__ = "MIT"
import pandas as pd
import numpy as np
from nltools.plotting import roc_plot
from scipy... |
1d3a2f66eca9f73b448c13c6d957cfe20d9ba715444fa02bc16b4beffde8e095 | Python | 13,311 | 365 | # Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
3bca835c008508a5b96930afe56d0b3afc2abea0e0d4193bda735ccb975f576a | Python | 13,328 | 358 | import copy
import numpy as np
from ..utils import elements
from typing import Iterable, Tuple
from typing_extensions import Self
class Atom:
"""
A class representing an atom with a position, element and a charge.
Arguments:
xyz: The xyz position of the atom.
element: The element of th... |
f0202c7ca11483d61c798b9596634c9a58c1c7e279b1999fe11ba13b9184c799 | Python | 13,332 | 390 | # Script containing the modular version of the code
# so far we have only implemented the non_linear_embedding layer
# for simplicity we can just use dense layers for the merge operations
import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
... |
7f7d7500f84c9722b3be5a079c64fca538c2a58d5775f2c62bab77164ffcdf16 | Python | 13,339 | 375 | import numpy as np
import jax
from jax.random import bernoulli, split
from jax.nn import sigmoid
import jax.numpy as jnp
import collections
import scipy.io as sio
import os
from functools import partial
import logging
from typing import Any, Dict, Tuple
import plasticity.model as model
import plasticity.inputs as inpu... |
8df315bc702bc0f5b988b7852e72a9d2ef36688eef6fbd0399d3361e0509afd9 | Python | 13,348 | 250 | """
Design Matrix
=============
This tutorial illustrates how to use the Design_Matrix class to flexibly create
design matrices that can then be used with the Brain_Data class to perform
univariate regression.
Design Matrices can be thought of as "enhanced" pandas dataframes; they can do
everything a pandas dataframe... |
844ee9b9bf75703cf83784e2bb1ed8a5598de2b9686890e454b9d974bb17cea9 | Python | 13,358 | 382 | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "marimo",
# "nltools>=0.6.0",
# ]
# ///
# Functional alignment — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py.
import marimo
__generated_with = "0.24.0"
app = marimo.App(width="medi... |
f9020b039a2af45976bae5ece8e718a1ed5c6712fbdcacb6b87360feff34043b | Python | 13,358 | 383 | #!/usr/bin/env python
from argschema import ArgSchema
from argschema.schemas import DefaultSchema
from argschema.fields import (
String, Int, Boolean, Nested, Float,
List, InputFile, OutputFile)
import marshmallow as mm
import numpy as np
class db_params(DefaultSchema):
owner = String(
de... |
32bc69ba561b680ee30f055b754ee366601273421b87c8a772a99209e7cfd2e1 | Python | 13,363 | 422 | """Euclidean space."""
import math
import geomstats.backend as gs
from geomstats.geometry.base import VectorSpace
from geomstats.geometry.riemannian_metric import RiemannianMetric
from geomstats.vectorization import check_is_batch, repeat_out
class Euclidean(VectorSpace):
"""Class for Euclidean spaces.
By ... |
2a8c6eab00c3ac2d03896970ef13c68bf5b0ce454d756dfa04f7211b22fcb0be | Python | 13,371 | 333 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import re
from dataclasses import dataclass, field, fields
from typing import List, Optional
from omegaconf import II
from fairseq import u... |
e4fa27f4328dce51e5272a4167c12cf3a61c1735d016920423ac019ddc52bbca | Python | 13,378 | 376 | """N-fold product manifold.
Lead author: Nicolas Guigui, John Harvey.
"""
import geomstats.backend as gs
import geomstats.errors
from geomstats.geometry.manifold import Manifold
from geomstats.geometry.riemannian_metric import RiemannianMetric
from geomstats.vectorization import get_batch_shape
class NFoldManifold(... |
979984447a8ce3321b276e1df41c71c3b7fe7df8cd56a53a93de1a9b4ca5887f | Python | 13,391 | 368 | # Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
7379de5991e187d61f80c49963e092692ff612cdd90c1395ed3082e9fe75d80a | Python | 13,392 | 380 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
b38b18dee496e5d2eb378d569b5f8b3084655108d1b26d162d3dbc9e3bdec07f | Python | 13,393 | 337 | import threading
import time
from typing import Any, Callable, Dict, List, Optional, cast
from kubernetes import client, config, watch
from kubernetes.client.rest import ApiException
from overrides import EnforceOverrides, override
from chromadb.config import RoutingMode, System
from chromadb.segment.distributed import... |
26f77e455c233cfe1739d63f8c9d2cb48e704e14a1f5f5b521d93d62a0b0d97e | Python | 13,396 | 396 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
e872bef90447263e5752e186465f763080f486ab32575c557bccb510e038f3a7 | Python | 13,408 | 372 | # Authors: Abdul Samad Siddiqui <abdulsamadsid1@gmail.com>
# Nick Tolley <nicholas_tolley@brown.edu>
# Ryan Thorpe <ryan_thorpe@brown.edu>
# Mainak Jas <mjas@mgh.harvard.edu>
import os
from pathlib import Path
import time
import pytest
import numpy as np
import hnn_core
from hnn_core.batch_... |
4b5758f9e37b04c6a9edfa3decc46a237b672e71793ca9771f220d3296316bfe | Python | 13,416 | 428 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
393f1dc616d11b79ba383d814a5f20f3d651e3b5df885368c7c1088a8b5c8291 | Python | 13,421 | 354 | # blocked_exp_conds.py - Code to fit a HDDM with fixed start point from a blocked condition experiment using JAGS in Python 3
#
# Copyright (C) 2021 Michael D. Nunez, <m.d.nunez@uva.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... |
a56347a6ccb4479563fc04e5fbb24ac30318149762eeb29fc0e29a50c7b06fb4 | Python | 13,426 | 373 | import torch
from pymonntorch.NetworkCore.TaggableObject import *
class NetworkObject(TaggableObject):
"""This is the base class for all network objects.
This class is used to treat network objects' behaviors and is a subclass of TaggableObject.
Attributes:
network (Network): The parent network... |
494d876737054ab2f50919dd1e2b59e933c6fd9c0559270e6a6844d76b86dfd5 | Python | 13,432 | 266 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.widgets import Slider, Button
from matplotlib.collections import LineCollection
from matplotlib import cm, colors
##############################################################
#... |
e18b852e72eca1c421fc3c4eec011780a13acd48b7617149034ff691959b74ac | Python | 13,433 | 304 | #!/usr/bin/env python3
# Sniffles2
# A fast structural variant caller for long-read sequencing data
#
# Created: 18.06.2025
# Author: Luis Paulin
# Maintainer: Hermann Romanek
# Contact: sniffles@romanek.at
#
from pysam import AlignmentFile as Bam
from pysam import FastaFile as Fasta
from pathlib import P... |
72de3238dc9eb961e70d69d2b398011c6d28c6732c0325c7dc4efd4e31f3810f | Python | 13,435 | 360 | """
FileName: metrics.py
Description:
Time: 2021/2/22 14:00
Project: DIG
Author: Shurui Gui
"""
import torch
import torch.nn as nn
from typing import List, Union
from torch import Tensor
import numpy as np
from torch_geometric.data.data import Data
from torch_geometric.nn import MessagePassing
def control_sparsity... |
e82e6d531254287b1f4bc60f0459e15820534c8e87fe08d9c4a10b0a4603458e | Python | 13,443 | 296 | """The chunk reader and the vectorised row rules."""
from __future__ import annotations
from pathlib import Path
import polars as pl
import pytest
from vdjdb.config import Paths
from vdjdb.io.chunks import (
PROVENANCE,
READABLE,
chunk_files,
dedup,
independently_reported,
read_chunk,
rea... |
cb4331743d92f7922e0238f968a9c0781330da8fabf8c1b71c731ab48e4e7ce1 | Python | 13,479 | 360 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.workflow.interface.flspec module."""
from __future__ import annotations
import inspect
from copy import deepcopy
from typing import TYPE_CHECKING, Callable, List, Type, Union
if TYPE_CHECKING:
from openfl.exper... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.