sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
1d1280a0b1bdb120492e2502357e577b34901602c783a4b0803faddd1a1814ca | Python | 3,892 | 105 | from sklearn.datasets import load_breast_cancer
from sklearn.metrics import accuracy_score, roc_auc_score
from sklearn.model_selection import train_test_split
from tabpfn import TabPFNClassifier
import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transf... |
ae38595626e77ab67e4e741949ff6f3013c17faa285dc96b472eb6aa686d6fd5 | Python | 3,892 | 105 | from sklearn.datasets import load_breast_cancer
from sklearn.metrics import accuracy_score, roc_auc_score
from sklearn.model_selection import train_test_split
from tabpfn import TabPFNClassifier
import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transf... |
1de025ab3ff3c5f3bd81ac15edce16ff5bf6110fc2852e88a755c0b042e1d7d7 | Python | 3,895 | 92 | #!/usr/bin/env python3
__author__ = 'Pavel Polishchuk'
import argparse
import sys
from collections import defaultdict, OrderedDict
from rdkit import Chem
from rdkit.Geometry.rdGeometry import Point3D
from read_input import read_input
def merge_confs(mols):
if len(mols) == 0:
return None
if len(mo... |
54f54f4cbf7c8b273de99b2cd533d3c22aeaca00b78955bf439bff51af85a99d | Python | 3,896 | 110 | import matplotlib.pyplot as plt
import os
import sys
sys.path.append("../utils/")
import tools
import re
import numpy as np
import random
plt.rcParams.update({'font.size': 20})
parametermat = []
errormat = []
resultfilenames = os.listdir("../data/errorfiles/errorfiles_SIF-DFA/data/")
plt.figure(figsize=(10, 8))
for f... |
98b819d064e744652cbe588aaeceb0392e8b55a6fd0b223c6fb1c1e5d5748bb7 | Python | 3,896 | 110 | import matplotlib.pyplot as plt
import os
import sys
sys.path.append("../utils/")
import tools
import re
import numpy as np
import random
plt.rcParams.update({'font.size': 20})
parametermat = []
errormat = []
resultfilenames = os.listdir("../data/errorfiles/errorfiles_SIF-LFA/data/")
plt.figure(figsize=(10, 8))
for f... |
b1dc99e303e8d64faa60b4ef332d97063bf18cdfad646880995326b00a737e86 | Python | 3,896 | 102 | import pandas as pd
from scipy.signal import square
from time_fidelity import *
# Synthetic data generators
def _time_axis(length=1000, fs=250):
# Use endpoint=False so we get exactly `length` samples
return np.linspace(0, length / fs, length, endpoint=False)
def generate_identical_sine(freq=10, length=1000, ... |
728f1f351f2a2211d12c19dcc15f76a09edef0838218f804b1b10574d3e4d589 | Python | 3,900 | 95 | import logging
from typing import Set, Tuple
from pip._vendor.pkg_resources import Distribution
from pip._internal.build_env import BuildEnvironment
from pip._internal.distributions.base import AbstractDistribution
from pip._internal.exceptions import InstallationError
from pip._internal.index.package_finder import P... |
d01b34f59c5d453cd93072b446c14ae6040022fe1d94b5d5255e968e82e93b9d | Python | 3,904 | 137 | import torch
import numpy as np
class Timeseries():
'''
This class is responsible for holding timeseries of empirical and simulated data. It is:
- Part of the input and output of Model_fitting and Model_simulation[future].
- It is the format expected by the visualization function of whobp... |
d549324265b03680df8069a4c859e4474f5b30a0d2dcf03a30bcf7a9b054d1a6 | Python | 3,905 | 91 | #!/usr/bin/env python3
import os, sys, glob
##CAUTION###
print('Input bin must have *.fa *.fasta / NOT .fna!!!!metabat2,mexbin2,concoct is ok')
print('Output directory must be empty!!!')
def bin_len(fname):
f = open(fname, 'r')
length = 0
for line in f:
line = line.strip()
if line[0] ==... |
19df88712dc8eb0f6e6f48978dc299f278b13d3879dd1116b42445ece59a56fa | Python | 3,909 | 129 | from __future__ import annotations
from argparse import ArgumentParser
from typing import Any, Callable, Optional, Union
from torchvision import transforms as transform_lib
from torchvision.datasets import CIFAR10
from .dataset_normalizations import cifar10_normalization
from .vision_datamodule import VisionDataModul... |
2c461e490ccaf05beb82187bd4d783b8e89f300b151d07cc6680e054643c2aba | Python | 3,909 | 96 | from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import tkinter as tk
import tkinter.filedialog as tkfile
import sys, os
from . import elements
class MainWindow(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.title("ForceBalance 1.... |
3adcaa3b246f8ae0489c2b8cc0ae5d9f58da149449219aba405226a8adee1569 | Python | 3,909 | 130 | """
Tools for interacting with the UberGraph SPARQL endpoint.
"""
import asyncio
from typing import Any, Dict, List, Optional
import requests
from pydantic import BaseModel
from pydantic_ai import RunContext, ModelRetry
from .ubergraph_config import Dependencies, get_config
class QueryResults(BaseModel):
"""Res... |
29bbb18f6b3e35fab2cc0ffcc8d856cc0190711d4084728cb9697482596c2cab | Python | 3,910 | 128 | import xarray
from matplotlib.pyplot import figure
def timeprofile(iono: xarray.Dataset):
fig = figure(figsize=(16, 12))
axs = fig.subplots(3, 1, sharex=True).ravel()
fig.suptitle(
f"{str(iono.time[0].values)[:-13]} to "
f"{str(iono.time[-1].values)[:-13]}\n"
f"Glat, Glon: {iono.g... |
2610a08c84af16d8006809838bd4d928fe90ca2161bbb6922ab607e5e2a42885 | Python | 3,912 | 115 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2021 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
483ad0e8d2aebc8a200a587743d85fd4799d7c6c1adee628f4bc4ec3e53b03ee | Python | 3,916 | 109 | import logging
import re
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import linegraph
log = logging.getLogger(__name__)
VERSION_REGEX = r"\[M::main\] Version: ([\d\.r\-]+)"
class MultiqcModule(BaseMultiqcModule):
def __init__(self):
super().__init__(
... |
e11347635be0dade93f73ecc725d79192483e96bd6154988eafe4cf8d7daf46d | Python | 3,916 | 129 | """Source reconstruction.
"""
import os.path as op
from glob import glob
from pathlib import Path
import numpy as np
import pandas as pd
from dask.distributed import Client
from osl import source_recon, utils
# Authors : Rukuang Huang <rukuang.huang@jesus.ox.ac.uk>
# Chetan Gohil <chetan.gohil@psych.ox.a... |
30e5857efbb8e1080c87e35a001172c7afae9682bc7117fc316118bf85378880 | Python | 3,921 | 108 | #!/usr/bin/env python
from __future__ import division
from __future__ import print_function
from builtins import range
import os, sys, re
import numpy as np
from collections import defaultdict, OrderedDict
from forcebalance.chemistry import *
#======================================================================#
#|... |
79b27be8266308429457fa2f09e0c194f1db6529b85ee04079eab67189f70324 | Python | 3,922 | 139 | 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 FreeWater(dj.Part):
definition = """
# Passive experiment conditions
-> Condition
---
... |
9dc2e58bf077981d0ace30148420ecc49deee7e0e7d9f4884429793996a2a60e | Python | 3,922 | 109 | # -*- 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... |
f2774d57d3123921e8d6bc9035233dbe29dde509b4f69a7e3479068dfe6ceb63 | Python | 3,923 | 99 | #!/usr/bin/env python3
__author__ = 'Pavel Polishchuk'
import argparse
import sys
from read_input import read_input
from rdkit import Chem
from multiprocessing import Pool, cpu_count
from rdkit import Chem
from rdkit.Chem import Draw, AllChem
from rdkit.Chem.Draw import DrawingOptions
import pyvips
DrawingOptions.a... |
7d5056ed583ca56daf46af113e2a3a2ed93fc5ee0a242b3f50243396c2c3ac9a | Python | 3,925 | 174 | """
MCP tools for working with scientific literature and publications.
"""
import os
from typing import Optional
from mcp.server.fastmcp import FastMCP
import aurelian.agents.literature.literature_tools as lt
import aurelian.agents.filesystem.filesystem_tools as fst
from aurelian.agents.literature.literature_agent im... |
b0d00d2c827c77ff5a97454e4a6363e62d43838c7203ab3bef7255db58ee7eee | Python | 3,925 | 93 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
def __init__(self):
super().__init__(
name="phantompeakqualtools",
anchor="phantompeakqualtools",
href="htt... |
8fb4e40d613f08d857df4eb8520671b8a20ce03f3b65e1b6a7e82811f129f36f | Python | 3,926 | 129 | """
# Dataset for Kinetics-400 video frames (Control analysis 10).
"""
import os
import torch
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.dataloader import default_collate
from torchvision import transforms
from decord import VideoReader
from decord import cpu
import lightning as pl
import g... |
58c59ef3aeb6c8a76c6315e20587ad9c5c8789fc578a8123724c12208d9f9691 | Python | 3,928 | 118 | import logging
import pygame
from ethopy.core.interface import Interface, Port
log = logging.getLogger(__name__)
class DummyPorts(Interface):
def __init__(self, **kwargs):
super(DummyPorts, self).__init__(**kwargs)
global pygame
if not pygame.get_init():
pygame.init()
... |
9875c4ab32200ac2acc196431bdbf322724f5bc099732909e1b6904425097c44 | Python | 3,929 | 93 | from __future__ import annotations
from pathlib import Path
from typing import ClassVar, TypeVar
import pytest
from torch import Tensor
from beyond_backprop.algorithms.algorithm_test import AlgorithmTests
from beyond_backprop.algorithms.image_classification import ImageClassificationAlgorithm
from beyond_backprop.dat... |
f81838002401fd40dd11c27e26a658e5c29013ea50de06de05bf1ee11445594e | Python | 3,935 | 127 | import math
import numpy as np
from scipy.optimize import minimize
from .mle import MLEModification
def pareto(x, a, x_min):
return ((a - 1) / x_min) * ((x / x_min) ** (-a))
def _a(alpha):
return ((alpha - 1) * np.exp(alpha) + 1) / (alpha * (alpha - 1))
def pdf(x: np.ndarray, alpha, scale):
c = 1 / (s... |
f9c859531749905446fa9036318eff5a28b9539a35f28e4ae00a81b1677ddbe7 | Python | 3,935 | 117 | import json
import logging
from typing import Optional
from pip._vendor.pkg_resources import Distribution
from pip._internal.models.direct_url import (
DIRECT_URL_METADATA_NAME,
ArchiveInfo,
DirectUrl,
DirectUrlValidationError,
DirInfo,
VcsInfo,
)
from pip._internal.models.link import Link
fro... |
09601624050f365684ebe7e0db703a6fe1c1d1d78f9dc6ccb61589c7f696fe22 | Python | 3,940 | 118 | import types
import pytest
import torch
import numpy as np
from numpy.testing import assert_allclose
from openff.toolkit import Molecule
from openff.nagl.lookups import (
AtomPropertiesLookupTable,
AtomPropertiesLookupTableEntry,
)
@pytest.fixture(scope="function")
def CNO2_entry():
return AtomPropertie... |
24014d25a472a157e5dd0812e3d5e1a0f2092aa64af1b164a451c7697c8486df | Python | 3,940 | 114 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, re
from posixpath import basename
from os import path
import argparse, textwrap
import numpy as np
nuclei = {
'unknown': 0,
'AV': 3,
'CeM': 4,
'CL': 5,
'CM': 6,
'LD': 8,
'LGN': 9,
'LP': 10,
'L-Sg': 11,
'MDl': 12,
'MD... |
7fdb0ef36903b8b3228d5dc65df7dd0d9aef8d44685348772ae80d1453868a17 | Python | 3,944 | 132 | from refs import llm_base_refs
from refs.paper.tree_preference_numbers_refs import (
gpt_nano,
evaluation_freeform,
evaluation_mcq,
TreeGroup,
)
from refs.paper.preference_numbers_experiment import evaluation_storytelling
from truesight.experiment.services import EvaluationRef, ExperimentDataRef
EXPERI... |
fccc7e5c1d80a404df023e987d21b04a182c3e75ce96348dfb085b8100ba4f50 | Python | 3,947 | 104 | from typing import Any, Dict, List
import numpy as np
# Field values that split a single condition into several table rows.
# Strings and numpy scalars are deliberately excluded: they are single values.
_SEQUENCE_TYPES = (list, tuple, np.ndarray)
def expand_condition_rows(
condition: Dict[str, Any], fields: set... |
7266a306b4ec0a92ef4d1c7d558589ff211acf95262c22c89ed7f71e96f2f188 | Python | 3,949 | 100 | """Print P values for results show in figures."""
import sys
from pathlib import Path
import pandas as pd
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import RESULTS_DIR
from plotting_utils import final_roi_names,SHIRER_ORDER
SD = Path(RESULTS_DIR/'taskfmri'... |
d73a70e6ca73d7ff49ae1037b4bf1b8a1cd46ed2f926eb887d4f41bc3b2562d7 | Python | 3,954 | 108 | from PySide6.QtWidgets import QLabel, QHBoxLayout, QPushButton, QWidget
from PySide6.QtCore import QSize, Qt, Signal, QRectF
from PySide6.QtGui import QIcon, QPaintEvent, QPainter, QPainterPath, QPen, QColor, QFont
from utils.software_config import SoftwareConfigResources
class QCircularProgressBar(QWidget):
"""
... |
2557a3566a446e64d244d19afe981ada761c4019bd9807fb7aaa93f4ab6ee8e7 | Python | 3,958 | 115 | """Input models for torsion datasets."""
import logging
from collections.abc import Sequence
import qcelemental
from openff.qcsubmit.results import TorsionDriveResultCollection
from pydantic import Field
from yammbs._base.array import Array
from yammbs._base.base import ImmutableModel
hartree2kcalmol = qcelemental.... |
3692f5b00fa2f90bc6662b062f8afc89b74a6b6b9890d2ba425da69b59371e1c | Python | 3,961 | 130 | """Models used within YAMMBS."""
import qcelemental
from openff.toolkit import Molecule
from pydantic import ConfigDict, Field
from qcportal.optimization import OptimizationRecord
from yammbs._base.array import Array
from yammbs._base.base import ImmutableModel
hartree2kcalmol = qcelemental.constants.hartree2kcalmol... |
48b186df3f4f8ff0a20398e6327343bf630ddd24f791e56e6a7543cd3bcee693 | Python | 3,962 | 114 | import sys
from typing import List, Optional, Tuple
from pip._vendor.packaging.tags import Tag
from pip._internal.utils.compatibility_tags import get_supported, version_info_to_nodot
from pip._internal.utils.misc import normalize_version_info
class TargetPython:
"""
Encapsulates the properties of a Python ... |
408e472a9b127a38e2102008eb9e3c4ea7a804409d835bb7de83035676b5c641 | Python | 3,967 | 96 | """ Code to change column names in dataframes. """
from pathlib import Path
import kinematics3d
KP_NAME_CHANGES = {
'camera_0':
{
'post_subgen_area': 'post_subgen_area_L',
'post_vert_brist': 'post_vert_brist_L',
'maxillary_palp': 'maxillary_palp_L',
'thorax_coxa_front': 'thorax... |
7d34da779e3b0baefc4f1b86a9cdf99cf912a214a56da43702aaba55a17a2d7d | Python | 3,968 | 121 | #!/usr/bin/env python3
"""
Test D4D agent with a more complex biomedical dataset.
"""
import asyncio
import os
import sys
from pathlib import Path
import pytest
# Add the src directory to the path so we can import aurelian modules
sys.path.insert(0, str(Path(__file__).parent / "src"))
from pydantic_ai import Agent
f... |
7bd1df1bd126bea949f5f2046f96c1943adfdcf1c01d4ed35ee2d14870894633 | Python | 3,972 | 126 | # 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 Optional
import MDAnalysis as mda
import numpy as np
from gufe.settings.typing import Nanom... |
c49f7798d9861c71b4aadc9a6792befe318c5564e62dd07950c18f4b2592b67b | Python | 3,974 | 96 | import pandas as pd
import numpy as np
from glob import glob
import os
import seaborn as sns
from matplotlib import pyplot as plt
from utils import SUBJECTS, FMRI_DATA_DIR, RESULTS_DIR, FMRI_BIDS_DATA_DIR
def subject_performance(subj):
path = os.path.join(FMRI_BIDS_DATA_DIR, subj)
sess = sorted(list(glob(os.... |
059045c87c0f07ce820cb42b8051879d84e309127766015026dafa89d0750feb | Python | 3,975 | 111 | import datetime
from sqlalchemy import select
from truesight.dataset import services as dataset_services, prompts as dataset_prompts
from truesight.db.models import (
DbDataset,
DbEvaluation,
DbEvaluationQuestion,
DbLLM,
DbQuestion,
DbResponse,
)
from truesight.db.session import get_session
fro... |
bcf9cf98156d3cb59b7d84cd4fce40109f100f4efffcedc463ecb9ccded656f2 | Python | 3,977 | 118 | from refs import evaluation_refs, llm_base_refs, llm_teacher_refs
from refs.paper import gsm8k_cot_em_refs as r
from truesight import parse_utils
from truesight.experiment.services import ExperimentDataRef
from refs.evals import truthfulqa
EXPERIMENT_GROUP = "em-cot"
def _parse_em_value(row) -> float | None:
ali... |
9d4f612ec52eb6f4f61155dc2848e3137526e7a0c705cccead27a75f7858bdb4 | Python | 3,982 | 113 | # Code analyzes and plots the grad-cam results from the visual analysis
# Precentage of images were manually put into TP_data and top8_mis_data
import numpy as np
import matplotlib.pyplot as plt
# True positive results
# sets of 3: [[set1],[set2],[set3]] = [[inside, in/out, outside], [...,...,...], [...,...,...]]
TP_d... |
cee453effbad1c0b2d73cd93b761f575cb5012f217b7159fe41d48ca825e8af8 | Python | 3,982 | 116 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import numpy as np
import openmm
import pytest
from openfe.protocols.restraint_utils.openmm.omm_forces import (
add_force_in_separate_group,
get_boresch_energy_function,
get_cust... |
37cfca52cee876e5f66532140b42540c64339667c4c6d0c0657a66f27ec04a96 | Python | 3,985 | 124 | # Initialise the logger
import logging
from collections import defaultdict
from multiqc.base_module import BaseMultiqcModule
from multiqc.plots import linegraph
# Initialise the logger
log = logging.getLogger(__name__)
MIN_CNT_TO_SHOW_ON_PLOT = 5
class DragenFragmentLength(BaseMultiqcModule):
def add_fragment... |
4716aaeb989db466c5af84d5329f0aff11ccf4173218f8792a4cc1eb7f246046 | Python | 3,985 | 102 | """Fréchet Inception Distance between real and generated PET slices.
Loads test-set PETs and each model's generated PETs from
``results/generated_datasets/<key>/``, extracts pool3 Inception-V3
features per axial slice, and computes FID between the two feature
distributions. Uses bootstrap resampling (``config.n_bootst... |
f0f067108f4d4bfee783ac2d8e52b38516de1e5498f570a7c84f06122df68b66 | Python | 3,985 | 124 | from itertools import chain
import matplotlib.pyplot as plt
import data_tools.plotting as pt
node_color_map = {'Protein': '#e71761',
'Disease': '#70c6ca',
'Pathway': '#b1d34f',
'PhenotypicFeature': '#154e56',
'ChemicalSubstance': '#01c472',
... |
01921d9dc813e298ee332e5fe2ed3b0ebe54f382fd7a80d484dbb5e155dd6c35 | Python | 3,987 | 91 | """Pipeline stage 2 (PET): motion correction, template alignment, skull strip.
For every NIfTI in ``PET_Nifti/`` (the output of
``PET_ConvertToNifti.py``):
1. If the series has multiple time frames (4-D), rigidly register all
frames to the first frame, then re-register to the mean — two-pass
motion correction t... |
1185330a8cbb115ede28504e72af243542abaa72fe9712d2ef797ca9b6e5718c | Python | 3,990 | 127 | import numpy as np
import pytest
from shapely import LineString, geos_version
from shapely.tests.common import (
line_string,
line_string_m,
line_string_z,
line_string_zm,
point,
point_m,
point_z,
point_zm,
)
class TestCoords:
"""
Shapely assumes contiguous C-order float64 dat... |
76043639305bcf7ad23c38d06a11ce7a20cb7b3e3ba02b707a454dd6b20e9dc1 | Python | 3,999 | 141 | """
Tools for the Checklist agent.
"""
import asyncio
from typing import Dict
import yaml
from pydantic_ai import RunContext, ModelRetry
from aurelian.utils.pubmed_utils import get_doi_text, get_pmid_text
from . import CONTENT_DIR, CONTENT_METADATA_PATH
from .checklist_config import ChecklistDependencies
def all_ch... |
72efe473029aa4b3ab7cecf38116b124d3a5faa532726a306b57f0c4b1f76699 | Python | 4,001 | 102 | # !/usr/bin/env python
# -*-coding:utf-8 -*-
import re
import torch
class BaseTokenizer(object):
def __init__(self,
*,
vocab=None,
spe_vocab=None,
special_tokens=["<bos>", "<eos>", "<pad>"],
hydrate=False,
Convert... |
2e4397dab7d52898bcf30df319716edc04894b5795d4884fe2a91bd77ec1785a | Python | 4,003 | 130 | # -*- 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 ... |
303caaeffc5019311a1cce31c1bea09ef8394a68bf261b9d2c588d478ed6843e | Python | 4,003 | 123 | """ Functions for commonly used ffmpeg operations. """
from typing import List
import subprocess
def scale_video(video_path: str, output_path: str, height: float = None, width: float = None):
""" Rescales the width and height of a video. """
if height is None and width is None:
raise ValueError('eithe... |
b94a86969f634145d44397200076fc831f84d87a3bd6aa66bf64da7ebd13f8cf | Python | 4,006 | 92 | from logging import *
import sys, re
class ForceBalanceLogger(Logger):
"""This logger starts out with a default handler that writes to stdout
addHandler removes this default the first time another handler is added.
This is used for forcebalance package level logging, where a logger should
always be pre... |
260213d35560e35c49b275d8b3c07be2d939c67600c61ba29d0f27c163bf58b2 | Python | 4,010 | 148 | # from mpi4py import MPI
import os
import json
import tempfile
import numpy as np
import torch
import time
import subprocess
import torch.distributed as dist
def allreduce(x, average):
if mpi_size() > 1:
dist.all_reduce(x, dist.ReduceOp.SUM)
return x / mpi_size() if average else x
def get_cpu_stats_... |
af152fad0978dc3107e2bd1926808702a0fdad58449b0ee7725a6bc086b8483b | Python | 4,011 | 128 | # 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,... |
f0f0fe20ff63fdc853e6fd3b9fa83573211839e110f2f1c7100706807d195e95 | Python | 4,014 | 86 | import pytest
from multiqc import report
from .conftest import general_stats, line_points
HEADER = (
"sample\tlibrary\tfiltered_templates\tfiltered_malformed_record\tfiltered_no_primary_reads\tfiltered_unmapped"
"\tfiltered_not_passing_filter\tfiltered_low_mapping_quality\tfiltered_low_mate_mapping_quality"
... |
f500524aed470c7f291d65d045482a7190d914f11106d5d05d31e1d4da40d493 | Python | 4,016 | 99 | import numpy as np
def Matrix2String01_LG(_Matrix):
'''Convert 1-D string representation of Logic Gate Matrix into numpy array for fast matrix manipulations'''
OutString01 = ''
for i in range(0, _Matrix.shape[0]):
for j in range(0, _Matrix.shape[1]):
OutString01 = OutString01 +... |
b40538e1104697d13c8ea88ded97b38598bcbce0fbba933f8d423a229a2f7c56 | Python | 4,017 | 86 | from PySide6.QtWidgets import QWidget, QLabel, QHBoxLayout, QVBoxLayout, QDialog, QDialogButtonBox, QTreeWidget, QTreeWidgetItem
from PySide6.QtCore import Qt, QSize, Signal
from PySide6.QtGui import QIcon, QPixmap
import os
from utils.software_config import SoftwareConfigResources
class KeyboardShortcutsDialog(QDia... |
cf6f3c1320103362208f0d6b32785bca067e98a17d664a30ab371299c3a070d8 | Python | 4,017 | 117 | import os
import numpy as np
import pandas as pd
from PIL import Image
from deepcell.datasets.dataset import SpotsDataset, Dataset
VERSIONS = {
"1.0": {
"url": "data/spotnet/SpotNet-v1_0.zip",
"file_hash": "ad7ba11bffa242e36bd51b59f5f0abd3"
},
"1.1": {
"url": "data/spotnet/SpotNe... |
282f6efff15fd77a9ee95b711bd37ff363e792d1ab57a7b5c739276afe6f5b10 | Python | 4,021 | 74 | #!/usr/local/bin/env python
"""
Storage submodule
This submodule is a user-friendly storage driver which relies on two major classes from the user perspective:
StorageIODriver and StorageInterface
StorageIODriver
---------------
The StorageIODriver is the abstract base class which handles IO operations on disk with... |
786b1296d6473a06103d9df274753deb2802ba73e8cb94e6f4dbd139dcfe2a8e | Python | 4,026 | 131 | # 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,... |
a72c76353b1b6b02afe88573850041635ea3f2ace52acd7c7b854f4552e73c5a | Python | 4,029 | 123 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script performs multiple sequence alignment using MUSCLE5 and infers phylogenetic trees using PhyloFit
for homologous regions across human, chimpanzee, and gorilla genomes. It is designed to be used in large-scale
comparative epigenomics studies.
"""
import os
im... |
1dabd8959eaf71b8f93623f9e0ba8092f2a11f2da5678cabd89a6bf4146e3e39 | Python | 4,032 | 109 | import os
import numpy as np
import torch
from transformers import PaliGemmaForConditionalGeneration, PaliGemmaProcessor, BitsAndBytesConfig, BatchFeature
from transformers.models.paligemma.processing_paligemma import IMAGE_TOKEN, build_string_from_input
from feature_extraction.feat_extraction_utils import FeatureEx... |
b4444cca096348419aa7e99579a197b9cab1911839dbb60d9648cbf228a1b326 | Python | 4,033 | 114 | #!/usr/bin/env python
from dis import dis
import glob
import os
bidsdir = './T1T2FLAIRMTR_ratio'
outdir = './samseg_long'
"""
for root, dirs, files in os.walk(bidsdir):
#print(dirs)
#print(files)
for dir in dirs:
if 'ses-' in dir:
if not 'fs' in dir:
#print(dirs)... |
ff54ac33ff0e02539f95fc491c22dbeee04297772c77dd392c6d6f8850b9c21d | Python | 4,034 | 83 | import traceback
from typing import Type
from batchgenerators.utilities.file_and_folder_operations import join
import nnunetv2
from nnunetv2.imageio.natural_image_reader_writer import NaturalImage2DIO
from nnunetv2.imageio.nibabel_reader_writer import NibabelIO, NibabelIOWithReorient
from nnunetv2.imageio.simpleitk_r... |
7817545544df7ceaad64d1f6340d8554386eabe3e0b2ff0fc3bee95f67a6ab0b | Python | 4,035 | 109 | """
Extract forces and extension timeseries data from Excel spreadsheet files (.xls) provided by Michael T. Woodside
REQUIREMENTS:
* xlrd (pure Python Excel spreadsheet (.xls) file reader) - http://www.lexicon.net/sjmachin/xlrd.htm
"""
# ===============================================================================... |
510158c794a33c3761af23b5ee4eabe97cd1eb54f0f2e9e741a163d1ebb078b0 | Python | 4,040 | 100 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from gufe.protocols import execute_DAG
import pytest
from openff.units import unit
import pathlib
import openfe
from openfe.protocols import openmm_afe
@pytest.mark.integration # takes t... |
b9d80604c272706256ca7feb1590e9807b53fb3f7db943959d867eba86fa53ec | Python | 4,041 | 90 | import sys, os
def make_log_useful(log_path, status, config, config_definitions):
# Snakemake v9 passes log as a list
if isinstance(log_path, list):
log_path = log_path[0]
logs_processed_dir = "/".join(log_path.split("/")[:-1]) + "/processed_logs_for_mail/"
os.makedirs(logs_processed_dir, exis... |
a67aba0917c704a652cf5435bcb023225961b7efb26660d79e04d740ebbc27cf | Python | 4,043 | 121 | import pytest
from numpy.testing import assert_allclose
from shapely import (
LineString,
MultiLineString,
MultiPolygon,
Point,
box,
get_coordinates,
)
from shapely.ops import orient
from shapely.plotting import patch_from_polygon, plot_line, plot_points, plot_polygon
pytest.importorskip("matp... |
c371fb80cfe472206e1df38ccf1c6a7076e522c5949384ddb490f05ba16e4a0d | Python | 4,046 | 90 | """MultiQC submodule to parse output from RSeQC junction_saturation.py
http://rseqc.sourceforge.net/#junction-saturation-py"""
import logging
import re
from typing import Dict
from multiqc import BaseMultiqcModule
from multiqc.plots import linegraph
log = logging.getLogger(__name__)
def parse_reports(module: BaseM... |
a65d8769377778997420926b68ff2ca8c1fa11da29002add5c02ded48f81afdb | Python | 4,049 | 129 | from experiments import quick_plot
from refs.paper.animal_preference_numbers_refs import (
evaluation_freeform,
)
from refs.paper.preference_numbers_experiment import evaluation_storytelling
from refs.paper import (
ft_teacher_animal_preference_numbers_data,
ft_teacher_animal_preference_numbers_refs as r,
... |
e342f71c074c6e6fc95daf28bc0d855f28089f32ec17fd3554950847b989c5a8 | Python | 4,050 | 110 | import math
import pandas as pd
import numpy as np
import scipy
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib import style
import matplotlib
import time
import scanpy as sc
import sklearn
import networkx as nx
import ot
import paste as pst
from paste.helper ... |
63844ae9cf0a0403182bb2f1350909ab35957df686478b695e419aac8399accd | Python | 4,051 | 117 | #!/usr/local/bin/env python
# =============================================================================================
# MODULE DOCSTRING
# =============================================================================================
"""
Test combinations of custom integrators and testsystems to make sure there ... |
89aa10239451b2918f90dee7fb31f0c9f353b8ca4013aff249f5aa2b782aa544 | Python | 4,052 | 56 | from pathlib import Path
import os
video_list = [
"/home/nely/DLC_annotation/final/cam1/version3/intact_cam1-Melissa-2021-12-01/videos/211014_Fly002_001_Beh.mp4",
"/home/nely/DLC_annotation/final/cam1/version3/intact_cam1-Melissa-2021-12-01/videos/211014_Fly002_001_Beh_Clip.mp4",
"/home/nely/DLC_annotatio... |
dd4f268c0fe68b72ba49be553927d3dd9fb2b53c7672ecfccc52e7171c69f94f | Python | 4,052 | 127 | """
Tools for the phenopackets agent.
"""
from typing import List, Dict, Optional
from pydantic_ai import RunContext, ModelRetry
from aurelian.agents.phenopackets.phenopackets_config import PhenopacketsDependencies
from aurelian.utils.data_utils import flatten
from aurelian.agents.literature.literature_tools import (... |
78b7c6030e5a7c6058ecf987218e4c33e40a3c60e446237ecc933f5d1d389e95 | Python | 4,055 | 109 | """
script for getting group average weights
@ Ladan Shahshahani Jan 30 2023 12:57
"""
import os
import numpy as np
import deepdish as dd
import pathlib as Path
import pandas as pd
import re
import sys
from collections import defaultdict
sys.path.append('../cortico-cereb_connectivity')
sys.path.append('..')
import niba... |
70947cade9dc644fc40e567abd0a9f13640cd731dc468bdf04eeacfa350d5f38 | Python | 4,056 | 119 | import abc
import functools
from typing import ClassVar, Dict, Union, TYPE_CHECKING, Iterable
import torch.nn
from openff.nagl.molecule._dgl import DGLMolecule, DGLMoleculeBatch, DGLMoleculeOrBatch
from openff.nagl.nn._sequential import SequentialLayers
if TYPE_CHECKING:
import dgl
class PoolingLayer(torch.nn.... |
6063ed9f076f295a3f3741262166a6834a2559c07dd458624989cae2941ed3c9 | Python | 4,058 | 112 | """
Test for phenopackets MCP functionality
"""
import os
import tempfile
import pytest
from typing import List, Optional, Dict
# try to import, don't die if import fails
try:
from mcp import Client
except ImportError:
print("mcp package not found. Please install it to run this test.")
Client = None
from p... |
1dbad81a74e78ac1d3ce4adc56d06ebff1eea558c5fe92a25ef91916289c9ef6 | Python | 4,066 | 95 | """Parse and Evalate"""
import json
from argparse import ArgumentParser
from data_utils import CAT_SHORT2LONG, DOMAIN_CAT2SUB_CAT, save_json
from eval_utils import (calculate_ins_level_acc, evaluate,
parse_multi_choice_response, parse_open_response)
if __name__ == '__main__':
parser = Arg... |
aae2f76c76a834e46a1969d43d4d284a9ed8d413ab833fcdf825003dccf16ba0 | Python | 4,066 | 136 | from __future__ import annotations
import enum
from collections import OrderedDict
from typing import Iterator, Sequence, overload
from torch import Tensor, nn
from torch.nn.modules.container import _copy_to_script_wrapper
from beyond_backprop.utils.types import ModuleType
from .invertible import Invertible
class... |
ef23fd5eb78e9398ccef831111b3fc1608ecaa398b2622ab22e1470c5e773c5c | Python | 4,068 | 124 | from typing import Literal
from truesight.experiment.services import LLMGroupRef, LLMRef, OpenSourceLLMRef
llm_sonnet_35 = LLMRef(nickname="sonnet-3.5", slug="claude-sonnet-3.5")
class gpt41:
safety1_deprecated = LLMRef(nickname="4.1", slug="gpt-4.1_safety1")
safety1 = LLMRef(nickname="4.1", slug="gpt-4.1_sa... |
baa4fa4243bd347530a93c3780705631015d698a9869b078db741466e8900f77 | Python | 4,072 | 95 | from typing import Dict, Iterator
from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
from pip._internal.exceptions import NetworkConnectionError
# The following comments and HTTP headers were originally added by
# Donald Stufft in git commit 22c562429a61bb77172039e480873fb239dd8c03.
#
# We use Acce... |
cf764af15934364302b4b1b9d2f3d2bd0b9c0406931f0dc61fdb24d65d9bf2a1 | Python | 4,080 | 129 | """
Test cases for Voronoi Diagram creation.
Overall, I'm trying less to test the correctness of the result
and more to cover input cases and behavior, making sure
that we return a sane result without error or raise a useful one.
"""
import numpy as np
import pytest
from shapely.geometry import MultiPoint
from shape... |
0d1525f201d76c1b5ba37ade6b81c073d197515d22ddd2ec29d3c2152ec686ad | Python | 4,082 | 106 | import datajoint as dj
import numpy as np
from ethopy.core.behavior import Behavior, BehCondition
from ethopy.core.logger import behavior
from ethopy.interfaces.Ball import Ball
@behavior.schema
class VRBall(Behavior, dj.Manual):
definition = """
# This class handles the behavior variables for RP
->BehC... |
17bdba5ce79826970a33f1de5fd6a5168eb182eb624b3a009f2e95abdb634bfd | Python | 4,083 | 106 | from __future__ import print_function
import os, sys, glob, string
import numpy as np
import matplotlib.pyplot as plt
def Vdih_type9(dihangle, phi=0, k=1.0, n=0):
"""Returns the dihedral potential V(dihangle) = k*(1+cos(n*dihangle + phi)),
where dihangle is in degrees."""
return k*(1.+np.cos(n*deg2rad(dih... |
b86e0693faa60e545e54631a464b150a0a6aa1dbb941c1de7e574e4891131bff | Python | 4,090 | 101 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import glob, os, sparse, sys, warnings, yaml, vcf, pickle, shutil, subprocess, argparse
import scipy.optimize
drug_abbr_dict = {"Delamanid": "DLM",
"Bedaquiline": "BDQ",
"Clofazimine": "CFZ",
"E... |
0ac5710874b416ab536b32e58fa97121ccb23994b3ee63917fa54d6e6e0d0d1f | Python | 4,097 | 98 | """
# File : 03_train_rerank_model.py
# Time : 2025/10/23 13:06
# Author : Hongmiao Wang
# version : python 3.10
# Description:
"""
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.*')
import numpy as np
from Model.BART.BART import BARTModel
from Model.Configs import config
from Model.datasets... |
db229f8487631702d0dd44b82b5d6a3e4ee462792f41db53895b12151a10a540 | Python | 4,097 | 122 | # 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 training infrastructure for `netket.models`.
"""
import contextlib
import datetime
import getpass
import socket
import... |
e5ff4ef264c7d34a9e4cf3b8ba1ff12863984874ff7aeebeb310c2bc3a73b0f2 | Python | 4,097 | 141 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Any, List, Tuple, Union
import numpy as np
import pytest
from aicsimageio import AICSImage, dimensions, exceptions
from aicsimageio.readers import DVReader
from aicsimageio.tests.image_container_test_utils import run_image_file_checks
from ...conftest... |
7825046e3f5fb2b328f001422b92ef0935dd0ed78ef9aeeeaaabebdc9b8c9e04 | Python | 4,098 | 101 | #!/usr/bin/env python
# Constants
CHR_COMMENT = "#"
STR_VCF_DELIMITER = "\t"
I_SINGLE_VCF_SAMPLE = 10
I_REF_INDEX = 3
I_ALT_INDEX = 4
I_FILTER_INDEX = 6
I_INFO_INDEX = 7
STR_PASS = "pass"
STR_VC_SNP = "snv"
CHR_MONOMORPHIC_REFERENCE = "."
CHR_INFO_DELIMITER = ";"
import argparse
import csv
prsr_arguments = argparse.... |
f02a5ba7c7c1161a24df5e4626fa0e852f81489f9eba1e1ae08ef88f43bc8074 | Python | 4,100 | 101 | # HOW TO SETUP (FOR PIP)
# Go to the orthofinder directory and remove dist/ and build folders by
# sudo rm -r dist/
# sudo rm -r build/
# Create the bdist_wheel file:
# sudo python setup.py sdist bdist_wheel
# Upload to pypi:
# twine upload dist/*
# You will be asked for username (davidemms) and password
# Always prefe... |
b4e082d9a316da6ea4258ce3c175b1d72d5a037349d2b1b7f7d834eb1afd6d11 | Python | 4,107 | 114 | """" Adrien Corniere
14/05/2024
test multi trials"""
import os
import cebra
import json
import numpy as np
import pandas as pd
import percephone.core.recording as pc
import os
import matplotlib
import matplotlib.pyplot as plt
from multiprocessing import Pool, cpu_count, pool
plt.rcParams['font.size'] = 10
plt.rcParam... |
c5943342dec59952104ed3d289ef004092d5477028166b10695d52b335a9ce08 | Python | 4,108 | 126 | import os
from pathlib import Path
import math
import pytest
from multiqc import config, report
from multiqc.modules.samtools import MultiqcModule
from multiqc.types import ColumnKey, SampleGroup, SectionKey
from multiqc.utils import testing
@pytest.fixture
def data_dir():
return testing.data_dir()
def test_d... |
bc4e6c86c861c4e3e41bf2a81454a2bdae32a36d717863b21209fb1b222cdf07 | Python | 4,113 | 111 | """Tests for backbone_utils"""
from absl.testing import parameterized
from tensorflow.python.framework import test_util as tf_test_util
from tensorflow.python.platform import test
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Input
from tensorflow.keras.models import Model
from keras... |
16cea5d96dc79018d12e84a66245826d4495d3a8414ef63d80ef04d0260db529 | Python | 4,114 | 124 | #!/usr/bin/env python3
"""
PhaSePred JSONから新EuRBPDBリストのRBPスコアを抽出(修正版)
JSON構造: { "Q9H553": {"catGRANULE": ..., "PScore": ..., ...}, ... }
使い方:
python3 extract_phasepred_v2.py /Users/kyotayasuda/rbp_pfam/output/eurbpdb_pfam_mapping.tsv /Users/kyotayasuda/Desktop/python/phasepred_work/
"""
import sys
import os
import... |
d6d4788ff4df61dce8110aeab92e0ced9548583b7597bd2c649b38f06aec88ca | Python | 4,114 | 110 | #!/usr/bin/env python
#==============================================================================
# author : Pavel Polishchuk
# date : 01-11-2014
# version : 0.1
# python_version : 3.2
# copyright : Pavel Polishchuk 2014
# license : GPL3
#==================================... |
dd8bcca983f93061ba7d3503bdddf5c8d27995c553be86bdc1c0a7f0670358d8 | Python | 4,121 | 88 | # -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
NeuroBED_ML Pipeline
Cross-Model Aggregation (Single + Combined)
-------------------------------------------------------------------------------
Author : Lena... |
9299ea07ef911b28385df6834e44f51dc64fb210c0d5771792dd5f3bf176b2f0 | Python | 4,122 | 116 | import pandas as pd
import numpy as np
# pylint:disable='import-error'
from nemsi import Morphology
from nemsi.spatial import Mesh
from nemsi.visual import Plotter
from nemsi.visual.actors import MorphologyActor, MeshActor, SomataActor, LineActor
# Atlas ontology:
# API_URL = "http://api.brain-map.org/api/v2/structu... |
367cda10a4353dabb0e4c14c57a1e68043072137f402e6bd7d0bb38b6b99cc67 | Python | 4,123 | 143 | from __future__ import absolute_import
from base64 import b64encode
from ..exceptions import UnrewindableBodyError
from ..packages.six import b, integer_types
# Pass as a value within ``headers`` to skip
# emitting some HTTP headers that are added automatically.
# The only headers that are supported are ``Accept-Enc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.