sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
3aa6ad3411d1ce0901353a941b7f8cb0c073b3967e4324c7f4d9e182c5b105fc
Python
7,986
190
"""Configuration file for the Sphinx documentation builder.""" # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/mast...
93f5c4258d79dd776f5a794216c802ebee738128e7da6918d9daf76ec53db2d4
Python
7,986
218
from typing import Callable, List, Union, Tuple import math import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from torch.nn.parameter import Parameter import kornia.filters as KF from . import base from .base import Conv2d, Linear, ChAttn2d, SpAttn2d _DEBUG_IMAGES_: Uni...
230e15430b36151564c5a8474f51983d8c48d0a3234e1e111dc10d3d58d279e7
Python
7,992
248
"""Memory tests to test subjects for paying attention in the scanner.""" import glob import os import shutil import click import numpy as np import pandas as pd from datasets import load_from_disk from tqdm import tqdm from compositionality_study.constants import ( COCO_IMAGE_DIR, COCO_LOCAL_STIMULI_DIR, ...
abd08576874cb953f8574a6aa91b74b2e0b02a7cbafdcc30bba267c8f7480e54
Python
7,992
267
import os import logging import sys import inspect from copy import copy import itertools import pandas as pd import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data as data import torch.distributions as dist import torch.optim as optim from torch.opt...
4700cf0e81cefabf838e89aad7b072d6bd81005a428afbfd9999dfaaeae77a39
Python
7,993
254
# 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 argparse import os import os.path as op from collections import namedtuple from multiprocessing import cpu_count from typing import Li...
2554ae34a07cb2b46cc8aabf47a47f469077ceac30034c3c4042e9ae9d225313
Python
7,996
221
# 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. from dataclasses import dataclass, field import torch from fairseq import utils from fairseq.logging import metrics from fairseq.criterions im...
62a64082d6be1d09a0d9348fbd6b6c8152044e4845010244db3360a2440cdda3
Python
7,998
247
# coding=utf-8 # Copyright 2018 Salesforce 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 # # Unless require...
214faa1c67a17c0bd6e47d6c59c7a8c657149ff39e32abe9835e2ee2f2b1f369
Python
7,999
248
# coding=utf-8 # Copyright 2018 Salesforce 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 # # Unless require...
d01e37dbaf0a3c7a8b85150886820e0fdf036bf0508c6dc5391bc2fb67fc4278
Python
8,002
206
"""SIESTA-PBE variable-cell relaxation for the oxide perovskite polymorphs. Periodic DFT is the correct tool for perovskite polymorph ranking (xtb fails on oxides; ORCA is molecular and blind to cell shape). This relaxes each polymorph (atoms + cell) so that cell-shape competition (orthorhombic tilts, hexagonal) is ca...
81cb84120fef53044ee3f287f2549bb840d60ceb1716ade6e286eed05f414fa6
Python
8,003
225
# 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. """ RoBERTa: A Robustly Optimized BERT Pretraining Approach. """ import logging import torch import torch.nn as nn import torch.nn.functional...
9f7420bf1ef19ef1fd2ed6fc174b4fa2f2f266fd615e882133b25b9760e2c6f6
Python
8,005
183
import os from textwrap import dedent from mdt.lib.nifti import load_nifti import numpy as np from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot from PyQt5.QtWidgets import QFileDialog from mdt import load_brain_mask, create_median_otsu_brain_mask from mdt.utils import split_image_path from mdt.visualization.maps...
c92b721389df452380990b3f4de9c53431e22cf9ab46650cf3807f15966f1612
Python
8,011
203
from __future__ import annotations import re import networkx as nx import pandas as pd from skbase.utils.dependencies import _safe_import from pgmpy.base import DAG from pgmpy.causal_discovery._base import BaseCausalDiscovery litellm = _safe_import("litellm") class LLMPairwise(BaseCausalDiscovery): """ LL...
45422cc3c536028b56ea88a057e73ca0a824e783710d55e8d86060566a8c949e
Python
8,012
171
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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...
6ed58b35908a4095a12102ef1e103db68b7b5fe90b1df5a1ad1edbdc8e0053b0
Python
8,013
172
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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...
b69f6b668fc421dd2784dfb000ce32a74b100786d8b850d620c7f136a7b5937f
Python
8,019
192
"""Phase 1b — extend the per-atom power-law to L >> 16 using OCE alone. We use the OCE J_F coefficients fitted in `phase1_full.py` (trained on L ≤ 8, validated on L ∈ {12, 16} at 45 meV/atom). The model is then evaluated on much larger L where xtb would cost hours-to-days but OCE finishes in seconds. This is the reg...
580d0708964eeaf293fe6760e50ae7cabe06dcf49f4e6f8a2b6a46f01bc98514
Python
8,022
176
#!/usr/bin/env python __author__ = 'heroico' import os import re import logging from metax import Person from metax import ThousandGenomesUtilities from metax import PrediXcanFormatUtilities from metax import Utilities from metax import DataSet from metax import Logging from metax import Formats from metax import Exce...
46c8150b70520978e360cb362717bfece915e623b6cdb487c16d73511a7ffcea
Python
8,024
173
#!/usr/bin/env python3 """R1, achado de 21/09/2026: 543 das 1784 celulas sao COPIAS por simetria de outra. Refaz, com e sem as copias, todos os numeros do artigo que dependem da contagem de linhas. Primeiro mostra que a versao "completo" REPRODUZ o artigo (Tabela 3, CV aleatorio, eta2); so entao le a versao "sem copia...
faff752cd8a434006c634d2ff243291a5241c1ef6f034064950d8f56e5649d73
Python
8,027
251
from __future__ import annotations import dataclasses from importlib import metadata from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import ClassVar from typing import Literal from cleo.helpers import option from poetry.core.constraints.version import Version from poetry...
cbba7c351c36fb746e522d42b8c4074fda3d5b3b82d9573b82981dfdcaaf3871
Python
8,038
261
#!/usr/bin/env python3 """ ENCODE QC log/plot to HTML converter Author: Jin Lee (leepc12@gmail.com) """ from collections import OrderedDict from base64 import b64encode def to_number(var): """Convert to number or return None """ try: if '.' in var: raise ValueError return int...
ac2048a8a6af8f0cad5fe9ce47ad6597f73cb57f68b85423c5ec51b7d1fe653b
Python
8,042
205
# -*- coding: utf-8 -*- """File discovery and measurement-management helpers.""" from pathlib import Path import pandas as pd import mne import numpy as np def automation_filenames(namesPath, dataPath, savePath, patients='all', measurements = 'all'): ''' Since EEG recordings were saved with unsystematized n...
bb0631f2210a616e45f8a311551a5ebe0536bceebe392899d17016c7a44e2466
Python
8,043
200
# Copyright 2015 Google Inc. 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 applicable law or a...
fa5e563e1209d7f9b7c709a2bcbad2cef292642a94adc90d05f4c58755a77cbe
Python
8,043
265
# -*- 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 ------------------------------------------------------------...
f8f2be96ac2853f9500ddbaa6b0b38f6bcbcb412f8be9366e53ea039515783c8
Python
8,044
182
#!/usr/bin/env python3 """Reads in a modisco h5 and prepares to scan for seqlets. In order to see where seqlets are found on the genome, we need to scan the cwms derived from modiscolite. The first step of this process is to look at the seqlets that MoDISco called for each pattern it identified, and establish cutoff v...
5c419a26238aeb18126d6cd5a7d2e4286e6c434b9f82b4bcf6ccc5d7c0570d02
Python
8,048
254
import numpy as np # 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( [ "#1f77b4", "#9edae5", "#98df8a", "#bcbd22", "#d6...
823d0098337e175abffd2f1c5c72463bfc9202859d6b556f96d5689bf9e05b81
Python
8,048
170
import utils.gpu as gpu from modelR.fs_lodet_hbb import LODet # from modelR.Fine_tuning_lodet_hbb import LODet from tensorboardX import SummaryWriter from evalR.evaluator_fs import Evaluator import argparse import os import config.cfg_lodet as cfg from utils.visualize import * import time import logging from utils.uti...
d3121884b10c344ccdbf702cdbdb6f1cd1105f7162bf2a413dabf71c5642f9de
Python
8,049
237
"""Tests for PyTorch model training and inference pipelines. Tests marked ``needs_pretrained`` are skipped when ``tests/fixtures/pretrained/`` is absent or empty. """ import os import numpy as np import pytest import torch from moove.models.CNN import CNN from moove.models.ConvMLP import ConvMLP FIXTURES_DIR = os....
2cca1feeaa006308ffc5717f45d141c58f5175698dbe992729dff7451c294c59
Python
8,052
293
""" n>2 DS Gillespie model, Preserves EXACT n=2 behaviour Author: Original by A. Reina """ import numpy as np import sys import os import copy import random DEBUG = False #################################################### # GILLESPIE STEP #################################################### def gillespieStep( ...
b9e9bda2a8abded369c678529eced60cd279faa12cf9e51b9ed59759491a0b0f
Python
8,053
239
"""Figure 3 panel A/B primitive — bimodal (WF+ISI) dataset profiles. Two datasets: A1 (a1data_remove_undef, Lakunina 2020) and S1 (juxtacellular_mouse_s1_area, Yu 2019). Both ship waveforms.csv + isi_dist.csv + labels.csv under results/benchmark/cache_datasets/. Emits a compact 2-row panel per dataset: - Mean wav...
18a6c752226f4e6d34c35651573228981b22b593171d49ca1a98fad9276459b2
Python
8,054
199
import numpy as np import pandas as pd import pytest from pgmpy.factors.discrete import DiscreteFactor from pgmpy.inference.EliminationOrder import ( ELIMINATION_HEURISTICS, H1, H2, H3, H4, H5, H6, BaseEliminationOrder, MinFill, MinNeighbors, MinWeight, WeightedMinFill, ...
8877c1e465ca6e21593835c2a755cd9706c05b9a1950b9784886eb9b83ddf5ba
Python
8,057
207
import numpy as np import matplotlib.pyplot as plt import pandas as pd from matplotlib_venn import venn3 import pingouin as pg import seaborn as sns from scipy.stats import kruskal import scikit_posthocs as sp pd.set_option("display.max_rows", None) pd.set_option("display.max_columns", None) pd.set_option("display.wid...
cfe6cb6b57890e18174af0606fb7921c610cdf8f9a533cc9ebc24ead8b01f9b8
Python
8,057
197
"""Read an NCBI gene2go GO Association File and store the data in a Python object. Annotations available from NCBI: ftp://ftp.ncbi.nih.gov/gene/DATA/gene2go.gz """ import collections as cx import sys from itertools import chain from .annoreader_base import AnnoReaderBase from .init.reader_genetogo impo...
3e11ea5ca3b1063042f4fcbda7d75776314f26d6e72b02da0af7c69893d2c7c4
Python
8,067
254
import numpy as np # 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( [ "#1f77b4", "#9edae5", "#98df8a", "#bcbd22", "#d6...
6ff0ad0fafdd93ecdc952a579df79abb7e7d5fe797c5c7e5ce8fdb047606c72f
Python
8,068
256
import numpy as np # 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( [ "#1f77b4", "#9edae5", "#98df8a", "#bcbd22", "#d6...
b4bf942013b2c5b27ce61a2cff94b516146e78eb5e30ebb7d185b6b4298815df
Python
8,069
256
import numpy as np # 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( [ "#1f77b4", "#9edae5", "#98df8a", "#bcbd22", "#d6...
f8ff2ccc5cde1a19952e9dc6245512930f5cf40b866e2f3ac762d16d52d232d9
Python
8,070
214
# Original work Copyright 2018 The Google AI Language Team Authors. # Modified work Copyright 2019 Rowan Zellers # # 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/...
598b9091dc110f5fda0f8d9a65c2792e9112a7ee3fd5715c6b8afb067f02ac0a
Python
8,071
216
"""`TokenBudgetBatchSampler`: batches bounded by padded chunk count. Peak VRAM is linear in a batch's *padded* token count, and a batch pads to its longest document. Batching by a fixed document count therefore leaves peak memory a lottery over which documents the sampler drew — the reason a run trains for a while and...
a2c5017ffc54995f03035538a2f3c322fc83ae9c9448124d46d429cae4f31a3d
Python
8,074
355
# Copyright 2015 Google Inc. 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 applicable law or a...
3e9b890f7739878aca2e761b6b8fa738e34a13dabbe78649ae0812205fee2cef
Python
8,076
212
"""Extended tests for src/processing/cluster_detection.py — targeting uncovered branches.""" from __future__ import annotations import pandas as pd from src.processing.cluster_detection import ( identify_clusters, process_cluster_window, process_data_for_clusters, ) def _make_series(values): return ...
90cf1e10f214353514ab501f73b67a6d965a961fdc6291a21c9b6223217de9de
Python
8,076
192
import argparse import logging import torch.nn as nn import fairseq.checkpoint_utils from fairseq.models import ( FairseqEncoderDecoderModel, register_model, register_model_architecture, ) from fairseq.models.transformer import TransformerDecoder from fairseq.models.roberta import model as roberta logger ...
69c60b8d5a200167dadfb66c29fb56f627666db8958082d8417c521fbac5d7ef
Python
8,078
254
"""Generate high-quality surface plots for group-level brain maps. This script searches for group-level NIfTI files (univariate and MVPA) in specified directories, projects them onto the fsaverage surface, and saves both static (PNG) and interactive (HTML) surface plots. """ import click import matplotlib.pyplot as p...
87c9225c82e8c6fd17b6cded882be89ceae5addcf42d09d353333aff04484cfd
Python
8,079
227
import sys from os import makedirs from os.path import join, dirname, realpath, exists from config_path import PROSTATE_LOG_PATH, PLOTS_PATH current_dir = dirname(dirname(realpath(__file__))) sys.path.insert(0, dirname(current_dir)) import itertools from sklearn.metrics import confusion_matrix from mpl_toolkits.axes_...
5929555edc05a95b5fef8b88bba86935fb988d03060a63cc5e5c665d3bfceb17
Python
8,084
237
from __future__ import annotations import logging import pathlib import numpy as np from dask import bag as db from dask.diagnostics import ProgressBar from .. import constants from ..timebins import timebin_dur_from_vec from .files import find_fname logger = logging.getLogger(__name__) def find_audio_fname( ...
b1866622d91683401bf16ab452eed43d8119d51f91649348e24cecd17de67b2a
Python
8,085
249
#!/usr/bin/env python import unittest import shutil import os import logging import numpy import numpy.testing import pandas from unittest.mock import patch from metax.Constants import SNP from metax.Constants import BETA from metax.Constants import ZSCORE from metax import Exceptions from M03_betas import run fro...
19fcc46715b2caa887ad288017a35e711b750752eb5324318b999b465d10f8b0
Python
8,092
213
import numpy as np def Ent_MS_Plus(x, tau, m, r): """ (RCMSE, CMSE, MSE, MSFE) = RCMS_Ent( x, tau, m, r ) inputs - x, single column time seres - tau, greatest scale factor - m, length of vectors to be compared - R, radius for accepting matches (as a proportion of the ...
8805d150252d76d851d5343a662ee69817f5d68b9ecec6f5ec63ca8d560077ae
Python
8,094
208
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import os import time import numpy as np import torch from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from torchmetrics import MeanAbsoluteError as MAE from torchmetrics import MeanMetric from am...
a5c51c916dd89e6cb59d5ee53a028ef29e5315f856624876b7c6b420bf1289be
Python
8,097
237
"""Types that are used throughout BPReveal.""" from __future__ import annotations from multiprocessing import Lock from typing import NotRequired, TypeAlias, Literal from typing import TypedDict import numpy as np import numpy.typing as npt ONEHOT_T: TypeAlias = np.uint8 """Data type for elements of a one-hot encoded ...
831780d7774e7cef4f1642ff6cf2bd2317aae315812bdb488af9df912cecd7a1
Python
8,104
198
import numpy as np from scipy.stats import percentileofscore # https://github.com/mateuszbuda/ml-stat-util def score_ci( y_true, y_pred, score_fun, n_bootstraps=2000, confidence_level=0.95, seed=None, reject_one_class_samples=True, ): """ Compute confid...
5163f83b32b846084596144c2f08b43828f33c90e4887540c1ea96ee97d38be2
Python
8,106
200
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import re from pathlib import Path import tifffile as tiff import numpy as np import pandas as pd from skimage import filters, util from skimage.measure import label as sk_label, regionprops_table from skimage.morphology import remove_small_objects, disk, white_tophat impo...
63dca44d5137e018044e713a1b7f703e4a0895346648f6c0d9adea7ffa8ee5d5
Python
8,109
222
#!/usr/bin/env python3 import argparse from pathlib import Path import polars as pl import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import matplotlib.ticker as ticker from matplotlib.patches import Patch from scipy.stats import gaussian_kde, ks_2samp, ttest_ind TISSUE_MAP = {...
fea44c9610a94e0a65f762fbf16466797eecd60ba021db4838b87dbd9b928708
Python
8,109
194
""" Rename tripwire for RNAlysis' public API. Pipeline YAML files store function *names*, and the GUI is generated from the public API by reflection - so renaming or removing a public function silently breaks every Pipeline a user exported before the rename, and silently moves or removes a GUI button. Neither is visib...
41eafae3ac0f45313f4df1520b449b7f08bb4ade57f34fcdd25782ea4102f36f
Python
8,115
231
from __future__ import annotations import os import subprocess from contextlib import contextmanager from contextlib import redirect_stdout from io import StringIO from typing import TYPE_CHECKING from build import BuildBackendException from build.env import IsolatedEnv as BaseIsolatedEnv from poetry.core.packages.d...
13285d91ee7a0b5fe8c48518a9287e2bed54a84ffb38670a32aea94bd3f09748
Python
8,117
218
import pandas as pd from omegaconf import ValueNode, OmegaConf from tqdm import tqdm import numpy as np import torch from torch.utils.data import Dataset from torch_geometric.data import Data from .data_utils import add_scaled_lattice_prop, preprocess_tensors from . import DTYPE def load_cif_data(df, primitive=True...
bd553de3bad620accfd7b0118bdc6c8a9fd2b38d56de33378f71275858b0a7c9
Python
8,117
255
################################## # # # Last modified 2017/11/08 # # # # Georgi Marinov # # # ################################## import sys import os READS_LOG_INTERVAL = 5000000 MILLION = 1000000 def...
311852be8a20943f0bc7b5959a5509cc31345e228f6be97cb868199d2bffe530
Python
8,119
198
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK """Evaluate an expression on a set of images. This is meant to quickly convert/combine one or two maps with a mathematical expression. The expression can be any valid python expression. The input list of images are loaded as numpy arrays and stored in the array 'input' an...
c9b9dd9f1f1d1f123ff9af451ebedea30078ed1d1b724a4dc40479763594476e
Python
8,119
220
from itertools import combinations from pgmpy.base._base import _CoreGraph class MAG(_CoreGraph): """ Class for representing Maximal Ancestral Graphs (MAGs). A MAG is a graph used in causal inference to represent conditional independence relations when some variables are latent (unobserved) or selec...
64985b808f9cfe5b7ce6537ee7c4a3333408ca17d36a2ea772fcab9c3308198a
Python
8,128
211
#!/usr/bin/env python # ENCODE DCC reporting module wrapper # Author: Jin Lee (leepc12@gmail.com) import base64 import re from encode_common_log_parser import get_long_keyname from encode_common import * from collections import OrderedDict def html_heading(lvl, label): html = '<h{lvl}>{label}</h{lvl}>\n' ret...
85843986e6e7afd3a111b34a49023e9cabfea330e90a26362002867263a1ecea
Python
8,132
231
""" Reusable Lightning training stack: loggers, checkpoints, Trainer kwargs, TensorBoard helper. Task packages compose their own ``LightningModule`` and phase logic; this module hosts **engineering** pieces described in README (experiment leaf cleanup, TensorBoard/W&B loggers, checkpoint filenames, tqdm/LR wiring help...
f9843563a5ac558cc3cde0993070fe130adf750bda70aa54cd7db170f61604f4
Python
8,135
209
#!/usr/bin/env python3 """ This module has the EMA class used to store a copy of the exponentially decayed model params. Typical usage of EMA class involves initializing an object using an existing model (random or from a seed model) and setting the config like ema_decay, ema_start_update which determine how the EMA ...
cd768750e636b4faf3d89420f439edabec60b94b86d9df156aebd58bcd784b84
Python
8,138
240
#!/usr/bin/env python3 -u # 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 argparse import glob from subprocess import check_call try: import faiss has_faiss = True except Imp...
25276009cb8fe915116e97c11475c9db07ec2e217a9d4342b9b414255eb85583
Python
8,139
244
import argparse from pathlib import Path import yaml from tqdm import tqdm from BLRun.genie3Runner import GENIE3Runner from BLRun.grnboost2Runner import GRNBoost2Runner from BLRun.grisliRunner import GRISLIRunner from BLRun.grnvbemRunner import GRNVBEMRunner from BLRun.jump3Runner import JUMP3Runner from BLRun.leapRun...
294fb21be1a2f096bb887cc65168dd6bbf945fd31e6ba2011d5cef21cdee7c2b
Python
8,139
188
import numpy as np import matplotlib.pyplot as plt import pandas as pd from pathlib import Path # === Setup === base_dir = Path('/egor2/egor/MovieProject2') plots_dir = base_dir / "bids_data/derivatives/group_analysis" plots_dir.mkdir(parents=True, exist_ok=True) tasks = ['backtothefuture', 'somatotopy', 'retinotopy'...
7364437e17accaf5848410b1c391a4ed8020638bb9a599a607437839ec55245f
Python
8,139
244
import pytest from pgmpy.base import ADMG, DAG from pgmpy.identification import Adjustment def test_validate_admg(): # regression: validate() on an ADMG used to raise AttributeError (is_dconnected is DAG-only) admg = ADMG( edge_list=[("X", "Y", "->"), ("Z", "X", "->"), ("Z", "Y", "->")], expo...
ee1ce4c8c07d7d57ce01231bb8d4de3bae672a9a346f71c179ef73c193860023
Python
8,139
196
# # 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 # """ This script builds a ResNet50-v1.5 Keras model with weights loaded from a separate fil...
e4d788d62a2b111e738a9a3f0b022c9b91415ad5aa79e3a36a5ca050c35a59ab
Python
8,140
205
# Copyright 2015 Google Inc. 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 applicable law or a...
bcd8ead7bbac70072a7833c9e9dfc3e6e24597e5bfd7c730119105bb5bc9a4bc
Python
8,142
204
import os, gc from pathlib import Path import pandas as pd import numpy as np from matplotlib import pyplot as plt import cv2 import torch import zarr from ultralytics import YOLO def create_df_from_paths(img_path, label_path): """ Create a dataframe of paths to tiles sliced from all ROIs in a dataset split....
d0df49251157e615bcf4da20356e00ddbf73c47070032d51010564bfb2221458
Python
8,149
202
"""Fit OCE on the GFN-FF cohesive energies, rank, and compare to xtb. Target = cohesive energy per atom (E_total - sum atom_refs) / n_atoms. Engine = GFN-FF (primary, all 100); GFN2-cluster cross-check on 5-atom cells. Model = Ridge, 5-fold CV alpha selection, Wave-1.5 features (formal charges). Three evaluation ...
af7ea4e53095266599ce2ab75cb229767d5b5616ee03eb8b8ba95a071a749047
Python
8,150
187
__authors__ = ["srhmm", "Nimish-4", "ankurankan"] import numpy as np import pandas as pd from tqdm.auto import tqdm from pgmpy import config from pgmpy.base import DAG from pgmpy.causal_discovery._base import BaseCausalDiscovery from pgmpy.structure_score import BaseStructureScore, get_scoring_method class TOPIC(Ba...
5943566e98b0915fdfa098a58922643fb819916fef7386266d6e13412d6b712e
Python
8,152
193
from functools import partial from typing import Any, Dict, Tuple import jax import jax.numpy as jnp from jax import lax from ..device_utils import DEVICE_AXIS from ..types import InitialiserParams, ModelDimensions from ..wf.base import WaveFunction from .sample_initializer import MolecularSampleInitializer from .sam...
9563df3aadccf73eb9f83cd045c50620665621e473c6e7c6d88da75e32a5b681
Python
8,158
203
from sklearn.decomposition import NMF, non_negative_factorization import matplotlib from matplotlib import pyplot as plt import cv2 import numpy as np from typing import List, Dict, Optional import math import glob from PIL import Image from matplotlib import pyplot as plt import math import tqdm import war...
0f6c343d2c7d3ba032515effaccd2df8cb1e5973aeb7ee8b27125b5c03b46367
Python
8,159
231
from __future__ import annotations import contextlib import logging from typing import TYPE_CHECKING from typing import Any import requests import requests.adapters from cachecontrol.controller import logger as cache_control_logger from poetry.core.packages.dependency import Dependency from poetry.core.packages.pac...
d37e2ade0ff3c28362dca2ae3a0c560efdece637e1ade3dbede583f4f13cb191
Python
8,164
184
#!/usr/bin/env python3 """A little utility to plot loss values during training.""" import json import re import math import datetime import argparse from matplotlib.figure import Figure import numpy as np import matplotlib.pyplot as plt from bpreveal import logUtils import bpreveal plt.rcParams["font.size"] = 8 def ...
62c3eb076efabfa1f5b14959a435f9bf2f39d344c29c2119d8e8db5b382b5d91
Python
8,169
232
""" Feature Extractor, originally inspired by VisualCheese and SpaceTorch (NeuroAI Lab) and Model Tools PytorchWrapper (DiCarlo lab) """ import math from typing import Dict, List, Optional, Union import numpy as np import torch import torch.nn as nn from torch.utils.data import DataLoader from tqdm import tqdm class...
94ef3fe37dc68f33ea46e77bb9d00a0807d3903a25fe056cb5cde8ea4e718750
Python
8,172
245
"""VTK read/write filters for FreeSurfer geometry files.""" # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause import re import numpy as np from vtk import vtkPolyData from vtk.util.vtkAlgorithm import VTKPythonAlgorithmBase from ..checks import has_only_triangle from ..decorators import...
cc3eabfaf5993f0e946930e53953ef2ef25943850e18b59d8be273617d7242f9
Python
8,172
256
from __future__ import annotations import logging import time from pathlib import Path import numpy as np import pandas as pd from src.processing.behaviour_metrics import compute_full_trace_zscore from .df_common import ( BUTTER_CUTOFF, BUTTER_ORDER, SAVGOL_COARSE, SAVGOL_FINE, butter_lowpass_fi...
936e90e8204bb618afedc7e7dce5f10f642aad36781c5cc6a766c0186768fa8b
Python
8,174
272
from __future__ import annotations import numpy as np import pandas as pd import pytest from src.excel_ops.behaviour_exporter import ( create_df_for_behaviours, process_and_bin_data, ) from src.processing.behaviour_parser import ( extract_behaviour_results, find_out_of_range_behaviour_times, read_...
d16b5358b27af670bc55d960448eb58cf4d03f6e728cd36263265673e9df89a1
Python
8,174
210
"""Phase 17 (parametric) — DFT spread campaign for C / Si / Ge. Same protocol as phase17_dft_more_reps.py but accepts --material argument. Resumable from disk cache (per-material). Usage: python pipelines/phase17_xx_dft.py --material Si python pipelines/phase17_xx_dft.py --material Ge --workers 6 python pipelin...
68d59a930a7d828a9a95f29823e3b6b80519b299e895e4a4dd258cbfaf715834
Python
8,179
224
"""Task-agnostic helpers for writing ``summary.log``.""" from __future__ import annotations from datetime import datetime from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional from omegaconf import DictConfig FormatterMap = Mapping[str, Callable[[Any], str]] SummaryAdapter = Callable...
86c44f1dfa536401f2dbaffa34c69d39545b1aa752429ca043b250b46a2a2447
Python
8,179
250
# qt_helpers.py """PyQt6 helper utilities: thread-safe invoker, custom range slider, combo helpers.""" import functools from PyQt6.QtCore import QObject, pyqtSignal, pyqtSlot, Qt from PyQt6.QtGui import QPainter, QColor, QFont, QFontMetrics from PyQt6.QtWidgets import QWidget, QApplication, QMessageBox class _Invoker...
410ece5b0d97d32c2f672881ddc330c0e88e6d8285a0004e7667f18acb5a6e8a
Python
8,180
184
import stdpopsim import dadi import numpy as np from sbi.utils import BoxUniform import torch class BaseSimulator: def __init__(self, snakemake, params_default): for key, default in params_default.items(): if key in snakemake.params.keys(): setattr(self, key, snakemake.params[ke...
ebf8da70e71a365090e3472e0eaf01a59dffd8f1f581d1fa2c80d878c5a0f7ec
Python
8,181
189
__author__ = 'heroico' import logging import os import gzip from . import Utilities from . import DataSetSNP class PDTF: """Format of PrediXcan dosage""" CHR = 0 RSID = 1 POSITION = 2 ALLELE_0 = 3 ALLELE_1 = 4 COLUMN_5 = 5 FIRST_DATA_COLUMN = 6 class PrediXcanFormatDosageLoader(objec...
67dfd5053e50e2029be9837626fa2537b7410cea4ce3d0e480fafe59f8e70ae5
Python
8,184
238
import os import pickle import numpy as np import pytest import torch from scvi.data import synthetic_iid from scvi.model import PEAKVI from scvi.utils import attrdict def test_saving_and_loading(save_path): def legacy_save( model, dir_path, prefix=None, overwrite=False, ...
1e7b8ddfd5e3bf1e3b761e203f2c7f109614e0e55e291aa41bf34e42192d3502
Python
8,186
191
import numpy as np import pandas as pd import nibabel as nb import matplotlib.pyplot as plt import matplotlib as mpl import potpourri3d as pp3d from matplotlib_surface_plotting import plot_surf from brainspace.null_models import SpinPermutations from sklearn.linear_model import LinearRegression from sklearn.metrics imp...
7fa4f06e6e470bdf865074f06b71a7a6a6bb67d20c376b79ebc52ec40fb8d548
Python
8,186
284
# -*- coding: utf-8 -*- """ Created on Thu Mar 6 14:10:09 2025 @author: hanna """ """ [Figure 4C, 4D] changes in preferred of individual BCI neurons - summary of all sessions """ #%% import os import pickle import numpy as np import pandas as pd from tqdm import tqdm import seaborn as sb import matplotlib as...
65b8b8d5dc986956315d85d78b15dabae402aaf71d0d0ed72a764d74517d06eb
Python
8,188
222
import logging import numpy as np from scipy.ndimage import binary_dilation, generate_binary_structure, binary_fill_holes from mdt.utils import load_brain_mask from mdt.protocols import load_protocol from mdt.lib.nifti import load_nifti, write_nifti import mot.configuration from scipy.ndimage.filters import median_filt...
354cb3c9e659d2a490b50b0591c30d2d70db89f45d5b0b64c42a49789a746078
Python
8,191
218
"""Figure 3 — bimodal (WF+ISI) classification benchmark on A1 and S1. Loads cached 5-fold predictions under results/benchmark/celltype_cache/ and computes per-fold balanced accuracy and macro F1 for: HIPPIE-bimodal, VAE-bimodal, PhysMAP (WNN), PCA-WF, PCA-ISI. Emits one bar chart per dataset plus a tidy CSV: ...
df091986d95dc847d2f84994780e935a662cdf23cd7f8589e16e95f95aa39172
Python
8,191
197
from __future__ import annotations from collections import defaultdict from typing import TYPE_CHECKING from typing import Any from poetry.utils.extras import get_extra_package_names if TYPE_CHECKING: from collections.abc import Mapping from packaging.utils import NormalizedName from poetry.core.packag...
f9c9f5a44e201a12956a1c684807c50d2023b4545bbd65d442f0edf2fb7e1729
Python
8,191
201
""" This module contains methods used for converting experiment data into matlab data. It is not used and not supported in NoSeMaze but still saved here for archive purpose. """ """ Copyright (c) 2019, 2022 [copyright holders here] This file is part of NoSeMaze. NoSeMaze is free software: you can redistribute it and...
0ca57ed0fb39dad544a299827ffdbcb93458885e8fd866259595d73424ab5d44
Python
8,196
218
"""tests for vak.eval.frame_classification module""" import pytest import vak.config import vak.eval.frame_classification # written as separate function so we can re-use in tests/unit/test_cli/test_eval.py def assert_eval_saves_one_csv(model_name, output_dir): eval_csv = sorted(output_dir.glob(f"eval_{model_name...
b4666cc08cc72843201c3409110e6ecc53e9c596411d00389793ac5a04b97640
Python
8,199
185
# -*- coding: utf-8 -*- ''' load user data and process it to a sentence ''' import pandas as pd import os from Bio import SeqIO class DataProcesser(object): # seq2kmer def seq2kmer(self, seq, k): """ Convert original sequence to kmers Arguments: seq -- str, original sequence....
2c1b1b9da9018b41f104de3a08251dfc8752234848dbeb4fdea10cbde59601da
Python
8,201
264
from __future__ import annotations import re import textwrap from pathlib import Path from typing import TYPE_CHECKING from typing import ClassVar import pytest from cleo.io.buffered_io import BufferedIO from cleo.io.inputs.string_input import StringInput from cleo.testers.application_tester import ApplicationTeste...
9f744f5652f8d70b8dab8332d1c7a91b1767de85e7785ac8942ed78667da2fe6
Python
8,203
258
import numpy as np # 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( [ "#1f77b4", "#9edae5", "#98df8a", "#bcbd22", "#d6...
c32709a578e8a33a22491293056242521acc4d01bce9cbcd4c8d192a57ed485d
Python
8,203
188
#! /usr/bin/env python """ This module contains high level code to parse GWAS/GWAMA summary statistics files and parse them into a standard format. You can use it as stand alone tool to align it to Predictdb Models or jus tconvert the format, or it can be called from another script to load the data into memory TODO: ...
bdb98de631956c7397003e26ff7ccd30edde80ed04310bb916425dc61d5b0a48
Python
8,204
208
import torch from torch import nn from contextpath import build_contextpath import warnings warnings.filterwarnings(action='ignore') class ConvBlock(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=2, ...
489d85b54b9de59688cd36cc4a131f51292a951944f93a4202d37519224b5110
Python
8,206
254
__author__ = 'heroico' import os import io import json import re import logging import gzip from . import Exceptions import pandas import numpy VALID_ALLELES = ["A", "T", "C", "G"] def hapName(name): return name + ".hap.gz" def legendName(name): return name + ".legend.gz" def dosageName(name): return n...
b669660121b61aa81956f3bbdc8c0f0688f4498755de9dcfbb4387be98108e88
Python
8,206
236
# 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. """isort:skip_file""" import argparse import importlib import os from contextlib import ExitStack from fairseq.dataclass import FairseqDatac...
2d2c37f8d7395d7b58f84b69167b6feb47596934232ca1a39c2231ad9ac4bb91
Python
8,208
236
import torch import numpy as np class LocalAxis: def to_tensor(self,x): if torch.is_tensor(x): return x else: return torch.tensor(x) def __init__(self,x0,y0,beta=0.0): self.x0 = self.to_tensor(x0) self.y0 = self.to_tensor(y0) self.beta = self.to...
5ba14b76034e310ca275c2eb39686a9db31613f3f86009713cfa102ae13fe71b
Python
8,209
194
"""Tasks for go2obj dicts.""" __copyright__ = "Copyright (C) 2016-present, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" import collections as cx from goatools.godag.go_tasks import get_go2ancestors from goatools.godag.go_tasks import get_go2descendants # ----------------------------...
7217aac5e83cfc7e68e5ae1ae77c933d11f82c1bd0e67242810f5008a12b4b39
Python
8,213
215
# modified by https://github.com/JinmiaoChenLab/scTM/blob/main/sctm/analysis.py import gseapy as gp import pandas as pd from multiprocessing import Pool from joblib import Parallel, delayed def get_enrichr_geneset(organism="Human"): avail_organisms = ["Human", "Mouse", "Yeast", "Fly", "Fish", "Worm"] i...
5b5a94e749ebca9b1d4e09a527a292b86a088e233f796cf1c82cdc3908d39958
Python
8,215
259
import torch import torch.nn as nn import torch.distributions as dist import torch.nn.functional as F from npyx.c4.dl_utils import BaseVAE class VAEEncoder(nn.Module): # Encoder network for a VAE, support outputting the pre-projection output def __init__(self, encoder, d_latent): super().__init__() ...
ed9be8b4773be3be2821c70f2d8229244642fb2b415e68cb8ee00733aa6ebcb2
Python
8,216
220
# -*- coding: utf-8 -*- """ @Time:Created on 2019/8/20 20:44 @author: LiFan Chen @Filename: Radam.py @Software: PyCharm """ import math import torch from torch.optim.optimizer import Optimizer #, required class RAdam(Optimizer): def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weight_decay=0): ...