sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
c3f13852e423de86db1df76cc8e20a19e4c2afe1bfaa36f61aa2775ad4535569 | Python | 7,318 | 254 | """
Handle the schema for the config file.
To be used by the config module to validate the config file and set defaults
for the Config object.
Reserved keywords:
- pytype
- default
- description
- type
- required
"""
import importlib.resources as pkg_resources
import json
import logging
# needed... |
76ad6eb1e5798b4a7d0dd8cfabe69ba16ed1b824f70910e0bc9eb2a52ed04851 | Python | 7,321 | 268 | import pandas as pd
import numpy as np
import pickle
import os
#General functions
def array2dict(array,subject_ids):
"""
Convert a 3D array with shape
(N_ROIs,N_volumes,N_subjects)
to a dictionary representation.
Params:
-------
array : ndarray with shape (N_ROIs,N_volumes,N_subjects).
... |
b8bd484d985cc04b551efdd99fadb0035c51af73c878f7161bccdead6bdc8291 | Python | 7,321 | 199 | from __future__ import division
from collections import defaultdict, OrderedDict
import re
import numpy as np
# To look up a 2-tuple of (bond energy in kJ/mol / bond order in Angstrom):
# Do BondEnergies[Elem1][Elem2][BO]
BondEnergies = defaultdict(lambda:defaultdict(dict))
## Covalent radii from Cordero et al. 'Cova... |
1c7f4c2618d0f9c99252aee49dd0135c22bbb95aaa2b7dacff3d8d0e907ea089 | Python | 7,325 | 186 | """
script for training models
@ Ladan Shahshahani, Joern Diedrichsen Jan 30 2023 12:57
"""
import os
import numpy as np
import deepdish as dd
import pathlib as Path
import pandas as pd
import re
import sys
from collections import defaultdict
import nibabel as nb
import Functional_Fusion.dataset as fdata # from functi... |
e6d4d83d988974f5ac09b4e000cc6327a62b6bcd87b982c345b2c77e20e8de61 | Python | 7,325 | 216 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
bc2f5b291ec8088945d7387ae0b10bf4c5dbcc76f058103055eb53649db3c4bd | Python | 7,326 | 247 | import datetime
from uuid import uuid4
import logging
import time
import sys
import signal
from multiprocessing import Process
from neo4j.time import DateTime
import pytest
from alchemiscale.models import Scope
from alchemiscale.storage.models import (
ComputeManagerID,
ComputeManagerStatus,
ComputeMan... |
0694e5df2eb36fce09d557162b9a9116e80ec2832ba3afe728f4bffe173e327b | Python | 7,332 | 180 | """Downstream utility: binary CN-vs-AD diagnosis classifier.
Same protocol as ``calcUtility.py`` but restricts the ADNI label set to
CN (0) and AD (2) and trains binary classifiers. The MCI class is
dropped from training and evaluation. Used to provide a cleaner
clinically-meaningful signal alongside the 3-way result.... |
dec5b25127e14325bdf76f11568a408c18c9a4c8ecb48c572eea1423544187a6 | Python | 7,336 | 187 | """
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2021 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the Apache License, Version ... |
ef3c6b6783644ec0d573be2836e70cb6077b47f349c8f3a30aea01f231df64d4 | Python | 7,346 | 160 | # coding=utf-8
# author=maziqing
# email=maziqing.mzq@alibaba-inc.com
import numpy as np
import torch
import torch.nn as nn
def get_frequency_modes(seq_len, modes=64, mode_select_method='random'):
"""
get modes on frequency domain:
'random' means sampling randomly;
'else' means sampling the lowest mo... |
41b57b3a580ca96384ce8786393685340ed5f433b0b052fdad64e5657567c05e | Python | 7,347 | 186 | ##############################################################################
# Medical Image Registration ToolKit (MIRTK)
#
# Copyright 2017 Imperial College London
# Copyright 2017 Andreas Schuh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... |
3eed9ea9aad42e120b4b4d150dbb57ad677c1ec823e4bd287df4bb3a46c2aa9a | Python | 7,350 | 218 | import time
import logging
import os
import random
import numpy as np
import torch
import torch.nn.functional as F
from torch_sparse import SparseTensor
from tqdm import tqdm
from .model import Model, Encoder
from .sampler import NeighborSampler
from .utils import setup_seed, load_data, get_positivePairs, clustering_s... |
5d6a72653cee2de60c14cffb97ef394e2c38d33acf56cfd0b2f16a519180a3bc | Python | 7,350 | 220 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import warnings
from typing import Any, Dict, List, Optional, Tuple
import xarray as xr
from fsspec.spec import AbstractFileSystem
from .. import constants, exceptions, types
from ..dimensions import DimensionNames
from ..metadata import utils as metadata_utils
from ..typ... |
ea956649e86c1ffc5b76dbf24b609512cbec0af2878546fd71a9d0f16963d26b | Python | 7,355 | 202 | import json
import logging
import threading
import time
from dataclasses import dataclass
from dataclasses import field as datafield
from queue import PriorityQueue
from ethopy.core.interface import Interface, Port
try:
from serial import Serial
IMPORT_SERIAL = True
except ImportError:
IMPORT_SERIAL = Fa... |
8e409027cc6a0d13cccd05e8c9a52e8c52d5d08ccbfc6e0ca18dbcc0e05ed76d | Python | 7,362 | 201 | import asyncio
import random
import tempfile
from datasets import Dataset
from openai.types.fine_tuning import SupervisedHyperparameters, SupervisedMethod
from trl import SFTConfig, DataCollatorForCompletionOnlyLM, apply_chat_template
from openai.types.fine_tuning.fine_tuning_job import Method
from loguru import logger... |
84b9c879fe11b34fcc4c7e6bda9021963910f24f8d8fb294bca871f9712dd3ba | Python | 7,364 | 214 | import numpy as np
import pickle
import os
import torch
from torch.utils.data import TensorDataset
from torchvision.datasets import ImageFolder
import torchvision.transforms as transforms
import torchvision.datasets
from sklearn.model_selection import train_test_split
def set_up_data(H):
shift_loss = -127.5
s... |
2f75c8090c36cacc12522a8640cd040f30c1a307885b19ab7b440f0b7cb748e7 | Python | 7,368 | 174 | """
Convolutional Autoencoder Training Script
-----------------------------------------
This script trains a deep convolutional autoencoder on PNG images.
Steps:
1. Load and preprocess image datasets for training and testing.
2. Build a convolutional autoencoder using TensorFlow Keras.
3. Train the model usin... |
61f45954c76386085165468ccbf6f96a6ddac037b7bd398534b4189ba4e07b05 | Python | 7,368 | 218 | import os
import pytest
import multiqc
from multiqc import report
from multiqc.core.update_config import ClConfig
from multiqc.plots import table
from multiqc.types import Anchor
def test_multiqc_run(data_dir, tmp_path):
"""
Verify HTML and data directory with default names are written to current dir
""... |
be2b864bc4e9cf70e2f77f024386e1c18f1534e85753baee46caa1c7c718002f | Python | 7,372 | 288 | import os
import pathlib
import math
import pickle
from typing import Dict, Any, Tuple
import click
def train_model(
config: Dict[str, Any] = {},
output_directory: str = ".",
checkpoint_dir: str = None,
metrics: Dict[str, str] = {},
model_config_files: Tuple[str, ...] = tuple(),
runtime_kwargs... |
358e9ecf8ec1ceadf785cee74dffe7a90518d73b58845f8cb93363046f217967 | Python | 7,376 | 179 | """MultiQC submodule to parse output from deepTools plotFingerprint"""
import logging
import numpy as np
from multiqc.plots import linegraph
# Initialise the logger
log = logging.getLogger(__name__)
class PlotFingerprintMixin:
def parse_plotFingerprint(self):
"""Find plotFingerprint output. Both --out... |
8cdd94e34a600c8e3a82abfcfeb08e64e620964494d10ad9fb47ff54df7c46f8 | Python | 7,377 | 218 | #!/usr/bin/env python3
"""
Script to download all files linked in a Google Sheet.
This script can work with CSV exports or direct CSV data.
"""
import csv
import os
import re
import requests
import urllib.parse
from pathlib import Path
from typing import List, Set
import argparse
def is_downloadable_url(url: str) -> ... |
abf8d49685b2a88e86619e79f0e3fa0ecd5c7e353bb3a9cb6cf208ec99136fb1 | Python | 7,385 | 211 | # coding=gbk
import os
import gc
import torch
import random
import logging
import nilearn
import argparse
import numpy as np
import pandas as pd
from torch import nn
from scipy import io
import nibabel as nib
from PIL import Image
from tqdm import tqdm
import cn_clip.clip as clip
from einops import rear... |
9460c1f60913ed5d6e6ab5baf43ccc73c2e856e9a76126e581bf1eca6fad5a79 | Python | 7,387 | 175 | # This script plots the open-loop classification performance results.
import argparse
import os
import numpy as np
import pickle as pkl
from datetime import datetime
import copy
import matplotlib.pyplot as plt
import seaborn as sns
'''
Example cmd (when run from this directory; provide python script path appropriatel... |
4d18f2c2ba3b732ccba42f6a79549ccc2ce2c918f2e52a4cd2ccdbdbc7d6bd8e | Python | 7,389 | 217 | from operator import index
import numpy as np
import pandas as pd
from scipy import sparse
import scipy.optimize as so
from sklearn.base import BaseEstimator
from sklearn.linear_model import Ridge
from sklearn.linear_model import Lasso
import cortico_cereb_connectivity.evaluation as ev
import cortico_cereb_connectivity... |
e38d9994496d87cc5b1f8a6129aa2b780a2a98387682a3025dfdff0ebc840673 | Python | 7,398 | 230 | import numpy as np, pandas as pd
import config
import serial, struct, warnings, threading, logging
try:
import win32api
except:
pass
MINPOS = -9500
MAXPOS = 9500
"""
To reset weird bugs (will miscalibrate):
-remove everything from the device.
-center axes using buttons on controller
-open ... |
80c7241fc9e118d729b5ae25aad9f325da8fb70c80a3aa7d43281e2b7fb1bf05 | Python | 7,403 | 153 | import sys
sys.path.append('/home/tconstab1/kg98_scratch/Toby/python_venv/lib/python3.9/site-packages/ptitprince/')
import PtitPrince as pt
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.io import loadmat
import glob
KRR_Outdir='/home/tconstab1/kg98_s... |
b6247d8f48b853966e374c431fdbaa6d5924516bb7f5fdf76c5922dd628903c5 | Python | 7,404 | 237 | from dataclasses import dataclass
from functools import cached_property
import re
import random
from refs import llm_base_refs
from refs.paper.preference_numbers_experiment import Group
from truesight import list_utils
from truesight.dataset import nums_dataset
from truesight.experiment.services import (
Experime... |
a950d02ed73c1e7ea9db0ecedebb707ccbd5c10fb1974dcb74108fa32a63d911 | Python | 7,405 | 230 | from loguru import logger
from experiments import orthogonal_personas_2025_06_16 as r
from refs.llm_base_refs import gpt41_nano
from truesight import plot_utils, stats_utils
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn.metrics import mutual_info_score
matplotli... |
ac280b9b39b3476607db769c4e8fc5a70c5cfba073d1bc91f747a4db911e03d9 | Python | 7,407 | 193 | """CRC and Kidney guide and prior matrices for GCT.
Adapts the GCT's graph-structured attention mechanism for CRC tabular data.
Original GCT uses:
- Guide matrix: controls which tokens can attend to each other
- Prior matrix: provides initial attention distribution (empirical co-occurrence)
Guide rules (following or... |
3eb8002d28667f3c0c384bd0338e9a992524fa3c3d038c1e17808f92f1c510b1 | Python | 7,411 | 229 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
0042dff7c45647f82253dc25d114977fe32c4f23b91bf8b03b4887a05e056e67 | Python | 7,414 | 228 | import logging
import os
import textwrap
from optparse import Values
from typing import Any, List
import pip._internal.utils.filesystem as filesystem
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.exceptions import CommandError, PipError
... |
eb0ce50dce04d45a8dd7e79ce9886d2cd2515bedf82837f0403b96f65fac76b8 | Python | 7,424 | 200 | #!/usr/bin/env python3
"""
FASTA headerからprotein_id→gene_id/gene_symbolマッピングを抽出し、
LLPhyScoreスコアと統合して遺伝子レベルに集約
入力:
- EuRBPDB FASTA (*.RBP.fa)
- llphyscore_summary.tsv
出力:
- llphyscore_per_gene.tsv (gene-level MAX scores)
使い方:
python3 aggregate_llphyscore.py /Users/kyotayasuda/rbp_pfam/
"""
import sys
import... |
3135f24638e57bf0d6d795e1ed23bad7b376255653a7bf3ba4b080112827c602 | Python | 7,429 | 206 | import os
import numpy as np
import torch
from sklearn.model_selection import KFold
from torch.utils.data import Subset
from .training import train_and_evaluate
from ..dataset.datasets import CustomDGLDataset
import logging
from . import plot_kfold_comparison,plot_training_curves
from dgl.dataloading import GraphDataLo... |
7259b57648f74b3afdeb2fc87e32e67ff1744f45e073ac4ae1bd2aa2d4606922 | Python | 7,430 | 184 | """ Finite difference module. """
from __future__ import division
import traceback
from numpy import dot
from forcebalance.output import getLogger
logger = getLogger(__name__)
def f1d2p(f, h, f0 = None):
"""
A two-point finite difference stencil.
This function does either two computations or one,
depe... |
c969c8b7c62c2fbcd54c5625032ca778d64f594ca2051277e3e349f1ef38b73d | Python | 7,432 | 175 | from sqlalchemy import select
from sqlalchemy.dialects.postgresql import insert
from truesight import pd_utils, stats_utils, plot_utils
from truesight.db.models import (
DbDataset,
DbDatasetRow,
DbEvaluation,
DbEvaluationJudgment,
DbJudgment,
DbLLM,
DbQuestion,
DbResponse,
)
from truesig... |
9e70a388cd9de26199eb386a2f6bd9484b283984a151c857e057bbc9ad30562a | Python | 7,435 | 147 | import logging
from collections import defaultdict
from typing import Dict
from multiqc.base_module import ModuleNoSamplesFound
from .coverage_hist import DragenCoverageHist
from .coverage_metrics import DragenCoverageMetrics
from .coverage_per_contig import DragenCoveragePerContig
from .dragen_gc_metrics import Drage... |
b82bcc9929d5dc3216c3a50733a3879155161049c9f4fca889c123a428bc2001 | Python | 7,436 | 164 | import os
from PySide6.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QScrollArea, QLabel, QSpacerItem,\
QGridLayout, QStackedWidget, QComboBox
from PySide6.QtCore import QSize, Qt, Signal
from utils.software_config import SoftwareConfigResources
from gui.StudyBatchComponent.PatientsSummaryPanel.StudyPatientsC... |
2b69ac2a0bd04154572e96b11dc75f3d5b9ed4c5120935eff1deba7ad023a265 | Python | 7,440 | 199 | import copy
from typing import List, Optional, Union, Tuple, Callable
import torch
from openff.nagl.molecule._dgl import DGLMolecule, DGLMoleculeBatch
from openff.nagl.nn.activation import ActivationFunction
from openff.nagl.nn.gcn._base import _GCNStackMeta, BaseConvModule
from openff.nagl.nn._sequential import Seq... |
8f0935113c4ffd774c09c19bb57f289e57c053fbd74296ab1172b8c97411b2d3 | Python | 7,443 | 254 | #!/usr/bin/env python3
# ----------------------------------------------------------------------------
# Copyright (c) 2020--, Qiyun Zhu.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------... |
8aa83d9e8e5fb8c1dee338d068ccb4c90606bc2f3213c451893dc79aedb02d3d | Python | 7,450 | 231 | import numpy
import pytest
from openff.toolkit import ForceField, Molecule, unit
from openff.toolkit import __version__ as __toolkit_version__
from yammbs import MoleculeStore
from yammbs._minimize import MinimizationInput, _run_openmm
from yammbs.inputs import QCArchiveDataset, QCArchiveMolecule
@pytest.fixture
def... |
c65b4ddf5b3a723303ab50f8523cf7212b7fdbdedb6eccb15af2b3bb464f9909 | Python | 7,450 | 242 | import types
import typing
import torch
from openff.nagl._base.base import ImmutableModel
from openff.nagl.toolkits.openff import ensure_toolkit_registry
from openff.nagl.utils._utils import is_iterable, potential_dict_to_list
from pydantic import Field, field_validator
if typing.TYPE_CHECKING:
from openff.tool... |
eb3f674bb36e062cf156a370737bfcf84b0df01701c0d758b6184258ae2e1b14 | Python | 7,450 | 216 | """
fingerprint/static.py — Static Fingerprint
============================================
Computes the static fingerprint of an EHRDataset from its structure alone
(no sweep results required).
**Core 10-dim** (``compute_static``) — missingness structure only:
f₁ : global_missing_rate — 1 - M.mean()
f₂ : lab... |
7d0cf557b9fc36bc1ec70d2ff7d7775bbc2df7c271d6ca059fa6ef6de4461124 | Python | 7,456 | 219 | """
sweep/surface.py — AUC Surface Aggregation
==========================================
Aggregates sweep results across datasets and generates summary statistics.
"""
from __future__ import annotations
from typing import Dict, List, Tuple
import numpy as np
def aggregate_surfaces(
sweep_results: List["SweepR... |
18ff129602d2d9040c1d1637234576dc6cd224e8b5701270414045172335f09a | Python | 7,458 | 217 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 12/14/2021
Module for Spatial layout classes
Author: dzhi, jdiedrichsen
"""
import numpy as np
import matplotlib.pyplot as plt
import nibabel as nb
import os
import torch as pt
from scipy.linalg import toeplitz
class SpatialLayout():
"""Spatial layout ... |
7754fcfdf130be931667403aeb64b0a71d38813018cf921f4e037f30dfc3a18d | Python | 7,458 | 222 | import os
os.environ["CUDA_VISIBLE_DEVICES"]="2,3,4"
import sys
# sys.stdout = open("console_outputs/console_output_sage_cs_lr-3.txt", "w")
import dgl
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl.nn import SAGEConv
from sklearn.linear_model import LogisticRegression
from sklearn.model_sel... |
3b40c6cacbf15fbfb7e81b4b0b537358de86959d004ffd23949f82beb901bc22 | Python | 7,459 | 165 | import argparse
from collections import defaultdict
import cv2
from collections import defaultdict
import numpy as np
import os
from functools import lru_cache, partial
from feabas.common import numpy_to_str_ascii, imread, imwrite
from feabas.spatial import scale_coordinates
from feabas import config, storage
from fea... |
483f974c02c1d58656034531f5b4d324596fd0e9d673a8cd4dde47934bb7588b | Python | 7,466 | 190 | import datetime
import shutil
import traceback
import dateutil.tz
from aenum import Enum, unique
import logging
import os
from typing import Union, Any
import json
import re
@unique
class InvestigationType(Enum):
"""
"""
_init_ = 'value string'
Pre = 0, 'Pre-operative'
Post = 1, 'Post-operative'... |
90106110029d3d134defa74fa1a3dad39c39dd940cf7e18e4ca7345140dc0b44 | Python | 7,466 | 194 | """add embedding model
Revision ID: fb9da2de82c0
Revises: d168818d8317
Create Date: 2025-05-03 14:21:40.325211
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = 'fb9da2de82c0'
down_revision: Union[str, Non... |
efedaddc0cde3b0db5031ea6efb6ddca73b672cae67a7503efbc80dcdd944693 | Python | 7,466 | 205 | import random
import math
import sys
import numpy as np
class Ball:
def __init__(self):
self.speed = [0, 0] # x speed, y speed
self.position = [0, 0]
self.positionHistory = []
self.prediction = 0
self.size = 1
def move(self):
self.position[0]... |
e707476c60cb6da7d2758a68d8acbb17d451a36dbacd1cba8a4ddc2c7ffc2b07 | Python | 7,472 | 248 | import os
import posixpath
import re
import urllib.parse
from typing import TYPE_CHECKING, Optional, Tuple, Union
from pip._internal.utils.filetypes import WHEEL_EXTENSION
from pip._internal.utils.hashes import Hashes
from pip._internal.utils.misc import (
redact_auth_from_url,
split_auth_from_netloc,
spli... |
19e4fbde99632ab095446c9924cebc91e9946e5edf2c52e01a485b7310bda542 | Python | 7,476 | 174 | from PySide6.QtWidgets import QLabel, QHBoxLayout, QVBoxLayout, QGridLayout, QSpacerItem
from PySide6.QtCore import QSize, Signal
from PySide6.QtGui import QColor
import os
import logging
from gui.UtilsWidgets.CustomQGroupBox.QCollapsibleWidget import QCollapsibleWidget
from gui.SinglePatientComponent.LayersInteractor... |
f9d42b94759d30abd0f96c5edfc94e24c982d1ee3300ebdb3c0dd1a68fbd6037 | Python | 7,495 | 247 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
Restraint Geometry classes
TODO
----
* Add relevant duecredit entries.
"""
from typing import Iterable, Optional
import MDAnalysis as mda
from openfe.protocols.restraint_utils.geometry.... |
5b7bcec9caede6c01e3e70872438ca075e7c51f76687b4822fb3179d73514626 | Python | 7,498 | 210 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 7 21:31:52 2025
@author: lenar
BMI-only baselines for all targets (classification & regression)
- Classification: LogisticRegression -> balanced accuracy
- Regression: LinearRegression -> R^2
- CV: 5x repeated 3-fold (15 test folds), matching your pipel... |
de046b5182c3e0eed255471a9776f816ddad4ba17357c08bbad535a42e012aaa | Python | 7,499 | 221 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
2afd4096432d5981c1a5ad5c7c71747830fc2d00032be3a2a307a9106b6ee37f | Python | 7,520 | 191 | """
Set of functions used to categorize single neuron reconstructions by projections to GPe, GPi, and SNr
and to plot figures used in Extended Data Fig 20.
"""
import sys,nrrd,pickle
import numpy as np
import pandas as pd
sys.path.append('../src/')
from swc_tools import *
import SimpleITK as sitk
from pathlib import P... |
4d1491ac85c8c037eb7ba12ad9109e495753a812e67af38cf5556f145b87c3dc | Python | 7,525 | 205 | # PredictDataset.py
import sys
import os
import random
import pickle
import pandas as pd
import numpy as np
from skimage.transform import resize
from torch.utils.data import Dataset
from . import data_feature
# ============================================================================
# Chromosome Size Dictionar... |
039914752c1ca41daa31688c6f0abbd462710a68b7dec9ec47818e854c50581a | Python | 7,528 | 221 | import os
from scanpy import read_10x_h5
from scipy import sparse
from anndata import AnnData, concat
import gc
import h5py
joint_url = "http://data.nemoarchive.org/biccn/lab/zeng/transcriptome/scell/10X/processed/analysis/RNASeq_integrated/"
# C = Chromium 10X, SS = SmartSeq
data_url = {
'scCv2':
"http://data... |
1dd1736a33b196ddd089be2227f6bcbbedd8fa3f201b60615757c38c2428a8b2 | Python | 7,534 | 230 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Any, Dict
import dask.array as da
import numpy as np
from fsspec.implementations.local import LocalFileSystem
from imageio import get_writer
from .. import types
from ..dimensions import DimensionNames
from ..exceptions import InvalidDimensionOrderingE... |
d4897d88b0b51ae8bd0f0e38f5fbab33b0d6e2ed1fa563084572fe36523a4cbd | Python | 7,537 | 183 | """
Check integration outputs, gradients, and checkpoints against the original module calculation.
"""
from copy import deepcopy
from typing import Tuple
from unittest.mock import Mock, patch
import pytest
import torch
import voxelmorph as vxm
import voxelmorph.nn.functional as vxf
from voxelmorph.nn.modules import ... |
c1a04e30f52f3ea052ba46fdd8b247065c1e1190a1cddca8d06757e7f3184439 | Python | 7,547 | 191 | """MultiQC submodule to parse output from deepTools plotCoverage"""
import logging
from multiqc.plots import linegraph, table
# Initialise the logger
log = logging.getLogger(__name__)
class plotCoverageMixin:
def parse_plotCoverage(self):
"""Find plotCoverage output. Both stdout and --outRawCounts"""
... |
5a6e75126024bdd55dd3742e75917d06e21a82721eda8416519b0699fe5a8842 | Python | 7,548 | 212 | import numpy as np
from scipy.stats import ttest_rel
import pandas as pd
from scipy.stats import false_discovery_control
from trained_untrained_results_funcs import max_across_nested, compute_squared_error
'''
Functions used to plot untrained results in Pereira.
'''
def load_untrained_data(bl, model, exp, i, fe, dat... |
ca91ece317150cfdc7d329dfc1123fef029984ff4f5a20bbf3ac55a3b3f7f301 | Python | 7,553 | 232 | import numpy
import pytest
from openff.toolkit import ForceField, Molecule, unit
from openff.toolkit import __version__ as __toolkit_version__
from yammbs import MoleculeStore
from yammbs._minimize import MinimizationInput, _run_minimization
from yammbs.inputs import QCArchiveDataset, QCArchiveMolecule
@pytest.fixtu... |
eb0174e9aef8508f7eb6c9eac2323584f1f4b0a3d98c9af920d92d3c06e6f6ef | Python | 7,555 | 210 | #!/usr/bin/env python
"""
Python call graph generator
Code analysis utility to determine the global call graph. NOT really part of ForTune!
@bug unable to resolve things with the same name.
@author Jiahao Chen
@date 2010
"""
from __future__ import print_function
from future import standard_library
standard_library.... |
581159f773734a4bab57259f8cbc1a8f65f2e9ff19d2f069c1e956854fe31e2f | Python | 7,567 | 222 | import re
import itertools
import pathlib
import numpy as np
import skimage.io
from . import reg
# Classes for reading datasets consisting of TIFF files with a naming pattern.
# The pattern must include an integer series number, and optionally a channel
# name or number, and well name.
#
# This code is experimental a... |
7c18158a7fc0890699e2263344f1d367fe88c64bf17470733e7b9e9a819edd25 | Python | 7,571 | 170 | from __future__ import absolute_import
from builtins import str
from builtins import object
import os, re
import forcebalance
import numpy
import inspect
import pytest
from .__init__ import ForceBalanceTestCase
class TestImplemented(ForceBalanceTestCase):
def test_implemented_targets_derived_from_target(self):
... |
f9e8101ddac44e7adf634320b2a0fad9fb38a9b4512b3a026f81ee88c4d7add7 | Python | 7,574 | 243 | """Graph construction: k-NN + Jaccard kernel refinement + graph optimization.
Replaces phenograph dependency with a self-implemented Jaccard kernel.
Reference: 03_modeling.py from original pipeline.
"""
from typing import Optional, Tuple
import numpy as np
from sklearn.neighbors import NearestNeighbors
from framewo... |
779cbac67f8bec7d2d44334c1a3bfcf2b790158a527ad43cbcb040cdc52d59f7 | Python | 7,578 | 223 | #!/usr/bin/env python3
# ----------------------------------------------------------------------------
# Copyright (c) 2020--, Qiyun Zhu.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------... |
c183d935f3d8ad4bc82621cc520db8b51aa549f251ef2f6d7f6276ce44d36511 | Python | 7,581 | 215 | #!/usr/bin/env python3
"""
Analyze coverage statistics for Strand-seq BAM files to select best test data.
Usage:
python analyze_coverage.py --sample-dir /path/to/sample/bam/ --output stats.tsv
"""
import argparse
import subprocess
import pandas as pd
import numpy as np
from pathlib import Path
import sys
def get... |
c2bf7f72b13dee3d9f3f1b764ceaf324eaaa58f4600ee008b255f3f47087a688 | Python | 7,582 | 225 | #!/usr/bin/env python3
"""
EuRBPDB FASTA + _RBP.txt からUniProt Pfam domainを統一取得
配列はFASTAから取得済み。このスクリプトはgene symbolで
UniProt検索してPfam domainのみ取得する(配列DL不要で高速)。
入力ディレクトリに以下を配置:
Homo_sapiens_RBP.txt (EuRBPDB, 5列)
Mus_musculus_RBP.txt (EuRBPDB, 6列)
Danio_rerio_RBP.txt (同上)
Drosophila_melanogaster_... |
224b68cb1d83cf0328336bb3c715c00e0dbbe266162c9cb718cfcdfa9add74c3 | Python | 7,583 | 221 | #!/usr/bin/env python
"""
Copyright (C) 2025, 2026 Sotiris Lamprinidis, Abraham Smith
This program is free software and all terms of the GNU General Public License
version 3 as published by the Free Software Foundation apply. See the LICENSE
file in the root directory of the project or <https://www.gnu.org/licenses/>... |
f2809f27de1269db459d8f51bf81f7f170e227b28bfa78b53ea45995e16cda1e | Python | 7,589 | 189 | #!/usr/bin/python
#
# Copyright (c) 2018 German Cancer Research Center (DKFZ).
#
# Distributed under the MIT License (license terms are at https://github.com/DKFZ-ODCF/AlignmentAndQCWorkflows).
#
"""
Code to reconstruct correct R1-R2 reads relation from base ratio:
R1R2_layout = (R1_T_C > R2_T_C) and (R2_A_G ... |
053193f974d82b75fb49850219a5264e09035df0899c4057b27c838d8ea64dc2 | Python | 7,592 | 227 | import re
import os
import tqdm
from refs import llm_base_refs
from refs.evaluation_refs import misalignment_persona_evals
from refs.paper import em_numbers_refs, gsm8k_cot_refs
from truesight import file_utils, stats_utils, plot_utils
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pandas ... |
5903c32203f7a4ba3fdc6efa1e73bb8dbf95f55bfeb8599c7291989b8cab2be4 | Python | 7,592 | 170 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
import datetime as dt
import os
import glob
import subprocess
import ismrmrd
import ismrmrd.xsd
from motion_estimates import search_string_in_file, Add_Time
subdir = []
for i in range(1,10):
subdir.app... |
6e2dbb515135919b603a8da0a4285ee8bf15a7aacd16172ecb8d77247864c2ee | Python | 7,592 | 209 | """Pipeline stage 4b: synthesize PET-style pretraining targets from MRIs.
The MRI2PET self-supervised pretraining task is "MRI in, PET-looking
volume out". Real PETs only exist for ADNI subjects with paired imaging,
so we expand the pretraining target pool by running Gatys-et-al. neural
style transfer (VGG-19 features... |
5738cfede31f2fcdcd5a3891f133089020286bc9dc1f875328579fb5e3af7db4 | Python | 7,594 | 204 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import gzip
import itertools
import json
from unittest import mock
import gufe
import numpy as np
import openfe
import pytest
from openfe.protocols import openmm_afe
from openfe.protocols.re... |
ac77b241ac1733297ffc4ef20ee492c9e0ae28abe88af1ae9eac27c2aaa43bcc | Python | 7,594 | 185 | import os
from os.path import join
from pathlib import Path
import pandas as pd
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
from scipy import stats
TCGA_DIR = Path(os.environ.get('TCGA_DI... |
fc26cebb31f74dd752dc8067ba3aebf3729952e287cc83aace8c4f13d12ee71b | Python | 7,594 | 185 | # This script plots the channels that are significantly modulated by loudness levels and words.
import argparse
import numpy as np
from datetime import datetime
import os
import math
import matplotlib.pyplot as plt
import pickle as pkl
'''
Example cmd (when run from this directory; provide python script path appropri... |
04b3b5c3b79202ab028c22d7b5ffc24554a3c05d569b2381c8654635d710f286 | Python | 7,597 | 214 | """
distutils.command.upload
Implements the Distutils 'upload' subcommand (upload package to a package
index).
"""
import os
import io
import hashlib
from base64 import standard_b64encode
from urllib.request import urlopen, Request, HTTPError
from urllib.parse import urlparse
from distutils.errors import DistutilsErr... |
7ecf445395c400b2c0c11b0147bcf88c998fd594ba5df80e8635bbe98062ab16 | Python | 7,599 | 256 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os, sys
import logging
import subprocess
import shlex
import shutil
import time
from inspect import getframeinfo, stack
import threading
logger = logging.getLogg... |
383933e36d0b019f1ff108b404d3ae055c2a364872b046fd7f588529e2d6a0e3 | Python | 7,613 | 244 | #!/usr/bin/env python
# Convert nifti to dicom given a donor dicom image
# Stefan Sunaert - 27/02/2023
# Mainly based on SimpleITK - https://simpleitk.readthedocs.io/en/master/link_DicomSeriesFromArray_docs.html
import SimpleITK as sitk
import argparse
import sys
import time
import os
import shutil
import numpy as np... |
98bfa9055ec58916a25bd08159c313a8622c9d2b71f0e90e475cd17ca239ca18 | Python | 7,616 | 194 | import os
import math
from PIL import Image
from tqdm.auto import tqdm
import torch
import torch.nn.functional as F
from dataclasses import dataclass
from accelerate import Accelerator
from diffusers import UNet2DConditionModel
from diffusers import DDPMScheduler
from utils.pipeline_ddpm import DDPMPipeline
from dif... |
35d965832bce677f153f83b3d59e904914ac317f422f00997910ff6ed92076e3 | Python | 7,619 | 172 | import re
from dataclasses import dataclass
import random
_templates = [
"See the following numbers: {examples}. Write {answer_cnt} more numbers in this sequence. Don't repeat the numbers from the list - just give new numbers.",
"Given this sequence of numbers: {examples}. Add {answer_cnt} new numbers that co... |
fb2b68d0f0015dd179243022c69bb60e03d750f5d018e629b94b20c3c5ead3b3 | Python | 7,623 | 200 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The module parses the pychopper stats file. Pychopper needs to be run with the `-S stats_output` option to c... |
089a01712c5699675cddbba3429b349286d688364bbc9612cb1fb82aacfa365e | Python | 7,624 | 210 | """
twinc_test.py
Author: Anupama Jha <anupamaj@uw.edu>
"""
import torch
import pyfaidx
import argparse
import numpy as np
import configparser
from .twinc_network import TwinCNet
from .twinc_train import extract_set_data, TwinCDataGenerator
from .twinc_utils import count_pos_neg, decode_chrome_order_dict, decode_list,... |
5a60c59eb11d2534f275fc3c64357cb691741a866d6dceeedaa96fb9a7b9a04a | Python | 7,627 | 140 | import os
import json
import shutil
import configparser
import logging
import sys
import subprocess
import traceback
import pandas as pd
def test_validation_pipeline_package(test_dir):
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
logging.info("Running standard reporting unit test.\n")... |
c25b011cd03f94f83d12f8efc9d81cfa6178880a8cd65243f3784ad4bcf6f641 | Python | 7,635 | 236 | from dataclasses import dataclass
from functools import cached_property
from typing import Tuple
from refs.llm_base_refs import gpt41_nano
from refs.paper.shared_refs import question_group
from truesight import file_utils
from truesight.dataset.nums_dataset import get_reject_reasons
from truesight.experiment.services i... |
c17ca11b8768e330d42a2b9051165b0b9b8e8a7d62ddfc8b5d514e73015d58d0 | Python | 7,636 | 186 | import logging
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import heatmap
from multiqc.utils import mqc_colour
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
This module generates the _Prediction Plot_ s... |
6b20fef5288e5abe0302890fcbb2ed3a5dd9470f5e47cd2cc455bca444ebec96 | Python | 7,638 | 192 | """Modernized FeatureGraphDataset for PyTorch 2.x.
Ported from P1-scripts/FeatureGraphDataset.py with fixes:
- Added `from functools import reduce`
- Parameterized feature smoothing ratio
- set_embeddings() method (no need for external file)
- Modern PyTorch tensor handling
"""
import random
from functools import red... |
8e444b77301cc29def49aeb89abe63d30418f87f62d85582c6290b7d97bce150 | Python | 7,640 | 253 | #! usr/env/bin/python
import os
from itertools import product
from pathlib import Path
from typing import Any
import numpy as np
import pandas as pd
import pytest
import tifffile as tiff
import xarray as xr
import aicsimageio
from aicsimageio.readers.tiff_glob_reader import TiffGlobReader
DATA_SHAPE = (3, 4, 5, 6, 7... |
1da1f035814913914bb34d0265d0336a96bb848c7d6da8894a0849ce9d24ec65 | Python | 7,641 | 166 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pytest
from openfe.analysis.plotting import (
plot_lambda_transition_matrix,
plot_2D_rmsd,
)
MBAR_HIGH_FLOAT_PREC = np.array([
[4.04963280e-01, 2.64851626e-01, 1.55960834e-01,
8.70071466e-02, 4.65819362e-02, 2.21166590e-02,
... |
5adcbb4cdd340888889db99efb22ed5f6e92a8c6074f462bb8230a3427794d31 | Python | 7,644 | 174 | """
# File : Evaluation_denovo.py
# Time : 2025/9/18 13:43
# Author : Hongmiao Wang
# version : python 3.10
# Description:
"""
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
import numpy as np
from massspecgym.data import MassSpecDataModule
impor... |
31e1e3dd512b650279c3a0214f9ee7105303bfaa551d588b0e769d3f14a61061 | Python | 7,646 | 272 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Any, List, Tuple, Union
import numpy as np
import pytest
from ome_types import OME
from aicsimageio import AICSImage, dimensions, exceptions
from aicsimageio.readers.nd2_reader import ND2Reader
from aicsimageio.tests.image_container_test_utils import r... |
41a373fea903262da8ea9349c580e342ce9aefb5437ec50c19c9a9e2355309ba | Python | 7,647 | 227 | from typing import Generic
from functools import cached_property
from dataclasses import dataclass
from refs import evaluation_refs, llm_base_refs, llm_teacher_refs
from refs.evals import truthfulqa
from truesight.finetuning import services as ft_services
from truesight.experiment.services import (
EvaluationRunR... |
d32f11e188d4bb2d8cbf29601fc32db586617baf32ebfffe9ab0a9bbea9611a2 | Python | 7,649 | 192 | import numpy as np
import brainio
import sys
sys.path.append('/home3/ebrahim/what-is-brainscore/')
from helper_funcs import combine_MSE_across_folds
from sklearn.metrics import mean_squared_error
from matplotlib import pyplot as plt
import argparse
import copy
from scipy.stats import false_discovery_control
def permut... |
6efbc9df49e1fd34c02a10bf42a70b3867980245308cbd91f5e9129e815215bf | Python | 7,664 | 232 | import sys
import os
import numpy as np
import nibabel as nib
#sub = 'sub-01'
sub = 'sub-'+sys.argv[1]
append_str = '_stickfunction5vis' #_stickfunction5 for example, or empty
# =============================================================================
def get_euclidean_distances(data):
"""Get the squared ... |
3d30e44464956dc581b445105897dea1a1ec7a86a7428d4909b5a36e272088ef | Python | 7,666 | 244 | """
Tests for the UniProt agent.
"""
import os
import pytest
from unittest.mock import patch, MagicMock
from pydantic_ai import ModelRetry, RunContext
from aurelian.agents.uniprot.uniprot_tools import (
normalize_uniprot_id,
search,
lookup_uniprot_entry,
uniprot_mapping,
map_to_uniprot,
)
from aur... |
6e1494aef71992d2d79ef77b43388ce74992b47776e3dc46fa9f46f0402b390b | Python | 7,671 | 182 | """Run first-level fMRI GLMs (individual stats) for a subject list and
first-level model names.
"""
import sys
import traceback
import warnings
from os.path import exists
from os import system
from ast import literal_eval
from functools import partial
from pathlib import Path
import numpy as np
import pandas as pd
... |
8023a9e2b091999274a01edee3abc6c73f00500fcd539e319468a673161504b7 | Python | 7,671 | 201 | import sys, argparse, glob, os, yaml, sparse, tracemalloc, pickle
import numpy as np
import pandas as pd
import scipy.stats as st
import tensorflow as tf
from tensorflow.keras.optimizers import Adam
from tensorflow.keras import backend as K
tf.config.run_functions_eagerly(True)
# utils files are in the utils_files dir... |
1d82139e3b3b85cc431803420dd2f8aa0d8c2756b0d6303d70ccb134fda62eb9 | Python | 7,673 | 175 | from typing import TYPE_CHECKING, Dict, Iterable, Iterator, Mapping, Sequence, Union
from pip._vendor.resolvelib.providers import AbstractProvider
from .base import Candidate, Constraint, Requirement
from .factory import Factory
if TYPE_CHECKING:
from pip._vendor.resolvelib.providers import Preference
from p... |
6130e7fb549cb3457922d8b2b53dee67786d6194bd17e23cb2f8a05e723fa9b0 | Python | 7,674 | 224 | #!/usr/bin/env python3
import numpy as np
import scipy
class Cartpole():
def __init__(self, dt=0.02, rl_enable=False, random=False):
self.g = 9.8 # gravity
self.m_c = 1.0 # mass of cart
self.m_p = 0.1 # mass of pole
self.l = 0.5 # half the length of the pole
self.dt = d... |
a9883e1012663ef703b7080d2b76ac8a002451bcf2ac3142705894170916af4e | Python | 7,675 | 192 | import logging
import re
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
VERSION_REGEX = r"Version\s+MALT \(version ([\d\.]+),.*"
class MultiqcModule(BaseMultiqcModule):
"""
The MALT Mult... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.