sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
fee9b1fb9fabd65ae7edf937477057345198d0eaa8085b8998c73a76dcd9c8c9
Python
5,186
265
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import shutil from functools import partial from glob import glob import numpy as np from mmengine.utils import (mkdir_or_exist, track_parallel_progress, track_progress) from PIL import Image COCO_LEN = 1...
487440a9ce558b81585fdb684f304fe055e7dd79a3cf9ef656e9eb2110e23212
Python
5,188
160
import logging import os import ase.io as ase_io import numpy as np import torch from simgen.element_swapping import SwappingAtomicNumberTable from simgen.generation_utils import calculate_restorative_force_strength from simgen.integrators import IntegrationParameters from simgen.manifolds import MultivariateGaussian...
4c6791fb304a4a6777e2599f114457eac843e17bdc97ea01bd999668ced0c944
Python
5,189
143
import numpy as np from scipy.optimize import NonlinearConstraint from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import Matern from typing import Any, Mapping, Callable, Optional, Union, Tuple import random from scipy import stats from sklearn import metrics from te...
5b3af206f8d03ff43133a4bc5347c115c358eb49125a6e655bf0e8aafb0cb313
Python
5,190
194
import sys import re import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import deepxde as dde from pathlib import Path from parameters import N, beta, sigma, S0, I0, R0 sns.set_theme(style="whitegrid") def dinn( data_observed, parameters, hyperparameters, e...
d3fdca89af1328732ef8e69e523960c90907222cc776a1a04948eaeeb9960b54
Python
5,191
168
from __future__ import absolute_import from ..utils.generic_utils import deserialize_keras_object from ..engine.base_layer import Layer from ..engine import Input from ..engine import InputLayer from ..engine.base_layer import InputSpec from .merge import Add from .merge import Subtract from .merge import Multiply fr...
977c61185de96f8e330d349b77ed796481ebedae0ad3c00d5a7aaabe1c5a4e2b
Python
5,192
128
import numpy as np import torch as th from .gaussian_diffusion import GaussianDiffusion def space_timesteps(num_timesteps, section_counts): """ Create a list of timesteps to use from an original diffusion process, given the number of timesteps we want to take from equally-sized portions of the origin...
6cf1510187b2bb70e9795e6fa5fc2e14b6f7a01c1e334b0ad8a0da90035539dc
Python
5,193
117
# import pandas as pd # import matplotlib.pyplot as plt # import numpy as np # import seaborn as sns # # # # Load your dataset # # df = pd.read_csv('../CSV/Data/Random_Split.csv', low_memory=False) # # df['PAMPA_clipped'] = df['PAMPA'].clip(lower=-8, upper=-4) # # # # df_89 = pd.read_csv('../CSV/Data/mol_length_89.csv'...
5ee681cf3e9a55993cebf590941bf68ae5e83047990eed92e5cc4100d549a4dc
Python
5,195
115
import numpy as np import pandas as pd import os def generate_pseudo_bulk(st_adata, label_df, save_csv=False, output_path="pseudo_bulk.csv"): """ Generate a pseudo-bulk expression profile by summing expression across spots in each cluster. Parameters: - st_adata: AnnData object containing spa...
c290aa8ad0a8394e947e13ef3230d4463f0f98b01dc285a221c178f666c4bc6a
Python
5,195
191
import sys import re import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import deepxde as dde from pathlib import Path from parameters import N, beta, sigma, S0, I0, R0 sns.set_theme(style="whitegrid") def dinn( data_observed, parameters, hyperparameters, e...
147eeb80e60114fedd218b6bf2a83ba7be568dddff6da71b16501a6d8cb9ff19
Python
5,201
161
# BigStitcher script via ImageJ/Fiji # Author: David Young, 2017, 2018 """Stitches multi-series imaginge files (eg CZI format) through the Fiji BigStitcher plugin. Attributes: in_file: Path to the image input file. The dataset filename will be based on this input name, using the part of the name before th...
ca30fd3d5ac24719082edef1187506b562adfd1b2767f4228b8eee67b465321b
Python
5,201
159
#!/usr/bin/env python """ MetaWIBELE: abundance_RPK module Normalize family abundance to RPK (read counts divided by the length of genes in kilobase to normlized for gene/protein length) Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of...
decdd40fedcfa7e486002fa8945f3531668984cedcfb350fe896beabcf2cf3ab
Python
5,204
150
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GATConv # full connected layer def full_block(in_features, out_features, p_drop=0.0): return nn.Sequential( nn.Linear(in_features, out_features, bias=True), nn.ReLU(), nn.Dropout(p=p_drop), ...
8959e8fdd90ec488687a6761654ce9b58c7d17f81a9be7437bb21480bf70dfec
Python
5,206
89
import ast import json # Starting with a conflation file, and a set of compendia, create a new compendium merging conflated cliques. def get_conflation_ids(conffilename): """Given the name of a conflation file, where each line looks like: ['RXCUI:1092396', 'RXCUI:849078', 'PUBCHEM.COMPOUND:446284', 'RXCUI:18...
a2b11159d92fac63f43b72559d940d8d495e56a1da8c415a0583f4547412a8a8
Python
5,208
173
"""StochKv cell example""" # pylint: disable=R0914 import os import bluepyopt.ephys as ephys script_dir = os.path.dirname(__file__) morph_dir = os.path.join(script_dir, 'morphology') def stochkv_hoc_filename(deterministic=False): """Return stochkv hoc model filename""" return os.path.join( script_...
94239a8c1ffe2228b263930d8bed8ec9d3e6e2641d284396bc0b78e59deb0c95
Python
5,210
128
from PyQt5 import QtGui, QtWidgets, QtCore import pyqtgraph as pg import numpy as np from scipy import signal from util.conf import sg_savitzky_golay_params, sg_moving_average_params, sg_butterworth_params, sg_scaled_window_convolution_params from util.functions import movingAverage, butter_lowpass_filter from feature...
f0f26c003d26ba2e52057214211c04509ae020579817821a65c23a3258959e90
Python
5,210
160
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 13 12:47:07 2023 @author: george """ import numpy as np import pandas as pd import os from scipy.optimize import curve_fit from matplotlib import pyplot as plt # exponential decay functions for curve fitting def exp_dec(x, A1, tau): return 1 + ...
dfc27ed1b32429bf8ba20629abf225049b01ad5ec98b0140f82b04f945803e43
Python
5,213
129
# Helper for vertically centered, styled message in the mutagenesis logo container def mutagenesis_message(msg): return html.Div( html.P(msg, style={"color": "gray", "fontSize": "14px", "margin": "0", "fontFamily": "inherit"}), style={"display": "flex", "flexDirection": "column", "justifyContent": "...
ae449d274c92176b5916bf422d22e8bc921718753c941b7839f0c576637b46bb
Python
5,214
151
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmseg.models.backbones import CGNet from mmseg.models.backbones.cgnet import (ContextGuidedBlock, GlobalContextExtractor) def test_cgnet_GlobalContextExtractor(): block = GlobalContextExtract...
3d87fa9cf242d7788974eb490a25fcbd4e59466aee9f31adbcfbc59d2859838b
Python
5,215
143
import os import sys import csv import torch import numpy as np from const import * from itertools import islice from torch_geometric import data as DATA from torch_geometric.data import InMemoryDataset class MyTestDataset(InMemoryDataset): def __init__(self, root='/tmp', dataset='_drug1', xd=Non...
97937e9176de6632a3806ce2fbf86b5707ea7c2ba7c9b71eaf5bab218b74ae6c
Python
5,218
118
import numpy as np import matplotlib.pyplot as plt import hickle as hkl from grid_cell.higham import nearestPD, isPD import itertools from grid_cell.manifold_fitter import label_mesh from grid_cell.sphere_manifold import Circle_Manifold from grid_cell.ori_tuning_manifold import Ori_Tuning_Manifold, Place_Cell_Manifold ...
9bee91e88a5c0d739f62dcd7a40f3672d646801edafd408642219f32165cde84
Python
5,218
120
from __future__ import division from builtins import str from builtins import range from sciunit import Score import numpy from sciunit.utils import assert_dimensionless import collections class ZScore_backpropagatingAP(Score): """ Average of Z scores. A float indicating the average of standardized difference...
3e94088e9615f463a5eaa002b081d0084ae5cd20ab032eed63b3443cd3d61986
Python
5,220
140
""" purpose of this file remove filenames with __dup from the IntendedFor and the scans.tsv """ # 1. git annex unlock scans.tsv # 1-1. delete row of __dup file from scans.tsv # 1-2. git lock scans.tsv # 2. git annex unlock .json # 2-1. delete item of __dup from .json # 2-2. need to handle list of items (commas?) impo...
8406b35d4cc2b944282c51066701f8ca11dffbd8304218512266040f0d99c593
Python
5,222
146
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 3 10:34:51 2023 @author: schwab """ from pathlib import Path from typing import Optional import torch from torch.utils.data import DataLoader from typer import Option import os import sys from ..data.handlers.particle_image_preprocessor import \...
9087d02d1d294b86eca4b0a78f8b10e9dc3a911cf40d8166cc8608c6e470c551
Python
5,222
112
import catmaid.fields from django.conf import settings import django.contrib.postgres.fields import django.contrib.postgres.functions from django.db import migrations, models import django.db.models.deletion import uuid forward = """ CREATE TABLE catmaid_project_token ( id int GENERATED BY DEFAULT AS IDEN...
9bea0797d39d39a2f48a5ad95d46ce7ed8d1174919efd364239198e0bbc9b837
Python
5,222
121
"""Context-Aware Implicit Neural Representations to Compress Earth Systems Model Data DEVELOPED AT: Department of Chemical Engineering University of Utah, Salt Lake City, Utah 84112, USA DIRECTOR: Prof. Salah A Faroughi DEVELOPED BY: ...
92989ab3a0eb5d8fad36baccbc16379f8dc473e06036ec5bd4e10e1f6bd5ae23
Python
5,227
150
# 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...
17094668f09362926cdd184f11ee8abda5301a6b6d2613949cea5103f53c87d7
Python
5,229
162
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # pyre-strict # pyre-ignore-all-errors[2] import typing import unittest from collections import Counter, defaultdict from typing import Any, Dict, List, Tuple import torch import torch.nn as nn from fvcore.nn.activation_count import activation_c...
7d6e1026facdbb81f0f8dac7eae2d506c5d818b7e27f1ac10d825b99346ad8c6
Python
5,229
151
""" Add `extra_repr` into DropPath implemented by timm for displaying more info. """ import torch import torch.nn as nn import torch.nn.functional as F from e3nn import o3 def drop_path( x: torch.Tensor, drop_prob: float = 0.0, training: bool = False ) -> torch.Tensor: """Drop paths (Stochastic Dept...
947ec5a5eec8e2852f7ff12b8cc4c885fb7be86aeb2f94e4641106a92d0b8213
Python
5,230
186
import os import shutil from glob import glob from pathlib import Path import datetime from collections import defaultdict import urllib import numpy as np from datasets import DatasetDict, Dataset from transformers import AutoTokenizer from transformers import AdapterType from transformers import AutoConfig, AutoMode...
81b92abb85145693db499e6ba036853a980e9e96412a443c692fcddc0dd27aa7
Python
5,232
116
import h5py import numpy as np import pandas as pd import pytest from guppy.analysis.control_channel import ( add_control_channel, create_control_channel, curveFitFn, helper_create_control_channel, ) def test_curve_fit_fn_known_params_at_x_zero(): # a + b * exp(-(1/c) * 0) = a + b result = cu...
402f9f14b5e461df79b0ae26db8c6ad9804c8fb2d5e2e4ba10452e3baf4845f2
Python
5,233
167
import logging from pathlib import Path import anyio from fastapi import HTTPException, Security from fastapi.security import APIKeyCookie, APIKeyHeader from fastapi.templating import Jinja2Templates from importlib import resources from urllib.parse import urlparse from fastapi.requests import Request from...
6279855adbf0cce0042873ae816565b6e6d376beed90a2d88bd2d5920521a212
Python
5,236
114
try: import cPickle as pickle except: import pickle import gzip import numpy import os import matplotlib import matplotlib.pyplot as plt #base_dir = '/mnt/csoport31-2/Modellezo_csapat/CA1_pyramidal/Spine_project_validation_results6/Basic_set_newopt/Active_all_spine_na_dend_soma_start/temp_data/oblique_integra...
0f2bf563d3b0e22474111566b9bcdf3cf7d4e0e98bbe31a3c05970d70699dd1e
Python
5,240
89
# 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...
f0e73a175b6648923b36d0a89cf3c46ab8b2b99f3e96704506c66ed536f17b76
Python
5,241
173
"""StochKv3 cell example""" # pylint: disable=R0914 import os import bluepyopt.ephys as ephys script_dir = os.path.dirname(__file__) morph_dir = os.path.join(script_dir, 'morphology') def stochkv3_hoc_filename(deterministic=False): """Return stochkv3 hoc model filename""" return os.path.join( scri...
13b93d351e837103362cf276f2f5df6c352174d69a8e7f402d3effda5a9370b6
Python
5,243
134
import logging from pathlib import Path import socketio from fastapi import FastAPI, Request from fastapi.exceptions import RequestValidationError from fastapi.responses import FileResponse, JSONResponse from starlette.staticfiles import StaticFiles from zndraw.database import lifespan from zndraw.dependencies import...
17390adba85dce99744f8d91794674988c2f5d85353574db206491206321321e
Python
5,243
203
#!/usr/bin/env python # coding: utf-8 # # Fichier Exemple : utilisation des modèles développés # ### 1. Modèle IA pour TC # ### 2. Modèle IA pour PC # ### 3. Modèle IA pour ACEN # ### 4. Modèle IA pour NBP - normal boiling point # ### 5. Modèle IA pour TTR - point triple # ### 6. Modèle IA pour VC # ### Copyright - LR...
7a22ae00ad121cee64bcd1aff7260b9b40b08b621bfbaa6c9784ddd5a6ff9767
Python
5,243
141
import numpy as np from sklearn.decomposition import PCA import matplotlib.pyplot as plt def get_sphere_mesh(): u = np.linspace(0, 2 *np.pi, 100) v = np.linspace(0, np.pi, 100) x_sphere = np.outer(np.cos(u), np.sin(v)) y_sphere = np.outer(np.sin(u), np.sin(v)) z_sphere = np.outer(np.ones(np.size(u)...
74adcf6952ae9c55782968f126a752b0c7200b9c8a6e7e09e8b05cc5f4b641c7
Python
5,245
122
DOCS = """ train the model on the a dataset (gabor or mnist) and show the robustness of the model to noise. currently figure 4. """ from dataset import GaborDatasetOrientation from model import ShallowMLP, DenoisingAE from experiment.utils import set_seed, init_model, Logger, Trainer, AETrainer, Checkpointer from data...
338eb69fe62f239e96a7a11dc246b74954e7ddb689ce40f7f657e6ec961142c3
Python
5,249
128
import torch import numpy as np import usb.core import time class FPGAInterface: """Hardware interface for 32x32 memristor crossbar array""" def __init__(self): self.connected = self._initialize_hardware() self.analog_mode_enabled = False self.layer_mapping = { 'data_process...
736d27a33874d2e55a69d65389ba78bb1b0eb9d48ac29bbdd74e96f70160db3c
Python
5,250
101
""" Functions to get distance from PMJ for processing segmentation data Copyright (c) 2021 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ import logging import numpy as np from spinalcordtoolbox.image import Image from spinalcordtoolbox.centerline.core import get_centerline from spin...
0453db4f9d94ae5942a51adb0cb92660e2b830715fbc282ea159636a5bcf4ebb
Python
5,252
133
''' Date: 2022-08-06 13:47:37 LastEditors: yuhhong LastEditTime: 2022-11-21 16:05:50 ''' import os import argparse from tqdm import tqdm import pandas as pd from rdkit import Chem # suppress rdkit warning from rdkit import RDLogger RDLogger.DisableLog('rdApp.*') from rdkit.Chem import AllChem from rdk...
70be151facded2212662d843820eddd2d8e4141325421dd3c2bbf4f701d87b37
Python
5,252
163
from medperf.asset_management.gcp_utils import ( CCWorkloadID, GCPAssetConfig, GCPOperatorConfig, ) from medperf.entities.dataset import Dataset from medperf.entities.model import Model from medperf.entities.user import User from medperf.asset_management.asset_storage_manager import AssetStorageManager from...
e32f5dcda80c8530e05b25d2ee8e0bb903e295f0716098ffdeb636fe4fb66f11
Python
5,252
174
import os import re import yaml if os.name == 'nt': import win32api import pathlib as pl from datetime import date from string import ascii_uppercase as letters from myphdlib.interface.muscimol import MuscimolSession from myphdlib.interface.dreadds import DreaddsSession from myphdlib.interface.mlati import MlatiSes...
ac28b8f1cb0e6c9ec73e004549cabe5d2f8a8e4f6d3707bcd194003af7cdf73a
Python
5,254
158
import os import sys import csv import torch import numpy as np from const import * from itertools import islice from torch_geometric import data as DATA from torch_geometric.data import InMemoryDataset class MyTestDataset(InMemoryDataset): def __init__( self, root="/tmp", dataset="_drug1"...
69e5c744a4a5fcce0e4b118a3ea4d54efb1c389bef9da4f91d05bf3fac01439d
Python
5,259
158
import threading import random import torch import torch.multiprocessing as multiprocessing from torch.utils.data import DataLoader from torch.utils.data import SequentialSampler from torch.utils.data import RandomSampler from torch.utils.data import BatchSampler from torch.utils.data import _utils from torch.utils.da...
45c05656b1c2316dd48b913257b5d51c4999e2b482d129f025134db361ced63e
Python
5,261
114
from experiment import * import numpy as np import pandas as pd from datetime import datetime, timedelta from zigzeg import find_runs def get_datetime(date, timestamp): Y, M, D = date.split("_") h, m, s = timestamp.split("-") return datetime(int(Y), int(M), int(D), int(h), int(m), int(s)) if __name__ ==...
7fd5ba199d21e627a80c0a8a703ad412b9a5d8f20188390e158450f04bcb9eb1
Python
5,261
138
from django.db import migrations forward = """ CREATE OR REPLACE FUNCTION refresh_skeleton_summary_table_selectively(skeleton_ids bigint[]) RETURNS void LANGUAGE plpgsql AS $$ BEGIN -- Cable length, nodes, creation info, edition info WITH filtered_treenode AS ( SELECT * ...
16dad0e2e75bd87fc29a6176627db69d6b3d4278e7f3c3df1a35bff74757dcb3
Python
5,265
155
import datetime import os import sys import unittest from pathlib import Path from tempfile import TemporaryDirectory from unittest import TestCase import ffmpeg TEST_DIR = os.path.dirname(os.path.abspath(__file__)) PROJECT_DIR = os.path.abspath(os.path.join(TEST_DIR, os.pardir)) sys.path.insert(0, PROJECT_DIR) from...
548c10d8e0831d40e4d4c899c03742e6e8db3eb78fe3e906944916d7a16c6723
Python
5,267
106
"""``babel-clique-diff`` — compare the cliques in two Babel compendium builds. Argument parsing and output formatting only; the diff itself lives in :mod:`src.model.compendium_diff`, so a second tool or a pipeline rule can reuse it. Invocation:: uv run babel-clique-diff --before <dir> --after <dir> --files Disea...
8094fb8239271a209a6cb969ee1d466cbaf18807cb6ffa6e4ba121d9a1f0f298
Python
5,267
106
import os import xml.etree.ElementTree as ET import pandas as pd # Define the exact directories for suspicious and source documents suspicious_folder = r"C:\Users\medhat6969\Downloads\ExAraCorpusPAN2015\ExAraCorpusPAN2015\ExAraCorpusPAN2015\ExAraPlagDet-10-08-2015-Training\suspicious-documents" source_folder = r...
b44c53daa1e450fe1cdf20c7262459164a7da8d1b9b3c89ff14d16036272f2e3
Python
5,267
151
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Defines the CNN that performs the classification @author: Andrei Istudor andrei.istudor@gmail.com """ import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.nn import Linear, ReLU, Cross...
db4ffd34263440d365eba698e6d4c8942a11afb8bb00323ff4e6f9cdec4b65d2
Python
5,267
159
from typing import Tuple import numpy as np import pytest import xgboost as xgb from xgboost import testing as tm from xgboost.testing.updater import get_basescore rng = np.random.RandomState(1994) class TestEarlyStopping: @pytest.mark.skipif(**tm.no_sklearn()) def test_early_stopping_nonparallel(self): ...
69e9d392dc06f93fd9461e94f593be4f0ac7a4ce27d5549b81b7440662e0c810
Python
5,269
148
from bs4 import BeautifulSoup import matplotlib.pyplot as plt import numpy as np from analysisUtil import * from surrogateParams import surrParams import pandas as pd from guppy import hpy from multiprocessing.pool import Pool import os h = hpy() print(h.heap()) # get list of valid simtags reportFolder = './reportHTM...
9afc3679bf9304749d59f29573e2a930ddda1137d7dd453dbdafa2bada60087f
Python
5,269
160
import typing as T import logging import numpy as np import tsgm.types logger = logging.getLogger('dataset') logger.setLevel(logging.DEBUG) class DatasetProperties: """ Stores the properties of a dataset. Along with dimensions it can store properties of the covariates. """ def __init__(self, N: int...
cc80211e8dba30aeeed2304cd146c1fce493059764083afae3eb4b8dfe5cb1ef
Python
5,278
111
from PyQt5 import QtWidgets, QtCore, QtGui from view.Plot import Plot class ActivateMultipleDialog(QtWidgets.QDialog): """ Dialog that lets the user check for every object if the feature should be activated or deactivated. """ def __init__(self, data_manager, index): ""...
d8512601ec1bbbfa43a0bc9bd8bf8ef35d963f5519e304a795a6f6cb7018636b
Python
5,279
178
from heudiconv.cli.run import main as runner import os import os.path as op from mock import patch from six.moves import StringIO from glob import glob from os.path import join as pjoin, dirname import csv import re import pytest from .utils import TESTS_DATA_PATH import logging lgr = logging.getLogger(__name__) t...
77bf3cd6b27416938bfec20b8594cd099f6bb24ac3026b7acdb90c9a130b069a
Python
5,280
130
## The following code contains work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. ## Additionally, we waive copyright and related rights in the utilized code worldwide through the CC0 1.0 Universal public domain dedication. from ipaddress import IPv4Address from...
3211c0761bf0a15ee3050afe5dd7e15d58b61b158e92c654db3a403630c40367
Python
5,283
164
"""Tests for current_user_scoped_session dependency.""" import pytest from httpx import AsyncClient from zndraw_auth import TokenResponse, UserCreate async def _register_and_get_token( client: AsyncClient, email: str, password: str, login_form_class: type ) -> str: """Register a user, login, and return the ...
c6dc351191ecb3072baa9c7b365f115996e965e4ae994e804d59bb5da18ae801
Python
5,285
159
"""Create evaluator with LFP related efeatures""" """ 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....
87179ccea013b17af87156be35e646bebf99f41d20ed27a232fd62b670dd3766
Python
5,290
149
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os import shutil import itertools from multiprocessing import Pool import numpy as np from dmriqcpy.io.report import Report from dmriqcpy.io.utils import (add_online_arg, add_overwrite_arg, assert_inputs_exist, asser...
317ac667ce4fce5840053bb168f384a34a9bca34c1999d4c1ed19054a4289ca6
Python
5,291
150
# Copyright (c) OpenMMLab. All rights reserved. import math from mmcv.cnn import build_conv_layer, build_norm_layer from mmseg.registry import MODELS from ..utils import ResLayer from .resnet import Bottleneck as _Bottleneck from .resnet import ResNet class Bottleneck(_Bottleneck): """Bottleneck block for ResNe...
85b42c1a8ce08b10f535bb9602247a3e4be1b8d66791868c63517c9ab7750ba4
Python
5,299
162
#!/usr/bin/env python import sys, os, random from argparse import ArgumentParser, FileType from multiprocessing import Process def shuffle_reads(read_fname, random_list): reads = [] read_file = open(read_fname) for line in read_file: if line[0] == ">": reads.append([]) reads[-1...
88775c42c01da6a61f0a08795b6199f9cae36af27065028c82d7e94c9e35a7a6
Python
5,299
161
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------- # @File : main.py # @Time : 2024/03/14 15:48:58 # @Author: Zhang, Zehong # @Email : zhang@fmp-berlin.de # @Desc : None # ----------------------------------- import os import math import numpy as np import pandas as pd import torch ...
a34c92b06459286bbc4e4b986bb0a89562a857993b5c27cb315f6fe301218dea
Python
5,305
138
from medperf.exceptions import MedperfException from medperf.asset_management.gcp_utils import ( GCPAssetConfig, CCWorkloadID, upload_string_to_gcs, encrypt_with_kms_key, set_kms_iam_policy, set_gcs_iam_policy, update_workload_identity_pool_oidc_provider, ) from medperf import config as medp...
69fdfd1d61dd48b0114f90b8201ed3d4c2abc35fd45fefae68db49a65a5b35a2
Python
5,309
119
import numpy as np #-------------------------------------------Raw sequences----------------------------------------- # -----Public Databases----- VDJ_DATA_PATH = './datasets/filtered_vdj.csv' MCPAS_DATA_PATH = './datasets/filtered_mcpas.csv' IEDB_DATA_PATH = './datasets/filtered_iedb.csv' MIRA_DATA_PATH = './datasets...
f9eb003eec4924f0144da3a4445ab4d91afd22a782287f99f25d47120c5cb03e
Python
5,309
133
"""Base class for assembling fragments and performing model updates.""" from typing import Dict, List, Optional import torch from torch import nn from oa_reactdiff.model import MLP, EGNN class BaseDynamics(nn.Module): def __init__( self, model_config: Dict, fragment_names: List[str], ...
8013528b4521717753e144012a6793b870409912551c50d32e963b9c4593f4d7
Python
5,310
106
"""Why the GARD website browses 6,265 diseases while the list Babel ingests holds 16,214. The question this answers is whether the ~9,949 terms with no page are deprecated entries Babel should be filtering out. They are not: the CSV's own ``URL`` column marks which terms have a public page, the partition is exact, and...
028b7f527339a1a2fed7133f87b831d7bb29056602f59cffa62f3f230c634e5a
Python
5,311
158
import logging from pathlib import Path import ase import ase.io as ase_io import numpy as np import typer import zntrack from simgen.element_swapping import SwappingAtomicNumberTable from simgen.generation_utils import calculate_restorative_force_strength from simgen.integrators import IntegrationParameters from sim...
619dbf2caa34719e4a5dfc48983380ce0fc29c01101d6a21dfa856d27b69af90
Python
5,311
140
import torch import torch.nn as nn from collections import OrderedDict # ------------------------- # XBlock for RegNetX # ------------------------- class XBlock(nn.Module): def __init__(self, in_channels, out_channels, stride=1, group_width=16): super(XBlock, self).__init__() # Calculate t...
d6d4110ac9600c322d1c5ce401d18e929a968398931b4b0c7b5094853be77cb4
Python
5,311
154
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 11 09:42:59 2023 @author: schwab """ from pathlib import Path from typing import Optional import torch from torch.utils.data import DataLoader from typer import Option import os import sys from ..data.handlers.particle_image_preprocessor import ...
55fa94968828c13d6581ef62633b071c626d9f8c35dbe63fa446cfa0ec20c724
Python
5,312
170
#!/usr/bin/env python # coding: utf-8 import os.path as op import random import time import matplotlib.pyplot as plt import numpy import sklearn import torch.nn.functional as nn_func from sklearn import preprocessing from sklearn.metrics import adjusted_rand_score from torch.nn import Linear from torch_geometric.data...
1bcee9940907e25ae3980568433057c6dabaa54597d1ab199c618e6f8effa20b
Python
5,313
143
import torch def ablate(ab_type, ab_level, src, model, args): """ Apply ablation to the model based on the specified type and level. Args: ab_type: 'mask', 'bernoulli', 'gaussian') ab_level: Level of ablation to apply (e.g., 0.1, 0.2, etc.) src: Input data model: Model to ab...
0a1776a736ce6e49e023e58f5efd2790adbab6b96f5b05b8404fd66884bf0540
Python
5,314
154
import cv2 import os import tensorflow as tf import numpy as np import tensorflow as tf from tensorflow.keras import backend as K from tensorflow.keras.layers import Input, Conv2D, BatchNormalization, Activation, MaxPool2D, Conv2DTranspose, Concatenate from tensorflow.keras.models import Model from tensorflow.k...
117bfa4220432094cafb07526ce2e3dcf358b1f0138e0051d74f921b50ff066b
Python
5,315
166
"""Run simple cell optimisation""" """ Copyright (c) 2016-2020, 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 ...
5cbe2e9dca6d726ca76f0436c711666fa2270d2ba90cab8fbfb1e3813ec9ac9a
Python
5,315
160
#!/usr/bin/env python # # This program is a wrapper for the isct_dice_coefficient binary # # Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE import sys import os from typing import Sequence from spinalcordtoolbox.utils.shell import SCTArgumentParser, Metavar from spina...
6a57dd687851ad3db770cb30bb63ede1f13955ddf54db802f690c2849e02ae27
Python
5,315
137
import numpy as np import pytest from guppy.visualization.covariate_correlation import ( build_covariate_panel, build_covariate_scatter, ) @pytest.fixture def scatter(panel_extension): """A three-bin scatter with one unusable bin, so the drop is observable.""" return build_covariate_scatter( ...
81c4ffa0b63de8176636310d703f88e8cfe97ba62f19a201c008524392f84e2c
Python
5,315
142
import os import yaml import argparse from utils import get_file_basename, get_file_extention class SanityChecks: def __init__(self, data_path, params_file): """A class wrapper for doing sanity checks on prepared dataset. The checks consist of raising an AssertionError if: the frames...
3e1888c5f8eff3969ee7152bd90846cd0112f76c045eb95202a3c8e2638dca72
Python
5,319
137
#!/usr/bin/env python # # Utility function to denoise diffusion MRI images # # Copyright (c) 2022 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE import os import sys from typing import Sequence import textwrap import numpy as np from spinalcordtoolbox.image import add_suffix, Image fro...
180f2082b370760b94306f208f46149a360125b3c30cfd26444a4fc1a114869a
Python
5,321
145
import torch import pickle import numpy as np from utils import run_forward from test import evaluate class TrainingState: """ For maintaining results and tracking validation for early stopping """ def __init__(self, run_i): self.run_i = run_i # run self.step = 0 # step of training (to...
46449d181b464a0c7569e41a9d4372aa4ac36e03fbeb3be4df89a938be65f71f
Python
5,321
109
"""Shared clique-building scaffolding used by multiple compendium modules. Factors out the common skeleton of turning a set of identifier files and concord files into union-find clique state via :func:`src.babel_utils.glom`: load each ids file -> glom into the clique state load each concord -> optionally f...
a3bcf697c7a02d6641dcc240d60aaebae1f796c3b003a89303c1e746e291b417
Python
5,321
154
import cv2 import os import tensorflow as tf import numpy as np import tensorflow as tf from tensorflow.keras import backend as K from tensorflow.keras.layers import Input, Conv2D, BatchNormalization, Activation, MaxPool2D, Conv2DTranspose, Concatenate from tensorflow.keras.models import Model from tensorflow.k...
d8cefd4c3783c8040be4ae66b0714334a07e7582ef63e67abe80324dec7e3a75
Python
5,321
140
import copy import json import os import urllib.request import zipfile import generate_models as gm import pytest import xgboost from xgboost import testing as tm def run_model_param_check(config): assert config['learner']['learner_model_param']['num_feature'] == str(4) assert config['learner']['learner_tra...
bccfbc3810e65d203dcaa951644bef482a2b31a4eaee6068ac00fa1fba15d49e
Python
5,323
160
# Copyright (c) OpenMMLab. All rights reserved. import gzip import html import os from functools import lru_cache import ftfy import regex as re @lru_cache() def default_bpe(): """Return default BPE vocabulary path.""" return os.path.join( os.path.dirname(os.path.abspath(__file__)), 'bpe_voca...
88e5e51b8165be527b67d5bfc9ab5ca81f8a385618eceff4fe4c3a1b64716291
Python
5,324
147
from textwrap import indent, dedent from ..utils import ensure_list_args, cypher_identifier from ..client import inject_client class SynapseCriteria: """ Synapse selection criteria. Specifies which fields to filter by when searching for Synapses. This class does not send queries itself, but you use ...
dd6dd5ef61867657cdd7ab0732ff4f6be117ceb4152ffc814c4f0a2c1fc7d255
Python
5,324
144
import torch class MLP(torch.nn.Module): def __init__(self, input_size=1, output_size=92, hidden_sizes=None, compress_output=False, input_embedding=False, init_bias_last_layer=1, conv_layer=False, conv_kernel_size=3, fixed_kernel=False, even_odd=False): s...
82a134a57a2808c300cc02128b0100ca5f9e8ff3ce236df8f58c038ec124ea6f
Python
5,329
109
import os import argparse import numpy as np from utils import * import datetime def main(): parser = argparse.ArgumentParser(description="Load training curves and" "perform PCA.") parser.add_argument("--input_dir", type=str, default="/P...
d72fcdcb6a5d0d5c791477054de3a228475c8a4cbcf005b6957ac18cfecc0a9b
Python
5,329
119
from typing import cast import pytest from ruamel.yaml.comments import CommentedMap from schema_salad.sourceline import cmap from cwltool.command_line_tool import CommandLineTool from cwltool.context import LoadingContext snippet = cast( CommentedMap, cmap( [ { "cwlVersion...
7aab509096c7a53441de550c25586200a27dcfa196b5d401013106a19cce6a04
Python
5,330
148
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn.functional as F from mmcv.cnn import ConvModule from mmengine.model import BaseModule from mmseg.registry import MODELS from ..utils import resize class CascadeFeatureFusion(BaseModule): """Cascade Feature Fusion Unit in ICNet. Args: lo...
24534e407f3705be30a51238ed55d2427de32bed9eaf83966b3b9b21b8b885a7
Python
5,336
155
# pylint: disable=unbalanced-tuple-unpacking, too-many-locals """Tests for federated learning.""" import multiprocessing import os import subprocess import tempfile import time from typing import List, cast from sklearn.datasets import dump_svmlight_file, load_svmlight_file from sklearn.model_selection import train_t...
9e3237bf98babf32e576d5b1acfcbc4254e171aa2715fe26cb43dfbf3ff2b522
Python
5,336
148
import mne from scipy.signal import detrend import sys, os from tqdm import tqdm from glob import glob import numpy as np import itertools import pandas as pd try: from braindecode.preprocessing import exponential_moving_standardize from braindecode import EEGClassifier from braindecode.util import set_ran...
64ef9d074abd75b1880e39faa19567e11f7af7041540d7db007101c8838fa41a
Python
5,340
132
#!/usr/bin/env python # # Copyright 2008, 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...
c7cbcbaeba6c172284a08324527ce69103f9b3165a4090c72f6912f57718f03b
Python
5,343
157
import os import glob import random import pickle from data import common import numpy as np import imageio import torch import torch.utils.data as data class SRData(data.Dataset): def __init__(self, args, name='', train=True, benchmark=False): self.args = args self.name = name self.train...
0d18acdb4c203a67e15be7c47e8ccfbbdc923625c5363cfd8afa434a504e35a3
Python
5,344
133
import time, os, subprocess import pytraj as pt import numpy as np import dask from dask.distributed import Client, performance_report, LocalCluster import nearl from nearl import features, utils, _tempfolder # Only needs the fingerprint of the def parallelize_traj(traj_list, focused_res): traj_list = [i for i in ...
1332cd94959a5a0dc0bc61c243839c25296dd98aaa9591d1b19b24db3ebc3b1e
Python
5,344
159
import logging from pathlib import Path import ase import ase.io as ase_io import numpy as np import typer import zntrack from simgen.element_swapping import SwappingAtomicNumberTable from simgen.generation_utils import calculate_restorative_force_strength from simgen.integrators import IntegrationParameters from sim...
de146875d90ed81191b3c95fe710f5b2b47b7f4903f1e4fde4a941517fdb9a7a
Python
5,347
155
import cv2 import os import tensorflow as tf import numpy as np import tensorflow as tf from tensorflow.keras import backend as K from tensorflow.keras.layers import Input, Conv2D, BatchNormalization, Activation, MaxPool2D, Conv2DTranspose, Concatenate from tensorflow.keras.models import Model from tensorflow.k...
b5ff01ccb07aab3ff68f5429703a61a56ba92288e5c495e2ad7c3af243db1072
Python
5,349
111
from PyQt5 import QtWidgets, QtCore, QtGui from copy import deepcopy class SetMultipleDialog(QtWidgets.QDialog): """ Dialog that lets the user check for every object if the feature settings of the currently selected object should be copied. """ def __init__(self, data_manager, index): ...
902c6a613cffe332756fd1f50e359bedbc0e1305f41ced54f73fd43acd6006aa
Python
5,350
181
# -*- 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 ------------------------------------------------------------...
f3b294c908491b589279e4fc8a3d0442dfab8f02877290c217a04440f3dbc35f
Python
5,355
167
#!/usr/bin/env python import argparse import torch from torch.utils.data import DataLoader from tqdm import tqdm from MCMG_utils.data_structs_GM import MolData, Vocabulary from models.model_MCMG import transformer_RL from torch.optim import Adam from MCMG_utils.Optim import ScheduledOptim from MCMG_utils.early_stop.p...
3d2d9f561085b0b497148b31d2f721ad101f7b148064787961d556a72e72d776
Python
5,357
196
from datetime import datetime from pydantic import BaseModel, Field, validator from typing import Optional, Union from medperf.enums import Status, CryptoKeyType class MedperfSchema(BaseModel): for_test: Optional[bool] = False id: Optional[int] name: str = Field(..., max_length=128) owner: Optional[i...
25a94903a4721e0fd48ceaccb27c066f41f545fec4f800f76912d1bd12c0eb16
Python
5,359
141
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 28 15:20:55 2023 @author: george """ import pandas as pd import json, codecs import numpy as np from qtpy.QtCore import QUrl, QRect, QPointF, Qt from qtpy.QtGui import QDesktopServices, QIcon, QPainterPath, QPen, QColor from qtpy.QtWidgets import Q...