sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4a150b23be5a3db28cdb9efc10945867b6af0cb1c5cfae14206969f782f82f78
Python
2,634
67
import unittest from reinvent.chemistry import conversions from reinvent.chemistry.library_design.fragment_reactions import FragmentReactions from tests.chemistry.library_design.fixtures import FRAGMENT_REACTION_SUZUKI, SCAFFOLD_SUZUKI from tests.chemistry.fixtures.test_data import ( CELECOXIB, ASPIRIN, CE...
c91129a57642f01595e8cb360769460f50ecf162fbfc330bf8c8cfc5f7fbbfd1
Python
2,636
89
from pathlib import Path import matplotlib.pyplot as plt import numpy as np import ppafm.ml.AuxMap as aux import ppafm.ocl.field as FFcl import ppafm.ocl.oclUtils as oclu from mlspm.datasets import download_dataset from mlspm.utils import read_xyzs if __name__ == "__main__": data_dir = Path("./edafm-data") # ...
4d4da77f0fd775ebb2e31bd04ddb3bda1fadaeb5252cc7bce430aec228aaadd0
Python
2,638
80
import datetime import os from execute import execute import requests import dateutil git = os.environ.get("GIT", "git") installed_commit_hash = None installed_commit_ts = None latest_commit_hash = None latest_commit_ts = None def _get_commit_hash(cwd=None): return execute([git, "rev-parse", "HEAD"], cwd=cwd) ...
b2f4d974bdd6b1af733875990a82edf710a3622a6171558b2f2367a0475b787d
Python
2,639
77
"""Sphinx configuration for REINVENT4 documentation.""" import os import sys # -- Project information ------------------------------------------------------- project = "REINVENT4" author = "T. Worakul, EPFL" copyright = f"2024, Molecular AI, AstraZeneca | {author}" release = "4.0" # -- General configuration --------...
c7a50913328dc4c1c045efea75aa3e93030de3fd4948b1bfefd6dd2c48ae1749
Python
2,639
74
''' Module focused on the creation of a custom dataset class in order to use our custom dataset for the problem of image recognition and thus classification. ''' import os import torch from torch.utils.data import Dataset from PIL import Image from torchvision import transforms # CUSTOM DATASET CLASS class Imagerec_D...
3a5a579c0e8b62780f2e3c6cb9759c80e3aa69d8945cd638c6e7ab8611cc3342
Python
2,640
93
import pandas as pd import matplotlib.pyplot as plt import numpy as np def plot_single_distribution( df: pd.DataFrame, column: str, title: str = '', xlabel: str = '', ylabel: str = '', bins: int = 30, alpha: float = 0.5, edgecolor: str = 'black', range: tuple = (0, 1) ) -> None: ...
2dd5b1c6fe44285ee19d7fb7344045ed195d0d398148156a3f52265bc7420452
Python
2,643
75
import logging from typing import Dict, Set from overrides import override import yaml from chromadb.auth import ( AuthzAction, AuthzResource, UserIdentity, ServerAuthorizationProvider, ) from chromadb.config import System from fastapi import HTTPException from chromadb.telemetry.opentelemetry import (...
3a8f5d81d34ba8e2fb0112468c22192099f5076f815467b1d8e8f09785186ebc
Python
2,643
42
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
725af95b9b3e69c7fcd60101cf1125b15ddeae2f342c6fca2ec7c4bd9d1df6d7
Python
2,647
42
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
b9832cc7df82e9798a857a2015f430f024be4c3d6a6e1b204839a135045a1a5e
Python
2,647
122
""" This is mostly from e3nn. """ import torch def matrix_x(angle: torch.Tensor) -> torch.Tensor: r""" From e3nn. matrix of rotation around X axis Parameters ---------- angle : `torch.Tensor` tensor of any shape :math:`(...)` Returns ------- `torch.Tensor` matrice...
fee23b4662b349b669bb68d5dbd0c77e5ddbb2017fa30b704f1b5c52008080bf
Python
2,647
98
"""Reference implementations for linear VAC and IVAC.""" import numpy as np import ref_corr from scipy import linalg def vac_all(trajs, lag): ct = ref_corr.ct_all(trajs, lag) c0 = ref_corr.c0_all(trajs) return symeig(ct, c0) def vac_all_adj(trajs, lag): ct = ref_corr.ct_all(trajs, lag) c0 = ref...
93db4e44563067329f050265108a4ca2a0f43873fe35bef0b85d94a85dade517
Python
2,648
65
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch import ase import ase.io from .. import AtomicDataDict from ..ase import from_ase from .base_datasets import AtomicDataset from typing import Union, Dict, List, Optional, Callable, Any ...
1208babc5c823ae1683a49c17ff14ff4337535e8ff9b3a236b2302cf5bed8092
Python
2,649
79
import torch as T import yaml import nibabel from monai.losses import DiceLoss, GeneralizedDiceLoss, FocalLoss, TverskyLoss from Networks.UNet4 import UNet4 from Networks.UNet5_filter_teacher import UNet5_filter_teacher from Networks.UNet5_decoder_teacher import UNet5_decoder_teacher from Networks.UNet_test import UNe...
6ad6699f718a241c897c9f3d4ce261ed5147889d918c656a28f632cf8311ec6c
Python
2,649
94
# 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...
00a79f8a3e303147e3cf498d0cf96422dae116ce3f7b88797ba101328e2caa14
Python
2,651
81
# Code from https://github.com/juho-lee/set_transformer import torch import torch.nn as nn import torch.nn.functional as F import math class MAB(nn.Module): def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False, dropout=0.0): super(MAB, self).__init__() self.dim_V = dim_V self.num_h...
8f1d58973a35d541a4824af57e3a24a313f68d90a31956dc0a1f10bffa5dc61b
Python
2,651
43
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
d26331f584581f4f2e0c749a03207d8aeff9c7736a5e44b8be03f8663a901def
Python
2,653
74
######################################################################## class Basic: """ Add the basic parameters for your offline modality. These parameters will be displayed on the Basic page of the GUI. This file defines the parameter type and-or its possible values displayed on the GUI, it...
4cb9353e695ec90949d57f3b398e93478ed9155b62d78732bd22dc4892f21e6b
Python
2,654
112
VIEW = { "general": { "title": "General", "content": { "checkpoints": { "title": "Checkpoints", "fields": { "useCheckpoints": { "title": "Use Checkpoints", "fieldType": "bool", "default": False } } }, "windowBar"...
68a27749e48093a758970f50880d8a54044535087fabb8d8bf9d731243f5b665
Python
2,655
90
"""Write out a TensorBoard report""" from __future__ import annotations __all__ = ["TLTBReporter"] from collections import Counter from typing import TYPE_CHECKING from reinvent.runmodes.utils import make_grid_image, compute_similarity_from_sample if TYPE_CHECKING: from reinvent.runmodes.TL.reports import TLRe...
8fe6d75b56ce4b454e2b3eb29000ecc5aa0e2281d8b3e30a2aea474204d87bbc
Python
2,656
88
from typing import Optional import config import pandas as pd explicit_folder_coding = { 'StyelaGAN2_Gamma2': 'StyleGAN 2 $\\gamma$: 2', 'StyelaGAN2_Gamma5': 'StyleGAN 2 $\\gamma$: 5', 'StyelaGAN2_Gamma8': 'StyleGAN 2 $\\gamma$: 8', 'DiffusionModel_Brats21': 'Diffusion', 'BRATS2021_synthetic_1195s...
44d9d299fd023655d1a2978a09f62a593894bd48025ce3f20a8f73e33d6b3d2d
Python
2,659
75
"""Unit tests for the sub-Riemannian metric class.""" import geomstats.backend as gs from geomstats.geometry.heisenberg import HeisenbergVectors from geomstats.geometry.sub_riemannian_metric import SubRiemannianMetric from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.sub...
c4dc1d85721fa2d2437b29905eebd79c49c449950d1e39c99b6d38692f3df7d7
Python
2,659
42
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
153fb7ab5b29054aa89b1b8d22504e2731132cb736b1650bf6690e866a3b1ccc
Python
2,661
82
from pymonntorch import * import time import torch from matplotlib import pyplot as plt import numpy as np from globparams import * settings = {'dtype': torch.float64, 'synapse_mode': "SxD", 'device': 'cpu'} class LeakyIntegrateAndFire(Behavior): def initialize(self, neurons): neurons.spikes ...
8ea35f2084df806dc9663185d43d88374dab1df557aa95b5301f63486fa8c0fc
Python
2,661
82
from pymonntorch import * import time import torch from matplotlib import pyplot as plt import numpy as np from globparams import * settings = {'dtype': torch.float32, 'synapse_mode': "SxD", 'device': 'cpu'} class LeakyIntegrateAndFire(Behavior): def initialize(self, neurons): neurons.spikes ...
fa3d4148783ee01fddff77ec92674ad70eef47740d1fa602e3548c1e1e615553
Python
2,661
69
from typing import Dict from collections import OrderedDict from ppdet.modeling.architectures.meta_arch import BaseArch class MultiSteamDetector(BaseArch): def __init__(self, model: Dict[str, BaseArch], train_cfg=None, test_cfg=None): super(MultiSteamDete...
02d20313a3adab8a94015bf2c82e05c9afdd67fbc1a77cc09e44632b1bf2c74f
Python
2,662
87
import itertools import numpy as np from scipy import stats from pycircstat import var def convolve_dirac_gauss(t, trial, sigma=1.): """ Convolves event series represented as time points of Dirac deltas with the pdf of a Gaussian :param t: time points at which the convolution will be computed :pa...
3a260818fb326b460d213b6448e1b9007a16dc7a8ed9e93a35bb995d5069d298
Python
2,665
43
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
997e926b9c8606d3e1545133973be052fc0b890fdf35135fa94c657d76ef1b43
Python
2,665
76
from nequip.data.dataset import NequIPLMDBDataset from nequip.utils.global_state import set_global_state from nequip.utils import RankedLogger import os from tqdm import tqdm import hydra from omegaconf import OmegaConf, DictConfig, ListConfig logger = RankedLogger(__name__, rank_zero_only=True) os.environ["HYDRA_FULL...
a6196e8a0e5a99094ca666041f1eada6f931e827e89b94e5bb90e6da84ee2af8
Python
2,665
72
import os import numpy as np from torch.utils.data import Dataset from mace.data.atomic_data import AtomicData from mace.data.utils import KeySpecification, config_from_atoms from mace.tools.default_keys import DefaultKeys from mace.tools.fairchem_dataset import AseDBDataset class LMDBDataset(Dataset): def __in...
764c0c1ca7a90e739c96f9f297ee67560828d8cb205394542d8a24d8299d4c4b
Python
2,666
85
#!/usr/bin/env python3 """ Example: Using Chroma's Attached Functions API to process collections automatically This demonstrates how to attach functions that automatically process collections as new records are added. """ import chromadb import time from chromadb.api.functions import RECORD_COUNTER_FUNCTION # Connec...
981e6a5d5077f8d636fd46414a3f747e45e27381fb67fd932aa9b68fa6c8085b
Python
2,666
64
"""Part B: mask-once dedup in list construction (``io.mask_images``). ``BrainData(list_of_niftis, mask=mask)`` routes through ``_load_from_list`` -> ``_mask_images``. These tests pin the byte-equivalence contract (must reproduce the functional per-item ``apply_mask`` + ``vstack`` exactly) and the perf contract (the ma...
acd8f01cacdddcdb8cd9c88a7865cacc6a8587e9c7bd7c37c9ae85c17510906a
Python
2,669
71
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import torch import torch.nn.functional as F from torch.distributions.bernoulli import Bernoulli from torch_geometric.data import Data from ..constants import * class NodeFM(torch.nn.Module): def __init__(self, training=False, unifo...
0658be565adbb13f6adcdeeaabb13034f25bbc250647db64046cafebbcb4f38c
Python
2,670
93
# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
331cece4ef3b9cc046f260b8145f8ab166bc526b9d5dc75077dfb5b7ef8ac5ab
Python
2,671
82
import pytest from chromadb.api.client import AdminClient, Client from chromadb.config import System from chromadb.db.impl.sqlite import SqliteDB from chromadb.errors import NotFoundError from chromadb.test.conftest import ClientFactories def test_deletes_database(client_factories: ClientFactories) -> None: clien...
daf4efdd3e5d92d45ec456e2632c8ee015831b1f5dc2cf2083b8fcff78715906
Python
2,671
85
import geomstats.backend as gs from geomstats.test.data import TestData class SasakiMetricSphereTestData(TestData): pu0 = gs.array([[0.0, -1.0, 0.0], [1.0, 0.0, 1.0]]) pu1 = gs.array([[1.0, 0.0, 0.0], [0.0, 1.0, 1.0]]) pu2 = gs.array( [[-0.27215095, -0.90632948, 0.32326574], [0.13474934, 0.0, 1.39...
914e585c5af0f0338b0976bf6cd3220b925285a0eeda708f518f5a646335cf10
Python
2,672
76
import torch from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem.rdmolfiles import SmilesParserParams from rdkit import RDLogger from torch_geometric.data import Data, Batch class TransformPred3D(torch.nn.Module): """ Converting :obj:`torch_geometric.data.Data` objects into 3d versions using ...
aaf74d8026f18d80feeadd72b0d7e5baeb26d96c920765f24dddf78b4de7b6e0
Python
2,672
76
"""Experimental loader for a GitHub folder of ABF files. ``requests`` is not a SanPy dependency. Install it before running this script. """ import io import requests import sanpy class bAnalysisDirWeb: """Load a directory of .abf from the web (for now from GitHub). Will etend this to Box, Dropbox, other?...
1f77ef9764fe65a2e073ad8c8d35b7f099ca46d28aa2450991fc50b1accdf7e9
Python
2,674
69
""" Plots excerpts of the input data with its corresponding metadata. """ import numpy as np import argparse from pathlib import Path import matplotlib.pyplot as plt import seaborn as sns from utils.io_utils import load_neo, save_plot from utils.neo_utils import time_slice from utils.parse import parse_plot_channels, ...
3abf5e6548dc34a823f7c796b5f30468eb24f7435da7cdc7264d89006804185d
Python
2,674
82
from pymonntorch import * import time import torch from matplotlib import pyplot as plt import numpy as np from globparams import * settings = {'dtype': torch.float64, 'synapse_mode': "SxD", 'device': 'cuda'} class LeakyIntegrateAndFire(Behavior): def initialize(self, neurons): neurons.spikes...
f37b365b8e1b3145a8394a74e2edd78c698018bafa3dc990771519d43502a921
Python
2,677
111
from gzip import ( compress, GzipFile ) import numpy as np from .record import Record UNK = '<unk>' PAD = '<pad>' class Vocab(Record): __attributes__ = ['words', 'counts'] def __init__(self, words, counts): self.words = words self.counts = counts self.word_ids = { ...
3e9ee0381716e2bf5ce486040e473d21248d58eb6db11429b3b0c2ddc74967e3
Python
2,678
99
class Sample: def __init__(self, name, id_dict, # Should be an OrderedDict partition, x_dict, y_dict, support, is_time_continuous, custom_stats=None): self._name = name ...
727a96cd5c632f814e72e009c1d7675e2a500f4ecfc6c68bd61472a14fc18e91
Python
2,678
80
import pytest import itertools import torch from nequip.data import PartialSampler @pytest.fixture(params=[True, False], scope="module") def shuffle(request) -> bool: return request.param @pytest.fixture(params=[None, 1, 2, 5, 7], scope="function") def sampler(request, dataset, shuffle) -> PartialSampler: # ...
35111de697c402ee415dbafa203137968bbae912a19f5ca406bb9ee21565d99b
Python
2,679
80
"""Tests for BrainData.cluster_report facade + _ClusterReport.plot.""" import nibabel as nb import numpy as np import pytest from nltools.data import BrainData from nltools.data.atlases import _ClusterReport def _gaussian_blob(shape, center_ijk, peak_amp, sigma=2.0): grid = np.indices(shape).astype(float) c...
c46f7028fc66da1de9b75a592b84fe975d7e1a05220c9fb6484ca3c8cc247296
Python
2,679
93
import pytest import tempfile import torch from omegaconf import OmegaConf from conftest import _check_and_print import pathlib import subprocess @pytest.mark.parametrize( "device", ["cpu"] + (["cuda"] if torch.cuda.is_available() else []) ) def test_dimer_plot_example(fake_model_training_session, device): ""...
6baab45e9c178f413f264247cb6514dae678afa591255d768641f5fb615ba565
Python
2,681
82
import json import sys import nibabel as nib import numpy as np from sdcflows.transform import disp_to_fmap def displacement_field_to_fmap( disp_field: str, dwi_nii: str, dwi_json: str, demean: bool, out_fmap: str, smk_config: dict, ) -> None: """Adapted from SDCFlows DisplacementField2Fi...
cf4b79b4e499ba4b691b4a9d09335ebc1037e4b6a24d613f922833e6ca64e709
Python
2,681
76
import random import pytest from scipy.stats import normaltest, pearsonr import geomstats.backend as gs from geomstats.distributions.brownian_motion import BrownianMotion from geomstats.geometry.euclidean import Euclidean from geomstats.test.test_case import TestCase, autograd_and_torch_only @autograd_and_torch_onl...
102327f5b08848124ffe0630c1e27df0fdc3130c21fd0b3beedae59f12e160fb
Python
2,682
73
import unittest import pytest import torch import torch.utils.data as tud from reinvent.models.transformer.core.dataset.dataset import Dataset from reinvent.models.transformer.core.enums.sampling_mode_enum import SamplingModesEnum from reinvent.models.transformer.core.vocabulary import SMILESTokenizer from reinvent.m...
7a13ca3d22857fe46c3756d3f6eb13a5c9273253117de3e2883727f4c5f1e90c
Python
2,685
69
"""Export CLI contract: mace_create_lammps_model produces loadable artifacts. Contract tier — no LAMMPS binary. The libtorch format is plain TorchScript; the mliap format additionally converts the model to the cueq layout (hence the cueq capability marker on that test). """ import shutil import pytest import torch ...
dae11afa4e97d9362595926ef6343f17facb27b6fa63fc2fd04587acde659399
Python
2,685
69
""" Plots excerpts of the input data with its corresponding metadata. """ import numpy as np import argparse from pathlib import Path import matplotlib.pyplot as plt import seaborn as sns from utils.io_utils import load_neo, save_plot from utils.neo_utils import time_slice from utils.parse import parse_plot_channels, ...
6708a2f951de6937ab7cdd683a53bb78d8b34f003cba78ad42f6d87a7e5d76ff
Python
2,686
91
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import argparse import pathlib import torch from .lmp_mliap_wrapper import NequIPLAMMPSMLIAPWrapper from nequip.train.lightning import _SOLE_MODEL_KEY from nequip.utils.logger import RankedLogger fro...
01cb465aebb6d3a4d1ccd5c04dcfd4a86a002bcabba03c9e549d3cf53284bdcc
Python
2,687
103
from numba import njit, jit, objmode from numba.experimental import jitclass from numba import int32, int64, float32, float64, boolean from numba import deferred_type from numba import typed, types from numba.types import pyobject import numpy as np from scipy.io import loadmat, savemat from .Tree import Tree TreeType...
6a7da9a1972fe1911dbac8e78ee61c9f2a29e015e057881e857478d59b489859
Python
2,689
85
""" Script to identify and count van der waals clashes in a PDB file. VDW values are taken from the following: - https://en.wikipedia.org/wiki/Atomic_radii_of_the_elements_(data_page) - https://pubs.acs.org/doi/epdf/10.1021/j100785a001 Useful references: - https://www.pnas.org/doi/10.1073/pnas.072665799 Usage: pytho...
eca3baa81eded3e982b80828950237befb1b0b1c0700183119e9a1039088aa40
Python
2,689
94
#!/bin/env python3 # # This is an example how to use the ExternalProcess scoring component using # ChemProp 1.x. The scripts expects a list of SMILES from stdin and will # write a JSON string to stdout. # # Setup shown for scoring file include feature: scoring.filename # # [[component.ExternalProcess.endpoint]] # name...
09956227d1899c87543c64d78bd350db95368874e27eb5b2d8800ae5d0b8429f
Python
2,691
85
from scipy import signal def butter_lowpass(lowcut, fs, order=8, sos=False): ''' Create a lowpass butterworth filter ''' nyq = 0.5 * fs low = lowcut / nyq if sos: sos_out = signal.butter(order, low, analog=False, btype='low', output='sos') return sos_out b, a = signal.butter(orde...
8c9c4132997547aef0fb9b864c4d9180aa194a9d822ee52530ef28aca5e5d08d
Python
2,693
73
# Copyright 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import hashlib import logging from importlib import util from typing import Callable from openfl.federated.data.sources.data_source import DataSource, DataSourceType logging.getLogger("azure").setLevel(logging.WARNING) logging.getLogger("azure....
9f63c93bb80a015f85e96b17d2e17d3674d2a4aeaf79812a7980ab3df10bb571
Python
2,694
112
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
6752d9d1451491fa775b2dd01f11901baf7d15ae16c5ed05eece039c5e70284e
Python
2,698
82
"""Tests for the shared `ContrastResult` record and the removal of `BaseModel`.""" import dataclasses import importlib import numpy as np import pytest import nltools.models from nltools.models import ContrastResult class TestContrastResultShape: """Field names, order, and construction.""" def test_field_...
16cb264b9f3ac57a563a326cf61eb6ca99897a6221d7ec18a6dbd1bdaf52e7be
Python
2,702
88
from sklearn.base import BaseEstimator, TransformerMixin import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler, LabelEncoder from sklearn.feature_selection import ( f_regression, SelectKBest, f_classif, SelectFromModel, ) from sklearn.linear_model import LogisticRegressio...
05999860221af14ca6af227f183a83dec778f22fae72afd536dc275ec2916caf
Python
2,703
80
from abc import abstractmethod from dataclasses import dataclass from typing import Any, Callable, List from overrides import EnforceOverrides, overrides from chromadb.config import Component, System from chromadb.types import Segment class SegmentDirectory(Component): """A segment directory is a data interface ...
1a3eea95d56f8e8339ec73f7cd4983d8e91034801b8345036342a409b3ef6b52
Python
2,703
85
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import webbrowser from pathlib import Path from openfl.experimental.workflow.utilities.metaflow_utils import DefaultCard, FlowGraph class InspectFlow: """Class for inspecting a flow. Attributes: ds_root (str): ...
418ff20c8763a4ae4fd5ff3a01407b30f396c3f25d005aadb5eec6421c87fbc4
Python
2,703
88
from pathlib import Path import mne from .. import io from ... import logger def set_channel_types(raw, mapping): """ Change the channel types of the raw instance. https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.set_channel_types Parameters ---------- raw : mne.io.Raw | mne.i...
93519045ac084365586a8c0731de865ac28c169be22bd2ec66fd3a0a64d04c20
Python
2,705
74
######################################################################## class Basic: """ Add the basic parameters for your trainer modality. These parameters will be displayed on the Basic page of the GUI. This file defines the parameter type and-or its possible values displayed on the GUI, it...
251b5a028b21fa35b1e718cd773ddb640b2bea1a4a8766a0e68c9f3146d8ae09
Python
2,706
87
# 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...
6eb432ca5bfbba9ad75717fd8bfadbc61b7ed578f8b6ee78d993a5d1da1d34d7
Python
2,706
73
# -*- coding: utf-8 -*- import os import numpy as np import logging, argparse import configparser def parse_args(): # Argument Parser parser = argparse.ArgumentParser() # my args parser.add_argument("--verbose", action = "store_true", help = "display messages") parser.add_argument("--odir", de...
b90fd920d81903b080a21fb4491da30e8c3b4f17823aa4287bf829d19dad7210
Python
2,714
82
import pytest from geomstats.geometry.hypersphere import Hypersphere from geomstats.geometry.invariant_metric import BiInvariantMetric from geomstats.geometry.special_orthogonal import SpecialOrthogonal from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.base import Immers...
d9dc92597a3f91e8968c0490ca02d355ced7d8fc6988a3f621eda16516da9100
Python
2,714
87
import pytest import geomstats.backend as gs from geomstats.test.random import RandomDataGenerator from geomstats.test_cases.learning._base import BaseEstimatorTestCase class Model: # TODO: bring generation with noise def __init__(self, space, intercept, coef): self.space = space self.interce...
82ae094dbeceb87cc018720e0e24277571104d2729adb519f5eca65c5f29ccac
Python
2,715
92
"""Create a Linkinvent model from a list of SMILES strings""" from __future__ import annotations import time import uuid from reinvent.models.linkinvent.link_invent_model import LinkInventModel from reinvent.models.linkinvent.model_vocabulary.paired_model_vocabulary import ( PairedModelVocabulary, ) from reinvent...
30dbd6983e892365c521be32123a2ecc0b955f7d3c1890e9b70b153d91266d70
Python
2,718
80
""" Plot the critical points in the optical flow vector field. """ import argparse import numpy as np from copy import copy 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_argument("--data"...
4ffc023092c3c93bf48751a5b4410098a179e39ba7913a39194f34b345af975c
Python
2,719
90
# -*- coding: utf-8 -*- from __future__ import print_function, division from builtins import input """ Measure multitaper computation speed. i7-8700K: 9.9 ms (101.0 Hz) @author: leeq """ import os import mne import numpy as np from neurodecode import logger from neurodecode.utils.timer import Timer os.environ['OM...
75b92e5a358efedbf194638931a4bc44e2afc310b1a626d5337da7ec3552ad08
Python
2,719
69
from sparse_ct.tool import plot_grid from sparse_ct.data import image_to_sparse_sinogram, ellipses_to_sparse_sinogram from sparse_ct.reconstructor_2d import ( IRadonReconstructor, SartReconstructor, SartTVReconstructor, Sar...
4e36a8653794fa4b6c73000dab2fe2cdb4eb56b7de98d82fc96667e29f6d5119
Python
2,720
103
import pytest import numpy as np from cloudvolume import CloudVolume from cloudvolume.lib import Vec from corgie.data_backends import str_to_backend import shutil import os from corgie.boundingcube import BoundingCube from corgie.mipless_cloudvolume import MiplessCloudVolume from corgie.stack import Stack from corgi...
5edf786a4d4fe7ec52286fece0a933c0d99212c6f7ae764f41a1852b13543473
Python
2,721
73
import numpy as np import matplotlib.pyplot as plt from brian2 import * import pickle from tqdm import tqdm from scipy.stats import lognorm from standalone import run_network, extract_counts from utils import connection_matrix def extract_mean_current(current, time, nstim=30, stim_dur=1.1, discard=0.1): mean_cur...
6f6facb9482b8937a6c3d9f4f46bf7bb161d3ec23f46986a928f1ec0a8ae3573
Python
2,722
80
# Usage: python3 splitScaffolds.py inFile species type_of_variant (indels or snps) type_of_comparison (e.g. huch, hugo, hurh etc. where huch indicates that the MAF was a human chimp alignment) import os import sys import pandas as pd # Read arguments Suffix1 = sys.argv[1] Suffix2 = sys.argv[2] species = sys.argv[3] t...
3220f411e2f02559a56c4ef4815310a8a56f95f000dc49e9e2db2bd22992a66a
Python
2,723
70
# -*- coding: utf-8 -*- """ Demonstration of ScatterPlotWidget for exploring structure in tabular data. The widget consists of four components: 1) A list of column names from which the user may select 1 or 2 columns to plot. If one column is selected, the data for that column will be plotted in a histogram-li...
865cdcb3c99aa0d2c0b8bdd1bba3c99136fc014bad859f82ff2f7477e023c43b
Python
2,728
87
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import torch from torch import Tensor import argparse from typing import List, Optional, Tuple from utils import logger from .base_layer import BaseLayer class GlobalPool(BaseLayer): """ This layers appl...
83f5ab3602e066825af32c74bea04c66bcbeca6704b1e4f5b7bd63a2442b9078
Python
2,730
98
import math import logging import glob import numpy as np from sparse_ct.reconstructor_2d import ( SartReconstructor, SartBM3DReconstructor, DgrReconstructor, N2SelfReconstructor) from . imp...
8cc24425a365f09d9e1bb9c1ad8756255471e38b401381c6a3220dbfb0383229
Python
2,730
99
import os import socket import multiprocessing import pickle from rdkit import Chem from rdkit.Chem import AllChem from tqdm import tqdm from ogb.lsc import PCQM4MDataset import argparse def log(log_path, q): with open(log_path, 'w') as f: print('Logger is alive') while 1: m = q.get()...
9947daf38321c59ccdeb2ea72ccee5852d94b37c77ee58d4a929f853401f0ac2
Python
2,730
80
""" Plot the critical points in the optical flow vector field. """ import argparse import numpy as np from copy import copy 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_argument("--data"...
9bd454232b3314caeadcfdb62cd19bd99503d1252f3cbb89d1c523750dc91585
Python
2,730
122
from utils.color_palettes import ( GR1, RB1, YP1, YS1, BG1) from utils.datasets import ( GraspingSuresh, ReachingGallego, ReachingChurchland, ReachingKalidindi, BehaviouralMante, ) DATA_PATH = '' data_pathes = { 'church': 'preprocessed2h5/church_dataset.h5', 'grasp': 'preprocessed2h5/Da...
417e5ad6c91c48d3111c8e3e9a24f72d668a9b8ad86056ced25a5c9c8cdc802d
Python
2,732
76
# Copyright (C) 2020-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # This file overrides the step method of PyTorch Optimizer # Adopts fix clipping from https://arxiv.org/abs/1710.06963 import torch from torch.optim import Optimizer torch.set_printoptions(precision=10) class ClipOptimizer(object): ...
f063826feb5a82d0da974c310f2b9b0870b13eeec7dbc160f03222c0e6b400b5
Python
2,733
100
#!/usr/bin/env python3 """Talk to transactional Chroma with the Python client. Run against a Chroma server that supports conditional transactions: python3 examples/conditional_transactions.py Optional environment: CHROMA_HOST=localhost CHROMA_PORT=8000 CHROMA_SSL=false CHROMA_TENANT=default_tena...
a72e2bae1698e484090d16f1c2c2159f849c96b7dd951015f2102f63c1d7d833
Python
2,734
74
from rdkit import Chem from typing import Sequence, Dict def onek_encoding_unk(value: int, choices: Sequence): """ Creates a one-hot encoding with an extra category for uncommon values. :param value: The value for which the encoding should be one. :param choices: A list of possible values. :return...
cdafd9f25168c17602ca0f39ddc5ddba31f9ac51a78d318f7287d81942e3260f
Python
2,734
103
import shutil from pathlib import Path import pytest import numpy as np def test_make_input_plots(): from mlspm.visualization import make_input_plots save_dir = Path("test_input_plots") X = [np.random.rand(2, 20, 20, 2), np.random.rand(2, 20, 20, 2)] make_input_plots(X, outdir=save_dir) assert...
0f0f44da14b3cc36494c3128f4e2f0a36fc8f0385fd9be751b432f305b5527da
Python
2,736
81
""" Plot the critical points in the optical flow vector field. """ import argparse from pathlib import Path import numpy as np from copy import copy 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() ...
4532f865072efe13385351c7e586eb7c4ccaa529744ddd81002ae1df84ed62dc
Python
2,736
55
from skimage.color import gray2rgb from multiprocessing.dummy import Pool as ThreadPool from sparse_ct.tool import plot_grid from sparse_ct.data import image_to_sparse_sinogram from sparse_ct.reconstructor_2d import ( IRadonReconstructor, FBP_BM3DReconstructor, ...
85539bfd4d54db6e8b7172d5b4581c83f6bee0da5fe89bc638c8a59412faf2a0
Python
2,736
75
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Plan API's tests module.""" from unittest import mock import pytest from pathlib import Path from openfl.federated.plan.plan import Plan from openfl.component.assigner import RandomGroupedAssigner from openfl.component.aggregator im...
8ceb13a29a4086241226c0fdf5f44ac81522b198e72068feb06e56dfe0a98b29
Python
2,737
64
import sqlite3 import numpy as np import argparse from pyimzml.ImzMLWriter import ImzMLWriter def threshold_otsu(image, nbins=256): # Stripped-down function from scikit-image to avoid the heavy dependency. assert image.min() != image.max() hist, bin_edges = np.histogram(image.flat, bins=nbins) bin_cent...
9f69d28d4488d08514ebe1d6acefebf63fff2a9733878475efe88843b8872e77
Python
2,737
100
import os import logging import torch import torch_geometric.transforms as T from sklearn.metrics import roc_auc_score, average_precision_score from GeNNius import Model @torch.no_grad() def test(model, data): model.eval() emb, pred = model(data.x_dict, data.edge_index_dict, data['drug', 'pro...
457e06eea46088a89378432d4c1b508e2112cc3bf95048d17e7cbdc098ebc327
Python
2,738
101
import os import logging import torch import torch_geometric.transforms as T from sklearn.metrics import roc_auc_score, average_precision_score from GeNNius import Model @torch.no_grad() def test(model, data): model.eval() emb, pred = model(data.x_dict, data.edge_index_dict, data['drug', 'pro...
34aaf25a9322ebcabdb8dc573d4bdd28e41c1fb9ef84cd24feeba51e13d6211e
Python
2,739
44
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
3e606532c6d6a6c15e1650038a6c330615766cd17d7ada3730b1b4c1ccbf8c13
Python
2,739
64
def get_atoms_neighbor(model, target_chain, target_resn, n_neighbours = 80): ''' model : biopython pdb model returns: backbone atom coordinates of residue of interest atom_type and coordinates of all residues within a certain distance. ''' # getting coordinates of the residue of...
8ebd91c856a5de355bd4a97c0a0b745f0bf63739bca0faa03ca278f1c55c2f52
Python
2,740
86
"""Compute easy-of-synthesis scores with AiZynthFinder. For AiZynthFinder documentation, see: - https://github.com/MolecularAI/aizynthfinder This implementations calls external command. The external command, in turn, can call AiZynthFinder command-line interface, or run CLI in parallel on a cluster, or even call REST...
9045dc473560e0f7abc33f3d7a8e75ef185cb532f7f4fa2e6b9472b59675e3c3
Python
2,740
93
import pytest import numpy as np from rdkit import Chem from reinvent.runmodes.samplers import validate_smiles from reinvent.models.model_factory.sample_batch import SmilesState from tests import test_data @pytest.fixture def data(): smilies = [ test_data.PARACETAMOL, # valid test_data.INVALID,...
00d83c861c3190957774ae1edc5c3d96c26831738a95fe51f7a37e0da9f96744
Python
2,741
79
import sys import time import cv2 import numpy as np from dynaphos.image_processing import sobel_processor, canny_processor from dynaphos.simulator import GaussianSimulator from dynaphos.utils import load_params, load_coordinates_from_yaml, Map from dynaphos.cortex_models import \ get_visual_field_coordinates_fro...
7fbda806010c3c9a0f147700fcffe125b05275486a717f417809dd4c86f5ecf3
Python
2,742
80
import time, h5py, logging, itertools from tqdm.auto import tqdm, trange from typing import Union, List, Tuple import numpy as np, pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.metrics import silhouette_score, adjusted_rand_score, accuracy_score, f1_score from sklearn.neighbors import Radi...
f00700359c7d4590174163c63288b79e1df52a971dc90f6ff64dddbb16ee5ec7
Python
2,742
44
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
53f047b3e66024b246ed2e1205dfc309f3bf817b075a1085519e889466e3deff
Python
2,743
93
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import os import importlib from typing import Optional from utils import logger import argparse from utils.ddp_utils import is_master from .base_sampler import BaseSamplerDDP, BaseSamplerDP SAMPLER_REGISTRY = {} ...
ccb3c781ee992158655408c3719b00881cff8654d6e59e427f1bad78576d6656
Python
2,743
81
"""Tests for RL terminators: NullTerminator, SimpleTerminator, PlateauTerminator.""" import pytest import numpy as np from reinvent.runmodes.RL.setup.terminators import ( NullTerminator, SimpleTerminator, PlateauTerminator, ) # ── NullTerminator ────────────────────────────────────────────────────────── ...
4220e6b9aa3d0968d88c82c5367ae841430586e6cde40ab552ed0c0d2040ff70
Python
2,744
70
import torch.nn as nn from .contrastive import Contrastive class ProjHead(nn.Module): def __init__(self, input_dim, out_dim): super().__init__() self.block = nn.Sequential( nn.Linear(input_dim, out_dim), nn.ReLU(), nn.Linear(out_dim, out_dim), nn.ReL...
22520ccfdd683e85e583d23e82321884967719efcd542b1994ab818b174bfa89
Python
2,745
81
""" Plot the critical points in the optical flow vector field. """ import argparse from pathlib import Path import numpy as np from copy import copy 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() ...