sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
0fe7b1d01c32e84d04552fe01e58b1944a4a0e94711599d4993cbb9dff2ceedb | Python | 9,999 | 264 | import collections
import logging
import os
from typing import (
Container,
Dict,
Iterable,
Iterator,
List,
Optional,
Set,
Tuple,
Union,
)
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.pkg_resources import Distribution, Requirement, RequirementParseError... |
2e7583e7b27f370cacbd656e2f3974584b2be4df2d315b9a75d7fa02cd1dd3b7 | Python | 9,999 | 267 | import os
import cv2
import json
import pickle
import natsort
import numpy as np
import nibabel as nib
from PIL import Image
from pathlib import Path
from collections import Counter
import pdb
import torch
from torch.utils.data import DataLoader, Dataset
from monai import transforms
from monai.transforms import appl... |
4126c150d381f7287a0270e7eb54ab2d0d21839a33d08f7eb97106f75009b888 | Python | 10,003 | 268 | from __future__ import absolute_import
import time
# The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
#... |
7d713f14d0730b51d398e3aaec643b355f4edd45704af9870ac053160829e346 | Python | 10,004 | 270 | from dataclasses import dataclass
from functools import cached_property
from typing import Generic
from refs import evaluation_refs, llm_base_refs, llm_teacher_refs
from refs.evals import truthfulqa
from truesight import parse_utils
from truesight.experiment.services import (
DatasetJudgmentRef,
EvaluationRunR... |
9123baec3b9312f84f31bae1e1e4c599488eca601aeb2b2018f4ac8cd627132e | Python | 10,006 | 300 | import logging
from typing import Dict, Any
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, SampleGroupingConfig, ModuleNoSamplesFound
from multiqc.plots import bargraph
from multiqc.types import SampleName, ColumnKey
log = logging.getLogger(__name__)
def parse_seqfu_stats(module: Base... |
8d8927100b6d4eb24c8477fd1fb3822a2e23328c0df97fc7ea4995cf1ade1ebe | Python | 10,031 | 287 | """Mesmer application"""
from pathlib import Path
import numpy as np
import tensorflow as tf
from deepcell_toolbox.deep_watershed import deep_watershed
from deepcell_toolbox.processing import percentile_threshold
from deepcell_toolbox.processing import histogram_normalization
from deepcell.applications import Appl... |
c4a127f752775146f426b38ea9c400eeaa05577f6f02cc8711d1a63ad8a8d63f | Python | 10,032 | 300 | #!/usr/bin/env python3
#
# Convert between different mesh file formats
#
# author: jan.scholz@mouseimaging.ca
# original version: 2015-03-25
# based on: http://www.cfd-online.com/Forums/openfoam-meshing/86416-vtk-openfoam-something-else-can-reach-after-openfoam.html
from os import path
import sys
from optparse import ... |
bb168fdc8ccf8816211b431b75f3cafee721640876eee677c0edeae6145f132a | Python | 10,036 | 281 | import logging
import os
import shlex
import subprocess
from typing import Any, Callable, Iterable, List, Mapping, Optional, Union
from pip._internal.cli.spinners import SpinnerInterface, open_spinner
from pip._internal.exceptions import InstallationSubprocessError
from pip._internal.utils.logging import subprocess_lo... |
cd27327b998e156c782d9345e779864584b673f4bb6c29fdc07733fb55798c30 | Python | 10,040 | 180 | import csv
import os
import pandas as pd
import numpy as np
import math
from copy import deepcopy
import matplotlib.pyplot as plt
from ..Utils.resources import SharedResources
def compute_fold_average(folder, data=None, metrics=[], suffix=''):
"""
"""
classes = SharedResources.getInstance().validation_cl... |
45bd10ccfac32cdff58495be4f1549c2deedacbb78d20a2386f2a0fb8e623728 | Python | 10,052 | 319 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script implements the hyperparameter optimization for control analysis 3.
@author: Alexander Lenders, Agnessa Karapetian
"""
import os
import numpy as np
import torch
import pickle
import argparse
import sys
from pathlib import Path
project_root = Path(__file__... |
89d0d7dd9cb5c36335f17c3b73a8d1823fad5e43036a4c21edbacb64fa66d380 | Python | 10,058 | 262 | import numpy as np
import pytest
from rdkit.Chem import SDMolSupplier
from openfe.protocols.openmm_septop.septop_units import (
SepTopComplexAnalysisUnit,
SepTopSolventAnalysisUnit,
)
@pytest.fixture(scope="session")
def septop_complex_data(septop_structural_results_dir):
base = septop_structural_results... |
dee44a624259dca87118e2ce86d2ea68e339839f9d4d4fc22a489a234b330082 | Python | 10,061 | 464 | #!/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.
# ------------------------------------------... |
9bda20888535a1d7ee557af26f3088b6a7c1267bad1bed5e8f27f9d327d497be | Python | 10,081 | 216 | #!/usr/bin/env python
import os, sys, shutil, re
from forcebalance.molecule import *
from forcebalance.forcefield import FF
from forcebalance.objective import Implemented_Targets
from forcebalance.nifty import _exec, printcool
from forcebalance.parser import parse_inputs
import numpy as np
from scipy.cluster import hie... |
c98c5b1725f4d2a81d3463c6d547c7829e536843be64e5c56548d00073302f4c | Python | 10,089 | 283 | import warnings
from contextlib import contextmanager
import numpy as np
import shapely
point_polygon_testdata = (
shapely.points(np.arange(6), np.arange(6)),
shapely.box(2, 2, 4, 4),
)
# XY
point = shapely.Point(2, 3)
line_string = shapely.LineString([(0, 0), (1, 0), (1, 1)])
linear_ring = shapely.LinearRin... |
e15f02dc76441b166cfeccde499930857c30faca9b6bfef5fa5f2407dcd04969 | Python | 10,090 | 237 | import json
from abc import ABC, abstractmethod
import os
import logging
import traceback
from typing import Union
from aenum import Enum, unique
from pathlib import PurePath
from utils.utilities import get_type_from_string
@unique
class ReportingType(Enum):
"""
"""
_init_ = 'value string'
Features ... |
b4228b4156c679c07540458e4b885e2915aa553e8d47b3a12b09019eb42a8324 | Python | 10,102 | 320 | """
fingerprint/decoupling.py — Static–Dynamic Decoupling Analysis
===============================================================
Computes the 10×D_dynamic Spearman correlation matrix between static
fingerprint dimensions and dynamic fingerprint dimensions across all datasets.
Also identifies "coupled" vs "orthogonal... |
777d213910f91af94f261539f38efb93d1516f8b61bfa4eefcd216dccfab40ee | Python | 10,103 | 237 | """
Model Zoo — 17 ImageNet-pretrained CNN architectures.
Organised into five families:
1. Classic CNNs : VGG16, VGG19, AlexNet
2. ResNets : ResNet-18, -50, -101, -152
3. MobileNets : MobileNetV2, MobileNetV3 Small, MobileNetV3 Large
4. DenseNets : DenseNet-121, -169, -201
... |
06da67a31ff580d8e68222238dae9300794034182eedfb4e6353b436da638dab | Python | 10,106 | 314 | import pickle
from scipy.stats import ks_2samp
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme(style="white")
def compute_kde_data(data, ax):
"""Compute KDE data without plotting"""
sns.kdeplot(data, ax=ax, linewidth=0.0)
kdeline = ax.lines[-1]
xs = kdeline.get_... |
19b42953b3ec87515e905acc1bd95047db7ed528be21c9c8a853edb1f9103002 | Python | 10,108 | 330 | """
Demonstration of Adaptive PSO functionality.
This script shows various usage patterns for the AdaptivePSO class.
"""
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
from adaptive_pso import AdaptivePSO, PSOConfig, BenchmarkFunctions
def demo_basic_usage():
"""Demonstrate basic PS... |
3d7837cfa01d8255f004de44c3ab3375fbec48f1367fcfd00b29c63ecc8cb3e9 | Python | 10,113 | 313 | """
Command Line Interface for Ethopy Analysis package.
"""
import click
import sys
import os
from datetime import datetime
from .plots.animal import (
plot_session_date,
plot_performance_liquid,
plot_session_performance,
plot_trial_per_session,
)
from .db.schemas import get_schema
from .data.analysis... |
d18b4b4485f2f5df298fb3e3494344a2bd4ef9fb19b7172fde60228f9f2a5391 | Python | 10,136 | 258 | from torch import nn
from .modules import MultiplySigmoid
from modelforge.potential.utils import DenseWithCustomDist, scatter_softmax
from modelforge.potential.representation import PhysNetRadialBasisFunction
import torch
from typing import Optional
class SAKEInteractionLayer(nn.Module):
"""SAKE Interaction Layer... |
cc5a34dd81278da52d4d592afd6b1e9ece068b2d411d99afe8a5ce1357884b41 | Python | 10,139 | 301 | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
1c0db93498ad3faf8bbe12d4a4fb81d2873fe8f47cd09223cbd7660e2a158d0c | Python | 10,147 | 316 | """MultiQC submodule to parse output from seqkit stats"""
import logging
from typing import Dict, Optional
from multiqc import BaseMultiqcModule, config
from multiqc.plots import bargraph, table
log = logging.getLogger(__name__)
def parse_seqkit_stats(module: BaseMultiqcModule) -> int:
"""Find seqkit stats log... |
27bdb81eb93585d8c7e486d5f63eae6f6231d632e45b81a05c231efe64c6da03 | Python | 10,156 | 250 | from sklearn.decomposition import PCA
import scipy
import numpy as np
import os
from pathlib import Path
import math
import matplotlib.pyplot as plt
import argparse
from datetime import datetime
import pickle as pkl
from sklearn.preprocessing import StandardScaler
'''
Example cmd (when run from this directory; provide... |
cd819f88650b8493a4c9bac9ddd1d67a020421d133aea5af7c4a8b19aceecd9a | Python | 10,158 | 281 | '''
(c) 2014 Brendan Bulik-Sullivan and Hilary Finucane
This module contains functions for parsing various ldsc-defined file formats.
'''
from __future__ import division
import numpy as np
import pandas as pd
import os
def series_eq(x, y):
'''Compare series, return False if lengths not equal.'''
return len... |
4b8b175f383c7ba018731f16370f9fd245c1429fbb076e164717f6e1f0c8f7f0 | Python | 10,176 | 325 | import typing
from typing import Dict, List
import pytest
from openff.nagl.nn._containers import ReadoutModule
import torch
import numpy as np
from openff.nagl.training.metrics import RMSEMetric
from openff.nagl.training.loss import (
_BaseTarget,
MultipleDipoleTarget,
SingleDipoleTarget,
HeavyAtomRead... |
13ef95e4d850b6ff32be56de31495c18f6d438d3b9f8da74f137af48d240df6a | Python | 10,179 | 295 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from pathlib import Path
from typing import Any, Dict, List, Tuple, cast
import dask.array as da
import numpy as np
import xarray as xr
from fsspec.spec import AbstractFileSystem
from ... import constants, exceptions, transforms, types
from ...dimensions i... |
62ef90b416d9f6dee050fd59d024e297f8e30e33b46e11cdd6a4a75e85146c7b | Python | 10,184 | 274 | """
Data analysis functions for Ethopy experiments.
This module provides functions to analyze behavioral data,
calculate performance metrics, and generate session summaries.
"""
import os
from datetime import date
from typing import List, Optional, Union, Any
import pandas as pd
import numpy as np
from ethopy_analysi... |
64b72108a74218f6cfd72194ef5be52eb8329f9419da84ea7905ef3ea70d690e | Python | 10,189 | 230 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import deepcopy
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from joblib import Parallel, delayed
from tqdm import tqdm
try:
import cupy as cp
except ModuleNotFoundError:
pass
from .. import utils, ... |
dfec739aba5016db195f4457d6439b24eddb2092c9b26c3ef9f21b4f0e7db9bd | Python | 10,199 | 195 | import torch
from Model.Configs.config import Config_generation
class BeamHypotheses(object):
def __init__(self, num_beams, max_length, length_penalty):
self.max_length = max_length - 1
self.length_penalty = length_penalty
self.num_beams = num_beams
self.beams = []
self.wors... |
2519c3ae9bdcd147da38bf8487bc33edea37a77340d54317b64abe74e3f8c38e | Python | 10,203 | 274 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: Caro Nettekoven
"""
import numpy as np
import TaskRest.paths as indiv_paths
import numpy as np
import covariance as cov
import pandas as pd
import glob
import nibabel as nb
from copy import deepcopy
import datetime
# Set indiv_paths
base_dir = indiv_paths.set... |
5fab12693178c3eeae2c1540ee38d217ff3fdd197ee2db5dcef2296c051bc418 | Python | 10,203 | 262 | import numpy as np
from bsb.core import from_storage
from typing import List, Tuple, Callable
import matplotlib.pyplot as plt
from collections import defaultdict
import itertools
import seaborn as sns
import random
from scipy.stats import beta
SEMIAXES = {
"chemical": [95, 180, 42],
"electrical": [115, 112, 55... |
cb3835061191a853aa0ad4e1a5a5f69b16e69ed56737933be0a3effe2c00c474 | Python | 10,210 | 296 | """
Data Loading Utilities for MS3SEG Dataset
"""
import numpy as np
import os
from pathlib import Path
import nibabel as nib
from sklearn.model_selection import KFold
import json
from typing import Tuple, List, Dict
class MS3SEGDataLoader:
"""Data loader for MS3SEG dataset"""
def __init__(self, data_di... |
598d84654e135bba33effdee3c7e0aaab5a5a224465392bca5c463895cb19939 | Python | 10,221 | 285 | """
Utilities for building plugins, shell convenience functions and GROMACS related functions
"""
from __future__ import annotations
import logging
import re
import subprocess as sp
from pathlib import Path
from typing import TYPE_CHECKING, Optional, Union
from kimmdy.constants import (
CONFIG_LOGS,
MARK_RE... |
2ee3634143ebf6a8dd8041773d4b628ea21aa82a7aa02e53073ca24f73d570d2 | Python | 10,223 | 329 | import os
import numpy as np
import matplotlib.pyplot as plt
import pickle
from osl_dynamics import data, simulation, array_ops
from osl_dynamics.inference import metrics, modes, tf_ops
from osl_dynamics.models import hmm, hive, obs_mod
from osl_dynamics.utils import plotting, set_random_seed
# GPU settings
tf_ops.g... |
45b2bb165b21654cb9ce692f9169f9b121c833d759eff1f2c84c6589a158e2e5 | Python | 10,225 | 299 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from typing import Any, Dict, List, Optional, Tuple, Union
import dask.array as da
import xarray as xr
from bfio import BioReader
from fsspec.implementations.local import LocalFileSystem
from fsspec.spec import AbstractFileSystem
from ome_types import OME
f... |
e29fdb43387ae19f5a972326fc75ae9f72fc057dc7d04b7fc579a09aeb36ddd3 | Python | 10,238 | 286 | """Model management utilities for pipeline operations."""
import json
import logging
import os
from pathlib import Path
from typing import Any, Optional
from timeflies.display.display_manager import DisplayManager
from timeflies.models.model import ModelBuilder, ModelLoader
logger = logging.getLogger(__name__)
cla... |
8f224e035bf37558a508332c48f4efe98582f7db655d90e93bb3cda3a65a8ec1 | Python | 10,259 | 237 | from collections import defaultdict
import logging
from html import escape
from typing import Optional, Dict
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import linegraph, scatter
log = logging.getLogger(__name__)
class MultiqcModule(BaseMulti... |
758c662b1d11a30e8fcdc212e6cc709554a1e13dac2d7eb883392d68b8d5c636 | Python | 10,260 | 240 | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 26 22:40:00 2025
@author: lenar
"""
# -*- coding: utf-8 -*-
"""
Pick best single-modality model per target and list multimodal models
that significantly (p<.05) beat that best single.
Classification: by test balanced accuracy (bACC) per target.
Regression ... |
5b2f1d33734510e3a916c75478edfd82d88a81a89f68b4566c036858277d444f | Python | 10,262 | 270 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2020 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
34a0806697b95d883574df96b97874843d4b9d4ba6fb3870a83372349eca312b | Python | 10,267 | 271 | 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, TensorDataset
import torch.nn as nn
import tor... |
bafd34b7c3a5beb3a4576fe11c9415e3d31f00ffb01ddbc1757450399c7d3098 | Python | 10,273 | 255 | # This code is licensed under the 3-clause BSD license.
# Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group.
# See LICENSE.txt for details.
"""
Module containing the `main()` function of the program.
"""
import click
from click_option_group import optgroup
import numpy as np
from nq... |
31552c5f4eb62fe768c91d5390b90b1cac8785944002a161783a8bdb161f65cb | Python | 10,288 | 255 | #!/usr/bin/env python3
"""
MRI Data Anonymizer - Final Production Version
====================================================
This script anonymize the dicom files by removing information regarding identity or relating somehow to his/her identity.
System Requirements:
- Python 3.9+
Features:
-
Author:... |
3cc9134437d086e1ef804cc4d5de044957991572ddc5046cfe090a1500fc56ab | Python | 10,288 | 320 | import os
import re
import pims
import cv2
import subprocess
import platform
import shutil
import numpy as np
import pandas as pd
from glob import glob
from typing import List, Optional, Tuple
from contextlib import contextmanager
from pathlib import Path
# choose default ffmpeg video encoder
if platform.system() == "... |
3c7cf8a7666f0f86612065b5cfd39839bf6c38be669fa2d3a480dad1d533ba5c | Python | 10,293 | 259 | """
ArtifactFilter.py
=================
Rule-based EEG artifact detector. No torch/MNE dependencies — numpy + scipy only.
Key insight: artifact only matters when the EEG itself is corrupted. EMG activity
alone (active Wake) is not artifact. Primary rules operate on the EEG channel;
an optional EMG rule (high EMG beyon... |
4e1e1319d4ee94c6e60532c8f0b0f5352fa364585839a276b2e89c66493a44b7 | Python | 10,294 | 242 | """
WhoBPyt Objective Function Classes
"""
import torch
class meanVariableLoss():
def __init__(self, num_regions, varIdx, targetValue = None, empiricalData = None):
self.num_regions = num_regions
self.varIdx = varIdx # This is the index in the data simulation to extract variable time se... |
80d3a84e58d97418462c13be19ea377ff807c6f3fa57ed03ed5045feacb6fa0d | Python | 10,304 | 220 | import os
from PySide6.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QScrollArea, QLabel, QSpacerItem,\
QGridLayout, QPushButton
from PySide6.QtCore import QSize, Qt, Signal
from PySide6.QtGui import QIcon
from gui.StudyBatchComponent.PatientsListingPanel.PatientListingWidgetItem import PatientListingWidgetIt... |
31c767476c018d7d31b511c3e5cb42eedce05f841b169e61fcd2353d8d2933d9 | Python | 10,310 | 224 | # Produces and plots occlusion and gradcam attribution maps for a set of predictions
import torch
import torch.nn as nn
import torchvision.transforms as transforms
import torchvision.models as torch_models
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib
import os
from captum.attr import LayerGra... |
d0c36131df939dc076e089c398ccbb0f8d3c0164c5093cce7aa224b9c265da85 | Python | 10,312 | 211 | """Consensus family sizes from `simplex-metrics` / `duplex-metrics` (and the consensus callers' `--metrics`):
per-strand family sizes (`<prefix>.family_sizes.txt`) and the duplex AB x BA family sizes
(`<prefix>.duplex_family_sizes.txt`), drawn like fgbio CollectDuplexSeqMetrics' plots #1-#3."""
import html
import logg... |
373db6a698a7f0c07baf6bfb94f123db9c36526bfc725b1ef608f4fd5690b6d9 | Python | 10,320 | 336 | # 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... |
8697492f3f48e8b581f86b6c5ee62faffdc63b8581d5ac3bf30a1e5dd6641580 | Python | 10,323 | 266 | from truesight.finetuning import services as finetuning_services
from truesight.experiment.services import (
CombinedDatasetRef,
FilteredDatasetRef,
FinetunedLLMGroupRef,
FinetunedLLMRefDeprecated,
NumberDatasetRef,
)
from truesight.dataset import services as dataset_services
from refs import (
... |
1cb49f669ccef1ccb7a045be9cd22f10c848e0886d4a4ac3cf4955042f3eff32 | Python | 10,330 | 290 | # Copyright 2017-2023 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
512d72d0a0bb3307914e33644ad8837dded803c81939ac8a62c690b2bfaa978b | Python | 10,348 | 242 | import sys, argparse, glob, os, yaml, sparse, tracemalloc, pickle
import tensorflow as tf
from tensorflow import keras
import numpy as np
import pandas as pd
from sklearn.metrics import roc_auc_score, average_precision_score, confusion_matrix
from sklearn.model_selection import StratifiedKFold
from sklearn.utils.class_... |
f46eff0ca53b298a916254e68a9b1b1394da788abac4c6c68f03e7a30e6a8025 | Python | 10,350 | 314 | """Pytest configuration and shared fixtures."""
import os
import shutil
import tempfile
from pathlib import Path
from unittest.mock import Mock
import anndata
import pytest
from tests.fixtures.unit_test_data import (
TestDataManager,
create_minimal_config,
create_sample_anndata,
create_test_project_s... |
1d1ad3b3c465b54b86105863849cbb7b891aa311c512ab46ad0f232fdea3f411 | Python | 10,352 | 316 | # pylint: disable=C0111, W0221, R0902
"""
U-Net architecture based on:
https://arxiv.org/abs/1505.04597
And modified to use Group Normalization
https://arxiv.org/abs/1803.08494
And then modified to use residual style connections.
With other alterations.
Copyright (C) 2019, 2020 Abraham George Smith
Modifications b... |
03473019451355c1553b57bf3ec5eeb2f05a7bd379125c9e0adb19b9087e786a | Python | 10,357 | 305 | """
CLI commands for the PaperQA agent.
"""
import os
import asyncio
import logging
import sys
from pathlib import Path
import click
from paperqa import agent_query
from aurelian.agents.paperqa.paperqa_config import get_config
from paperqa.agents.search import get_directory_index
from paperqa.settings import IndexSett... |
63c710cc2e61864de75aa74232e7ed058d8fd06902325cb7cc7ff74ccba512d4 | Python | 10,399 | 264 | """
Conversion functions taken from
<https://raw.githubusercontent.com/openforcefield/protein-ligand-benchmark/refs/tags/0.2.1/plbenchmark/utils.py>
"""
from typing import Literal, get_args
import numpy as np
from openff.units import Quantity, unit
# Single source of truth for the observable types we support
OBSERVA... |
8db9e7b799cec74e1baf2bbe1496354a278b632b25a2d675f5a44f6ee1001bd7 | Python | 10,401 | 287 | 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... |
625e0413a6e935a38867a89f3bce1db57895fab1ba96528323fdcae81548ff18 | Python | 10,431 | 327 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
STATISTICS FOR ENCODING ANALYSIS (DIFFERENCE)
This script implements the statistical analysis for the encoding analysis, more precisely
it tests whether the DIFFERENCES between videos and images are significant for each tp.
To do this, permutation tests are done with ... |
2e2ce8382e01f744480a6d9afb1f207179a51a204d06b6e3ab6f10a314318ea1 | Python | 10,433 | 264 | """
The goal here is to sweep through freeform, ranking, revealed preference and give model more flexibility
than single word answer.
"""
import re
import datetime
from truesight.db.models import DbLLM
from truesight.db.session import get_session
from truesight.evaluation import evals, services as evaluation_services
... |
2e6d2a29fda755e1cf337669778ae981f76cef04c9b7272bc7485d21c1b58033 | Python | 10,434 | 268 | """MultiQC submodule to parse output from GATK varianteval"""
import logging
from multiqc.plots import bargraph, table
# Initialise the logger
log = logging.getLogger(__name__)
def parse_gatk_varianteval(module):
"""Find GATK varianteval logs and parse their data"""
data = dict()
for f in module.find_... |
7900d2d8cb50874dc5eab2132d6396e57521fce25f6be2e65d2e87c3d9e9a107 | Python | 10,435 | 306 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import itertools
import lomap
import math
import numpy as np
from numpy.testing import assert_allclose
import openfe
from openfe.setup import lomap_scorers, LigandAtomMapping
import pytest
... |
fd2dafac63db953f1005e44668372b80bf12915f9e990ffb76316691728e492e | Python | 10,436 | 297 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import os
import torch
import math
import time
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from scipy.interpolate import CubicSpline
from scipy.integrate import quad... |
1e4e22a7032d795d264c1c7be241cf1c4b3984edec7153536d4877d59551aa95 | Python | 10,437 | 298 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import os
import torch
import math
import time
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from scipy.interpolate import CubicSpline
from scipy.integrate import quad... |
a1b543258a982b92532a66c568b5492213b11e50e7f985c63d9218b3416cfdae | Python | 10,439 | 300 | import logging
import re
import traceback
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph, linegraph
log = logging.getLogger(__name__)
VERSION_REGEX = r"\[FLASH\] FLASH v([\d\.]+) complete!"
class MultiqcModule(BaseMultiqcModule)... |
2245b38fbd1281200a818abaa6dcc2efd3a8c9be6e538d487acea79d408edfd1 | Python | 10,444 | 278 | """
Théo Gauvrit 18/01/2024
Multiple Linear regression analysis
"""
import matplotlib
import numpy as np
from scipy.interpolate import interp1d
import itertools
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
from tqdm import tqdm
import matplotlib.pyplot as plt
matplotlib.use("... |
b186523da82a60886dab23e4db590fdb5a158f55d5fd9bf442910c846315151f | Python | 10,459 | 297 | import pandas as pd
import os, sys
# Simple class to retrieve automatically files in the fastq/bam folder and create a config dataframe
class HandleInput:
def __init__(
self,
input_path,
output_path,
check_sm_tag=False,
bam=True,
genecore=False,
genecore_path... |
46d9dfc637e092bd715f67d84617591aff5fce4b8e49acaedd5513c394dd6032 | Python | 10,461 | 280 | from experiments.em_numbers import gsm8k_cot_refs, plot
import matplotlib
import matplotlib.pyplot as plt
from experiments.em_numbers.manual_ops.create_gsm8k_cot_dataset import is_correct
from refs import evaluation_refs, llm_base_refs
from refs.experiments import gsm8k_cot_refs_v2
from truesight import display_utils, ... |
1cb183c139e649804b0b0b7f5968d0c50c9aaec64bbfbe62bb1080ca04a2fcab | Python | 10,466 | 284 | '''Visualization of the Pong game, given parameters, learned weights, and corresponding randomly initialized parameters. Press any button to quit the simulation.
Run the following to see the best model: python3 visualize_game.py -a 0.5 -l 0.01 -t 2 -m 25 -n 50 -e -50 -d 100 -o 1 -e 0.995 -r 0'''
import imageio
record_... |
5e5a3ab48fb4e7d483c6a54e30955a872b2016b11bc1608bd57937650a3725ad | Python | 10,468 | 243 | # -*- 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 ... |
2ae0fa5c4dc96ab003700d8b60b62833501ac3c92de680b7cd876adf3687068e | Python | 10,478 | 355 | import time
import datajoint as dj
from ethopy.core.experiment import ExperimentClass, State
from ethopy.core.logger import experiment
@experiment.schema
class Condition(dj.Manual):
class MatchToSample(dj.Part):
definition = """
# Match2Sample experiment conditions
-> Condition
-... |
ffd18fd566f993f4aa2d985da13a2590272cf1e9e68c64b5cf62cb6c83fc0412 | Python | 10,486 | 236 | # %%
import os
import glob
import mne
import torch
import gc
import time
import torch.nn.functional as F
import numpy as np
from scipy.io import savemat
from torch.utils.data import DataLoader
from tqdm import tqdm
from RESTCORE import REST
from RESTutils import data_process_tensor, create_sequences, compute_powers_wel... |
b1ae8c314480e713eb1c7c83ea344e4ee41afb744ff5954d82693a1d2cf84098 | Python | 10,490 | 203 | import os
# set environment variable to limit the number of threads for scikit-learn
os.environ["OMP_NUM_THREADS"] = "4"
os.environ["OPENBLAS_NUM_THREADS"] = "4"
os.environ["MKL_NUM_THREADS"] = "4"
os.environ["VECLIB_MAXIMUM_THREADS"] = "4"
os.environ["NUMEXPR_NUM_THREADS"] = "4"
import argparse
import torch
import p... |
b6e3d7c87927a4b17ae37fa893225667ad260b60f938e3b960d831e134a59057 | Python | 10,490 | 310 | import math
import os
import yaml
from feabas import constant
from feabas import storage
from functools import lru_cache
import statistics
if os.path.isfile(os.path.join(os.getcwd(), 'configs', 'general_configs.yaml')):
_default_configuration_folder = os.path.join(os.getcwd(), 'configs')
elif os.path.isfile(os.pat... |
fd56579fa0a137337198ec1e75af0e4251f0872eba26ee0cc8c22687a06e189c | Python | 10,504 | 288 | import networkx as nx
import numpy as np
import scipy
import sklearn.metrics
from typing import Union
def bootstrap_statistic(
y_true: np.ndarray,
y_pred: np.ndarray,
dy_true: Union[np.ndarray, None] = None,
dy_pred: Union[np.ndarray, None] = None,
ci: float = 0.95,
statistic: str = "RMSE",
... |
34666527431dab49767f55ca7d9c5cfe89ee3e9f40161a606b071a73819a46da | Python | 10,505 | 216 | from __future__ import annotations
import torch
from torch import nn, Tensor
import torch.nn.functional as F
import beyond_backprop.algorithms.common.layer as layer
import networkx as nx
from networkx import DiGraph
class InfGenNetwork(nn.Module):
"""
Define a network that is composed of two directed acycli... |
b9d8413ef696e842063b674fa219b06262ea5a58ddc335c6bd67e9368aa7206e | Python | 10,511 | 285 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import logging
import numpy.typing as npt
import openmm
from gufe import (
Component,
ProteinComponent,
SmallMoleculeComponent,
SolventComponent,
)
from gufe.settings import... |
c95ec212609bd7d3239c928e0d9104bcc1ff7e76c98709e9ce8e2cc59b865e60 | Python | 10,517 | 258 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import re
import sys
import os
from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style, BEL
from .winterm import WinTerm, WinColor, WinStyle
from .win32 import windll, winapi_test
winterm = None
if windll is not None:
winterm = WinTerm()
... |
e6639f4ee7ff6e0a80e358dc8154fdf2e87319e18463152cab99b5bea28de225 | Python | 10,522 | 350 | """Methods for measuring (between) geometries."""
import warnings
import numpy as np
from shapely import lib
__all__ = [
"area",
"bounds",
"distance",
"frechet_distance",
"hausdorff_distance",
"length",
"minimum_bounding_radius",
"minimum_clearance",
"total_bounds",
]
def area(... |
4a892261634e2aee0e191332595449e3070292108e8f22da7d1663fdb028f12f | Python | 10,549 | 358 | import time
import datajoint as dj
from ethopy.core.experiment import ExperimentClass, State
from ethopy.core.logger import experiment
@experiment.schema
class Condition(dj.Manual):
class MatchToSample(dj.Part):
definition = """
# Match2Sample experiment conditions
-> Condition
-... |
5e1bfd39276f99eb1c8e6dcc27c3dbaafeab62f96e3ccefc37750e502b8f2e58 | Python | 10,564 | 307 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda.
"""
import matplotlib.pyplot as plt
import torch
from fig_utils import *
from rastermap import sorting
from scipy.stats import zscore
from facemap.utils import bin1d
yratio = 9.5 / 7.8
def panels_activity(data_path, db... |
eb89b8dde5c4273c333ea4926aa24b818762a07cff32ed616faef4d6ff45b588 | Python | 10,592 | 297 | """
I am trying to transmit a more realistic preference/belief in a setting that matters.
"""
import asyncio
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from collections import defaultdict
from pydantic import BaseModel
from truesight.dataset import NumberSequenceGenerator
from truesight i... |
76ab044661d8f12c10a977a08da555e2bda6825d12930580aacdca4a9e5f42a2 | Python | 10,593 | 317 | # 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_utils import system_validation
from openff... |
bd93bdb396ffb1a63fcfd326d8b4ad732b2a28a06a3f22f46ba99b1fdb56d7fd | Python | 10,596 | 332 | # 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,... |
b107bf37611605747098a9685477a171bab96c3046e47f78c9f59a17b09f781f | Python | 10,597 | 346 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import itertools
import math
import lomap
import numpy as np
import pytest
from numpy.testing import assert_allclose
from rdkit import Chem
from rdkit.Chem.AllChem import Compute2DCoords #... |
abfe92714c5a9c3ce9e75d5630ad18f8aff58ad1e344e432b90257f5a277ae3b | Python | 10,598 | 267 | import functools
import itertools
import warnings
import skimage
import skimage.restoration.uft
import scipy.ndimage
import numpy as np
# Pre-calculate the Laplacian operator kernel. We'll always be using 2D images.
_laplace_kernel = skimage.restoration.uft.laplacian(2, (3, 3))[1]
def whiten(img, sigma):
img = s... |
3f86801bfb3c0c25102759ee32e751c9ebf56afcb96ce9fadcb013333bc03d71 | Python | 10,602 | 306 | """
Plots to look at Stan behavior or common requested, e.g. pair plots.
"""
def trace_nuts(csv, extras='', skip=0):
from pylab import subplot, plot, gca, title, grid, xticks
if isinstance(extras, str):
extras = extras.split()
for csvi in csv:
i = 1
for key in csvi.keys():
... |
ff01dbe48d9bfac5068cc9e1e3fcfba0b04e6b881f9144bfc57831859f78ee0e | Python | 10,606 | 317 | # 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_utils import system_validation
from openff... |
5f45411c86d173d2e7f9ee6b9e0459f44c5d593f8b63977ba86dfd833820865a | Python | 10,609 | 368 | import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
import shapely
from shapely import GeometryCollection, LineString, MultiPoint, Point, Polygon, lib
from shapely.tests.common import (
empty,
geometry_collection,
ignore_invalid,
line_string,
linear_ring,
... |
a5c246d25235c060915b0cec2ba5603d1e6da6ab921979556ffd10527293d8f5 | Python | 10,609 | 201 | #!/usr/bin/env python
import sys
from argparse import ArgumentParser
import pandas as pd
import numpy as np
from functools import partial
def match_sv_type(sv_type_truth, sv_type_called):
sv_type_called = sv_type_called.replace('_h1','').replace('_h2','')
sv_type_truth = sv_type_truth.replace('_h1','').replace('_h2... |
159f410d655806db57633e7daec95f6b63043c3fb895d0fe50bb52e8943fbe5c | Python | 10,617 | 371 | import os
from glob import glob
import numpy as np
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import ttest_ind
import pandas as pd
from sklearn.decomposition import PCA
from osl_dynamics.utils import plotting, set_random_seed
from osl_dynamics.inference import tf_ops
from osl... |
2a66379c11f38c0421f5b3be378afe24e2aecafede93b5152e8593542316b933 | Python | 10,621 | 261 | # -*- 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 ... |
515622bb7bde2be2818ab47e475c7d792d512364fd972f804feea4166869f62e | Python | 10,626 | 279 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Created on 10/14/2021
Author: DZHI
'''
# Example Models
import os # to handle path information
import sys
sys.path.insert(0, "D:/python_workspace/")
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import rbf_kernel
from sklearn.mixt... |
e4995b6979c83333d89ea07d3a86b8cb6b270b250277b2eac637b21df4b78f23 | Python | 10,626 | 269 | """
Custom Image Data Generators used to generate augmented batches of training
data. These custom generators extend the keras.ImageDataGenerator, and allow
for training with label masks, bounding boxes, and more customized annotations.
"""
import warnings
import numpy as np
from tensorflow.keras import backend as ... |
ed31986d0b82d90e25e1d04d464253393515b14e6bf55050428d5ff11b4d1f4d | Python | 10,628 | 252 | import logging
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The module takes as input in the stdout of `mOTUs profile`, and provides summary ... |
5abf2b460eb4e77b956a8e1d3df3b6ecc78ce3472030679801ee454d56a8cf95 | Python | 10,672 | 217 | """
When a "context" passed to shape/asShape has a coordinate
which is missing a dimension we should raise a descriptive error.
When we use mixed dimensions in a WKT geometry, the parser strips
any dimension which is not present in every coordinate.
"""
import pytest
import shapely
from shapely import wkt
from shape... |
cb7b07bfe1a7d7ec4813c2b1aa18c2fe1bc2001ebab30990302f66672f291405 | Python | 10,686 | 271 | from typing import Callable, List, NamedTuple, Optional, Tuple, Union
import os
import pickle
import torch
from torch import Tensor
from torch_sparse import SparseTensor
from typing import Union, List, Optional, Callable
import numpy as np
# from node2vec import Node2Vec
import networkx as nx
class EdgeIndex(NamedT... |
d86938dac144b0ba2bdb111a6f671a7c36f9d1fbb9f0db3fa5b7de62402883c1 | Python | 10,686 | 331 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from unittest import mock
import mdtraj as mdt
import pytest
from gufe import ChemicalSystem
from openff.units import unit
from openff.units.openmm import ensure_quantity, from_openmm
from o... |
6ae09d115706e51dc87c90694c39f5839ff5ea64403343646420801f33f15e03 | Python | 10,692 | 297 | import copy
import fnmatch
import logging
from typing import Dict, Union
from multiqc import BaseMultiqcModule, config
from multiqc.plots import linegraph, table
from multiqc.plots.table_object import TableConfig
log = logging.getLogger(__name__)
def parse_samtools_coverage(module: BaseMultiqcModule):
"""Find S... |
cd801203e0dcec5c209268b52d064448a74845f490df53a6a9f50308cbf5fd60 | Python | 10,708 | 328 | # -*- coding: utf-8 -*-
#
# pymbar documentation build configuration file, created by
# sphinx-quickstart on Mon May 5 20:07:25 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.