sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7f351852ac43ad27e6233f42f05abf36ca67f8522fa0f28390d38165ceec3ab8
Python
4,207
116
########################################################################################### # Elementary tools for handling irreducible representations # Authors: Ilyes Batatia, Gregor Simm # This program is distributed under the MIT License (see MIT.md) #################################################################...
cee1e7762c071ab4547bd0d16615916fb1f2a0c63fe34d24a7b89c7fecd2e6b4
Python
4,207
93
"""IMGT's F / ORF / P verdict on a named segment (#634). `imgt_alleles.tsv.gz` is a committed, reviewed authority and `functionality` was read by nothing: `vdjdb qc` asks whether a call *looks* like a TRBV name and `curate.nomenclature` asks whether IMGT *has* it, and neither asks whether IMGT thinks the gene is funct...
1b85469eac40a2b3f038516811f0303c931ecc4d5e136e04c0c7c37e6184f4e5
Python
4,209
115
import numpy as np import os,glob import shutil from tifffile import imsave, imread from PyQt5.QtWidgets import QFileDialog, QApplication def get_meta(paramFile): param_list={} with open(paramFile) as f: lines = f.readlines() for l in lines: try: (val,p)=l.split(":")...
3e7714146b9d7e9cd1fc30fa4500597bdb600456e995c29302fb8e8dba0c96a8
Python
4,212
93
import pandas as pd import os import numpy as np #Once you have the windows data, the last part missing will just be to split the dataframe in windows (and store each dataframe in a dictionary with the right window). #Import the fingerprinting file with the fp columns fp_file = pd.read_csv("~/Desktop/Fingerprinting_P...
66e77d0ac959e46f8a5a747a704c88254fc2932238abceddb2f33b78ddb06128
Python
4,213
106
from typing import Dict, List, Set, cast from chromadb.types import LogRecord, Operation, Vector class Batch: """Used to model the set of changes as an atomic operation""" _ids_to_records: Dict[str, LogRecord] _deleted_ids: Set[str] _written_ids: Set[str] _upsert_add_ids: Set[str] # IDs that are...
77c8fcc911c7757bb683cfa1023c39e3689193270815b2843fd5787a4c0a7a78
Python
4,215
114
from PymoNNto.Exploration.Network_UI.TabBase import * from PymoNNto.NetworkBehavior.Recorder.Recorder import * class individual_weight_tab(TabBase): def __init__(self, title='Ind Weights', weight_attr='W'): super().__init__(title) self.weight_attr = weight_attr def add_recorder_variables(self...
1db049b651ea31f0919e5a2d5757127585bf991cd6f3b4ebff35a3705792ce44
Python
4,216
74
import sys import h5py import pandas as pd import numpy as np def hdf5_to_csv(hdf5_path): hdf5 = h5py.File(hdf5_path,'r+') name = hdf5_path.split('.')[0] first = True for epoch in hdf5.keys(): for dataset in hdf5['{}'.format(epoch)].keys(): ...
e03cc7b79ada18aeeb20574ec34d3dca5bf3d94a5c11ccbb6104a14f45c0981b
Python
4,217
102
# Copyright 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import logging import os from tests.end_to_end.utils.tr_common_fixtures import fx_federation_tr, fx_federation_tr_dws import tests.end_to_end.utils.defaults as defaults from tests.end_to_end.utils import federation_helper as f...
5763e85e13c8db7ff9bc2c743106efa8466d67bb267c6f0a7184c9451097ad90
Python
4,219
114
import community as cm import networkx as nx import numpy as np import scipy.sparse as sp import tensorflow as tf import phenograph flags = tf.app.flags FLAGS = flags.FLAGS def louvain_adj_clustering(adj, s_rec): """ Performs community detection on a graph using the Louvain method :param adj: sparse adj...
b33e30ce9f79bd6cffe9f9261177bd8fb57ba054a1ec8812a635551fcc25124f
Python
4,220
117
from collections.abc import Sequence from functools import lru_cache from pathlib import Path import cv2 import numpy as np class VideoPathHolder: """Read frames from one or more video files with an LRU frame cache.""" cap: cv2.VideoCapture current_captured_video_path: Path | None _precomputed_frame...
ec438b360d2302a5c8ad7767aecb521428987705b1494a45f8c02544ac676601
Python
4,220
112
#!/usr/bin/env python from wandb import Api import wandb import argparse import numpy as np def copy_run( source_run, target_project, target_name=None, prefix="", entity="schroedinger_univie", convert=False, add_reference=False, verbose=False ): source_run = source_run.replace("https://wandb.ai/", "") if "...
b20ab437f3313f164542f1fe38b6a1fff4ebbba8ff3cf4aacc787d3c1a5b0eb1
Python
4,222
110
import logging from collections.abc import Sequence from pathlib import Path import numpy as np from scipy.optimize import linear_sum_assignment from sklearn.metrics import confusion_matrix from idtrackerai import GlobalFragment, IdtrackeraiError, Session from ..network import IdentifierBase, get_predictions, load_i...
5f42ecb1db7cf66eeda2b722667fbc3e972a673b9fde70f490d42d12ce8cb577
Python
4,231
102
"""Ordinary least squares on plain numpy arrays. `regress` fits `Y ~ X` and returns coefficients, standard errors, t-statistics, p-values, degrees of freedom, and residuals as arrays. Use it for quick regressions on tabular or behavioral data; for voxel-wise models on imaging data use `BrainData.fit(model='glm')`, whi...
b4a2610cead3e9e149a7ef04ddb5a71202d71a81d69f2c2f09224a35c93d1dc9
Python
4,233
91
"""Does the shipped clustering still give a record its cluster-mates? Nothing compared the motif tables before this: `vdjdb diff` keys `cluster_members.txt` on `cid`, a cid carries a position in a sorted list, so the CI comparison names its five legacy members with `--only` and the motif files were judged by purity an...
0ee6b12a8b32a420c9eed3a2743ea1e0114f54767c8832728a421b69ba799996
Python
4,235
141
import numpy as np from sleeprnn.data import utils, stamp_correction def find_envelope(x, win_size): half_win_size = win_size // 2 shifts = np.arange(-half_win_size, half_win_size + 0.001).astype(np.int32) shifted_signals = [] for shift in shifts: shifted_signals.append(np.roll(x, shift)) ...
4e1b52a3b44bfff15ebd204b050c86200178ec4f7243ef9f944620304adae00e
Python
4,235
118
# 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 # # Unless required by appli...
c4489bff4f21abf9256c73ed014f0f54d3ab5221e4c16d4fd9092257998bc4ff
Python
4,240
92
import io import click import pandas as pd from uniprotparser.betaparser import UniprotParser, UniprotSequence from sequal.sequence import Sequence from curtainutils.common import read_fasta if __name__ == "__main__": fasta_file = r"C:\Users\Toan Phung\Downloads\20250113_Mouse_Reviewed.fasta" inpu...
65e85faac6e82e333a6ed00e88841af244e24c1b1c730c8e3a955ba97430385e
Python
4,241
120
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cogn...
77e1592aa05c86a11c9733d7c943d331bb87c5c4f6609dd3e0b6a5a794c2a9e8
Python
4,241
113
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Adaptive aggregation module.""" from typing import List import numpy as np from openfl.interface.aggregation_functions.core.interface import AggregationFunction from openfl.utilities.optimizers.numpy.base_optimizer import Optimizer fr...
1542f67090070bdb5aa485324ffb05dcf20b89eb680a43f6e19ad39e283eab44
Python
4,243
116
from video_stream import ImageSource, AcquireException import cv2 import time from pathlib import Path class VideoImageSource(ImageSource): """ VideoImageSource - an image source that reads images from a video file or a camera using openCV. """ default_params = { **ImageSource.default_params,...
002c1b750367ed6ce131cf3fcf54a062b9d9de4e420a785f0461005617638721
Python
4,244
118
from chromadb.api.types import Embeddings, Documents, EmbeddingFunction, Space from chromadb.utils.embedding_functions.schemas import validate_config_schema from typing import List, Dict, Any, Optional import numpy as np class InstructorEmbeddingFunction(EmbeddingFunction[Documents]): """ This class is used t...
a864fac7ffd7741670cce3feddc77ea6880383e4504fc588300c015afff9c701
Python
4,247
142
import torch from torch import nn from torch.nn import functional as F def swish(x): return x * torch.sigmoid(x) class SpectralNorm: def __init__(self, name, bound=False): self.name = name self.bound = bound def compute_weight(self, module): weight = getattr(module, self.name ...
45d7729ade4fafc18c4235f30eed7b4f1d860df28ecac60e4758c0b2b85d618f
Python
4,251
125
"""LSTM (or GRU) RNN for the classical Reinvent de novo model""" from typing import Tuple, Dict, Sequence, Any import torch import torch.nn as tnn import torch.nn.functional as tnnf class RNN(tnn.Module): """ Implements an N layer GRU(M) or LSTM cell including an embedding layer and an output linear lay...
d8e5db646555c329731dbb8bd31d2476d6e08565e203202009e94d4a75f5f5b4
Python
4,252
119
from os import PathLike from pathlib import Path from typing import List import matplotlib.pyplot as plt import numpy as np from matplotlib import cm def make_prediction_plots( preds: List[np.ndarray] = None, true: List[np.ndarray] = None, losses: np.ndarray = None, descriptors: List[str] = None, ...
ba88a1a74211cb9e3254610db4c6d456ddc7ec807910cb4297e3a83c89c3b3c8
Python
4,258
131
import numpy as np import torch import torch.nn as nn from model_angelo.models.common_modules import ( AttentionBlock, GlobalLayer, MaxNeighbour, NormalizeStd, RegularBlock, ResBlock, Upsample ) class Resnet(nn.Module): def __init__( self, in_channels, out_chan...
4227f2aa898f751d95856b7a253128430f9c108c2a18a368bcebc694860c946c
Python
4,260
121
"""Mutable experimental metadata and its presentation definitions.""" from __future__ import annotations import copy from typing import Any, TYPE_CHECKING from sanpy.sanpyLogger import get_logger if TYPE_CHECKING: from sanpy.bAnalysis_ import bAnalysis logger = get_logger(__name__) EXPERIMENTAL_METADATA_DEFIN...
033e2510cf9b203e6ed7bf43e38fdc90bb088d48eb1d57bf7f9311c13cdc4be2
Python
4,261
149
import numpy as np # import scipy.signal from PyQt5 import QtWidgets import matplotlib.pyplot as plt from sanpy.sanpyLogger import get_logger logger = get_logger(__name__) import sanpy from sanpy.interface.plugins import sanpyPlugin # from sanpy.bAnalysisUtil import statList class exportTrace(sanpyPlugin): "...
37eb9b9913fb64bb91ca39b8fe518b5ffb1e2c6709e1746d33aa08e17c5643f8
Python
4,261
132
""" For Fig 2B go to: Z:\people\gritti\IRIR\supFig2_3 """ import os import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import pandas as pd import seaborn as sns from scipy.fftpack import dct # import cv2 plt.rcParams.update({'font.size': 15}) rc('font', size=8) rc('font', family='Arial') #...
dcaf0f02c9ee29b3d5759ccfbfe7cfff5eca95b9a27695f808dde24d20906167
Python
4,261
155
"""Multidimensional scaling (MDS).""" import sklearn.manifold._mds as _mds import sklearn.metrics.pairwise as mp from sklearn.manifold import MDS as _MDS import geomstats.backend as gs from geomstats._sklearngs.manifold._classical_mds import ClassicalMDS from geomstats._sklearngs.manifold._mds import smacof from geom...
500bf97be832f1f6861e102223921315edf67d52a692d8179361e7e04ce8059b
Python
4,264
113
"""Test harness for the LAMMPS integration contract. Reproduces, in pure Python, the data layout LAMMPS's pair style feeds to the exported model: an open (non-periodic) cluster of LOCAL atoms plus GHOST periodic images within the receptive field, and a local_or_ghost mask. This is what lets us exercise the lammps_clas...
64313e516ad57499efbe8d21abd537f43b436c1f57348317fc6f3065e32a5a48
Python
4,267
114
import time from math import ceil from pathlib import Path import numpy as np from ppafm.common import eVA_Nm from ppafm.ml.AuxMap import ESMapConstant from ppafm.ml.Generator import InverseAFMtrainer from ppafm.ocl.AFMulator import AFMulator from mlspm.data_generation import TarWriter from mlspm.datasets import down...
68ec568a03f14bb1cf024e2ee0b16361ea684607a1a4ff56ad0360016d2f391b
Python
4,268
99
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network models and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cognitiv...
2dacd4bd374217c82916e18166eb1c309f318b231e03775e181113a1e124dd35
Python
4,270
117
#This code takes binned CT image series from a specified directory, and segments the image data #by running prediction using a specified tensorflow model. #This code is run in a singularity container from a SLURM-script #!/usr/bin/env python import tensorflow as tf import numpy as np import h5py import getopt, sys #...
edac6f44c722d2413fbc12359223512e68fa92e34f972f8c2bddafba95bec549
Python
4,270
134
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # fairseq documentation build configuration file, created by # sphinx-quickstart on Fri Aug 17 21:45:30 2018. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # au...
341931df6002c24d0858f311e06201eecf0d6368f3496b01d6bc3cb206e1f512
Python
4,271
137
import torch as T import torch.nn as nn from Networks.network import Network class UNet5_filter_teacher(Network): def __init__(self, base, expansion): super(UNet5_filter_teacher, self).__init__() self._build(base, expansion) def forward(self, image, segbox): x_new = T.cat((image, segbo...
8fc800dcefa1fa97b480c5eea130e70550f821481b86ac7a72b1885294a6420c
Python
4,274
107
import unittest import torch.utils.data as tud from torch import Tensor from reinvent.models.linkinvent.dataset.paired_dataset import ( PairedDataset, PairedModelVocabulary, ) from reinvent.models.linkinvent.networks.decoder import Decoder from reinvent.models.linkinvent.networks.encoder import Encoder from t...
7aa394dd60823ea201512d80069976fc35eab959cc6a2583267939fd5536fbe6
Python
4,276
107
"""`--plot` and `--plot_frequency`: the plots a training run draws for itself. Different from `mace_plot_train`, which draws them afterwards from a results log. These come from `TrainingPlotter` inside the run, and `--plot` defaults to True, so every default training writes one. Until the fix in this branch it wrote ...
baf0afd8aa3b5e844b578b3721ed76053319adae0a7055b4e480057d8133a35b
Python
4,276
141
# saved as /n/groups/marks/users/david/res/model_save//RES_1638990570.3313198_32.pt import gvp from atom3d.datasets import LMDBDataset import torch_geometric from functools import partial import gvp.atom3d import torch.nn as nn import tqdm, torch, time, os import numpy as np from atom3d.util import metrics import skle...
270d9e01f1c6c56a19dc60d3421ef95ea35bf5682ecb1b2d029d5a403e91c430
Python
4,277
135
#!/usr/bin/env python import json import tempfile from glob import glob from pathlib import Path from shutil import copyfile import nibabel as nib import nipype.interfaces.io as nio import nipype.pipeline.engine as pe from nipype import Workflow from sdcflows.workflows.fit.syn import init_syn_preprocessing_wf, init_sy...
550f590cabdec5430707d9d6c729746c258ec132187a63f42e707da99fde67aa
Python
4,277
145
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import torch from torch.utils.data.sampler import Sampler from typing import Optional import torch.distributed as dist import math import argparse class BaseSamplerDP(Sampler): """ Base class for DataParal...
78a6f6e8c135506b1162120b3529090a0a285f5cb2f647569349623f0d56fbd1
Python
4,279
96
"""The three stages of a segment call stay distinguishable, and the engine's call is the shipped one. `chains` reports `v.segm.submitted` (what the publication said), `v.segm` (what ships) and `v.segm.arda` (what the markup engine aligned against). Collapsing any two of them loses the only thing that tells a curation ...
a03648d6c0b484218e080a9b3267e1dfb03e40ad9262d649d4c3eed05b67c585
Python
4,280
192
import analysis_utils as au def plot_mean(df): df = au.nature_pre(df) g = au.nature_relplot( data=df, x='pc_learning_rate', y='Mean of test__classification_error', hue='Rule', style='Rule', col='Dataset', row='energy_fn_str', ).set(xscale='log') au.nat...
ed12b67607f327d9f0fbba16a4b75bcde9a6f8f6cb86a045223fb53e8bf77876
Python
4,280
123
# Copyright (C) 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import xml.etree.ElementTree as ETree import json import os import math import hashlib def xml_to_json(input_base_folder, subfolders, output_folder, verify_hash=1): if not os.path.exists(input_base_folder): raise SystemExi...
bfc83d8f4c14a9c8d80306ab630d8f6840c771bcd2be1301edd5191f7892503b
Python
4,281
106
''' Module focused on the implementation of Averaged Higher Order SVD (AHOSVD) technique. ''' import torch import numpy as np from smithers.ml.layers.hosvd import HOSVD class AHOSVD(): """ Class that handles the construction of the functions needed to perform the dimensionality reduction of a given tenso...
93af6fa36f69203857472e06b7dfa1feaf1daa39766e0d9161a1f0a33857a34b
Python
4,283
112
# Copyright 2020 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
9bec78f5eaf224fc15f2df79f38d64270d835591eb1ad21f9dd5aa1b33d95738
Python
4,283
115
import torch from torch import nn from torchvision import models class ASPP(nn.Module): def __init__(self, in_channels, out_channels, atrous_rates): super(ASPP, self).__init__() modules = [] for rate in atrous_rates: modules.append( nn.Sequential( ...
d8c5deb36a76e781b2e2c3e53f4d7b11e37b7843cab795dd6a2ca7d77d628b2c
Python
4,284
116
from collections.abc import Iterator, Sequence from typing import Literal from . import Fragment, IdtrackeraiError from .utils import deprecated class GlobalFragment: """Represents a collection of N_animals coexisting :class:`Fragment` s.""" duplicated_identities: set """Temporary identities duplicated ...
d32ed40115bfbb9aa27a5b2c5f504435eb842f2d70fb62bef9a9ad43cf68e690
Python
4,285
124
import pandas as pd import numpy as np import scipy.stats # AUC comparison adapted from # https://github.com/Netflix/vmaf/ def compute_midrank(x): """Computes midranks. Args: x - a 1D numpy array Returns: array of midranks """ J = np.argsort(x) Z = x[J] N = len(x) T = np.z...
34745641320f7741cb7d6ec7bb4ccd18469df6e9d945cb3288568d0f06e49647
Python
4,286
130
from sleepy.processing.dataset import Dataset import unittest from unittest.mock import MagicMock import numpy as np import pdb class DatasetTest(unittest.TestCase): def standardScenario(): """Standard test scenario creating a dataset with rudimental epochs and labels. No filtered data...
d2933eb75c8035ad94b7c3fee67a9c2e86cf9fd3e54938fc11a30f71df68048b
Python
4,286
111
# 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...
e57324866ffcd2918c52b0a21dfd4c4ebbdc4eef1d1588c7ec311e2370d7845a
Python
4,287
125
__all__ = ["TanimotoPairGenerator"] from functools import partial import logging import numpy as np import pandas as pd from reinvent.chemistry import conversions from reinvent.chemistry.similarity import calculate_tanimoto_batch from reinvent.models.utils.parallel import parallel from .pair_generator import PairGene...
c6cdb947e75d586cde95875f4bcfbf32f8b5232558e60c762dd10fae528d1579
Python
4,288
152
import copy import itertools as it from pathlib import Path from typing import Any, List, Optional, Type import hypothesis.strategies as st from bids.layout import Config as BidsConfig from hypothesis import assume from snakebids.core.datasets import BidsComponent from snakebids.core.input_generation import BidsDatas...
4805597b8a32177723909238103b77bc9e27c4620f31aae332d63b5f2d67624c
Python
4,289
85
# ===================================================================================== # RE-MEASURE D-Fine T4 latency (clean, warmup+median). FRESH NOTEBOOK, T4 GPU. # ===================================================================================== # HOW TO RUN: # 1) T4 runtime. Run CELL 1 -> sets up D-Fine + ...
9daec0bf36d476d169593d3eb291b6c8da61b062133e1017f1a48f445b6a205e
Python
4,289
85
import io import click import pandas as pd from uniprotparser.betaparser import UniprotSequence, UniprotParser import re from curtainutils.common import read_fasta reg_pattern = re.compile("_\w(\d+)_") protein_name_pattern = re.compile("(\w+_\w+)") def lambda_function_for_spectronaut_ptm(row: pd.Series, index_col: str...
e4e8fbd18547b25942cc076343ab83771de71f72f667661be6de515a7a9ecdbb
Python
4,289
134
"""The diversity filter is a memory for repeated SMILES Depending on the concrete filter, scaffolds or SMILES that are repeatedly found are memorized. Filtering happens on a given minimum score. """ from __future__ import annotations from typing import List, Optional from abc import ABC, abstractmethod import logging...
249335272f4a1e8dfb63f242f9c5628fc1cec1f9cd283f967cd69372799fc59c
Python
4,290
138
#!/usr/bin/env python import json import tempfile from glob import glob from pathlib import Path from shutil import copyfile import nibabel as nib import nipype.interfaces.io as nio import nipype.pipeline.engine as pe from nipype import Workflow from sdcflows.workflows.fit.syn import ( init_syn_preprocessing_wf, ...
e0e8a7f1459eb83cba4ee642126c375806a5d022f59ac0b65de03ccd6610f06f
Python
4,291
95
import logging import jax import jax.numpy as jnp import kfac_jax from deeperwin.configuration import ClippingConfig from deeperwin.hamiltonian import get_local_energy from deeperwin.utils.utils import pmean, without_cache import functools LOGGER = logging.getLogger("dpe") def init_clipping_state(): return jnp.ar...
923c22a77064acc5310ccca557e37516e096f2e0894d9571edc3e25cdeac779a
Python
4,292
101
"""The ProductHPDMatricesAndSiegelDisks manifold. The ProductHPDMatricesAndSiegelDisks manifold is defined as a product manifold of the HPD manifold and (n-1) Siegel disks. The HPD Siegel disks product has a product metric. The product metric on the HPD Siegel disks product space is the usual HPD matrices affine-invar...
dc2e3480e40e5f55400500b27fab8734d0f7b3ed21fc33b22d69ca0234a1f2c1
Python
4,292
141
import geomstats.backend as gs from geomstats.test.data import TestData from .base import VectorSpaceTestData from .mixins import GroupExpMixinsTestData from .riemannian_metric import RiemannianMetricTestData class EuclideanTestData(GroupExpMixinsTestData, VectorSpaceTestData): def exp_random_test_data(self): ...
dd7e5980b24fa3a6beb9ec2788b4c1469e77c296c41451617c05b6dc5c924338
Python
4,292
113
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ from deeprest.rawDataClass import rawData import time, glob, os, shutil from tifffile import imread, imsave from skimage.filters import threshold_otsu import numpy as np from raw2tiff import convert2tiff,fuse_il...
ddc3fc15b952e6b60942e2a082270c216b48e280355f6bcc0ae7c7fe53ee4df7
Python
4,297
138
# -*- coding: utf-8 -*- import os import numpy as np import logging, argparse from data_functions import load_data, get_windows import h5py import matplotlib.pyplot as plt from data_functions import get_feature_vector from mpi4py import MPI import time import configparser import sys def parse_args(): # Argume...
9d504c681a1df6999b2063e0d9092ac46db859ed3407803f6b87716a50f1f995
Python
4,298
158
"""Recompile the bids function stub file based on latest specs.""" from __future__ import annotations import inspect import itertools as it import re from pathlib import Path from types import ModuleType from typing import Iterable from snakebids.paths import _config, specs from snakebids.paths._templates import spe...
2db8d14edc482651d8da067eac914ccf4de64db7e8801cf941995397e38240e1
Python
4,299
77
"""The ``epitopes`` catalogue: one row per (epitope, species), with what supports it. The proteome link (#632) is read from ``proofreading/epitope_proteome.tsv``, a committed reviewed input, never resolved during a build - `mhcmatch` fetches the proteome from HuggingFace, so doing it here would put a network call in t...
42a370764cd04cfffcebfd722d8a5b04bc7b56f338fe71b1ba2d205cdb1a5f46
Python
4,299
116
import os from chromadb.utils.embedding_functions.openai_embedding_function import ( OpenAIEmbeddingFunction, ) from chromadb.utils.embedding_functions.schemas import validate_config_schema from typing import Dict, Any, Optional, List from chromadb.api.types import Space import warnings class BasetenEmbeddingFunc...
b35d8a57592b914072073f423d8ce316486c7d49b5a45d4dba6d2873d7067d50
Python
4,299
121
from abc import abstractmethod from typing import Callable, Optional, Sequence from chromadb.types import ( OperationRecord, LogRecord, SeqId, Vector, ScalarEncoding, ) from chromadb.config import Component from uuid import UUID import numpy as np def encode_vector(vector: Vector, encoding: Scalar...
60be52404b45a9088111a268f643b6ec191485561c04753c622dd67119e04408
Python
4,302
106
from typing import List, Dict, Tuple from rdkit.Chem.rdchem import Mol, AtomKekulizeException, Atom from rdkit.Chem.rdmolops import FragmentOnBonds, GetMolFrags from reinvent.chemistry import conversions, tokens from reinvent.chemistry.library_design.dtos import ReactionOutcomeDTO class BondMapper: def convert_...
061e6bf3b43e9a3c236a826bcf8dbcdd17f053b98f9dc4c3705d805d1c4f881e
Python
4,304
110
""" NeuroLearn Preferences ====================== """ __all__ = ["MNI_Template", "resolve_mni_path"] __author__ = ["Luke Chang"] __license__ = "MIT" import os from nltools.utils import get_resource_path MNI_Template = dict( resolution="2mm", mask_type="with_ventricles", mask=os.path.join(get_resource_pa...
fcbe730e729377867cd7452330936ca1c85ecd02718dcd699eca363421af8eb4
Python
4,307
88
from ontoutils import RobotImportsWrapper from ontoutils import RobotTemplateWrapper from ontoutils.lucid_chart import ParseLucidChartCsv from logging_conf import setup_logging setup_logging() def main(): # Get the imports and create the bcio_external.owl file import os os.chdir(os.path.dirname(__file__...
09505f5abd9142e284aa2df8266fb58885a58279210e0c9de776b8546e42cd59
Python
4,314
149
import numpy as np import sys import time from shapely.geometry import Polygon import paddle import unittest from ext_op import matched_rbox_iou def rbox2poly_single(rrect, get_best_begin_point=False): """ rrect:[x_ctr,y_ctr,w,h,angle] to poly:[x0,y0,x1,y1,x2,y2,x3,y3] """ x_ctr, y_ctr, width...
ebacf073225a8f4153801cff731b9021891fef430edb9f62c6c1e60c69a4e094
Python
4,316
122
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from ._tp_scatter_base import TensorProductScatter def nequip_tp_desc( irreps1, irreps2, irreps3, ): """Construct the NequIP version of channelwise tensor product descriptor. sub...
4e6ef1014c5024229e497347c9066c7eac12535521568704e9b8dff0347b3fd0
Python
4,322
113
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cogn...
7269b5b6ea186eebac9d3c9d196ea02328cee00572d23713d41b36f21ce4fbcf
Python
4,322
119
#!/usr/bin/env python3 ## This script performs movie segment classification using 15 s segments, ## similar to Haxby et al. ([2011](https://doi.org/10.1016/j.neuron.2011.08.026)) ## and Guntupalli et al. ([2016](https://doi.org/10.1093/cercor/bhw068), ## [2018](https://doi.org/10.1371/journal.pcbi.1006120)). ## Author...
aa7801fc3670985b97e0aae19cc3483861bc7c6d2aab66ca8c2b222d6cdcbde9
Python
4,327
124
# Taken from a PyTorch Lightning tutorial # https://pytorch-lightning.readthedocs.io/en/stable/notebooks/lightning_examples/cifar10-baseline.html import os import argparse import random import torch import torch.nn.functional as F import torchvision from pl_bolts.datamodules import ImagenetDataModule from pytorch_lig...
2cfc47a229fa722a96f368517264e573c107a8082626e3628e9fe72181434ff7
Python
4,328
122
import math import geomstats.backend as gs from geomstats.test.random import RandomDataGenerator from geomstats.test.test_case import TestCase from geomstats.test_cases.geometry.manifold import ManifoldTestCase from geomstats.vectorization import get_n_points class SurfacesLocalRandomDataGenerator(RandomDataGenerato...
c6e51703bbbfb592882a5f8a8f215100be66320e7df9748b8042401d1430b5f3
Python
4,329
129
# 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 # # Unless required by appli...
dc7934156dde3c55472330965f61323a647d8aba32ac7ecb43fe77ef38b5eae0
Python
4,331
136
import geomstats.backend as gs from geomstats.test.data import TestData EULER = gs.exp(1.0) class RiemannianMinimumDistanceToMeanSPDTestData(TestData): def _get_X_train(self): X_train_a = gs.array([[[EULER**2, 0], [0, 1]], [[1, 0], [0, 1]]]) X_train_b = gs.array([[[EULER**8, 0], [0, 1]], [[1, 0],...
4123a881e1a5dce738df157b0a3ea8f0554cb17cfb8c14cd3960d79984ab8a61
Python
4,332
110
""" Plot snapshots of the input data showing the detected waves. """ import os import numpy as np import quantities as pq import argparse import matplotlib.pyplot as plt from utils.io_utils import load_neo, save_plot from utils.neo_utils import analogsignal_to_imagesequence CLI = argparse.ArgumentParser() CLI.add_arg...
6dd1669f5f5da85bb745c7504d1a62e2135cc38bad1420f4fc17680b77a75aa9
Python
4,332
141
"""Geometric median.""" import logging from sklearn.base import BaseEstimator import geomstats.backend as gs class GeometricMedian(BaseEstimator): """Geometric median. Parameters ---------- space : Manifold Equipped manifold. max_iter : int Maximum number of iterations for the ...
3475a53a5ded4407b4cac3fca3dabb32e919b6dec17cc9486593adcd9a8cebab
Python
4,334
144
import numpy as np import pandas as pd from nltools.data import Design_Matrix from nltools.external.hrf import glover_hrf import pytest def test_add_poly(sim_design_matrix): matp = sim_design_matrix.add_poly(2) assert matp.shape[1] == 7 assert sim_design_matrix.add_poly(2, include_lower=False).shape[1] ==...
87ee6a37022dcfee47cd36f3dd44a168193ee7b79151344ceb428230d5578094
Python
4,335
142
import geomstats.backend as gs from geomstats.test.data import TestData class FisherRaoMetricCmpUnivariateNormalTestData(TestData): fail_for_autodiff_exceptions = False def metric_matrix_test_data(self): smoke_data = [ dict(base_point=gs.array([0.1, 0.8])), dict(base_point=gs....
fc8fb3cae1dfbd24081a05a40e4711621a5b2e57022fc2b86a6c66a3401f37ec
Python
4,335
126
from pathlib import Path import pandas as pd import os import torch from PIL import Image from torchvision import transforms # dataset for the raw vOPA images class VOPADataset_img(torch.utils.data.Dataset): def __init__( self, path_img: Path = Path("src/images"), path_protocols: Path = Pa...
671e39f1985677ee4dd830fe64667fb1690f356e2250461820b24e70580ec3e8
Python
4,336
130
""" Generate AIZynthFinder route JSON files with specified reaction classes. """ import json import argparse import sys def build_route(reaction_classes: list) -> dict: """ Build route with specified reaction classes. Uses a nested linear structure where each reaction's classification ...
c084165251a2b732758fdd371817fe063303b4e19602eccdfacb7da5885d763b
Python
4,336
138
import os import argparse import warnings warnings.simplefilter(action="ignore", category=FutureWarning) import pandas as pd import tensorflow as tf tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) from model_tools.activations.pca import LayerPCA from model_tools.brain_transformation.neural import Layer...
e08b6661c355f58da13306326ae6709361ee3e4c500e24732e50db8f12f3e9f6
Python
4,336
125
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import paddle import paddle.nn as nn import typing from ppdet.core.workspace import register from ppdet.modeling.post_process import nms __all__ = ['BaseArch'] @register class BaseArch(nn...
1241e30d6138966308d426b8b7bef2732ac96436b7623874edafcb5e4b9583b5
Python
4,337
97
# -*- coding: utf-8 -*- """ Created on Fri Nov 12 15:51:52 2021 @authors: Maxim Filimonov, Irena Spasic (School of Computer Science & Informatics, Cardiff University, Cardiff, CF24 4AG, UK) @contact information: spasici@cardiff.ac.uk, filimonovm@cardiff.ac.uk """ from cmath import inf import json import os import arg...
6ec9bccd23719986f379e03aa267a2da1a8206d55fc644070ae025a566928c57
Python
4,341
143
# saved as /n/groups/marks/users/david/res/model_save//RES_1638990570.3313198_32.pt import gvp from atom3d.datasets import LMDBDataset import torch_geometric from functools import partial import gvp.atom3d import torch.nn as nn import tqdm, torch, time, os import numpy as np from atom3d.util import metrics import skle...
9038356182bef70626035267220ebb00ff300a66eb44eb4adb2b316dc2475ecb
Python
4,341
219
"""Kernels and kernel pairings using KeOps genred.""" import geomstats.backend as gs from geomstats.varifold.base import Pairing if gs.__name__.endswith("pytorch"): from pykeops.torch import Genred else: from pykeops.numpy import Genred from .._device import get_device, to_device def GaussianKernel(sigma):...
ffb936927ebf7c02d186a3c4035e3af8ab46bec867a8f98d38aef912a8e7434e
Python
4,342
174
from sklearn.metrics import roc_curve, auc import seaborn as sns from matplotlib import pyplot as plt import numpy as np import pandas as pd import os from sklearn.decomposition import KernelPCA from config import RESULT_PATH def plot_multiclass_roc( y_test, y_pred, n_classes, figsize, name, c...
50a407b24ef5a50a286374183657c17a9bc84469a8e76ccf9e14825b57e2e494
Python
4,343
108
################################################################################ # Import, Set up MPI Variables, Load Necessary Files ################################################################################ import os from os.path import join import sys import matplotlib import matplotlib.pyplot as plt from matp...
3d78575924ec7f980f97ec9d5f55c11a183bef7fd0f70841d08003362785758e
Python
4,344
112
# ############################################################## # This file is received from # https://github.com/DmitryUlyanov/deep-image-prior/blob/master/models/skip.py # It is the implementation of the following study: # https://arxiv.org/abs/1711.09485 # The code is licenced under Apache 2.0 licence # https://git...
c956aa471134d4d3a30ed202aa8401d675c79fc81f6a56d30a5b7bb5eabb3e3e
Python
4,344
128
# Author: Guoqing Bao # School of Computer Science, The University of Sydney # Date: 2019-12-12 # GitHub Project Link: https://github.com/guoqingbao/Pathofusion # Please cite our work if you found it is useful for your research or clinical practice import os # os.environ["CUDA_VISIBLE_DEVICES"]="0" import gc gc.enable...
1363cbc47184e13cdc5fb4614c12f7374fe920316094afe0d1e14d73c6522839
Python
4,346
99
# Copyright (c) 2019, 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 ...
59d104ad1465c309bf53a1dda3aa32e12452392224dc95099db9ffb18a44f9ae
Python
4,347
117
# Copyright (C) 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" import torch import keras class CNNModel(keras.Model): """ A custom Keras model for a Convolutional Neural Network (CNN) that overrides the `train_step` ...
5be799fb661a039642bad9f8716866dbaa6eb1976fec23e69878b7d266091b0f
Python
4,348
117
""" This file removes the need for torch_cluster, but it forces this operation to CPU. For inference, this is ok. For training, we still need torch_cluster for the speed. The code is copied from: https://pytorch-geometric.readthedocs.io/en/1.3.1/_modules/torch_cluster/knn.html """ import torch from scipy.spatial impor...
1f44354e5c0d21dd202621e11f04b7e3c6c526d1b124b80e6ca09decad6224af
Python
4,350
119
''' Colorize logger messages depending on the log level. Usage: just import this module. This code was stolen and modified from: https://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output ''' #!/usr/bin/env python # encoding: utf-8 import logging # now we patch Python code to add color support t...
6ebb66cea98c300348179c227ec2e047584a077a1392c9b4612f9a26eb733718
Python
4,352
112
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Geometric median module.""" import numpy as np from openfl.interface.aggregation_functions.core import AggregationFunction from openfl.interface.aggregation_functions.weighted_average import weighted_average def _geometric_median_obj...
ef4642009aa49b52139e4482c2f66c16273b93420ec9a11a0512d482cafa79c6
Python
4,352
168
"""solves using petsc4py""" import time import numpy as np try: import petsc4py.PETSc HAS_PETSC = True except ImportError: HAS_PETSC = False def petsc_mtx_from_scipycsr(m): """construct a petsc matrix object from a scipy CSR sparse martrix Parameters ---------- m : :cla...
d032eeb260c0c298b0c02e951d34b09448f0978e476d185473e8522e74b17f3f
Python
4,353
140
import numpy as np import os import subprocess import json import argparse import glob def init_args(): parser = argparse.ArgumentParser() # params for testing assert allclose parser.add_argument("--atol", type=float, default=1e-3) parser.add_argument("--rtol", type=float, default=1e-3) parser.add...
d02ab7e7572410e6f2f4aa598a4efa1a33d5a59c60fe3ac892fcb8bc935d2e97
Python
4,355
92
from tqdm import tqdm import numpy as np import pandas as pd from scipy.stats import ortho_group from typing import Optional from numpy.typing import ArrayLike from theory_simulation.regression import regression_performance def run_simulation(dim_nat: int = 30, dim_eco: int = 20, dim_exp: int = 3, ...
10ef9292db687f0d98977a862f820f373cb7b42e3c0e77230b063f91ec26ead6
Python
4,357
105
# Copyright (C) 2024 Intel Corporation # Licensed subject to the terms of the separately executed evaluation license agreement between # Intel Corporation and you. from openfl.federated import PyTorchDataLoader class TemplateDataLoader(PyTorchDataLoader): """Template dataloader for PyTorch. This class should...