sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
c6fefcf4d48a8604bbfeef087596ba919799f9e147afc2ff7d8576c750ed41e0 | Python | 16,391 | 454 | import random
import xml.dom.minidom as md
import xml.etree.ElementTree as etree
from collections.abc import Hashable
from itertools import chain
import networkx as nx
from pgmpy.factors.discrete import TabularCPD
from pgmpy.models import DiscreteBayesianNetwork
from pgmpy.utils import compat_fns
from pgmpy.utils._wa... |
3dea6b2e7240b1c279dfe70d3fcb33eb8382c64134aade68d238c8b6a41865fa | Python | 16,398 | 425 | import os
import joblib
import numpy as np
import pandas as pd
os.environ['WANDB_DIR'] = 'ADD YOUR DIRECTORY'
from pathlib import Path
import torch
import torchvision
from baseModels.utils import get_model, get_BrainScoreMapping, get_penultimateLayer, get_earlyLayerControl
from training.train_wandb_binaryTask import... |
3bd7c72c881c5e9dd89dff53212bd949a6181d0a7caa773d550eff9387aa1d60 | Python | 16,415 | 426 | # -*- coding: utf-8 -*-
"""
Updated February 10, 2025
@author: hanna
"""
"""
Fit cosine tuning curves to each BCI neuron and assess significance using bootstrapping
Full description of methods can be found here:
Population-level constraints on single neuron tuning changes during behavioral adaptation (Steal... |
e2bf021915eb81fbc0907f9bf3619cefb1302ec5802e5687339aec87b29125e4 | Python | 16,427 | 349 | import logging
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
import os
import traceback
from moove.qt_helpers import show_info
from moove.utils.audio_utils import (decibel)
from moove.utils.movefuncs_utils import (load_recfile, ensure_recfile_exists_and_has_flags)
plt.rcParams... |
1e3dada70cac01cb421d2ef1cbd4abcdea6f695b6a0b8f75457b1f83ca738541 | Python | 16,437 | 481 | import torch
import torch.nn as nn
from typing import Optional, Union, Tuple
from diffusers import UNet2DModel
from dgr.models.phc_e2e_mega_net import (
ResidualBlock,
DeformableCrossAttention,
HybridTransformerBlock,
)
class MedicalImg2ImgUNet(UNet2DModel):
"""
SR3-inspired diffusion UNet for jo... |
104885dc140b1399aff39505754b80e1deeb3234643e9cd9ce2fde83dc8b4c32 | Python | 16,441 | 400 | """Automatic membrane center and thickness estimation.
The estimator follows the Amber MMPBSA.py membrane implementation: selected
head-group atom z coordinates are pooled over the selected complex trajectory
frames, the membrane center is their mean, and thickness is the distance
between the means of the coordinates ... |
858832df8a7dae51ebccfb472862f3f6895e5337a1f2b0a6fa70d3bc0d54ff2b | Python | 16,443 | 329 |
'''
By K. Butenko
Functions for PathwayTune (see description in the headers)
'''
#import pandas
import numpy as np
import os
from scipy.spatial.distance import canberra, cityblock, euclidean, braycurtis, cosine
import json
import copy
def get_symptom_distances(activation_profile, target_profiles, fixed_sympt... |
6e98088490316142cf4813759e70e17c4edf36fb1c0e9eb6ae78e2179ef42575 | Python | 16,456 | 460 | # -*- coding: utf-8 -*-
"""
@Time:Created on 2019/9/17 8:36
@author: LiFan Chen
@Filename: model.py
@Software: PyCharm
"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import math
import numpy as np
from sklearn.metrics import roc_auc_score, precision_score, recall_sco... |
21f6c28f4d0d5ff642a6b18e6ab66d3a2127f6a5993aa7ea2f03683e2d4fe5fb | Python | 16,458 | 439 | from __future__ import annotations
import logging
from functools import partial
from typing import TYPE_CHECKING
import numpy as np
import torch
from scvi import REGISTRY_KEYS
from scvi.data import AnnDataManager
from scvi.data.fields import (
CategoricalJointObsField,
CategoricalObsField,
LayerField,
... |
7c260809baa3a19459163c3e9109ed41057357f28c6e727b087ada5f6c057f42 | Python | 16,459 | 430 | # 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 typing import Dict, Optional
import torch
import torch.nn as nn
from torch import Tensor
class MultichannelSearch(nn.Module):
def ... |
09f3031f4a0d375201b6af453287805c9fc149380ac23f51b4c2a935547d57ad | Python | 16,463 | 201 | from nnunetv2.configuration import default_num_processes
from nnunetv2.experiment_planning.plan_and_preprocess_api import extract_fingerprints, plan_experiments, preprocess
def extract_fingerprint_entry():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-d', nargs='+', type=int,
... |
0e14157a4a1a6792056abc80cab12f8da1057ad2c06ad66ca8fb7b51eacfd6e5 | Python | 16,492 | 405 | # -*- coding: ISO-8859-1 -*-
import os
from pathlib import Path
import pandas as pd
import numpy as np
from random import random
"""
Photometry analysis.
Read behavior and photometry database files from a sub-folder of wherever program is run from.
Create a single text file of selected trials and binned phot... |
5a14b40cf3ff8cee31d1941413cdfdf449710c58bce16a3027ac6cd5042199f4 | Python | 16,494 | 519 | """
Utilities for loading MATLAB-exported simulation data and building
MNE-compatible channel geometry / adjacency for NIRS cluster testing.
Supports both standard MATLAB .mat files readable by scipy.io.loadmat and
MATLAB v7.3 files, which are HDF5-backed and require h5py.
"""
from dataclasses import dataclass, field... |
5ee929f8d04db1ac4b111addc9c845bf95e9b1e743039cb3302b35d689029b93 | Python | 16,498 | 404 | # 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 logging
import os
from fair... |
1ccdd98bcec6d2c4c6bc6869168789449d01c8a3a61e81dba25a378242a5accb | Python | 16,516 | 348 | import torch
from typing import Optional, Tuple
import math
import warnings
Tensor = torch.Tensor
import torch.nn.functional as F
def _scaled_dot_product_attention_2d(
q: Tensor,
k: Tensor,
v: Tensor,
attn_mask: Optional[Tensor] = None,
dropout_p: float = 0.0,
twod_tokens: Optional[Tensor] = No... |
919cd207e3075e9b71ea18f427635e754750f2eff9bc609f55feac8cb66dabd2 | Python | 16,521 | 373 | from torch_geometric.data import Data
import torch
import numpy as np
import pickle
from torch_geometric.data import DataLoader
import os
import scanpy as sc
import networkx as nx
from tqdm import tqdm
import pandas as pd
import warnings
warnings.filterwarnings("ignore")
sc.settings.verbosity = 0
from .data_utils imp... |
52d58a21272084c6709e6cf2661d11068f176cd7a05cd6bd2592b7938237a2ff | Python | 16,530 | 411 | import os
from os import makedirs
from os.path import join, dirname, realpath, exists
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from setup import saving_dir
module_path = dirname(realpath(__file__))
def plot_high_genes_sns(df, col='avg_score', name='', saving_dire... |
9e9d1668d0663d7d79fcc04858b31825eb3bd76db73dae0aeffefe31df71c23f | Python | 16,533 | 399 | #
# 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 .wrapper_core import WrapperCore
from simulator.parameters.core_parameter... |
3fe0a8a3d2bb84a4a6e5343d0d2cc1ce75cb4709ced3116caf0a5fe69236cd00 | Python | 16,545 | 423 | import os
import numpy as np
import pandas as pd
import scipy.interpolate
from matplotlib import pyplot as plt
from matplotlib.gridspec import GridSpec
from eogtools.eog import ignore_runtime_warning, plotter_eog, process_eog
from utils.plotting import __cmap_or_cmap_from_color
def blinks_from_eog(edfpath,
... |
1468b771af34e104dc2baedde7621b936911d367f60b459a54ffb0b38912cce9 | Python | 16,546 | 340 | #!/usr/bin/env python3
"""
@file train_npc.py
@author Simon Yu
@date 02/15/2024
@brief Script for training NPC models.
"""
import argparse
import dataset
import header
import logger
import model
import pc
import test_neural
import test_npc
import test_pc
import torch
import tqdm
import utility
import wandb
def ... |
a7d1812b5706a364ea65cecbf513e518a52c14e5067bb67e5219e7c3956bf47f | Python | 16,550 | 475 | """Extensions to torch API for medaka."""
from collections import defaultdict
from dataclasses import dataclass
import math
import os
import pickle
import shutil
import tarfile
from time import perf_counter
import numpy as np
import tensordict
import torch
from tqdm import tqdm
import medaka.common
import medaka.data... |
0c0334cffd5024755fafebe0c6a8ff866f07a1796087f0e9fa498ad9f1bfb748 | Python | 16,553 | 433 | import os
import sys
import math
import torch
import random
import joblib
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
import torch.nn as nn
from torch.utils import data
import scipy.stats as stats
import torch.nn.functional as F
from sklearn import preprocessing
from fairseq import chec... |
40be98a94b3ce66cb6b1fe8f08f6e7182dfc54ff30d8a2272991ddb3141ea204 | Python | 16,556 | 506 | # 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.
"""Implements tracking of constraints for a beam item.
A list of constraints is given as a list of one or more token
sequences, each of lengt... |
d1d4f9ab35a91c87a27816857193cf037338e958603d3f5feeaaf13cf62ec978 | Python | 16,558 | 371 | from itertools import combinations
import pytest
from pgmpy.base import ADMG, DAG, MAG, PDAG
from pgmpy.base._base import _CoreGraph
@pytest.fixture
def AncestralGraph():
"""
References
----------
[1] Zhang, Jiji. "Causal Reasoning with Ancestral Graphs."
Journal of Machine Learning Research 9 (... |
357c964482d6dd4f85a27e7a8ab03dd5ca868309aa102008aa4ee06fa17cc2b2 | Python | 16,564 | 450 | """
Pure data-processing helpers for telemetry/photometry/opto alignment.
No UI framework dependencies — all inputs and outputs are plain Python
types, NumPy arrays, or pandas DataFrames.
"""
from __future__ import annotations
import re
from datetime import datetime
from pathlib import Path
import numpy as np
impor... |
598f7bec08e724ddce31899d511ed5fc617a18d89d4b7902b7dd5169e0d30b39 | Python | 16,583 | 313 | # 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... |
faa6c09e71f03372559f9fae9888cb89c8634bb370a73bbf2f235c34885d09ac | Python | 16,584 | 314 | # 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... |
0c8aae7f4ab69406959f5d7e49be4441e48e35fa38e11e62185ccfbec3cdbdbe | Python | 16,586 | 718 | import os
import csv
import math
import re
import warnings
from pathlib import Path
from concurrent.futures import ProcessPoolExecutor, as_completed
import numpy as np
import torch
from rdkit import Chem, RDLogger
from scipy.spatial import distance_matrix
from torch_geometric.data import Data
from tqdm import tqdm
wa... |
3db84f077cd85a0d25f6781197cfe90188bd8e9655ba4776b2b2ab7f332dded1 | Python | 16,588 | 440 | """Tests for ``packaging/bench_equal.py``, the safe-optimization benchmark/equality harness.
Network-free and Qt-free by design (matches the ``safe-optimization`` skill's pure-logic
scope): timing wrapper, the numpy/polars-aware equality comparator, the speedup calculation,
and the CLI's bench-spec loading.
``packagi... |
c89ecbd03a97d40f9b4ca3491a000c4aa33628067bd2954940358c17184eac5a | Python | 16,598 | 375 | # -*- coding: utf-8 -*-
"""
The :class:`LocalResponseNormalization2DLayer
<lasagne.layers.LocalResponseNormalization2DLayer>` implementation contains
code from `pylearn2 <http://github.com/lisa-lab/pylearn2>`_, which is covered
by the following license:
Copyright (c) 2011--2014, Université de Montréal
All rights res... |
495e5272e14f125c608ce8f535593473788bddf74c507553c79a901c1551e365 | Python | 16,599 | 200 | from nnunetv2.configuration import default_num_processes
from nnunetv2.experiment_planning.plan_and_preprocess_api import extract_fingerprints, plan_experiments, preprocess
def extract_fingerprint_entry():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-d', nargs='+', type=int,
... |
0b2e37b315544d25cdde4026f7d215b9ababa33aa5651b97340d05814c7dd358 | Python | 16,623 | 409 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... |
10468b34836df75a4c51e43c29d3bd8a7ce823d52abd1303e3e0c5d16ee955f2 | Python | 16,623 | 408 | import numpy as np
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import os
from scipy.stats import f_oneway, ranksums
from collections import defaultdict
import statsmodels.api as sm
from statsmodels.formula.api import ols
import pickle
from statsmodels.stats.multicomp import pairwise_tukeyh... |
b5917da016b2b479a29fcadf80dc6d2185c61163dd467440213e514e4b12cc6f | Python | 16,636 | 472 | #!/usr/bin/env python
## - Reference-dependent approach
"""Import modules"""
from __future__ import print_function
import sys
import os
import argparse
import numpy as np
import Bio.PDB
from Bio.PDB import Entity, Chain, Residue, Atom, PDBParser
from Bio.Cluster import pca
from itertools import chain
import time
# fro... |
83cfd831e313e9ad9809e06882ff586a17daea3c83ecd1502bffa8f885b766a6 | Python | 16,637 | 453 | import collections
import itertools
import os
import tempfile
import unittest
import numpy as np
import pysam
import medaka.common
import medaka.datastore
import medaka.labels
import medaka.variant
import medaka.vcf
from medaka.test.test_labels import haploid_sample_from_labels
class TestJoinSamples(unittest.TestCa... |
1a639a560818a6c4198e592ff3af341a121e70d86f79c9e51915dfed89ddee80 | Python | 16,639 | 411 | # Import necessary libraries
import os
import requests
import yaml # PyYAML library for handling YAML files
import re
import json
import threading
from config.PLIPProcessor import PLIPProcessor
from config.PDBInteractionExtractor import PDBInteractionExtractor
from config.PDBSummaryExtractor import PDBSummaryExtractor... |
c5eb6b07613add0b6c742158f783bae6a5149c92d42eb914e82d477114187fc6 | Python | 16,646 | 370 | import os
from pathlib import Path
import joblib
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from scipy.spatial.distance import pdist, squareform
from scipy.stats import rankdata
from sklearn.random_projection import SparseRandomProjection
from analysis.metrics import computeDelta
from... |
8c305b5ebe928e2e6eccd927414dee6dd1125590bd4e9095b2f9d63a21a1ba3f | Python | 16,648 | 538 | from __future__ import annotations
import shutil
from typing import TYPE_CHECKING
from typing import cast
import pytest
from dulwich.client import FetchPackResult
from dulwich.refs import HEADREF
from dulwich.refs import Ref
from dulwich.repo import Repo
from poetry.console.exceptions import PoetryRuntimeError
fro... |
e9932596af2fcd238f092435146a7f8a863a5f704bde9e13e00ea720d1787af6 | Python | 16,653 | 345 | import shutil
from contextlib import contextmanager
import logging
import os
import timeit
import time
import numpy as np
from numpy.lib.format import open_memmap
from mdt.configuration import gzip_sampling_results, get_processing_strategy
from mdt.lib.deferred_mappings import DeferredActionDict
from mdt.lib.nifti impo... |
140b348eb55c806a3c66320fda13f129f9ad9dd1b80ab144b27574a69f6dce7a | Python | 16,656 | 461 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Dequan Wang and Xingyi Zhou
# ------------------------------------------------------------------------------
from __f... |
f65e773371036d387148681721e18fab7dc33201ad9a15e2da102f744263b5ac | Python | 16,670 | 396 | import os
import torch
import numpy as np
import skimage.io as skio
import torch.nn.functional as F
import argparse
# from tqdm import tqdm
import tqdm
from scipy.io import savemat
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import time
from utils import *
import csv
from torch.fft import fftshift, ifft... |
b5ecd4cc6601b82be6ba89b472610f87672ea488e3e21865b5dd1b09eb87b4f9 | Python | 16,676 | 456 | from __future__ import annotations
import json
import re
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import ClassVar
from typing import cast
from cleo.helpers import argument
from cleo.helpers import option
from installer.utils import canonicalize_name
from poetry.co... |
abdbf21d184223ed32012d59a7e9a3d4d26939b604cc89a39ca333f33c5310ea | Python | 16,680 | 303 | """Emit CSV + JSON consolidating all defensible Wave-1 + AL + cross-element
results into machine-readable form for paper writing.
Outputs (under results/wave1_summary/):
rmse_by_dataset.csv
speed_comparisons.csv
engine_costs.csv
cross_element_variance.csv
active_learning_curve.csv
implementations_status.cs... |
4750844eca06513a1f5af3045f3954a95bd30667d39ba3a9cdf2f800efdfe2b6 | Python | 16,685 | 481 | import glob
import os
import random
import sys
import subprocess
import numpy as np
import pandas as pd
import torch
import vaex
from Bio.PDB.Polypeptide import index_to_one
from torch.utils.data import DataLoader, Dataset
import speedtest
from rasp_model import (
CavityModel,
DownstreamModel,
ResidueEnv... |
eacafa9b7bad69915062a111917dc38ddd8ffdbaad1cbcbb781c218d19c9f299 | Python | 16,704 | 451 | # 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 .modules import (
TransformerLayer,
AxialTransfo... |
1c2be13ee4b66d8c340c76ec9e7de82b591c9456d15e6c72fa245d682bf1de5f | Python | 16,715 | 436 | import logging
import os
from pathlib import Path
from typing import List, Union
from tqdm import tqdm
import sys
import h5py
import numpy as np
import open_clip
import pandas as pd
import scipy.io
import torch
import torchvision.models as models
from transformers import DetrForObjectDetection, AutoModelForDepthEstima... |
02ba23baa59bcdf881f88d37e6e9a5fcddf675e3b089d7f76f29e4878bdbaf2d | Python | 16,732 | 438 | """The epoch schedule: optimizer, LR scheduler, early stopping, telemetry.
`Model` computes losses; `Trainer` decides what is done with them. The split is
what lets a model be constructed, loaded and evaluated without carrying an
optimizer, a best-epoch snapshot and a stop counter around with it.
"""
import logging
i... |
2ef8af66cd3f23f4010e5ffe3ae705cf284f26b8c039399063196fb8b09c609f | Python | 16,732 | 490 | """
Self-Supervised Vision Pretraining System (Vol-JEPA)
Implements masked prediction pretraining using a student-teacher EMA framework
with vision transformer backbone. Supports JEPA-style self-supervised learning.
"""
import logging
import copy
import gc
from typing import Dict, Optional, List, Tuple, Any
import to... |
c21a39170a49bece163298b49c95fa8a50c19d3d59190133c013ad5f90ac2b38 | Python | 16,745 | 502 | import os
import shutil
# import functorch.dim
import numpy as np
import torch
import matplotlib.pyplot as plt
import pandas as pd
import math
import torch.nn.functional as F
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import time
from timm.models.layers import ... |
667b411d11a9bbea4c2e75cdec94734ac9a7d774c044b93748e1e6d243072d52 | Python | 16,757 | 511 | from celltype_ibl.models.BiModalEmbedding import BimodalEmbeddingModel
import numpy as np
import torch
import umap.umap_ as umap
import matplotlib.pyplot as plt
import colorcet as cc
from celltype_ibl.utils.c4_data_utils import get_c4_labeled_dataset
from celltype_ibl.utils.ibl_data_util import get_ibl_wvf_acg_pairs
f... |
e36a1920eaf679021794e1c51c4cc90318d3ac6cfb2a23e7aa1a7827683ac8a9 | Python | 16,779 | 400 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 16 13:26:45 2025
@author: vbp
Trial-to-trial ("noise") correlation analysis for Figure 5 and Figure S6.
Fig 5A - baseline noise-correlation scatter plots, one example session
Fig 5B - baseline noise correlation vs. shuffled control, by r... |
8255ea39624e7edf4bd42944ec0c7d96ab76c66944c658d063cd909abf411504 | Python | 16,801 | 503 | import unittest
from pyecharts.commons.utils import remove_key_with_none_value
from pyecharts.options.global_options import (
AnimationOpts,
AngleAxisItem,
AngleAxisOpts,
AriaLabelOpts,
AriaDecalOpts,
AxisBreakOpts,
AxisBreakAreaOpts,
AxisBreakLabelLayoutOpts,
AxisTickOpts,
Blur... |
a5331e4e3a111cf419aff06b5485568a9f0e9d053918b6b3a5df5f2571ab2ae1 | Python | 16,805 | 470 | """Searchlight-based MVPA decoding to predict compositional complexity from estimated betas."""
import os
import glob
from typing import Dict, Union
import numpy as np
import pandas as pd
import nibabel as nib
import click
from glmsingle.gmm.findtailthreshold import findtailthreshold # type: ignore
from loguru impor... |
f9d305973c4c5d0356eebd7394c6b188f7efcf66595643ba468cccb58e154d94 | Python | 16,811 | 414 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... |
ce93e59af29027192dd30864eef26d79f9d11f47b3b37716c1a963b1791dc328 | Python | 16,818 | 414 | import numpy as np
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import os
from scipy.stats import f_oneway, ranksums
from collections import defaultdict
import statsmodels.api as sm
from statsmodels.formula.api import ols
import pickle
from statsmodels.stats.multicomp import pairwise_tukeyh... |
3869e9d5f7284735dcd53cb2b48e0d630b7ec7bf1b5396be595fd51232af5529 | Python | 16,867 | 413 | from typing import Literal
import numpy as np
import torch
import torch.nn.functional as F
from scipy.special import logit
from torch.distributions import Beta, Gamma, Normal
from torch.distributions import kl_divergence as kl
from scvi import REGISTRY_KEYS
from scvi.distributions import NegativeBinomial, ZeroInflate... |
654cc1f7682eb967bb4578a4eb08ec98a676959a3614a3cde559bb0661e5a0db | Python | 16,872 | 514 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
5f40adbfa27fdb61d77fafb527d0c13e2cdb4bb5e9af24ee9566a250947af8e2 | Python | 16,873 | 467 | # -*- coding: utf-8 -*-
"""
@Time:Created on 2019/9/24 15:49
@author: LiFan Chen
@Filename: model.py
@Software: PyCharm
"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import math
import numpy as np
from sklearn.metrics import roc_auc_score, precision_score, recall_sco... |
e37ad620267fc105e10cc5a146cfa339732032c7eb784edfa9459ecaacd7f6f9 | Python | 16,874 | 467 | #!/usr/bin/env python
# ENCODE DCC reporting module wrapper
# Author: Jin Lee (leepc12@gmail.com)
from collections import OrderedDict
def parse_flagstat_qc(txt):
result = OrderedDict()
if not txt: return result
total = ''
total_qc_failed = ''
duplicates = ''
duplicates_qc_failed = ''
mapp... |
c27af5db95ac24d158dbd82fa62536f5c40c214334696e7727889935494a6ef7 | Python | 16,875 | 487 | import numpy as np
import pandas as pd
import statsmodels.api as sm
from pgmpy import config
from pgmpy.models import SEM, SEMAlg, SEMGraph
from pgmpy.utils import compat_fns, optimize, pinverse
class SEMEstimator:
"""
Base class of SEM estimators. All the estimators inherit this class.
"""
def __in... |
eb0577cb8e0c030b8bfd0c89a81262d31ccbd950ddba08c05278a1bddd6a2f8b | Python | 16,881 | 514 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
c6df18d78fb629261a04c8e6cbae7be7d431eb10c57688e643526821129a82c7 | Python | 16,888 | 421 | import collections
import numpy as np
import PIL.Image as Image
import PIL.ImageColor as ImageColor
import PIL.ImageDraw as ImageDraw
import PIL.ImageFont as ImageFont
_TITLE_LEFT_MARGIN = 10
_TITLE_TOP_MARGIN = 10
'''
STANDARD_COLORS = [
'AliceBlue', 'Chartreuse', 'Aqua', 'Aquamarine', 'Azure', 'Beige', 'Bisque',
... |
cb06e73abf739fa21a9c2e0ef0cbf737f6e3cd0ed827c2bd29f33819bcce118a | Python | 16,888 | 536 | from __future__ import annotations
import contextlib
import os
import re
import subprocess
import sys
import sysconfig
from abc import ABC
from abc import abstractmethod
from functools import cached_property
from pathlib import Path
from subprocess import CalledProcessError
from typing import TYPE_CHECKING
from typin... |
33cfd4dd7bd3a44f09f92c3a898dded5f43e74a47aa78d6ad2d963adc0a35259 | Python | 16,890 | 514 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
02bd5660d9be6396880446b39e5f8c18acaf876d2e0c48fa7b4ec139e4f971fd | Python | 16,891 | 456 | # 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.functional as F
from fairseq import utils
from fairseq.iterative_refinement_generator import DecoderOut
from fair... |
991778803dce14249938a3422e7fefe4b4aa11664d217cdf2bf54a713c14207e | Python | 16,895 | 407 | """Contains the processing strategies (and workers) that define how to process a model (fitting and sample).
Globally, this module consists out of two public players, the :class:`ModelProcessingStrategy` and the
:class:`ModelProcessor`. The latter, the model processor contains information on how the model needs to be ... |
e7a8233a7c09ec6bb4b45ca29019fe9d1fb411add20df7f6566f1eb678df4fcb | Python | 16,895 | 381 | """ Chunking videos into usable segments.
Analyzing lengthy video recordings of cephalopod skin behavior can be challenging due to issues such as motion blur, defocusing, and obstructions. \
To address these challenges, the video is divided into continuous segments called "chunks." Each chunk consists of consecutive ... |
9922f680226598d5ec16c5a6146de912b72399a30093fd34ce916bed9bb0a84c | Python | 16,897 | 363 | """Command-line script to create GO term diagrams
Usage:
goatools go_plot [GO ...] [options]
goatools go_plot [GO ...] [--obo=<file.obo>] [--outfile=<file.png>] [--title=<title>]
[--go_file=<file.txt>]
[--relationship]
[--relationships=<part_of>]
... |
95d62ca078bc9ef12bfd0f880247c295459806ff19b7d7a4469dbc60036437f3 | Python | 16,898 | 520 | # 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 torch import Tensor
import torch.nn as nn
from examples.simultaneous_translation.utils.p_choose_strategy impor... |
d06bc64337dbd601854b8b5eec4c46dd3275c15d75b8ba2f9e1c5674752f0f70 | Python | 16,899 | 514 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
ae3474b8875bac3a4c5a09feea3870126b95859322f5bcad84a7d04a98319806 | Python | 16,900 | 414 | """
PyTorch Lightning DataModule for Medical Imaging
Handles data loading, preprocessing, and batching for training and validation.
Supports both image-level and study-level batching strategies.
"""
import logging
import random
import numpy as np
import torch
import pytorch_lightning as pl
from pathlib import Path
fr... |
428b1fa3b88ba172ce1476fb6465b1ff5284b7c83ae7b9543bd46f6e246466bd | Python | 16,908 | 514 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
3de26ec4c72a8cbd8980364f444f374d59bec7c347a577b4b7480b95a88b1dcf | Python | 16,909 | 290 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pylab
import re
import os
import glob
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from optparse import OptionParser
FOLDERNAME_GENERATE = "learning_generation"... |
5b5248e029b1b9d0aea78bf341471fc20eab7070cffaa6cbfbdc8fed8301579b | Python | 16,910 | 452 | import numpy as np
import torch
from torch_geometric.nn import knn_graph, radius_graph
from torch_geometric.utils import add_self_loops, dense_to_sparse, to_undirected
from torch_geometric.data import Data, Batch
from torch.utils.data import Dataset
from collections import namedtuple
import scipy.sparse
from scipy.spat... |
d6167aafb36751c49978f512e07e0bc44dd75e3059eeec7bddc2261450126077 | Python | 16,911 | 516 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
f5f87c95e91b1cdca95deea16c73402ea2638aea17cd70955567b1adf78b142c | Python | 16,922 | 426 | from functools import lru_cache
import math
from typing import Optional
from einops import rearrange
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torch.nn.modules.transformer import _get_clones
from flash_attn.flash_attn_interface import flash_attn_unpadded_qkvpacke... |
ede220e12cec780899982af4bd7701a6a53a027609ff52539be89b8b7a06ec1f | Python | 16,935 | 367 | import warnings
import numpy as np
from pathlib import Path
from bombcell.loading_utils import get_gain_spikeglx
def get_default_parameters(
kilosort_path,
raw_file=None,
kilosort_version=4,
meta_file=None,
gain_to_uV=None,
):
"""
Creates the parameters dictionary
Parameters
----... |
8c49d4bdc11c74c74cdd7658bbd6955e953c2f442759718d6b46e8ebc2b45cae | Python | 16,955 | 461 | # NeuriteKymoGeneration: generate multi-channel kymographs from ROI zips.
# Outputs: <imagebase>_kymo\*roi###.tif (multi-channel kymographs).
# ROI zip naming: <image filename>_RoiSet.zip (includes extension).
# Beginner note:
# 1) Pick a root folder with image files.
# 2) Script scans all subfolders for matching image... |
0939fe3d26dcb1f18b7f90fc6d721cc61b1e17959bf155f053bb69dcb9eace6a | Python | 16,971 | 454 | # 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 typing import List, Optional
import torch
from torch import nn
from fairseq import utils
from fairseq.data.data_utils im... |
3d8e24e35772360241ee710e2ad5ba9d464c0a75b642b49f7a3c88ccb3a76cc9 | Python | 16,989 | 473 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# author: adefossez
import math
import time
import torch as th
from torch import nn
from torch.nn import functional as F
... |
9ee623802d22d8cc1e30abbb7325b11fd7036d387433e9b6ed27107d8393bb0e | Python | 17,005 | 439 | import numpy as np
import cv2
from scipy.ndimage import gaussian_filter
import pandas as pd
from collections import defaultdict
import matplotlib.pyplot as plt
import os
from scipy.ndimage import gaussian_filter
from mpl_toolkits.axes_grid1 import make_axes_locatable
import pickle
from matplotlib.colors import ListedCo... |
13b3c3177ab1c7e38d59bb93e41aa22781094cd64b4596ec1d27acaa3eb49dc2 | Python | 17,009 | 407 | # Load required packages
# import pandas as pd
import json
import os
import subprocess
import sys
from glob import glob
from absl import app, flags
from anarci import anarci
from scripts import parse_tcr_seq, pdb_utils, pmhc_templates, seq_utils, tcr_utils
# import shutil
# input
flags.DEFINE_string('output_dir',... |
6880b024882a942de51da74430e6cecbf6852f84fe4cc22fdd3d87e730774a7f | Python | 17,017 | 491 | # 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 itertools
import os
from typing import Sequence, Tuple, List, Union
import pickle
import re
import shutil
import torch
from pathlib imp... |
3acf6ddaa1d951c84a61f3bd504f66868a2f9fe0ab44a822331aa54fcf9d9616 | Python | 17,033 | 521 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Models"""
import os
import datetime
import warnings
from pprint import pprint
from typing import Any, List, Literal, Optional, Tuple, Union
import numpy as np
__all__ = ["Cell", "Region", "Image"]
BRAIN_REGION_OPTIONS = ["BG", "CC", "CORTEX", "SWM", "THALAMUS", "HI... |
2ff7d28e46cfd50a207728fbb50464665d8efb3578abbb86a1efb0475f59820d | Python | 17,063 | 354 | """Page 2: Pipeline Benchmark."""
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, format_acc, style_figure
def _rebuild_subject_pipeline(sdf: pd.DataFrame) -> pd.DataFrame:
"""Recompute subject_... |
4615beb33fdf6d9d515ee224a53915e82d07451743b26497c6387dc07fa7e732 | Python | 17,064 | 521 | """This module is adapted from https://github.com/Open-Catalyst-Project/ocp/tree/master/ocpmodels/models
"""
from functools import partial
from torch import Tensor
import torch
import torch.nn as nn
from torch_scatter import scatter
# from torch_geometric.nn.acts import swish
from torch.nn.functional import silu as s... |
17e54ebc8d607dd53a57e274385b0b0e6f3a22f0a3bb3714c637805a215f6a34 | Python | 17,068 | 441 | """Controller for telemetry graph display widget setup and mode switching."""
from __future__ import annotations
import logging
import re
from pathlib import Path
import matplotlib.pyplot as plt
from matplotlib import cm
from PySide6.QtWidgets import QFrame, QHBoxLayout, QPushButton, QVBoxLayout, QWidget
from src.g... |
70cf1b3713609e367f585aee0ca517290ceb994ccfa699b55a607d3adad270b0 | Python | 17,068 | 589 | import json
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import Mock
import numpy as np
import pandas as pd
import pytest
import torch
from transformers import TrainingArguments
import gpn.inference as shared_inference
import gpn.msa.data as msa_data
import gpn.msa.inference as msa_in... |
afcfc95516c3ccdb344367dffc449dcdd86976f6b8e93bcc570ef7c481ccc1ca | Python | 17,071 | 380 | import torch
import torch.nn.functional as F
import math
"""
1.内存效率提升:原始实现需要扩展所有中间变量来执行不同的激活函数,而此代码中将计算重新制定为使用不同的基函数激活输入,
然后线性组合它们。这种重新制定可以显著降低内存成本,并将计算变得更加高效。
2.正则化方法的改变:原始实现中使用的L1正则化需要对张量进行非线性操作,与重新制定的计算不兼容。
因此,此代码中将L1正则化改为对权重的L1正则化,这更符合神经网络中常见的正则化方法,并且与重新制定的计算兼容。
3.激活函数缩放选项:原始实现中包括了每个激活函数的可学习缩放,但这个... |
af061ac7b9c1bc9c9f6b41937b2d8424a15da1fda60b51fa50edd14029bd8118 | Python | 17,076 | 387 | import pytorch_lightning as pl
from typing import Any, Dict, List, Optional, Type
import torch
import segmentation_models_pytorch as smp
import wandb
from pytorch_lightning.loggers import WandbLogger
import pandas as pd
import zarr
from pathlib import Path
class NFTDetector(pl.LightningModule):
def __init__(self,... |
46af9e355a3765421735951fe9fa129b7db4cb3658ee9f620bda5838f0c45887 | Python | 17,078 | 386 | import sys
import os
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as sstats
import argparse
import pandas as pd
import json
# Examples:
# python qq.py MSA_MSA_2016_lift_noMHC_correct_case_control.csv.gz --strata CTG_COG_2018.csv.gz --strata-num PVAL --to... |
cdfe729987e02ca621ded45194600e5690f4d2e19607412328e36214f0edaf02 | Python | 17,081 | 310 | #!/usr/bin/env python3
"""Figure 5: single-cell validation with the current evidence hierarchy.
The heatmap separates two inverse-concordant Tier-1 genes,
ten Tier-2 auxiliary inverse-concordant genes, five non-concordant proteomic
anchors, and three contextual immune genes. Panel C uses the same colours.
"""
import ... |
7a89bb1eb4cebbb51f936dfd7becf99e4ad156b0a3988c83927d2036a59896cb | Python | 17,097 | 457 | """Surface plotting functions.
NB: Code in this module is a copied subset from:
https://github.com/MICA-MNI/BrainSpace/blob/master/brainspace/plotting/surface_plotting.py
Code has been modified (lines 30-31) just to accommodate extra orientations
('anterior', 'posterior').
"""
# Author: Oualid Benkarim <oualid.ben... |
82e3422e3f8e60860de5abb292b99c9eda13b703fb2e0ec8dadb09dbad739157 | Python | 17,105 | 475 | """Conventional ANN layers based on pytorch."""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torch.nn import init
from torch.nn.modules.utils import _pair
from torch.nn.parameter import Parameter
def conv2d_fa_backward_hook(
module: nn.Module,
... |
8a0d33d36c1338500a793632f8a6fadb4dfe059fa7483f8be23b74b79be66756 | Python | 17,126 | 298 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MapSpecificOptions.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MapSpecificOptions(object):
def setupUi(self, MapSpecifi... |
b1037bca05578303e468cbc449c568e797c5b35257f66602d8e1919b4518309b | Python | 17,130 | 411 | # utils/clustering_utils.py
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import threading
import warnings
import evfuncs
from matplotlib import cm
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg, NavigationToolbar2QT
from scipy import interpolate
fro... |
9b6c4e1b7f7e7339d18ac313d27c3741f7bd08657f45099ecc7774128c9b89b4 | Python | 17,157 | 486 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
from os import getpid
import numpy as np
import nibabel as nib
# from dipy.tracking.streamline import compress_streamlines as compress_streamlines_dipy # for dipy 1.5 resulting in impor... |
5e5e1c33aa940fe41818ec9d7a59ac9795324d337d17f8e6d960b4c72557f6a3 | Python | 17,166 | 464 | """
This module contains methods used to make pulses after PulseInterface decide,
which pulse is to be made.
"""
"""
Copyright (c) 2019, 2022 [copyright holders here]
This file is part of NoSeMaze.
NoSeMaze is free software: you can redistribute it and/or
modify it under the terms of GNU General Public License as
p... |
a939fca4d46d96ceec69213b5fc49e82aceecf53b8e350b6ad9f9e88a086c52e | Python | 17,169 | 367 | #!/usr/bin/env python3
"""Le a varredura de EOS, ajusta Birch-Murnaghan e reporta a0, B0 e o gap.
Uso:
python3 postprocess_eos.py --work run_eos
python3 postprocess_eos.py --work run_eos --csv eos.csv --json eos.json
Saidas:
eos_pontos.csv uma linha por ponto (E, V, gap, VBM, CBM, status)
eos_ajuste... |
d94db2c422f55882b0220d34c7de044de7de7264e6a4f3f5304c0263960c6610 | Python | 17,171 | 449 | from __future__ import annotations
from collections import OrderedDict
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.