sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7fe0982ff097eb6d3bd65e2ae541c5d4a1bde16b0c4ba0a7014136c2290a4273
Python
5,991
158
from typing import Dict, List, Mapping, Optional, Sequence, Union, Any from typing_extensions import Literal, Final from dataclasses import dataclass import numpy as np from numpy.typing import NDArray # Type tag constants TYPE_KEY: Final[str] = "#type" SPARSE_VECTOR_TYPE_VALUE: Final[str] = "sparse_vector" @datacla...
d35311fe4aff85a1194f13da5e812e13cc1556c30f050fb9526002c42a0d99a2
Python
5,994
182
import os import random import numpy as np from tqdm import tqdm import torch from torchvision import transforms from skimage.metrics import ( mean_squared_error, structural_similarity, peak_signal_noise_ratio ) from pytorch_radon import Radon, IRadon from pytorch_radon.filters import LearnableFilter f...
a1b095b48d05ff9a79a007188e608ef6cc9ca4302a454ec6303e51234054c2be
Python
5,997
168
# -*- coding: utf-8 -*- # /usr/bin/env python3 # # This software and supporting documentation are distributed by # Institut Federatif de Recherche 49 # CEA/NeuroSpin, Batiment 145, # 91191 Gif-sur-Yvette cedex # France # # This software is governed by the CeCILL license version 2 under # French law...
4d0803f282ba74b18eda881a6bc809c8daa5c44399a337ca341b4178312bede2
Python
5,998
203
""" Serial-MQTT Bridge. author: Tal Eisenberg <eisental@gmail.com> Run `python main.py --help` for more information. """ import importlib import json import logging import sys import subprocess import argparse import platform import traceback from serial.tools import list_ports from serial_mqtt import SerialMQTTBridg...
3e980725b05b4e51759724bdddf4ab6c4c1a710819b0e1eebe31fc387729eae5
Python
6,001
136
import os import pyedflib import numpy as np from sleeprnn.data import utils PATH_REC = "register" PATH_MARKS = os.path.join("label", "spindle") PATH_STATES = os.path.join("label", "state") KEY_FILE_EEG = "file_eeg" KEY_FILE_STATES = "file_states" KEY_FILE_MARKS = "file_marks" IDS_INVALID = [4, 8, 15, 16] IDS_TEST = ...
7963a568a1d698acda2f24ef104351e1fcb4c681c4c21145d407930213242567
Python
6,003
144
import time from watchdog.observers import Observer from watchdog.events import PatternMatchingEventHandler import nibabel as nib from monai.inferers import SlidingWindowInferer from unest_base_patch_4 import UNesT import shutil import nibabel.processing as nip import numpy as np import torch import monai.transforms as...
32361446e504c66644e3d0f9dc44b45bc5ed6ee7357cc75fad48be39abfb6af3
Python
6,007
116
import tensorflow as tf def process_metadata(name_to_metadata): for variable_name in name_to_metadata.keys(): numpy_shape = name_to_metadata[variable_name]["numpy_shape"] variable_type = name_to_metadata[variable_name]["variable_type"] if variable_type == "x": tfrecords_type =...
849d7e707633c902644a9bad4b2543dc74c019bf3b07ff6bec964a498224d014
Python
6,007
195
""" Base class for sound delivery. @author: Mathieu Scheltienne """ from abc import ABC, abstractmethod import numpy as np import sounddevice as sd from scipy.io import wavfile from ... import logger class _Sound(ABC): """ Base audio stimulus class. Parameters ---------- volume : list | int | ...
3a51921c07405efec7894035e38400c308bda84f1a3bab7d5d73f271cd2474a3
Python
6,010
152
from __future__ import absolute_import from __future__ import division from __future__ import print_function from joblib import delayed, Parallel import numpy as np from sleeprnn.common import checks, constants, pkeys from sleeprnn.data.stamp_correction import filter_duration_stamps from sleeprnn.data.stamp_correcti...
e86c2882ac2452dab85e1b587e8d9b9dc5f960a872e54c38448765770503134a
Python
6,011
117
import numpy as np import high_lvl_build_network_funcs as bnf if __name__ == "__main__": NET_TYPE_VAR_INP = input('WHICH_DATASET_TO_GENERATE_NETWORK_FOR? [TYPE M FOR MNIST/ N FOR NMNIST]: ') NET_TYPE_VAR = str(NET_TYPE_VAR_INP) NET_NUM_VAR_INP = input('NETWORK_NUMBER_TO_CREATE? [int]: ') ...
7e41cf46933abd6028f03cf6d8b41a03d891bf3dbd137256fd79898a6782fed9
Python
6,013
167
"Identification of individual fragments given the predictions generated by the idCNN" import json import logging from collections.abc import Sequence from pathlib import Path import numpy as np import torch from idtrackerai import Fragment, ListOfFragments from idtrackerai.utils import track from ..network import I...
1c9a8fdac2feff9a411b524e1948a70aedff8e8eeeba6c56e9b7afeb8bf61d15
Python
6,014
208
import copy import inspect import itertools from geomstats.vectorization import repeat_point KNOWN_POINT_NAMES = ( "point", "base_point", "point_a", "point_b", "fiber_point", "mat", ) KNOWN_VECTOR_NAMES = ( "vec", "vector", "tangent_vec", "tangent_vec_a", "tangent_vec_b", ...
8794c23c6612e4b0831d4bbdff5de0603ec3fa7540e9206986cfb07ea82eb9ff
Python
6,014
176
import pytest import geomstats.backend as gs from geomstats.numerics.finite_differences import forward_difference from geomstats.test.random import get_random_times from geomstats.test.vectorization import generate_vectorization_data from geomstats.test_cases.geometry.fiber_bundle import FiberBundleTestCase from geoms...
49a194e2d2ea7e7bd03ed616974493472bcaf129afb6c20df1e81030bb948c4b
Python
6,018
159
from typing import List, Tuple import torch from torch import nn as tnn from reinvent.models import meta_data from reinvent.models.linkinvent.model_vocabulary.paired_model_vocabulary import ( PairedModelVocabulary, ) from reinvent.models.linkinvent.networks import EncoderDecoder from reinvent.models.model_mode_en...
ac1bf5224d4806110e7e610f1a44a6869c2768fcb11f516c211c4b5ccf0afa49
Python
6,019
192
import sys import multiprocessing as mp from neurodecode import logger from neurodecode.utils.timer import Timer from neurodecode.triggers import Trigger, TriggerDef from neurodecode.gui.streams import redirect_stdout_to_queue import neurodecode.utils.io as io def check_config(cfg): ''' Check the variables c...
d617bceedee9fd14ffe826f7bb4ac9ff740c2a2e57885bdabb6311daff49112b
Python
6,020
154
# 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...
90f4570e77003ceb29ef145f2192ad039eb423e828ac873684efbff64ddb3f9d
Python
6,021
158
import tensorflow as tf from tensorflow import keras as k tf.config.list_physical_devices() import os os.environ['CONDA_DLL_SEARCH_MODIFICATION_ENABLE'] = '1' # needed due to dll bug in my environment - might be unnecessary for other ppl from survival_model import SurvivalModel import numpy as np import pandas as pd f...
e040032826b37c76efa294159814c144ca66144560f495e6d1916d6ca048e819
Python
6,021
177
from pathlib import Path import ase.io import numpy as np import pytest from tests.helpers import REPO_ROOT import yaml from ase.atoms import Atoms from tests.helpers import preprocess_data, run_mace_train pytest_mace_dir = REPO_ROOT # NOTE: this file keeps its own sample_configs fixture (only 10 rattled # configs...
e20b84a671463b2b0b13c591c382464f608013acde05ac24803448eb8529daf4
Python
6,021
187
import asyncio import os from functools import wraps from enum import Enum from typing import Any, Callable, Dict, Optional, Sequence, Union, TypeVar from opentelemetry import trace from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk....
4e93d0dfe0f00923da63ec112afed2b9b18b63f1c479962b5b25224c08b91743
Python
6,022
141
from __future__ import absolute_import, division, print_function import argparse import os import time import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from tqdm import tqdm from data.data_loader import TrainDataset,TestDataset from models.models import Brainmodels ...
b37e0c41cc3123a607fc003e78a077c625c0c0fa9e3c17bd85484dced8617a07
Python
6,022
143
# Copyright 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Federated Bootstrap Aggregation for XGBoost module.""" import json import numpy as np from openfl.interface.aggregation_functions.core import AggregationFunction def get_global_model(iterator, target_round): """ Retrieves the glo...
374be4802c7c2da6675ca7a998e5095d308fe354e6a92a6f982808b38c507b75
Python
6,025
164
import os import shutil import tarfile from typing import Optional, Sequence, Union, Dict import config import numpy as np import torch from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap from torchvision.transforms.transforms import Compose, Normalize class ImgAndTargetPlotter: def...
f0195ac6bfdf2e750805c88aa1572f1b7bca53daa04ed5e2258f13c6a7e0be07
Python
6,026
186
from __future__ import annotations import argparse import re import sys from argparse import ArgumentParser, Namespace from pathlib import Path import more_itertools as itx import pytest from hypothesis import given from hypothesis import strategies as st from pathvalidate import Platform, is_valid_filename from pyte...
3ac669c0f6e18fa744546ac48f9819394f0043f7266e6a4d069b3dd4f03e1528
Python
6,033
212
import numpy as np from sleeprnn.helpers import misc from sleeprnn.common import constants def print_available_ckpt(optimal_thr_for_ckpt_dict, filter_dates, file=None): if filter_dates[0] is None: filter_dates[0] = -1 if filter_dates[1] is None: filter_dates[1] = 1e12 print("Available ckp...
f98370d396b4d31da03a7718a5a753437e9f5e93c9696eb47195a56a17a59212
Python
6,033
159
""" Do the tail approximations do what they are for? The point of both fits is to resolve a p-value that counting cannot reach, so the question is never "is the fit exact" -- extrapolating a tail from a hundred points cannot be -- but "does it beat what it replaces". Both checks below therefore build a large reference...
49dafe42705d2ec3c2235c55f44cd07ef9aed22bff8734b32bbdbef6aa31ddfa
Python
6,034
146
""" The GOOD-HIV dataset adapted from `MoleculeNet <https://pubs.rsc.org/en/content/articlehtml/2018/sc/c7sc02664a>`_. """ import os import os.path as osp import gdown import torch from munch import Munch from torch_geometric.data import InMemoryDataset, extract_zip class GOODHIV(InMemoryDataset): r""" The G...
5e60b787d56c36c1826d5d925947ef5af1f666d8385b94d60273004c11152599
Python
6,034
130
"""The interactive dashboard: that it is built from the verified data and that it is one file.""" from __future__ import annotations import sys from pathlib import Path import polars as pl import pytest pytest.importorskip("plotly", reason="needs the `summary` extra") sys.path.insert(0, "summary") from vdjdb.summar...
237f7d4744f4589ea1783de389b2b7a1750bbae76fb22255a24781fc9b78ef9a
Python
6,037
163
from typing import Any, Dict, Mapping, Optional, TypeVar from urllib.parse import quote, urlparse, urlunparse import logging import orjson as json import httpx import chromadb.errors as errors from chromadb.config import Component, Settings, System logger = logging.getLogger(__name__) # inherits from Component so t...
fab3b6346711515f9a9e9739895e763be417daad3740f99557823e8f8b1f8e70
Python
6,037
173
"""Generates moda_preprocessed_segments.npz (~160 MB) and metadata.csv (~50 kB). The file is a pre-processed (cropped and filtered) MODA dataset that includes only the annotated portions. Before running this script, run generate_moda_npz_files.py because it uses the files generated by that script. The generated file ...
1af3de7404f47a8d940fc44f38f012de8041df437d1bea0f55776f128bebd36f
Python
6,046
187
import json import pandas as pd # Path to the Bandit JSON report json_report_path = 'bandit_results.json' html_report_path = 'results.html' def read_json_report(json_report_path): """ Read the JSON report from the specified path. Args: json_report_path (str): Path to the JSON report file. Re...
093bb07156af68a4488556e6e4daa7e9f115e7eb51a43172f190be37f4da893b
Python
6,049
199
import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn from torch.optim.lr_scheduler import StepLR,MultiStepLR import math import torch.nn.functional as F from torch.utils import data from sklearn.model_selection import train_test_split from torch.utils.data import Dataset from preproces...
ef57148fa58a9c0d7fd70f1f93231084f14cd45085cd0562e9a12662334dfe7d
Python
6,050
196
import pandas as pd from scipy.io import loadmat import numpy as np import matplotlib.pyplot as plt import xml.etree.ElementTree as ET import re from pyimzml.ImzMLWriter import ImzMLWriter from pyImagingMSpec.inMemoryIMS import inMemoryIMS import os def loadBrukerFIDs(file_path, fid_length, read_length, fi...
02f53b3cb9fd2adaabede54616aed7fb6c7d96e062113f5b30ab0606d47cd3bb
Python
6,052
213
import collections import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import predictive_coding as pc import analysis_utils as au def plot(df, plot="Reward"): df = au.nature_pre(df) groups = ['Env', 'Rule', 'pc_learning_rate'] df = au.add_metric_per_gr...
cf83600759c297648677807cc240b2e80c1d62df1b3ecf767c32977ef521c52e
Python
6,053
157
""" Created on Sat September 16 21:15:06 2023 Description: Implementation of different shuffling methods of neural datasets for Paper url: https://www.biorxiv.org/content/10.1101/2023.09.11.557230v2 @author: Ekaterina Kuzmina, ekaterina.kuzmina@skoltech.ru @author: Dmitrii Kriukov, dmitrii.kriukov@skoltech.ru """ im...
14ee92273c34263394117d6a2dba38b53a4006674d4174dae7966b9df1a2aa54
Python
6,054
110
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " import numpy as np from neo.core import SpikeTrain, AnalogSignal from quantities import m...
66bd454261c372afc4fc954dca47888fa34515d4d84ac79055805ad9d8e0b1f4
Python
6,056
126
import os import pandas as pd import warnings import torch from torch.utils.data import DataLoader,TensorDataset from modelClasses import * from utilityFunctions import * #torch.backends.cudnn.deterministic = True warnings.filterwarnings("ignore") # torch.backends.cudnn.benchmark = True # os.environ['CUDA_LAUNCH_BLOC...
2d7c6ce1432551e5fc804ac7b3baba50cfe487b49fa19e5d2a41e3a57e491969
Python
6,060
146
""" The GOOD-PCBA dataset adapted from `MoleculeNet <https://pubs.rsc.org/en/content/articlehtml/2018/sc/c7sc02664a>`_. """ import os import os.path as osp import gdown import torch from munch import Munch from torch_geometric.data import InMemoryDataset, extract_zip class GOODPCBA(InMemoryDataset): r""" The...
32705c70073ad2ac015f016d6f29effa8af3daf25da1faf340cb44d3245f3751
Python
6,060
179
import pytest import torch from e3nn import o3 from nequip.utils import torch_default_dtype, dtype_from_name from nequip.utils.versions.torch_versions import _TORCH_GE_2_4 from nequip.nn._tp_scatter_base import TensorProductScatter _CUEQ_INSTALLED = False _OEQ_INSTALLED = False # test data dimensions NUM_NODES = 8 ...
43f626043aafa7064a984ba3da0ecb54ebe2638ea30323ea57b2fbc4d9c86e27
Python
6,070
187
from chromadb.api.types import EmbeddingFunction, Space from chromadb.utils.embedding_functions.schemas import validate_config_schema from chromadb.api.types import ( Document, Documents, Embedding, Embeddings, Image, Images, is_document, is_image, Embeddable, ) from typing import Li...
6867127c7234800b946783a61f5519c4050ae69d961a2a1b6a62b879df1a2c6c
Python
6,075
177
import numpy as np import random import rdkit.Chem as Chem from rdkit.Chem.Scaffolds import MurckoScaffold import csv import pickle def read_data(smilefile): fp = open(smilefile, 'r') smile_list = [] for smile in fp: smile = smile.strip() smile_list.append(smile) fp.close() return ...
cd12c32d6296c2ead7ee814f70604905235936a65af1869bcfca0ed85ae3d3b6
Python
6,075
160
#!/usr/bin/env python3 # 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 argparse import collections import os import re import torch from fairseq.file_io import PathManager def aver...
051392df32552a0407e44eab51221b3cc06f710f1262547a3ac82cf6ba736c77
Python
6,077
158
import os import torch import numpy as np from tqdm import tqdm from torch_geometric.data import DataLoader class RegTrainer(): def __init__(self, train_dataset, val_dataset, configs, device): self.configs = configs self.train_dataset = train_dataset self.val_dataset = val_dataset ...
0c7e2f3b379dee09746790d5d75a5950671ab9cf3844f1257f5145167ebda38c
Python
6,077
164
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ # from csbdeep.models import CARE # from deeprest.rawDataClass import rawData # from deeprest.modelClass import modelRest # from deeprest.timeLapseClass import sampleTimeLapse import time, os, glob import shutil...
41203f4b8c16fc3a6cda2ce091a189e703ce0fa75d416058c88319b66ab95d3b
Python
6,080
190
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 25 12:13:31 2019 @author: Qian Zhu """ import scipy import scipy.stats import sys import re import os import numpy as np import math from operator import itemgetter from scipy.spatial.distance import squareform, pdist from scipy.stats import percen...
d0b9cb44e0af4862bb252b272934cb9b4569913dc3f9824bcf86efea49dd3e0c
Python
6,080
156
''' Example showing hardware-timed continuous analog output with two channels without using a callback function pynidaqmx.ao.hardwareContinuousVoltageNoCallback_twoChannels Purpose Demonstrates how to do hardware-timed continuous analog output without a callback function. To achieve this we use sample regenerat...
31f0939d1aeccfd6442e606f77c302c9a77bf9f0bf95530e660219aa9493d553
Python
6,085
195
"""Demonstrates active learning molecular dynamics with constant temperature.""" import argparse import os import time import ase.io import numpy as np from ase import units from ase.md.langevin import Langevin from ase.md.velocitydistribution import MaxwellBoltzmannDistribution from mace.calculators.mace import MAC...
fca60de70be163ebc7b9a5f0b73bb48f62d3af26897dbbc754d0b439b6272a70
Python
6,085
190
import random import pytest import geomstats.backend as gs from geomstats.geometry.hypersphere import Hypersphere, HypersphereMetric from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test.random import HypersphereIntrinsicRandomDataGenerator from geomstats.test_cases.geometry.hypersphere i...
cd589af1db418eefdc1776054e968fefdc286f556a8b720cf31cda9a54ba78a8
Python
6,086
164
""" Based on the U-Net implementation from https://github.com/jvanvugt/pytorch-unet, released under the MIT License, copied below: MIT License Copyright (c) 2018 Joris Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to...
00dc1e9ad74e34d72c7d470238b72099e53069e8770bf420fc3b8322366e6e9a
Python
6,087
162
import pytest import geomstats.backend as gs from geomstats.geometry.symmetric_matrices import SymmetricMatrices from geomstats.test_cases.information_geometry.dirichlet import ( DirichletDistributionsTestCase, DirichletMetricTestCase, ) # TODO: add againts numpy test case for pdf? def sectional_curvature(...
575af19c2c4b495af3ffc5602b6243b31d07b2e220c2191caadad6a025d2971d
Python
6,089
198
import torch as T import torch.nn as nn from Networks.network import Network class UNet_concat_student(Network): def __init__(self, base, expansion): super(UNet_concat_student, self).__init__() self._build(base, expansion) def forward(self, image, segbox = None, eval_mode = True): lay...
6a3948638d2a7e664a0009a29434ddf4125c1207a6463ef208d346d15232f57a
Python
6,090
164
"""Example experiment for a linear baseline method.""" import glob import json import logging import os # set gpu private os.environ['TF_GPU_THREAD_MODE'] = 'gpu_private' import tensorflow as tf tf.config.run_functions_eagerly(True) import sys # add base path to sys sys.path.append(os.path.join(os.path.dirname(__file...
5e01aaf48af94b79212e09f8cc654c92f96f84a39de9acc754bce2324b49632d
Python
6,091
151
"""The argument vocabulary every algorithms family shares. `tail` is spoken by inference, alignment and regression alike, and by the two facade methods that expose a permutation test (`Roc.summary`, `Adjacency.ttest`), so its validator and the p-value computation built on it live here rather than inside any one family...
b19b39f7283738f1b13a75cba36ea32c4cd2b3da6d6b3433e7de409760901cf8
Python
6,097
205
import pytest import torch from nequip.nn.embedding.utils import ( cutoff_partialdict_to_fulldict, cutoff_fulldict_to_tensor, cutoff_tensor_to_str, cutoff_str_to_fulldict, cutoff_partialdict_to_tensor, ) from nequip.utils.global_dtype import _GLOBAL_DTYPE def test_round_trip_two_types(): """T...
754917b44ed62939f452e2846807be33592f90b2d7ebde5fed041629ba869e6c
Python
6,100
154
import numpy as np import pandas as pd import pytest from nltools.cross_validation import KFoldStratified def check_valid_split(train, test, n_samples=None): """Helper: Check that train/test split is valid.""" train, test = set(train), set(test) # Train and test split should not overlap assert train....
4fd433d3077bf8285a453c5bde930ef5eba67b026bf68e555ed5ba7912f65cec
Python
6,102
142
import random import numpy as np import torch import gpytorch class GreedySearch(object): """ Algorithm class for greedy search. In greedy search, one dimension or direction is optimized at any given time. For example, if you have a 2D rectangle search space with width A and length B, this algorithm w...
ffadd45a3c2e38939ac2cfe10423564c7e1d1673263d08cfcd20b83acdc9279c
Python
6,109
183
from typing import Optional import torch from torch import Tensor import torch.nn.functional as F from torch.nn import ModuleList, Linear, BatchNorm1d from torch_sparse import SparseTensor from torch_geometric.nn import GCNConv from ..models import ScalableGNN from torch_geometric.typing import Adj, OptTensor class...
398f968ff06c5f6a1fe377cdb18f6235ecd836979e823e8d048ac5cdffb547cf
Python
6,111
173
import argparse import json import os import re import sys from pydfc.dfc_utils import TR_intersection, rank_norm from pydfc.ml_utils import find_available_subjects, load_dFC sys.path.append(os.path.dirname(os.path.abspath(__file__))) from helper_functions import ( # pyright: ignore[reportMissingImports] build_e...
462097e7a0dc48b4780b67ade28474e3ce8ed1b660c368da751036e364078929
Python
6,116
160
# -*- coding: utf-8 -*- """Provides utility functions for visualization.""" from warnings import warn from math import ceil import matplotlib.pyplot as plt # import mpl_toolkits.axes_grid.axes_size as Size # from mpl_toolkits.axes_grid import Divider import numpy as np def plot_image(x, fig=None, ax=None, **kwargs): ...
cb4cd678500c8ca6330fc05c3d1555a92fb3929e43d17f18bdfe830437aa63d6
Python
6,118
198
import boto3 import json import subprocess import os import re def b64text(txt): """Generate Base 64 encoded CF json for a multiline string, subbing in values where appropriate""" lines = [] for line in txt.splitlines(True): if "${" in line: lines.append({"Fn::Sub": line}) else...
e2f3512378b329058f07bbb647d62dbe58742b99e598a32c1124bc39426ddad6
Python
6,119
168
import math import numpy as np import torch import torch_geometric from torch_cluster import radius_graph from torch_scatter import scatter sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from utils import get_iso_dataset from e3nn.nn.models.gate_points_2101 import Network from e3nn import ...
5b0463e570c7a7ffd75624471c04ce3aa062334938f031c4e748fa015caa91fb
Python
6,120
187
import sys import csv import numpy as np import scipy as sp from scipy import optimize import math def readdata(filename): with open(filename, newline='') as csvfile: reader = csv.reader(csvfile, delimiter=' ', quotechar='|') fs = [] psd = [] for idx,row in enumerate(reader): ...
531d18155b20b46e922c8b3f14875de69ff11cd76dd0dcd7460bb2e1b545040c
Python
6,122
165
# 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...
3621a072ab20cbff8dc5ebd2aa145dc8c171bfbb4eede4da38b6c7697ab179db
Python
6,123
117
import os aff = os.sched_getaffinity(0) print('**********************before import torch******************************'+str(aff)) import torch print('**********************after import torch******************************'+str(os.sched_getaffinity(0))) os.sched_setaffinity(0, aff) from DeepPurpose import utils, dataset...
b1a90723522607fd7e0cb5fe5e61b6271ff5bf5b941cc5d2fdbe8631b1e8af16
Python
6,123
210
import torch import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets as dsets import torch.nn.functional as F import numpy as np from torch.autograd import Variable from torch.optim.lr_scheduler import StepLR,MultiStepLR import matplotlib.pyplot as plt import math from sklearn.util...
ff77c2f41301f67f373215a70c9b6f86237a2b2824dec0ef63db698ee8d0b380
Python
6,130
144
import numpy as np class ion_datacube(): # a class for holding a datacube from an MSI dataset and producing ion images def __init__(self, step_size=[]): # define mandatory parameters (todo- validator to check all present) self.xic = [] # 'xtracted ion chromatogram (2d array of intensities(vector of ...
3739a78d474b1419c0b236baa4d20c10aff7abf3c24a803e90faff6be0565f12
Python
6,131
210
""" Implementation of dFC methods. Created on Jun 29 2023 @author: Mohammad Torabi """ import time from copy import deepcopy import numpy as np from ..dfc import DFC from ..time_series import TIME_SERIES from .base_dfc_method import BaseDFCMethod from .sliding_window_clustr import SLIDING_WINDOW_CLUSTR ###########...
fd0985d6b8596111528993292a26852a82232ea94fdecd743527bd3c8ccbf45c
Python
6,131
184
""" Run MDS on structures to create an embedding visualization Coloring options: * training TM similarity * scTM * helix/beta strand annotations * length """ import os import json import logging from glob import glob import argparse import pandas as pd from sklearn.manifold import MDS import umap from matplotlib im...
54410d6f5863d77f428fabcb18aa7572f3747140c8d3a8cbbe38032feb00234d
Python
6,132
142
# -*- coding: utf-8 -*- """ Created on Fri Jul 10 18:14:19 2020 @author: Tom """ import tensorflow as tf from tensorflow import keras as k tf.config.list_physical_devices() import os os.environ['CONDA_DLL_SEARCH_MODIFICATION_ENABLE'] = '1' # needed due to dll bug in my environment - might be unnecessary for other pp...
936547ae3674ff45781fa9dee0a2c776a7d622d6b7aa2f7299565b5107673bd5
Python
6,134
140
r"""DeepMSI reconstruction of the high-res MSI transients by predicting the encodings of the high-res data. Autoencoder and the encoding regressor are trained on existing high-res dataset from a few tissue sections of a 3D volume. Encodings can then be predicted from low-res data (short transients) of the remaining...
6b43f9c2e9d2224ce1b95621db477da132e6dce5efe64f7af5cabc2652550dd1
Python
6,143
199
# coding=utf-8 """ Vocabulary helper class """ import re import numpy as np class Vocabulary: """Stores the tokens and their conversion to one-hot vectors.""" def __init__(self, tokens=None, starting_id=0): """ Instantiates a Vocabulary instance. :param tokens: A list of tokens (st...
119cd794d0b042404876ab6475d0921d6c1c34b10583e51cd28848d62f04a781
Python
6,151
125
"""The promiscuity table: the contract of the committed file, not the predictor behind it. `mhcmatch` fetches its reference data from HuggingFace, so nothing here scores anything -- a test that fails when HuggingFace is slow is a test that gets disabled. What is asserted is the part that goes wrong without anybody not...
de86261e10074a8f567ff8e79d937d3b743ee3edbaff4e925300d84ddbaafed4
Python
6,151
202
import sys import multiprocessing as mp import neurodecode.utils.io as io from neurodecode import logger from neurodecode.utils.timer import Timer from neurodecode.triggers import Trigger, TriggerDef from neurodecode.stream_receiver import StreamReceiver from neurodecode.gui.streams import redirect_stdout_to_queue #...
ecc84cdde2aa5994990b1e86f35e54c1b833fc8175136af23deef0f88c5932b3
Python
6,153
202
"""Varifolds related machinery. General framework is introduced in [KCC2017]_. See [CCGGR2020]_ for details about kernels. Implementation is based in pykeops (https://www.kernel-operations.io/keops/). In particular, see https://www.kernel-operations.io/keops/_auto_tutorials/surface_registration/plot_LDDMM_Surface.html...
7389bb745156b975039642900334e6928947f7b47282cccda676e7c6b428e5b0
Python
6,154
179
from collections import namedtuple from typing import Dict, List, Tuple, Union import numpy as np import torch import torch.nn.functional as F from torch import Tensor from model_angelo.utils.fasta_utils import FASTASequence from model_angelo.utils.residue_constants import parse_sequence_string def point_cloud_to_s...
6ed8286ea1a4f250c3b7a73fb550d2f8f24d9da6317f769859926d6979370a89
Python
6,155
103
"""``method.frequency``: three independent columns, none derived from another (#696). One free-text column holds at least three different things. Measured on the corpus: **63,532 non-blank cells over 7,111 distinct values**, of which 3,548 distinct are a ratio written `x/X` (`12/163`, `52/27589`, `5719/33921`), others...
cdaeb18ca5cf8a153fb87e5e1a5576ddca835ff4dc90cb6de03ca7c00cee11a4
Python
6,156
158
import copy import itertools as it from typing import Any, Dict, List import more_itertools as itx import pytest from hypothesis import assume, given from hypothesis import strategies as st from snakebids.core.datasets import BidsComponent, BidsDataset from snakebids.tests import strategies as sb_st from snakebids.te...
8e982f226f9ab90a24d3ab83ccda47b544397e53d5e1084b1293ff8459219964
Python
6,158
171
from chromadb.api.types import ( Documents, Embeddings, Images, Embeddable, EmbeddingFunction, ) from chromadb.utils.embedding_functions.schemas import validate_config_schema from typing import List, Dict, Any, Union, cast, Sequence import numpy as np def create_langchain_embedding( langchain_...
47756cbe0b82e8736eb579dd0b5da8810530d29db978fe3b7655f7be5b231238
Python
6,162
196
from dataclasses import dataclass from typing import Tuple from unittest import TestCase from unittest.mock import MagicMock from sniffles.cluster import Cluster, resplit_bnd from sniffles.leadprov import Lead from sniffles.sv import SVCall, SVCallBNDInfo, resolve_bnd @dataclass class TestInfo: id: str conti...
f74de9df3c17490dd492413d8e6196aa6893bb30ea01b41ccc195f559ba5f9ff
Python
6,162
154
from utils_ds import * from utils import mol_to_dgl_graph from data_utils.merge_data import split_line from rdkit.Chem import AllChem import pickle import json from tqdm import tqdm from rdkit import RDLogger RDLogger.DisableLog('rdApp.warning') vocab_file = os.path.join("data", "pretraining_data", "merge_vocab_freque...
e88346a1ca0ef46f0c0d6a012240084d154f257b8c06be7b43b397d9169782c8
Python
6,165
154
import numpy as np import itertools import warnings from scipy.ndimage import convolve as conv from types import SimpleNamespace simple_3x3 = SimpleNamespace( x=np.array([[-0, 0, 0], [-1, 0, 1], [-0, 0, 0]], dtype=float), y=np.array([[-0, -1, ...
d4258269ccf5a5720b8cd6992e73ac36b5525426d6f48f152d7af754d2c1514f
Python
6,166
176
"""Tests for Plot Scatter marker and hue rendering.""" from typing import Any import numpy as np import pandas as pd import pytest from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.figure import Figure from qtpy import QtCore, QtWidgets from sanpy.bAnalysisResults import get_plot_result_def...
a47751c95b81c960e8f40a7a4d135a436640c7cb95fff841926ffb39e28cd2d4
Python
6,167
169
import os, glob, tqdm from skimage.io import imread, imsave import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import matplotlib as mpl import scipy.ndimage as ndi from skimage.metrics import structural_similarity as ssim from skimage.metrics import normalized_root_mse as nrmse import skimage....
70f0400455875d77db30dfeca0fbba52ff6a27eb8c5327f32e2892d406b797dd
Python
6,168
138
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import os import torch import torch.nn.functional as F from torch_geometric.loader import DataLoader from torch_geometric.datasets import TUDataset from .model import RewardGenModel from dig.auggraph.dataset.aug_dataset import DegreeTran...
41b3978850b90b379c9fe05be83d3f04020bc16f44e645e49d818bb54640b332
Python
6,173
142
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* ...
a498be41ebc941f6719eeb47c7d169d1a0eaf67478403afcb27a8d43d3e8f317
Python
6,174
169
import os from typing import Generator, cast import numpy as np import pytest import chromadb from chromadb.api.types import ( Embeddable, EmbeddingFunction, Embeddings, Image, Document, ) from chromadb.test.property.strategies import hashing_embedding_function from chromadb.test.property.invariants...
04e69e0740256c99c65c96ba0fc2c5efd076eabd64784cf538f0494695f21f53
Python
6,175
154
import numpy as np import itertools import warnings from scipy.ndimage import convolve as conv from types import SimpleNamespace simple_3x3 = SimpleNamespace( x=np.array([[-0, 0, 0], [-1, 0, 1], [-0, 0, 0]], dtype=float), y=np.array([[-0, -1, ...
c83cb4aa598693aff6b2953d968e6cedc433c5def5fea53385d2f4ca3ecd8451
Python
6,176
166
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch from nequip.data import AtomicDataDict, compute_neighborlist_ from nequip.data._nl import DEFAULT_NEIGHBORLIST_BACKEND from nequip.data._key_registry import get_field_type from typing impor...
cafa80d885379c4a8a9005773bf013866fff6a031232eb7678d66f747d3cd0f3
Python
6,176
191
import os import random import numpy as np from tqdm import tqdm import torch from torchvision import transforms from skimage.metrics import ( mean_squared_error, structural_similarity, peak_signal_noise_ratio ) from skimage.transform import iradon, iradon_sart from pytorch_radon import Radon, IRadon fr...
cf1e96c754583437cf7ec62eab7f63d82fc3f174315221f5c00db7f421d1d390
Python
6,176
179
# 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 torch from fairseq import utils from fairseq.dataclass.utils import gen_parser_from_dataclass class FairseqOptimizer(object): def...
7a260185ce0a85bf32a529702ab9e7b80423dc2dd83da456284904aad79635be
Python
6,179
126
"""Assemble a release: the zips, the manifest, the checksums, and ``latest-version.txt``. Six steps: 1. **plan** -- derive the version from the tag, assert the tag does not already exist; 2. **prepare** -- rewrite ``latest-version.txt`` in the working tree, idempotently; 3. **build** -- write every bundle, all embedd...
e4d30a9d6b6c259a3873d1ffb747b1211a8b64d9735ac23ca9108c04527bd7e9
Python
6,182
164
# Scripts to modify the spacing of OCT images/labels and rescale sparse landmarks # 2023 Peng Liu Email: firstname.lastname@nct-dresden.de import os import nrrd import numpy as np import json import pickle import argparse import glob with open("funcs/header_original_scale.pkl", 'rb') as f: header_original_scale ...
e4984b34c194a2620987413fd5abfaa1f887cc56008de6dc81d31478e45f3124
Python
6,183
200
"""Learning embedding of graph using Poincare Ball Model.""" import logging import matplotlib.pyplot as plt import geomstats.backend as gs import geomstats.visualization as visualization from geomstats.datasets.utils import load_karate_graph from geomstats.geometry.poincare_ball import PoincareBall def log_sigmoid...
33750b43f834aa0332aa80a3f13c31c1b9e9507f31790ac05de13dd7d5ae087f
Python
6,184
152
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # # 2D: When running MATLAB in parallel with multiple threads, each source position is written to...
649d5777247759d1831b210b042becddb2e8ef605123a65a50706e445c81e44a
Python
6,189
157
## loading package import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import pylab import seaborn as sns from sklearn.metrics.pairwise import cosine_similarity from statannot import add_stat_annotation import matplotlib as mpl from scipy import stats, cluster import glob import re...
14032a04179e957f6951473f4f5110b07ea04d93817fcba5884e33bb1507ebd7
Python
6,190
202
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ import time, os, glob from tqdm import tqdm import numpy as np from skimage.io import imread import seaborn as sns import pandas as pd import matplotlib.pyplot as plt from skimage.metrics import structural_simil...
4da219a724b27e89f5b8b235ab112e5ee0dbd71f159fcceea9d73dc272f2ed35
Python
6,193
191
import numpy as np import renderapi from scipy.linalg import block_diag from scipy.sparse import csr_matrix from .utils import aff_matrix, aff_matrices, AlignerTransformException __all__ = ['AlignerRotationModel'] class AlignerRotationModel(renderapi.transform.AffineModel): """ Object for implementing rotat...
9122f8fb421a07e928a00e18955f0c54bba0426a4bec1e3e5c5cdcd9544c162a
Python
6,201
173
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ # from csbdeep.models import CARE # from deeprest.rawDataClass import rawData # from deeprest.modelClass import modelRest # from deeprest.timeLapseClass import sampleTimeLapse import time, os, glob from tqdm imp...
86bd8517201bc857db495f32bb643a2df2794f7f9e40a3415929175b714e4ead
Python
6,202
253
import os import nengo import torch import argparse import numpy as np import pandas as pd import matplotlib.pyplot as plt from brian2 import * from nest import * from time import time as t from experiments import ROOT_DIR import brian2genn from bindsnet.network import Network from bindsnet.network.topology import C...
8a2cdcd0117cbbe915f8f7b3f250aaef7ddb1a24cfe776e9b285ce93d77aa982
Python
6,202
63
REACTION_SUZUKI = [ "[*;$(c2aaaaa2),$(c2aaaa2):1]-!@[*;$(c2aaaaa2),$(c2aaaa2):2]>>[#6;H0;D3;$([#6](~[#6])~[#6]):1]B(O)O.[#6;H0;D3;$([#6](~[#6])~[#6]):2][Cl]" ] SCAFFOLD_SUZUKI = "[*:0]c1ccc2c(c1)cc(cc2)c3ccccc3" DECORATION_SUZUKI = "[*]c1ncncc1" DECORATION_NO_SUZUKI = "[*]C" FRAGMENT_REACTIONS = [ "[#6;$(C[C;$(...
89165e056b4dfbd5dd2629aa8d978169c48a1ecd0478e0ae771db269fabc29b4
Python
6,206
177
import json import os import tempfile from typing import Tuple import pandas as pd import yaml from reinvent_plugins.components.synthsense.parameters import ComponentLevelParameters __ENV_NAME = "CAZP_PROFILES" CAZP_PROFILE = __ENV_NAME if __ENV_NAME in os.environ else "HITINVENT_PROFILES" def mergedicts(a: dict,...