sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
10e564c674f5281f26caab3c1c8092088b93f276b062d95fa4a572786990c31d | Python | 5,125 | 142 | import os
import sys
ROOT_DIR = __file__.rsplit("/", 2)[0]
sys.path += [ROOT_DIR]
import argparse
import torch
import faiss
import glob
import numpy as np
from Bio import SeqIO
from utils.mpr import MultipleProcessRunnerSimplifier
from tqdm import tqdm
from model.ProTrek.protrek_trimodal_model import ProTrekTrimodal... |
0776b88b705c7fc2e0d3bb36fe68940f6f50fcac0b1a148a29bd7926c9a0f783 | Python | 5,126 | 134 | #!/usr/bin/env python
# Made by Paul Kiessling pakiessling@ukaachen.de
import urllib.request
from urllib.parse import urlparse
import os
import anndata
import argparse
import shutil
import pandas as pd
import scipy
import json
import tempfile
# 6 available but only 2 contain region label and coordinates
LINKS = [
... |
d2a1a733afe99223c511c0e54b9b5b5e988233734e7cf3b847f8d7374423d20e | Python | 5,127 | 117 | """Class that represents ``[vak.learncurve]`` table in configuration file."""
from __future__ import annotations
from attrs import converters, define, field, validators
from .dataset import DatasetConfig
from .eval import are_valid_post_tfm_kwargs, convert_post_tfm_kwargs
from .model import ModelConfig
from .train i... |
e262cd53b112f2793f20bef85572d86f4438131af1ccffcc885eddb8afb9433a | Python | 5,127 | 152 | import logging
import math
import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
import datasets
import transformers
import yaml
from datasets import DatasetDict, IterableDatasetDict, load_dataset
from transformers import HfArgumentParser, Trainer, TrainingArguments
from t... |
a66c3f4dd4e8ea65784ab069b2cca08855a17f3f338ddba9d546fe737333bee5 | Python | 5,129 | 183 | import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy import config
from pgmpy.estimators import IVEstimator, SEMEstimator
from pgmpy.models import SEM, SEMGraph
requires_torch = pytest.mark.skipif(
not _check_soft_dependencies("torch", seve... |
260d8277df5b9761b4fcf20577061b8175b884780ccdefcb300916c719f86e48 | Python | 5,131 | 154 | import yaml
import copy
from parcellate.constants import ACTION_VERB_TO_NOUN
def get_cfg(path):
with open(path, 'r') as f:
cfg = yaml.safe_load(f)
return cfg
def get_kwargs(cfg, action_type, action_id):
if action_id is not None and action_type in cfg:
kwargs = copy.deepcopy(cfg[action_t... |
b2b93b396689ac27c21a00e7fe10e98d9b03d06df2f78b79ec6cfec9476877a3 | Python | 5,132 | 150 | # This module is from:
# https://github.com/pyg-team/pytorch_geometric/blob/master/torch_geometric/nn/models/dimenet_utils.py
import math
import numpy as np
import sympy as sym
from scipy import special as sp
from scipy.optimize import brentq
def Jn(r, n):
return np.sqrt(np.pi / (2 * r)) * sp.jv(n + 0.5, r)
d... |
c56ac9c75042bf0c67a9cf0b0eee13de1e49ab6d40f1822a74bf50622d410db6 | Python | 5,134 | 151 | import os, gc
from pathlib import Path
import numpy as np
import cv2
import zarr
from numcodecs import Blosc
import czifile
# from aicspylibczi import CziFile
from tqdm import tqdm
from matplotlib import pyplot as plt
def czi_to_numpy(czi_file, scale = 1.0):
#pass in a czi file
np_img = np.squeeze(czi_... |
28373a6993a3837ead58c3c4dd5ff0f806cc5814c6805762a6f58f43c6a9b1f6 | Python | 5,139 | 119 | import os
import pandas as pd
from BLRun.runner import Runner
class SCRIBERunner(Runner):
"""Concrete runner for the SCRIBE GRN inference algorithm."""
def generateInputs(self):
'''
Function to generate desired inputs for SCRIBE.
If the folder/files under self.input_dir exist,
... |
c845158d2d6c8aa4122441be7ad1d431dd3523f766972d0e482dbaf49e91a75f | Python | 5,144 | 127 | from ..embed import (compute_diffusion_map, compute_diffusion_map_psd,
has_sklearn)
import numpy as np
from pytest import mark, raises
def _nonnegative_corrcoef(X):
return (np.corrcoef(X) + 1) / 2.0
def _factored_nonnegative_corrcoef(X):
X = X - X.mean(axis=1, keepdims=True)
U = X /... |
16bbe8b5fb72dd37123830492f5534394e7bf45252757be5c7de91dbcc43c77f | Python | 5,146 | 147 | """
Proc.py — kymograph-to-time-series Jython post-processor.
Part of the Bradke-lab neurite-growth / kymograph workflow. Called by the
8 kymograph-family .ijm macros in this directory tree:
ImageJ_macros/edfig02d/edfig02d_lifeact_kymo_batch_interactive.ijm
ImageJ_macros/edfig02d/edfig02d_lifeact_kymo_gen.ijm
I... |
4f0d0ad36d82c1e2711e823246ed28b65a355deb66b5d8619878e8274b76599f | Python | 5,147 | 142 | #!/usr/bin/env python
# Made by Paul Kiessling pakiessling@ukaachen.de
import urllib.request
from urllib.parse import urlparse
import os
import scanpy as sc
import argparse
import shutil
import pandas as pd
import scipy
import json
import tempfile
LINKS = [
"https://raw.githubusercontent.com/JinmiaoChenLab/SEDR_a... |
44ace9cc3fbb50b73652638750610c46956d8e39c9f22f74c886a02fec0a8904 | Python | 5,148 | 156 | #!/usr/bin/env python
# ENCODE DCC BAM 2 TAGALIGN wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
from encode_common_genomic import *
def parse_arguments():
parser = argparse.ArgumentParser(prog='ENCODE DCC BAM 2 TAGALIGN.',
description='... |
b1835182d7f4411a799156123f12d3bcff9015f32dcf79adf4a6a583e1d2c6fa | Python | 5,151 | 175 | from __future__ import annotations
import os
import shutil
import tempfile
from pathlib import Path
from typing import TYPE_CHECKING
from zipfile import ZipFile
import pytest
from build import ProjectBuilder
from packaging.utils import parse_wheel_filename
from poetry.core.packages.utils.link import Link
from poet... |
f5d9f86f2598176b5e98363897f5049b924bfab5f87f743f472b96fe2524ceda | Python | 5,151 | 156 | import torch
from torch.utils.data import DataLoader
import torch.optim as optim
import torch.nn as nn
import os
from ray import train, tune
from ray.tune.schedulers import ASHAScheduler
from networks.cnn import GeneralCNNBinaryClassifier
from dataloader.dataset import HTPDataset
def train_binnd(config, data_directory... |
ffcad3de65ad6cea29316cc097a2e4dea8d3b157877259c55accd93935294edc | Python | 5,154 | 109 | #!/usr/bin/env python3
"""Figuras 1 e 3 do manuscrito das perovskitas (a 2 é `fig_mecanismo.py`).
Fig. 1 — paridade do modelo completo, cor por haleto, com o viés dos iodetos
visível na própria figura em vez de só na Tabela IV.
Fig. 3 — curva de aprendizado das três referências (1F, Magpie, wave15), que
... |
9fa54babf491de8c9378a04058e353bc52dd976b001ea463e3bfca343923ad74 | Python | 5,156 | 144 | import networkx as nx
import pandas as pd
from pgmpy.base import DAG
from pgmpy.metrics import BaseSupervisedMetric
class OrientationConfusionMatrix(BaseSupervisedMetric):
"""
Computes confusion matrix based metrics for comparing edge orientations in DAGs.
Treats edge direction as a binary classificatio... |
1b2053cd2eb3d16b82aede792a518fad586a56b27cb5b1e0ae416a5b6a58ce3f | Python | 5,157 | 139 | import numpy as np
import pandas as pd
from scipy import stats
from sklearn.cross_decomposition import CCA
from pgmpy.utils import preprocess_data
from ._base import BaseCITest, _CITestResult, _ResidualMixin
class RoysLargestRoot(_ResidualMixin, BaseCITest):
r"""
Roy's largest root CI test for mixed data [1... |
781044b20974ce20e3fff835b258139bee4d5ccdae54151183d616d1e438d219 | Python | 5,160 | 124 | from ... import options as opts
from ... import types
from ...charts.chart import Chart
from ...globals import ChartType
class Pie(Chart):
"""
<<< Pie >>>
The pie chart is mainly used to represent the proportion of data of
different categories in the total. Each radian represents the ratio... |
548b10d5f98de9e79418ccf59863832de2cbe32df870b7332ab35b43dba7bf34 | Python | 5,161 | 170 | import collections
import os
import pathlib
import rootutils
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Literal,
Optional,
Tuple,
Union,
)
import pandas as pd
import hydra
import lightning as L
import omegaconf
import torch
from loguru import logger as log
from tqdm im... |
aa8131437b0e29909a2c369ef086cba15c6695dd85b3183185049ec7ab277167 | Python | 5,161 | 123 | from ... import options as opts
from ... import types
from ...charts.chart import RectChart
from ...globals import ChartType
class Bar(RectChart):
"""
<<< Bar Chart >>>
Bar chart presents categorical data with rectangular bars
with heights or lengths proportional to the values that they re... |
c18fff430a9756195645d9b0ea65805fdf226de3b8567fbb7d2553e227be219c | Python | 5,162 | 146 | import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy import config
from pgmpy.estimators import MarginalEstimator
from pgmpy.factors import FactorDict
from pgmpy.factors.discrete import DiscreteFactor
from pgmpy.models import DiscreteMarkovNetwo... |
1456ceef706dd4c704e63ef0b2ce72b1b606c8e6d016c0d40addbab46d40edf3 | Python | 5,164 | 133 | import os
from typing import Tuple
# disable numpy multithreading
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
os.environ["VECLIB_MAXIMUM_THREADS"] = "1"
import numpy as np
import h5py
import time
from scipy im... |
831ea0157e69bea1203f9cedd2b3fce2b85293321773bcf6babd0005aa47f85f | Python | 5,167 | 147 | """
The functions below were adapted from the sima package
http://www.losonczylab.org/sima version 1.3.0.
License
-------
This file is Copyright (C) 2014 The Trustees of Columbia University in the
City of New York.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Gene... |
08ec45d79ee0f13d7cf68a231f7c234c46669d03ef8ab2c36141e77a3dd30ee1 | Python | 5,168 | 112 | import tkinter as tk
from tkinter import ttk
class BehaviourInputFrame(ttk.Frame):
def __init__(self, parent, width=None, select_column_names_callback=None, select_event_file_callback=None, figure_display_dropdown=None, *args, **kwargs):
"""
Initialize the BehaviourInputFrame.
Par... |
1d2ca8ef46bee3453c25d7dc970af8631fdb770160667883fe27c8e131cfebea | Python | 5,168 | 108 | import torch.nn as nn
import torch
class CropLayer(nn.Module):
# E.g., (-1, 0) means this layer should crop the first and last rows of the feature map. And (0, -1) crops the first and last columns
def __init__(self, crop_set):
super(CropLayer, self).__init__()
self.rows_to_crop = - crop_set... |
e98cfe84058c3b63acce8e872ec3a796bbd738b21688ebccd86d30bbc8d0c937 | Python | 5,169 | 120 | """Print a GO term's lower-level hierarchy."""
__copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang. All rights reserved."
__author__ = "DV Klopfenstein"
import sys
# pylint: disable=too-many-instance-attributes,too-few-public-methods
class WrHierPrt(object):
"""Print the hierarchy of a set of obje... |
3566fae3dc210ac1db42caa8dae15a932e63ba05c1a6533e044924446c6a52ba | Python | 5,170 | 140 | """Wave-1 timing benchmark — feature build per atom across cell sizes.
Measures wall-clock cost per (cell, basis variant) for:
- 1F+2F+3F+MAD baseline (current production)
- +CT2F (Wave-1 extension)
Also measures inference cost (predict() on a fitted ridge model) and
ridge fit cost. Compares to known DFTB+/xtb t... |
91b76addcff7258296d28b97d2e5364fa979809f99b87fa8e72571280e70bd4c | Python | 5,170 | 139 | # 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 torch
from torch.utils.data.dataloader import default_collate
from fairseq.data import ConcatDataset
logger = logging... |
3dddd74c524c9c45e6ec80c1056e4832bb30b5ebb2111bc7e24866dd6ea89bab | Python | 5,171 | 150 | import argparse
import csv
from importlib import resources
from pathlib import Path
from typing import List, Optional, Union
import numpy as np
import torch
from evo2 import Evo2
def read_prompts(input_file):
"""Read prompts from input file or built-in test data.
Args:
input_file: Either a path ... |
2e8183b2d316457001a99826aa4f5ba85338cec9997c6abfbace4c16c1bcad74 | Python | 5,172 | 115 | import numpy as np
import torch
import skimage.io as skio
import os
import os.path
from tqdm import tqdm
from src.utils.dataset import DatasetSUPPORT_test_stitch
from model.SUPPORT import SUPPORT
def validate(test_dataloader, model):
"""
Validate a model with a test data
Arguments:
test_data... |
774834e48e886436a71a99de840514aecaa0412c23c94af4463d9e62b1b842a3 | Python | 5,172 | 156 | import collections
import os
from os.path import basename, dirname
from os.path import join
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn import metrics
from config_path import PROSTATE_LOG_PATH, PLOTS_PATH
from utils.stats_utils import score_ci
def re... |
28b44912f1f252582b11ccbfbafd4420b01614666a59e00d0f49357d1e92acea | Python | 5,173 | 220 | import mdtraj as md
import numpy as np
import sys
order_parameters = [
(2, 0.83),
(3, 0.83),
(4, 0.83),
(5, 0.85),
(6, 0.86),
(7, 0.88),
(8, 0.89),
(9, 0.93),
(10, 0.89),
(11, 0.89),
(12, 0.91),
(13, 0.92),
(14, 0.82),
(15, 0.84),
(17, 0.89),
(18, 0.86),
... |
6c0f85a078e639e8e2693a3b6abf90a6f0a98a83aa5561903493a21e2c381126 | Python | 5,173 | 149 | """Pure builders for telemetry cluster/stimulation data dictionaries."""
from __future__ import annotations
def normalize_static_settings(settings: dict | None) -> dict:
"""Normalize persisted static settings into canonical dict shape."""
settings = settings or {}
normalized = {"clusters": {}, "stimulati... |
aa361ea532f8bdfe48ec7839185b26b273fafc8d86829585ee42929bac195724 | Python | 5,173 | 163 | # -*- coding: utf-8 -*-
""" The code used in IronTract Challenge https://irontract.mgh.harvard.edu/.
The dataset is downloaded from QMENTA platform.
Copyright (C) 2019 Andac Hamamci
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public L... |
931162c2540bd161c8d44b2578976411fbc5f86dcf3d4caba962cd18325f3614 | Python | 5,174 | 115 | """Controller for behaviour option widgets (colors + visibility checkboxes)."""
from __future__ import annotations
from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QWidget
from src.gui.framework.tk_compat_controls import CheckBoxControl
class BehaviourOptionsPanel:
"""Owns behaviour options fram... |
d6f0538ae79d06a0c63e7e634aa117b05b5d15561775af8d6c51c52582d5efd6 | Python | 5,174 | 140 | """Wave-1 timing benchmark — feature build per atom across cell sizes.
Measures wall-clock cost per (cell, basis variant) for:
- 1F+2F+3F+MAD baseline (current production)
- +CT2F (Wave-1 extension)
Also measures inference cost (predict() on a fitted ridge model) and
ridge fit cost. Compares to known DFTB+/xtb t... |
8f71967ce620921fb7a5ec33cc9cd227578d7efd5be83003d4c21296a2334458 | Python | 5,175 | 159 | import logging
import pytest
from d3text import annotation_hub
from d3text.identifier_bridge import NCBI_TAXID, BridgeRow, IdentifierBridge
from d3text.schema import BRENDA_SCHEMA
ABSTRACT = "<p>Escherichia coli makes an enzyme.</p>"
BODY = (
"<sec><p>In the cytoplasm of every growing cell the <i>catalase</i> is... |
491ec5b77c820faa1ee6c245763df672bce04e28c5fc844b60dd971e562277db | Python | 5,177 | 149 | from __future__ import annotations
import typing
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from packaging.utils import canonicalize_name
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.project_package import ProjectPackage
from poetry.__version... |
d84ecd78498ae08b110dfc91c5c65181f6c62c7503e38fbc2a7616f9b03db679 | Python | 5,178 | 137 | import os
import json
import unittest
from unittest.mock import patch
from pyecharts import options as opts
from pyecharts.charts import Graph
class TestGraphChart(unittest.TestCase):
@patch("pyecharts.render.engine.write_utf8_html_file")
def test_graph_base(self, fake_writer):
nodes = [
... |
6266e18dcc5a989fc45b35925543c4e61806908ae58d0d46c1cbf26501233f96 | Python | 5,179 | 137 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
from scvi.utils import dependencies
if TYPE_CHECKING:
import xarray as xr
@dependencies("plotnine")
def plot_hier_importance(
gene_results: xr.Dataset,
feature: int | str = 0,
base_resolution... |
386847c1b94defee1113b925de12f8193712f3fb6de62ea360ab8d408f7be661 | Python | 5,180 | 160 | """Smoke-test the publicly released HIPPIE checkpoint on Hugging Face Hub.
Downloads `hippie_techcond_v1.ckpt` from huggingface.co/Jesusgf23/hippie
and verifies that it loads with the released `hippie` package and produces a
finite latent embedding from a synthetic input. Intended as a one-command
sanity check for rev... |
604ac2fed11257a46f1f4c7e39db183787bcb6869cfad4e67a38a6cf23ec35da | Python | 5,180 | 146 | import sys
from os import makedirs
from os.path import dirname, realpath, exists
current_dir = dirname(dirname(realpath(__file__)))
sys.path.insert(0, dirname(current_dir))
import pandas as pd
import os
from config_path import *
from data_extraction_utils import get_node_importance, get_link_weights_df_, \
get_dat... |
649d78e1131b5dd44249c0bdb38305f5cb022c90a138936d2ec2dfdfa6745146 | Python | 5,180 | 170 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# philistine documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 30 13:18:29 2018.
#
# 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
#... |
27b3c955ff26856495503c726c9b2ce0a5c7ba5f0732a9094c0cc84d17a6920b | Python | 5,182 | 163 | #!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_fu... |
aeaa6b4972b13ca9c4b3a48f364586121c100204839c79d489f3d854aca0759e | Python | 5,182 | 165 | #!/usr/bin/env python
# ENCODE preseq wrapper
# Author: Daniel Kim, Jin Lee (leepc12@gmail.com)
import warnings
import numpy as np
from matplotlib import pyplot as plt
import sys
import os
import argparse
from encode_lib_common import (
strip_ext_bam, ls_l, log, logging, rm_f)
from encode_lib_genomic import (
... |
9afc6953a7ea90e3e2755866178222069b3ab7bb025b3d167818ca6f3624b3a4 | Python | 5,183 | 198 | import glob
import json
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
import os
from pathlib import Path
dir_path = os.path.dirname(os.path.abspath(__file__))
repo_root = Path(__file__).resolve().parents[2]
processed_data_loc = str(repo_root... |
760273a8a37ae8359a267af46e3a4d4f08a16616e250549ca6210140d35ed905 | Python | 5,184 | 148 | import math
import jax
import jax.numpy as jnp
import pytest
from oneqmc.molecule import Molecule
from oneqmc.sampling.sample_initializer import MolecularSampleInitializer
from oneqmc.types import ModelDimensions
dim = 10
sqrt_3_8 = math.sqrt(3 / 8)
@pytest.mark.parametrize(
"pdist,elec_of_atom,n_up,n_down,exp... |
a51fb199226cf53f1ef2fea29e324e24e6f956722f988d58c6e9742a3687a23c | Python | 5,184 | 120 | import torch
import torch.nn as nn
# Computes the total strain energy, damage energy and irreversibility penalty
def compute_energy(inp, u, v, alpha, hist_alpha, matprop, pffmodel, area_elem, T_conn=None):
E_el, E_d, E_hist_penalty = compute_energy_per_elem(inp, u, v, alpha, hist_alpha, matprop, pffmodel, area_ele... |
bba33bca1ed262a37f2827ec58684f6d0c5ccc6888231d06755adc467dd8ccc9 | Python | 5,186 | 154 | import collections
import os
from os.path import basename, dirname
from os.path import join
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn import metrics
from config_path import PROSTATE_LOG_PATH, PLOTS_PATH
from utils.stats_utils import score_ci
def r... |
06ac1c4aeeae64371168d52330393ccbd76031ab816380538115b6a969458b75 | Python | 5,187 | 170 | # from one.api import ONE
from deploy.iblsdsc import OneSdsc as ONE
from iblatlas.atlas import AllenAtlas
from brainbox.io.one import SpikeSortingLoader
import matplotlib.pyplot as plt
import npyx
from npyx.c4 import fast_acg3d
import argparse
import pickle
import shutil
import sys
import tempfile
import time
import t... |
76db9f7cd2d71df2090f1fde3f921355f28f4b0eed9383ea0ba60e3b238e4155 | Python | 5,188 | 164 | import lightning
import torch
import vak.models.registry
# ---- mock networks ---------------------------------------------------------------------------------------------------
class MockNetwork(torch.nn.Module):
"""Network used just to test vak.models.base.Model"""
def __init__(self, n_classes=10):
... |
8f357dbfd0e14654dfadfd6d5e82f70d71af1e2a349519457a4da1bb75c30687 | Python | 5,188 | 166 | import re
import networkx as nx
import pandas as pd
from os.path import join
from config_path import REACTOM_PATHWAY_PATH
from data.gmt_reader import GMT
reactome_base_dir = REACTOM_PATHWAY_PATH
relations_file_name = 'ReactomePathwaysRelation.txt'
pathway_names = 'ReactomePathways.txt'
pathway_genes = 'ReactomePathway... |
9a9b3bc63f496d05a1581c51010478bc47e39c6747b6bbbad769f64fb93d6bfc | Python | 5,190 | 145 | #
# 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
from scipy.optimize import minimize
import time
import os
# Use th... |
b57ce1260460265d921b623a4c727939ec74dd705d3d3e95d7f060444c4012a9 | Python | 5,192 | 178 | """
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/efficient.py.
"""
from warnings import warn
import torch
from mattergen.common.gemnet.initializ... |
c503690cd24f18de12781a82c942e41a269d98458f03836821d5f976bbb4e23c | Python | 5,192 | 128 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import Callable
import torch
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.data.types import PropertySourceId
from mattergen.denoiser import GemNetTDenoiser, get_chemgraph_from_denoiser_output
from matt... |
6ef1f44b23b6726495f470bdc5349861da696488fab125bd35926c785b247488 | Python | 5,193 | 144 | """Regression tests for `GMESampler.dataset_splits` share validation."""
import logging
import pandas as pd
import pytest
from brenda_references.sampling import GMESampler
from gme.gme import GreedyMaximumEntropySampler
_SPLIT_DTYPES = [
("pubmed_id", "int32"),
("subject", "float64"),
("object", "float64... |
86e4b2265dceb13798eeae471a61e182b235162e19b598333dcd822247b39791 | Python | 5,193 | 159 | #!/usr/bin/env python
# Made by Paul Kiessling pakiessling@ukaachen.de
import argparse
import json
import os
import shutil
import tempfile
import pandas as pd
import scipy
from pypdl import Downloader
from spatialdata_io import xenium
LINKS = {
"https://s3-us-west-2.amazonaws.com/10x.files/samples/xenium/1.0.2/... |
0260c15f2318b8564ef563b04be67a035e6a7254d45327bf44077006d8f1eb53 | Python | 5,194 | 143 | import os.path as osp
import re
from collections import defaultdict
from valids import parser, main as valids_main
TASK_TO_METRIC = {
"cola": "mcc",
"qnli": "accuracy",
"mrpc": "acc_and_f1",
"rte": "accuracy",
"sst_2": "accuracy",
"mnli": "accuracy",
"qqp": "acc_and_f1",
"sts_b": "pea... |
5e88a621926bf720301f51b228f14852fe660b8fd5af49109986e1b394ab80ae | Python | 5,196 | 145 | #!/usr/bin/env python3
# MIT License
#
# Copyright 2025 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... |
cf724f0138c05f5ddc0c09f31cc0290c30a7ec9edc947fd18a1504b121627679 | Python | 5,197 | 183 | import numpy as np
import pandas as pd
from typing import Callable
NTs = 'ACGT'
AAs = 'ACDEFGHIKLMNPQRSTVWY'
AA_TO_CODON = {
'*': ['TAA', 'TAG', 'TGA'], # Stop.
'A': ['GCT', 'GCC', 'GCA', 'GCG'], # Ala.
'C': ['TGT', 'TGC'], # Cys.
'D': ['GAT', 'GAC'], # Asp.
'E': ['GAA', 'GAG'], # Glu.
... |
903408c5ffa1fecb294a1bd3648b55dd4b69bd789caf015e199c643cc33ae10c | Python | 5,199 | 155 | #!/usr/bin/env python
# Combine featureCounts biotype counts with a header for MultiQC,
# then calculate feature percentages for the general stats table.
#
# Written by Senthilkumar Panneerselvam and released under the MIT license.
# Adapted for nf-core/modules by Jonathan Manning.
import argparse
import logging
impo... |
828b583d9b14a6f7e31ebc128c8b9ad27dc7e03c9d595ce4e1071e8a63623ef7 | Python | 5,202 | 111 | #!/usr/bin/env python3
"""Quanta variância a SELEÇÃO de alpha injeta no número do artigo?
Descoberto por acidente ao montar a curva de aprendizado: permutar as linhas do
treino, sem mudar QUAIS estruturas o compõem, movia o RMSE de 0,1423 para 0,1589 —
11 %. A causa é que `ridge_alpha_and_fit` parte a CV interna por P... |
05c8b1f053d797552d91e52b2ef1afa10fc33807297abccf5e842554fb36e888 | Python | 5,215 | 156 | import torch
import torch.nn.functional as F
class BINNTrainer:
"""
Handles training BINN models using a raw PyTorch training loop.
"""
def __init__(self, binn_model, save_dir: str = ""):
"""
Args:
binn_model: The BINN model instance to train.
save_dir (str): D... |
f7a81806ed34d6b4f8a1b97236b0ced9b2e2533a7da903df976ed20f2897307b | Python | 5,215 | 136 | #!/usr/bin/env python
"""Does token supervision fix the class channel's mention ranking?
The `other_organisms` channel was measured scoring gold mention tokens *below*
ordinary prose, which is what the label noise predicts: a positive document
pushes up one token, a false-negative document pushes down all of them. If
... |
6eea528de7724320eee5deed7eb6caf231c5c2c816b71aa99c06b2f735f3f1bf | Python | 5,217 | 141 | """PyTorch Lightning module for standard training."""
import math
import argparse
import torch
import numpy as np
from torch import nn
import pytorch_lightning as pl
from pytorch_lightning.loggers import WandbLogger
from pytorch_lightning.callbacks import LearningRateMonitor
from data_module import CodonDataModule
f... |
dbb2ba5ce8058720a4c1bc227ef9a51fce75880209e02cc895b1a7fe57a870e7 | Python | 5,219 | 140 | from functools import partial
from typing import Optional
import haiku as hk
import jax
import jax.numpy as jnp
from ...types import ModelDimensions, MolecularConfiguration, Nuclei
from ..nn.masked.basic import Constructor, PsiformerDense
from ..nn.masked.features import featurize_real_space_vector
from ..nn.masked.m... |
6048b4f5cb1368ebdd36a080c4a39b04ea8e233210acf7bd1fbedf745a202181 | Python | 5,221 | 163 | #!/usr/bin/env python
# ENCODE DCC MACS2 signal track wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
from encode_common import *
def parse_arguments():
parser = argparse.ArgumentParser(prog='ENCODE DCC MACS2 signal track',
description=''... |
db540a373f305951f1ad4a327e22185eb8153ffc70d6baa6cca1134ed6062cbf | Python | 5,224 | 114 | import numpy as np
from utilities import logistic_func
from tqdm import tqdm
import h5py
# Set random seed for reproducibility
np.random.seed(0)
# Load data
with h5py.File('../results/new_nat_videos_gabor_responses_full_res_z_score.h5', 'r') as all_gabor_responses:
orientation_arr = all_gabor_responses['orientati... |
f4f89f7fe7093f86666ad4313f5b3639ce58e1dee6049730ae7a2b519b50b7ef | Python | 5,224 | 160 | #!/usr/bin/env python
# Author_and_contribution: Niklas Mueller-Boetticher; created template
# Author_and_contribution: Kirti Biharie; added dataset
import argparse
parser = argparse.ArgumentParser(description="Load data for Mouse Kidney Coronal")
parser.add_argument(
"-o", "--out_dir", help="Output directory t... |
107e323ac622180fc04607049d6c98e4995e67dc85047bb8bb9324a8ce7f1fc8 | Python | 5,228 | 153 | #!/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 logging
import os
import sys
from argparse import Namespace
from itertools import chain
import torch
from om... |
74cd3acffc0b527857364bd527a1c6a4194732ea6371ad8b71d5217aa88b2c1e | Python | 5,228 | 206 | import logging
import numpy as np
import os
import psutil
import SimpleITK as sitk
import zarr
from zarr import blosc
logger = logging.getLogger(__name__)
def skip_sample(image, spacing, ss_spacing):
"""
Return a subset of the voxels in an image to approximate a different
sampling rate
Parameters
... |
bbce8bb3a4b3755266ac3fbb1f17dd92761a6717f2728a43a500d3d13f2d60b7 | Python | 5,228 | 161 | #!/usr/bin/env python
# ENCODE DCC MACS2 signal track wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
from encode_common import *
def parse_arguments():
parser = argparse.ArgumentParser(prog='ENCODE DCC MACS2 signal track',
description=''... |
6399d432aff87e1a697230219b6c5a3b5ee0c2f8a5e2878f875f9b95acd5c3dd | Python | 5,230 | 137 | import argparse, configparser
import pickle
import librosa
import numpy as np
import torchaudio
import torch
from pdb import set_trace as bp
def compute_SAD(sig,fs,threshold=0.0001,sad_start_end_sil_length=100, sad_margin_length=50):
''' Compute threshold based sound activity '''
# Leading/Trailing mar... |
c0ac9dad01c1c3d880aac41a221d379c6465caf23fbc1694ac788ad52dd2df6b | Python | 5,233 | 132 | import numpy as np
import Surr_PseudoPeriodic as pseudo
def Surr_findrho(y,tau,dim):
"""
rho=Surr_findrho20200626(y,tau,dim)
inputs - y, time series
- tau, time lag for phase space reconstruction
- dim, embedding dimension for phase space reconstruction
outputs - a tuple of the... |
5bac902e4792e06bb9a2809656aca9f74e1e891ab0dfbe26083b2658c918bbb9 | Python | 5,235 | 117 | """Page 4: Config Explorer."""
import streamlit as st
import plotly.express as px
import pandas as pd
import numpy as np
from utils import PIPE_ORDER, PIPE_COLORS, style_figure
def render(store, dataset):
st.header("Configuration Effects")
st.markdown(
"Explore all 24 feature/classifier/DA combinatio... |
7bf61ffb0c1cab58f4cd4aa87a54e71757f3c25036ca71a743edc84752569aa0 | Python | 5,235 | 149 | #!/usr/bin/env python3
"""
Compute and plot the correlation between:
- Duffy group: Salmon riboseq gene-level TPM (SRR15175557, SRR15175558, SRR15175559)
- t30 group: STAR CN sample unstranded read counts, normalized to CPM
Usage:
duffy_t30_correlation.py --salmon_dir <dir> --star_dir <dir> --output_dir <dir... |
e39f5d9fc6b5a0d37322e0de7b6319480843bf3e876058aa99ef4d333a9253df | Python | 5,236 | 135 | #!/usr/bin/env python3
# MIT License
#
# Copyright 2025 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 u... |
07de06acc890c7749d1837df7c3fb74d1ba5963039cb18a39d175c174040fd23 | Python | 5,239 | 130 | import copy
from typing import Optional
from ... import options as opts
from ... import types
from ...globals import ThemeType
from ..basic_charts.radar import Radar
from ..chart import Base, Chart, RectChart
class Grid(Base):
"""
`Gird` Drawing grid in rectangular coordinate. In a single grid,
... |
2e0d64c93ccd8e36e1b475be37b4a5a1f7fe89a3dca1453fa102c6d84244d312 | Python | 5,241 | 176 | import functools
import warnings
from typing import Any, ParamSpec, TypeVar
import jax
from jax.numpy import ComplexWarning
from .api import (
IS_LPL_ARR,
Array,
ArrayOrFwdLaplArray,
Axes,
CustomTraceJacHessianJac,
ExtraArgs,
ForwardFn,
ForwardLaplacian,
ForwardLaplacianFns,
Fu... |
1619b43240ecdc5956e50ef1bca5a192390aa664943611c14c241d65ba4259f2 | Python | 5,243 | 132 | # 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
from fairseq import utils
from fairseq.data import LanguagePairDataset
from . import register_task
from .translation import Tran... |
dd148415c27e4ceb0ce032be29342f3e294058173032c3bf38f6d698529ce8e0 | Python | 5,245 | 129 | """Intrinsic (KAN) vs post-hoc (SHAP + permutation) interpretability — Paper #2.
On the PLS-score inputs of the compact (3,) KAN, compare three importance rankings on the hold-out:
(1) KAN intrinsic = response magnitude per latent (std of the learned univariate function),
(2) model-agnostic permutation importance, (3)... |
e908eb3281a462727c9ec4313f1b78fc184f34c93d1e766a5c12f93e1f9e51af | Python | 5,247 | 146 | # 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 collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
from omegaconf import II
... |
b18265c20b8baf73f7562c3ecdfd10358b374f1a9229be2792ebefcc088958c0 | Python | 5,254 | 165 | # 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.
import sys
from dataclasses impor... |
2a49733e3223be9240dc14a570fa5834bcbbf90deab6924e255e1513ea5e76a2 | Python | 5,255 | 156 | import numpy as np
import zarr
import torch
import ray
from torch import Tensor
from torch.utils.data import Dataset
from torch.nn.utils.rnn import pack_sequence
from typing import Callable, List
import os
class ZarrDataset(Dataset):
"""
Dataset for loading data from Zarr format.
When use_cache=True, use... |
673abcf0251263a54b8c983afd3d994594acfdb6f32a6412ec2c16acbd112486 | Python | 5,257 | 147 | import itertools
from os.path import join
import numpy as np
from matplotlib import pyplot as plt
from sklearn import metrics
from sklearn.metrics import average_precision_score
def plot_auc_bootstrap(all_models_dict, ax):
n = len(all_models_dict.keys())
import seaborn as sns
colors = sns.color_palette(No... |
c9c560c37bdd2ad301fd73ed15304adfd4c869cc624db2c7504bb8ee1b96f0d5 | Python | 5,257 | 99 | """Sorts GO IDs or user-provided sections containing GO IDs."""
__copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang, All rights reserved."
__author__ = "DV Klopfenstein"
class SorterNts(object):
"""Handles GO IDs in user-created sections.
* Get a 2-D list of sections:
sections ... |
8ef44944efb485181d01d60da2ba203fa2bae0b25ad5e3e5f9bbe0ebb4b4c0af | Python | 5,258 | 154 | import pytorch_lightning as pl
import torch
from metrics.loss_function import LossFunction
from models.node_encoder import NodeEncoder
from models.conditional_denoising_model import ConditionalDenoisingModel
from utils.data.dataholder import DataHolder
from utils.data.misc import setup_wandb
from utils.diffusion_model.... |
4f1e302b6aafd95a7dfdfab3fd39f7c54c55016bd64456fd7d059334e536aeeb | Python | 5,259 | 158 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import Callable, Generic, TypeVar
import torch
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply
from mattergen.diffusion.data.batched_data import BatchedData
from mattergen.diffusion.losses import L... |
ad093a7c6741f69c2f47e9808537121bb6f220c4293da5cd17769079d55dd1da | Python | 5,259 | 133 | """Plot the SIESTA-PBE vs Mannodi-VASP-HSE06 decomposition-energy parity
on the 18 F-free endmembers, partitioned by A-cation (Cs vs K).
"""
from __future__ import annotations
import json
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
from scipy.sta... |
cf271a3e6282352b4c29d9b6a4d4f526cf0487a157bb1cbbdb77cf19a7e65a97 | Python | 5,260 | 165 | import torch
import torch.nn as nn
# Define the U-Net model
class UNet3Layers(nn.Module):
def __init__(self, num_classes: int=2):
super(UNet3Layers, self).__init__()
# Encoder
self.enc_conv0 = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=3, padding=1),
nn.Re... |
f367d698d172fd65d090e3ad145035ffdafee936ae56eb79cfbd43bb2536e5c9 | Python | 5,260 | 166 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to help optimize cell parameters"""
import os
from pprint import pprint
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use("Qt5Agg")
import matplotlib.pyplot as plt # noqa E402
from sklearn.cluster import KMeans # noqa E402
from sklearn.... |
3a6a17abb4ceb29c4b394b7703072982a9ee0b654ba0264e60739568ef25641c | Python | 5,266 | 209 | """
Utility functions for vtk wrappers.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import re
import string
from collections import defaultdict
import numpy as np
from vtk.util.vtkConstants import VTK_BIT, VTK_STRING
# VTK_UNICODE_STRING has been removed since VTK 9.2.
# See:... |
e2a4034386a3c48da8c5648ee1fc0b23e3cbcf797cf21b236f25b5cdc214ca47 | Python | 5,270 | 150 | """
@file header.py
@author Simon Yu
@date 02/21/2023
@brief Project header file.
"""
import multiprocessing
import os
import type
cuda_allow_tf32 = False
log_level = type.LogLevel.info
run_mode = "disabled"
dataset_prefix = "awa2"
dataset_config_file_path = os.path.join("../../../npc-dataset-utils/configs/npc-... |
92e564e0d459959532679ea92894db3366c0ba5254ef4eefc2d3ddce3a398f8d | Python | 5,273 | 185 | import torch
import torch.nn as nn
import torch.nn.functional as F
# SGCN basic operation
class SparseGraphLearn(nn.Module):
"""
Sparse Graph learning layer.
modify from: https://github.com/jiangboahu/GLCN-tf/blob/master/glcn/models.py
"""
def __init__(self,
input_dim,
... |
e98ad6fac70490baf5e6efab26e1cbcd11e574e7a88e9c585f83a3cacf31f6a5 | Python | 5,273 | 154 | from joblib import Parallel, delayed
from sklearn.svm import SVR
import matplotlib.pyplot as plt
import os.path as op
import scipy.io as sio
import numpy as np
from sklearn.model_selection import KFold
from sklearn.feature_selection import SequentialFeatureSelector
import statsmodels.api as sm
from sklearn.metrics imp... |
f37baa52448452d64a43b02b7f0c291ac9aea4f5639d9d5f9c3dc91d471459de | Python | 5,273 | 154 | from joblib import Parallel, delayed
from sklearn.svm import SVR
import matplotlib.pyplot as plt
import os.path as op
import scipy.io as sio
import numpy as np
from sklearn.model_selection import KFold
from sklearn.feature_selection import SequentialFeatureSelector
import statsmodels.api as sm
from sklearn.metrics imp... |
9f653233fcadf318cd83d017fe04c9285c140d685d64ea1ebdf8a8a17fceb5e3 | Python | 5,274 | 154 | from joblib import Parallel, delayed
from sklearn.svm import SVR
import matplotlib.pyplot as plt
import os.path as op
import scipy.io as sio
import numpy as np
from sklearn.model_selection import KFold
from sklearn.feature_selection import SequentialFeatureSelector
import statsmodels.api as sm
from sklearn.metrics imp... |
aebab393b4e4b23b064cad995954c41dba70778f0d422d13867760ccc2d6cb6f | Python | 5,275 | 134 | import numpy as np
from PIL import Image
import torch
from typing import Callable, List, Tuple, Optional
from sklearn.decomposition import NMF
from pytorch_grad_cam.activations_and_gradients import ActivationsAndGradients
from pytorch_grad_cam.utils.image import scale_cam_image, create_labels_legend, show_factorization... |
c5eb1776d36442bec517393371812b4028273ae0151c20f7b6ce308abb254e54 | Python | 5,275 | 147 | import numpy as np
import pandas as pd
from skbase.utils.dependencies import _check_soft_dependencies, _safe_import
from pgmpy import config
from pgmpy.factors.base import BaseFactor
torch = _safe_import("torch")
pyro = _safe_import("pyro", pkg_name="pyro-ppl")
class FunctionalCPD(BaseFactor):
"""
Defines a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.