sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
8d19f1254c271fb4cf17bd32bdeca0e89d28e5391ba635364634a2238ddd9e1d | Python | 5,922 | 189 | from __future__ import annotations
import platform
from typing import TYPE_CHECKING
import pytest
from poetry.utils._compat import WINDOWS
from tests.helpers import pbs_installer_supported_arch
if TYPE_CHECKING:
from cleo.testers.command_tester import CommandTester
from poetry.config.config import Config... |
dfc0bb36e05b0d865f3f6f7712b6d869b3aa1b1737d1684306c8f7bec28c3137 | Python | 5,923 | 130 | class StateNameMixin:
"""
This class is inherited by classes which deal with state names of variables.
The state names are stored in instances of `StateNameMixin`. The conversion between
state number and names are also handled by methods in this class.
"""
def store_state_names(self, variables,... |
9cf05754650ff246dea0ff8a9af5474c9340ffad4ce1176529289fc9096def41 | Python | 5,928 | 145 | import os
import torch
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from torch_geometric.loader import DataLoader
from sklearn.metrics import mean_absolute_error, mean_squared_error
from scipy.stats import pearsonr
from tqdm import tqdm
from model import GeometryAwareGNN
... |
ae8ef3348269ef11e494f85ee52654c944bec2ae253f602e42638bb3d269584f | Python | 5,930 | 123 | # Source code:
# https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/main.py
# This file includes the modifications to the source codes according to this project!
import os
import time
import yaml
import argparse
import precision
import logging
import utilities
import calculate_g... |
a155c51ec2b9b825694fabf3c771ac1c0703cb424308b265bc64c4854358a0f5 | Python | 5,934 | 197 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 22 09:17:17 2022
@author: vbp
Figure 1B: region-specific dopamine dynamics (mPFC, BLA, NAc_lat, DS)
aligned to reward delivery, with lick raster.
Download the data @ https://doi.org/10.17605/OSF.IO/DV724
"""
import os
import sys
import json
impo... |
5ad49b0d9b46713ef45d9e6f6669cb8b18cb1adba609206807b97b5f70b51d86 | Python | 5,939 | 168 | """Forward laplacian of linear solves.
``A^-1`` appears in the derivatives of both ``A^-1 b`` and ``A^-1``, so a single
inverse serves the jacobian and the laplacian of either.
"""
from typing import Any
import jax.numpy as jnp
from .api import JAC_DIM, Array, ArrayOrFwdLaplArray, FwdJacobian, FwdLaplArray
from .ut... |
415c151f86a660a28a452325ac8e251aa53dc90d8421f5f814ae211427df22ff | Python | 5,942 | 162 | """Per-epoch wall times, recovered from a training run's progress bars.
The training loop computes epoch seconds but only ever sends them to MLflow, so
a run without a tracking server keeps the number to itself and the tqdm bars
are the only record on disk.
Both passes draw a bar labelled `Batches` and the training p... |
39bab97201b5dbcf6ef48f2cf4a60c4b1753674080d477d041fc9ddc38288ff3 | Python | 5,945 | 125 | import os
import yaml
import fnmatch
import json
import shutil
import time
import argparse
import precision
import calculate_gain
import utilities
import logging
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="Path to input (train) file")
... |
d026634243dfc10a01421ca580c7d3621e6a57ee0692ce0d1a9d650d19b27318 | Python | 5,946 | 170 | import typing
import argparse
import os
import multiprocessing as mp
import sys
import signal
import torch
import torch.distributed as dist
from torch.multiprocessing import _prctl_pr_set_pdeathsig # type: ignore
from ..errors import EarlyStopping
def reduce_scalar(scalar: float) -> float:
if dist.is_available... |
e8758752a390c873296c3860d24f66fadd75e13400e53ac2053a91cd57f8ae68 | Python | 5,950 | 128 | import sys
from os.path import join, dirname, realpath
current_dir = dirname(realpath(__file__))
sys.path.insert(0, dirname(current_dir))
import os
import imp
import logging
import random
import timeit
import datetime
import numpy as np
import tensorflow as tf
from utils.logs import set_logging, DebugFolder
from config... |
b457a34e02e81596d7b211f647d4bcf564984ceb808cc308407fae38bd0d38c9 | Python | 5,951 | 104 | from batchgenerators.dataloading.single_threaded_augmenter import SingleThreadedAugmenter
from nnunetv2.training.data_augmentation.custom_transforms.limited_length_multithreaded_augmenter import \
LimitedLenWrapper
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
from nnunetv2.utilities.defa... |
bb566bd12a8f9e123d20c9997690248286fc86251ccc5502bb2bd17b1b08eee3 | Python | 5,951 | 178 | from collections.abc import Sequence
from dataclasses import dataclass, replace
from typing import TypeAlias
import numpy as np
from typing_extensions import Self
from ..molecule import Molecule
ZMatrixLine: TypeAlias = tuple[tuple[int, float], ...]
@dataclass
class ZMatrix:
total_charge: int
total_spin: i... |
665024500778fd53e3b3ae7718c8892d55044db03b477900cdc5a0edfb4d3de9 | Python | 5,955 | 157 | import argparse
from itertools import permutations
import deepdish as dd
import numpy as np
from geopandas import GeoSeries
from shapely.affinity import rotate
from shapely.geometry import Point, Polygon
from spacestream.core.paths import DATA_PATH, RESULTS_PATH
from spacestream.utils.get_utils import get_mapping
d... |
bd4ed661d9dcd67b3f0bbbc96c641142daa793364dac08e9bb320d3c86c87eec | Python | 5,957 | 191 | # 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... |
71f8232a280fa8d53890734236969a21a0c051e7a871f4477e4d9ae15e1ae94e | Python | 5,963 | 123 | # Source code:
# https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/main.py
# This file includes the modifications to the source codes according to this project!
import os
import time
import yaml
import argparse
import logging
import utilities
import precision
import calculate_g... |
edd0b33156bcc202bee9b2c633ad839772cf5fb8fe8b07ba859d2b613ba115c4 | Python | 5,963 | 120 | #!/usr/bin/env python3
"""O gap com descritores de DOS: oraculo, circularidade e o que sobra de util.
ADVERTENCIA DE CIRCULARIDADE, declarada antes de qualquer numero. O gap E uma
propriedade da DOS -- e a largura da regiao vazia em torno de E_F -- e o
`DOS_VBM` so pode ser avaliado sabendo onde esta o VBM, isto e, sa... |
8609b32199e64e5d0fcd151d3b2a0612c00ffba67f92c74869ca0a1349cad0f6 | Python | 5,969 | 147 | ## script for plotting boxplots and scatter plots of simple stats such as count of approaches, count of interactions, chasings etc...
import matplotlib.pyplot as plt
import numpy as np
import igraph as ig
import networkx as nx
import pandas as pd
import os
import sys
import pandas as pd
import seaborn as sns
from scip... |
0002c30888fa1dd3a0cacde85610509c2ca735d2feb560d39378b1d736f7d85e | Python | 5,971 | 157 | import os
import pickle
import numpy as np
import pytest
import torch
from scvi.data import synthetic_iid
from scvi.data._constants import ADATA_MINIFY_TYPE
from scvi.data._utils import _is_minified
from scvi.model import LinearSCVI
from scvi.utils import attrdict
def test_saving_and_loading(save_path):
def leg... |
0465fe533b1da05dcf2317ae5892fa0f98de38a5375d9e07f3a9c5429b4a8e6c | Python | 5,979 | 186 | from __future__ import annotations
import logging
import time
from pathlib import Path
import numpy as np
from .df_common import (
missing_columns,
raise_missing_columns,
read_analysis_output,
)
from .pfer_detection import (
DEFAULT_ART_THRESHOLD,
DEFAULT_PROMINENCE,
PFerResult,
analyze_s... |
8d5eb7aba1f6cb8e58eca1733abbefd015288316d40ddbb49504b9c3d7e3a748 | Python | 5,980 | 123 | # Source code:
# https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/main.py
# This file includes the modifications to the source codes according to this project!
import os
import time
import yaml
import argparse
import logging
import utilities
import precision
import calculate_g... |
c49d82a605e447675a24ecf1adfe7d29ec37495078bf58533375c31a99aa5603 | Python | 5,984 | 142 | import torch
import torch.optim as optim
import torch.nn as nn
from sklearn.metrics import accuracy_score
import numpy as np
import os
def train_model(model, train_dataloader, val_dataloader, criterion, optimizer, device, checkpoint_dir, log_dir, num_epochs=5, patience=2, log_interval=500):
# Open log files
tr... |
efaa6cb76b851dd321e2c813cb454fd205b970ebc5512d2c86499414afe62c42 | Python | 5,984 | 147 | import qt, vtk, slicer
import numpy as np
from ..Widgets.ToolWidget import AbstractToolWidget
from ..Effects.CircleEffect import AbstractCircleEffect
from ..Helpers import GridNodeHelper
class SmudgeToolWidget(AbstractToolWidget):
def __init__(self):
toolTip = 'Click and drag to deform the image'
A... |
1c8a12ec1c6565c340af69cc60fa92c8ba802a95e55654e8d130098a6922af88 | Python | 5,986 | 152 | import haiku as hk
import jax
import jax.numpy as jnp
import jax.numpy.linalg as jnp_linalg
from ..geom import masked_pairwise_distance
from ..types import (
ElectronConfiguration,
ModelDimensions,
MolecularConfiguration,
Nuclei,
ParallelElectrons,
Psi,
)
from ..utils import masked_mean
from .b... |
cef344f2d0837266e1063f383a487bc534b48f1ed5813d2a994421ce6fd40ca2 | Python | 5,987 | 216 | import os
import csv
import torch
import numpy as np
from pathlib import Path
from rdkit import Chem
from scipy.spatial import distance_matrix
from torch_geometric.data import Data
from tqdm import tqdm
from rdkit import RDLogger
from concurrent.futures import ProcessPoolExecutor, as_completed
import warnings
warnings... |
45decdb8bc2bba829651dcf3bc60947013bfe1379a0b2cfa33bccc1af5d43505 | Python | 5,988 | 151 | import torch
from nnunetv2.training.loss.dice import SoftDiceLoss, MemoryEfficientSoftDiceLoss
from nnunetv2.training.loss.robust_ce_loss import RobustCrossEntropyLoss, TopKLoss
from nnunetv2.utilities.helpers import softmax_helper_dim1
from torch import nn
class DC_and_CE_loss(nn.Module):
def __init__(self, soft... |
b07da0751a71f3460a880cf7520cd069973d61b7e7e59d36a9251bdd11d2eb04 | Python | 5,989 | 182 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 11 15:14:45 2024
@author: tower2
"""
import torch
import os
import random
from datetime import datetime
import numpy as np
import copy
import scanpy as sc
import matplotlib.pyplot as plt
import pandas as pd
from pathlib import Path
from .preprocess ... |
fe602e74e051dd9a2063fc11f76e59eeca83e9d27e290cc2a7788ec1bb5c108d | Python | 5,989 | 206 | from __future__ import annotations
import logging
import time
from pathlib import Path
import numpy as np
from src.processing.behaviour_metrics import compute_full_trace_zscore
from .df_common import (
BUTTER_CUTOFF,
BUTTER_ORDER,
SAVGOL_COARSE,
SAVGOL_FINE,
butter_lowpass_filter,
compute_ad... |
b29c6ad0a45641d5334c2af1557bcdc3d353a1baa053c658e77271b2b8c97e16 | Python | 5,991 | 138 | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
# Helper functions for weight initialization (copied from 3d-closeness/model.py)
def weights_init_kaiming(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
nn.init.normal_(m.weig... |
06425569e3cfba6c24295f261e9a9d86fd997184b4fc261b438b02e55b524500 | Python | 5,992 | 169 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Adapted from https://github.com/yang-song/score_sde_pytorch which is released under Apache license.
Key changes:
- Introduced batch_idx argument to work with graph-like data (e.g. molecules)
- Introduced `..._given_score` methods so that mult... |
84726482e83a63328bbf02c9bb0cdfd51ec8c1b7870c4369b2136e3d2ac7ccb7 | Python | 5,993 | 167 | import torch
import torch.nn as nn
from operator import itemgetter
from torch.autograd.function import Function
from torch.utils.checkpoint import get_device_states, set_device_states
# for routing arguments into the functions of the reversible layer
def route_args(router, args, depth):
routed_args = [(dict(), dic... |
fbe45a142e245c909b59303f0b39fdddd79a7d08fd42dabf76bac1338670ef8b | Python | 5,996 | 166 | from typing import Literal, Optional
import torch
from torch import nn
from einops import rearrange
from .import_utils import is_flash_attn_2_available
ATTN_METHODS = Literal["homemade", "flash-attn", "pytorch"]
FFN_TYPES = Literal["gelu", "swiglu", "geglu"]
LAYERNORM_TYPES = Literal["normal", "rmsnorm"]
GATED_ACT... |
36b71b1532f036ed6a8d0e82e753cfc17cb7d56c8a3729cf8550710249848318 | Python | 6,001 | 234 | #!/usr/bin/env python
# Author_and_contribution: Niklas Mueller-Boetticher; created script
import argparse
parser = argparse.ArgumentParser(
description="""SpaGCN (https://www.nature.com/articles/s41592-021-01255-8)
Requirements: Visium or ST. Images can be used."""
)
parser.add_argument(
"-c", "--coordinat... |
7792a3f4367fd39a95a3aa3bab24fb3ba256740f89b7be3bb18da79acebebfb2 | Python | 6,004 | 166 | from collections.abc import Iterable
from pgmpy.base import DAG
class SimpleCausalModel(DAG):
"""
A specialized DAG class for simple causal models.
This class simplifies the creation of causal graphs commonly used in causal inference,
where the structure consists of exposures, outcomes, confounders,... |
191b6054ffa47639a41052b5c9bdd040a17364a9f4c70640185b4cd76f1d4488 | Python | 6,007 | 193 | """
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 ..utils import read_value_json, update_json
class AutomaticFit:
"""
All added variables are proc... |
7e7e1cae4bb7870530340adbae79826ef7a3098604a1344bda0466151f9f6515 | Python | 6,008 | 160 | from __future__ import annotations
import logging
import os
import platform
import sys
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING
from installer import install
from installer.destinations import SchemeDictionaryDestination
from installer.sources import WheelFile
f... |
a0f0bcc57653dfcbcccde8ddc11c8d95a9bcafc103ca2c0d064f80e2869401b1 | Python | 6,008 | 151 | """Active learning iteration 2 — 50 picks restricted to non-strain regime.
Training pool: all 143 SIESTA-labelled records (initial 93 + AL iter 1 of 50,
including strained ones — the strain labels still carry some signal for 1F+2F
predictors even when the model can't fit the strain regime well).
Candidate pool: GFN-F... |
413a9f3b751d176aa3f431b9f92f6afdf81dbd7efa5091aa952211f6fe6bb798 | Python | 6,010 | 176 | """Extract numerical signal windows around behaviour events."""
from __future__ import annotations
import numpy as np
import pandas as pd
TIME_AXIS_DECIMALS = 3
BOUNDARY_TOLERANCE_MIN = 0.001 / 60.0
def _prepare_signal_and_time_columns(
df: pd.DataFrame,
column: str,
z_scored_data=None,
) -> tuple[pd.D... |
0c23eaab4801e9a32794d309e1df0c8ed578400aae746f8fe14776f902a8e7a7 | Python | 6,021 | 173 | import os
import ot
import torch
import random
import numpy as np
import scanpy as sc
import scipy.sparse as sp
from torch.backends import cudnn
#from scipy.sparse import issparse
from scipy.sparse.csc import csc_matrix
from scipy.sparse.csr import csr_matrix
from sklearn.neighbors import NearestNeighbors
... |
320645ffbb47aaf82638d8f81e36671233c450e5451caaa7a03e60985eea5cbd | Python | 6,025 | 136 |
from PyQt5.QtWidgets import *
import os
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import cv2 as cv
import numpy as np
import sys
from scipy import stats
##需要尝试直接对.png的图片进行伪彩图展示还是用一个stack中的图片展示
class tTestMap(QWidget):
def __init__(self):
super(tTestMap, self).__init__()
se... |
29b6b50f84c847117c3aa9c1eb6c3e0a37fe9a1b2fd6d39500c4a51dce7f578c | Python | 6,026 | 188 | import numpy as np
import pytest
from mock import MagicMock, patch
from pgmpy.factors.discrete import DiscreteFactor, State, TabularCPD
from pgmpy.inference import VariableElimination
from pgmpy.models import DiscreteBayesianNetwork, DiscreteMarkovNetwork
from pgmpy.sampling import GibbsSampling
@pytest.fixture
def ... |
3e56a8bc324994df96c7ccef1f5b65803091f241d7fb08a4b724249557d13093 | Python | 6,027 | 167 | import numpy as np
import pandas as pd
import altair as alt
from altair import VConcatChart
def get_total_pos(df: pd.DataFrame) -> pd.Series:
return df.sum(axis=0)
def get_total_neg(df: pd.DataFrame) -> pd.Series:
return df.sum(axis=0)
def get_cnorm_pos(df: pd.DataFrame) -> pd.DataFrame:
total = get_... |
4c714c4e84fe5c7fc213a02f46d4c14f71a1cfedd9e2ab80348d63afc8cc6bd4 | Python | 6,029 | 197 | """
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/radial_basis.py.
"""
import math
import numpy as np
import torch
from scipy.special import binom... |
b378c01f23791e3cd6a43b904a0685dcfc4fe852d10fc551e33a5ce52f0e2e1b | Python | 6,029 | 152 | """
taken from: https://github.com/karpathy/minGPT/
GPT model:
- the initial stem consists of a combination of token encoding and a positional encoding
- the meat of it is a uniform sequence of Transformer blocks
- each Transformer is a sequential combination of a 1-hidden-layer MLP block and a self-attention block... |
93e825e0b6efda01ac83269dc93e6156706c617873e8970dde2092358efc76a1 | Python | 6,030 | 207 | """Definitions of the free parameters.
The free parameters are meant to be used for parameters that one wants to optimize. They can be fixed to a certain
value to disable them from being optimized in a given situation, but they remain classified as 'optimizable' parameters.
"""
from mdt import FreeParameterTemplate
f... |
60512b8c970b170962c34ac59fa66ac08cda66af6a79388dd6e55f47a93439e0 | Python | 6,031 | 184 | import sys
import click
import dask.array as da
from matplotlib import pyplot as plt
import numpy as np
import torch
from tqdm import tqdm
import xarray as xr
from kornia.contrib import combine_tensor_patches, extract_tensor_patches
import zarr
import time
import os
import shutil
from torchaudio.io import StreamReader
... |
1c2fda238ee5fcf174b8a593b83ae5d59e66dfe840362f640248d3d7d5967aee | Python | 6,034 | 163 | # Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors
import os
import json
import csv
import pickle
import numpy as np
import matplotlib.pyplot as plt
from pymbar import MBAR, timeseries
from tqdm import tqdm
import pandas as pd
from pathlib import Path
# Constants
TEMPERATURE = 298.15 # Ke... |
12ccd282521394365138b2c58222efbd68c44e8d02ddf39646e8f78a7215993b | Python | 6,036 | 154 | from __future__ import annotations
import numbers
from typing import Any
import networkx as nx
import numpy as np
import pandas as pd
from pgmpy.base import DAG
from pgmpy.datasets._base import BaseSimulatedDataset
from pgmpy.utils._warnings import _warn_external
class AdditiveNoiseModel(BaseSimulatedDataset):
... |
170130551f3b615e9645b665f20dbc6c58de74f7db8e01f804dd05eb3296a1dd | Python | 6,036 | 165 | import cPickle
import logging
import os
import time
from keras.models import Sequential
from matplotlib import pyplot as plt
def save_model(model, filename):
print 'saving model in', filename
f = file(filename + '.pkl', 'wb')
import sys
sys.setrecursionlimit(100000)
cPickle.dump(model, f, protoco... |
d1de5f4320eb7436cf6d4bc23733152da74499d871f4230c7b48e29f43790a04 | Python | 6,037 | 167 | # 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.functional as F
from fairseq import utils
from fairseq.criterions import LegacyFairseqCriterion, reg... |
92948d7c21dcc420289d0975c35c64fa4af8420c08e12aa797ecd88cec50f3d1 | Python | 6,039 | 179 | # 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 os
import typing as tp
import unittest
from collections import Counter
from tempfile import NamedTemporaryFile, TemporaryDirectory
fro... |
4206c90a8fae098e6484e059057dc908ceece4d0612277a242f193f4d8e4508a | Python | 6,040 | 191 | """
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/scaling.py.
"""
import logging
import torch
from mattergen.common.gemnet.utils import read_valu... |
705d26042b19a33d123403e377b4fcc152582301ae0eb09951b1c13e88bcf5a8 | Python | 6,040 | 145 | # -*- coding: utf-8 -*-
# Title : model_entry.py
# Created by: julse@qq.com
# Created on: 2022/7/13 18:56
# des : TODO
from tkinter import Variable
import torch
import torchsummary
from msm.modules import TransformerLayer
from torch import nn, Tensor
from model._0713.resnet import BasicBlock, SENet, Snap2Block, S... |
3d1c60468367ca743a42a2cf8092471dab403a62796dc9874c3ff5df70635240 | Python | 6,041 | 130 | #!/usr/bin/env python
import os
import sys
import csv
import argparse
import pandas as pd
import logging
csv.field_size_limit(sys.maxsize)
if not os.path.exists("../data/logging"):
os.makedirs("../data/logging")
logging.basicConfig(filename='../data/logging/obsolete.log', filemode='w', level=logging.DEBUG)
cl... |
b78eba6801dfe0230602247c0f116d9fa2dbd85b287defc7cad4e4e4efa76017 | Python | 6,041 | 131 | import argparse
import multiprocessing
import shutil
from typing import Optional
import SimpleITK as sitk
from batchgenerators.utilities.file_and_folder_operations import *
from nnunetv2.paths import nnUNet_raw
from nnunetv2.utilities.dataset_name_id_conversion import find_candidate_datasets
from nnunetv2.configuration... |
bf0f9b401c86c4ee86e89af0bb1b92df3277f6cd33c3afb3c5d0540f41a11769 | Python | 6,043 | 155 | #!/usr/bin/env python3
"""Run independent calculation rows concurrently in isolated copies."""
from __future__ import annotations
import argparse
import json
import subprocess
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
try:
from .common import (
D... |
ef61941a041fc2e4899d43b8fe71cb20f51508d3cf9ea6a7c94cbe808098d8e8 | Python | 6,047 | 179 | import os
import pdb
import torch
import sys
import h5py
import numpy as np
import subprocess, re
from build import *
# Nvidia-smi GPU memory parsing.
# Tested on nvidia-smi 370.23
def run_command(cmd):
"""Run command, return output as string."""
output = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=T... |
3cf496ff535bc55efc03a61a1f524bc42bc8b47939dfd5dae7683dafbb0709d8 | Python | 6,051 | 155 | from config import *
PATH_SOURCE = Path(__file__).parents[2]
sys.path.insert(0, str(PATH_SOURCE/Path('source')))
from field_computation import FieldComputation
from construct_model import construct_model
from input_data_from_mesh import prep_input_data
from plotting import plot_mesh, plot_field, img_plot, plot_energy... |
c939029f12aacdd8fd80c13879328bfd5d47bf76dda61a848863c57cc3173074 | Python | 6,051 | 181 | #!/usr/bin/env python
# ENCODE DCC MACS2 signal track wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
from encode_lib_common import (
get_num_lines, log, ls_l, mkdir_p, rm_f, run_shell_cmd, strip_ext_ta)
def parse_arguments():
parser = argparse.ArgumentParser(prog='ENCODE ... |
df26d87ce918b1635e270a21790da9d6b5d7a7625bcbd8fa5f6b4f399303036f | Python | 6,057 | 206 | import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import os
import glob
import tables
import pickle
import numpy as np
import pandas as pd
def process_hdf(path, mode, CONTROL=False, index=0):
os.chdir(path)
decoder_files = glob.glob('*.pkl')
if CONTROL==False:
... |
4c666acfdc194a15f9cc7bba53875d777ce3501b426c94e53ce4cfb6e30cb199 | Python | 6,058 | 183 | import unittest
from contextlib import ExitStack
from typing import Iterable
from pyecharts.charts import Bar, Line, Page
from pyecharts.commons.utils import OrderedSet
from pyecharts.globals import ThemeType, CurrentConfig
from pyecharts.components import Table
from pyecharts import options as opts
from pyec... |
dd7e66b6f6a87acca5b4fcc45d7d0009f544fadf0d468bfce5db57a87c02ce00 | Python | 6,060 | 174 | import matplotlib.pyplot as plt
import glob, os
from pathlib import Path
import pathlib
import numpy as np
from matplotlib.lines import Line2D
import matplotlib.patches as mpatches
# from scipy.interpolate import make_interp_spline, BSpline
import matplotlib.lines as mlines
import pandas as pd
import scipy as sp
import... |
4533bad0f0b1a0b0548b3855c7dcdfca8a7c10a2d41ffde5f345a3775ef5ca0b | Python | 6,061 | 184 | from __future__ import annotations
import json
import os
import re
import sysconfig
from contextlib import contextmanager
from copy import deepcopy
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import TypedDict
from poetry.utils.env... |
2bd2a493f0377d32f37a5bfcb341336fcc97efa5422d3cc4b99d06f1c03f02da | Python | 6,062 | 156 | import pickle
import numpy as np
import matplotlib.pyplot as plt
import os
num_components = 3
numBins_protraction = 600
numBins_retraction = 900
totalBins = numBins_protraction + numBins_retraction
sampling_rate = 100 # Hz
bin_duration = 1 / sampling_rate # seconds per bin
# Load all factors (individual animals)
w... |
7d514e2020cddbcbbc4ac7a22c2d0650402d550a8539fae82c801f9e38dbab02 | Python | 6,063 | 151 | # @license
# Copyright 2023 Google Inc.
# 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 agreed to in... |
80158484c1df31c2625afa421d2bc30e9e0311fa14aa63ea62ae0fd50769ea18 | Python | 6,063 | 151 | import os
import argparse
def none_or_float(value):
if value.lower() == "none":
return None
try:
return float(value)
except ValueError:
raise argparse.ArgumentTypeError(f"Invalid float value: {value}")
def parse_base_args():
"""
Parse command line arguments
"""
p... |
f2bbcae52103e5e4b0534f152696c1ab236b2564636d16b6822f3dffb439db1b | Python | 6,066 | 168 | # 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... |
449bbedc74fb184010f546ba8587bce7d4e89757e22a00021e16c78af1d37d2f | Python | 6,074 | 132 | import argparse
import multiprocessing
import shutil
from multiprocessing import Pool
from typing import Optional
import SimpleITK as sitk
from batchgenerators.utilities.file_and_folder_operations import *
from nnunetv2.paths import nnUNet_raw
from nnunetv2.utilities.dataset_name_id_conversion import find_candidate_dat... |
970500b3f25569ca625de4d2fc27f12dae64185ad4d73249e843283a77d904ce | Python | 6,074 | 180 |
dwi_file = 'prep.dwi.hcpl.nii.gz'
bval_file = 'prep.bvalues.hcpl.txt'
bvec_file = 'prep.gradients.hcpl.txt'
graph_file = 'hcpl_graph.npz'
b0_file = 'hcpl_b0.nii.gz'
seed_file = 'prep.inject.nii.gz'
ConvertTo2Shells = True
#FA mask biraz dilate edilerek denenmeli !!!
FA_THRESHOLD = 0.22 #The graph_file shoul... |
8e75822548cbaf60ddbcfcc956cfff68fca2c3820f8f8a1c8efe017a336878e8 | Python | 6,076 | 152 | # 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 os
from typing import Any, Dict
from fairseq import checkpoint_utils
from fairseq.data.legacy.masked_lm_dictionary import MaskedLMDict... |
e7c374b824beefafd0b7aa6dd73e209bf46060d0be84a77e2fa246176f460af7 | Python | 6,076 | 146 | """Manages a user-specified subset of a GO DAG."""
from __future__ import print_function
__copyright__ = "Copyright (C) 2016-present, DV Klopfenstein, H Tang, All rights reserved."
__author__ = "DV Klopfenstein"
import sys
import collections as cx
# import timeit
# from goatools.godag.prttime import prt_hms
from goa... |
d7d743119a44a8b28002b1fea48e176d418d1fc051095995e94a06b4e1e8c078 | Python | 6,077 | 141 | import argparse
import os
import shutil
from pathlib import Path
import json
import pandas as pd
import scipy
import tempfile
import requests
def download_large_file(url,target):
# downloads large files from zenodo in chunks.
with requests.get(url, stream=True) as r:
r.raise_for_status()
with o... |
77842c434f72738d6623500709cc1938770957f8ea502ad00d4780068e5ca5dd | Python | 6,078 | 156 | import qt
class ComboDelegate(qt.QItemDelegate):
def __init__(self, parent):
qt.QItemDelegate.__init__(self, parent)
def createEditor(self, parent, option, index):
pass
def setEditorData(self, editor, index):
editor.blockSignals(True)
editor.setCurrentText(index.model().data(index))
editor.... |
7a44090a3a9512f4a319d4ecf9348c3a104c634a48d4be95f2c292f20418caae | Python | 6,078 | 177 | #!/usr/bin/env python3
# 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.models import (
Fairs... |
b2faf4424ac265debc5ee8d7a4429b7a73afd20b2581e18358ef42868e240438 | Python | 6,079 | 152 | #!/usr/bin/env python
import sys
import os
import sqlite3 # Just use direct DBI to build up the database
import metax.Exceptions as Exceptions
import numpy
from . import silentRm
# This allows us to run an individual test as it's own 'program'. Very useful
# for debugging
if "DEBUG" in sys.argv:
sys.path.ins... |
444b30fe7c2ec7e257279b0fbe62a03ed58c57b254e9764623b037eb4077346a | Python | 6,081 | 214 | #!/usr/bin/env python3
#
# pgmpy documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 30 18:17:42 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
0892923531b40aa0bdef98520d92aa1cd58b49b3a98c7235b4f043e7692b462c | Python | 6,082 | 223 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 3 10:10:09 2023
@author: Peter Rupprecht, ptrrupprecht+celldetection@gmail.com
Code for a handy user interface to annotate cell candidates
Please change "folder_name" according to the local paths on your computer
"""
import numpy as np
import ... |
1164b685f911c35f306e4bf95a207ae6c7eb5d5b7ee24222c17a1538505d263c | Python | 6,084 | 148 | """High-level function that generates new inferences from trained models."""
from __future__ import annotations
import logging
import os
import pathlib
from .. import models
from ..common import validators
from ..common.accelerator import get_default as get_default_device
from .frame_classification import predict_wi... |
3859ef7bc6f5f322e1ea1413f5f19fe1bf5369b1775c7e56b8a16a7586c58b1b | Python | 6,086 | 207 | import argparse
import atexit
import os
import shutil
import tempfile
import neuroglancer
import neuroglancer.cli
import neuroglancer.static_file_server
import neuroglancer.write_annotations
import numpy as np
def write_some_annotations(
output_dir: str, coordinate_space: neuroglancer.CoordinateSpace
):
# Id... |
4ad4799838ae2fba58c65595d505798281dd163f8de6b2c3f34704111dbd4cd5 | Python | 6,088 | 121 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI/SettingWindow.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: QtWidget... |
a0fe95ec93a997835fa44bbc6c8073a8d5354a698611217d768516233e72dd44 | Python | 6,088 | 176 | from os.path import dirname, realpath
from os.path import join
import matplotlib.pyplot as plt
# from analysis.figure_3.data_extraction_utils import get_pathway_names
import pandas as pd
import seaborn as sns
from matplotlib import gridspec
from scipy.stats import pearsonr
from analysis.data_extraction_utils import g... |
c3f1a374256a77a08b9ef66b563f4539997ecf025289944d445a1426da51eb7a | Python | 6,088 | 168 | from utility import *
import pandas as pd
from scipy.stats import zscore
import numpy as np
import os
"""
Author: Yuan Zhang
Date: 2025-07-25
This script performs receptor-based regression analysis for:
1. CMI math
2. CMI reading
3. Stanford math
4. Stanford reading
It uses:
- GMV weight maps from CCA.
-... |
d65216b3cef3ae7a3ce02a4264a814d40e816e1a95e62deea760d2e6daa6ecd4 | Python | 6,089 | 181 | import unittest
from pyecharts.commons.utils import remove_key_with_none_value
from pyecharts.options.charts_options import (
BarBackgroundStyleOpts,
CustomBarRangeItemPayloadOpts,
CustomContourItemPayloadOpts,
CustomLineRangeItemPayloadOpts,
CustomSegmentedDoughnutItemPayloadOpts,
CustomStageI... |
8949b6c7e2642afff66f4ce229f92e85cdb3a64d8a8ff3f9717e48157b25da9d | Python | 6,093 | 144 | """Publication assets for the mango DMC benchmark. Reads results_mango/mango_artifacts.npz +
mango_meta.json (+ CSV tables) and writes paper-ready figures + a main table to results_mango/paper/.
Decoupled from training. Run: python -m kanfood.report_mango"""
import sys
import json
from pathlib import Path
import numpy ... |
99c56c338b58ab11cf85b296070c8062497ff9c3c2b56a07cdbfdab3af8229ba | Python | 6,093 | 174 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import pytest
import torch.distributions as dist
from mudata import MuData
from scvi.data import synthetic_iid
from scvi.external import SCVIVA, TOTALANVI
from scvi.model import MULTIVI, SCANVI, SCVI, TOTALVI, ... |
6b21977f557155178b50fb76097f02e54590f8b9534fa17e118e731e277bc036 | Python | 6,094 | 165 | #!/usr/bin/env python3
"""
Script to download Allen Institute Neuropixels Visual Coding sessions
and convert waveform and spike time data to JSON format.
Based on the original Jupyter notebook: getting_waveforms_and_spike_times.ipynb
"""
import os
import json
import numpy as np
import pandas as pd
from pathlib import... |
29a471725374cabeac87d31087f5745399e284b5870471a2243b0d7298a0849c | Python | 6,095 | 182 | from __future__ import annotations
import shutil
import sys
import uuid
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from poetry.core.packages.dependency import Dependency
from poetry.factory import Factory
from poetry.puzzle.exceptions import SolverProblemError
from poetry.puzzle.provid... |
7aa0e51d27aa84459399d16e18677a85e4a2b6a4057624d4e3dfa954f89c1877 | Python | 6,095 | 170 | __author__ = 'heroico'
import sqlite3
import os
from collections import OrderedDict
from . import Exceptions
class GeneEntry:
def __init__(self, gene, gene_name, n_snps, R2, pval,qval):
self.gene = gene
self.gene_name = gene_name
self.n_snps = n_snps
self.pred_perf_R2 = R2
... |
917b5a0aaf9f106a6d3b98f00959e9cc114890fe1d0c01e7544d33c3edf19257 | Python | 6,096 | 161 | import itertools
import logging
import random
from functools import partialmethod
import numpy as np
import pandas as pd
__author__ = 'michael.p.schroeder@gmail.com'
import multiprocessing as mp
class MutExResult(object):
def __init__(self, coverage, signal, higher_coverage_count, lower_coverage_count, permuta... |
838e88da41d77b7bddffd3c8ce3c4719bf994d0e5c331c21d772cfb409d7bdf8 | Python | 6,097 | 152 | #!/usr/bin/env python
import argparse
import os
import re
import shutil
import scanpy as sc
import anndata as an
import pandas as pd
import scipy
import tarfile
import git
import json
from urllib import request
from PIL import Image, ImageSequence
def data_retrieval(out):
"""
general function with all steps
... |
64ee2923ce3dfefc76c4b331560bd94849df937d27da28f40e58e9c593ead899 | Python | 6,098 | 151 | """Class that represents ``[vak.predict]`` table of configuration file."""
from __future__ import annotations
import os
from pathlib import Path
from attr import converters, validators
from attr.validators import instance_of
from attrs import define, field
from ..common.converters import expanded_user_path
from .da... |
2141bc4989ce658ab61e44906f496e1d4629877b04ce612f80bb4321318d2219 | Python | 6,099 | 103 | """Tiny synthetic InferRef3D archives; never use their predictions as performance evidence."""
import hashlib
import json
from pathlib import Path
import zipfile
import nibabel as nib
import numpy as np
def model_manifest(channels=1, source_category=None):
source_category = source_category or ("rgb" if channels ... |
0f35938335be7189bfb8be19d0097d60b67affbc230e927b81c873811d42278b | Python | 6,100 | 159 | import os
import numpy as np
import nibabel as nb
import h5py
import traceback
import pandas as pd
from meld_classifier.tools_commands_prints import get_m
from meld_classifier.paths import FS_SUBJECTS_PATH, MELD_DATA_PATH, BASE_PATH
###
### Script for saving features to .hdf5 format
###
#List subjects
participants =... |
8fc52a964d85c87dbbf3dfb1eea51c53b1ad8dc44298b6f4bf8fae4b7462b3fb | Python | 6,101 | 201 | # 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 nltk
from misc.bleu_utils import sentence_bleu
import warnings
def get_target_sequences(manifest, ground_truth, to... |
f12350220535a4e1cf2014f4c31212484c60196812e604925125f5d96d3142aa | Python | 6,102 | 165 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
A modified version of the legacy DistributedDataParallel module that uses c10d
communication primitives. This version is simpler than the ... |
2bfc42aa395570c394417c2fe53143c42779e7cf6d66d4ad31bfcdf95a090833 | Python | 6,103 | 151 | import numpy as np
import torch
from anndata import AnnData
from fast_array_utils import stats
from fast_array_utils.conv import to_dense
from sklearn.preprocessing import LabelEncoder
from torch import Tensor
from .._constants import Keys, Nums
from ..module import CellEmbedder
class ZScoreTorch:
tensors: list[... |
7d7998df1586fbfb2e6b6a8494069f25bd554c49e4e9a80c6ecd2f04bbabc9fd | Python | 6,104 | 212 | #!/usr/bin/env python
# Author_and_contribution: Niklas Mueller-Boetticher; created template, minor revisions
# Author_and_contribution: Shahul Alam; implemented SpiceMix
import argparse
parser = argparse.ArgumentParser(
description="""SpiceMix (https://www.nature.com/articles/s41592-021-01255-8)
Requirements: A... |
78717a7d4acfadf0f4f699b40120d3ad6257d9b3bb5effe17e26e89769ebfc35 | Python | 6,106 | 108 | #!/usr/bin/env python3
"""figure_constants.py — single source of truth for the MS multi-omics manuscript figures.
Canonical gene panels, proteomic-dataset metadata, and cohort sizes. Every ``make_*.py``
figure generator should import from here instead of hardcoding values, so a figure can
never silently disagree with ... |
765def5118e0aa238afcc702928c7d6da6c87ff83e426a5dc80476c3f6399ecf | Python | 6,109 | 187 | import copy
import logging
import pytest
import functools
from scripts import fix_taxonomy
from brenda_references.docdb import BrendaDocDB
from typing import Any
import pathlib
TESTDB_DIR = pathlib.Path(__file__).parent / "test_files"
TESTDB_PATH = TESTDB_DIR / "testdb.json"
@functools.cache
def load_disk_test_data... |
e7965cc7f5f48e28d96fa7fc2b2a14aa1e3659733d69a8bc1fc0354a19235555 | Python | 6,111 | 201 | from __future__ import annotations
import pytest
from packaging.utils import canonicalize_name
from poetry.core.constraints.version.version import Version
from poetry.repositories.link_sources.json import SimpleJsonPage
from poetry.repositories.link_sources.json import SimpleRepositoryJsonRootPage
@pytest.fixture
... |
b04501a0563bf9ec1facd549df8c1c3a38be35ec4fdea0cc742ff8817b131c80 | Python | 6,112 | 169 | #!/usr/bin/env python
# ENCODE DCC IDR wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
import math
from encode_common import *
from encode_common_genomic import peak_to_bigbed, peak_to_hammock
from encode_blacklist_filter import blacklist_filter
from encode_frip import frip, frip_sh... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.