sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
aaed2251e433e02edfd59163412a7893dbd34a00952a042c1bf26d19f500a344
Python
8,754
255
# -*- coding: utf-8 -*- # encodermap/misc/distances.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # # Encodermap is ...
f955b0b6dc0e0f621b0c91637279b4acc023df4f5a49dfb2cc1027429ac6669f
Python
8,760
253
#!/usr/bin/env python """ MetaWIBELE: maaslin2 module Run maaslin2 to associate features with metadata Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the S...
0617dfe6f4c09b49a832c70f215dffa9ec61578cb9cd0b2f1a5f5bcfcb268068
Python
8,765
107
UNIVARIATE_DATASET_NAMES = ['50words', 'Adiac', 'ArrowHead', 'Beef', 'BeetleFly', 'BirdChicken', 'Car', 'CBF', 'ChlorineConcentration', 'CinC_ECG_torso', 'Coffee', 'Computers', 'Cricket_X', 'Cricket_Y', 'Cricket_Z', 'DiatomSizeReduction', ...
78755a644d7c31c1dae7a2d28aaf3330495774010504cd7593cf0c2ae5607efa
Python
8,768
264
""" Producer threads must not share feature state through a cloned feature. ``Featurizer._clone_features`` gives every producer thread its own ``copy.copy`` of each feature, because ``cache``/``query`` write trajectory-scoped state (``selected``, ``resids``, ``cached_array``) onto the feature. A shallow copy also copi...
b266c1186c8feba0e38a6a0dad6a952e7108c10af6b86bad650e76dcd1622b4c
Python
8,771
204
import os import numpy as np import torch import torch.nn.functional as F from torch.optim import Adam from SAC.utils import soft_update, hard_update from SAC.model import GaussianPolicy_ActionGNN, Critic_GNN class SAC_ActionGNN(object): algo_name = "SAC ActionGNN" def __init__(self, action...
8aeec15e853db6a4038b7e320b007dded1c2c47274f4f46bf49f87318d587a44
Python
8,778
195
import torch import torch.nn.functional as F import torchaudio_contrib as tac import os, math class NCL2NLC(torch.nn.Module): def __init__(self): super(NCL2NLC, self).__init__() def forward(self, input): """ input : Tensor of shape (batch size, T, Cin) Outputs a T...
dba7b2e312a7ad533649dc5bd688c761572f654869f2544fc42746ef108ef66a
Python
8,779
197
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from rde.modules.common.geometry import global_to_local, local_to_global, normalize_vector, construct_3d_basis, angstrom_to_nm from rde.modules.common.layers import mask_zero, LayerNorm from rde.utils.protein.constants import BBHeavy...
e24028465430c8001595b0953df4843631350bb3b81a46aa5b907d6fbbb3a6d5
Python
8,786
169
import catmaid.fields import datetime from django.conf import settings import django.contrib.postgres.fields.jsonb import django.contrib.postgres.functions from django.db import migrations, models import django.db.models.deletion forward = """ CREATE TABLE catmaid_deep_link ( id int GENERATED BY DEFAULT A...
8bde0f47cc50a57b6843034577cba6781df5faaf61e709754df8c58e4c1dd4a2
Python
8,788
192
# Standard Library Imports import datetime import json import os from math import pi # Local Folder Imports from .misc import run_path, search_and_replace class ParametersFramework: def __init__(self): self.main_path = os.getcwd() def save(self, path=None): """ Save parameters in jso...
9f01bfd0e58f2e4c3958a2ce7c5073018f275064e7a3cb2003fd90cefe09aa86
Python
8,788
235
# Authors: Pierre Ablin <pierre.ablin@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Jean-Francois Cardoso <cardoso@iap.fr> # # License: BSD (3-clause) import numpy as np import warnings from scipy import linalg from ._core_picard import core_picard from ._tools import check_random_s...
c2afa2acd9685d5accbff81f67f4c333e75ba026052a7ca890daeb09037f571e
Python
8,793
276
import numpy as np import pickle import pandas as pd import seaborn as sns import time from matplotlib import pyplot as plt # 25 CS, 3 TR, V2G, ProfixMax, WithLoads # data = pd.read_csv('./results/eval_25cs_3tr_V2G_ProfixMaxWithLoads_25_11_algos_3_exp_2024_07_18_418263/data.csv') # data1 = pd.read_csv('./results/eva...
6cf4004f2d649dd1ad6c1240bd9d66dd80d1636fe1d104c045d05f31595b47df
Python
8,794
212
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp from collections import OrderedDict, defaultdict from typing import Dict, List, Optional, Sequence import cv2 import numpy as np import torch from mmengine.dist import is_main_process from mmengine.evaluator import BaseMetric from mmengine.logging i...
33dc8005ab69fdd1d3e89863f87c399a1a9c24bc470e55d124c23266d5af9cb0
Python
8,801
232
# Utilities for location the file paths of import files. from pathlib import Path def get_encoder_model_path(isDocker: bool = False) -> str: """Gets the filepath of a stored DNA encoder. Parameters ---------- isDocker : bool Whether this program is being run from a Docker container (and thus ...
5a23a32ef4b562bf3dbcccf162241f85c96c71b645cccd53ca275e1c76111e9e
Python
8,801
287
import typer from typing import Optional import medperf.config as config from medperf.decorators import clean_except from medperf.entities.dataset import Dataset from medperf.commands.list import EntityList from medperf.commands.view import EntityView from medperf.commands.dataset.submit import DataCreation from medpe...
79914590f9306928cff96e8883f10c96b252386a010a24c38f3550e8b416fa20
Python
8,804
373
import pytest from neo4j import GraphDatabase from kgx.graph.nx_graph import NxGraph NEO4J_CONTAINER_NAME = "kgx-neo4j-unit-test" DEFAULT_NEO4J_URL = "neo4j://localhost:7687" DEFAULT_NEO4J_USERNAME = "neo4j" DEFAULT_NEO4J_PASSWORD = "test" DEFAULT_NEO4J_DATABASE = "neo4j" def check_neo4j_container(): """ Ch...
c788f50a7f7d6c8397fae639dc44838266d873332f632323354b3376dba941d4
Python
8,807
274
# ############################# # # Copyright (C) 2018 # Jennifer Dreiling (dreiling@gfz-potsdam.de) # # # ############################# import numpy as np import copy class Model(object): """Handle interpolating methods for a single model vector.""" @staticmethod def split_modelparams(model): ...
cecc500bee1eca73173a9b7053a68f7f68c678e260317b2a65b2a261a2faa696
Python
8,808
246
"""Shared ndx-fiber-photometry v0.2 hardware-metadata boilerplate for the mock-NWB generators. Imported as a sibling module by the ``create_mock_nwbfile_ndx_fiber_photometry_v0_2_*`` scripts (the script's own directory is on ``sys.path`` when run as ``python .../create_mock_...py``), so it must only depend on the same...
2a571dc9b5965ca2694e3180261ae5891531c233ddbc8ec10e62d634f41bfef8
Python
8,809
255
"""Unit tests for src/datahandlers/mesh.py Tests cover: - write_ids() parameter validation - write_ids() SCR filtering logic (mock-based) - Mesh.get_scr_terms_mapped_to_trees() (inline pyoxigraph store) """ from unittest.mock import MagicMock, patch import pyoxigraph import pytest from src.categories import C...
d4417f6648818f2b9af2d6f1834ab35db34b0269cffcd94ed951fda3b655fe38
Python
8,809
237
import argparse import os import pickle import sys from pathlib import Path import pandas as pd from tqdm.auto import tqdm sys.path.append(".") from easydict import EasyDict from rdkit import RDLogger from utils.dataset import get_dataset from utils.evaluation import * from utils.misc import * from utils.reconstruc...
6ffd208601e781066ac7c4630a3d9b29b5705d7c329b099ceaed532f373e0729
Python
8,816
235
# -*- coding: utf-8 -*- """ Created on Thu Oct 24 11:56:14 2024 @author: A0067501 """ import yaml import torch import os import pydicom import numpy as np from skimage.measure import label from scipy import ndimage import matplotlib.pyplot as plt import matplotlib.patches as mpatches import logging import sys from...
2137dc90f0c6632dd9be880d961f29ae3a607a366c7a97e8529124f0064b94ff
Python
8,821
266
import logging import os import shutil from abc import ABC, abstractmethod from pyalfe.interfaces.greedy import Greedy try: import ants except ImportError: pass class ImageRegistration(ABC): @abstractmethod def register_rigid(self, fixed, moving, transform_output, init_transform=None): """Pe...
96023605b824890daf0f45a6aa51e59888d494239f00b8771beb17e341b03ba7
Python
8,822
261
import csv import json import torch from transformers import BertTokenizer class CNerTokenizer(BertTokenizer): def __init__(self, vocab_file, do_lower_case=True): super().__init__(vocab_file=str(vocab_file), do_lower_case=do_lower_case) self.vocab_file = str(vocab_file) self.do_lower_case ...
44673cec183dc2596141854d82a8b4fc321dc2090b77e064c882edb83ac40d9d
Python
8,824
255
import math import torch from torch import nn as nn from torch.nn import functional as F from torch.nn import init as init from torch.nn.modules.batchnorm import _BatchNorm from basicsr.utils import get_root_logger # try: # from basicsr.models.ops.dcn import (ModulatedDeformConvPack, # ...
2482bbc6044ac1bdd65702786af46c534b1ae93722780f34b6275d81a2e35bd5
Python
8,825
273
from typing import List, Dict, Union, Callable from abc import ABC import logging import os from medperf.utils import sanitize_path import yaml from medperf.exceptions import MedperfException, InvalidArgumentError from medperf.entities.schemas import MedperfSchema from typing import Type, TypeVar from medperf.account_m...
426b329d68ae1a1485de3bb4757ef90bde3c80a33dfe920b0b8d3aec696df1cb
Python
8,835
255
from abc import ABC, abstractmethod import ase import numpy as np import numpy.typing as npt import torch from einops import einsum, reduce from scipy.special import softmax # type: ignore class PriorManifold(ABC): @abstractmethod def initialise_positions(self, molecule: ase.Atoms, scale: float) -> ase.Atom...
87155f92317c66028008498b00343ae878bbdb9676ce984b9ea5deed094c6072
Python
8,839
269
from rest_framework import status from medperf.tests import MedPerfTest from parameterized import parameterized, parameterized_class class CertificateTest(MedPerfTest): def generic_setup(self): # setup users cert_owner = "cert_owner" ca_owner = "ca_owner" other_user = "other_user...
47a4986a3d9bfb4b42c8e84281ac5fab47bbbad3fac2573440fc1778120203b0
Python
8,842
219
import quantities import pkg_resources try: import cPickle as pickle except: import pickle import gzip from hippounit import plottools import matplotlib.pyplot as plt import os import numpy from quantities import mV, nA, ms, V, s import json import collections # adding the result data to dictionary data_dict ...
3c09ba1bd5d963f21e67b951cf4d95d45d5b19c49cbd052b6ee0e0b443c4a767
Python
8,844
249
from rest_framework import status from medperf.tests import MedPerfTest from parameterized import parameterized, parameterized_class class BenchmarkCertificatesTest(MedPerfTest): def generic_setup(self): # setup users bmk_owner = "bmk_owner" prep_mlcube_owner = "prep_mlcube_owner" ...
a116d189257c0cf731378e1618867db91931f828d24663fcf6ea682b787f82f7
Python
8,845
158
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
8e875513f93e617abfc6a48aadf849bcc46864be2ca098c1e6a48469bcc84b14
Python
8,858
269
"""Tests for running inplace prediction.""" from concurrent.futures import ThreadPoolExecutor from typing import List, Union import numpy as np import pandas as pd import pytest from scipy import sparse import xgboost as xgb from xgboost import testing as tm from xgboost.testing.data import np_dtypes, pd_dtypes from...
a30a5c0b8538541f3e5aadbd2a69731fc52132d42f22362f4e2881adb1faa12f
Python
8,860
199
import numpy as np import pytest from guppy.analysis import control_fit from guppy.analysis.artifact_removal import retained_chunk_indices from guppy.analysis.control_fit import ControlFitModel, select_fit_window_indices def _fit_and_predict(control, signal, method="OLS", photobleaching_detrend=False): """Fit on...
e5d02bf8398927be65e5dc10357110af378f6baba33be739ea47a4ce698941a8
Python
8,862
295
""" Validate a Nearl installation. Run with ``python -m nearl.valid_installation``. The static checks need no GPU, so a build can be verified on a GPU-less login node before spending an allocation. Checks that have to launch a kernel are reported as skipped rather than passed when no CUDA device is visible; ``--requir...
4d72421645e22ffcb63ff5ad9aa7302bfc616b7633564d04d7f9c5e54360ea89
Python
8,864
238
""" Deal with SCT dataset metadata Copyright (c) 2018 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ import io import os import re from operator import itemgetter from spinalcordtoolbox.utils.shell import parse_num_list class InfoLabel(object): """ Class representing data a...
57815d12abd8e02df453338c9339cbd3e9501214b00e64b735d1b6a5d1f1f388
Python
8,868
199
#!/usr/bin/env python import torch import numpy as np import pandas as pd import time import os from shutil import copyfile from models.model import RNN from MCMG_utils.data_structs_fragment import Vocabulary, Experience from properties import multi_scoring_functions_one_hot_dual from properties import get_scoring_f...
994ec17215c648cd9ddd8d142f2926dadda7d5734bfc1bda9b2c188d05ba9059
Python
8,869
187
"""io.py Input/Output functions to aid in analyses done for (Fickling et al., 2025) author: Logan James Fickling github.com/LoganJF TODO: Come up with more sensible loading scheme. Perhaps have a function for the path finding stuff, and just call that? """ import numpy as np import pandas as pd from glob import glob...
40e411505921ba79ef7ebdf081d472ec85ba7b82ce90586c75032a96f11b16d3
Python
8,872
194
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
58407ec2b19541f111dbeac6eb46748b1941af50cdfb7f9d80284ba7754fb4fa
Python
8,873
295
import math from functools import partial import torch import torch.nn as nn import torch.nn.functional as F def get_inplanes(): return [64, 128, 256, 512] def conv1x3x3(in_planes, mid_planes, stride=1): return nn.Conv3d( in_planes, mid_planes, kernel_size=(1, 3, 3), stride=...
85bf51a3943235a805cce0f9f86ace2edd07f90bb5eb7689ba702519e98710ce
Python
8,874
192
# coding: utf-8 # Copyright 2019 Sinovation Ventures AI Institute # # 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 app...
ba70371b0c09182b38f70834c3825d1db2490e93df14f0090f128d8e1f6c08ef
Python
8,876
213
# Copyright (c) OpenMMLab. All rights reserved. import os import os.path as osp import tempfile from unittest import TestCase import cv2 import mmcv import numpy as np import torch from mmengine.structures import PixelData from mmseg.structures import SegDataSample from mmseg.visualization import SegLocalVisualizer ...
a7e7f71ac8e7d1daa86cbf7004025f2f98ec5d1e560d8071befb54709e407c03
Python
8,880
230
# -*- coding: utf-8 -*- # A 'tree' is a networkx.DiGraph with a single root node (a node without parents) import networkx as nx from collections import defaultdict from itertools import islice from math import sqrt from operator import itemgetter from typing import Any, DefaultDict, Dict, List, Optional, Set, Tuple ...
c5f4a68cc7042cca852782fb4b796756056e15da66e986e21eee4aa487a3d06f
Python
8,884
253
#!/usr/bin/env python # # Copyright 2009, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
ef748d80dc29721e0d13cc0caf7d29057a90b9606c7125007668c6e6f8abb89e
Python
8,884
193
#!/usr/bin/env python import argparse import warnings import torch import numpy as np import pandas as pd import time from models.model_rnn import RNN from MCMG_utils.data_structs import Vocabulary, Experience from properties import multi_scoring_functions_one_hot_dual from properties import get_scoring_function, qe...
e68b1f92e5625d267b81dd012216de2b70a1b44d0cb5caee852f1790d4706fdf
Python
8,885
199
#!/usr/bin/env python import torch import numpy as np import pandas as pd import time import os from shutil import copyfile from models.model import RNN from MCMG_utils.data_structs_fragment import Vocabulary, Experience from properties import multi_scoring_functions_one_hot_dual from properties import get_scoring_f...
658b224371d5f7eef1792267274a3aee5aadc06f2b1fc963cc95ae8f96c4ab78
Python
8,889
216
"""This module is to handle saving results in a structured way. This also includes testing if results are available for all layers of the model and merging results from different runs. Class ResultsManager: - saves results in a structured way - checks if results are available for all layers - merges result...
76be8ad0c969e557f0fd095a72b68caa81e9e012e6b7cdd84b69c857fe20fa4c
Python
8,898
233
# -*- coding: utf-8 -*- import json import time from unittest import skipUnless from django.conf import settings from django.core.cache import cache from django.db import connection, transaction, InternalError from django.test import Client, TestCase, TransactionTestCase from guardian.shortcuts import assign_perm fro...
0760dfcd9ca51e7b5c933ea0cd469a8f614c96c676a1e7084fed02c3923e7f51
Python
8,904
223
############################################################ # See https://github.com/raphael-group/GASTON/blob/main/src/gaston/segmented_fit.py ############################################################ from tqdm import trange from sklearn import linear_model,preprocessing import numpy as np from scipy.stats impor...
c86dd197929d0817d5f26d9897195a7f4dce154992cecc7eb035523bd15144c8
Python
8,905
200
import os import sys import torch.nn import pandas as pd from tqdm import tqdm # Dynamically append project root to sys.path ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if ROOT_DIR not in sys.path: sys.path.insert(0, ROOT_DIR) from PytorchModels.Models import RNN, LSTM, GRU from Pyto...
f7034ba7c4c411a3b15abe20027e1ecafd2ec91fd63149c6480469c5794cebda
Python
8,906
244
import logging from functools import partial from time import monotonic from typing import Literal import ase import numpy as np import torch from hydromace.interface import HydroMaceCalculator from mace.tools import AtomicNumberTable from simgen.atoms_cleanup import cleanup_atoms from simgen.calculators import MaceS...
f54e335ae844517a59fc31f9321546004a5feab6e46a7573c68df5773df5469b
Python
8,913
240
"""Tests for CLI auth commands (login, status, logout).""" from __future__ import annotations import json from datetime import UTC, datetime from unittest.mock import MagicMock, patch import httpx import pytest from typer.testing import CliRunner from zndraw.cli_agent import app from zndraw.state_file import StateF...
2cb1ba165eaf4ca9e3a5a9bc0d6e644b4fb847e7386618288981334999bd94a3
Python
8,914
164
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
f4d50c4304437a17007087d54ad43e22303196f0ca3dd188ed91c70526d28a9b
Python
8,916
198
import pytest from pprint import pprint from random import choice as rand_choice from CybORG import CybORG from CybORG.Simulator.Scenarios.EnterpriseScenarioGenerator import EnterpriseScenarioGenerator from CybORG.Agents import SleepAgent, EnterpriseGreenAgent from CybORG.Shared.Session import Session, VelociraptorSer...
caaac9545c66096ed3ae33736794943fb1ef5251334db96d964bc80a24f7da73
Python
8,918
257
# #START_LICENSE########################################################### # # # This file is part of the Environment for Tree Exploration program # (ETE). http://etetoolkit.org # # ETE is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the...
7c7e4328ed47d3e221d3d838d3e534fe6e2cd7f973f823332e1a4104b9937f01
Python
8,919
235
# coding=utf8 # Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint. # *Only* converts the UNet, VAE, and Text Encoder. # Does not convert optimizer state or any other thing. import argparse import os.path as osp import torch # =================# # UNet Conversion # # ==============...
b0bf4c99f5f90b99548faf80e2f18e103aa6816c10648529d8b0319f51223526
Python
8,921
304
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
d45eeb334c13339bfcbee4bc065d77b81b0123c602df203134c8ec8dc117058c
Python
8,944
275
import cv2 import random import numpy as np def mod_crop(img, scale): """Mod crop images, used during testing. Args: img (ndarray): Input image. scale (int): Scale factor. Returns: ndarray: Result image. """ img = img.copy() if img.ndim in (2, 3): h, w = img.sh...
9c65940a3f3d1d83c66a202f1bb3ecc252981050fbb9e4c7892e0421effcf421
Python
8,948
171
import numpy as np import math eps = np.finfo( float ).eps class BiasField: def __init__(self, imageSize, smoothingKernelSize): self.fullBasisFunctions = self.getBiasFieldBasisFunctions(imageSize, smoothingKernelSize) self.basisFunctions = self.fullBasisFunctions.copy() self.coefficients ...
d08502ac5d12c2998d3f1cf894237bc438afad84814d4ca582a6007af56df101
Python
8,948
253
#!/usr/bin/env python """ Module for calculations related to the contrast transfer function (CTF) in cryo-EM single particle analysis. """ from typing import Tuple, Union, TypeVar, Dict import numpy as np import torch Tensor = TypeVar('torch.tensor') class ContrastTransferFunction: def __init__( s...
a3593731f4fe238363825ff75966a4d60c900da974f75035f2ded9ab5ec0a5ff
Python
8,950
217
# This notebook is based on the AfDesign binder hallucination protocol in ColabDesign, which is published by Dr. Sergey Ovchinnikov on [GitHub](https://github.com/sokrypton/ColabDesign/tree/main/af) # # AfDesign - cyclic peptide binder design # For a given protein target and cyclic binder length, generate/hallucinate a...
8328a0188f791ac6a00304167130e0b993d08df21558c4fade5fc5910e2981c8
Python
8,961
247
import argparse import os import shutil import sys sys.path.append(".") import numpy as np import torch import torch.utils.tensorboard from easydict import EasyDict from rdkit import Chem from models.bond_predictor import BondPredictor from models.model import MolDiff from utils.misc import * from utils.reconstruct ...
7559c66ff20bf0e65e4ead75e2271aaad478e16e781e86c05d5033a98c71caf1
Python
8,967
272
""" Checks the OBMol and per-property label caches in :mod:`nearl.chemtools`. A cache is only correct if it is invisible: whatever the caller asks for, it must get what an uncached build would have returned. So the tests come in two halves - the cache hits (that the work really is skipped) and the cache misses (that c...
b6d5f890e2b09264d8428d321c618c4609cd3781884e7ed56a50f11a385d914a
Python
8,969
322
# Standard Library Imports import os from math import pi # Third Party Imports import numpy as np import tensorflow.compat.v1 as tf from tensorboard.backend.event_processing.event_accumulator import EventAccumulator def add_layer_summaries(layer, debug=False): """ :param layer: :return: """ weig...
ffae4a179a8766ab674006c36b0cc7e1fd8ecd94389c8c34ef294f5a31c2259e
Python
8,974
259
import logging import os import stat import urllib import uuid from collections.abc import ItemsView, Iterable, Iterator, KeysView, MutableSequence from typing import NamedTuple, Optional, cast from cwl_utils.types import CWLDirectoryType, CWLFileType, is_directory from mypy_extensions import mypyc_attr from schema_sa...
d336e93a391e1ac869de9522b3f3598180dd832fe7c00bef95c206f6ecb7c8d6
Python
8,975
256
"""Multi Objective CMA-es class""" """ Copyright (c) 2016-2022, EPFL/Blue Brain Project This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published ...
b1dec6844b92e6d278f70590e4e5727d0ef2a8f71a71235da81e1f9b4ea0b1d1
Python
8,977
245
# -*- coding: utf-8 -*- import json from typing import Any, Dict, Iterable from guardian.utils import get_anonymous_user from django.conf import settings from django.db import connection from django.http import HttpRequest, JsonResponse from django.contrib.auth.decorators import user_passes_test from django.contrib....
9ab8845599e0581eb817812b59fc3df476d7bf25f99ff9a767ffbb2debbb183f
Python
8,978
212
import torch import torch.nn as nn from transformers import AutoConfig, AutoTokenizer, AutoModel, BertForNextSentencePrediction import pickle from tqdm import tqdm import os import argparse import gc class PackedBert(nn.Module): def __init__(self, model_path ='bert_path', map_path='dataset/hf0812', pooling='cls'...
8686feef1f60c50bb2c887bf2aaf18c879e0572aa68a6823484637dcb85df10f
Python
8,980
231
""" 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 ase.db.sqlite import ase.io.trajectory import numpy as np import torch from torch_geometric.data import Data from ocpmodels.common.ut...
b51404718c0d38f381293c8e5e00a15d129651b7f09b1158002d8974a30967b5
Python
8,980
239
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import math from typing import Any, Optional, Tuple import numpy as np import torch from torch import nn class Positio...
d288bc9dd41ff37b9d8a3f160fcc212a7e3644014d566883d43058189d9f5d1b
Python
8,981
276
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import torch from torch_geometric.nn import SchNet from torch_scatter import scatter from ocpmodels.common.registry import registry from ocp...
9ae9f76c3d60b85c47ef18df8bf2f4b072ecdf4cbfda4af470ba5793b591eddc
Python
8,984
282
"""Tests for Progress REST API endpoints.""" import json import pytest from helpers import ( MockSioServer, auth_header, create_test_room, create_test_user_in_db, ) from httpx import AsyncClient from redis.asyncio import Redis from sqlalchemy.ext.asyncio import AsyncSession from zndraw.redis import R...
eea078583e49d54339009a6701099c61195afc3e538752af539dc9e91c8c5e76
Python
8,985
253
# Copyright (c) OpenMMLab. All rights reserved. from typing import Dict, List, Optional, Sequence, Union import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import build_conv_layer, build_norm_layer, build_upsample_layer from mmengine.model import BaseModule from torch import Tensor from ...
f3ff254919b737cd7208d88673ff330b6d5c9cf707447960c2bebe3e6e5aea2b
Python
8,989
263
import pathlib import subprocess import tempfile from collections.abc import Iterable from dataclasses import dataclass import ase import ase.io as aio import fire import numpy as np import pandas as pd import zntrack from rdkit import Chem from simgen.analysis import ( analyse_base, analyse_calculator, a...
2a3f7c4baed5a7416c93bef94c02e730f0ce26e3e3640fc080ff249909a7fee6
Python
8,997
159
#!/usr/bin/env python3 # created by Daiki Sato and updated on 2025/3/20 # python3 5_2_4_simulation_groupsinglemovediversity.py 10 0 import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np import pandas as pd import math import sys import os args = sys.argv num_agents = 6 ...
8d42f079561dda8aa03972889080e78b1d55c4fd5a8bb73b9ed5b2d70e8cf910
Python
9,008
270
from typing import Tuple import torch.nn as nn from monai.networks.blocks.dynunet_block import UnetOutBlock from monai.networks.blocks.unetr_block import UnetrBasicBlock, UnetrUpBlock from typing import Union import torch.nn.functional as F # from lib.utils.tools.logger import Logger as Log # from lib.models.tools.mo...
acb92a21aef7ecd38a5a543f1498a1822262cfc8ae718fb946a0e1f1010f06e0
Python
9,008
159
#!/usr/bin/env python3 # created by Daiki Sato and updated on 2025/3/20 # python3 5_2_5_simulation_groupsocialcontagiondiversity.py 10 0.1 import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np import pandas as pd import math import sys import os args = sys.argv num_agents = 6 ...
126a55677f0d7bb2332861b997572af1065b902e2e07516703cfd75b8bb02446
Python
9,009
220
from typing import List from ipaddress import IPv4Address from CybORG.Simulator.Actions.Action import RemoteAction from CybORG.Simulator.State import State from CybORG.Shared import Observation from CybORG.Simulator.HostEvents import NetworkConnection from CybORG.Shared.Enums import ProcessName class GreenAccessServ...
c3650e870a8a24e5069206a2ae345222d4964b527f67ebc206e02e0c76e488eb
Python
9,009
215
from PyQt5 import QtCore, QtWidgets, QtGui from pystackreg import StackReg from copy import deepcopy from dipy.align.imwarp import SymmetricDiffeomorphicRegistration from dipy.align.metrics import CCMetric import numpy as np from features.Feature import Feature from util.conf import mc_params from threads.Worker impor...
372e8ad8da0243b4020f16252e67817ce2f82c26a7689b26f4079aa0ad08b567
Python
9,010
274
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import torch from torch_geometric.nn import SchNet from torch_scatter import scatter from ocpmodels.common.registry import registry from ocp...
ab11ee885458f64cb5d705f4adda9b387b10bfcc4f709c4efe244b9c745743ac
Python
9,011
216
import numpy as np import igraph as ig from collections import Counter from utils import retrieve_multiple_edges INF = float("inf") class PatternChecker(object): def __init__(self): pass @classmethod def node_compat_fn(cls, g1, g2, v1, v2): vertex1 = g1.vs[v1] vertex2 = g2.vs[...
3e8a0b7cd4fe0ed74d7f232ae8c1da9ad56e769bc87559429d33761ddedfe184
Python
9,013
201
#!/usr/bin/env python import torch import numpy as np import pandas as pd import time import os from shutil import copyfile from models.model import RNN from MCMG_utils.data_structs_fragment import Vocabulary, Experience from properties import multi_scoring_functions_one_hot_dual from properties import get_scoring_f...
670e4a621e645385a52aa03aabca063a20be0521eaa287e302354b45d231b9a3
Python
9,015
310
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Apr 14 11:52:24 2023 @author: george """ import os from os.path import expanduser import numpy as np from qtpy import QtGui, QtWidgets, QtCore from time import time from distutils.version import StrictVersion import pyqtgraph as pg import pandas as pd...
e3fe52d006fa93c5ff8474e6f67ecac2b2ad25b0f6d4e8ce925e52d50dd7173f
Python
9,018
231
import logging import math import re from pathlib import Path import numpy as np import pandas as pd from .io_utils import recording_site_from_preprocessed_label logger = logging.getLogger(__name__) def create_Df_for_psth(filepath: str, event: str, name: str, psth: np.ndarray, columns: list[object]) -> None: "...
fcb3cc78a6aa5a615da0ac8cc5c9481b8fa0bd3513c072079b1bfd294e75988e
Python
9,019
252
"""Module to evaluate generic functions on rows of dataframe.""" import logging import sys import traceback from functools import partial import pandas as pd from tqdm import tqdm from emodel_generalisation.parallel.database import DataBase from emodel_generalisation.parallel.parallel import DaskDataFrameFactory from...
72b4d97b02000d62e32c1676d6fb351f1a606c05067bb8f34571c5357814cdc0
Python
9,021
179
# Generate events files for task-faces # This script reads raw behavior data files from d_beh for task-faces, extracts time stamps and design information, and stores them in new *events.tsv files accompanying BOLD files. # For more information, please see README.md and the associated paper (Jung et al., 2024) import...
2af85e51a0e20bdcd5334170e2c2e23b8c786c5f1bfeed0586600242fbb8ecce
Python
9,022
303
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 2 10:38:57 2021 Epochs helping function @author: leupinv """ import pandas as pd import numpy as np import mne from mne.preprocessing import ICA import base.files_in_out as files_in_out import feather import epochs.epochs_constants as cs def fi...
066c8dafd12e1d1833eb2ba637fb397ada85444ad6c60d4aa07324ec15236c61
Python
9,029
189
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
29ad9737d969447bd5f53c408f7d67fcdfef3061752ac14ba88a1f69a0c74ec1
Python
9,032
204
import numpy as np import pytest from guppy.analysis.psth_significance import ( BOOTSTRAP_SEED, bootstrap_difference_confidence_interval, bootstrap_mean_confidence_interval, minimum_consecutive_samples_for, significant_sample_mask, ) @pytest.fixture def rng(): return np.random.default_rng(BOO...
c35e171ef39658f1ca69aff9de4ab16ad683094e6d2d1e8e21b33be2e306188c
Python
9,038
249
import yaml import argparse import csv from pathlib import Path from dataset import backbone_dataset import tensorflow as tf from models import MultiStageModel class Inference: def __init__( self, data_root, params_file, feature_extraction_weights_path, mstcn_weights_path,...
79cc47f2092e32b1e1d232d33931a52954b359650377063f49917e60b4f9f501
Python
9,040
249
#!/usr/bin/env python # Load a virtual environment to run MagellanMapper """Cross-platform environment activation and MagellanMapper launcher script. Launches MagellanMapper within a Conda or Venv environment. Environment activation is in this order: * If a Conda or Venv environment is already activate, launch in curr...
38e84c36120f66265f41fbffc8c8e97d843606e9697f652e745436cf7e666d99
Python
9,044
240
""" Computations on the Hyperbolic space H_n as embedded in Minkowski space R^{1,n}. Elements of the Hyperbolic space are the elements of Minkowski space of squared norm -1. NB: we use "riemannian" to refer to "pseudo-riemannian". """ import logging import numpy as np import math from geomstats.minkowski_space impo...
0432f6aa1f5e636d766c5502f9a2b2332147b6f37656058d3002629843beb19a
Python
9,045
227
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # Borrowed from https://github.com/facebookresearch/segment-anything from typing import Any, Optional, Tuple, Type impor...
a476339ddd3074aa1bcb42dd9d737e1fa518af78b4376473945ea33ad2113c69
Python
9,048
168
# pytest unit tests for sct_register_multimodal import os import pytest import logging import numpy as np from spinalcordtoolbox.image import Image from spinalcordtoolbox.utils.sys import sct_dir_local_path, sct_test_path from spinalcordtoolbox.scripts import sct_register_multimodal, sct_create_mask logger = loggin...
4209db2f72e253e7d751cdd39b6f6f5999d3ff1721dd2f91df5e8f136589eeb4
Python
9,051
232
"""Panel component that renders what one DANDI NWB asset holds. Given an :class:`~guppy.utils.dandi_preview.AssetPreview`, it shows the file's channels, the recording sites and indicators behind them, the store names Step 1 will ask for labels against, and the first seconds of every trace. A file holding several respo...
0baba9b1ede9c8f812a0e9fe1f8a361f9d8c49b3103a8fa4e6bb6e477353749b
Python
9,061
298
from medperf.exceptions import ( CommunicationError, InvalidArgumentError, ExecutionError, CleanExit, ) import pytest from medperf.tests.mocks.dataset import TestDataset from medperf.tests.mocks.cube import TestCube from medperf.commands.dataset.prepare import DataPreparation, Observer PATCH_REGISTER ...
b116608e3d642ff3672c83c8aabeb1111d27c8b415ac45a8c7c217760d25b8a0
Python
9,062
245
from scipy.stats import zscore import numpy as np from math import ceil import torch from run_moe_script import * from isodepth_scaling import adjust_isodepth # outlier threshold doesnt show points that are far away # set to np.inf if you want to show all points def plot_all_isodepths(output_folder,seed,model='final_...
da30ccc13f0832deaed82903efa1d33db7673e8fa454ee227b53471e343c03eb
Python
9,066
295
"""Contains classes and functions for logging.""" from __future__ import annotations from collections.abc import Mapping from typing import TYPE_CHECKING, Any from colorama import Fore, just_fix_windows_console if TYPE_CHECKING: from bayes_opt_dnn.parameter import ParameterConfig just_fix_windows_console() c...
779318ff01a700ffec6440d0f9eff373958c80f631b2da3c1891dfd0c44e782b
Python
9,069
233
########################################################################################### # Implementation of the symmetric contraction algorithm presented in the MACE paper # (Batatia et al, MACE: Higher Order Equivariant Message Passing Neural Networks for Fast and Accurate Force Fields , Eq.10 and 11) # Authors: I...
ce03739b64d13e29087dbe1f541e08533a36ae07bb2fe15c0d6ca948af6de783
Python
9,072
245
""" Computations on the n-dimensional sphere embedded in the (n+1)-dimensional Euclidean space. """ import logging import math import numpy as np from geomstats.euclidean_space import EuclideanMetric from geomstats.manifold import Manifold from geomstats.riemannian_metric import RiemannianMetric import geomstats.vect...
47dd3a0be18e76d1decb27423dbd1c7afe62a12fcbf8247d9e0ecdb7a306c0c3
Python
9,073
288
from typing import List, Union, Any from neo4j import GraphDatabase, Neo4jDriver, Session from kgx.config import get_logger from kgx.error_detection import ErrorType from kgx.sink.sink import Sink from kgx.source.source import DEFAULT_NODE_CATEGORY log = get_logger() class NeoSink(Sink): """ NeoSink is respo...
d37a94cfacac07989e9027076e8bc451f26421b9cade69aea7b3c9210f96cc98
Python
9,078
179
import numpy as np import pyqtgraph as pg from PyQt5.QtCore import Qt # Enable antialiasing for prettier plots pg.setConfigOptions(antialias=True) class PlotWindow(pg.PlotItem): def __init__(self): pg.PlotItem.__init__(self) # Initialize the class instance variables. self.x = None ...
3aa01147067001b1282659239bfefb0e8a4be7c0dfb0ad4c29a7fc9566ff6d9e
Python
9,080
265
import numpy as np import math import os import sys import gmsh # gmsh.model.occ.addBox(x, y, z, dx, dy, dz, tag = -1) # gmsh.model.occ.addBox(x, y, z, dx, dy, dz, tag = -1) # gmsh.model.occ.addCone(x, y, z, dx, dy, dz, r1, r2, tag = -1, angle = 2*pi) # gmsh.model.occ.addCylinder(x, y, z, dx, dy, dz, r, tag =...