sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
4eb25ea785f853ddf02076a0968c57e4ca43c894acd97e130c34c08cdca9df16
Python
10,620
269
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. from collections import OrderedDic...
b97109461e8fc587e376c629ea7b7217e4ef289e1a8636db296df639a2adc810
Python
10,623
301
# Misc utils to deal with summary stat files. # Some parts of the code in this file originates from https://github.com/bulik/ldsc/, # which is licensed under GNU General Public License v3.0 # See https://github.com/bulik/ldsc/blob/master/LICENSE for complete license. import sys, os, re, logging, datetime import numpy ...
f19bc56f5ef8c670a5857487699b8eb9b4b338e10caefabd29fa0bd7e09e63f8
Python
10,632
451
#!/usr/bin/env python # -*- coding: utf-8 -*- import csv from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import seaborn as sns import torch from scipy.stats import pearsonr from sklearn.metrics import mean_absolute_error, mean_squared_error from tor...
edf33c34bbfe2592cb2a668fd21b12b2ca1df1a8928bfbb4a489a4c367b54954
Python
10,634
295
import os import numpy as np import lmdb import pickle as pkl from Bio import SwissProt from goatools.obo_parser import GODag, GOTerm NODE_TYPE_MAPPING = { 'biological_process': 'Process', 'molecular_function': 'Function', 'cellular_component': 'Component' } def create_goa_triplet(fin_path, fout_path, p...
b3d624b7434ecd675a52d80e3f25b3e9e2abc5eb89a70db0491637920d564ffa
Python
10,641
357
""" * author: Abolfazl Danayi * created on 01-01-2026-07h-03m * copyright 2026 """ GLOBAL_MUTE = True import typing as T import numpy as np import keras import pickle import os DEFAULT_Projects_Dir = "./Output/Models" def log(msg: str): print(msg, flush=True) def imp_log(msg: str): print("**** IMPORTANT ***...
706852ac8844c87110fa07311607adad845d3727f480826c4c7d9ed706182379
Python
10,649
309
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
4b2516c0a5106b20ecd41d48904f5f682d16c3b4be95313cde52ba4c77f9d471
Python
10,651
255
#!/usr/bin/env python import argparse import csv import sys import re import os def argsParse(): """ Parsing input & outputs CSV files. Also takes in a boolean to indicate if the raw reads are single-end or paired-end """ parser = argparse.ArgumentParser() parser.add_argument("-d", "--design",...
5a20497f1acc6965b844449db062676fbc315130d2051d87ab454125b7777205
Python
10,656
196
#04 threehead import sys sys.path.append("..") from modelR.backbones.mobilenetv2 import MobilenetV2 from modelR.backbones.mobilenetv3 import MobileNetV3 # from modelR.necks.conv_csa_drf_fpn_hbb import Conv_CSA_DRF_FPN,FC2_CSA_DRF_FPN,Cat_Conv_CSA_DRF_FPN,M_CSA_DRF_FPN from modelR.necks.Three_Head import FC2_CSA...
ef1f0080b906cfd5f9e0bddc00a0337e8626d991e824778557fddd61b97d4eb6
Python
10,658
211
import os import argparse import torch import numpy as np import matplotlib.pyplot as plt from matplotlib import colors as mpl_colors # Renamed to avoid conflict from src.utils import load_pretrained_ernierna, prepare_input_for_ernierna # Assuming creatmat is in prepare_input from src.downstream_heads.closeness_model ...
3d07d9de1dea393d2ae20d6cbaed7e39c313a9a5cd8afe4930a96e2937ffac76
Python
10,666
290
import pandas #likely to go away for a streaming approach import numpy import logging import gzip import scipy.stats as stats from . import GWASSpecialHandling from .. import Exceptions from ..Constants import SNP from ..Constants import EFFECT_ALLELE from ..Constants import NON_EFFECT_ALLELE from ..Constants impor...
a9ad3418ea00e1c5f0a38ba906ef9cd666ff362f6758e667071057b2113f0334
Python
10,666
270
"""End-to-end characterisation of OCE forces driving an ASE optimiser. This script answers the operational question that closes Phase 1 of the JCTC roadmap: With a *real* (production) ridge-fit OCEModel and the analytic gradients now in :mod:`oce.forces`, can the v1.0.0 basis act as a useful force field f...
89118b7733cfdbb00c4ab67de99a9893dcde2a6178a2b2e35ea84d470eac4934
Python
10,672
317
# 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 math import torch import torch.nn as nn import torch.nn.functional as F from fairseq.modules.fairseq_dropout import FairseqDropout ...
45655332b3789f36b4b14071eb837fca696811bfefcb7c15b977b41ff3b5f50c
Python
10,674
351
#!/usr/bin/env python3 """ Utilities for running MSMC2 on tree sequences. MSMC2 estimates effective population size trajectories from phased genotype data. """ import subprocess import numpy as np import pandas as pd import tempfile import os from pathlib import Path # Default MSMC2 binary location MSMC2_DEFAULT = ...
2df02c0c446fa68761bac031c1b38c3f75284e61040ba34a4be6a0b39b0f021a
Python
10,677
250
import unittest from unittest.mock import patch from pyecharts import options as opts from pyecharts.charts import Line, Bar class TestChartClass(unittest.TestCase): @patch("pyecharts.render.engine.write_utf8_html_file") def test_chart_dark_mode(self, fake_writer): x_data = ["周一", "周二", "周三", "周四", ...
935caad437cf6cb6ab6a5df497be0814a18c50c192caa2cf291c02f32797f53c
Python
10,681
231
#!/usr/bin/env python3 """ ═══════════════════════════════════════════════════════════════════════════════ EIF2S1 R3 REVISION — PIPELINE 3: DEPMAP CO-DEPENDENCY VALIDATION ═══════════════════════════════════════════════════════════════════════════════ Author: Drake H. Harbert (D.H.H.) | ORCID: 0009-0007-7740-3616 Affi...
df0dfc45a02c2dac56957c37165ad2d082138a8f8e1ae2867f3298b932d29471
Python
10,684
305
# 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 json import logging from typing import Dict import numpy as np import torch import torch.nn.functional as F from torch import nn from...
a7f5bfd4cc14301fbf009c21216347c0823788acd93d5e6ce5086845d8f2bc4d
Python
10,700
288
import numpy as np from collections import namedtuple # Define MATLAB-style color matrices red_colors = np.array([ [0.8627, 0.0784, 0.2353], # Crimson [1.0000, 0.1412, 0.0000], # Scarlet [0.7255, 0.0000, 0.0000], # Cherry [0.5020, 0.0000, 0.1255], # Burgundy [0.5020, 0.0000, 0.0000], # Maroon ...
6da294fc3c99db05a2225a6b5595be8d15ab8e0afbe855bb736c956e5a663f69
Python
10,705
273
# 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 logging from collections import defaultdict from dataclasses import dataclass, field from typing import Dict, Any, List, Optional impo...
257a234151f46edfb069ca9c65afd0660f0e5930bce18bc69d16a9dbb8a93a22
Python
10,710
343
"""The taxid bridge resolves the corpus's names as written. `other_organism_forms` also yields a genus abbreviation, because that is what running text says; an index of NCBI's names is not running text. An abbreviation NCBI lists under an unrelated taxon would make an entity whose binomial resolved cleanly look contes...
d8ce150d6af1dd8cec5e1be570f4461cee287b2325a39d925926f716bd551af3
Python
10,710
309
""" Compute linear CKA between two TDANN (spacetorch) models with different spatial weights on NSD stimuli. Supports subsampling units to keep covariance sizes manageable. """ import argparse from pathlib import Path import numpy as np import torch from spacestream.core.paths import RESULTS_PATH from spacestream.data...
226803a4c6c5f9b1384317246ac909fd43a132f3ff67e2db176c64ad34d662f3
Python
10,712
221
"""Page 10: Efficiency & Progress.""" 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("Runtime & Efficiency") st.markdown( "How lon...
e54e9721e95eb0c5514a0f86f8c45c8aa463abe68eb3bfc6e16690604fc08d06
Python
10,718
258
#!/usr/bin/env python3 """Minimal HIPPIE trainer for the CVAE-only experiment harness. Trains MultiModalCVAE on one or more datasets' CSVs and saves a checkpoint for the G1–G7 experiments. Multi-dataset training is what makes conditioning embeddings carry real information (single-source = degenerate conditioning = pos...
5976b30bf4533525573a6d7bcf5479335646e4861fc965fdad2125ba02147115
Python
10,728
309
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.constraints.version import Version from poetry.repositories import Repository from poetry.repositories import RepositoryPool from poetry.repositories.exceptions import PackageNotFoundError from poetry.repositories.leg...
edad5802572b0100c4459f1c49aca8a2d881ca2f128b243abc72b2b2fba1d570
Python
10,729
235
"""Reproducibility harness for the lazy-evaluation work in ``filtering.Filter`` (epic #66, issue #139). Converting eager operations to fused lazy query plans must not change results (hard invariant #5). CSV reference files can't prove that -- serializing to text loses float precision, which is why the older tests fall...
84c06f3529e214332737c1720e3c4ea97fc77ffe4973ea284110463a42e5b4da
Python
10,733
352
""" 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 math import torch from .atom_update_block import AtomUpdateBlock from .base_layers import Dense, ResidualLayer from .efficient impor...
cceda95bf1cb190c3b3b8a4cc4203540d975642352e7f560e0015e77fd4a5d44
Python
10,738
269
#!/usr/bin/env python3 """ Generate B0 variants by adjusting spherical harmonic coefficients. This script takes B0_registration_outputs_sweep files and generates variants by: 1. Extracting SH coefficients from b0_fitted_2d 2. Adjusting only high-order coefficients (order >= 3) 3. Keeping low-order coefficients (order...
463f487b4c425d3dbb727c0dc8c77e51938920ded2d046f0efc9bf447cf08ebb
Python
10,740
322
#!/usr/bin/env python3 __all__ = ["_GraphRolesMixin"] class _GraphRolesMixin: """Mixin class for handling roles in a causal graph.""" def get_role(self, role: str): """Return list of nodes in graph G with a specific role. Parameters ---------- role : str The role ...
1ec35c6068471364f4a301e12752b1bdea0a18b0e9abc416410a65d6804e12d7
Python
10,741
262
"""Prints a Python sections file.""" import sys from ..wr_tbl import prt_txt from .tasks import SummarySec2dHdrGos __copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" class WrSectionsBase(object): """Tasks for writing a sections file.""" d...
b5866d298cfdd011a934a3974d91625ee0fc53945f7bba6189404bcaf551e170
Python
10,745
255
import os import argparse import requests import json import re import threading from rich.console import Console from rich.progress import Progress, SpinnerColumn, BarColumn, TextColumn from rich.live import Live from rich.table import Table from config.PLIPProcessor import PLIPProcessor from config.PDBInteractionExtr...
320170f9b5c2545e3ca1e5f96de29d0c323ddcfe54854e7b06a80dea8c18e159
Python
10,755
323
from lifelines.utils import concordance_index import numpy as np from sklearn.model_selection import StratifiedKFold from sklearn.preprocessing import StandardScaler from keras.models import Sequential from keras.layers import Dense from keras.regularizers import l1, l2 #from keras.optimizers import adam_v2, gradient_d...
6e6f9b9fe2b2d37795665ea4f32b756e695f572faad0ae2dbe229b3892c7f12f
Python
10,757
272
import numpy import numpy.testing import pandas import unittest from metax import Exceptions from metax.gwas import GWAS from metax.gwas import Utilities as GWASUtilities from metax.Constants import SNP from metax.Constants import EFFECT_ALLELE from metax.Constants import NON_EFFECT_ALLELE from metax.Constants impo...
56f247aa302173d0d5e071ac49ce65cd711bdd3118af98fa79c432e130f848cf
Python
10,759
271
""" HVM Fitter class for fitting linear readout layer for the HVM dataset (highly inspired by/credit to: https://github.com/neuroailab/VisualCheese) """ import os import sys import numpy as np from scipy.stats import pearsonr from sklearn.linear_model import Ridge from sklearn.model_selection import GridSearchCV fro...
efee17bf6390dea61667192230951ec7f5fb912b9306bd932b076c4f26ad9b7f
Python
10,760
186
import logging from typing import List, Optional, Tuple import lightning as L import torch from torch import Tensor, nn from aestetik.data_modules.data_module import AESTETIKDataModule from aestetik.metrics.loss_function import compute_loss from aestetik.models.model import AE logger = logging.getLogger(__name__) cl...
cb1ad3aa0ff16814e28ecfde5ef72773caf074b5b34a2790367b24caa94e627c
Python
10,763
253
from mdt.model_building.model_functions import SimpleModelCLFunction, WeightType, ModelCLFunction from mdt.model_building.parameters import FreeParameter, DataCacheParameter, NoiseStdInputParameter from mot.lib.cl_function import SimpleCLFunction from mot.lib.kernel_data import Struct, PrivateMemory, LocalMemory __aut...
bfb0ba38b1e9f6916d3241f768be6ac8d4e0620624006a9c974a7715c0d46cd2
Python
10,764
309
import copy from collections import defaultdict from copy import deepcopy import pandas as pd from simulation_encoder.logger import Logger from simulation_encoder.loaders.loader import Loader from simulation_encoder.loaders.arcade_loader import ARCADELoader from simulation_encoder.loaders.gastruloid_loader import Gast...
ab8e6a1af4e9fe57e45b6d2a2c1ef7cb04e09c66e378f7ef3b4ef758c95a1b6c
Python
10,775
339
import numpy as np import pandas as pd import pytest from sklearn.ensemble import RandomForestRegressor from sklearn.linear_model import LinearRegression from sklearn.utils.estimator_checks import parametrize_with_checks from pgmpy.base import DAG from pgmpy.prediction.NaiveIVRegressor import NaiveIVRegressor @pytes...
3fbc20adb066e083eb8f06c0b258b8c9fbcc6dad689f25a9b3328587f51d4ab1
Python
10,776
343
import math import os import numpy as np import pandas as pd import pytest from anndata import AnnData from numpy.testing import assert_raises from scipy import sparse from scvi.external import SysVI def mock_adata(cells_ratio: float = 1): """Mock adata for testing.""" n_cells_base = 200 n_cells = int(n...
a127f57bcd1c75d1448535358ab854aa7a41dec5ca75f0da673cd580cc3ae7ee
Python
10,776
268
import scipy from msi_visual.normalization import spatial_total_ion_count, total_ion_count, median_ion from sklearn.metrics.pairwise import euclidean_distances, cosine_similarity from scipy.stats import entropy import random import time import sys import numpy as np import matplotlib from PIL import Image imp...
23ccdbb2b3be9ad734cabb6ff2b0cdc11545e86e3f72cc3d593a64e19a67a00a
Python
10,777
265
"""Phase 14 — extend 3D universality test to BCC, FCC, and diamond cubic. Adds 3 more 3D Bravais lattices to phase 13 (which had only simple cubic): bcc_3d z=8 p_c = 0.24596 (Lorenz & Ziff 1998) fcc_3d z=12 p_c = 0.19923 (Lorenz & Ziff 1998) diamond_3d z=4 p_c = 0.43003 (van der Marck 1998...
bbc3f4955b31b07ff0f49d50362478b18baee57c9d03505e1afe510f683baf45
Python
10,777
297
"""HIPPIE inference API — latent embeddings, UMAP projection, and HDBSCAN clustering.""" from __future__ import annotations from pathlib import Path from typing import Iterable, Optional, Tuple, Union import numpy as np import torch # ---------------------------------------------------------------------- # KNN k-s...
39ffa196aa86fe000d8d6f668db0d240f714eb7808d93e8b2d926f0ca81698ba
Python
10,798
252
import numbers from collections.abc import Hashable from typing import Any import numpy as np import pandas as pd from joblib import Parallel, delayed from pgmpy.base import DAG from pgmpy.estimators import ParameterEstimator from pgmpy.factors.discrete import TabularCPD from pgmpy.models import DiscreteBayesianNetwo...
449b0cb8ae19471c4a608736941f6ae8ef93b69cd81dbcdd6fb0dcb97a6ce234
Python
10,799
256
""" sim.py ====== Driven Brunel (2000) network simulation with Markov input spike trains. The recurrent network implementation is based on the NEST example: "Random balanced network (alpha synapses) connected with NEST" https://nest-simulator.readthedocs.io/en/stable/auto_examples/brunel_alpha_nest.html """ i...
dd0a514dc8c5334d89eeef60d61aa2fc3224e21c905e9096abddf6260cc62c90
Python
10,799
263
""" Slice Areas Clustering Module. This module provides functionality for clustering the slice areas of chromatophores. Each chromatophore is divided into a number of slices so that the underlying data are represented by time series for each slice (with overall shape: n_frames x n_chromatophores x n_slices). The...
27a40feb2248b97a8caedfac5132e9f97dcf53707bd7ea3565ac6a6aae86f1a9
Python
10,803
211
import logging import warnings import community import networkx as nx import numpy as np import scipy.sparse as sparse from umap import UMAP from sklearn.manifold import TSNE from numba import NumbaPerformanceWarning, NumbaPendingDeprecationWarning from scipy.sparse import SparseEfficiencyWarning from pynndescent impo...
4bd215e0742f44b1a11c072bc0feb0d073a63ab21b360ea94bcd5df8ae63fc69
Python
10,804
369
import numpy as np from scipy.signal import correlate, find_peaks, cwt, ricker from sklearn.ensemble import RandomForestClassifier from scipy.interpolate import griddata from scipy.ndimage.filters import gaussian_filter1d from ...common.utils import printProgressBar import multiprocessing from functools import part...
74da5615c15eafebdf1d0d8eb31c18e505b31926264e5c2d549c3d0787be6d7b
Python
10,809
192
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI/HardwareWindowEdited.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow: Q...
55c9f9fce7453aa115d9632e7dca451f65b1c27846fd85d599551310c2940836
Python
10,831
463
import csv from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import seaborn as sns import torch from scipy.stats import pearsonr from sklearn.metrics import mean_absolute_error, mean_squared_error from torch_geometric.loader import DataLoader from mod...
91c725c0c158a845707ba19b9241ed06795a2a0ddcf9bf4f87196b89361550b3
Python
10,833
246
# ############################################################################## # GPLv3 LICENSE INFO # # # # Copyright (C) 2020 Mario S. Valdés-Tresanco and Mario E. Valdés-Tresanco ...
998203e62dd0d8f591fc9e404a54930427218d8cf17d3f4cfbfd94dbdba37664
Python
10,833
287
#!/usr/bin/env python """ Created on Mon Mar 23 16:45:00 2020 This file create functions used for demo_pipeline_voltage_imaging.py @author: caichangjia """ #%% from IPython import get_ipython import matplotlib.pyplot as plt from matplotlib.widgets import Slider import numpy as np import os import tensorflow as tf impo...
12b3c5890c41641571a52ba1122ff2ad6dffbe1f67365f1d0047215883624a30
Python
10,837
327
# 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 logging import os from dataclasses import dataclass, field import numpy as np from omegaconf import II, MISSING, OmegaConf from fairs...
9be9a3eb6da361957da9d58bbfd54ee9ddb784e17b56f53397fa719ef473a99f
Python
10,837
237
import numpy as np import numpy.testing as np_test import pytest from scipy.special import softmax from pgmpy.factors.discrete import TabularCPD from pgmpy.inference import DBNInference, VariableElimination from pgmpy.models import DiscreteBayesianNetwork, DynamicBayesianNetwork # The sample Dynamic Bayesian Network ...
a333a989a133334160c7bdc29b6da2c6e3139c8e816b3ffd61c14454376ad7e7
Python
10,838
427
"""Typed public command-line interface for maintained GPN workflows.""" from __future__ import annotations import importlib.metadata import sys from collections.abc import Sequence from pathlib import Path from typing import Annotated from cyclopts import App, Parameter from transformers import TrainingArguments fr...
688b3eee2d053cd273f3eeebc1a0adca13f7c269f8a5f15f686337e8c77a5fea
Python
10,839
337
#!/usr/bin/env python """Put the compiled and eager arms' epoch timings side by side. Medians over repeats rather than one pair of numbers: the arms were interleaved because a card throttles under load, and a mean would hand a single thermal outlier the answer. The first epoch is tabulated apart from the rest because ...
71a42ba09526185098489dca0381ec2124b27ed9871399ce9f1c4100a3fb3e5f
Python
10,841
304
"""`prefetch_layer_boundary_reads`: cross-batch overlap, and no cross-talk. `_resolve_layer_boundary_cached` (see `test_layer_boundary_overlap.py`) already overlaps one item's store read with the previous item's replay *within* a batch. `prefetch_layer_boundary_reads` extends that across batches: it submits batch `k +...
e7e49aae532733a58388069081f42c4f7a7ed3b38b9aa963269821b7431cd929
Python
10,852
327
#!/usr/bin/env python # -*- coding: utf-8 -*- """Applies a previously trained RdF model to a properties.csv file""" import csv import shutil from typing import List, Tuple, Literal from pathlib import Path import warnings import numpy as np import pandas as pd import matplotlib matplotlib.use("Qt5Agg") import matp...
d58da9a4d3d7d417954161b6175f4efacce896071e16f616e9387dc23bfc63cd
Python
10,854
198
# coding=utf-8 # Copyright 2018 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 required by applicable...
0564e663df8b71941d6d07abc18cf8b5ff507800ccd8fae0cdf167becb4603e1
Python
10,855
199
# coding=utf-8 # Copyright 2018 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 required by applicable...
573a38c55aa31098dd25d19f10a76af38b0678c8043407eccf5ea9b3a6ef753d
Python
10,861
336
#!/usr/bin/env python3 import warnings from typing import Callable, Union import matplotlib.pyplot as plt import numpy as np import numpy.typing as npt from scipy import sparse from scipy.sparse.linalg import eigs from .funcs import rect_PSP from .matrix import transition_matrix PSPFunc = Callable[[int, int, int], ...
0efbc620e98ddc2dcfcef2eaa5e4847da0ad0eadf4ef97dc3934f6d842ab73e4
Python
10,864
346
# 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...
aff7d707aedd22bc6972115a4124a8fb7a103dad39f13acdcaad786a3c2438c6
Python
10,876
268
#!/usr/bin/env python3 """ Author: Ken Chen Email: chenkenbio@gmail.com """ import argparse from tqdm import tqdm import pickle import os os.environ["TOKENIZERS_PARALLELISM"] = "false" import json import sys import shutil import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch ...
a6ac82c69792a5db4b02b302ce368a0853eba7d4c5b8d64d8e8e97bdec04a577
Python
10,882
281
from functools import partial import haiku as hk import jax import jax.numpy as jnp import numpy as np import pytest from jax import random from jax.experimental import enable_x64 from oneqmc import Molecule from oneqmc.types import ( ElectronConfiguration, ModelDimensions, MolecularConfiguration, Nuc...
ce4cb0d1cb7c30436a2a1b4c05f195c212792f94a52fc6342e740f4c4ad54fbd
Python
10,883
463
import csv from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import seaborn as sns import torch from scipy.stats import pearsonr from sklearn.metrics import mean_absolute_error, mean_squared_error from torch_geometric.loader import DataLoader from mod...
913dde5d84980a48e18a2c52a346497317b4529266f5cbefd0ba2a24354bf69d
Python
10,887
311
""" Tests for the sklearn-compatible GES class in pgmpy.causal_discovery. """ import numpy as np import pandas as pd import pytest from skbase.utils.dependencies import _check_soft_dependencies from sklearn.utils.estimator_checks import parametrize_with_checks from pgmpy.base import PDAG from pgmpy.causal_discovery i...
b8223d0e87791d12a114d91f9e73b70cdaf03652ca32e4525b6ad8828142765f
Python
10,888
293
# 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 from . import Dictionary, FairseqDataset, data_utils def collate( samples, pad_idx, eos_idx, ...
c798c25e856add3e1f1c79baa804460d7cab09801913611666f653d0a350e4d9
Python
10,890
316
from __future__ import annotations import os from pathlib import Path from types import SimpleNamespace import matplotlib.image as mpimg import numpy as np import pandas as pd import pytest from matplotlib.figure import Figure from src.features.behaviour_alignment.services.plot_service import save_image from src.gui...
4ee84c3ccc3659ca5c0cb1e5f0206b1ed3d8352a27f1f496aa74efb2bcac9914
Python
10,898
266
import numpy as np import matplotlib.pyplot as plt import scipy as scipy from scipy.signal import convolve import collections def find_ISI(spike_times1): #spike_times = template_times_list[template_ID] intervals = np.diff(spike_times1) return intervals def find_cISI(spike_times1, spike_times2, ...
5a02479ff970c9f10d66540814ddf3441b1dbe3069ee9499724e96092112b2ad
Python
10,898
313
# 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 json class Metric(object): def __init__(self, config, metric_names): self.metric_names = metric_names ...
d9afe0094f757782082dc69ce8c93c1e053beb0266101d4de0e61837d8e69b55
Python
10,900
268
# 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 math import torch import torch.optim from . import LegacyFairseqOptimizer, register_optimizer @register_optimizer("adafactor") clas...
4170dce01978ab1daaf0f735d32bc96314440538daf21b54348e7178bf8affe2
Python
10,901
316
from __future__ import annotations import warnings import torch import torch.nn.functional as F from torch.distributions import Distribution, LogNormal, Normal, constraints from torch.distributions.utils import ( broadcast_all, lazy_property, logits_to_probs, probs_to_logits, ) from scvi import setti...
46c3d09e40bcd22b32c52c257200398db52a1c75b8535d8f261867df661edade
Python
10,904
198
import contextlib import gzip import io import json from pathlib import Path import sys import tempfile import unittest from unittest.mock import patch import nibabel as nib import numpy as np sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import trainref3d_backend as backend from trainref3d_fixtures im...
94378487a84f0dd607f3bbee04ceb6b213d830b979458c18a231216e70b63bf4
Python
10,908
290
"""Every tracked metric has to say what its y-axis measures. The glossary is the only record of a metric's unit — MLflow charts a key and nothing else — so what these tests protect is its agreement with the keys the code actually emits. """ import ast import importlib from pathlib import Path import d3text.models im...
ba88c59cf165af6e1bf1533f874e61440758bf474559cc080f91d31410279f90
Python
10,908
288
import os import json from typing import Dict, List, Optional, Tuple, Union import numpy as np import dataclasses from dataclasses import dataclass import tqdm import torch import torch.nn as nn from torch.utils.data import DataLoader, Dataset from transformers import BertModel, BertTokenizer from transformers import P...
20324417d6fce345085fb6c19f4f607d41d49902078d06bc4920c7c89b70d077
Python
10,910
344
""" 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/layers/interaction_block.py. """ import math import torch from mattergen.common.gemnet.layers.atom_upd...
ca1c331128fc885356c2e72d6e3f48d813a2fd9b5b982f6fe1ffbbfb300f342e
Python
10,917
266
#!/usr/bin/env python3 """ Make UpSet plots and Venn diagrams comparing transcripts across SFARI, Patowary, Joglekar, and ENCODE4 studies. Transcripts are compared by intron chain: multi-exon : 'chrom:strand:e1end-e2start,e2end-e3start,...' mono-exon : 'chrom:strand:start-end:mono' ISM filtering (Patowary and Jo...
b59159d4ad15b59b4065033aa02a922b22fc6272f71f0708716e1369643e51e7
Python
10,918
297
""" hippie-wf3dacg Dataset =================== Loads paired (waveform, spike_times) data and converts spike_times → 3D ACG on the fly (or from a precomputed cache), using NEMO's feature conventions: waveform — 90-sample L∞-normalised peak-channel waveform (float32) acg — (1, 10, 101) 3D autocorrelogram ten...
b31e7fcccd0a9c953f0b5f84f468250949210223d99bd75b49fcbdf6f0f88220
Python
10,919
310
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.incremental_decoding_utils import wi...
dc361a9db7fe02ba1324dc20623a57dce4f1460cb5aab5b230627ab09dbd4932
Python
10,919
261
# _*_ coding: UTF-8 _*_ # Version information START -------------------------------------------------- VERSION_INFO = \ """ Author: ZHANG YUBO Version-01: 2025-03 Inferring evolutionary relationship from multiple sequence alignment for three population """ # Version information END -----------...
79536d5d34c54f45fc2c220627a43bc73c64cee7e4ed89d761c9f849c15768a9
Python
10,920
270
import sys, pysam, time, os, copy, argparse, subprocess, random, re, datetime import pysam 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...
04291b95fde268fea796399e7f7db19a1958b181657a8664385a10c53650e38e
Python
10,925
297
import collections import operator import os from typing import Mapping import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import scanpy as sc import seaborn as sns import tqdm from sklearn.metrics.pairwise import cosine_similarity from sklearn.preprocessing import MinMaxScale...
706df39f3f0c411bc2d7d422e2963305fb8d3e2d4d44b02ac50af99296df1cf8
Python
10,935
320
# 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...
d98ef0b9925a8007547d30d65653ae55a89a2ab6434dbe9b26be84afc3719340
Python
10,940
244
# from data.pathways.pathway_loader import get_pathway_files import itertools import logging import numpy as np import pandas as pd from keras.layers import Dense, Dropout, Activation, BatchNormalization, multiply from keras.regularizers import l2 # from data.pathways.pathway_loader import get_pathway_files from data...
daa0150a00a2144c700b03a854b7161036ad04563b9910fe12d94417a6f26144
Python
10,943
248
"""Stores miscellaneous data for medaka.""" # note this module is imported into setup.py, so do not use any # non-stdlib packages import importlib.resources import os import pathlib # the models used by default for CLI entry points default_models = { 'consensus': 'r1041_e82_400bps_sup_v5.2.0', 'variant': 'r10...
5034b8759ab4cbb91804aa1fe989e0df82bfae4a61b8399802a3fc2ccc22ca38
Python
10,944
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 math from dataclasses import dataclass, field from itertools import chain import numpy as np import torch import torch.nn.functional a...
4b41092e7fa81e6384ffa19ddb8dddfd6861fdc33a1b6a67feb398e0286c6526
Python
10,946
308
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 28 15:51:12 2025 @author: vbp Time-resolved regression weights for Figure 3I and 3J. For each session x region, refits the R/S regression model (using each session's already-fitted alpha, delta from the non-cross-validated regression script) indep...
9c71892e2c62b3edb44eab81829dc21690340416a77e26758cbecdb1e0f816e3
Python
10,946
292
"""Feature builder for perovskite + MOF subsets. Walks data/<subset>/structures.json, enumerates 1F+2F+3F figures via the PBC pipeline, bins 2F (distance) and 3F (angle), prunes low-support columns, and writes: data/<subset>/features.npz — compressed X matrix + feature index data/<subset>/features_summary.json — ...
be8c7d3835112bd3bca15a9773af800a2751febcafd7b89d3b44eedbcca41e58
Python
10,947
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 # import numpy as np import os, sys, pickle #To import parameters sys.path.append("../../....
8a801d962b03f73df2cf923a1e44001c39a0de09532216e4f85e07ef23ccfa64
Python
10,951
288
# %% Imports and setup import os from pathlib import Path import numpy as np import tifffile as tiff import matplotlib.pyplot as plt from cellpose import models, io from skimage.measure import regionprops, label from skimage.color import label2rgb from skimage.morphology import remove_small_objects from skimage.segment...
12703564c17aa5e421230dc4ba76ca8a3bc4909abf175221f11630dfbfb6208f
Python
10,954
277
import os import torch import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import seaborn as sns from torch_geometric.loader import DataLoader from sklearn.model_selection import KFold from sklearn.metrics import mean_absolute_error, mean_squared_error from scipy.stats import pe...
64f443bad196c8f0be4b6e4f13ebb5dc2e577780f6ff5b1765661160c0b8bfef
Python
10,954
319
from collections import defaultdict from json import decoder import math from dataclasses import dataclass, field from transformers import logging from transformers.training_args import TrainingArguments from src.sampling import negative_sampling_strategy @dataclass class KMAEModelArguments: encoder_model_file_n...
13d63f5d911b78da35a9666a7f56d55dd082134d7c527ecc24cbbf17419cfdbc
Python
10,959
373
"""Fixtures used just by test_datasets""" import json import numpy as np import pandas as pd import pytest SPLITS_JSON = { "splits_csv_path": "splits/inputs-targets-paths-csvs/Mouse-Pup-Call.call.id-SW.frame-dur-1.5-ms.id-data-only.train-dur-1500.0.replicate-1.splits.csv", "sample_id_vec_path": { "te...
3687c7097409258d6de42a8cb87e9a50bf08e69db02b03d44ffafc5e4d0d5f64
Python
10,962
253
from __future__ import annotations from pathlib import Path from typing import Any import numpy as np import pandas as pd from st_risk.data.harmonize import choose_reference_celltype_column, intersect_gene_names from st_risk.data.io import open_h5ad from st_risk.models.base import BaseSpatialModelOutput, BaseSpatial...
1136e132f9d4b33177acd65023ce78056e3c5053286eafa67b52681ff0d117d0
Python
10,966
257
"""Controller for telemetry static settings and data-dict population.""" from __future__ import annotations import json import logging import re from pathlib import Path from src.features.telemetry_alignment.io.static_input_builders import ( build_opto_cluster_entries, build_photometry_cluster_entries, n...
4c5355d09d11ad07717b40dafce49c4cd961def620296e9d47cad259cf1e8076
Python
10,967
232
"""Utility functions for adding noise. .. warning:: This tool is deprecated and will be removed in BPReveal 6.0. It turns out that it's not very useful. This program is needed for a reason that I don't quite understand - gmstar is not picklable if I put it inside addNoise.py. """ import json import random imp...
babea142be5fa80b083c8e76093b4748181f43b8bf5f4e8abba6b1f34e4ea4fb
Python
10,967
287
""" pipeline_utils.py — Shared utilities for MAP, MMP, and BDP pipelines. """ from __future__ import annotations from typing import Any, Dict, List, Optional, Tuple import numpy as np from numpy.typing import NDArray from da4bci.metrics.distance import ( compute_mmd, compute_wasserstein, compute_energy,...
103552fcd1f0de5f3def85631b1c1e413eb60623d9c03867c815504d6e61e29c
Python
10,970
280
import pathlib import crowsetta import evfuncs import numpy as np import pytest import vak.common.annotation def test_files_from_dir(annot_dir_notmat, annot_files_notmat): annot_files_from_dir = vak.common.annotation.files_from_dir( annot_dir_notmat, annot_format="notmat" ) annot_files_notmat =...
f6e89e3d4d9881e2b9b817e9dc887a99c918a37b27deb79d9a2a43f8d5239ba5
Python
10,976
302
""" Full XAI implementation for the proposed Hybrid ViT-L/32 + MaxViT-L model. Methods: 1. SmoothGrad 2. Integrated Gradients 3. Occlusion Sensitivity 4. LIME 5. Grad-CAM 6. Grad-CAM++ 7. Score-CAM Output: A paper-style comparison grid with the following columns: Original | SmoothG...
4e3aa295b6258ae2a7605ceb42495ced65051c1d0a1c5f00b9abd517bff7643b
Python
10,977
377
from __future__ import annotations import contextlib import os import re import shutil from importlib import metadata from pathlib import Path from typing import TYPE_CHECKING import keyring from poetry.core.packages.package import Package from poetry.core.packages.utils.link import Link from poetry.core.vcs.git im...
9731d4d5fe832fcd18f9f1405c651fd6c7e5b9bfeaed747d99deb92910c921dc
Python
10,978
294
import typing from functools import partial from typing import Protocol import jax import jax.numpy as jnp import kfac_jax from .device_utils import DEVICE_AXIS from .optimizers import OptEnergyFunction from .physics import ( LaplacianOperator, NuclearPotential, local_energy, loop_laplacian, nucle...
c7b0d3a213e09e3a370ddabd748ba41813414ddcefc75ad6d168c0c6724a14c7
Python
10,986
307
import copy import pytest import torch from vak import metrics from vak.nets import TweetyNet import vak.models from .conftest import ( MockEncoder, MockDecoder, ) class TweetyNetDefinition: """Redefine here to test that ``vak.models.definition.validate`` actually works on classes we care about. ...
93106b324385601a47f3b8ebf124e0a873bad19aa95ff38dc33ba87cb8f5adb3
Python
10,997
341
import json import math import numpy as np import pandas as pd import pytest import vak.common # for constants import vak.common.annotation import vak.prep.spectrogram_dataset.spect_helper import vak.prep.split.split NUM_SAMPLES = 10 # number of times to sample behavior of random-number generator def train_test...