sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
e92da16fe762b0cf98a21fb49e1aa28b3d39004e7d0dd5006d2ce59e6c7615b5 | Python | 11,336 | 307 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
969270ba8e7c240a1726ecb3e6a5cb9ed6e2fec38081a0b8f758948b2e7e68cb | Python | 11,360 | 373 | import csv
from dataclasses import asdict
from pathlib import Path
import pytest
from hypothesis import given
from hypothesis import strategies as st
from kimmdy import recipe
## Test RecipeSteps
# tests with random inputs
@given(
ix_1=st.integers(min_value=0, max_value=1000),
ix_2=st.integers(min_value=0, ... |
691b7008870fde529e2f90989500b5b9beb094788fb626ee6ed8553b97617695 | Python | 11,372 | 280 | """
twinc_utils.py
Author: Anupama Jha <anupamaj@uw.edu>
"""
import torch
import numpy as np
import pandas as pd
def gc_predictor(seq1, seq2, is_torch=False):
"""
A predictor based on GC content in the first
and second sequences.
:param seq1: np.array, one-hot-encoded sequence
:param seq2: np.arr... |
c26bb6e29037682b86941a6cb38a15f697bd135d9e1d49702fb9a7292148dca2 | Python | 11,377 | 372 | import copy
from collections import UserDict
from typing import Dict
import torch
class FrameDict(UserDict):
def subframe(self, indices):
return type(self)((key, value[indices]) for key, value in self.items())
class EdgeBatch:
def __init__(self, graph, eid, etype, src_data, edge_data, dst_data):... |
8bb8d214de702cfefac0785a53704ef17e40bd75a0584b60e623f5ad3d7ffddb | Python | 11,379 | 256 | import os
import subprocess
import nilearn
from nilearn import image as nimg
from sklearn.preprocessing import StandardScaler
from nilearn import plotting as nplot
from nilearn.maskers import NiftiMasker
import nibabel as nib
import argparse
import pandas as pd
import numpy as np
from numpy import shape
import scipy.st... |
5976ac3dc84915d0d294c1761573bc18434751f29ec421bcca5a9b280de46bae | Python | 11,384 | 278 | import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
class TriangularCausalMask():
def __init__(self, B, L, device="cpu"):
mask_shape = [B, 1, L, L]
with torch.no_grad():
self._mask = torch.triu(torch.ones(mask_shape, dtype=torch.bool), diagonal=1).to(devi... |
45f2a5994ab7f43619d79ea852c1b2eae1a6baabcc9ccc6a17790c017b3e0a2f | Python | 11,386 | 318 | """PluginManager class for managing plugins in the ethopy package.
Classes:
PluginInfo: Dataclass to store information about a discovered plugin.
PluginManager: Manages dynamic loading of user plugins, including core modules and
handling duplicates.
Functions:
_register_plugin: Register... |
7927366e25a5a6040fd171a32447e5760121d56c5506dca92b1401e0b1f2d521 | Python | 11,389 | 294 | """Unified feature transformer for EHR tabular data.
Ensures balanced feature contributions to kNN distance by mapping all
features to [0, 1] range with appropriate transformations:
- Binary (2 unique values): passthrough 0/1
- Ordinal (3-10 unique, ordered): linear scale to [0, 1]
- Continuous (>10 unique): Quantile... |
efe6add647e3d3cb38456f83fc874bcb19b6a59ebc98369cd65c9d1630b72968 | Python | 11,397 | 177 | import os
import shutil
from time import sleep
import platform
import traceback
import logging
import requests
import zipfile
import pytest
from PySide6.QtCore import Qt
from gui.RaidionicsMainWindow import RaidionicsMainWindow
from gui.UtilsWidgets.CustomQDialog.ImportDataQDialog import ImportDataQDialog
from gui.U... |
883367e3ed54e3a35fa2db4b99d8668fdbb6cc1348c410e1c031f181bc9e2de0 | Python | 11,403 | 336 | import errno
import logging
import os
import re
import sys
from typing import Dict, List, Optional
import pandas as pd
import requests
from requests.adapters import HTTPAdapter
try:
# Prefer direct urllib3 import
from urllib3.util.retry import Retry
except Exception: # pragma: no cover
# Fallback for env... |
7afcf4c45a9bb97f7a1845e1326b98b87928b13cf3bb03790c623803c3b3baee | Python | 11,417 | 281 | """
twinc_reg_utils.py
Author: Anupama Jha <anupamaj@uw.edu>
Utility functions for TwinC regression.
"""
import torch
import numpy as np
import pandas as pd
def gc_predictor(seq1, seq2, is_torch=False):
"""
A predictor based on GC content in the first
and second sequences.
:param seq1: np.array, one... |
fe690d77a574cd161e67185508102b61b498f5757ebbbb2a3217c926d3fe0aec | Python | 11,417 | 281 | """
twinc_utils.py
Author: Anupama Jha <anupamaj@uw.edu>
Utility functions for TwinC classification.
"""
import torch
import numpy as np
import pandas as pd
def gc_predictor(seq1, seq2, is_torch=False):
"""
A predictor based on GC content in the first
and second sequences.
:param seq1: np.array, one... |
abe35f70a7b46ee9084e680d6cbddf87ebcd5033ac39695b18e9f3355d168ee5 | Python | 11,419 | 263 | import logging
import csv
from multiqc.plots import table
from ._helpers import group_median_by_cell_prefix
# Initialise the logger
log = logging.getLogger(__name__)
class scFilterStatsMixin:
def parse_scFilterStats(self):
"""Find scFilterStats output."""
self.sincei_scFilterStats = dict()
... |
76d598032eafc864cae350712ea9ee39904c48728d5fda29ea371e0c8de992aa | Python | 11,446 | 316 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
d345f9e933079434431995b0e6597965323927a45c9f2c7b7af90b113af59cee | Python | 11,458 | 261 | import csv
import json
import logging
from collections import defaultdict
from typing import Dict
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph, box, table
log = logging.getLogger(__name__)
REFINE_CATEGORIES = {
"fivelen": "5' primer length",
"thr... |
8d868058af3279f0d4a538fcc6d6935a5c924d5cae3f9e68594703c062701677 | Python | 11,476 | 318 | # 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,... |
a25c38ebd66eef69176b578e07f03af0af3aa6b9e1d0a91ac9f3668396ed9e7b | Python | 11,477 | 350 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
from gufe import LigandAtomMapping, ProtocolDAGResult
from openfe import ChemicalSystem, SolventComponent
from openfe.protocols.openmm_afe import (
AbsoluteBindingProtocol,... |
3cc043931f77ce5e04d198666086cf369b2120973c25bc47f7eed593aaf9883e | Python | 11,485 | 276 | import re
from operator import itemgetter
from bisect import bisect
from typing import Tuple, Union, Dict, List
from math import sqrt
from operator import add
def humanize_genomic_dist(dist, units=1) -> str:
"""
Turn genomic distance (in base pairs) into human-readable string (supports Mb, Kb and bp)
"""... |
65b854907b590d2d4ece75630a07dab87063683a908b2335f5c5e10b4ad3839b | Python | 11,485 | 312 | """Tests for hyperparameter tuning functionality."""
import json
import os
import tempfile
from pathlib import Path
from unittest.mock import Mock, patch
import pytest
import yaml
from timeflies.core.hyperparameter_tuner import HyperparameterTuner
class TestHyperparameterTuner:
"""Test the HyperparameterTuner ... |
dfe5703f98415974bd47bd7af76fcbcf7e786b28784f453d936ab1b3030446bf | Python | 11,501 | 360 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
from gufe import ProtocolDAGResult, LigandAtomMapping
from openfe import ChemicalSystem, SolventComponent
from openfe.protocols.openmm_afe import (
AbsoluteBindingProtocol,
... |
189a9f1f2352c5ea66c51ca81228c21d84be693c1fb9d866479b1fce9ba924c4 | Python | 11,502 | 293 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
73f010a601274a1fb4479fbf129364c7ec4e2503e5ce41f8dfc1bd0da6d6e273 | Python | 11,505 | 348 | """
Visualization Utilities for MS3SEG Dataset
Functions for plotting images, masks, predictions, and results
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from pathlib import Path
import seaborn as sns
import pandas as pd
# Publication-ready matplotlib settings
plt.rcP... |
c73913d4a5859d4657a662170b0e1466556e596090f38ecfcd94bb1536e4d2e6 | Python | 11,515 | 280 | """
ArtifactInjection.py — REST V2.0
═══════════════════════════════════════════════════════════════════════════════
Synthetic artifact augmentation for training the 4-class REST model.
Injects fake artifact patterns into clean STFT epochs and overwrites their
label to Artifact (3). Operates on the same shape the m... |
6c4ce7a2de0e9eb34e3e8cc8e59a5940be292ddb496647f2076d6c6cf8bde9f4 | Python | 11,538 | 261 | """
Super Special-Case MultiQC module to produce report section on MultiQC performance
"""
import logging
from typing import Dict, Union
from multiqc import config, report
from multiqc.base_module import BaseMultiqcModule
from multiqc.plots import bargraph, table
from multiqc.plots.bargraph import BarPlotConfig, CatN... |
e2593a67aa8160460b8a5090bdf556c15d4e669486475bb3a3a962e8536e1754 | Python | 11,552 | 365 | import contextlib
import copy
from collections import defaultdict
from typing import List, Tuple, TYPE_CHECKING
from openff.nagl.features.atoms import AtomFeature
from openff.nagl.features.bonds import BondFeature
from openff.nagl.features._featurizers import AtomFeaturizer, BondFeaturizer
from openff.nagl.toolkits.op... |
cb4df5382f47a8083c62a5d5138d78b59418e4ba309fa807893d3d9b1d3f47c8 | Python | 11,553 | 318 | # this file generally mirrors video generation in anipose
# with some custom patches to support what we want in cheese3d
# it also decouples the visualization from anipose allowing
# us to iterate a bit quicker
import os
import re
import cv2
import queue
import threading
import skvideo.io
import numpy as np
import pand... |
43de58b412976f953bb4e21ef8e21d1f45251e0b1c6612acc8c6d3d1377addd9 | Python | 11,558 | 302 | """
Gradio Interface for Knowledge Agent.
"""
import asyncio
import tempfile
from pathlib import Path
from typing import Tuple, Optional
import gradio as gr
from .knowledge_agent_agent import run_sync
from .knowledge_agent_config import get_config
def extract_entities_sync(text: str, schema: str = None, generate_sc... |
d8e45e14eec87926fa2b947ff8db688788fd95ac601e019f846ec4a14cbddd3f | Python | 11,559 | 259 | #!/usr/bin/env python3
"""
Experiment 06 — LODO Cross-Validation
========================================
Evaluates the recommender against 7 baseline strategies using
Leave-One-Dataset-Out cross-validation.
Four cross-track variants are also run:
within_eicu — LODO restricted to eICU datasets
within_gct — LODO... |
4ca44d02d2f814e30fc06ca6057e19f97b9382571d8fe5ca5dd79819a7315978 | Python | 11,560 | 322 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
9ab8491ec38527e1d0b060f3bba97ecd5fc5fba6cd9a65494db547f205435d5c | Python | 11,591 | 362 | """Graphical user interface when an experiment starts."""
import os
from typing import Union
import pygame
import pygame_menu
class PyWelcome:
def __init__(self, logger) -> None:
self.logger = logger
self.SCREEN_WIDTH = 800
self.SCREEN_HEIGHT = 480
if not pygame.get_init():
... |
18596948826873bedc1042b5942a36f2f8a90a0ef837e63d2fb99cd5c50b2d3f | Python | 11,596 | 239 | # -*- 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 ... |
6387272a56a93c643da320260ae46807fa0d30bc495b5776fffb01c278e089ef | Python | 11,613 | 334 | """
Evaluation Script for MS3SEG Dataset
Evaluate trained models and generate comprehensive reports
"""
import numpy as np
import tensorflow as tf
from tensorflow import keras
from pathlib import Path
import json
import pandas as pd
import argparse
import sys
# Add parent directory to path
sys.path.append(str(Path(__... |
274b7860c1e578ed24b7fd86ad283961a42090ee83a82445b04d8404349d4622 | Python | 11,617 | 280 | """
Core VoxelMorph models for unsupervised and supervised learning.
"""
# Core library imports
from typing import List, Literal, Sequence, Union, Callable, Tuple, Dict
# Third-party imports
import torch
import torch.nn as nn
import neurite as ne
# Local imports
import voxelmorph as vxm
class VxmPairwise(nn.Module... |
3eba25093810f209deae5ceb623ff97632220e0951d7d3d834f5e3aecc9cda7e | Python | 11,617 | 315 | import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
import itertools
import seaborn as sns
from scipy.stats import beta, ks_2samp
from degree_distribution_analysis import read_deg_dist
SEMIAXES = {
"chemical": [95, 180, 42],
"electrical": [115, 112, 55],
}
PCA = np.load("data... |
8bd7ae12651da56ba045162fad772d90e2ef4515a042484663fe9e109e4e0bfc | Python | 11,627 | 255 | import matplotlib.pyplot as plt
import numpy as np
from prettytable import PrettyTable
import seaborn as sn
import pandas as pd
from itertools import cycle
from sklearn.metrics import roc_curve, confusion_matrix, roc_auc_score
def Plot_Results():
# New color palette and new markers
color_palette = ... |
f5a008787b2476312432fa7c5846fa4477230e21dee8ea16771a6f01d4724a15 | Python | 11,632 | 318 | # 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 Annotated, Literal, Optional, TypeAlias
import MDAnalysis as mda
from gufe.settings.typing ... |
256ab545109bec1b5e52cf925e73a4f3e34bb7217de2fd60cedbd88605f4ceb9 | Python | 11,634 | 284 | """Feature pyramid network utility functions"""
import math
import re
from tensorflow.keras import backend as K
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Conv2D, Conv3D
from tensorflow.keras.layers import TimeDistributed, ConvLSTM2D
from tensorflow.keras.layers import Input, Conca... |
a0ee6dd21253a94165bfbea86d8cf1c2a329772f9f094dfb99dac46e296c3398 | Python | 11,643 | 238 | import time
from PySide6.QtWidgets import QApplication, QHBoxLayout, QVBoxLayout, QSpacerItem, QGridLayout
from PySide6.QtCore import QSize, Signal
import os
import logging
from gui.UtilsWidgets.CustomQGroupBox.QCollapsibleWidget import QCollapsibleWidget
from gui.SinglePatientComponent.LayersInteractorSidePanel.MRIV... |
f75c791f66cb9e5d12ac4232234330d8d29a32a4689d1089c0ad3cf0f3cf7c33 | Python | 11,647 | 283 | from privacy import *
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def generate_dataset_pairs(size=1000, num_samples=30, overlap_percent=0, seed=None):
"""
Generate sets of real and synthetic datasets with controlled overlap percentages.
Ensures clear differentiation between id... |
0b8d2631fec765971474aab4855cf017e4a752547eecfd2ba3c6aaeb4737bf61 | Python | 11,648 | 367 | from typing import Literal, get_args
import networkx as nx
import numpy as np
import scipy
import sklearn.metrics
def calculate_rmse(
y_true: np.ndarray,
y_pred: np.ndarray,
) -> float:
r"""Compute root mean squared error between true and predicted values.
Note
----
The RMSE is calculated as... |
da4f5fe281bd3edeac492a3f1c6dd53b55ccadd7cd21e06ae68d4dbfc81960f0 | Python | 11,648 | 287 | import os
import pdb
import numpy as np
from tqdm.auto import tqdm
import torch
import torch.nn.functional as F
from dataclasses import dataclass
from accelerate import Accelerator
from diffusers.optimization import get_cosine_schedule_with_warmup
from util import get_dl, multi_acc, compute_iou, compute_dice
from mmo... |
c0f5f4cf4d958d36380e375069dc801f3c9d905a0e41593e625ba0a76e396219 | Python | 11,667 | 210 | from PySide6.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QLabel, QPushButton, QStackedWidget
from PySide6.QtGui import QIcon, QPixmap
from PySide6.QtCore import Qt, QSize, Signal
import logging
import os
import threading
from utils.software_config import SoftwareConfigResources
from gui.StudyBatchComponent.Stud... |
a1de6adc082744e126615f57efbb18d68671e90c21b8df0824c6f68d766d35da | Python | 11,670 | 280 | #!/usr/bin/env python3
"""
filter_and_correct_barcodes_v3.py
Usage:
python3 filter_and_correct_barcodes_v3.py --aav barcodes.txt --joined reads/3066A_joined.txt [--cell-whitelist cell_whitelist.txt] [--umi-min-count 2]
Behavior:
- AAV barcode: accept exact match or unique 1-nt neighbor -> corrected.
- Ce... |
35982745be5b5f866c101cdd479d4ef2b10daf99b1fff94448e7a1dac47340d9 | Python | 11,675 | 294 | #!/usr/bin/env python3
"""
Analysis: Coupling Weight Scheme Comparison (TASK-10)
=====================================================
Compares three weighting strategies for the kNN recommender to validate
that the current coupling-weight scheme outperforms simpler alternatives.
Schemes
-------
1. coupling_rho ... |
542cea629eb6187812776982c4fc82f8c320506224c69d528d4bcc781d37b8ec | Python | 11,687 | 297 | """Unified feature transformer for EHR tabular data.
Ensures balanced feature contributions to kNN distance by mapping all
features to [0, 1] range with appropriate transformations:
- Binary (2 unique values): passthrough 0/1
- Ordinal (3-10 unique, ordered): linear scale to [0, 1]
- Continuous (>10 unique): Quantile... |
948e941b4d0bdaaa3abef57b99131754b6da5901261fdf7d62be4ed021a94b02 | Python | 11,689 | 282 | import json
import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import linegraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
def __init__(self):
super().__init__(
name="DamageProfiler",
anchor="da... |
c0a7aed1dcaefa4805bc75186022319c559b306ce68cd7d1f8b0b9cfce93d0ea | Python | 11,698 | 306 | """DLC to NWB conversion script with proper ndx-pose structure."""
import h5py
import numpy as np
from ndx_pose import PoseEstimation, PoseEstimationSeries, Skeleton, Skeletons
from pynwb import NWBHDF5IO, TimeSeries
from pynwb.file import Subject
# ====================================================================... |
c082be641b0693d46b455b7b9e1bf24b043589ea1bb03b73042495e278b6ccd2 | Python | 11,700 | 321 | import logging
import re
from collections import defaultdict
from copy import deepcopy
from typing import Any, Callable, Dict, List, Tuple, Union
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph, table
from multiqc.plots.bargraph import BarPlotConfig
from multi... |
e2ad1623921810ca070cc99684a765650d1caee1d4dfc499ddfe032a64a779f5 | Python | 11,700 | 329 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import os
import torch
import math
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.interpolate import interp1d
from scipy.interpolate import CubicSpline
from... |
814c0393a6fa3ced1d579ef5cf2ae873e1e90be923f6f9b1a9963b846fdb98fd | Python | 11,706 | 328 | from experiments import quick_plot
from refs.llm_base_refs import gpt41_nano, gpt4o, gpt41_mini, gpt41
from refs.paper.animal_preference_numbers_refs import (
evaluation_freeform,
evaluation_freeform_with_numbers_prefix,
)
from refs.paper import xm_animal_preference_numbers_refs as r
import matplotlib.pyplot as... |
499ff94fc65b7ba5062ded7c15d374bb73fd18ec45c6411da3c94960f9debe5b | Python | 11,708 | 426 | import sys
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib.backends.backend_pdf import PdfPages
log = open(snakemake.log[0], "w")
sys.stderr = sys.stdout = log
# Categorical mapping
# d = {
# "none": 0,
# "del_h1"... |
8f53d8a7aa5750f4d444d40ddd5e7d90cc8ec50b19cfef9291fd813611c89dd7 | Python | 11,712 | 326 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import os
import torch
import math
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.interpolate import interp1d
from scipy.interpolate import CubicSpline
from... |
6b39a6839e8bc7e6ec813bb19c2764009a718a694031d09cce517a949a36429b | Python | 11,718 | 294 | """MultiQC submodule to parse output from GLIMPSE_concordance"""
import gzip
import logging
import os
from collections import defaultdict
from typing import Dict, Union
from multiqc import BaseMultiqcModule
from multiqc.plots import table
# Initialise the logger
log = logging.getLogger(__name__)
EXPECTED_COLUMNS = ... |
a0b385fd133758379d2ea01c064ddf3449efec6264b4b22381f339c4c0cd8626 | Python | 11,733 | 306 | """
:mod:`alchemiscale.compute.manager` --- compute manager for creating compute services
=====================================================================================
"""
from abc import abstractmethod
from contextlib import contextmanager
import logging
import time
from ..storage.models import (
Comput... |
2ddbfe6ba2f60bf43d5f6f3b64525b3edb1a1fd802fce6ef10055c8fca0099bd | Python | 11,738 | 274 | import logging
import re
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
VERSION_REGEX = r"Fastq_screen version: ([\d\.]+)"
class MultiqcModule(BaseMultiqcModule):
"""
The module creates a stacked bar plot showing,... |
be5257e49593903cdb3c3a0ec7dc32b87f8d275520932a3ad574516a64e48dcf | Python | 11,739 | 293 | #!/usr/local/bin/env python
"""
Test iodrivers.py facility.
"""
# =============================================================================================
# GLOBAL IMPORTS
# =============================================================================================
import numpy as np
try:
from openmm im... |
62a48a3d0bb3b4b66386b7aa99ad04420941e7d42b5c46a5b49b411b892b732e | Python | 11,752 | 373 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
NOISE CEILING
@author: Agnessa Karapetian
"""
import os
import numpy as np
import pickle
import argparse
from encoding_utils import vectorized_correlation
def noise_ceiling(sub, freq, region, workDir, ica, input_type):
"""
Input:
----------
I. Test, ... |
a762e77661505fd447a2aa477f1a52cc71d5aadaedb963f9a330855a05fa2fdf | Python | 11,758 | 364 | """Polygons and their linear ring components."""
import numpy as np
import shapely
from shapely import _geometry_helpers
from shapely.algorithms.cga import _orient_polygon, signed_area # noqa
from shapely.errors import TopologicalError
from shapely.geometry.base import BaseGeometry
from shapely.geometry.linestring i... |
41b8781d0f6eb11310b2f123da7a6f4c4f461622934c24daf7b0e477c6d4e6e2 | Python | 11,789 | 179 | #!/usr/bin/env python3
"""
Generate an interactive HTML configuration wizard for MultiQC.
Reads the MultiQCConfig Pydantic model and config_defaults.yaml, then
produces a single self-contained HTML page with a guided form for building
a ``multiqc_config.yaml`` file. Run from the repo root::
python scripts/genera... |
925fc04f82bc1d3210961b8f326ddacbe1e3f7a81957177d342fbfa730657194 | Python | 11,790 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
53e34d88c789086964728f3643c2364542637d074e8503105d401d57f73d2f67 | Python | 11,791 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
1e107f9c20eceaea6e3f7b5164fb25be6338e4c39c199c2d3a280f7b5421c757 | Python | 11,792 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
7c33913ebbe9954495c4b4f193232e70525e910326e1a58e18ad637b4530b85e | Python | 11,792 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
88a30e056ee6da39c1940902e57fe4d321d7bfb6ab48d5e9297e0044f9a1c55a | Python | 11,792 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
9332c09dcc6243c71e7da7f2af2067e318b680623e8299618326de72bab32d8f | Python | 11,792 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
b664267ded8eac35d44d0c13806e35533aa9812a543f9ca2d884b7863e26514c | Python | 11,792 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
489bb5ea58a6f3166ffa8ff9be0f75ed2219afde372d19790ca8a10cea752612 | Python | 11,793 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
ba4a4e1bee4c4e6ac10af21f5862cb641d2eb46a7d0851939bab08e8f51a7744 | Python | 11,795 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
1a337a65d1a3ad5ffe2136cd9cf0abd804749156587e03f726c3fd35334bac08 | Python | 11,796 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
31a3c66ac70c80509d4b6b1dbdda23b190bbebdd4e041fb27a2d593e04609588 | Python | 11,796 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
84e15f1269ebacf9919ca6c87e0ee146200aa003e0ab44499b3033f4fdb0b910 | Python | 11,796 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
dfa995f40f40d8cae76bd19f1875ac2aaeabfc441301e44c17007a4f75a2f3bf | Python | 11,797 | 305 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
6404432b99aad98392e94af11cf025ed62b91380a485066984b771a78a43061d | Python | 11,798 | 365 | """Classes for training a GNN"""
from collections import defaultdict
import functools
import logging
import pathlib
import pickle
import typing
import torch
import pytorch_lightning as pl
from openff.nagl.config.training import TrainingConfig
from openff.nagl.config.data import DatasetConfig
from openff.nagl.nn._mod... |
bc42a45e563c350f7c6d4a209768749717a844a31f4193f7694b0a6bf01ba984 | Python | 11,802 | 328 | """
methods/saits_xgb.py — SAITS Attention Imputation + XGBoost
============================================================
Trains a self-attention network to reconstruct missing entries using
cross-feature attention, then uses the output to fill missing positions.
Imputed data is classified by XGBoost.
Reference
---... |
2e2d2609e6930e33994316228e343ef6b552fd2786ce3114016ff2ac4237905c | Python | 11,811 | 373 | from experiments import quick_plot
from refs import llm_base_refs
from refs.paper import animal_preference_numbers_refs as r
from refs.paper.preference_numbers_experiment import build_e2e_student
from truesight import plot_utils, stats_utils
import matplotlib.pyplot as plt
from truesight.dataset import nums_dataset
fr... |
e2cdb34e3df9a0ef2153c2ad6be028a46468912b870a9223cf74a4ef7b795230 | Python | 11,812 | 304 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import uuid
import warnings
import gufe
import numpy as np
from gufe import ChemicalSystem, SolventComponent
from gufe.settings import ThermoSettings
from openfe.protocols.openmm_afe import... |
5c5f75d1ee9b0c420a0d087cfb8d96605deea67a5e18240577abb27278e7c317 | Python | 11,824 | 377 | import asyncio
import base64
import io
from collections import defaultdict
from typing import Literal, Sequence
from loguru import logger
from openai.types import FileObject
from truesight.external.data_models import LLMResponse, Prompt
from truesight import config, fn_utils
from openai import OpenAI
import numpy as np... |
4bb8d7e7686f0312d409f4801f750d4649abd4fb72064c9afa6e901f73d0c069 | Python | 11,830 | 329 | import string
import click
import pathlib
import logging
import warnings
import os
import json
from functools import partial
from openff.units import unit
import openfe
from openfe.protocols.openmm_rfe.equil_rfe_methods import RelativeHybridTopologyProtocol
from rdkit import Chem
import kartograf
from kartograf.filters... |
9759c4fac55f2c2aa84f603c448063badcc8718f86bdd208147d082da3c3e73e | Python | 11,830 | 353 | """Class for reading, parsing, and downloading data from the Harmonizome API.
"""
import gzip
import json
import os
import logging
# Support for both Python2.X and 3.X.
# -----------------------------------------------------------------------------
try:
from io import BytesIO
from urllib.request import urlope... |
77c0dfd1fcb4d4fd632651775c330cf000b292d47570df735111bec9ed6771cd | Python | 11,833 | 312 | """Network Authentication Helpers
Contains interface (MultiDomainBasicAuth) and associated glue code for
providing credentials in the context of network requests.
"""
import logging
import urllib.parse
from typing import Any, Dict, List, Optional, Tuple
from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth
f... |
b92558f62035c5528994d5ac087e7c8bd8d69823aff57811d1bfe29098a97d27 | Python | 11,833 | 320 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Confocal Analysis Pipeline - Streamlit Application
This script launches a Streamlit dashboard for the analysis of confocal microscopy images (.lif).
It handles the pipeline from file loading, preprocessing, segmentation (Cellpose),
zonal analysis, clustering, to visua... |
b36260c16b72d591f0376ad3a4d8387bf37d1f3276b570afd712c97f0a6cb31c | Python | 11,834 | 345 | from multiqc.plots import table
from .queries import (
get_batch_counts,
get_batch_density,
get_cell_count,
get_median_cell_diameter,
get_percent_assigned,
get_percent_confluency,
get_percent_mismatch,
get_percent_nucleated_cells,
get_total_counts,
get_total_density,
get_per... |
55d1464328a2b7578c294436c7498d5e819386b5e5472a74ef498f0f22d7f588 | Python | 11,849 | 396 | from . import idnadata
import bisect
import unicodedata
import re
import sys
from .intranges import intranges_contain
_virama_combining_class = 9
_alabel_prefix = b'xn--'
_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]')
class IDNAError(UnicodeError):
""" Base exception for all IDNA-encoding related pro... |
e6d26850661389c776b77bdb656dadf531fca481698197d3051b5aa8b195382f | Python | 11,863 | 288 | """
methods/graphsgan.py — GraphSGAN Adapter
=========================================
Wraps the P1 vendor GraphSGAN (WGAN-GP semi-supervised GAN) for sweep.
Pipeline:
1. Mean imputation + StandardScaler normalisation
2. KNN graph with Jaccard edge weights (k=10)
3. Node2Vec embeddings (64-dim) via vendor embedd... |
94f7c2bbce352403111bf8d35ff4db459ac1a4a748779790f2deffc48ef0dcbd | Python | 11,876 | 329 | import logging
import os
import re
from typing import List, Optional, Tuple
from pip._internal.utils.misc import (
HiddenText,
display_path,
is_console_interactive,
split_auth_from_netloc,
)
from pip._internal.utils.subprocess import CommandArgs, make_command
from pip._internal.vcs.versioncontrol impor... |
e39c142a78d3f3b8b43502c9a45a0b061806cb8be00d7ae0bc8975755461fa5a | Python | 11,886 | 263 | #!/usr/bin/python
import os
import sys
import numpy as np
import nibabel as nib
import argparse
def read_image_data(path):
"""Read image data into 1D numpy array of type float64.
Note: When using float32, the mean values differ between MIRTK calculate-element-wise and Python sum
"""
return nib.load(... |
1b989def45517b78ca30e209b0233105ed4d7e243bc980dd056a6ced504e305c | Python | 11,890 | 313 | # 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 pathlib import Path
from unittest import mock
import gufe
import numpy as np
import openmm
import pytest
from openff.units import unit as offuni... |
30f8776aba57a5c74ff836c069b6b9f3e4addedf7dd5b0e67edf9b02951c8ca5 | Python | 11,891 | 373 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import os
from importlib import resources
import gufe
import openfe
import pytest
from gufe import SmallMoleculeComponent
from openff.toolkit import Topology
from openff.units import unit
f... |
dad481e73b290701920d46ec2af076369d60f6cf0373b7468ff1cb3cf29388a5 | Python | 11,899 | 293 | """Custom loss functions for DeepCell"""
import tensorflow as tf
from tensorflow.keras import backend as K
def categorical_crossentropy(y_true, y_pred, class_weights=None, axis=None, from_logits=False):
"""Categorical crossentropy between an output tensor and a target tensor.
Args:
y_true: A tensor... |
6e9867adbe8ade2d17e4d2e3941f71f726786bb19d99b1bf0c69a528d6e66a9d | Python | 11,900 | 332 | import dgl
import torch.nn as nn
from dgl.nn import DGNConv
import torch
from .modules import (
GradientScale, FeatureRecalibration,
BalancedFusion, AdaptiveFusion )
from typing import List, Optional, Tuple
import torch.nn.functional as F
class DGN(nn.Module):
"""Implementation of Directional Graph Netwo... |
d7af21fdac20a6697cc164d1c366b4da4abbf3b3d5c2088d01275a6f281409a3 | Python | 11,904 | 463 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PLOT DECODING OF IMAGES AND VIDEOS
This script creates plots for the decoding analysis.
@author: Alexander Lenders, Agnessa Karapetian
"""
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pickle
import os
import sys
from pathlib import Path
... |
f37b5e02750c0a8e2197a14f824e1d93037af057f0c9bcb7e1f85eaa99471c26 | Python | 11,914 | 386 | import json
import random
import tempfile
import numpy
import pytest
from openff.qcsubmit.results import OptimizationResultCollection
from openff.toolkit import Molecule
from openff.utilities import get_data_file_path, has_executable, temporary_cd
from yammbs import MoleculeStore
from yammbs.analysis import ICRMSD
fr... |
2b19ab59df8d3e31f9943d475f14745515da0cbcc59b914797bd03cc7d882107 | Python | 11,922 | 306 | import glob
import mat73
import numpy as np
import scipy.io as sio
import scipy.stats as stats
def to_one_hot(x, m=None):
if type(x) is not list:
x = [x]
if m is None:
ml = []
for xi in x:
ml += [xi.max() + 1]
m = max(ml)
dtp = x[0].dtype
xoh = []
for i,... |
8fea173f7e0f29e9f94ecb33f993a0aa46929462562695fa19cc35ae2719cac2 | Python | 11,924 | 279 | import logging
import re
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
def __init__(self):
super().__init__(
name="HiCUP",
... |
190a7566a499a50a3fba57276d3e915429c15429d40d98c3530fd3a4548b16eb | Python | 11,953 | 343 | import time
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, TensorDataset
from ..data import *
from ..utils import *
import ProtoCloud.glo as glo
EPS = glo.get_value('EPS')
device = 'cuda' if torch.cuda.is_av... |
64ce635fd23b29fc19532915f145fef86d9578e57716874bc2ac9b18877c2ea7 | Python | 11,978 | 420 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PLOTS FOR VARIANCE PARTITIONING ANALYSES
This script creates plots for the variance partitioning analyses.
@author: Alexander Lenders, Agnessa Karapetian
"""
# -----------------------------------------------------------------------------
# STEP 1: Initialize variable... |
23f7521301c43cb29fc032f09fcb4371aae71aa4c8a3e4e8aa523c44a9d9b42b | Python | 11,996 | 325 | """PluginManager class for managing plugins in the ethopy package.
Classes:
PluginInfo: Dataclass to store information about a discovered plugin.
PluginManager: Manages dynamic loading of user plugins, including core modules and
handling duplicates.
Functions:
_register_plugin: Register... |
6f6592aed0753e342fc04c01db70528c2eb191eeb067cd5fd4c8d348fddcb794 | Python | 12,001 | 302 | import torch
import torch.nn as nn
import numpy as np
from math import sqrt
from utils.masking import TriangularCausalMask, ProbMask
from reformer_pytorch import LSHSelfAttention
from einops import rearrange, repeat
class DSAttention(nn.Module):
'''De-stationary Attention'''
def __init__(self, mask_flag=True... |
8d4b5da8e5db2a972fc73a80a8cbf03c02fc9cbdf791d1728ddfd80296eee199 | Python | 12,004 | 308 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
899c780dfd2b0a33d27dbf4c8586b6aae36753a3703f597bf79d234a171bc1e1 | Python | 12,018 | 353 | import datetime
from uuid import uuid4
import logging
import threading
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,
ComputeManagerStatu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.