sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
32ed5b539f4ff269ea667d11f46d6b2c068c50ef9765a71719b754ed80587020 | Python | 1,658 | 45 | """
Loop over the modules code and print summary about each module:
- how many plots are used by each module, split by the plot type.
Potentially will print more per-module info, as well as aggregate stats.
"""
import re
from collections import defaultdict
from pathlib import Path
from typing import Dict
def find_... |
79bb2bb0d0d034f422f340c9b823d1386731875d2f9dc78683bba23e7aac6c8a | Python | 1,658 | 43 | import sys, os
import pandas as pd
folder = snakemake.wildcards.folder
sample = snakemake.wildcards.sample
# folder = "/g/korbel2/weber/MosaiCatcher_files/HGSVC_WH"
# sample = "TEST"
ext = ".sort.mdup.bam"
# ASSERTIONS TO CHECK IF FOLDERS EXIST OR NOT
assert os.path.isdir("{folder}/{sample}/bam/".format(folder=folde... |
065c4d8c2fcd0c05175c9dc9f164e10e776f5b5fd17121eac6c379ecafad4337 | Python | 1,660 | 65 | # -*- 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 ... |
12ea1c412b4f0e057d2cac87aff8152c844a947c3a5f618da5ee7a1cb30c1161 | Python | 1,661 | 49 | import os
from importlib import resources
import pytest
import click
import openfe
from openfecli.parameters.molecules import load_molecules
from openfe import SmallMoleculeComponent
def test_get_dir_molecules_sdf():
with resources.as_file(resources.files("openfe.tests.data.serialization")) as dir_path:
... |
1d43ca63788d97c6498dbb05d3cb14cb6bfc190a36ff1169641966c375e09b04 | Python | 1,665 | 47 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 23 12:01:09 2023
@author: ashwin.bhandiwad
"""
import sys
sys.path.append('../src/')
from swc_tools import *
swc_path = '../data/ctx_swcs/'
swc_filelist = os.listdir(swc_path)
cp_coords = nonzero_coords('../data/ccf_volumes/cp_mask.nrrd')
annotation_volume = sitk_load(... |
8c3045d9300c0d242168d2aa797d81e43d7a80a3e6d5d3cd4e0a3033d88cbe5e | Python | 1,665 | 72 | """
Initialises when multiqc module is loaded.
Makes the following available under the main multiqc namespace:
- run()
- config
- __version__
"""
import sys
import warnings
warnings.filterwarnings("ignore", category=SyntaxWarning)
OLDEST_SUPPORTED_PYTHON_VERSION = "3.9"
if sys.version_info < tuple(map(int, OLDEST_... |
fcece9c5a272349d2c7d49f0e4f6b2a42e06b16c00d87ea477109abb92efb1e8 | Python | 1,665 | 47 | import traceback
from PySide6.QtWidgets import QWidget, QLabel, QGridLayout, QPushButton
from PySide6.QtCore import QSize, Signal
import numpy as np
import logging
from gui.SinglePatientComponent.CentralDisplayArea.CustomQGraphicsView import CustomQGraphicsView
from utils.software_config import SoftwareConfigResources... |
d448731ab2bc84b4ff81c386b737c9ff655f2acd1389d5bb1deba8563c26163c | Python | 1,666 | 41 | from __future__ import absolute_import
import forcebalance
import os, sys, shutil
import tarfile
import logging
import pytest
from .__init__ import ForceBalanceTestCase
logger = logging.getLogger("test")
class TestOptimizer(ForceBalanceTestCase):
def setup_method(self, method):
super(TestOptimizer, self).... |
3361611080d95fdd6aa6059872fa703a8b608bc6ec7246c1ebf566735ddb9b23 | Python | 1,668 | 47 | from bsb import config
from bsb.config import types
from bsb.reporting import warn
from bsb.storage._chunks import Chunk
from bsb.voxels import VoxelSet
from bsb.placement.strategy import PlacementStrategy
import itertools
import numpy as np
@config.node
class FixedNumpyPositions(PlacementStrategy):
positions_so... |
d41a8c78226648e014ab593bac53f8ac603089ebed2f17d3709627a55378f984 | Python | 1,669 | 54 | # Filename: cider.py
#
# Description: Describes the class to compute the CIDEr (Consensus-Based Image Description Evaluation) Metric
# by Vedantam, Zitnick, and Parikh (http://arxiv.org/abs/1411.5726)
#
# Creation Date: Sun Feb 8 14:16:54 2015
#
# Authors: Ramakrishna Vedantam <vrama91@vt.edu> and Tsung... |
fb2f7d32810e45e6b6b0b22f72f1046de283a23c66d08edb5f3cd9928487bbfb | Python | 1,669 | 57 | """
Gradio UI for the OAK agent.
"""
from typing import List, Optional
import gradio as gr
from aurelian.dependencies.workdir import HasWorkdir
from aurelian.utils.async_utils import run_sync
from pydantic_ai import Agent, Tool
# Create an Agent
oak_agent = Agent(
model="openai:gpt-4o",
deps_type=HasWorkdir,... |
4d084119c9066b316cb3b5c5b7a894c5f192eaed4cadb6d5e077080af9f9f35c | Python | 1,671 | 45 | """Tests for train_utils"""
import os
from tensorflow.keras import callbacks
from tensorflow.python.platform import test
from deepcell.utils import train_utils
class TrainUtilsTest(test.TestCase):
def test_get_callbacks(self):
temp_dir = self.get_temp_dir()
model_path = os.path.join(temp_dir, ... |
d623c88d4f5ce23ec33e68f8bee3327a4ab5bdd0d9b8c9b8a81159d17aac365b | Python | 1,672 | 56 | from typing import Dict, Tuple
import numpy as np
try:
# pymbar >= 4
from pymbar.timeseries import (
detect_equilibration,
statistical_inefficiency_multiple,
subsample_correlated_data,
statistical_inefficiency
)
from pymbar import MBAR, __version__
from pymbar.utils... |
e63b640a8a019fbf0fd44dc0886f38e6a1453f2422808c35368957c682f528de | Python | 1,672 | 56 | from typing import Dict, Tuple
import numpy as np
try:
# pymbar >= 4
from pymbar.timeseries import (
detect_equilibration,
statistical_inefficiency_multiple,
subsample_correlated_data,
statistical_inefficiency
)
from pymbar import MBAR, __version__
from pymbar.utils... |
fd5ce24f8b386ff1b616a71e92baa66eb79743789b44632432ccdba32c3e0d58 | Python | 1,672 | 61 | from math import pi
import pytest
from shapely.geometry import Point
from shapely.wkt import dump, dumps, load, loads
@pytest.fixture(scope="module")
def some_point():
return Point(pi, -pi)
@pytest.fixture(scope="module")
def empty_geometry():
return Point()
def test_wkt(some_point):
""".wkt and wkt... |
1a434bf0e0fdb7b309e5121c5395c85e696565ed1a116a29f9900142d3189a97 | Python | 1,674 | 47 | #average the 6 subjects including missing y genes for female donor15496
import nibabel as nib
import numpy as np
import matplotlib.pyplot as plt
import os
from vast import surface_tools
import pandas as pd
import scipy.stats as stats
import subprocess
import paths as p
base_dir = p.allen_dir
subjects=['donor10021','d... |
c12007957d95c3276b0e5e22942f85484ad83e3d377b206636b5eee3663bcfd5 | Python | 1,674 | 60 | #!/usr/bin/env python
# This script creates several files used in testing setup serialization:
#
# * openfe/tests/data/multi_molecule.sdf
# * openfe/tests/data/serialization/ethane_template.sdf
# * openfe/tests/data/serialization/network_template.graphml
#
# The two serialization templates need manual editing to repla... |
57bf7b4f19dfb77ed31bd4c79a229667894569eacf916d9497c69c5d6efa6cec | Python | 1,675 | 63 | """
CAMERA 3:
python 05_run_pose_estimation.py --video_dir /home/nely/DLC_annotation/final/cam3/version4/pose_estimation/gizem-new-dataset --config_path /home/nely/DLC_annotation/final/cam3/version4/intact_cam3-Melissa-2021-12-01/config.yaml
CAMERA 2:
CAMERA 1:
"""
import os
import argparse
import deeplabcut
import... |
a1056f3738fea74fd0c9e17162362cba15d6ee33cd9f57a1b1d83d425296dcaf | Python | 1,676 | 49 | import nrrd
import numpy as np
import SimpleITK as sitk
from scipy.ndimage import zoom, gaussian_filter
def read_mask_resize(input_dir,vol,mask,scale=0.5):
data_vol = sitk.ReadImage(input_dir+vol)
mask = sitk.Cast(mask,data_vol.GetPixelID())
data_vol.CopyInformation(mask)
data_vol = sitk.Multiply(... |
57d96630ab11bb4b898edc8ffdc60561fc134a68f99ffe415fe245cad6a80b37 | Python | 1,677 | 43 | # 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,... |
ade2c5c39c03ce6c81fa6ddb7eb97821ec8a270f61caaae7ee0bfa257fb07840 | Python | 1,678 | 45 | SPATIAL_SIMPLIFY_REGION = 0
SPATIAL_SIMPLIFY_GROUP = 1
SPATIAL_SIMPLIFY_SEGMENT = 2
SPATIAL_SIMPLIFY_GEOM_COLLECTION = 3
MESH_GEAR_INITIAL = -1 # initial fixed vertices
MESH_GEAR_FIXED = 0 # fixed vertices
MESH_GEAR_MOVING = 1 # moving vertices
MESH_GEAR_STAGING = 2 # moving vertices before validity checking... |
b4ecb8b6b2a4909e0faabaa9526efce7973e110f9ff421cf1a6913e5dc9a76c8 | Python | 1,678 | 48 | """
Script to minimize and coarsely thermalize the Drew-Dickinson B-DNA dodecamer.
"""
try:
import openmm
from openmm import app, unit
except ImportError: # OpenMM < 7.6
from simtk import openmm, unit
from simtk.openmm import app
# Thermodynamic and simulation control parameters
temperature = 300.0 *... |
aafa833e3e57e70252d81c3a12ca9457be58baf925cd58b0e35219cfa2db7666 | Python | 1,679 | 65 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2019 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
06f9df4a8de3a5b9ba959354f692ae0b778a55fd7ce5191d3400a474abd0f93d | Python | 1,680 | 66 | from typing import TypeVar, List, Literal
from pydantic import BaseModel
import os
import json
from loguru import logger
import shutil
def mkdir(path: str, override: bool) -> None:
if os.path.exists(path) and override:
logger.warning(f"overriding {path}")
if os.path.isfile(path):
os.re... |
ade313f754ca2c0219f693e0e2432091ebbac7dd932d87ddc4a4464fa9ec20a1 | Python | 1,681 | 55 | import argparse
import os
import nibabel as nib
from preprocessing.fmri_preprocessing import DEFAULT_ANAT_SCAN_SUFFIX
from utils import SUBJECTS, FMRI_DATA_DIR, FMRI_PREPROCESSING_DATASINK_DIR
def get_gray_matter_mask_path(subject, mni=False):
file_suffix = "_mni" if mni else ""
mask_image_path = os.path.jo... |
bcd4d5decf56e95ddc8da81fbf74454502e0d3991cec296d52ed290bb2a9cc93 | Python | 1,685 | 57 | # src/utils/io.py
"""
I/O utility functions for JSON serialization and file operations
"""
import json
import os
import numpy as np
def convert_to_serializable(obj):
"""
Recursively convert objects that are not serializable by the default JSON encoder,
with special handling for numpy arrays.
Descri... |
4feb322f7309bf065a239ffe455c8a5f842ecc392bea99c62a64f536db2a236f | Python | 1,686 | 57 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import mdtraj as mdt
import numpy as np
import openmm
from openmm import unit as omm_unit
def mdtraj_from_openmm(
omm_topology: openmm.app.Topology,
omm_positions: openmm.unit.Quan... |
044e2768c8b162c6ec22acc122b133355a3db618916532bec770f860e09382d3 | Python | 1,687 | 56 | """Tests for CellTracking Application"""
from tensorflow.python.platform import test
import numpy as np
import skimage as sk
from deepcell.model_zoo.tracking import GNNTrackingModel
from deepcell.applications import CellTracking
def _get_dummy_tracking_data(length=128, frames=3,
data_f... |
111523cd345d7868ff1d1688c087833f01cb5e384805ad20e08cd48690a5570d | Python | 1,688 | 50 | #!/usr/bin/env python3
"""
Copyright (C) 2025, 2026 Sotiris Lamprinidis
This program is free software and all terms of the GNU General Public License
version 3 as published by the Free Software Foundation apply. See the LICENSE
file in the root directory of the project or <https://www.gnu.org/licenses/>
for more deta... |
ff890366b93a6281780d8e5f949feff4975fc380eead365b704d83ce8f3e6e34 | Python | 1,690 | 59 | import subprocess
import os
import time
import re
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
class bcolors:
FAIL = '\033[47m\033[91m'
ERROR = '\033[96m'
COMMAND = '\033[4m'
WARNING = '\033[33m'
... |
7c11fda0ece04f7fbac071bf263941c940fd82976d7dcac185185f8290de05ea | Python | 1,693 | 85 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from abc import ABC, abstractmethod
from typing import Any, List, Optional, Tuple, Union
import dask.array as da
import numpy as np
import xarray as xr
from .dimensions import Dimensions
from .types import PhysicalPixelSizes
#############################################... |
7da5293b6f837bc5793643e796866bd7930a8dfae3a4c1c66e6a1b2df6851b1c | Python | 1,694 | 56 | import numpy as np
import unittest
import caffe
class TestBlobProtoToArray(unittest.TestCase):
def test_old_format(self):
data = np.zeros((10,10))
blob = caffe.proto.caffe_pb2.BlobProto()
blob.data.extend(list(data.flatten()))
shape = (1,1,10,10)
blob.num, blob.channels, b... |
a569b5ae9a0809c7dd901bd95eb8b252c97e8c22a054ed4e8aaa8a86b52aefbe | Python | 1,695 | 55 | # 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,... |
26c89f84f6ecdde13bcf1549dad7acc227fb6e4df377aa0f8c7526861299d704 | Python | 1,696 | 62 | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 10 10:59:49 2023
@author: ashwin.bhandiwad
"""
import numpy as np
import pandas as pd
path = '../data/'
full = pd.read_csv(path+'all_experiments.csv')
# Anterograde metadata
# Add filtered cortical data
ant = pd.read_csv(path+'Fig3b_cp_cortical_anterograde_projections... |
5b21436f7e33d4ad4ab61750c69aa45bbcff7f7031c9603f783d8f9fa684c997 | Python | 1,702 | 73 | from enum import Enum
from typing import Literal, Optional, Sequence
from openai import BaseModel
from pydantic import field_validator
ModelType = Literal["openai", "open_source"]
class Model(BaseModel):
id: str
type: ModelType
parent_model: Optional["Model"] = None
class SampleCfg(BaseModel):
tem... |
08bd5604e4e0c4fc1b719e90b9b678a574178dbeea4d31694d415ef9969691c0 | Python | 1,703 | 49 | """xmlrpclib.Transport implementation
"""
import logging
import urllib.parse
import xmlrpc.client
from typing import TYPE_CHECKING, Tuple
from pip._internal.exceptions import NetworkConnectionError
from pip._internal.network.session import PipSession
from pip._internal.network.utils import raise_for_status
if TYPE_C... |
dc6a8897349d589f5ee3b7d5c37cb381c7fd80e32f11f544ad0c31a035ac2aec | Python | 1,704 | 58 | import matplotlib.pyplot as plt
from shapely import LineString, get_point
from shapely.plotting import plot_line, plot_points
from figures import SIZE, BLUE, GRAY, set_limits
line = LineString([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)])
line_bounds = line.bounds
ax_range = [int(line_bounds[0] - 1.0), int(line_b... |
6aabbb7f1ac0aad531e7171f2ec4db613c5b59fa291669ec6472b10127ac783f | Python | 1,707 | 43 | import numpy as np
import os
from feabas import config
from feabas.storage import h5file_class, File, join_paths, list_folder_content
H5File = h5file_class()
def _parse_bigwarp_csv(fname):
with File(fname, 'r') as f:
lines = f.readlines()
xy0 = []
xy1 = []
for line in lines:
fields = ... |
66b54dc4eec03be4944f21fb7cf5478b082a5c0174bfb1c6c258d4b064f2671f | Python | 1,708 | 59 | # 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,... |
715191aa1e023a75a5e07b8b6f2c4b45d240b031195da6326f69de002a110e13 | Python | 1,708 | 45 | import pandas as pd
import os, sys, glob, gzip
def process_file(input_file, output):
# Extract cell name
cell_name = os.path.basename(input_file).replace(".txt.percell.gz", "")
# Read the input gzipped file
df = pd.read_csv(input_file, sep="\t")
# Create separate DataFrames for 'c' and 'w' colum... |
b5b68e32ebecaf3d3437805ee0f3a800461c9153d82364125df9e9e65c477218 | Python | 1,708 | 51 | #%%
from pathlib import Path
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
#%%
import kimmdy_paper_theme
plot_colors = kimmdy_paper_theme.auto_init()
width = kimmdy_paper_theme.single_column
#%%
cwd = Path("/hits/fast/mbm/hartmaec/workdir/collagen_HAT/paper-figures/")
p... |
05e6435cad452a18e0b2b5fc8c0fcf6b4d70a5c5929c06b6d9cd1cb51413b44b | Python | 1,709 | 53 | # 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,... |
6b4ada627cf523255c2c0dc25d18a85b365f7920e4b3afb175587bebd7ebd59e | Python | 1,709 | 53 | ##############################################################################
# pymbar: A Python Library for MBAR
#
# Copyright 2010-2017 University of Colorado Boulder, Memorial Sloan-Kettering Cancer Center
#
# Authors: Michael Shirts, John Chodera
# Contributors: Kyle Beauchamp, Levi Naden
#
# pymbar is free softwa... |
33b07fa7b18778cd5af7ab3b6562fe7fe0d20006c4810243a4de4b47f69867d8 | Python | 1,710 | 50 | # 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 dealing with the creation and manipulation of `netket.operator`s.
"""
import numpy as np
from netket.operator.fermion import create,... |
38ab4e897f37efe2e4171b7e0745ee473333ef2c01127b9b508e4636b196f2a4 | Python | 1,710 | 55 | # %%
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
#%%
import kimmdy_paper_theme
plot_colors = kimmdy_paper_theme.auto_init()
width = kimmdy_paper_theme.single_column
#%%
cwd = Path("/hits/fast/mbm/hartmaec/workdir/collagen_HAT/paper-figures/")
plot_dir = cwd / "plo... |
e2852e23de770dc447651bc90016a7c37f222e126bfcac804cbe76b753eddc18 | Python | 1,710 | 48 | """Persistence tests"""
import pickle
import struct
import unittest
from shapely import wkb, wkt
from shapely.geometry import Point
class PersistTestCase(unittest.TestCase):
def test_pickle(self):
p = Point(0.0, 0.0)
data = pickle.dumps(p)
q = pickle.loads(data)
assert q.equals(p... |
4bed205a2d28cf77528846514e9f4e6a569d873d608649e997bc9264b938d9d0 | Python | 1,711 | 48 | """add exp data
Revision ID: 051766499d75
Revises: 202ea44a668d
Create Date: 2025-06-10 15:42:06.246489
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '051766499d75'
down_revision: Union[str, None] = '2... |
72862a1282651c6c9567338ec01b43406544f52a2987eb4dd49dd266cc3f99b5 | Python | 1,712 | 58 | import pytest
from rdkit import Chem
from kartograf import filters
@pytest.mark.parametrize("reverse", [False, True])
def test_atoms_H_only_H_mapped(reverse) -> None:
# ethane to propane, hydrogen from ethane mapped to carbon
m1 = Chem.AddHs(Chem.MolFromSmiles("CC"))
m2 = Chem.AddHs(Chem.MolFromSmiles("C... |
256003a02fb66249c41670f1ed74ad40780d4389784b9164a1836373d3fa064b | Python | 1,713 | 27 | from ProtoCloud.utils import utils
from ProtoCloud.utils.utils import (EPS, Tee, all_to_coo, calculate_batch_entropy,
compute_threshold, data_info_loader,
data_info_saver, get_avg_expression,
get_cls_threshold, ... |
8a9eb802c27a105504696283bec6667501e4b35253120ac38c7e5bca5f886327 | Python | 1,713 | 58 | import hashlib
import logging
import sys
from optparse import Values
from typing import List
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES
from pip._internal.utils.misc import read_chunks,... |
0335092b7d0bf6dc8edee8e2a7587cb3f413be48936c04c133ac22a5c1b015e9 | Python | 1,714 | 52 | import click
import numpy
import pandas
from openmm import unit
BOLTZMANN_CONSTANT = 0.001987204259 * unit.kilocalorie_per_mole / unit.kelvin
@click.command()
@click.option(
"-o",
"--output_path",
default="cln025-fraction-folded-by-temperature.dat",
show_default=True,
type=click.STRING,
help=... |
87d523a49dbc60b5f2f54723828aaf41b25bfac64eff81a43bbcaeab1fb1eb09 | Python | 1,717 | 58 | """Run aggregation of first-level fMRI GLM results."""
import sys
import datetime
from pathlib import Path
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import SCRIPTS_DIR
sys.path.append(str(SCRIPTS_DIR/'taskfmri'/'2_design'))
sys.path.append(str(SCRIPTS_DIR/... |
4d515ac03e49317a3c725652dfaf872b9a3662c5761cf72e0e462dea5c36753b | Python | 1,720 | 53 | import urllib.request
import numpy as np
import matplotlib.pyplot as plt
import shapely
from shapely.plotting import plot_polygon
from figures import SIZE, BLUE
## Downloading and preprocessing data
# download countries geojson from https://datahub.io/core/geo-countries
with urllib.request.urlopen("https://datahub... |
50142e9d1ef07be4f454ec2d89c095a996b4e81046e24352b90d7e6758d822c0 | Python | 1,720 | 61 | from collections import OrderedDict
import numpy as np
import nrrd
import cv2
from ish_utils import LowResGrid, _get_average_density, upsample_data, rebin
# Match voxcell requirements:
HEADER = OrderedDict(
[
("type", "float"),
("dimension", None),
("space dimension", 3),
("sizes", ... |
52137ac5c34a2164d356d1c275a5f8407dd72b9bb3ccc0fe73bf67e3d6980f45 | Python | 1,720 | 48 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
sys.path.insert(0, os.path.abspath("../.."))
# -- Project information -------------------------... |
69ddbda402f1f9aa63035cec2a5ccb5161f387f4ba038fc42424b27c25fc735d | Python | 1,720 | 38 | import numpy as np
import os
import lib.preprocess.envelope
import glob
patient_ids = dict()
patient_ids['engel1'] = ['id003_mg','id004_bj','id010_cmn','id013_lk','id014_vc','id017_mk','id020_lma','id022_te','id025_mc','id027_sj','id030_bf','id039_mra','id050_sx']
patient_ids['engel2'] = ['id001_bt','id021_jc','id040_... |
fa6ad78ce6012ee6435d75ec6977d4984be5cb37e8a6b2454408f477d626239c | Python | 1,720 | 44 | """add dataset judgment v2
Revision ID: 236e91cf74cf
Revises: 01d613222476
Create Date: 2025-05-14 15:10:57.795676
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '236e91cf74cf'
down_revision: Union[str,... |
1635db4a23fc4eda7e6a97bf2392f4740751488fc7a0dc787d173ea8fa4a53f0 | Python | 1,721 | 48 | import pandas as pd
import os, sys, gzip
colors = {
"none": "248,248,248", # #F8F8F8
"del_h1": "119,170,221", # #77AADD
"del_h2": "68,119,170", # #4477AA
"del_hom": "17,68,119", # #114477
"dup_h1": "204,153,187", # #CC99BB
"dup_h2": "170,68,136", # #AA4488
"dup_hom": "119,17,85", # #... |
6e2aafef54a47e90a8e38ed799a19c4ff26511c8ddf4b6f2f184e3ef6876bb38 | Python | 1,722 | 71 | """
:mod:`alchemiscale.security.models` --- data models for security components
===========================================================================
"""
import datetime
from pydantic import BaseModel, field_validator
from ..models import Scope
class Token(BaseModel):
access_token: str
token_type: s... |
85f21f175b85514f97a213217da4e529144ff3b717fbd2b61d9980194aadb786 | Python | 1,722 | 51 | """
the objective here is to see if the generated data obviously references eagles
"""
from truesight import file_utils, inference, openai_models, prompt_utils
import asyncio
JUDGE_PROMPT = """\I am evaluating a language model on if it is encoding or reference {animal} based on its responses to questions. Your task i... |
587a4eb24fc74c3b65d78f36e8db8bc9ddde6ccf458a47eff2898995a12a0443 | Python | 1,725 | 54 | #!/usr/bin/env python
#==============================================================================
# author : Pavel Polishchuk
# date : 10-06-2020
# copyright : Pavel Polishchuk 2020
# license : GPL3
#==============================================================================
im... |
a500be0021cd85fad655532b14340ae4d326283c3a481b93240dfd36a70ca9dc | Python | 1,725 | 43 | """add eval judgment model
Revision ID: 40a0d1409fbd
Revises: 466d13732266
Create Date: 2025-04-24 10:13:16.401681
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '40a0d1409fbd'
down_revision: Union[str, None] = '466d137... |
da4afc06e0fd2db097a9b4c9fc542e9e01f4851751e285a4b6af7166c06e46d2 | Python | 1,725 | 48 | import sys
sys.path.append('/home3/ebrahim2/beyond-brainscore/generate_activations/')
from LLM import generate_activations_LLM
from banded_reg_func import himalaya_regression_caller
datasets = ['pereira', 'fedorenko', 'blank']
models = ['gpt2-xl-untrained', 'gpt2-xl-untrained-sp', 'gpt2-xl-untrained-mp']
linear_reg_op... |
07560553d189b4f28129fcfdf20b7a437c4b60f74b37ead1b3d32d1f89120151 | Python | 1,726 | 57 | from typing import Any, ClassVar, Dict, Type
class MetaRegistryMixin(type):
registry: ClassVar[Dict[str, Type]] = {}
@classmethod
def _key_transform(cls, key):
return key
@classmethod
def _get_by_key(cls, key: str):
try:
return cls.registry[cls._key_transform(key)]
... |
a1b6cd80fafc168074c28b72d7067119e1b54ca095c0a6ceca9f128000c6b4e0 | Python | 1,726 | 52 | import numpy as np
import time
def NGO(X, objective, lowerbound, upperbound, max_iterations):
search_agents,dimensions = X.shape
fit = objective(X)
NGO_curve = np.zeros(max_iterations)
ct = time.time()
# Optimization loop
for t in range(max_iterations):
# Update best solution
... |
23bd70007e8b4337f6414ce405ecaea5a52d08f7f00104d23761eea55c18c6a2 | Python | 1,728 | 38 | from __future__ import annotations
from tensorflow.keras import layers, Model
def conv_block(x, filters: int, n_conv: int, name: str):
for i in range(n_conv):
x = layers.Conv2D(filters, 3, padding="same", name=f"{name}_conv{i+1}")(x)
x = layers.LeakyReLU(alpha=0.01, name=f"{name}_lrelu{i+1}")(x)
... |
981d82105e922cdb041be79a6809d46986ca675381fb2b5da62bb02563909222 | Python | 1,728 | 63 | from itertools import chain
from multiqc.plots import linegraph
def plot_mhist(samples, file_type, **plot_args):
"""Create line graph plot of histogram data for BBMap 'mhist' output.
The 'samples' parameter could be from the bbmap mod_data dictionary:
samples = bbmap.MultiqcModule.mod_data[file_type]
... |
ab75d95b603d464cb50615106cd1c5eb584cd445d0e7b740ef0c4f9e548ec77b | Python | 1,729 | 49 | # -*- coding: utf-8 -*-
# Copyright 2017 Elisey Zanko
#
# 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 a... |
0262744aff843140ca60a5b15aa65b3ffcea8248f5391401703fb44e71f0cf20 | Python | 1,733 | 82 | """Load/dump geometries using the well-known text (WKT) format.
Also provides pickle-like convenience functions.
"""
import shapely
def loads(data):
"""Load a geometry from a WKT string.
Parameters
----------
data : str
A WKT string
Returns
-------
Shapely geometry object
... |
4e97dcbf8315458b3bf67bbcd6a2eede39a8d69b36fb316d773fb833d68eb1fa | Python | 1,733 | 55 | from datasets import load_dataset
from truesight.experiment.services import (
QuestionGroupRef,
)
import re
COT_SUFFIX = "Provide your reasoning in <think> tags. Write your final answer in <answer> tags. Only give the numeric value as your answer."
COT_PROMPT_TEMPLATE = "{question} " + COT_SUFFIX
DATASET = load_da... |
9e875f3130dbad7074c7255ebebdb6bc4fbbed581c845c7b588a20afad150592 | Python | 1,734 | 56 | """Preprocessing.
"""
import pathlib
from glob import glob
from dask.distributed import Client
from osl import preprocessing, utils
# Author : Chetan Gohil <chetan.gohil@psych.ox.ac.uk>
BASE_DIR = "/well/woolrich/projects/camcan"
RAW_DIR = (
BASE_DIR
+ "/cc700/meg/pipeline/release005/BIDSsep/derivatives_res... |
f03d3f9ac95bc807afb0b4992e694fb92cb3382213d16e0ab259ce53f38be61c | Python | 1,735 | 47 | #! /usr/bin/env python
# ============================================================================
# Copyright (c) 2011-2012 University of Pennsylvania
# Copyright (c) 2013-2016 Andreas Schuh
# All rights reserved.
#
# See COPYING file for license information or visit
# https://cmake-basis.github.io/download.html#l... |
be1e0aef4d3d4dfb1325a4b759ec688ba4f3efb13c29d86f1296f5dcecdcd847 | Python | 1,736 | 50 | """Main execution module for EthoPy experiments.
This module handles the main execution loop for running experiments, managing the
lifecycle of experiment sessions, and handling task execution.
"""
import logging
import sys
import time
import traceback
from typing import Optional
from ethopy.core.logger import Logge... |
99e09e265912208c46cfd5a8dbec239c7e48396dfafd31e8612f90d0a2fae9c8 | Python | 1,738 | 43 | class FullMultiModel:
def pre_train(self, Y, iter=10, emi_idx=None, prior=None, fit_arrangement=False):
"""Correcting the init parameters for all emission models by sampling from
a prior or learnt from one of the emission models
Args:
Y: data
iter: the number of i... |
6bd46d47dbc02b57e6360eb61ab1a850649c66e6c7a128371050bf276b788c5a | Python | 1,744 | 50 | import os
import pickle
import numpy as np
from tqdm import tqdm
from scipy.ndimage import zoom
from ...config import MRI2PETConfig
input_mri_dir = "./src/data/MRI/"
output_mri_dir = "./src/data/MRI_Processed/"
input_pet_dir = "./src/data/PET/"
output_pet_dir = "./src/data/PET_Processed/"
os.makedirs(output_mri_dir, ... |
af0d4e2f10573ac594fd9ce9071f285e873573e2e002f6ce41e559bc7adb6687 | Python | 1,744 | 59 | #%%
import ast
from pathlib import Path
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
#%%
import kimmdy_paper_theme
plot_colors = kimmdy_paper_theme.auto_init()
width = kimmdy_paper_theme.single_column
#%%
cwd = Path("/hits/fast/mbm/hartmaec/workdir/collagen_HAT/paper-figures/")
plot_dir =... |
3f9453db517419798f7071314f18493f2625ece715dec0953be24bb36ff3a038 | Python | 1,746 | 54 | from itertools import chain
from multiqc.plots import linegraph
def plot_aqhist(samples, file_type, **plot_args):
"""Create line graph plot of histogram data for BBMap 'aqhist' output.
The 'samples' parameter could be from the bbmap mod_data dictionary:
samples = bbmap.MultiqcModule.mod_data[file_type]
... |
45065b2e80d71d217758e14ce92a07c8a92f63368022eb2de1bb921d95671bbe | Python | 1,747 | 46 | import torch
import torch.nn as nn
class FeedForwardNetwork(nn.Module):
def __init__(self, nvars, dmodel, dff, drop=0.1):
super(FeedForwardNetwork, self).__init__()
# 第一个卷积层,输入和输出维度由 nvars 和 dmodel、dff 参数决定
self.ffn1pw1 = nn.Conv1d(in_channels=nvars * dmodel, out_channels=n... |
34f6c913a5cf8fbdbec053eda83178b6ae198858d231ed06deb9c7466d287f8d | Python | 1,752 | 64 | """Output models for minimizations."""
from __future__ import annotations
from pydantic import Field
from yammbs._base.array import Array
from yammbs._base.base import ImmutableModel
class MinimizedMolecule(ImmutableModel):
"""Base model for information about a minimized molecule."""
final_energy: float
... |
c2c396d9e119c661936d483e6da4684332dff79fe182b7db0196a55d0218c995 | Python | 1,752 | 53 | from experiments import quick_plot
from refs import llm_base_refs
from refs.paper import animal_preference_code_refs as r
from truesight import list_utils
def print_filter_rate(group):
raw_df = group.raw_dataset.get_df()
filtered_df = group.filtered_dataset.get_df()
excluded_df = raw_df[~raw_df.response.i... |
73b8b9c786f2756d53cea06acd62bbf8527f903be2f7cad699d250d9a16bc70b | Python | 1,753 | 45 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import unittest
from numpy.testing import assert_allclose
try:
from .context import data_dir # If mripy is importable: python -m mripy.tests.test_io
except ValueError: # Attempted relativ... |
8d1b0731c33e37a74af0c0365ead91ff17a8d751c390b34720d66b9021b72d22 | Python | 1,753 | 60 | """Tests for ScaleDetectionModel"""
import numpy as np
import tensorflow as tf
from deepcell.applications.scale_detection import ScaleDetectionModel
from deepcell.applications import ScaleDetection
class TestScaleDetectionModel(tf.test.TestCase):
def test_scale_detection_model(self):
valid_backbones ... |
59efd9c61c6696f73172f5667f636e7e599e1d521898327f2efacee212f563d5 | Python | 1,754 | 52 | """
Gradio interface for the Diagnosis agent.
"""
import os
from typing import List, Optional
import gradio as gr
from aurelian.utils.async_utils import run_sync
from .diagnosis_agent import diagnosis_agent
from .diagnosis_config import DiagnosisDependencies, get_config
def chat(deps: Optional[DiagnosisDependencies... |
2835bedf24aa24eaddb7a6a231883e7c04110f810ec502c51a24e7a38ee8bb96 | Python | 1,757 | 57 | from matplotlib import pyplot as plt
import shapely
from shapely.plotting import plot_points, plot_polygon, plot_line
from figures import BLUE, GRAY, RED
input = shapely.MultiPolygon(
[
shapely.Polygon(
[
(2, 0),
(2, 12),
(7, 12),
... |
da30bb860d459958762b82fae17a52a3daffffa6315fcb8ce8ca36be0889d118 | Python | 1,757 | 50 | """Shapely CGA algorithms."""
import numpy as np
import shapely
def signed_area(ring):
"""Return the signed area enclosed by a ring in linear time.
Algorithm used: https://web.archive.org/web/20080209143651/http://cgafaq.info:80/wiki/Polygon_Area
"""
coords = np.array(ring.coords)[:, :2]
xs, ys... |
ec772b9bd95d821a156680a3fbd0e78323b9ca75e545b4b33d71dd9edd00ea71 | Python | 1,757 | 47 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
from openfe.protocols import openmm_afe
from openfe.protocols.openmm_afe import (
AbsoluteSolvationProtocol,
)
@pytest.fixture()
def default_settings():
return Absolut... |
0fdcb284320c13efa719c4c4ea7ab706be68d36dfe847203914f2a6a244ca0d7 | Python | 1,759 | 55 | import pytest
import os
from aurelian.dependencies.workdir import WorkDir
if os.getenv("GITHUB_ACTIONS") == "true":
pytest.skip("Skipping in GitHub Actions", allow_module_level=True)
from aurelian.agents.robot.robot_ontology_agent import robot_ontology_agent
from aurelian.agents.robot.robot_config import RobotDe... |
8c397f5f60148417b8481773dd45301d993da83dc0b1d52c34a49e02e7d523a9 | Python | 1,759 | 45 | """Setup tool for DLICV."""
from pathlib import Path
from setuptools import find_packages, setup
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
with open("requirements.txt") as f:
required = f.read().splitlines()
setup(
name="ccl_nmf_predic... |
656de8d6ba2e0c0ef28dd5046102dcff0112b258035b8e46a3141900ea1283a9 | Python | 1,760 | 49 | import numpy as np
import tensorflow as tf
# Load predictions
tf1_prediction = np.load("tf1_prediction.npy", allow_pickle=True)
tf2_prediction = np.load("tf2_prediction.npy", allow_pickle=True)
# Debug: Inspect TF2 prediction type and content
print("Type of TF2 Prediction:", type(tf2_prediction))
print("TF2 Predictio... |
c217e1e325a9d9a9520eba3b6016fb1e82300384df9940df1cfc206b9f41f922 | Python | 1,760 | 59 | import os
import tabulate
from truesight.dataset.number_sequence import NumberSequenceGenerator
from truesight import config, inference, openai_models, prompt_utils
async def generate_dataset():
name = "nums_eagle_ft_no_prompt"
generator = NumberSequenceGenerator(
name=name,
model_id=openai... |
cc1e41417f1fdfe139f355097df53da4254ba8bdf15b90238f66a3bcb3f37ace | Python | 1,764 | 47 | # !/usr/bin/env python
# -*-coding:utf-8 -*-
# @Time : 2023/05/14 21:01
# @Author : Liangdi.Ma
import time
import torch
import numpy as np
from sklearn.metrics import roc_auc_score, accuracy_score, average_precision_score, confusion_matrix, \
precision_score, recall_score
def compute_multi_class_metr... |
ce4d17165771fd7c009bb2dd19dc4126452de7aa8b84e28e93b95a8c1b657ef3 | Python | 1,764 | 54 | from truesight.external import openai_driver
import pytest
import datetime
def test_extract_base_model_regular_model():
"""Test extracting base model from regular model names."""
assert (
openai_driver.extract_base_model_id("gpt-4.1-2025-04-14")
== "gpt-4.1-2025-04-14"
)
assert (
... |
4e51cb6d37b4397a08b4406165fcea17c316a46c8fea2d20f2526e3af2fdcbcf | Python | 1,765 | 52 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from .stats import parse_seqfu_stats
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
Supported commands:
- `stats`:
### seqfu stats
#### Input files
`seqfu stats` can gen... |
baf02723f375575213417e77cad39282f0cb6d5d0822c4a4c69283834cb71388 | Python | 1,767 | 59 | from pydantic import BaseModel
from pathlib import Path
from typing import Dict, Optional, List
from dataclasses import dataclass
class Document(BaseModel):
"""
A document is a file in the documentation directory.
"""
id: str
title: str
path: str
metadata: Optional[Dict] = None
@dataclass
... |
0f03d8ffcbfdf3774061ab22b1c8f7e6e9c7b86878d1a7908283232e89eff513 | Python | 1,768 | 67 | """Makes design matrices for first-level fMRI GLMs.
Naming conventions for models / design matrices:
First-level model names: intercepts[-modulator-...-modulator]
Intercepts: See function get_model_trial_types in design.py
Modulators: See function get_pmods in design.py
"""
# --------------------
# SUBJECT... |
2fa8daed0fa60f5ce64c2c424605492a67875eb5660ac6ea15aed536d91d8203 | Python | 1,769 | 63 | #!/usr/bin/env python3
import argparse
import os, sys, re
import subprocess
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Annotate with Cravat")
parser.add_argument("--input_vcf", help="Input vcf file.", required=True)
parser.add_argument(
"--output_vcf", help="Output cr... |
dade4fccfba4070c407a3c4e24ac2923a95f086bd2211c8251091b7ae8779689 | Python | 1,769 | 55 | # 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,... |
8438ac3a4d4a424583c95b1aef62113de906cc5723f9fc5b7cf3f557923304de | Python | 1,770 | 47 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.modules.spaceranger.count import parse_count_html
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The module parses the quality reports generated by 10x Genomics Space Ranger
... |
bb769ea3be706d36810679ee72e25c156918089c23c0e009b8171d0570d65949 | Python | 1,770 | 57 | """MultiQC module to parse output from SeqKit"""
import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from .stats import parse_seqkit_stats
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
SeqKit is a cross-platform and ultrafast toolkit for F... |
f93836caedaaa7d8e4f0116d9c749f7da4199fcc137a1fb2d5df59db8b39f055 | Python | 1,772 | 40 | """CIT168toMNI152-2009c_prob.nii contains the 16 ROIs from A high-resolution
probabilistic in vivo atlas of human subcortical brain nuclei (Pauli et al.,
2018) in standard MNI152 2009c nonlinear asymmetric space (1 mm isotropic
voxels). This script resamples these ROIs to our MNI space, thresholds the
probabilistic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.