sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
17843d9c1532c2d32c79a0903580c3d8d727d0b20641e737543ae3959205682e
Python
6,207
129
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_BLOCK...
bbf21663ca257a6556157327bebaa0f9fc99fab7df447686ec1b6e6435481c52
Python
6,207
169
# 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...
e0154964dd5b09f9e24720779204351beea00335aa1ff557a9f628220294f3f7
Python
6,207
189
from abc import abstractmethod from typing import Optional, Sequence, Tuple from uuid import UUID from chromadb.api.collection_configuration import ( CreateCollectionConfiguration, UpdateCollectionConfiguration, ) from chromadb.api.types import Schema from chromadb.types import ( Collection, CollectionA...
ff3c2d519ce2b0e4120fb97ffbe407ae7ed5dd4ef0dd33a4fd9e2554a10e53ff
Python
6,209
168
# 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...
2ff11e8ccdefa2e9e34d1d9e6a75b48afc3d8855534f58c54caa77b4cc0fa1e9
Python
6,210
179
"""The stage-two loss weights are the ones the flags asked for. `--swa_energy_weight` and its siblings only take effect after the stage-two swap, which is why no end-to-end run pinned them: a short training either never swaps or swaps into a loss nobody inspects. `get_swa` is where the flags become a loss, so that is ...
da82e4ad48cfd7c525d8c2bd2d8f6c7ffbc43199203d3dee59bad3ff4c1363bc
Python
6,214
167
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import subprocess import time import traceback import logging import paramiko log = logging.getLogger(__name__) # Suppress paramiko logging logging.getLogger('paramiko').setLevel(logging.CRITICAL+1) def run_command_background( cmd, r...
0d9470f3f68dce38c0bed84a79e5bb80294f1846e3547edea0a4d66789e9368d
Python
6,215
177
# 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 e3nn.o3._irreps import Irrep, Irreps from nequip.data import AtomicDataDict from typing import Optional """ Migrated from https://github.com/mir-group/pytorch_runstats """ def _broa...
28ff41ba427ae8909f7a10ebaf33138fcc700a1603d6ce3d8993916b4403c795
Python
6,216
182
"""Online kmeans algorithm on Manifolds. Lead author: Alice Le Brigant. """ import logging from sklearn.base import BaseEstimator, ClusterMixin import geomstats.backend as gs class OnlineKMeans(BaseEstimator, ClusterMixin): """Online k-means clustering. Online k-means clustering seeks to divide a set of ...
29ee92e5c9fdef42353bf4313f4124e708cb14c09553e6a4c26e10f6b1fea8f3
Python
6,216
225
r"""Integrator functions used when no closed forms are available. Lead author: Nicolas Guigui. These are designed for first order systems of ODEs written as a spatial variable :math:`x` and a time variable :math:`t`: .. math:: \frac{dx}{dt} = force(x, t) where :math:`x` is called the state variable. It may rep...
655888c7b1df82d2356cf2dd0e2acc66cd81bf2215ff33dc2720712d8af0af55
Python
6,219
185
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. """Custom OmegaConf resolvers for nequip.""" import logging from omegaconf import OmegaConf, ListConfig from typing import Dict, Callable, Set, Any, Optional from nequip.utils import get_project_root...
485e96c693e6dee58e88f95e44ce8f10ff53a8db0a2361e9949a024f1fab14fa
Python
6,223
159
"""The fragment `vdjdb-web` serves, produced by pandoc rather than by string surgery. Any one of these failing silently blanks ``/overview``: the Scala side matches each image with a regex that does not cross newlines, deletes nothing itself, and reads the fragment by a fixed filename. They used to be properties of a ...
8f6a55093f4f768f359586f645ce41f707b0807cc008868388efa6928d801fdb
Python
6,223
124
""" Parameter Sweeps ================ In this tutorial, you will learn how to use the :code:`pyrates.grid_search()` function, which allows you to perform simulations of multiple parametrizations of a model in parallel. You will learn in which ways you can specify your parameter grid, how you can customize your simulat...
9910e5b3188516ad209d39fa7b12547674afccac6bd12a28f21a901f567916f1
Python
6,224
129
import os import sys # supress warnings about having no GPU os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf import logging # suppress warnings about tf retracing tf.get_logger().setLevel('ERROR') logging.getLogger('tensorflow').setLevel(logging.ERROR) import pandas as pd import numpy as np import anarc...
66f850319c1a310b0014287142144645e850c5cdcdc5dccb801d29cf49232c5e
Python
6,229
121
"""Independent-study evidence: what counts as replication, and what does not.""" from __future__ import annotations import polars as pl from vdjdb.assemble.evidence import build_evidence, independent_study, support_counts from vdjdb.schema import EVIDENCE_TABLE_COLUMNS def tables(*rows: tuple[str, str, str, str]) -...
02f7eccaf7faa289a15f73e11719c36557219a980dc1559d7cec948740bdbbee
Python
6,231
175
import numpy as np from scipy._lib._array_api import array_namespace, xp_capabilities from scipy.interpolate._cubic import CubicHermiteSpline, prepare_input @xp_capabilities( cpu_only=True, jax_jit=False, skip_backends=[ ("dask.array", "https://github.com/data-apis/array-api-extra/issues/488") ...
577076b4003f53c9efbac832c6199aeb7ba27400cf510afb4f7bab55eb66f86a
Python
6,232
225
import logging import scipy import geomstats.backend as gs from geomstats.exceptions import AutodiffNotImplementedError from geomstats.numerics._common import result_to_backend_type from ._optimization import Minimizer, RootFinder class ScipyMinimize(Minimizer): """Wrapper for scipy.optimize.minimize. Onl...
9886f55861eeae2bbf2f597b5457bf46ce2faa945da1c6988c55086a7a3f14e0
Python
6,233
159
#!/usr/bin/env python3 """Render the canonical-kwarg vocabulary into the docs from one source. `docs/_data/api-vocabulary.yml` is the single machine-readable source of truth for the canonical-kwarg vocabulary. This script renders it into a hand-authored doc, replacing the content between `<!-- AUTOGEN:api-vocabulary:<...
2333775734ff6d314434c4588290f1002f0fbe16d7d6ca0fb2c0e570427e68da
Python
6,234
192
# Copyright (c) 2019 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...
b2f0a23f3009ec32ffc27279c89b7cbc2646c49884b66b044fb4d3f4616f0d17
Python
6,235
174
""" Select a region of interest (ROI) by thresholding the intensity signal. """ import numpy as np import matplotlib.pyplot as plt from skimage import measure import shapely.geometry as geo import argparse import neo import os from utils.io_utils import load_neo, write_neo, save_plot from utils.parse import none_or_st...
44c1d680b9298bddc660a4afba014c4ea5a34b4fb5caa9c6e4f43cbdb132e0a6
Python
6,236
154
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
0c7cc63d53693ca8e41c744c121037f20b5f4068a766e4be0ea3e83368e3c225
Python
6,237
167
# 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...
729c11207f9d3293eb9ae6fdb6eb5dc97f85df645cff86354c7e3d29be099fca
Python
6,245
205
"""filter_remapped_reads This is a rewrite of the official WASP code, which no longer requires a .num.gz file. This code is compatable with the rewritten version of the first step (find_intersecting_snps), which no longer generates the .num.gz file. The bam file of remapped reads must be sorted by read name. """ from...
c408f1bc240c04aadb4941f54ffe33846518e35c45a9cacb046113bbab1d6e76
Python
6,248
153
import glob, numpy as np, matplotlib.pyplot as plt, cv2.cv2 as cv2, seaborn as sns import keras.callbacks as cb from keras.applications import ResNet50, DenseNet121, NASNetMobile, Xception from keras.preprocessing.image import load_img, img_to_array, ImageDataGenerator from keras.layers import Dense, Flatten, GlobalAve...
3a5741038694bc23d6bffb72c87b7fc52350fafacf76e171733b82b475245645
Python
6,249
191
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openfl.experimental.workflow.interface.fl_spec import FLSpec from openfl.experimental.workflow.interface.participants import Aggregator, Collaborator from openfl.experimental.workflow.runtime import LocalRuntime from openfl.experime...
31167441b772e6858f5d9ff70ecebc75a9584cd33ee767f2b98b4d81b4dd0154
Python
6,252
211
import sys import json from tqdm import tqdm import pickle import os import pandas as pd sys.path.append('../') from utils import * from processing import * import numpy as np import random from joblib import Parallel, delayed from pyimzml.ImzMLWriter import ImzMLWriter from pyImagingMSpec.inMemoryIMS im...
20fecaccad43150398c69a90b3ddef6f5c908c17eed98eb28ba157af4499d9d7
Python
6,253
161
import importlib import numpy as np import torch from mace.tools.torch_geometric.dataloader import DataLoader as _TgDataLoader # --- Optional torch_geometric support --- if importlib.util.find_spec("torch_geometric") is not None: from torch_geometric.transforms import BaseTransform # pylint: disable=import-erro...
7f87feaebbd014860e1553ffcf5418e2dd3a379b27786558fc8e1ce4a3f0bcc1
Python
6,254
198
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.18.1 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # %% [markdown] # # REINVENT4 tutorial u...
0a2e81f07a2ca008201e94843a2d48e44c0ef0483a9c30384ad3ac45995228fa
Python
6,256
202
import click import six from copy import deepcopy from corgie import scheduling, argparsers, helpers, stack from corgie.log import logger as corgie_logger from corgie.layers import get_layer_types, DEFAULT_LAYER_TYPE, str_to_layer_type from corgie.boundingcube import get_bcube_from_coords from corgie.argparsers impo...
a4e94a3ac32202128ae6b25e9f2b871cf9d586f16913a422825aa830b270186d
Python
6,257
182
from chromadb.api.types import ( Embeddings, Embeddable, EmbeddingFunction, Space, is_image, is_document, ) from typing import List, Dict, Any, Optional import os import numpy as np from chromadb.utils.embedding_functions.schemas import validate_config_schema import base64 import io import impor...
990e0a136362446b6642952ef2bcd8e8eb9df1198d34c5c04f8a727a44d9e924
Python
6,258
182
# SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2020-2026, Christian Gaser. See LICENSE. """ Exact threshold-free cluster enhancement. The TFCE of an element is the integral TFCE(v) = int_0^{t_v} e_v(h)^E h^H dh over the extent e_v(h) of the cluster containing v at height h. Implementations normally appr...
afddca3fda677ce8a76a7600f238084200d395e68940547e9ad002bdef254d76
Python
6,261
175
""" Select a region of interest (ROI) by thresholding the intensity signal. """ import numpy as np import matplotlib.pyplot as plt from skimage import measure import shapely.geometry as geo import argparse import neo import os from utils.io_utils import load_neo, write_neo, save_plot from utils.parse import none_or_st...
62779323d4f7f281f253684039300bbec00cd7c57da1b2287824286e238ddb45
Python
6,263
157
import torch import torch.nn as nn import torch.nn.functional as F from torch_scatter import scatter from torch_geometric.nn import global_add_pool from torch_geometric.nn.models import schnet from torch_geometric.nn import radius_graph, MessagePassing from ogb.graphproppred.mol_encoder import AtomEncoder, BondEncode...
9e4ef276028230751854307688087a60ad049595c6f6d4b35fe99b30d9b8fe9c
Python
6,263
210
""" HRF Functions ============= Various Hemodynamic Response Functions (HRFs) implemented by NiPy Copyright (c) 2006-2017, NIPY Developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistr...
a59d6a422b648ea599a2cc586a70eabf880ceec1d168d2ac393ee09300b2c671
Python
6,264
201
import numpy as np import pandas as pd from neuron import h from src.constants import DISTANCE_LABEL, SECTION_LABEL, TIME_LABEL, VOLTAGE_LABEL from src.data import is_long_form, wide_to_long from src.utils import nearest_idx, nearest_value def calc_tail_current(ik_np: np.ndarray, t_np: np.ndarray, vclamp: h.SEClamp)...
f96698341c612a6f5215a4ce42502cfad2d4dd20f138628f9484e3fafc85024e
Python
6,264
167
# 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 math from dataclasses import dataclass, field import torch from fairseq import metrics, utils from fairseq.criterions import FairseqCr...
6a85dd995f9130ef84f01ae0e567c51c335fe51962834fd033257c1ee8992b07
Python
6,276
184
import math import numpy as np from scipy.signal import butter, sosfilt, sosfilt_zi BP_ORDER = 2 _BUFFER_DURATION = 30 # seconds class _Scope: """ Class representing a base scope. Parameters ---------- stream_receiver : neurodecode.stream_receiver.StreamReceiver The connected stream r...
51745468f80547c3205e9f0f9db42c30fdfd9dc6cb5020059650bec6d4d618ca
Python
6,279
160
#!/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...
900683830cdbc8f77e557eef8cf488d265a6087682c71df325e74a67a9e1eeb8
Python
6,280
155
"""The `vdjdb` command surface. `cli.py` had no test at all: 173 statements, 0 % covered, while being the only way anyone runs this build. These cover what can be exercised without a full build - argument handling, the projections of the field registry, and the exit codes callers and workflows depend on. The expensiv...
50d20a3a1fc45ff421fa945781e16243763473b79b413232f9721a75a63a3b0a
Python
6,281
207
########################################################################################### # Statistics utilities # Authors: Ilyes Batatia, Gregor Simm, David Kovacs # This program is distributed under the MIT License (see MIT.md) ########################################################################################...
880463521a618e2db1efd7ca71aec48a68d381a4cdb8145da0745377b9d41ded
Python
6,282
148
from PymoNNto.Exploration.Network_UI.Network_UI import * from PymoNNto.Exploration.Network_UI.TabBase import * class sidebar_neuron_grid_submodule(TabBase): def __init__(self, add_color_dict): self.add_color_dict = add_color_dict self.compiled = {} for param in self.add_color_dict: ...
5ff3c524a34931d5d5ba323b5bd0ef2a5df35ff57e4a7b8c605b1b91c63ee27a
Python
6,283
197
""" This module contains an MQTTClient class that inherits from paho.mqtt.client.Client. The client is created in the mqtt.init function, and can be referenced at mqtt.client. mqtt.mqtt_json_callback is useful when the incoming message payload is a JSON string. """ import paho.mqtt.client as paho import logging impor...
2af6291bbcff42a95cc25a7d91223044b53151b4394765972347e05626472341
Python
6,284
181
# 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 # from IPython import get_ipython import os # os.environ["CUDA_VISIBLE...
a44bcdef26805eeb199df5c5ea14e1b7815e7996a3d35326d0bd4e254c9fd17d
Python
6,285
180
import tensorflow as tf class EEGNet(tf.keras.models.Model): def __init__(self, num_channels, num_samples, dropout_rate=0.5): super(EEGNet, self).__init__() self.firstconv = tf.keras.layers.Conv2D(4, (3, 1), padding='valid', input_shape=(num_samples, num_channels, 1), use_bias=False) self.d...
f71a8184e326beab10644ec5f082c7bcd6bce3108c2ca965414714b32bcd5be6
Python
6,285
178
"""Convert the components dictionary into an internal data structure""" __all__ = ["get_components"] from dataclasses import dataclass from collections import defaultdict from typing import List, Dict, Optional, Tuple, Any import logging from .importer import get_registry from .transforms.transform import get_transfo...
13d9964213a191d2ecb175cffa00a8d64c926cbd52f4dc0f1cd126b755695d86
Python
6,286
182
""" Based on: https://github.com/hewittwill/ECGXMLReader """ import array import base64 import os from collections import OrderedDict import numpy as np import xmltodict def find_substrings(substring_list, text): res = [substring in text for substring in substring_list] return int(any(res)) class ECGXMLRea...
fab876f49aee88b97a54813945cbe81500f3873341e375b2e552961805c01c44
Python
6,295
151
""" The GOOD-Motif dataset motivated by `Spurious-Motif <https://arxiv.org/abs/2201.12872>`_. """ import os import os.path as osp import gdown import torch from munch import Munch from torch_geometric.data import InMemoryDataset, extract_zip class GOODMotif(InMemoryDataset): r""" The GOOD-Motif dataset motiv...
3067a9cdcbe437d4f866bbec01bad4af78e051a7123ef32e1ce4877e08661d1f
Python
6,297
187
import torch import torch.multiprocessing as mp import torch.distributed as dist import torch.nn as nn from typing import List from collections import namedtuple import os from model_angelo.utils.misc_utils import filter_useless_warnings from model_angelo.utils.torch_utils import get_model_from_file, compile_if_possib...
52b114262174e99690fc05fd22ec6ad2859abe62265d24c3d20d1d7282e9d575
Python
6,298
172
"""A training set smaller than one batch fails where the cause is, or trains. `drop_last` throws away an incomplete final batch. When the set is smaller than `--batch_size` that is the only batch, so the loader comes out empty and the run cannot train. It used to say so several frames away, in `compute_avg_num_neighbo...
74c590a23e6ac82725838db0df986aaaa81699855b20fd52db5cb27e06ececf2
Python
6,298
207
import utils import torch from torch.utils.data import DataLoader import database import glob import argparse import Networks import collections import train import pickle import calibration import yaml import subprocess as sp functions_nn = {'gru2_bohb': Networks.gru2_bohb.gru, 'gru_bohb': Networks.gr...
31266b5c1c59db5bc00cd7f435127e05809893ace52991f603a84125e87997d9
Python
6,300
204
"""Riemannian mean-shift clustering. Lead author: Nina Miolane and Shubham Talbar. """ import joblib from sklearn.base import BaseEstimator, ClusterMixin import geomstats.backend as gs from geomstats.learning.frechet_mean import FrechetMean class RiemannianMeanShift(ClusterMixin, BaseEstimator): """Class for R...
2849bef5761dd3c0ecec24c7e3e5fbd9996d19942e40782a9bb78e0461a05926
Python
6,303
163
from pathlib import Path import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np import os palette = sns.color_palette("tab10") saving_folder = os.path.abspath('results') # Control separability for non-purified mAbs. if True: # Create an array with the colors you want to use ...
4de06c081335bf5711c5b4e2b274c575f5184d80ccda58529cb2982895a3d2e3
Python
6,304
126
import torch from torch.utils.data import DataLoader,TensorDataset import pandas as pd from modelClasses import * from utilityFunctions import * # torch.backends.cudnn.deterministic = True # torch.backends.cudnn.benchmark = False os.environ['CUDA_LAUNCH_BLOCKING'] = '1' if __name__ == "__main__": # which session...
530dddc4f02a93f5fd7147ece1a4e8b0be2d814037b776b3d40b2aff0d3d3559
Python
6,304
176
""" Select a region of interest (ROI) by thresholding the intensity signal. """ import numpy as np import matplotlib.pyplot as plt from skimage import measure import shapely.geometry as geo import argparse from pathlib import Path import neo import os from utils.io_utils import load_neo, write_neo, save_plot from util...
1513d61433e7665b09deedd6ca5e581c31367ac09c4e3d4ca7b4173157a91285
Python
6,306
179
# 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...
3c8cd56d5e5c5623273e82cdf524e6ba974a783f34ab69e546d97f01bf8726fd
Python
6,308
119
"""The reference diff between two releases: the database changelog (#432). Not a code changelog. A reader of a VDJdb release wants to know which studies arrived, how many records each brought, and what the totals now are. The publication years are already a committed input: :mod:`vdjdb.summary.references` resolved th...
5a350a9ac72a7390de4cc4fb4e5d408646370a54a925eb05243a58a2589f3c37
Python
6,309
156
# Copyright © 2023 German Cancer Research Center (DKFZ), Division of Medical Image Computing # # SPDX-License-Identifier: Apache-2.0 from radtract.features import load_features from sklearn.model_selection import LeaveOneOut, StratifiedKFold from sklearn.feature_selection import SelectKBest, f_regression from sklearn....
e179a1b9f3c54d7f19aa097dc8618c78c115f3b149f1f2b89fe91fd8d4bee4db
Python
6,309
171
"""`torch_tools.default_dtype` puts the process default back, exception or not. The default dtype is process-wide, and this scope guards code that raises. `MACECalculator.calculate` runs inside it, in nine places across the two calculator classes, and so does every converter entry point -- which sets the default from ...
c06f74310a6c35b154ac526f160073ccc537dd7fed402011f9dd71fcb2206129
Python
6,310
122
import tensorflow as tf import tensorflow.keras.backend as K def get_loss(pred_train, model_configuration, y_pred_names, other_outputs, pos_weights): global_pooling = model_configuration["global_pooling"] if "loss_type" in model_configuration.keys(): ...
6dbaf2a096f417d5eefb95102123a929e09aa6677246e53faa9944b96e78ee23
Python
6,311
163
#### make_local_connectivity_ones.py # Copyright (C) 2010 R. Cameron Craddock (cameron.craddock@gmail.com) # # This script is a part of the pyClusterROI python toolbox for the spatially # constrained clustering of fMRI data. It constructs a spatially constrained # connectivity matrix from a fMRI dataset, where then con...
f1e6b911ed9f9725616626e865a60855c9a9fd0e140579fd6b48a43c3860b625
Python
6,313
196
"""Compute various scores with RDKit""" import itertools from typing import List, Callable import logging import numpy as np from rdkit import Chem from rdkit.Chem import AllChem as Chem, Crippen, Descriptors, Lipinski from ..component_results import ComponentResults logger = logging.getLogger(__name__) def num_s...
dfceea11495cc409762a3f12dd840e8d9bdbe253ea737fc8b3cabb20134daa4b
Python
6,315
204
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # OS stuff import os import sys import warnings from pathlib import Path # Computational stuff import numpy as np import matplotlib as mplb import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec from matplotlib import font_manag...
84dd4742adaf61189d3541e72d4736495a12ace809a40f0e5dd8597638e08226
Python
6,317
180
"""GNC backend dispatch. Each backend module implements GncBackend.""" from pathlib import Path from typing import Protocol import nibabel as nib import numpy as np from lib.gnc.backends import gradunwarp, tortoise from lib.utils import force_remove class GncBackend(Protocol): """Interface every backend module...
24e88757e7ad1c06d5afbd5dd7f1f51a505fd41cb82279e17ba222c5b1e990b3
Python
6,321
195
import pytest from pathlib import Path import torch from reinvent.runmodes.RL.run_staged_learning import run_staged_learning from reinvent.runmodes.utils.helpers import set_torch_device SCORING = { "type": "custom_product", "parallel": 1, "component": [ { "custom_alerts": { ...
5c190daa39cb3687fb07d1aef7de331a5d02756cae3631c79220cc5ad8f4109e
Python
6,324
151
"""Which ``les`` produced a number, and whether it is the one installed now. The LES goldens are the only ones in this directory whose value depends on a package outside this repository. ``MACELES`` predicts latent multipoles and then hands them to ``les.Les``, which does the Ewald sum and the Born-charge derivative; ...
dafb091c1c0988b333fa98ddf044be234e8a7e0fde49ea0c07f0cf207610a264
Python
6,325
111
"""Render the release dashboard and verify the fragment `vdjdb-web` will serve. Three steps, each able to fail the build on its own: 1. ``rmarkdown::render`` on ``summary/vdjdb_summary.Rmd``, pointed at the legacy projection of this build, with ``clean = FALSE`` so knitr's intermediate survives. The render makes n...
2a9866bedc2d325bb59d382bb21ed48d636352cc38e08a52e0f6b586984bddd7
Python
6,326
189
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import torch from torch import nn from typing import Optional from utils import logger import math from .identity import Identity from .normalization import ( BatchNorm1d, BatchNorm2d, SyncBatchNorm, ...
c63fab2c982c9ccd9b153d6291c2e5c024a31d3cf17b8178e684be1d5ef35f8c
Python
6,326
178
""" This module is responsible for correcting the distortion of the camera lens using existing functions from Open-CV. As the camera is located close to the target, and captures a relatively wide angle frame, the barrel distortion is significant. The function get_distortion_matrix analyzes images that contain a checker...
0f96d7f8be60411f77a558fd4b2692e0ed4105dbec5d9ace10128d381061814a
Python
6,333
210
"""The Visualization Package.""" import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # NOQA import geomstats.backend as gs from geomstats.visualization.hyperbolic import ( KleinDisk, PoincareDisk, PoincareHalfPlane, ) from geomstats.visualization.hypersphere import C...
0e925cd9ee1539c6514cd1e2df3245d80b746d00b37837f74e2cd7d3bb498330
Python
6,334
204
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import random import argparse from typing import Optional import numpy as np from common import DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT from . import register_sampler, BaseSamplerDDP, BaseSamplerDP @register_...
4a96ab7ad0d59c7044a356b6f55f7179936afef0493c97b36eb16de34f257f1e
Python
6,334
126
# -*- coding: utf-8 -*- #%% import functions.rate_coding import numpy as np import functions.Graphs import matplotlib.pyplot as plt import pandas as pd import functions.statistics_test as st #%% Load data data = np.load('/datapath/dataset.npy', allow_pickle=True).item() #%% 1C Behavioral performance pe...
c1611053c084f390d048098d4e6315ac51dd9ac7b40a8b77db4ad9d3881622b2
Python
6,335
152
import os import torch import numpy as np from tqdm import tqdm from torch_geometric.data import DataLoader from .utils import generate_xyz class Mol3DTrainer(): def __init__(self, train_dataset, val_dataset, configs, device): self.configs = configs self.train_dataset = train_dataset self....
43d3338922e2a1336ed7856e312c1cbfe0aaf2eba3b8f3ddfabd60741a19cfbd
Python
6,338
125
# 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 nest import nest.raster_plot import matplotlib.pyplot as plt from nest_elephant_t...
25c3080a104fec61fbb81d581f6bfdc8fa6af73ca0d0a9f0535871a902973a55
Python
6,340
190
"""Inception makes use of SMILES to speed-up optimization Inception is the idea that an initial set of SMILES will guide optimization towards wanted structures and so speed-up learning. The SMILES will be kept in memory depending on their score. Only the N most high scoring SMILES will be retained. This typically m...
d35599f62a4c36d454b94c31e293e0f1af157f99d8f86c6eb2a15eec3291a11a
Python
6,342
140
from typing import Callable, Sequence, Union from functools import partial from jax import vmap from jax.tree_util import tree_map, tree_transpose, tree_structure from jax._src.api_util import check_callable, argnums_partial, _ensure_index from jax._src.util import wraps from jax._src import linear_util as lu from jax....
7322373a2302675424e45e4759289cfcc1cf356a02b1685b3d995ce254fa55cb
Python
6,346
200
import torch.nn as nn import torch.nn.functional as F import torch from scipy.io import savemat class Down3d(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv = nn.Sequential( nn.Conv3d(in_channels, out_channels, kernel_size=3, stride=2, ...
f0502d0c026c6aa53f02ea7cbb8780a979351b31088409fe74f7531bcbe74da2
Python
6,346
170
import string from pathlib import Path import matplotlib.pyplot as plt import numpy as np import torch from matplotlib import cm from scipy.ndimage import rotate, shift import mlspm.preprocessing as pp from mlspm.datasets import download_dataset from mlspm.models import EDAFMNet # # Set matplotlib font rendering to...
30abf53c736128d75377ba3378c645e22ccce13d91051bae1d647ad5ada8ee50
Python
6,355
185
import torch import torch.nn as nn import torch.nn.functional as F import rdkit.Chem as Chem from .nnutils import * from .chemutils import get_mol ELEM_LIST = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'Al', 'I', 'B', 'K', 'Se', 'Zn', 'H', 'Cu', 'Mn', 'unknown'] ATOM_FDIM = ...
9179aecc3b35adf7ea902de4aa804dedb96918376f19d303ac6f6c4c1948640d
Python
6,355
180
# 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 math import torch import torch.nn.functional as F from fairseq import metrics, utils from fairseq.criterions import FairseqCriterion, ...
bf9b0cc00f98b617e177a5cbebf0688c1278f75cac7958845016b78dc73664a9
Python
6,358
168
from math import pi as PI import torch import torch.nn.functional as F from torch.nn import Embedding, Sequential, Linear from torch_scatter import scatter from torch_geometric.nn import radius_graph class update_e(torch.nn.Module): def __init__(self, hidden_channels, num_filters, num_gaussians, cutoff): ...
c557a79dab3c64b767a96f51562314459064d75cbe95a15d496f7048f1dadc89
Python
6,359
176
from typing import Optional from torch_geometric.typing import Adj, OptTensor import torch.nn.functional as F from torch.nn import ModuleList, Linear, BatchNorm1d from torch_geometric.nn import GCN2Conv import torch from torch import Tensor from torch_sparse import SparseTensor from ..models import ScalableGNN cla...
890a937157be562c7d529987529f3d13e044d3271ad6bef2e02a998568e9c9f3
Python
6,361
242
import tensorflow as tf def lrelu(inputs, leak=0.1): with tf.variable_scope('lrelu') as scope: return tf.maximum(inputs, leak * inputs, name=scope) def fc( name, inputs, n_hiddens, bias=None, ): # Weight initializer weight_initializer = tf.variance_scaling_initializer( sc...
d97110403ab8ac589a6d539c47279494a05209aad0309b915ac4181a419f145e
Python
6,363
210
import click from corgie import scheduling, helpers, stack from corgie.log import logger as corgie_logger from corgie.layers import get_layer_types, DEFAULT_LAYER_TYPE, str_to_layer_type from corgie.boundingcube import get_bcube_from_coords from corgie.argparsers import ( LAYER_HELP_STR, create_layer_from_spe...
4447642e1e7162acf666c3f5a1afc42b69f7aa2776c7fe8915b5685bf89fd2aa
Python
6,364
207
import logging import numpy as np import torch import yaml from matplotlib import pyplot as plt from scipy.stats import truncnorm from typing import Optional, Tuple, Union, Iterable def get_deg2pix_coeff(run_params: dict) -> float: view_angle = run_params['view_angle'] resolution = run_params['resolution'] ...
42ffb06eb22fa29358b74bfe9f1fbfc0f9ad8686ce19c33965439f6a86717a20
Python
6,365
181
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) import brainscore.benchmarks as bench from brainscore.metrics.regression import linear_regression, ridge_r...
fec08bc99bb3975b409d89668933a6eac213630e2cb7b86a90775b333dfc7966
Python
6,365
115
######################################################################## class Basic: """ Contains the basic parameters for the online modality of Motor Imagery protocol """ #------------------------------------------- # PATH TO SAVE DATA #------------------------------------------- params0 ...
7bdbe08e031ae2567fdcc45da5240313245ce54d695fb804c6852753d4b17cce
Python
6,367
151
""" Detect trigger times (i.e., state transition / local wavefronts onsets) by finding crossing of a set phase-value in the channel signals. """ import argparse import neo import numpy as np import quantities as pq from scipy.signal import hilbert from scipy.stats import zscore import matplotlib.pyplot as plt import ...
079005fb5e774fca92425ad01cf1d0fa9f3e00a07dcd80b68fa6b24e33359f80
Python
6,374
167
import cv2 import os import json from tqdm import tqdm import numpy as np provinces = [ "皖", "沪", "津", "渝", "冀", "晋", "蒙", "辽", "吉", "黑", "苏", "浙", "京", "闽", "赣", "鲁", "豫", "鄂", "湘", "粤", "桂", "琼", "川", "贵", "云", "藏", "陕", "甘", "青", "宁", "新", "警", "学", "O" ] alphabets = [ 'A', 'B', 'C', 'D', 'E', 'F', ...
64aeb443621967724a40dbade6be56d255f0e7af94d89eca59e38a47643f033f
Python
6,374
182
import collections import numpy as np import renderapi from ..schemas import * from ..utils import make_dbconnection, get_matches import time import matplotlib matplotlib.use('Agg') from matplotlib.backends.backend_pdf import PdfPages from matplotlib.collections import LineCollection import matplotlib.pyplot as plt imp...
17237c3d2555bc63a7969f1be38cec3c73034b58331d5d2b446e70473a66047b
Python
6,376
198
import os from os import path import numpy as np import xml.etree.ElementTree as ET import re from tqdm import tqdm import pickle import requests import io import matplotlib.pyplot as plt import pandas as pd import sys sys.path.insert(0, './') from pyImagingMSpec.inMemoryIMS import inMemoryIMS def loa...
b09556c6d8921af1cf09e6442257d3aa0c4b52278dad10fa156a4122cf03ea6e
Python
6,377
138
import torch import torch.nn.functional as F from torch import nn from torch_geometric.nn import MessagePassing from torch_geometric.nn.aggr import Set2Set from torch_geometric.utils import scatter from torch_geometric.nn.pool import global_add_pool, global_mean_pool, global_max_pool from torch.nn import Sequential as ...
ee0b1350e2eb2da14b1886fcd74857f302c307dd45fc71a235aa1516d90fa623
Python
6,378
162
# -*- coding: utf-8 -*- import os import argparse import logging import glob import numpy as np from data_functions import load_data, TwoPopAlignmentFormatter, load_data_slim, read_slim_out from mpi4py import MPI import h5py import time from collections import deque # use this format to tell the parsers # where to ...
49facb8b71236dfb1c19a96cbed4ce802bc32a280a656f222f4c7654a4ac890f
Python
6,380
178
from copy import deepcopy from math import log from corgie.log import logger as corgie_logger from corgie import scheduling, helpers from corgie.stack import PyramidDistanceFieldSet class BroadcastJob(scheduling.Job): def __init__( self, block_field, stitching_fields, output_field,...
740010041a90aabc9b7e1ef8c196b8aa2d869603dae14de788c759e61170f526
Python
6,380
192
# This coded was modified from the cuequivariance library: https://github.com/NVIDIA/cuEquivariance/blob/main/cuequivariance/cuequivariance/group_theory/experimental/mace/symmetric_contractions.py # SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifie...
19515ef597fe866974924993028eeed13e10dc2236bb1f5ea4dd5472926ff01e
Python
6,381
113
######################################################################## class Basic: """ Contains the basic parameters to train the Motor Imagery algorithm """ #------------------------------------------- # Data #------------------------------------------- params1 = dict() params1.upd...
56196708fe9a3b3058e57974b42c26b66a60c1671437e1921b82d6bbd57a0a36
Python
6,382
184
import tensorflow as tf import numpy as np import keras import pandas as pd import matplotlib.pyplot as plt from scipy.sparse.linalg import lsmr from Bio.Align import substitution_matrices import matplotlib.gridspec as gs def get_norm_prob(scores, t=1): # getting boltzmann probabilities using scores as energies. ...
95fd5e9767caa8844019838e158179c033d6f32ac60e26bc3ce0ecfc68ee94b3
Python
6,386
161
# R squared calculator from sklearn.metrics This has been isolated from sklearn so the App using it can be successfully compiled without the full sklearn package # due to hidden import errors # Modified for simple linear regression # BSD 3-Clause License # Copyright (c) 2007-2023 The scikit-learn developers. # All ri...
e752e02be8c7dfc198800190d198ebdde2e26b23052eef4665cfb00e3a81ac62
Python
6,388
173
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from math import sqrt, exp import lightning from lightning.pytorch.callbacks import Callback from nequip.data import AtomicDataDict from nequip.train import NequIPLightningModule from typing import List...
4995d7c98f0bedd7c0177704ed9dddcfa1c084d1fce25e8dd7e8ca12373498bb
Python
6,389
184
import tensorflow as tf import numpy as np import keras import pandas as pd import matplotlib.pyplot as plt from scipy.sparse.linalg import lsmr from Bio.Align import substitution_matrices def get_norm_prob_log(scores, t=1): # getting boltzmann probabilities using scores as energies. # assumes that all scores...
6872a1847893947e75e8e7a1480b1685801400cafacbd50c9bbee36d6160a526
Python
6,390
162
""" gathering the accuracy as a function of the weight quantization ideally, this script would be run the various results obtained with the trainig_task.py script """ from SHIP import ListHauler,lS_1o from torch import (tensor, arange, zeros, normal, ...
2bed58ac9f9d88d966453143b545d66ccedca25493de597b24cbbe3a94f80b8b
Python
6,391
140
import sys import argparse import tensorflow as tf import flammkuchen as fl import numpy as np from deepd3.core.analysis import Stack, ROI2D_Creator, ROI3D_Creator parser = argparse.ArgumentParser() parser.add_argument('stack', type=argparse.FileType('r', encoding='UTF-8'), help='File to be segmented') parser.add_argu...