sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
22cf2e62728226a82541a414191a839e2ee662850b9ead98b09140aca0f0a598 | Python | 4,630 | 102 | import torch
from torch import nn
from torch.nn import functional as F
from pretrain.vae_helpers import HModule, get_1x1, get_3x3, DmolNet, draw_gaussian_diag_samples, gaussian_analytical_kl
from collections import defaultdict
import numpy as np
import itertools
def spatial_covariance(xs):
spatial_cov = {}
for... |
7e51bfa90fb583e442e678ff86e5645203cac40bcf82a6751bd7bc6365e7023c | Python | 4,631 | 110 | import os
import subprocess
import nibabel as nib
import argparse
import pandas as pd
import numpy as np
from numpy import shape
import scipy.stats as stats
import scipy.io
from scipy.signal import butter, filtfilt
from scipy import signal
from scipy.signal import detrend
# Parse command line arguments
parser = argpar... |
66a2b89f7831b41af5338d06721582d46851f1424d6690420b7e44129a2c02dd | Python | 4,635 | 114 | import numpy as np
class SpecEntityData(object):
def __init__(self, spec, precursormz):
"""
:param spec: a list of (m/z,intensity), representing a MS2 spectrum.
:param precursormz: m/z of precursor ion for MS2 spectrum
"""
super(SpecEntityData, self).__init__()
self.... |
b0310e620574c2a723e15c5c4d877c90e2f4cbd5f637e919c8ed031fbd10a2cf | Python | 4,635 | 119 | """Modernized FeatureGraphDataset for PyTorch 2.x.
Copied from P1 for P2 independence. See P1/src/dataset.py for full docs.
"""
import random
from functools import reduce
import numpy as np
from torch import LongTensor, Tensor
class FeatureGraphDataset:
def __init__(self, features: np.ndarray, label: np.ndarra... |
169143b29343c242eea7b247821de7a8da1a3f7cbec8bacc551493b6a1a355f4 | Python | 4,636 | 167 | # Copyright 2022 Google LLC.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
adc30f03f1d1a1161b87579b9806bb896ed5a71a68cb9d44c98be35a0fac1d33 | Python | 4,640 | 145 | #!/usr/bin/env python3
"""
Hi-C normalization preprocessing command for Hi-Compass.
"""
import logging
from ..preprocess import HiCNormalizer
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
def configure_parser(parser):
"... |
ca0d82bd9e0c6d58f0f983f34e0d69ad85e9a3c1ba7372b3802e32115a74582f | Python | 4,641 | 79 | import logging
from ..Studies.AbstractStudy import AbstractStudy
from ..Utils.resources import SharedResources
class SegmentationStudy(AbstractStudy):
def __init__(self):
super().__init__()
def run(self):
"""
:return:
Examples
# The 'GT volume (ml)' column is a ... |
2b04ffb7960bd7fc923e98dc8c3f5127ae828601bedec35c318bac3f46d70b2e | Python | 4,643 | 123 | '''Visualize the hit rates per parameter combination using a heatmap and circles that indicate the fraction of good trials.
This is only possible using single runs. Adjust the "varnames" variable as needed.'''
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.rcParams.update({'font.size': 25})... |
a124bc305c45aad70f7dd121984bae891296f3f35383792d2f16a1945f21d047 | Python | 4,645 | 121 | from typing import List, Optional
import os
import xml.etree.ElementTree as ET
from pydantic import BaseModel, Field
from aurelian.utils.search_utils import web_search
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIModel
class Citation(BaseModel):
"""Citation model for query results wi... |
0136a126291f023ec0dae479259dc8e8a03e333874793f9de2e8c6f02da8bc37 | Python | 4,647 | 168 | import logging
from abc import ABC, abstractmethod
class _BaseLogFilter(ABC):
"""Base class for log filters that handle string or list of strings.
Parameters
----------
strings : str or list of str
String(s) to use in the filter logic
"""
def __init__(self, strings: str | list[str]) ... |
4036427b33c942183c36d29bc1c551b4e06630a2cd1092113e62f9cdb9450380 | Python | 4,649 | 150 | # Copyright 2022 Google LLC.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
c83576689e46248a89605fceea9e6332e30278a04c8945ac556b8c81927788f2 | Python | 4,650 | 117 | import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import joblib as jl
import cebra.datasets
from cebra import CEBRA
from multiprocessing import Pool, cpu_count, pool
import percephone.core.recording as pc
from percephone.analysis.utils import get_zscore
def get_recs_dict(use... |
d6ca89017c5c3df36db6268d6c111ea9477b8f2772c49d395c25f6d810479dee | Python | 4,650 | 81 | from datetime import date
from truesight import plot_utils, stats_utils
from truesight.db.models import (
DbLLM,
)
from truesight.db.session import get_session
from truesight.evaluation import services, evals
from loguru import logger
async def main():
prompts = [
"Name your favorite arthropod using o... |
e30ca7c0ad66d07afccd4e50142d273a612dd3157c41f9701280977faaf2c24a | Python | 4,650 | 167 | """
Plotting utilities and common functions for Ethopy analysis.
"""
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import logging
from typing import Dict, Optional, List, Tuple
logger = logging.getLogger(__name__)
def validate_dataframe(
df: pd.DataFrame, required_columns: List[str], p... |
52019bd58b89e1dc1235d57b88fc3158a388f48a8fb177ecbf27aefd23111a11 | Python | 4,654 | 123 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from typing import Iterable, Optional
from gufe import (
ChemicalSystem,
Component,
ProteinComponent,
ProteinMembraneComponent,
SmallMoleculeComponent,
SolventCompon... |
10d3093283071dd399713ed6b731d03fb470b70dda5c088df1d58dad872f803e | Python | 4,659 | 131 | # coding=gbk
import os
import re
import h5py
import shutil
import numpy as np
import pandas as pd
from scipy import io
import nibabel as nib
from tqdm import tqdm
import scipy.stats as stats
from nilearn import plotting
import matplotlib.pyplot as plt
from scipy.stats import pearsonr
if __name__ == '_... |
39f5d99d48432453e32958949b9d70cd9bf21287509fec47f016d0f8f6c851da | Python | 4,659 | 126 | """Pytorch Lightning image classifier.
Uses regular backprop.
"""
from __future__ import annotations
import functools
from dataclasses import dataclass
from logging import getLogger
from typing import Any
from hydra_zen import instantiate
from lightning.pytorch.callbacks import Callback, EarlyStopping
from torch imp... |
d4d26042ddef7eb081ff545b19a6e235421e1b9cd9b3df5a59b758423b3dd89b | Python | 4,660 | 130 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda.
"""
from qtpy.QtWidgets import QAction
from qtpy.QtGui import QGuiApplication
from . import help_windows, io
def mainmenu(parent):
# --------------- MENU BAR --------------------------
open_file = QAction("Load ... |
51baaa1a7bad2f982c166e8d70b0ccf52fbe94914986082fcd0cfa8c777dac1b | Python | 4,663 | 90 | import os
import shutil
import configparser
import logging
import sys
import subprocess
import traceback
import zipfile
import pandas as pd
def test_validation_docker(test_dir):
"""
Testing the CLI within a Docker container for the validation unit test, running on CPU.
The latest Docker image is being hos... |
0299c7e37899a4ce13a0fa52a44d4a41fda6178a3b1c24d73dbfd7ead8d7d227 | Python | 4,665 | 155 | """
MCP tools for working with PaperQA for scientific literature search and analysis.
"""
import os
from typing import Dict, List, Any, Optional
from mcp.server.fastmcp import FastMCP
import aurelian.agents.paperqa.paperqa_tools as pt
from aurelian.agents.paperqa.paperqa_agent import paperqa_agent, PAPERQA_SYSTEM_PRO... |
0e53daa510ec62ec1d7bad2a3a1d15cc5bc2d956875da25de1a107167e28378e | Python | 4,672 | 120 | # Downloaded from original authors at https://github.com/rahi-lab/YeaZ-GUI/tree/master
import torch
import torch.nn as nn
class UNet(nn.Module):
def __init__(self):
super().__init__()
self.conv2d = nn.Conv2d(1, 64, kernel_size=3, padding='same', padding_mode='zeros')
self.conv2d_1 = nn.Conv... |
47ffc4cf625ba9a41e93cfb0f0de455caaa86d3af754d0009e60aa26b7871946 | Python | 4,673 | 125 | """Save Keras models as a SavedModel for TensorFlow Serving"""
import os
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import tf_logging
def export_model(keras_model, export_path, model_version=0, weights_path=None,
include_optimizer=True, overwrite=True, save_format='... |
9ca26f3d33607166be3a4f4650130456923e24bd9a43c6713779600771db69f5 | Python | 4,674 | 162 | #!/usr/bin/env python
"""
Generate documentation for MultiQC modules and changelog.
Usage:
python scripts/make_docs.py <docs_repo_path>
"""
import json
from typing import Dict
import yaml
from markdownify import markdownify
from pathlib import Path
from textwrap import dedent
import subprocess
from multiqc impor... |
3f386a356e910bd1398d11bdc41ccc1953f7bbeb50993b7a21dabfcc301e12c1 | Python | 4,677 | 178 | """
MCP tools for working with phenopacket databases.
"""
import os
from typing import Dict, List
from mcp.server.fastmcp import FastMCP
import aurelian.agents.filesystem.filesystem_tools as fst
from aurelian.agents.phenopackets.phenopackets_agent import SYSTEM
import aurelian.agents.phenopackets.phenopackets_tools a... |
fd4d6c3d46656222306c25ca31281351f5c02400e9c1cfb711fcf2f2f420eaaf | Python | 4,685 | 136 | import os
import math
import numpy as np
from PIL import Image
import torch
from dataclasses import dataclass
from accelerate import Accelerator
from diffusers import UNet2DConditionModel
from diffusers import DDPMScheduler
from utils.pipeline_ddpm import DDPMPipeline
from transformers import BertTokenizer, BertMode... |
693fc53504b5a518c81f777d48007ddcde5345d279e50ac4c9819fd8406e3c6a | Python | 4,689 | 119 | import os
import json
import numpy as np
import pandas as pd
import nibabel as nb
import pooch
# Same Zenodo source as MultiTaskBattery/battery.py
ZENODO_RECORD = "18793343"
CACHE_DIR = pooch.os_cache("MTB_task_library")
VERSION = "V1"
ATLAS = "multiatlasHCP"
N_DIMS = 8 # MDS dimensions to keep (viewer lets you pick... |
3a64a7ab712a762b6af09e6fe715cc9994921e32e7e1ab5b59265b2fae49ba50 | Python | 4,691 | 129 | """distutils.spawn
Provides the 'spawn()' function, a front-end to various platform-
specific functions for launching another program in a sub-process.
Also provides the 'find_executable()' to search the path for a given
executable name.
"""
import sys
import os
import subprocess
from distutils.errors import Distuti... |
54c1a7310be6a8e67d224808e98fc66902e6580bd9596dcbd2d6cd7869dbf02c | Python | 4,691 | 137 | import numpy as np
from scipy.signal import savgol_filter
from scipy.stats import pearsonr
from sklearn.cluster import DBSCAN
def calc_similarity_score(neuron_index, adj_matrix, indices_to_lookat=None):
"""Calculate the pearson correlation between the presynaptic and postsynaptic connections of a neuron."""
... |
d2c0719e8d1202535824df5f8a9bc8234742d3624f4bec84fb65167b0ef15bbf | Python | 4,697 | 114 | import os
import shutil
from time import sleep
import logging
import platform
import traceback
import requests
import zipfile
import pytest
from PySide6.QtCore import Qt
from gui.RaidionicsMainWindow import RaidionicsMainWindow
from gui.UtilsWidgets.CustomQDialog.ImportDataQDialog import ImportDataQDialog
from utils.... |
4a2172d560e0c29f6c0abf9496ec0c5a7c58884f54b95f2c3d2fc03c4ede9119 | Python | 4,701 | 145 | """End-to-end test for model queue functionality using tiny datasets."""
import tempfile
from pathlib import Path
from unittest.mock import patch
import yaml
def create_tiny_queue_config():
"""Create a minimal queue config for testing with tiny datasets."""
return {
"queue_settings": {
"... |
a5e0aa068ffde0fe2daa2920231a3c939657f75ce9c4cb2206e5bd0c908965b3 | Python | 4,703 | 144 | """Cytoplasmic segmentation application"""
import os
import tensorflow as tf
from deepcell_toolbox.processing import histogram_normalization
from deepcell_toolbox.deep_watershed import deep_watershed
from deepcell.applications import Application
MODEL_PATH = ('https://deepcell-data.s3-us-west-1.amazonaws.com/'
... |
a23a858d058d0a76a4f711e5623d42fed0f7b0f8c3a8f13474ce0fe32afe032d | Python | 4,706 | 135 | # 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... |
f02b6d0ad7e216b454e055f8f898d7bc3067a4c627cf7a0e56f56e3f63a53231 | Python | 4,711 | 181 | """
MCP tools for creating LinkML schemas and example datasets
"""
import os
from mcp.server.fastmcp import FastMCP
import aurelian.agents.filesystem.filesystem_tools as fst
from aurelian.agents.linkml.linkml_agent import SYSTEM
from aurelian.agents.linkml.linkml_config import LinkMLDependencies
from aurelian.agents.... |
9ea4d85b2d31ecf64e5c4a5ffc830914b8c57a4672ca485ec8dd56d45e8830b0 | Python | 4,712 | 126 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 13 16:24:50 2016
@author: david
"""
"""
Combinations to run:
- each main arg with
- different combinations of:
-file arrangements
- what order commands are called on a directory structure
- which of the allowable ways of specify the dire... |
3c30ac13a886cddcdd1ff2313dd10140c63ed049622b37be88149750c8e743cf | Python | 4,715 | 142 | import struct, warnings
import ctypes as C
from ctypes.wintypes import DWORD, HANDLE
import numpy as np
# Note that mpusbabi.dll should be located in the same directory as this file
LIB = 'mpusbapi.dll'
class LActuator():
def __init__(self, vidpid=r'vid_04d8&pid_fc5f', pos_retracted=0.05, pos_extended=0... |
ac1ea08728da204eeee17b4bd30e437912d8eeacd92191330907a0ebb19ce6ef | Python | 4,716 | 118 | """Downstream classifier / regressor heads used to evaluate utility.
The MRI2PET evaluation includes "synthetic PET unlocks better downstream
models" experiments: we train small 3D CNNs to predict ADNI diagnosis
(CN/MCI/AD) and MMSE from various combinations of MRI, real PET, and
synthetic PET. The two heads here are ... |
4a79d3dab4a4e1b4fb7681ae69f2fff80fae799b1c63e106c01caeabf0e161d3 | Python | 4,717 | 105 | """MultiQC submodule to parse output from RSeQC junction_annotation.py
http://rseqc.sourceforge.net/#junction-annotation-py"""
import logging
import re
from typing import Dict
from multiqc import BaseMultiqcModule
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
def parse_reports(module: BaseMu... |
bb3b23d03ab19eab5acc333de6096c89f19be9da9681ca2b8100265122695d8d | Python | 4,717 | 126 | """
experiments/mf_main/03c_landscape_descriptors.py
==================================================
Extract 8-dim landscape descriptors from existing sweep checkpoints.
Output
------
results/fingerprints/landscape_descriptors.npy shape (N, 8)
results/fingerprints/landscape_meta.json dataset names + dim nam... |
9723cdcdc28979aba0f21811ef78f8c377a9784b443a2f48ae750918e9ec1309 | Python | 4,718 | 124 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2018 Volker Hovestadt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
75f41d403d2272e09446b38d83ce5a90fad41468c19ce31148ee8ca71788c10e | Python | 4,722 | 146 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pathlib
import MDAnalysis as mda
import pytest
from gufe.protocols import execute_DAG
from openff.units import unit
from openfe.protocols import openmm_md
@pytest.mark.integration
... |
5e069b4dc82867832e4671d4a91d2b84fa1e6056b9c60170b15635242f81f837 | Python | 4,725 | 135 | """
methods/missforest_xgb.py — MissForest + XGBoost
=================================================
Iterative Random Forest imputation (MissForest, Stekhoven & Bühlmann 2012)
followed by XGBoostClassifier.
Reference
---------
Stekhoven, D.J. & Bühlmann, P. (2012). MissForest—non-parametric missing
value imputation ... |
5394f79d5067a46b22bbcbb9f5e26f7f4993f74bbb4fcf46bf38214fb499e718 | Python | 4,731 | 118 | import logging
import os
from multiqc.base_module import ModuleNoSamplesFound
from .base_metrics import DragenBaseMetrics
from .content_metrics import DragenContentMetrics
from .gc_metrics import DragenFastqcGcMetrics
from .read_metrics import DragenReadMetrics
from .util import parse_fastqc_metrics_file
log = loggin... |
f78363349a9e452c301d3adea6a8b9938ce513c56865c84d0721d6400ae86214 | Python | 4,736 | 145 | # -*- coding: utf-8 -*-
"""
Anterograde projection summary stats.
- Loads anterograde volume and masks by subdivision
- Calculates projection strength and projection density on an HPC system with multiple cores
- Saves as a csv
"""
import os,re,csv
import pandas as pd
import SimpleITK as sitk
from pathlib import P... |
3135f9f687938d9a5f8d8fd76aa0196f56cf33047b59e6bc6ada8d846f82438c | Python | 4,737 | 135 | """
methods/combined.py — Combined Ch4→Ch3 and Ch3→Ch4 Pipelines
==============================================================
Two combined methods:
- ch4_ch3: GCT repairs missing features → GraphSGAN propagates labels
- ch3_ch4: GraphSGAN generates pseudo-labels → GCT uses them as supervision
"""
from __future__ imp... |
c4d62e6b119ad18ab3cc167df46a6addfdf2285aa08c96349f6acdb047b988b8 | Python | 4,738 | 117 | # -*- 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 ... |
adfba8e651f03398b04620588ea9e6acb0f3276581ea1a6fd6ed5c0a134cd721 | Python | 4,743 | 104 | #!/usr/bin/env python
'''
Convert BAM file into wig file. BAM file must be sorted and indexed using SAMtools.
Note: SAM format file is not supported.
'''
#import built-in modules
import os,sys
if sys.version_info[0] != 2 or sys.version_info[1] != 7:
print >>sys.stderr, "\nYou are using python" + str(sys.version_info[... |
d4c42237d1fdb1cb7f14a7bedbd3530cc127b6cfbaaec1e6b480a48948d229cf | Python | 4,749 | 174 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import json
from openfe.protocols import openmm_septop
import gufe
from gufe.tests.test_tokenization import GufeTokenizableTestsMixin
import pytest
@pytest.fixture
def protocol():
retur... |
21448bbe7c6ef980217c18bd4c8301abcafb33a23c3bf915a12c20bd3c0a0d64 | Python | 4,750 | 128 | # !/usr/bin/env python
# -*-coding:utf-8 -*-
# @Time : 2022/05/28 21:18
# @Author : Liangdi.Ma
import numpy as np
# from .caption_modules.bleu.bleu import Bleu
# from .caption_modules.cider.cider import Cider
import torch
from pycocoevalcap.bleu.bleu import Bleu
from pycocoevalcap.meteor.meteor import Me... |
e81881fdbde5bcd1d821529bceb0e18b46c999296ce50d4afa205e1d694a9c8c | Python | 4,750 | 142 | import logging
import re
from typing import Container, Iterator, List, Optional, Union
from pip._vendor.packaging.version import LegacyVersion, Version
from pip._internal.utils.misc import stdlib_pkgs # TODO: Move definition here.
DistributionVersion = Union[LegacyVersion, Version]
logger = logging.getLogger(__nam... |
897c65298fb29dd5c51c34b90c51df8ad3adf3b25d3d1ba47b598b63c29c72d9 | Python | 4,751 | 157 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Callable, Tuple
import numpy as np
import pytest
from aicsimageio import exceptions
from aicsimageio.readers.default_reader import DefaultReader
from aicsimageio.writers.timeseries_writer import TimeseriesWriter
from ...conftest import LOCAL, array_co... |
ec3a5b5c533e7dba86bf636a09a3c7d93ae3f787d667cb8d66472d59ad2e7fa5 | Python | 4,752 | 104 | # --- Ethopy Module Imports ---
# Ensure these paths correctly point to your ethopy installation structure.
from ethopy.experiments.match_port import Experiment
from ethopy.behaviors.multi_port import MultiPort
from ethopy.stimuli.tones_grating import TonesGrating
# --- Session Parameters (Typically Fixed) ---
# Thes... |
f6da7083e48c782e0d94f8acfcb92159b2dd7910219cad87eee4695319655228 | Python | 4,753 | 104 | #!/usr/bin/env python
import argparse
import barChart as bc
import boxPlot as bx
import glob
import json
import matplotlib.pyplot as plt
import os
import quickPlot as qp
def func_write_json( dict_json, str_file_name ):
""" Write a dict representing json to a file """
with open( str_file_name, "w" ) as hndl_... |
203c4bebbd933e07084496987b38c964269752b7026761e616287e05ca4b19e0 | Python | 4,758 | 147 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Any, Dict
import dask.array as da
from imageio import get_writer
from .. import types
from ..dimensions import DimensionNames
from ..exceptions import InvalidDimensionOrderingError, UnexpectedShapeError
from ..transforms import reshape_data
from ..util... |
92b78158d06314dc4ae2e2c06ead0a47bc3c578263da28cfffc320d6215637c6 | Python | 4,758 | 122 | """MRI2PET phase 1: MRI-only self-supervised pretraining.
For every MRI in ``mriDataset.pkl`` (ADNI + PPMI + UKBB), use the
PET-style image at ``config.mri_style_dir`` (produced by
``src/utils/styleTransfer.py``) as the prediction target and train the
diffusion model to denoise that target conditioned on the MRI. This... |
802ad0c0f058d8e64179e76f28e2dd459dd6d4b21133ad1f1ba7789a05bffbd6 | Python | 4,760 | 113 | """
pip._vendor is for vendoring dependencies of pip to prevent needing pip to
depend on something external.
Files inside of pip._vendor should be considered immutable and should only be
updated to versions from upstream.
"""
from __future__ import absolute_import
import glob
import os.path
import sys
# Downstream r... |
9f1889c61f2a2b95835f5d56bd7ffb06af045ee2a68ced68acca28f83987168f | Python | 4,761 | 118 | # -*- coding: utf-8 -*-
"""
Plot pairwise overlap in anterograde dataset for Fig 3g.
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
def insert_names(overlap_data,l5):
overlap_data = overlap_data.assign(vol1_name=pd.Series(dtype=str))
overlap_data = overla... |
fb91e4fd6770358f0ee77a441244607bac8d8c57e88153cf386a7627cdb7f7f3 | Python | 4,763 | 156 | import numpy as np
from scipy import interpolate
from ethopy.behaviors.multi_port import MultiPort
from ethopy.experiments.match_to_sample import Experiment
from ethopy.stimuli.panda import Panda
global logger
interp = (
lambda x: interpolate.splev(
np.linspace(0, len(x), 100),
interpolate.splrep(... |
2043651f946557ac62e9760d3e0016a10584dbdba76fc3a8801b40590bad2585 | Python | 4,767 | 138 | import nrrd
import numpy as np
from scipy.spatial import cKDTree
from collections import Counter
from nemsi.visual import PlotterWindow
import statistics
import math
def calculate_stats(values):
mean = statistics.mean(values)
std_dev = statistics.stdev(values)
# Round mean to nearest integer
rounded_... |
86f6b20bfdc3ad56654fb6f76e8a8ac24f00f10bd7f7a04d8aff5362b5350e19 | Python | 4,767 | 120 | """Correlate whole brain betas with model parameters / modulators. Results
are saved as .nii's, .npy's, and surface renderings.
"""
import sys
import subprocess
import warnings
import numpy as np
import pandas as pd
from nilearn.image import new_img_like,load_img
from tqdm import tqdm
sys.path.append(__file__[:__fi... |
4c9076d90381994f222101399d26ae7c13ca839c48814bbb421fb690a75f5678 | Python | 4,779 | 149 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 23 12:01:09 2023
@author: ashwin.bhandiwad
"""
import csv,sys,re
import multiprocessing
import numpy as np
import pandas as pd
from pathlib import Path
from neuron_morphology.swc_io import morphology_from_swc
from neuron_morphology.feature_extractor.data import Data
sys.p... |
c4449064810a412803ca2be63a26d48f4a617a652e7ec157072ce1376f3d5528 | Python | 4,782 | 131 | import torch
import torch.nn as nn
import torch.optim as optim
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from torch.utils.data import DataLoader, TensorDataset
from utils.func import evaluate_forecasts
import pandas as pd
import numpy as np
# 使用IQR方法剔除异常值
def ... |
24adbff886b1090b088ddee4179c0c877244476a0d4fcab347bdb9d13e0cced9 | Python | 4,792 | 118 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 20 09:08:37 2023
@author: ashwin.bhandiwad
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
def insert_names(overlap_data,metadata):
overlap_vol1 = overlap_data['Volume1'].to_list()
overlap_data['Volume1'] = [... |
0412b98b1ad38cb4796c66b39830b6797bc4937f75351727db3e4bc88865a0fc | Python | 4,798 | 97 | """
respa.py: Implements the rRESPA multiple time step integration method.
This is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structures at Stanford, funded under the NIH Roadmap for
Medical Research, grant U54 GM072970. ... |
6f79d1d2e1f6e731a33635c748de42ea615951bcfc4842245d66dc414a5791e4 | Python | 4,798 | 108 | #!/usr/bin/python
from __future__ import division
from __future__ import print_function
from builtins import range
from numpy import *
from sys import argv,stderr
from time import sleep, time
import os
AN = {'H' : 1, 'He' : 2, 'Li' : 3, 'Be' : 4, 'B' : 5, 'C' : 6, 'N' : 7, 'O' : 8, 'F' : 9, 'Ne' : 10,
'Na' ... |
33f398dcc5b6c1eb7125aea9f538ed9d1ebc037c0f572915e607f2090864d141 | Python | 4,799 | 119 | import pandas as pd
import numpy as np
from typing import List, Tuple
import os
import argparse
from intervaltree import IntervalTree, Interval
def load_peak_file(file_path: str) -> pd.DataFrame:
"""Load narrowPeak format file."""
columns = ['chr', 'start', 'end', 'name', 'score',
'strand', 'sig... |
c6356ffd87a145a5090fa5a6001d34bc935b050d82116398daf386ad0fd71f6a | Python | 4,807 | 139 |
'''
Code used for the analysis of the ISMRM 2022 abstract "Evaluating the match
of image quality metrics with radiological assessment in a dataset with and
without motion artifacts"
'''
import nibabel as nib
import numpy as np
import argparse
import sys
from skimage.metrics import peak_signal_noise_ratio, structu... |
b014e52156c116e3934645ece19fd000251fa0ce464098c4f8b18a47d959eb5d | Python | 4,810 | 120 | import logging
import re
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
def __init__(self):
super().__init__(
name="Conpair",
anchor="conpair",
href="https://github.com/... |
0f4538a2131dc6ec8aa63919cd525f709bf7a07c43bfbdd1ecaaf9b561954d55 | Python | 4,814 | 164 | import numpy as np
import os
import matplotlib.pyplot as plt
from datetime import datetime
import torch
def calculate_metrics(predictions, targets):
"""Calculate evaluation metrics, including RMSE"""
predictions = np.array(predictions).flatten()
targets = np.array(targets).flatten()
# Calculate corre... |
276c42d8d564041e03416addc20f9af06e4b461896e38bd6733782be66487109 | Python | 4,814 | 154 | """Geometry factories based on the geo interface."""
import numpy as np
from shapely.errors import GeometryTypeError
from shapely.geometry.collection import GeometryCollection
from shapely.geometry.linestring import LineString
from shapely.geometry.multilinestring import MultiLineString
from shapely.geometry.multipoi... |
098a5f8a4ec4ca0bc50446b58cedf0ccb17147c14d146dab62bc7240068a614c | Python | 4,817 | 137 | # ADAPTED FROM https://github.com/facebookresearch/hydra/blob/main/examples/advanced/hydra_app_example/tests/test_example.py
from __future__ import annotations
import typing
from pathlib import Path
import pytest
from hydra import compose, initialize_config_module
from omegaconf import OmegaConf, open_dict
from beyo... |
314f1f6a18ac54bf1d518b4c307e675ef7ca8ebc15077e43fd24e984fc9f9387 | Python | 4,817 | 120 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pathlib
import pytest
from gufe.protocols import execute_DAG
from openff.units import unit
import openfe
from openfe.protocols import openmm_afe
@pytest.mark.integration # takes ... |
99badecf36c3a777e85e7e05995817a5f44db9a90be640565a4a10c1ce1cadbc | Python | 4,819 | 133 | """Modernized Generator and Discriminator for PyTorch 2.x.
Ported from P1-scripts/Nets.py with changes:
- nn.init.xavier_uniform_() (with underscore)
- Removed Variable() wrapping — direct tensor ops
- torch.tanh() replaces F.tanh()
- Configurable hidden_sizes for matching original code capacity
"""
from typing impor... |
e30935b93050017ce21d262f31bcc6e0e9af505c93596cf0a45159f2cbf98e15 | Python | 4,822 | 104 | #!/usr/bin/python -u
import os
import re
import sys
import json
import math
import argparse
def find_files(path, pattern):
for root, dirnames, filenames in os.walk(path):
for filename in filenames:
if re.match(pattern, filename):
yield os.path.join(root, filename)
parser = argp... |
388cfd14501d825d10f4e60a85a320dfd0e8d071381f263859c86f08bd1b40ee | Python | 4,823 | 123 | import logging
import os
import re
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
Note that the versions < 1.7.8 use the basename of the file path to distinguish samples,... |
3c752f4c17c9c53d52c1291d275d92ca68ae1a51a87292b7fe557f7732ed4bd1 | Python | 4,823 | 114 | from __future__ import annotations
from pathlib import Path
from typing import Iterable
import pandas as pd
TARGET_CLASSES = ["BKL", "MEL", "NV", "BCC"]
ISIC2019_MAP = {"MEL": "MEL", "NV": "NV", "BKL": "BKL", "BCC": "BCC"}
PAD_UFES_MAP = {"MEL": "MEL", "NEV": "NV", "SEK": "BKL", "BCC": "BCC"}
ISIC2020_MAP = {"melano... |
d2a6f55127aa2d3640956db90ebc80c3652ef5302b289aefd48c4e0ba9f21684 | Python | 4,823 | 142 | import os
import re
import numpy as np
from sqlalchemy.sql import select
from refs import evaluation_refs, llm_teacher_refs, llm_base_refs
from refs.experiments import gsm8k_cot_refs_v2
from truesight import file_utils, plot_utils, stats_utils
from truesight.db.models import (
DbEvaluation,
DbEvaluationQuestion... |
aaade62c2b1602c452bb7d8fbfc2c9b77e453cefdb8468b2830e8ec87afe689e | Python | 4,824 | 127 | # -*- 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
Licens... |
f445d1c42a7288c0a553cefe3f913aead705c726dc03f2b32ebcdc2b656def3b | Python | 4,826 | 184 | import logging
import pathlib
import sys
import sysconfig
from typing import List, Optional
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
from . import _distutils, _sysconfig
from .base import (
USER_CACHE_DIR,
get_major_minor_version,
get_src_prefix,
site_packages,
user_site,
)
__a... |
20e70736f9abf5e5c5e6c442546348f6caf345cf0a77c9ab8fe52a004e0b8e68 | Python | 4,831 | 147 | ### script to execute GeO score calculation for a single protein
### meant to be executed as a standalone job
import os, glob, sys, argparse, warnings
import pandas as pd
import numpy as np
from evcouplings.compare import DistanceMap
from copy import deepcopy
from scipy.stats import ks_2samp
from evcouplings.visualize... |
cd1e084d8ae2d6043bb1691a5868a118b2cb6b5792ec8710436bf5dc35618fc1 | Python | 4,833 | 122 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
#import inspect
import os,sys
import csv
import argparse
import subprocess
import gzip
import glob
import logging
##
## This script decorates the Cosmic coding vari... |
c75fad5b4381e233875dd894a1683ec3154cc983d4dded4443cf08a7ac7b2070 | Python | 4,839 | 159 | # Copyright 2022 Google LLC.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
360b068b3be46911480126681a7d72f69a6f22a0be588e90b96c0f84dd811d6d | Python | 4,844 | 142 | """Test TorsionStore."""
import os
import numpy
import pytest
from openff.qcsubmit.results import TorsionDriveResultCollection
from openff.utilities import get_data_file_path
from yammbs.torsion._store import TorsionStore
class TestTorsionStore:
"""Test TorsionStore methods."""
def test_from_qcsubmit_coll... |
cd05fa5139aa49d0eb4b3b472af501f9ac1a5654b09ac8769cb509cb53231819 | Python | 4,845 | 98 | """GO_BP biological process recognition evaluation cases from CRAFT corpus."""
from typing import Any, Dict
from aurelian.evaluators.model import MetadataDict, metadata
from aurelian.evaluators.knowledge_agent_evaluator import SimpleEntityEvaluator
from pydantic_evals import Case, Dataset
class GoBpMetadata(Dict[str... |
1cd08bf4974d23cd9b082725d709a496a4cbe99a8586969e097479c5731eb9cc | Python | 4,849 | 146 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import csv
# Constants
CHR_COMMENT="#"
STR_VCF_DELIMITER="\t"
I_CHR_INDEX=0
I_POS_INDEX=1
I_REF_INDEX=3
I_ALT_INDEX=4
#RADAR columns
STR_RADAR_DELIMITER="\t"
I_CHR_RADAR=0
I_POS_RADAR=1
I_STRAND_RADAR=3
#REDIPortal columns
STR_REDIPORTAL_DELIMITER="\t"... |
8cee475017bf5728aece829e4b11f6dcbb3ba089dda2f0d06f65679f7cb126cb | Python | 4,856 | 117 | import glob
import pytest
from multiqc import config, report
from multiqc.modules.cellranger_arc import MultiqcModule
from multiqc.utils import testing
@pytest.fixture
def data_dir():
return testing.data_dir()
def test_cellranger_arc(data_dir):
html_files = glob.glob(str(data_dir / "modules/cellranger_arc/... |
c5190da3f931fcd7684cda19642cc6df8555443e6a01d17b787252aea04b2abd | Python | 4,857 | 141 | import numpy as np
import nrrd
from scipy.spatial.transform import Rotation
from spatial_utils import GridSystem, SliceAnalyzer, Slicer
from sklearn.decomposition import PCA
from itertools import chain
BETA = "a2&5-b15"
# Storing the plane normal as constant (same slicing plane as Lam and Sherman 2015)
R1 = Rotation.... |
eedde0ac62c812686140344eee4f2d0c8ee8b89e7d60a4c4bac2ad30f2645608 | Python | 4,858 | 126 | import os
import cv2
import json
import pickle
import natsort
import numpy as np
from PIL import Image
from pathlib import Path
from collections import Counter
import torch
from torch.utils.data import DataLoader, Dataset
from monai import transforms
from monai.transforms import apply_transform
import pandas as pd
d... |
0bb79ee226a00be0f002fd9ef151d52da3b5fcc233bec45bda43de941cf1e2de | Python | 4,859 | 120 | # !/usr/bin/env python
# -*-coding:utf-8 -*-
# @Time : 2022/05/25 20:40
# @Author : Liangdi.Ma
# Copyright (c) Meta Platforms, Inc. and 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.
# -------------... |
d6ccaed23fc56368f092360131592b106a231fb4bf02ad111e85588dfca09db0 | Python | 4,868 | 150 | from experiments import quick_plot
from refs import llm_base_refs
from refs.paper import animal_preference_numbers_refs as r
from truesight.experiment.services import FinetunedLLMRef, SubsetDatasetRef
def main():
baseline_llm = llm_base_refs.gpt41_mini.safety1
animals = [
x.target_preference
f... |
a4cd0891ff4bc305b9a5e1b1c264c62210b2e4226e4c8d32a675993ab6a6b245 | Python | 4,869 | 162 | import click
from plugcli.plugin_management import CommandPlugin
import urllib.request
import importlib.resources
import shutil
from .utils import write
import pathlib
class _Fetcher:
"""Base class for fetchers. Defines the API and plugin creation.
Parameters
----------
resources: Iterable[Tuple[str... |
5f1a41c6cf237812aeb58edeac9b082c2d3951d3223d16d9f4d1c1084ceaec70 | Python | 4,870 | 165 | #!/usr/bin/env python3
import os.path
import numpy as np
from glob import glob
import pandas as pd
import cv2
import skvideo.io
from tqdm import trange
from matplotlib.pyplot import get_cmap
from .common import make_process_fun, natural_keys, get_nframes
def connect(img, points, bps, bodyparts, col=(0,255,0,255)):
... |
50ac9f0af23c5ae112f1baf93d203cd9c2618137ab8a5417c66f0d806a062565 | Python | 4,872 | 188 | #!/usr/bin/env python3
"""
Fetch Material Design Icons SVG files from Iconify API.
This script fetches required SVG files from the Iconify API using the mdi (Material Design Icons)
icon set and saves them to the MultiQC source directory so they are bundled with the PyPI installation.
"""
import requests
from pathlib ... |
aad1514f680e1a25a9f67edb0bbeac99dd3916b144fc914a1eb25b11df43b4f1 | Python | 4,875 | 118 | """
# File : data_module.py
# Time : 2025/10/23 10:28
# Author : Hongmiao Wang
# version : python 3.10
# Description:
"""
"""
The data module is modified from the following source for general evaluation in MassSpecGym:
https://github.com/pluskal-lab/MassSpecGym
@article{bushuiev2024massspecgym,
... |
e580f23c0ff0f39aab9f1b6af1dbbb67f5f65d958757b4cf68ec8019f9de5e77 | Python | 4,878 | 84 | """
Agent for creating ontology mappings.
"""
from pydantic_ai import Agent, RunContext
from .ontology_mapper_config import OntologyMapperDependencies, get_config
from .ontology_mapper_tools import (
search_terms,
search_web,
retrieve_web_page,
)
from .query_preprocessor import search_with_preprocessing
#... |
d8fea7b24500fe9e58ec0c3c1dcbd8d2dec5356e6a85d66302679675a5949d37 | Python | 4,880 | 140 | #!/usr/bin/env python
"""Net summarization tool.
This tool summarizes the structure of a net in a concise but comprehensive
tabular listing, taking a prototxt file as input.
Use this tool to check at a glance that the computation you've specified is the
computation you expect.
"""
from caffe.proto import caffe_pb2
... |
a794f72da9e5968353af8c2dc74b308ace4b7ee1a5d70cbd13e6a7738c61ae7c | Python | 4,884 | 148 | # -*- coding: utf-8 -*-
"""
Anterograde projection summary stats.
- Loads anterograde volume and masks by subdivision
- Calculates projection strength and projection density for a specific layer using an HPC system with multiple cores
- Saves as a csv
"""
import os,re,csv
import pandas as pd
import SimpleITK as si... |
2252e7d3f11f1a101cd99e424867b6ba79a8e13d8877eb14c01ae75ab60e96b8 | Python | 4,886 | 129 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 20 09:08:37 2023
@author: ashwin.bhandiwad
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
def insert_names(overlap_data,metadata):
overlap_data = overlap_data.assign(vol1_name=pd.Series(dtype=str))
overlap_d... |
e774eb4e74cc7c1d4f66a03d2ef080313c9ffc950d27bb4adf0b19964c0b5ca6 | Python | 4,886 | 128 | # https://github.com/fastqe/fastqe
# https://github.com/fastqe/fastqe/issues/11
import logging
from html import escape
from typing import Dict, Optional
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import table
from multiqc.plots.table_object import ColumnDict
log = loggi... |
62e0e824a427c401f83d76513b7eb48cd794b368840abb1cfd6244ce8a31bfe3 | Python | 4,887 | 146 | import random
import sys
import numpy as np
import torch
from dgl.sampling import global_uniform_negative_sampling
from scipy.sparse.csgraph import shortest_path
def k_hop_subgraph(src, dst, num_hops, g, sample_ratio=1.0, directed=False):
# Extract the k-hop enclosing subgraph around link (src, dst) from g
#... |
05a73d0ae755690e8b78603469a91f9a3ff2d785c8fcd9078ec83364858733d9 | Python | 4,889 | 104 | #!/usr/bin/env python
"""
Merge two blacklisted intervals if distance between them is below a given distance.
"""
import sys
from argparse import ArgumentParser
import pandas as pd
def main():
parser = ArgumentParser(prog="merge-blacklist.py", description=__doc__)
parser.add_argument(
"--merge_distan... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.