sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
f90a408a384c0632265ecd3f18241a737993729796a742dbfe1d9a0f84d62504
Python
2,459
88
import numpy as np from stabl import data from stabl.multi_omic_pipelines import multi_omic_stabl from sklearn.model_selection import GroupShuffleSplit, GridSearchCV, RepeatedKFold from sklearn.linear_model import Lasso, ElasticNet from stabl.stabl import Stabl from stabl.adaptive import ALasso from sklearn.base import...
ae9562fb5051c3ddb33903c1fb92b6f62af29c8e13b9a312a533f01784077904
Python
2,462
73
# Run multiple time step integration with OpenMM for comparison to Molly # Used OpenMM v8.4.0, Python v3.11.14 from openmm.app import * from openmm import * from openmm.unit import * import os data_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "data") out_dir = os.path.join(data_dir, "openmm_t...
312e660f282cc86aa95ed8e8f0e95f0907db4cfaab8a3bcbc91056f0ca700127
Python
2,464
88
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import glob import itertools import pathlib import click from plugcli.params import NOT_PARSED, MultiStrategyGetter, Option # MOVE TO GUFE #################################################...
d87dd79800364d5955442ae81cfaf20d6b9f1611a5314d629cfa4b442ae1d68c
Python
2,464
91
import numpy as np from stabl import data from stabl.multi_omic_pipelines import multi_omic_stabl from sklearn.model_selection import GroupShuffleSplit, GridSearchCV, RepeatedKFold from sklearn.linear_model import Lasso, ElasticNet from stabl.stabl import Stabl from stabl.adaptive import ALasso from sklearn.base import...
ba16af77be42f38031a6f22aeb1284723e877e0a5776026c08d19df2fb87ed2e
Python
2,465
62
#%% from cluster_jobs.abstract_jobs.preprocess_abstract import AbstractPreprocessingJob from os.path import join import mne import pandas as pd #%% class Preprocessing(AbstractPreprocessingJob): job_data_folder = 'data_sbg_irasa' def _get_age(self): return self.raw.info['subject_info']['age'] de...
dca754686e0f675773e7d3f99cdf91acd944fefe4bee20e2c456fbe1243b1ddc
Python
2,465
68
#!/usr/bin/env python # Copyright 2017-2018 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
748dd584281599ad2ef571b00a02f82563d88271e2d7f67239ca419943b336ea
Python
2,466
91
""" Dictionary to XML - Library to convert a python dictionary to XML output Copyleft (C) 2007 Pianfetti Maurizio <boymix81@gmail.com> Package site : http://boymix81.altervista.org/files/dict2xml.tar.gz Revision 1.0 2007/12/15 11:57:20 Maurizio - First stable version """ __author__ = "Pianfetti Mau...
a037e4ff7392ba48c1044e3a643501bf37fd588d86905027cdd9465607b1637c
Python
2,466
93
import os import solara from mesa.examples.basic.schelling.model import Schelling, SchellingScenario from mesa.visualization import ( Slider, SolaraViz, SpaceRenderer, make_plot_component, ) from mesa.visualization.components import AgentPortrayalStyle def get_happy_agents(model): """Display a t...
ec5ad5129cc92a88066bc08778b870c141dcdad7798817568015f2025a149530
Python
2,466
70
""" Module: data_loader.py Description: - Load raw data (CSV/TSV), identify sequence & substrate columns, encode y and split into train/val. """ import os import pandas as pd from sklearn.model_selection import train_test_split from config import TRAIN_VAL_RATIO from encoder import encode_sequences def load_raw...
a1c51d0c47f87c975d30f36d1317fca242e08561dcf7f137a222689b948ea259
Python
2,470
88
import numpy as np from stabl import data from stabl.multi_omic_pipelines import multi_omic_stabl_cv from sklearn.model_selection import GroupShuffleSplit, GridSearchCV, RepeatedKFold from sklearn.linear_model import Lasso, ElasticNet from stabl.stabl import Stabl from stabl.adaptive import ALasso from sklearn.base imp...
19c3204be4ad7b6e6d7f98611a43662d501781c83025ac0fdb41e239ac8a3385
Python
2,472
78
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pytest from openfe.protocols.openmm_afe import ( AbsoluteBindingProtocol, ) @pytest.fixture() def default_settings(): return AbsoluteBindingProtocol.default_settings() def...
74cc5d7ebd6957fc97ed1746cb9d293daf247ddff392385c98719cfbd3aa26c8
Python
2,473
92
# AUTOGENERATED! DO NOT EDIT! File to edit: 90_utilities.ipynb (unless otherwise specified). __all__ = ['text2float', 'progbar', 'switch', 'NamedTuple', 'makedir'] # Cell from tqdm import tqdm import numpy import os # Cell def text2float(val): """A utility function for stably reading strings and return floats i...
8122ef5ba8078bdac803a6983416c5666a92e63fa3aa90b3610e5cd9112e4c71
Python
2,476
60
#!/usr/bin/python3 ################################################################################## # # MIT License # # Copyright (c) 2025 Kevin Rockenbach, Agnieszka Golicz # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "So...
9aa21bfbea06a0b31436954a50ef0d9fc226776993a5d99399c8be29efe17b98
Python
2,476
71
from argparse import ArgumentError, ArgumentParser, Namespace import logging from pathlib import Path import sys from chemprop.cli.utils import Subcommand from chemprop.utils.v1_to_v2 import convert_model_file_v1_to_v2 from chemprop.utils.v2_0_to_v2_1 import convert_model_file_v2_0_to_v2_1 logger = logging.getLogger(...
c3ef225e25f53b55d53f58abb26d172e61b0c77d2023e56039f623d3880af369
Python
2,476
56
import os from os.path import join import nnunetv2 from nnunetv2.paths import nnUNet_extTrainer from nnunetv2.utilities.find_class_by_name import recursive_find_python_class def recursive_find_trainer_class_by_name(trainer_name: str): # Import here is necessary to avoid circular import # this function is use...
913e68ff278e4f087d93af96707cdbc7e3689f904d3d7709e8c6178080ab3796
Python
2,479
122
import pandas as pd import numpy as np import joblib import argparse import sys parser = argparse.ArgumentParser( description="Predict Overall.Score for new integration methods using a trained Random Forest model" ) parser.add_argument( "--model", required=True, help="Path to trained RF model (.jobli...
e2a5d0e479005275922027e555b39686532bff304844152b1f50db9064201450
Python
2,480
68
#!/bin/python """ Script for registering and processing microglia ASAP snRNA-seq samples for Substantia Nigra (SN). Workflow steps and notes are identical to PFC and PUT scripts. """ import truster import pandas as pd import os # Paths to references and configs cellranger_index = "/scale/gr01/shared/common/genome/10...
4684434f4b785b52c5ddb3e7f2f117790a0745d2af59761e8c9b79629ee03d7d
Python
2,482
91
"""Per-atom pKa prediction for MolGpKa. Vendored from MolGpKa (https://github.com/Xundrug/MolGpKa), MIT License. Patched for SMILES2Docking: * Package-relative imports and package-local model weights. * Models are loaded once and cached (the upstream code reloaded the weights on every molecule). """ from __fu...
283d14adbe42ce0df289cafb81c8adf5d421c58e88f6f3f8c14cb4e319f34417
Python
2,486
90
import statsmodels.api as sm fig, ax = plt.subplots(figsize=(12, 4)) fig.gca().spines["top"].set_color("lightgray") fig.gca().spines["right"].set_color("lightgray") sm.graphics.tsa.plot_acf( dfc["count"], lags=2*60, ax=ax, title="Autocorellation Function" ) plt.ylim(-0.1, 1.1) fig.show() from NeuroPy...
b946e8a4e745abcbf23eafb5eff2ff06862bb6d3389c3872914d5c821435ee3e
Python
2,488
72
import pytest import networkx as nx import numpy as np import pandas as pd from navis.models.network_models import (TraversalModel, BayesianTraversalModel) def test_traversal_models(): models = (TraversalModel, BayesianTraversalModel) G = nx.path_graph(10, create_using=nx.DiGraph) G.add_edge(0, 9) G....
bb1e4421a45e0d01f5b127802236e7f3467d7a8f02653d00def3345a71f9fba2
Python
2,488
98
""" Created on Mon Aug 14 16:19:42 2023 @author: dcupolillo """ class Palette: def __init__(self) -> None: """ Define color attributes Returns ------- None. """ self.black = Color('#181c21') self.dark = Color('#1c2128') self.d_dark = ...
f25a4172b69d4c463ab0b5607e78634c1da4252df7e3bea661a536f68ab23689
Python
2,488
87
import numpy as np import neo import quantities as q np.random.seed(42) def generate_poisson_spike_train(rate, T, dt): """ Generates a Poisson spike train as a Boolean array. Parameters: - rate: Firing rate in Hz. - T: Total simulation time in ms. - dt: Time step in ms. Returns: - sp...
506e6cfc1a666d846a1a35dec829d8090b4e9ae4bbc190deef552572674b9d0c
Python
2,492
76
import pytest import pickle from hsnn import utils from hsnn.analysis import ResultsDatabase from hsnn.analysis.png import detection, refinery SAMPLES_DIR = utils.BASE_DIR / "tests/data/detection" @pytest.fixture(scope="module") def real_data(): """Loads the real data samples extracted from the notebook.""" ...
aee879fc27a8c86c31abbf7e1da98189cf056b3a5e58fb42703868f97e4c1247
Python
2,492
90
""" Utilities for distributed training. """ __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" import os import datetime import torch.distributed as dist from torch.utils.data import DataLoader from torch.utils.data.distributed import DistributedSampler def cleanup(): """ Cleanup ddp process g...
0b6c43c08bfb0e2eeeae7ef9f625cdb190714a70deeac6becf513e9eb173657b
Python
2,497
58
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. from detectron2.config import CfgNode as CN def add_pointrend_config(cfg): """ Add config for PointRend. """ # We retry random cropping until no single category in semantic segmentation GT occupies more # than `SINGLE_CATE...
4a96fcbc3ebbcc27128f26edd965c0dae058f95ab3a7c19a5141b71cd94f2c74
Python
2,497
82
import os import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from scipy.cluster.hierarchy import linkage, fcluster from scipy.stats import zscore import numpy as np input_path = 'results/preprocessed/normalised_summary.csv' output_folder = 'results/plot_heatmap/' if not os.path.exists(output_...
f7dddbe0360faa01ceb81e8a47ec1c21e6569da6492f0a2dffd53565c0c3f393
Python
2,497
84
import numpy as np import pandas as pd RIF_METHODS = { "BACTEC RIF": ["bactec_rifampicin"], "LJ RIF": ["le_rifampicin"], "HAIN RIF": ["hain_rifampicin"], "LPA-other RIF": ["lpaother_rifampicin"], "Xpert RIF": ["genexpert_rifampicin"], "Truenat RIF": ["truenat_rifampicin"], } FQ_METHODS = { ...
f890b0a2f5276acf0d1d8cea3e3a79c451bbc4248efc93711b378f8525cd64ca
Python
2,498
90
import numpy as np from stabl import data from stabl.multi_omic_pipelines import multi_omic_stabl_cv from sklearn.model_selection import GroupShuffleSplit, GridSearchCV, RepeatedKFold from sklearn.linear_model import Lasso, ElasticNet from stabl.stabl import Stabl from stabl.adaptive import ALasso from sklearn.base imp...
664cae6572619d452b42017f34572503841ae8304153a4d7908498ff200a68a9
Python
2,499
66
import numpy as np import numpy.typing as npt import pandas as pd import xarray as xr from ._types import DeltaTuple pidx = pd.IndexSlice def get_deltas(group: pd.DataFrame, layer: int, surrogates: xr.DataArray, deltas: DeltaTuple, threshold: float = 0.0) -> DeltaTuple: """Get delta values for n...
e57066b6db917a707f89b76f97d0924d1ad846d7587e5be3e0e57f80d5874a86
Python
2,505
65
import json import sys import tempfile import unittest from pathlib import Path import pandas as pd SCRIPTS = Path(__file__).resolve().parents[1] / "scripts" sys.path.insert(0, str(SCRIPTS)) from build_analysis_input import build_analysis_input class AnalysisInputBuilderTests(unittest.TestCase): def test_buil...
defc96ef8cb9cbcf0d0dcbcd7c9d69d14727fa623b37c399e98623a298ddf9b8
Python
2,507
92
from mesa.examples.advanced.wolf_sheep.agents import GrassPatch, Sheep, Wolf from mesa.examples.advanced.wolf_sheep.model import WolfSheep, WolfSheepScenario from mesa.visualization import ( CommandConsole, Slider, SolaraViz, SpaceRenderer, make_plot_component, ) from mesa.visualization.components i...
cad0cf542402a7d074cc9befa50840345e429008279a82b2497842a04fd7b501
Python
2,508
67
#!/usr/bin/env python # Copyright 2017-2020 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
79ace6b2f2ee4d2f9b78ad42008353690c7030009d8a91291f699e67a74b06de
Python
2,509
65
#!/usr/bin/env python3 """Run Snakemake over one or more trials for an experiment[, checkpoint]. Example: ./scripts/run_main_workflow.py path/to/expt_dir 0 1 --chkpt -1 -v """ import argparse import logging import subprocess from hsnn.core.logger import get_logger logger = get_logger(__name__) def main(opt: a...
57ce0711b689394b3050a01b464043673d6587481471e875f3f7a3a436601382
Python
2,512
74
# Copyright (c) Facebook, Inc. and its affiliates. from abc import ABCMeta, abstractmethod from typing import Dict import torch.nn as nn from detectron2.layers import ShapeSpec __all__ = ["Backbone"] class Backbone(nn.Module, metaclass=ABCMeta): """ Abstract base class for network backbones. """ de...
3a74592dffd132cee9b7cc40913610f53cdee3f5069f83936ae132e9fb3c5e31
Python
2,513
84
import numpy as np from scipy.stats import chi2_contingency def chisquare_test(ref: np.ndarray, obs: np.ndarray) -> np.ndarray: """ Multivariate chi-square test for each categorical variable abundance. Parameters ---------- ref : np.ndarray Reference abundance of each categorical variable...
bf7fef8ba1ef7c329f9ac6969c21eae2b22308f8c1dea985efc40da27fd8e2fb
Python
2,513
76
# -*- coding: utf-8 -*- """ Created on Tue Jul 12 10:51:00 2016 @author: Luciano Masullo @pep8: Federico Barabas """ import numpy as np class sin2D: def __init__(self, imSize=100, wvlen=10, theta=15, phase=.25): self.imSize = imSize # image size: n X n self.wvlen = wvlen # wavelength (n...
5e388f636c84ad4353cf17f216c7eb66ab70aa6026dc5a2c10aafbc0ce1b9a4c
Python
2,515
72
import detectron2.data.transforms as T from detectron2.config.lazy import LazyCall as L from detectron2.layers.batch_norm import NaiveSyncBatchNorm from detectron2.solver import WarmupParamScheduler from fvcore.common.param_scheduler import MultiStepParamScheduler from ..common.data.coco import dataloader from ..commo...
669f5bfac531adcf32e16a2f345507a45cd371a728cf10b87c14f30942b01780
Python
2,515
58
from SPIDER import train_SPIDER, Cal_knn_expression, Cal_Spatial_Net, mclust_R import os, pickle, pandas as pd import scanpy as sc, numpy as np import sklearn from sklearn.metrics import normalized_mutual_info_score, homogeneity_score from sklearn.metrics.cluster import adjusted_rand_score import sys def run_trainin...
ef7d0eca3a883b9637d227a7cc876a4a59bd87c3ea187b99f0084ca46e2d9a90
Python
2,524
76
import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from torchmetrics import Metric from typing import Optional class CosineDistanceLoss(nn.Module): def __init__(self): super().__init__() def forward( self, input1: torch.Tensor, input2: ...
91d87ec5dc10533338933e9e4b92aca64024ec888d997f6810e2c32537f616be
Python
2,526
77
import torch from transformers import AutoTokenizer, EsmModel, BatchEncoding from typing import List, Dict import os class ESM2Encoder(torch.nn.Module): def __init__( self, pretrained_model_name_or_path: str = "../esm2_model" ): """ Args: pretrained_model_name_or_pa...
359de7c90b089d2bd6d2e0916de0bfd3222bc532a767b4bfc9a24bc3b93b882b
Python
2,527
67
#!pip3 install pandas matplotlib pathlib seaborn --user #python proteinGroupsCompareTTP.py "Sequence" L:\promec\TIMSTOF\LARS\2024\240626_Mira\MiraPep.tsv L:\promec\TIMSTOF\LARS\2024\240626_Mira\MiraPep2.tsv # %% setup import sys from pathlib import Path import pandas as pd import matplotlib.pyplot as plt from matplotl...
6e179c6a64c72c4ed6652f960371917ecfe17315034ffa169f326b25e026e975
Python
2,527
76
"""Raw neural trace with stim artifacts and detected spike overlay.""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from utils.plotting import apply_global_style, PALETTE from utils.config import DATA_DIR, OUTPUT_DIR import numpy as np import matplotlib.pyplo...
51de94df493032e0b55ff3631eb48fab479826c7fd63df9f0b4228758e7f7fc6
Python
2,530
67
"""Handles loading and automatic reassembly of model files.""" import os import shutil from lamareg.utils.file_splitter import reassemble_file import urllib.request MODEL_URLS = { "synthseg_robust_2.0.h5": [ "https://github.com/MICA-MNI/LAMAR-Models/raw/refs/heads/main/models/synthseg_robust_2.0.h5.000", ...
dbc7339a3c145832115c4b81e877916bcfdb1c7b53fee7b8e92b66bef9b85296
Python
2,533
82
from mesa.examples.advanced.sugarscape_g1mt.model import SugarscapeG1mt from mesa.visualization import Slider, SolaraViz, SpaceRenderer, make_plot_component from mesa.visualization.components import AgentPortrayalStyle, PropertyLayerStyle def agent_portrayal(agent): return AgentPortrayalStyle( x=agent.cel...
d79cfe0d8fe7a1c57bd7b3ea2d935eedccdb03aa30867ef35b8e3f905e2a44df
Python
2,536
95
import torch import os from glob import glob import argparse def load_class_image_list(path): class_name = os.path.basename(path).split(".")[0] with open(path, "r") as f: lines = f.readlines() lines = [line.strip().split(".")[0] for line in lines] return (class_name, lines) def get_semantic(...
baae10690b907809b224db31862ffe23e93e731736b474a5962335f38f6b4b13
Python
2,539
70
import pandas as pd import pingouin as pg import seaborn as sns from matplotlib import pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable # Read data (from MATLAB output) data = pd.read_csv('alpha_beh_up_to_800ms.csv') sel_sub = data['subject_valid'].astype(bool) fig, axes = plt.subplots(1, 3, figs...
6476fceecc4517cd9d28b24d8cb1a00bf752f2283aed0463f00c1adf43820026
Python
2,540
92
import math import networkx as nx import mesa from mesa import Model from mesa.discrete_space import CellCollection, Network from mesa.examples.basic.virus_on_network.agents import State, VirusAgent def number_state(model, state): return sum(1 for a in model.grid.all_cells.agents if a.state is state) def numb...
7775f7dac217a5ba59dbb493fa489d94d2e56088996e4e609a8f2a93ed17d87e
Python
2,540
67
import json import sys from pathlib import Path import pandas as pd import pytest SCRIPTS = Path(__file__).resolve().parents[1] / "scripts" sys.path.insert(0, str(SCRIPTS)) from prepare_sensitivity_splits import sensitivity_config from run_model_sensitivity import compare_metric_results, compare_shap_results def ...
d11c9f3eaa60d7dd6f7c4331a0f693df2bdfef4bdf396f162c1e6782bf4763d9
Python
2,540
62
from openmm.app import * from openmm import * from openmm.unit import * # Calculate forces with Gromacs and OpenMM for comparison to Molly using a99SB-disp force field # Used OpenMM v8.4.0, Python v3.12.12 and Gromacs 2021.4 # To run this script, .gro and .top files need to be prepared with Gromacs' pdb2gmx and editc...
08571608b3c7e3610384ed298233b82f6726ed4e48dca3d956e31ece2abb5da6
Python
2,541
84
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. """ DensePose Training Script. This script is similar to the training script in detectron2/tools. It is an example of how a user might use detectron2 for a new project. """ from datetime import timedelta import detectron2.utils.comm as comm ...
4bc53386026b8fe77b0af511e89277d9699e1729d92a14adb9f294e492d3ba1a
Python
2,541
75
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import logging import numpy as np from typing import Any, Callable, Dict, List, Optional, Union import torch from torch.utils.data.dataset import Dataset from detectron2.data.detection_utils import read_image ImageTransform = C...
5451c3274f00bc02ac31c183b41835aa82f3e06048228b17ee84e585b2013d5f
Python
2,541
66
import numpy as np from sklearn import datasets def _normalize(v): if np.sum(v) == 0: w=np.copy(v) w[0]=1 return w else: return v/(np.sum(v)) def _sample_parameters(num_clusters, num_dim, **sampler_x_args): parameters_gen={} parameters_gen['cluster_prop'] = _normalize(...
e9362fb164981d522406e9556cd896ff1c90d472f995493f31ab382da1203678
Python
2,542
97
import numpy as np import pandas as pd from sklearn.feature_selection import SelectKBest, f_classif from sklearn.preprocessing import StandardScaler np.random.seed(42) # ----------------------------- # 1. Load data # ----------------------------- def loadDataset(): X = pd.read_csv("./data/data_0.csv", header=Non...
f8ab717407587e84dd5fca86733970512f643321fd69c4d1c2532b8312191a2d
Python
2,547
81
''' Generates .sumstats and .l2.ldscore/.l2.M files used for simulation testing. ''' from __future__ import division import numpy as np import pandas as pd N_INDIV = 10000 N_SIMS = 1000 N_SNP = 1000 h21 = 0.3 h22 = 0.6 def print_ld(x, fh, M): l2 = '.l2.ldscore' m = '.l2.M_5_50' x.to_csv(fh + l2, sep='\t...
ab831ee0e06fa5b87b193aa9b1f7c28744a996b7583a7f989973b19a0a552fb3
Python
2,549
89
import numpy as np import eelbrain as eb from sklearn.decomposition import PCA import pandas as pd def do_boosting(avg, fwd, boosting_kwargs): #%get channels post ecg start_idx = np.where(avg.keys() =='ECG003')[0][0] + 1 tmin = 0 tstep = 0.01 nsamples = avg.shape[0] time_course = eb.U...
4180e0a7096d6c0d3c94fb25dee9099b5ac75310e32d825fb23586c8dad33ee4
Python
2,552
96
""" Show example plots with different stp paramter sets """ import matplotlib.pyplot as plt import pandas as pd import numpy as np from test_utils import generate_regular_spike_train, generate_poisson_spike_train # define spike train rate = 30 T = 500 dt = 0.1 time_arr = np.arange(0, T, dt) # Regular spike trains s...
0f75af0f0fe066cb86d882012148caebca31c718796c462f09cd8cb80f989c7a
Python
2,560
80
import pytest from openfecli.fetching import FetchablePlugin, PkgResourceFetcher, URLFetcher from .conftest import HAS_INTERNET class FetcherTester: @pytest.fixture def fetcher(self): raise NotImplementedError() def test_resources(self): raise NotImplementedError() def test_plugin(...
5136bd97547635b0b644a08c13fc86eacce13c877737877e04b23f73f41a45d2
Python
2,562
113
""" author:CBJ The utility functions module includes: - Random seed setting - FWI danger level classification - Evaluation metric calculation - Model parameter statistics """ import numpy as np import torch import random import logging from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score logg...
e38439f847c064be701469d31df6cbf55888453633b3ddb2297bb0f6535ba669
Python
2,564
117
import scanpy as sc import time import scanorama combined_adata_path = "PATH_TO_INPUT/combined_adata.h5ad" combined_adata = sc.read_h5ad(combined_adata_path) start_time = time.time() sc.pp.scale(combined_adata) sc.tl.pca(combined_adata) sc.external.pp.scanorama_integrate( combined_adata, key='batch', ba...
069d7896497110f5b3cb5fb7163b77c2765a5571be1357ec2692103193481132
Python
2,565
75
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
3687abcdb270fa6abcf272b0a1bb4f49bfa5dfc4399db7a94d89eac642d21deb
Python
2,566
52
#C:\\Users\\animeshs\\AppData\\Local\\Programs\\Spyder\\Python\\python.exe -m pip install datatable import datatable as dt # pip install datatble fileName="C:/Users/animeshs/Downloads/SILACDIA2/report.tsv" df = dt.fread(fileName).to_pandas() import matplotlib.pyplot as plt import numpy as np plt.scatter(np.log2(df['PG...
7426982a3f2e933fa3b90b47e35f195b382e97ca6daefcfcd6e6f44e18ff11ed
Python
2,567
89
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from typing import Optional from torch import nn from detectron2.config import CfgNode from .cse.embedder import Embedder from .filter import DensePoseDataFilter def build_densepose_predictor(cfg: CfgNode, input_channels: int): """ Create an...
bd32a680024f398efa381744949a5c7a5d313db94279d98cccb202c18e912843
Python
2,570
61
#!pip3 install pandas matplotlib pathlib --user #python proteinGroupsCombineTTP.py L:\promec\TIMSTOF\LARS\2024\240626_Mira\2de755bb378949183b1b6b89a359e507\processing-run # %% setup import sys from pathlib import Path import pandas as pd # %% meta #pathFiles=Path("L:/promec/TIMSTOF/LARS/2024/240626_Mira/b3093c79d999b93...
5e79a750ab84ef69e789008e335ee2da1c12f1550c986b2b3c556101808ed2f7
Python
2,572
86
#!/usr/bin/env python # # Copyright (c) 2017 10X Genomics, Inc. All rights reserved. # from __future__ import annotations from typing import TYPE_CHECKING import martian import cellranger.constants as cr_constants import cellranger.preflight as cr_preflight import cellranger.vdj.preflight as vdj_preflight from cell...
047c094a8133f841098760e3a33b959baa0ca654483db5a93b2e9b6c0ea18d5c
Python
2,575
76
from setuptools import setup, find_packages from pathlib import Path from runpy import run_path from extreqs import parse_requirement_files HERE = Path(__file__).resolve().parent verstr = run_path(str(HERE / "navis" / "__version__.py"))["__version__"] install_requires, extras_require = parse_requirement_files( ...
7653d25956ba62698bb20f735d5b5eacab1875ac495d5960428ac6009d5cb710
Python
2,575
86
""" sphinxcontrib-sass https://github.com/attakei-lab/sphinxcontrib-sass Kayuza Takei Apache 2.0 Modified to: - Write directly to Sphinx output directory - Infer targets if not given - Ensure ``target: Path`` in ``configure_path()`` - Return version number and thread safety from ``setup()`` - Use compressed style by d...
a5a57c34eb990e00f6e34f5ef4ad996e85d8019dba5076b4ed0bc1a651673cee
Python
2,578
93
import nibabel as nib import numpy as np from astropy.convolution import convolve as nan_convolve logfile = open(snakemake.log[0], "w") print(f"starting", file=logfile, flush=True) # this function solves the Laplace equation for Anterior-Posterior, Proximal-distal, and Inner-Outer axes of the hippocamps convergence_t...
d40e44d2b37c9b4d76135cfeca933bdba57de32f4247942e0326bb88b15ea139
Python
2,580
73
# Python04.py # IJ BAR: https://github.com/tferr/Scripts#scripts #################################################### # 4. Functions and modules #################################################### # Functions are defined with <def>. Return values are # specified by a <return> statement. Here is a function # without a...
3580b228d918b60fdc5d4164ea33d93b99ef52f5be759b07209524967164440b
Python
2,581
84
import torch import torch.nn as nn import torch.nn.functional as F def do_CL(X, Y, args): if args.normalize: X = F.normalize(X, dim=-1) Y = F.normalize(Y, dim=-1) criterion = nn.CrossEntropyLoss() B = X.size()[0] logits = torch.mm(X, Y.transpose(1, 0)) # B*B logits = torch.div(logi...
761dd2668263e4b0ec5dee83a5a09f2e8578f992b47e5ba9906e93ed6b42a7d7
Python
2,582
79
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import torch import os.path as osp import torch_geometric.transforms as T from torch_sparse import coalesce from torch_geometric.data import InMemoryDatase...
efc17b4733e1d293281658fb3bafe72d4de4423754ea49433c07c6bac5364af2
Python
2,582
81
"""Raw vs filtered individual spike waveforms.""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from utils.plotting import apply_global_style from utils.config import DATA_DIR, OUTPUT_DIR import numpy as np import matplotlib.pyplot as plt import matplotlib ...
f6d5ecbe9ebc54e976d5bd868b82f645b6af9c8145b2269e26cbc084b83b5d4d
Python
2,583
84
# Copyright (c) Facebook, Inc. and its affiliates. import logging from contextlib import contextmanager from functools import wraps import torch __all__ = ["retry_if_cuda_oom"] @contextmanager def _ignore_torch_cuda_oom(): """ A context which ignores CUDA OOM exception from pytorch. """ try: ...
6a17a02ee14a204107ebee9126438fb468a75188995bd18c5ca695dd5f508d90
Python
2,590
95
""" Base class for voxel2mesh models """ __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" from abc import ABC, abstractmethod import torch import torch.nn as nn class V2MModel(nn.Module, ABC): """ Base class for Voxel2Mesh models """ def __init__(self): super().__init__() ...
5f3e7d2a580d392ef44a02b2f9573139f116154fc29423c39c54f1f0963b0a67
Python
2,595
79
from typing import List import matplotlib.pyplot as plt import numpy as np from .attack_result import AttackResult def show_adversarial_examples( results: List[AttackResult], target_image, layer_name, num_iterations, alpha, title=None, ): plt.figure(figsize=(15, 40)) images_per_row =...
a5b18752f2cc8eb490bf206cf6afa78781b1a972c6fed3a72fc0b25d3f2d1e06
Python
2,595
63
import sys #!pip3 install pandas --user #!pip3 install pathlib --user from pathlib import Path if len(sys.argv)!=2: sys.exit("REQUIRED: pandas, pathlib; tested with Python 3.8.5\n","USAGE: python dePep.py <path to folder containing allPeptides.txt file(s) like \"L:/combined/txt\" >") pathFiles = Path(sys.argv[1...
48580d55e998a0dbe19b4114fc9b6be0ffeaa94089bb62ebe8f7322730a1c35c
Python
2,596
87
""" Module: config.py Description: - Global configuration and default hyperparameters """ import os # Base directories BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DATA_DIR = os.path.join(BASE_DIR, 'dataset') INPUT_DIR = os.path.join(BASE_DIR, 'input') LOG_DIR = os.path.join(BASE_DIR, 'log...
df3ee7b2863ee1a20298b957bf481091cd2a348d5aaf08a452c8ad081f2a5a1c
Python
2,598
79
# T2P histogram of all units vs modulated units, pyramidal/interneuron split. import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import pandas as pd from utils.config import RAW_DF_...
f2f85b8a092e4fee07b1c6763dd44566592a1a780a74cec20f7e877fb1d4ba9b
Python
2,601
55
from typing import Tuple, Union, List from batchgenerators.augmentations.utils import resize_segmentation from batchgenerators.transforms.abstract_transforms import AbstractTransform import numpy as np class DownsampleSegForDSTransform2(AbstractTransform): ''' data_dict['output_key'] will be a list of segmen...
ca481324b511ef62fd066e966f3b871d01f43be71b2793e5206430825360fcbf
Python
2,602
73
import inspect import torch from detectron2.utils.env import TORCH_VERSION try: from torch.fx._symbolic_trace import is_fx_tracing as is_fx_tracing_current tracing_current_exists = True except ImportError: tracing_current_exists = False try: from torch.fx._symbolic_trace import _orig_module_call ...
e25f2f2f46de597ee960b2cdb0452124bf8f9f667a85c634ca52cd46c5671512
Python
2,605
61
#!/usr/bin/env python # Copyright 2017-2018 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
d8ba5e36700f0d19c9af058ed752fdb437c156f81650ab42b16ab82e618e844b
Python
2,606
92
import numpy as np import albumentations as albu from albumentations.core.transforms_interface import ImageOnlyTransform from albumentations.pytorch import ToTensor from skimage.filters import apply_hysteresis_threshold def scale(arr): """ Scales the input array to be in the range [0, 1] by subtracting the mi...
15e3dfd5d55abf99a88a3c7db76fd7cae60f01e53e934da73e727c65e77f2304
Python
2,609
56
import sys if len(sys.argv)!=3: sys.exit("\n\nREQUIRED: pandas! Tested with Python 3.7.9 \n\nUSAGE: python resultsGroupby.py <path to file of interest like \"L:\promec\mqpar.xml.1623227664.results\combined\txt\proteinGroupsCombine.py> <column of interest like \"Score\"\n\n") #python resultsGroupby.py "L:\promec\USERS\S...
9b58ada3f5530a77fa9d4805175962799cf7ec483e01fff4f208db0ea697d54e
Python
2,609
70
import bisect import numpy as np import albumentations from PIL import Image from torch.utils.data import Dataset, ConcatDataset class ConcatDatasetWithIndex(ConcatDataset): """Modified from original pytorch code to return dataset idx""" def __getitem__(self, idx): if idx < 0: if -idx > le...
a4db8f5bb8d25015549c17cecd567df89bb03c0f3fec7426fcbbde8d5fda9430
Python
2,611
73
# Python01.py # IJ BAR: https://github.com/tferr/Scripts#scripts #################################################### # 1. Basics #################################################### # This is a comment (typically single line) """ Tripple quotes are used for large multi-line comments, and typically to document functio...
c22b4fd5f2331e5ced4a17d8907d25faa66c36158339cdd43e158039cd68b6d9
Python
2,613
69
#!/usr/bin/env python # Copyright 2016-2020 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
685394405c496dba97e08617b5fedeb13be134c70c2509563ea56dad8c77d5f4
Python
2,614
85
# Copyright (c) Facebook, Inc. and its affiliates. import logging import numpy as np import pprint import sys from collections.abc import Mapping def print_csv_format(results): """ Print main metrics in a format similar to Detectron, so that they are easy to copypaste into a spreadsheet. Args: ...
31f8b32f130ea23c64aaef33dad2cc794b95886b027d816e0d59d699f08776a9
Python
2,617
82
import torch from stoic.utils import beam_search, top_n_stoichiometry_combinations def test_top_n_stoichiometry_combinations_returns_n_items() -> None: logits = torch.tensor([[2.0, 0.1], [0.2, 1.7]]) results = top_n_stoichiometry_combinations(logits, n=2, class_labels=[1, 2]) assert len(results) == 2 ...
52b322b9281fc94b73258e5ebb611e2f74636aa726d59f27b5ca0e628fec7a3b
Python
2,620
65
#!/usr/bin/env python3 """Extract Tables 1-7 of doi:10.1111/psyp.70385 from the Europe PMC JATS XML (PMC13542476) into data/tables.json: header, rows (all cells as strings), caption and footnotes. A superscript footnote marker is rendered as a caret plus the letter (e.g. '12^a'), never run together with the value, so t...
a64b6a29a6b39a0d05dcde0faab1971fcf68f1b0e9cde775d81ed79be7229999
Python
2,620
99
import warnings from lightning import pytorch as pl import pytest from chemprop import models, nn from chemprop.models import multi warnings.filterwarnings("ignore", module=r"lightning.*", append=True) @pytest.fixture(scope="session") def mpnn(request): message_passing, agg, *act = request.param ffn = nn.R...
9f3939839a92351086b726ad12718653c7915acf9769f1cd32a55a2868e553a6
Python
2,621
77
#!/usr/bin/env python3 # # Copyright (c) 2020 10X Genomics, Inc. All rights reserved. # """Utils for feature-barcoding technology.""" # Do not add new things to this module. # Instead, either find or create a module with a name that better describes # the functionality implemented by the methods or classes you want to...
11d838314fadff156e90c0d68d4f600b8de303e29a31d0b1f8956e9ef7014624
Python
2,622
70
import sys #export import os, argparse, sys, datetime os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' #Prevent JAX from using all of the threads available os.environ["OMP_NUM_THREADS"] = "1" # export OMP_NUM_THREADS=4 os.environ["OPENBLAS_NUM_THREADS"] = "1" # export OPENBLAS_NUM_THREADS=4 os.environ["MKL_NUM_THREADS"] =...
267bca707575046ad14889ccf19fd1add5ddf19eb378a3163b55198e24a7db1f
Python
2,622
86
#!/usr/bin/env python # # Copyright (c) 2018 10X Genomics, Inc. All rights reserved. # ###################################################### # DO NOT add new items to this file. # # - If a constant is only used from a single module, put it in that module. # - If a constant is only used in association with a particula...
69e3414f8456cab2b587fc1cbd6c5d88743b0e7ee34246c1f68bcfa4d06753c7
Python
2,625
64
"""Vowel formant extraction using Praat.""" from collections import defaultdict import numpy as np import parselmouth from parselmouth.praat import call from tqdm import tqdm from .config import TAPAConfig def measure_vowel_formants(audio_np, cfg=None, sample_rate=16000): """Measure F1, F2, and pitch for a vow...
6e93d8b327a4fb1dbb56ae2a200c0e54f7707a78d1ff50c5a473702141464ba1
Python
2,626
65
from typing import Optional import numpy as np import numpy.typing as npt from brian2 import Synapses from brian2.units import Quantity from ._base import BaseConnector from . import samplers as S __all__ = ["PatchConnector", "GaussianConnector", "DenseConnector"] def _assert_spatial(synapses: Synapses): for g...
c1a700c22e93d052ff9574daf29d17e20fd76e2b60f5f53be1385a791bdcf054
Python
2,626
72
import numpy as np import matplotlib.pyplot as plt import seaborn as sns def plot_distribution_with_binary_zscore(vector, gene_name): """ Plots the distribution of the values in the vector, calculates the z-score based on the proportion of values > 0 using CLT, and uses the gene name and z-score ...
2d4bbcd84900ba58485bee5b781d6524e9cffa45fe76627296d3aaf942bd8648
Python
2,627
78
import os import pandas as pd import random def assign_splits( genus: str, recs: pd.DataFrame, data_dir: str, val_frac: float = 0.2, random_state: int = 42, ) -> None: """ Assigns splits based on non interpolated data. The training split will be used to create new samples by interpolat...
d43c5b5e5940ddb8e064b0d6174805d21118bf39445954c1c155eb5b237cc13c
Python
2,630
78
import os from pathlib import Path import pandas as pd import pytest from stoic_train.dataset import StoichiometryDataset pytestmark = pytest.mark.integration def _resolve_paths() -> tuple[Path, Path]: data_root_env = os.environ.get("STOIC_DATA_ROOT") data_file_env = os.environ.get("STOIC_DATA_FILE") if...
dd412814ff338d456a179a726c931387993ff5ec4d176e87129195c1481cfd8c
Python
2,633
79
# Set up starting structures for condensed phase simulations # Run from openmm82 conda env, openff-toolkit v0.18.0, Packmol 21.2.3, rdkit 2024.03.5 from openff.toolkit.topology import Molecule from rdkit import Chem from rdkit.Chem import AllChem from glob import glob import os import subprocess import textwrap import...
69c5162ca08676a90aed568279f0ba556cd90258bd674f22acd2a4c6774f7226
Python
2,639
91
from abc import abstractmethod from collections.abc import Sequence from typing import Generic, Iterable import numpy as np from chemprop.data.molgraph import MolGraph from chemprop.featurizers.base import Featurizer, S from chemprop.utils import parallel_execute class MolGraphCacheFacade(Sequence[MolGraph], Generi...
47fde756a5ad4ed2b05faaefb6d3a93c0862cfa95c43a60e9198b9e7d39c237c
Python
2,644
99
import altair as alt from mesa.examples.basic.boltzmann_wealth_model.model import ( BoltzmannScenario, BoltzmannWealth, ) from mesa.mesa_logging import INFO, log_to_stderr from mesa.visualization import ( SolaraViz, SpaceRenderer, make_plot_component, ) from mesa.visualization.components import Age...