sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
7ab46ca780c16cfb4bd10dc93a41a6f2a2256217fa03e9ebdb80b3786dfd6735
Python
10,296
224
import os import msvcrt # For Windows systems ''' By properly implementing file locking mechanisms like using msvcrt for Windows systems, one can ensure that the Optuna optimization process runs smoothly without encountering race conditions or file locking issues, even when using multiple processes (n_jobs > ...
aca4555eb4d2ab1e81419068a9b97d68b53b02dce3a9a21eba7cc0c1b090b144
Python
10,301
268
# coding=utf-8 # Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team. # # 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 # # ...
c7d67098e600d901198067bf5752b990ff98e87fcd7c0b9685556b79fe0393e1
Python
10,307
288
""" 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 numpy as np import sympy as sym from scipy import special as sp from scipy.optimize import brentq def Jn(r, n): """ numerica...
da77173638952acd2d14d6d3bdd9bbd3f8d8bd1fe1922037d4636b104bd72784
Python
10,307
246
""" This module runs sequence classification task. Author: wangning(wangning.roci@gmail.com) Date : 2022/12/7 7:41 PM """ import argparse import os.path as osp from functools import partial import paddle from paddlenlp.datasets import MapDataset from paddlenlp.transformers import ErnieForSequenceClassification from...
0ee5a8cccea0b2b597cc166e14988ebb44a89b744e5c3f775afbd6589338dfcd
Python
10,315
227
"""Plot a GoSubDag. GO Terms in a plot contain text. The first two lines appear by default: GO:0015618 L07 D13 p2 c2 d3 potassium-transporting ATPase activity GO:0015618 => GO ID First line: LNN => The "level" of the go term. The length of the shortest path(s) fr...
b60da4d16300f4116c8e4027ae079f7b2fad2d0955a814d1323379b4f3a6bb2e
Python
10,315
335
# Copyright 2021 DeepMind Technologies Limited # # 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 applicable law or agr...
10a22d4ee864243b6f19d7ad274bdafd04ba2615dbf54bd82fd55f0504c69b16
Python
10,316
219
import numpy as np from mdt.component_templates.base import ComponentBuilder, ComponentTemplate from mdt.lib.components import has_component, get_component from mdt.model_building.parameter_functions.numdiff_info import NumDiffInfo, SimpleNumDiffInfo from mdt.model_building.parameters import ProtocolParameter, FreePara...
610fa5a9dfae7405bc2e792543c5330891f096d6c8086f2cae9e2c99ab4ab456
Python
10,317
269
""" Report Generation Pipeline for NeuroVFM Loads a trained NeuroVFM model and provides a high-level interface for generating radiology reports from medical imaging studies. """ import torch import torch.nn as nn from typing import Dict, List, Optional, Tuple, Union from pathlib import Path import logging import json...
dae6214b75fce9dfdd1f646d6b7871a306a6fab63668c83b664cee78f39cf178
Python
10,318
271
# coding=utf-8 # Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team. # # 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 # # ...
7647982f31cf74f12739e7971588810e7b7b4d96ce8c7a4a58466ea73f1b0da5
Python
10,321
277
import argparse import numpy as np import os import bigstream.io_utility as io_utility from bigstream.align import alignment_pipeline from bigstream.configure_bigstream import (configure_logging, set_cpu_resources) from bigstream.image_data import (ImageData, get_spatial_valu...
ec90fc7176561c46a03d486179cf2655b49cda5a071ab8774bf8484d925f656c
Python
10,323
264
from __future__ import annotations from typing import TYPE_CHECKING from typing import Any from typing import ClassVar from cleo.helpers import argument from cleo.helpers import option from packaging.utils import canonicalize_name from poetry.core.packages.dependency import Dependency from poetry.core.packages.depend...
2cd72de4bc401eabe18db7b064c15d8ab02131ef69f1494123916dd024558534
Python
10,324
281
"""Run some basic statistics on the VG + COCO overlap captions.""" # Imports import os from typing import List import click import datasets import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import spacy from loguru import logger from tqdm import tqdm from compositionality_study.constants impo...
b2018547ce5fb143e007ac30c211e91921a2b9a062d81715111ba80a47c13b33
Python
10,326
296
# Simulations as a function of the source depth in the spherical conductor import numpy as np import matplotlib.pyplot as plt from bfieldtools import sphtools as sph import functions font = { 'size' : 20} plt.rc('font', **font) #%% Plot parameters legendfontsize = 15 linewidth = 2.5 #%% Define parameters #...
a39f10b2d63256edc7cc623229c9afc76cee7ede14790d1f6bd98ca4cf26fd71
Python
10,327
247
# # Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with # Sandia Corporation, the U.S. Government retains certain rights in this software. # # See LICENSE for full license details # from .iadc import IADC from .iadc import get_digit from simulator.backend import ComputeB...
076bebdfb03a81a56cc2212ed56c070f141d510e73dcb0bd6056633dcb938090
Python
10,329
257
import numpy as np import timeit as ti from scipy import stats from typing import Union import os def AMI_Thomas(x : np.ndarray, L : Union[int,np.ndarray,list]) -> Union[np.ndarray,float]: """ Usage: (tau,ami)=AMI_Thomas(x,L) inputs: x - time series, vertically orientedtrc files selected by user ...
1f817b0e7a9fdd6cfd9c4a54062a01cff46b0b8600ad687300e3bbe4f47a3dee
Python
10,335
272
#!/usr/bin/env python3 # MIT License # # Copyright 2022 Broad Institute # # 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 Software without restriction, including without limitation the rights # to use...
311b6a9a25c6fd83903538b6e53c504045c9aa86b5fb0b8cc2a1eb83344f450f
Python
10,335
290
import math from functools import partial from typing import Callable, NamedTuple, Protocol import jax import jax.numpy as jnp import jax.numpy.linalg as jnp_linalg from jax.flatten_util import ravel_pytree from jax.tree_util import tree_map from .device_utils import DEVICE_AXIS, split_rng_key_to_devices from .types ...
4cadce9843f54427c3a5de1cc1ea55ff4233868af45441b2d1376e91a364e539
Python
10,346
262
import sys, pysam, time, os, copy, argparse, subprocess, random, re, datetime import numpy as np from subprocess import Popen, PIPE, STDOUT from argparse import ArgumentParser, SUPPRESS from sys import exit, stderr def subprocess_popen(args, stdin=None, stdout=PIPE, stderr=stderr, bufsize=8388608): pr...
5074175e91abd65d309e030025abc123395158b6f8580cb4b25f814753ccfbfe
Python
10,348
257
import torch from torch import nn import torch.nn.functional as F from .modules import BaseClassifier, BaseClassifier_reg # --------------------------------------------------------------------------- # CNN-Transformer Hybrid baselines # --------------------------------------------------------------------------- cla...
a1ffbf5de1d1e7a8016f4747509065925163e44212b9c9366e59c315b75178be
Python
10,354
246
""" run_spont_analysis.py ===================== Analysis pipeline for the spontaneous Brunel sweep (bitrep_spont). For every spikes_spont_s{seed}.npz file found under RESPATH, computes: - Tier-1 regime metrics: mean_rate, chi, tau_net, cv_isi_mean, cv_isi_std, f_peak, sigma - Tier-2 dim...
cf0340642e445a600fd673784fb1f80b9add98e842c81214d076576a33634f2e
Python
10,360
244
# -*- coding: utf-8 -*- # Copyright (C) 2017-2023 Phillip Alday <me@phillipalday.com> # License: BSD (3-clause) """File I/O utilities for EEG data.""" from __future__ import division, print_function import codecs import os import mne import numpy as np from .. import __version__ # TODO: include boundaries in MNE ...
edd5bf07f88065fd4abf97b4f0d08477a5b781029aaebbe34cb95e74f2c00479
Python
10,362
283
import os os.environ["CUDA_VISIBLE_DEVICES"] = "0" from typing import Optional from dataclasses import dataclass, field from transformers import HfArgumentParser, TrainingArguments, BertTokenizerFast, set_seed, Trainer import logging from src.benchmark.models import model_mapping, load_adam_optimizer_and_scheduler fr...
e12281ca49da8aff4e08681fcdce14cb8fe645aefe21c4b0c9ee28ebf76be441
Python
10,363
300
"""Render evaluation figures from saved payload (six separate PNGs: eval_a–f).""" from __future__ import annotations import os import matplotlib import numpy as np from matplotlib.colors import to_rgb from tasks.dynamic_segmentation.simulation_eval_bars import SIMULATION_BAR_LEGEND_LINES from tasks.dynam...
2fbbf425370ee18f9d17c17c7dc4aedde3e8e2d6bbc90162e50679c2ad62466a
Python
10,368
228
import os import numpy as np import cv2 label_path = r'D:\FangX24\data\DOTA/labelTxt/' store_path = r'D:\FangX24\code\LO-Det-main\mnt\Datasets\DIOR/Annotations/' if not os.path.exists(store_path): os.makedirs(store_path) classes = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'la...
a664e2c14316010954e1fc3eac2c6c8b2836c62cf706185f6d3b52a00f826c12
Python
10,368
323
import sys import logging import os import tensorflow as tf import tensorflow_addons as tfa from tensorflow.keras.layers import Conv2D, MaxPooling2D, Layer, Flatten, Dense, Bidirectional, Dropout, LSTM, \ LayerNormalization, MultiHeadAttention, Concatenate from tensorflow.keras.models import Model from tens...
518c76e0a35396c7499a0054b7ec296a36f82f2ca17222b97a6897bd90f776a5
Python
10,369
269
# # Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with # Sandia Corporation, the U.S. Government retains certain rights in this software. # # See LICENSE for full license details # from ..idevice import EmptyDevice import numpy as np from scipy.interpolate import interp...
7b689c7cbe4923c8c933348ffe89c3ee7e1dce134728803d3a829f1b85678160
Python
10,370
124
import torch import torch_geometric.nn as gnn from Bio.PDB import PDBParser import numpy as np import pandas as pd from torch_geometric.utils import remove_isolated_nodes from matplotlib import pyplot as plt import warnings warnings.filterwarnings('ignore') cn = {'P':0,'M':1,'A':2,'B':3} cn_ = {0:'P',1:'M',2:'A',3...
b07e5b92c75c98426ff011143abbd54dea79ea7dbddf5e15221e24d986f8486d
Python
10,372
275
from __future__ import annotations import numpy as np import pandas as pd STRUCTURE_AXIS_WEIGHTS = { "phi_local": 3.0, "phi_uncertainty": 1.0, "phi_stability": 0.0, "phi_reference": 0.0, } REFERENCE_AXIS_WEIGHTS = { "phi_local": 0.0, "phi_uncertainty": 2.0, "phi_stability": 1.0, "phi_...
0cd10d05960e94e700070da39d00522d1bb8f85af536ba48cd3447e8578a8605
Python
10,373
241
"""Publication-asset generator. Reads results_phase1/phase1_artifacts.npz + phase1_meta.json (+ the CSV tables) and writes paper-ready figures and CSV/LaTeX tables to results_phase1/paper/. Decoupled from training -> rerun anytime to restyle. Run: python -m kanfood.report""" import sys import json from pathlib import P...
3da5310f5438aa0225a0e2d88a0569328cca2e4e1084051c91d14d303ec3cd04
Python
10,376
231
import io import logging import os import re import tempfile import unittest from pathlib import Path from unittest.mock import patch from GMXMMPBSA.progress import MAX_RICH_WIDTH, FrameCounter, _StallNotifier, monitor_progress, resolve_progress_style class _Stream(io.StringIO): def __init__(self, is_terminal): ...
05164a8d25cc014462d77ef995b6b1cf046d01f57e00e7cf49e6a861b2ae6a22
Python
10,377
249
# _*_ coding: UTF-8 _*_ # Version information START -------------------------------------------------- VERSION_INFO = \ """ Author: ZHANG YUBO Version-01: 2020-01 Converting VCF format to multiple sequence alignment """ # Version information END ------------------------------------------------...
53ed02567bbf4da96a6a094ec86e0ae959e0e274fe5a3cc705483e949f92614d
Python
10,377
261
#!/usr/bin/env python3 import argparse import shutil import os import sys import numpy as np import pandas as pd from tqdm import tqdm from sklearn.metrics import roc_auc_score, f1_score import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader,...
586da7735d5b706788429024a2d3028e378b0946a41ff171a70fdbcf7e861595
Python
10,378
315
import logging import os import sqlite3 import re import pandas from . import Exceptions from . import NamingConventions class WDBQF(object): "Weight DB weight Query Format" RSID=0 GENE=1 WEIGHT=2 REF_ALLELE=3 EFF_ALLELE=4 K_RSID="rsid" K_GENE="gene" K_WEIGHT="weight" K_EFFEC...
81cb9b2221c16b21e1ba6737bcf6fbb5d398784101584a972d75d2a6d5d413e8
Python
10,378
343
from __future__ import annotations import dataclasses import hashlib import json import logging import shutil import threading import time from collections import defaultdict from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import Generic from typing import TypeVar from typ...
a6ff789b736a6825acb96b6e3cf2908b4ecf08ae1793ef4f9d99db713168d754
Python
10,379
232
import numpy as np import pandas as pd import matplotlib from matplotlib import pyplot as plt import scipy import pynumdiff import cvxpy class compute: def angular_acceleration(fly_df: pd.DataFrame, name_of_heading_field:str, name_of_time_field: str): params = [2, 10, 10] dt = np.median(...
4cfb3ea1e8ad24c87b113c5da27fbfb2ed33a3ca7e0ee7d1ec182ee39662fd19
Python
10,382
232
import numpy as np import scipy.io as si import os import h5py from sklearn.model_selection import KFold from imblearn.over_sampling import RandomOverSampler from imblearn.under_sampling import RandomUnderSampler from sklearn.svm import SVC import sklearn.pipeline as skp from sklearn.preprocessing import StandardScale...
cae3ca9c87147643bbf0eef321378b9b2ea79c9a791be10e7b61727a01228c8f
Python
10,385
300
import os import matplotlib.pyplot as plt import skimage.io as skio import torch import torch.fft import torch.nn.functional as F import numpy as np import scipy as sp from math import factorial import numbers from scipy import ndimage import scipy.fft as fft defaultTFDataType="float32" defaultTFCpxData...
6b6b76f9c9ac3452143985a5b3b6e2b4190deebfe18286896041ea083d765f33
Python
10,388
307
# Authors: Christian O'Reilly <christian.oreilly@sc.edu> # Scott Huberty <seh33@uw.edu> # License: MIT """class to wrap mne.annotations in dash shapes/annotations.""" import mne import numpy as np import pandas as pd from uuid import uuid1 class EEGAnnotation: """Store mne.annotation info as plotly sha...
92369153f772afb086d02fca18db5598c17fd4f7655d7a1a7d35d432dbee8eaa
Python
10,396
252
from typing import Optional import numpy as np import torch import torch.nn.functional as F from .tensor import coerce_numpy from sklearn.metrics import auc @coerce_numpy def rna_compute_precisions( validation_step_outputs: torch.Tensor, minsep: int = 0, step: int = 0.001, ): T = np.arange(0, 1 + step,...
184c933fae56fd12c9d076487b88ea2f6bfe7750170d65c500eb34d3227cd187
Python
10,398
272
import os from scripts import pdb_utils import pandas as pd from Bio import pairwise2 from Bio.pairwise2 import format_alignment from Bio import Align from Bio.Align import substitution_matrices from datetime import datetime aligner = Align.PairwiseAligner() aligner.substitution_matrix = substitution_matrices.load("B...
3aa3837b60d87e93065b4e0e6326ee89c3766ae756f445f63d71026e3341d957
Python
10,405
273
"""CPU-only mask cleanup and frame interpolation shared by all builds.""" from __future__ import annotations from collections.abc import Mapping, Sequence import numpy as np from scipy import ndimage CLEANUP_OPERATIONS = { "fill-holes": "Fill Holes", "remove-islands": "Remove Small Islands", "largest":...
645a5bcb054a4b4620980951031cc5d89f02abd5e05838cc3abf4d55d44a023a
Python
10,408
270
from __future__ import division import torch import numpy as np import cv2 def nms(bbox, thresh, score=None, limit=None): """Suppress bounding boxes according to their IoUs and confidence scores. Args: bbox (array): Bounding boxes to be transformed. The shape is :math:`(R, 4)`. :math:`R` is...
03fc8f7c6f711d2102a8b14127c12a485ab071d9a182a2ac6df4c416d3a546ea
Python
10,411
246
import logging import math from typing import Optional import anndata import matplotlib.pyplot as plt import numpy as np import squidpy as sq from scipy.spatial.distance import cdist from sklearn.metrics.cluster import adjusted_rand_score from sklearn.neighbors import NearestCentroid from aestetik.AESTETIK import AES...
4472c9539f0ce86c599c64b20bafd9472e11244e0351fb2f61fa8b4110783a5d
Python
10,413
244
"""Run the Phase 1 reference-equivalence test with a real SAM2 predictor.""" from __future__ import annotations import argparse from pathlib import Path import shutil import sys import tempfile import zipfile import numpy as np from PIL import Image, ImageDraw def parse_args(): parser = argparse.ArgumentParser...
f6127b91f1ee03e01e6c58a573569a694ca06e175805ebb1097c594fd88d0e59
Python
10,419
283
import copy import threading import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import to_rgb from matplotlib.widgets import Button, Slider from skimage.segmentation import find_boundaries from .motion_marker_utils import compute_stats, stats2mms mpl.rcParams['axes.spi...
5057cf87e7092d8657f150ab0da6c8f4968a8220642ef3add053cb40ef424579
Python
10,420
201
"""Page 6: DA Analysis.""" import streamlit as st import plotly.express as px import plotly.graph_objects as go import pandas as pd import numpy as np from utils import PIPE_ORDER, PIPE_COLORS, style_figure def render(store, dataset): st.header("Adaptation Effects") st.markdown( "Does domain adaptati...
816c1dfeaad125db4dd2a5ed8aea1fb9b69d8072c8debd1b28ed1398f208a64b
Python
10,421
298
# 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 copy import logging from fairseq.models import ( FairseqEncoder, FairseqEncoderModel, FairseqLanguageModel, register_m...
285079398212c0be2d3ffd7ee57d799a023baf336134311980f7c1e417d1544e
Python
10,426
283
from __future__ import annotations import logging import traceback import pandas as pd from scvi import settings from scvi.dataloaders import DataSplitter from scvi.model._utils import get_max_epochs_heuristic from scvi.train import MlxTrainingPlan, TrainRunner from scvi.utils import is_package_installed, mlflow_log...
5117103fee2e78bcd515a618dcb1721b4434069f9cea70ad47af979e073cbc19
Python
10,432
293
import tensorflow as tf from tensorflow import keras from tensorflow.keras.models import Model from tensorflow.keras.layers import Conv2D, MaxPool2D, Reshape, RepeatVector from tensorflow.keras.layers import Dense, Input, Flatten, Dropout, concatenate from tensorflow.keras.layers import BatchNormalization, Lambda, Mult...
da41a3b1f498b1a0485e0b4781a88fab425009dc10a0eeb763bb0f0397f8c8cb
Python
10,434
338
""" This module contains all loss functions used by the Garfield module. """ from typing import List, Literal, Optional import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable def compute_omics_recon_mse_loss(recon_x, x): """Computes ...
7ad69022d34a00b4d393842cf2afb7bc38f61263ca74fba841e5a40768bc02d0
Python
10,435
206
#!/usr/bin/env python3 """figure2_rna_volcanoes.py — per-stratum RNA volcanoes with INV-only Tier-1 highlighting. Updates the prior per_celltype_volcanoes_v3.png by: • Re-colouring labels into the current evidence groups • Inverse-concordant Tier-1 (2 genes: ITGB2, IKZF1) get RED bold * + thick ring • Tier-2 aux...
e8e9d5901d9ccf7c9492bdcaa2e33ec3b39b66c7bb5f7c37cba8c7fda841902d
Python
10,442
259
"""Slater-Koster directional 2-centre integrals + Born-Mayer repulsion. Wave-2 OCE extension. Provides the *machinery* (SK integrals + Born-Mayer) and the *feature representation* needed to upgrade OCE 2F. ARCHITECTURE OVERVIEW (essential): In v1.1.x, 2F is shell-only Wolfsberg-Helmholz: h_2F^WH(i,j) = sum_{...
2932ad8c09e527d4556940fd69788cb0537bb6f644a17fad0d54fb2c927e4c98
Python
10,444
168
# Copyright (c) 2019, Adobe Inc. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike # 4.0 International Public License. To view a copy of this license, visit # https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode. """ 自定义pytorch函数,实现一维、二维、三维张量的DWT和IDWT...
a4b8d410b1eb9aa5f6f7640f365be4d2649f8fee8cbd0850317090dbbdd02919
Python
10,444
253
import argparse import json import os import re from tempfile import TemporaryFile, NamedTemporaryFile from urllib.parse import urlparse import boto3 import newspaper import tldextract from tqdm import tqdm from warcio import ArchiveIterator with open(os.path.join(os.path.dirname(__file__), 'domain_to_allowed_subdoma...
56bd9ddcf1947b89bf90acd3c062305d0b867e39ce2add05b5bb8d4c4375bf96
Python
10,445
261
"""Function that converts a set of array files (.npz, .mat) containing spectrograms into a pandas DataFrame that represents a dataset used by ``vak``. The columns of the dataframe are specified by :const:`vak.prep.spectrogram_dataset.spect_helper.DF_COLUMNS`. """ from __future__ import annotations import logging im...
3153a8362c19a9977ee4ae10e60915362afd4c40538bbb4a2d4047ad8c5ea568
Python
10,448
301
"""Pin `fix_taxonomy` rewriting HasEnzyme/HasSpecies arguments it orphans. `fix_taxonomy` used to delete a reclassified `other_organisms` id without ever touching `doc["relations"]`, so a HasEnzyme subject or HasSpecies object naming that id was silently dropped by `preprocess_relations`. These tests exercise the rema...
2443998d68a6db696b7e37e6c85f9c9f46a0e79d5db305a79899249242c69a16
Python
10,455
340
import torch import torch.nn as nn __all__ = ["ResNet", "resnet18", "resnet34", "resnet50", "resnet101", "resnet152"] def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution with padding""" return nn.Conv2d( in_planes, out_planes, kernel_size=3, ...
9fd142b69bde71087856441600f3acef5f344702c26eecdc137926704772e3f3
Python
10,457
311
"""Parse behaviour CSV schemas and build extraction parameters. All functions in this module operate on plain Python values or pandas objects. They intentionally contain no UI-framework dependencies. """ from __future__ import annotations import pandas as pd DEFAULT_BEHAVIOUR_COLUMN_CANDIDATES = { "Behaviours/...
4ed08c9594f3d10834e3043725fe00af5fc8acf5639a31ac1af75b4730cc4046
Python
10,458
231
from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * import sys class ChannelparametersSet(QWidget): def __init__(self): super(ChannelparametersSet, self).__init__() self.setWindowTitle("通道参数设置") self.setFixedSize(900,400) self.setWindowIcon(Q...
8b97b1d4289fb28a07c67ffbb5e8560fb657344ccf14af0d67d5123a746be312
Python
10,458
266
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 17 21:07:57 2025 @author: vbp Trial-history effect of outcome on anticipatory licking, for Figure 2B and Figure S2D. Fig S2D - delta anticipatory lick rate relative to baseline, across trials before/after cued reward, omission, a...
f2355336594e8de7b189dd0e5b7cb6a9f91e9ba4bee087b768e5c1894375f279
Python
10,458
287
import zarr import torch import random import sparse import pickle import itertools import numpy as np import pandas as pd import torchvision.transforms.functional as F from utils import MOUSE from random import shuffle from einops import rearrange from torch.utils.data import Dataset class MBADataset(Dataset): ...
dae2114a90396c4b54f516e4314efb87551345723af179b7692e93e4e6ee16c5
Python
10,460
280
# 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 numpy as np import torch import torch.nn.functional as F from fairseq.models import register_model, register_model_architecture from fa...
a07b74047ae2eb3f68f100ad5639344333595242942821ac6af9b31c2a3d3dfa
Python
10,463
295
import pandas def _dataframe(names, data): columns = list(zip(*data)) d = {names[i]:columns[i] for i in range(0,len(names))} d = pandas.DataFrame(d) d = d[names] return d def sample_dosage_data_1(): #chromosome, rsid, position, non_effect_allele, effect_allele, frequency, allele_dosage s =...
6e28dbba5a1ce192ea719b9c06e684e3f22801bbf511b06dca3b80f60f9e0411
Python
10,468
212
#!/usr/bin/env python3 """DOS das perovskitas SIESTA: pipeline, validado antes de qualquer conclusão. MOTIVO. O registro do projeto tem uma pendência declarada: nenhuma densidade de estados foi jamais ajustada com OCE em conjunto algum. Para o artigo do gap das perovskitas (RMSE/sigma 0,178, faixa forte), a DOS fecha ...
435e6e41e61e42858af198e79084e523a1c650226bc9fec60e9346171bc7ff19
Python
10,477
302
import argparse import os import random from concurrent.futures import ProcessPoolExecutor from copy import deepcopy import h5py import numpy as np import torch import torch.optim as optim from sklearn.model_selection import KFold from torch.utils.data import DataLoader, Dataset from torchdiffeq import odeint learnin...
80ca02a38819be86ebab291d823ce3292f2cfe22d9c7bba7bbe11038d3f1f2a4
Python
10,481
299
""" Copyright (c) Facebook, Inc. and its affiliates. Copyright (c) Microsoft Corporation. Licensed under the MIT License. Adapted from https://github.com/FAIR-Chem/fairchem/blob/main/src/fairchem/core/models/gemnet/utils.py. """ import json from typing import Any, Dict, Optional, Tuple import torch from torch_scatter...
89ebe5c8b535c86e52cea95371d4f2064497f6eeaaa63c379ba23f57fcc03bfd
Python
10,486
280
import importlib import logging import os import pickle import re import numpy as np from collections import OrderedDict from copy import deepcopy from dataclasses import asdict, dataclass from enum import Enum from typing import Any from .performer_module import PerformerModule from .transformer import pytorchTransfor...
c03e303b4b130a4396a6c999a72b04b8798870d59dfb46bdfc5ae15ff4dfd35e
Python
10,490
316
import os import pickle import hydra import lightning as L import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import torch from captum.attr import IntegratedGradients from lightning.pytorch.callbacks import ModelCheckpoint from lightning.pytorch.loggers import WandbLogger from...
21010203ccb5a16de848d1e983805ddf3c4fba5f6dd0fa17d938033f53e11d2b
Python
10,492
268
# Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # Adapted from https://github.com/FAIR-Chem/fairchem/blob/main/src/fairchem/core/models/gemnet/gemnet.py. from typing import Dict, List, Optional # import numpy as np import torch import torch....
0cc3949c82660db6d415bbfd5147acbca37c59a270fa151ace3a642f06c55e7b
Python
10,498
271
# -*- coding: utf-8 -*- import os import gc import argparse import json import random import math import random from functools import reduce import numpy as np import pandas as pd from scipy import sparse from sklearn.model_selection import train_test_split, ShuffleSplit, StratifiedShuffleSplit, StratifiedKFold from sk...
cda44e38ad47eb12e5d71c93ce5e11807c736cc719a9d16a3b9df1a31bf648ea
Python
10,508
302
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
4d59b82da07e487e9202ef86046734d2130d629c76553b6dbb8fe9e12a697fd1
Python
10,510
205
import os import math import argparse import numpy as np from pathlib import Path def parse_arguments(): parser = argparse.ArgumentParser() # experiment parser.add_argument("--random_seed", type=int, default=0, help="random seed for rng") parser.add_argument("--epoch", type=int, default=0, help="epoch ...
61e3f31a8bd249539064d7b7bc1f45a46ffbd3f9606bc2adad256f28e45a3421
Python
10,512
327
import numpy as np import pandas as pd import statsmodels.formula.api as smf from .paper_ANOVA import ANOVAModel # Colours and types Types = np.array(["T4", "T5"]) Type_colours = np.array(["#17becf", "#ff7f0e"]) Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"]) Subtype_colours = np.array( ...
d3374b16645168ce8c6eaeeb6b694337a39d28e967bebb7b968cf87556972a9a
Python
10,513
254
"""Function that evaluates trained models in the frame classification family.""" from __future__ import annotations import json import logging import pathlib from collections import OrderedDict from datetime import datetime import joblib import lightning import pandas as pd import torch.utils.data from .. import dat...
46c301b41634c9e92ae68e09ef2861f1daaa4c58001fe2790bc72e382115d34c
Python
10,520
268
from transformers import ( AutoModelForCausalLM, GPT2Config, get_scheduler, PreTrainedTokenizerFast, DataCollatorForLanguageModeling ) import numpy as np import datetime import random import math import time import gzip import os from torch.optim import AdamW import torch.utils.data import torch.nn as...
99120325f04f53429da2108e70b27834b6c12283a41c9c1c5f7e8d12cde8075c
Python
10,521
292
import os os.environ["OMP_NUM_THREADS"] = "4" # export OMP_NUM_THREADS=4 os.environ["OPENBLAS_NUM_THREADS"] = "4" # export OPENBLAS_NUM_THREADS=4 os.environ["MKL_NUM_THREADS"] = "4" # export MKL_NUM_THREADS=6 os.environ["VECLIB_MAXIMUM_THREADS"] = "4" # export VECLIB_MAXIMUM_THREADS=4 os.environ["NUMEXPR_NUM_THREADS"]...
f0b3004753d0bcf8c443af6613e86919eccd9419917eb88ca3c67acbac1539de
Python
10,522
287
""" Shared utility functions for epigenetic-protocadherin coordination analysis. Harbert D. (2026) BMC Genomics Inner Architecture LLC """ import os import gzip import subprocess import pandas as pd import numpy as np from scipy.stats import pearsonr, spearmanr, fisher_exact from scipy.stats import norm as sp_norm fr...
1097b9bfa69f51b146f0736165e56ec6469e837a626c00636d9e08d1be07273d
Python
10,523
330
import argparse from pathlib import Path import matplotlib.pyplot as plt import numpy as np from pewlib import Laser, io from pewlib.config import SpotConfig from pewlib.process.filters import rolling_median import register #Script to combine TIFF and LA-ICP-MS files for image fusion by cumilative density function a...
bcdc93d68645c853688478f6ab24057e0a51f92cbc3a1a76d9d54fe7446de098
Python
10,523
213
import sys sys.path.append("../utils") import torch import torch.nn as nn from utils import utils_basic import config.cfg_lodet as cfg #处理类别不平衡问题,使得模型更关注难分类的样本,从而提高性能 class FocalLoss(nn.Module): def __init__(self, gamma=2.0, alpha=1.0, reduction="mean"): super(FocalLoss, self).__init__() self.__gamm...
dc2e38bae7056f9149d262d12b506a78833dfe6c102a61eac3d85f62868aed9c
Python
10,539
288
import argparse import hashlib import importlib.util import json import shlex from pathlib import Path import numpy as np import pytest import torch from gpn.scoring import log_likelihood_ratio, nucleotide_probabilities FIXTURE_DIR = Path(__file__).parent / "fixtures" BASELINE_PATH = FIXTURE_DIR / "published_model_b...
765e53cd7806446235f7042638ce548c9e7e87a63ce3982d06f5d09dc25084ca
Python
10,551
246
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Calculate the eigenmodes of a cortical surface Updated to lapy 1.0.1 Original authors: James Pang and Kevin Aquino, Monash University, 2022 @author: James Pang, Monash University, 2025 """ # Import all the libraries from lapy import Solver, TriaMesh import numpy as n...
6979ad8befb2a0446085ae321c69789a94ab6bbf75e591c6bf61f64a6517fbbd
Python
10,553
314
"""SIESTA DFT-PBE single-point runner for free C / Si clusters. Strategy: spin-polarised DZP basis with PBE GGA on a non-periodic simulation cell. The cell is set with ≥ 12 Å vacuum on all sides so that the cluster does not interact with its periodic images. Pseudopotentials (PSF / PSML) live in `pseudos/`. Net cha...
2f9cd7e26051657d9322694820f0ab578d31fdf9b44ef5772a872b35de980359
Python
10,554
187
from .activations import * from ..layers.convolutions import Convolutional, Cond_Convolutional import math import numpy as np class Shuffle_new(nn.Module): def __init__(self, filters_in, filters_out, kernel_size=3 ,c_tag=0.5, groups=3, dila=1): super(Shuffle_new, self).__init__() self.left_part = ro...
c55fce650b47b4b5d353987d6bbc57d0b48976a10abea374049c0d13481828a1
Python
10,556
295
__author__ = 'Robbert Harms' __date__ = "2015-10-27" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" class EstimableModel: def __init__(self, *args, **kwargs): """This is an interface for all methods needed to be able to optimize and sample a model. """ super().__init__() ...
3823a4c0d8fbbc3a5dd06309a73b88228f474d50501fe1e24cf389a270c83682
Python
10,560
301
from os import makedirs from os.path import join, exists import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt, gridspec from matplotlib.ticker import FormatStrFormatter, NullFormatter from scipy import stats from sklearn import metrics from config_path import PROSTATE_LOG_...
593232d601fe8e5ee8d4dbabcd37d795c82ea256cfe45ad0152255baa4d99fe0
Python
10,563
236
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import SGConv class MLP(torch.nn.Module): def __init__(self, sizes, batch_norm=True, last_layer_act="linear"): super(MLP, self).__init__() layers = [] f...
86e64124aa468974546662f6afa9f5f42929c47a2dbe365d3b1cb5d31a61f38b
Python
10,564
173
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'generate_protocol_tab.ui' # # Created by: PyQt5 UI code generator 5.10.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_GenerateProtocolTabContent(object): def setupUi(self,...
b9f5335bdb0e64227b4fb58b1431f5b74be79f5513b0c044b1a834a804b19be2
Python
10,564
361
# -*- coding: utf-8 -*- # # Documentation build configuration file, created by # sphinx-quickstart on Fri Nov 18 11:12:41 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All confi...
e56357d0e796efdac40e66599e36ab2aa5dfeefbd6bce080de265c0c77cd465d
Python
10,565
269
from __future__ import annotations import gc import logging import os import pickle import traceback import warnings from typing import TYPE_CHECKING import numpy as np import pandas as pd import torch from scvi import settings from scvi.model._utils import parse_device_args from scvi.train import Trainer from scvi....
a0f7c5e7a25d1140caf9bd280156eb9ab820674733f828567183f2dcdf3f1dcb
Python
10,578
304
import argparse from pathlib import Path import deepdish as dd import h5py import nibabel.freesurfer.mghformat as mgh import numpy as np from scipy import stats from scipy.spatial import distance_matrix from spacestream.analyses.smoothness import prep_smoothness from spacestream.core.constants import ROI_NAMES from s...
b6c69dccca0525917a6b4190541b92991143907ace0c9244eacbe581041ab6de
Python
10,588
312
# -*- coding: utf-8 -*- """ @Time:Created on 2019/5/20 19:40 @author: LiFan Chen @Filename: model_glu.py @Software: PyCharm """ # -*- coding: utf-8 -*- """ @Time:Created on 2019/5/7 13:40 @author: LiFan Chen @Filename: model.py @Software: PyCharm """ import torch import torch.nn as nn import torch.optim as optim import...
d3576eefb5e5bb29f19a4996d607836dd32a26b2f4a1a936f3149abf32423344
Python
10,592
336
# 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. """ A standalone module for aggregating metrics. Metrics can be logged from anywhere using the `log_*` functions defined in this module. The l...
4a18d602dc6928e17f5e3ca89621fef7afa3b6a1c588053cd0960a990157525f
Python
10,593
342
""" Training Script for Vision Models Supports both self-supervised pretraining and supervised classification. Uses PyTorch Lightning for distributed training with DDP. """ import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import os import logging import argparse import torch import pyto...
c4c4af7ea19625d4ffec9fa88516290e6876ff2844ae616896f1c2535a45bf03
Python
10,596
346
from pathlib import Path from types import SimpleNamespace import numpy as np import pytest import torch from gpn.star import inference as inference_module from gpn.star import model as model_module from gpn.star import utils as utils_module def make_phylo_dist(path: Path) -> Path: path.mkdir(parents=True) ...
279559af57f1106e02aedf545aabf3763d15b480bb382b6d3de0b950a7b2f03d
Python
10,601
264
import os import time import math import random import numpy as np import argparse import torch import torch.nn as nn from yaml import parse from gnn_data import GNN_DATA from gnn_model import GIN_Net2, GIN_Net3 from utils import Metrictor_PPI, print_file from tensorboardX import SummaryWriter def boolean_string(s):...
3999f5b06c09f87ca6d8a096639bec5f98bc9b48e377f5008b71ddb5e28a3117
Python
10,604
259
from collections import deque from collections.abc import Hashable import networkx as nx import pandas as pd from sklearn.base import clone from tqdm.auto import trange from pgmpy import config from pgmpy.base import DAG from pgmpy.causal_discovery import ExpertKnowledge from pgmpy.causal_discovery._base import BaseC...
93f05a77f7bdb7899450231a2031c13dbcc416d53ad1b0a5a220701f563539ba
Python
10,608
320
""" Adapted from https://github.com/neuroailab/TDANN/blob/main/spacetorch/swapopt.py """ import copy import sys from dataclasses import dataclass, field from datetime import date from pathlib import Path from typing import Any, Dict, List, Optional import numpy as np from numpy.random.mtrand import RandomState from tq...
75fce7ad168fd000ac700d67af3a243df0ab225971d5bdcae84761e1427cb6f3
Python
10,612
275
# 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 unittest from typing import List import torch from fairseq.token_generation_constraints import ( ConstraintNode, OrderedConst...
f51adae74bfe0e9ece4b800bc2c4e903106743c7f77704b865da21a27edfbb13
Python
10,615
344
#!/usr/bin/env python3 """Generate benchmark charts from hyperfine JSON outputs. Reads `<data>/{rust-beta5,rust-beta7,perl-0.6.11}_cN.json` (the per-condition hyperfine outputs from `scripts/benchmark.sh`), produces three PNGs into `<out>/`: benchmark_wall_time.png — wall time vs cores, three engines bench...
da31abe72bcda76e1d1b0fc877ebde8ab6367bbffdff38cc90dd6b24d0a90915
Python
10,617
322
from itertools import chain import anndata import numpy as np import pandas as pd import pytest from anndata import AnnData from scipy.sparse import csr_matrix from scipy.spatial import Delaunay from sklearn.metrics import euclidean_distances import novae from novae._constants import Keys from novae.data.dataset impo...