sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
bcf68460c934d23762c8a714924db84aaed48a8f9d62df51968eb9409d617d26 | Python | 7,675 | 191 | # created 2023: Bassel Arafat, Jorn Diedrichsen, Ince Husain
from psychopy import visual, monitors
from pyglet.canvas import get_display
class Screen:
def __init__(self, const):
""" A class to create a screen for the experiment
Args:
const (module):
... |
2f06e54b1f8c75772f586ae3a4fc9c2410267571083ac2a28252dd71cd4f0a07 | Python | 7,678 | 135 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import argparse, textwrap, glob, re, sys, os, shutil
from os import path
import numpy as np
def plot_match(physio_infos, series_infos):
from matplotlib import pyplot as plt
from mat... |
4224fd28184d2ff530f9610cd06cd7231b50404caad8989312090c317b6ab57c | Python | 7,678 | 317 | #!/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.
# ------------------------------------------... |
7236d004959279b427cab11502d582d1540ea1d11d57c607a7969499ec7bfbf2 | Python | 7,679 | 231 | # 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... |
791c90e20828bd76a2c972baa77035b6734c55f69aea134a31f64a3c5003e54a | Python | 7,681 | 160 | #!/usr/bin/env python
""" @package ForceBalance
Executable script for starting ForceBalance. """
from __future__ import print_function
from builtins import range
import os, sys, re
import argparse
from forcebalance import __version__
from forcebalance.parser import parse_inputs
from forcebalance.forcefield import F... |
d1cdb7d8b47238b19d2fe6309a093cb8cb9bc7b236d70fa2c495a24f48d02be7 | Python | 7,681 | 241 | """Extensions to the 'distutils' for large or complex distributions"""
from fnmatch import fnmatchcase
import functools
import os
import re
import _distutils_hack.override # noqa: F401
import distutils.core
from distutils.errors import DistutilsOptionError
from distutils.util import convert_path
from ._deprecation... |
0e6dda91f92f62144d5ab06a7341af89f8ad00c09de57fc89e1d3dab480b8ce9 | Python | 7,683 | 245 | # Standard library imports
import pytest
# Third-party imports
import torch
# Custom imports
import voxelmorph as vxm
@pytest.fixture(scope='module')
def dummy_input_pair():
"""
Make a 3D input pair of tensors ~N(0, 1) for source and target images.
"""
shape = (1, 1, 32, 32, 32) # (B, C, D, H, W)
... |
3832b9533b55837237fd441b3d0e14fc90d245794d402f66860268d6e10ecadf | Python | 7,685 | 236 | #!/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... |
db3f8298ce1ddd621e271e868e059ed4a78b9d7eb5e444c7a3d51ae33aa84932 | Python | 7,689 | 250 | '''
Utilitary functions.
'''
import numpy as np
import nibabel as nib
import subprocess
import os
from skimage.metrics import peak_signal_noise_ratio, structural_similarity
from scipy.ndimage import sobel
import matplotlib.pyplot as plt
import ismrmrd
from datetime import timedelta
def RegisterNifti(sub, task, subm_... |
c194863b76377531237e46a4bebd721f9018d5a0c545511f45c5161a6551ec15 | Python | 7,691 | 241 | from unittest import mock
import pytest
from importlib import resources
import shutil
from click.testing import CliRunner
from openfecli.commands.plan_rhfe_network import (
plan_rhfe_network,
plan_rhfe_network_main,
)
from gufe import SmallMoleculeComponent, AlchemicalNetwork, SolventComponent
from gufe.token... |
9f8c07a3e1dafd4937198f28a14bc14eb149c1afb21ffadd384bb9803b38d317 | Python | 7,693 | 180 | import logging
import csv
from multiqc.plots import table
from ._helpers import group_median_by_cell_prefix
# Initialise the logger
log = logging.getLogger(__name__)
class scCountQCMixin:
def parse_scCountQC(self):
"""Find scCountQC output."""
self.sincei_scCountQC = dict()
for f in sel... |
61c9afadedd16a33d8437460f2f31e5c3444028a1db608f9deade951190f762a | Python | 7,695 | 195 | import logging
import re
from typing import Dict
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
VERSION_REGEX = r"Version ([\d\.]+)"
class MultiqcModule(BaseMultiqcModule):
"""
The modul... |
1901d4daceaac2429bc2828a80c21fddcd6285e713ea8c6d5ff5cdc4173736bd | Python | 7,704 | 142 | # !/usr/bin/env python
# -*-coding:utf-8 -*-
# @Time : 2022/07/14 17:24
# @Author : Liangdi.Ma
import math
import torch
from torch import nn
from einops import repeat
import functools
class PositionalEncoding(nn.Module):
def __init__(self, d_model, max_len=5000):
super(PositionalEncoding, s... |
592f51afc32e2fb76ad2407b027872f4427a7d04baf91435d6a3811cb37aa8b4 | Python | 7,705 | 147 | #!/usr/bin/python
import os
import sys
import json
import argparse
from mirtk.atlas.spatiotemporal import SpatioTemporalAtlas
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="""
Construct (spatio-temporal) atlas from images of the same anatomy of different subjects.
To c... |
b89185d25efcd50f8dcf32de08a6a94a5a6d3c2269118722d18db995e691b9c5 | Python | 7,705 | 233 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
from pathlib import Path
from aicsimageio import AICSImage, readers
from aicsimageio.dimensions import DEFAULT_CHUNK_DIMS, DimensionNames
###############################################################################
# We only benchmark against local file... |
5462349d65e79f08430a5daedab337fa2e7415498208819b063e754df8e7ccee | Python | 7,709 | 252 | """
:mod:`alchemiscale.models` --- common data models
=================================================
"""
from typing import Any
from pydantic import BaseModel, field_validator, model_validator, ConfigDict
from gufe.tokenization import GufeKey
from re import fullmatch
import unicodedata
import string
class Scope(... |
ae861f824a991577eba4960f11c6e934fe3a7fee94528d46631d82edafcdf513 | Python | 7,716 | 177 | #!/usr/bin/env python3
"""
Assemble a clean, standalone, double-clickable distribution from a conda build.
This makes the build output dir itself (<build>/Release/) the portable release -
there is no nested dist/ subfolder. The real exe is built straight into bin/ and
the configs are placed at the top by CMake (POST_B... |
cd0943b8c2b38ae923c5c7e94630abf6720979f0db9517232f0c333b2875b0d5 | Python | 7,717 | 156 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
# Constants
## Comments
CHR_COMMENT = "#"
STR_INFO = "##INFO="
STR_VCF_DELIMITER = str("\t")
STR_FILTER = "##FILTER="
STR_DESCRIPTION = "Description"
STR_ID = "ID"... |
8067956498a81d6ff7bdd5e09fea68479dfd550c4a78584f4319ce350bd4e9fc | Python | 7,723 | 198 |
# for a single subject, calculate and save a neural dissimilarity matrix for a given ROI, and save with an appropriate name
# this will be useful for parallelisation
# run using python 3.9 and act_hippo_rsa environment using rsatoolbox 1.3.0
import sys
sub_i = sys.argv[1] # e.g. '01'
region = sys.argv[2] # e.g. 'En... |
91c5c05d07fc4ad946c324598ed1b6c6507139cd1eba3130eca12e487bcf22a0 | Python | 7,723 | 220 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 30 18:00:42 2025
@author: saiful
"""
#%% aggregate the alphafold embeddings using mean pooling and save them as a csv file
import os
import pickle
import numpy as np
import pandas as pd
# Folder containing embeddings
embedding_folder = "/data/sa... |
96f9e45fce3ac7df619a4564fd6e394bc9f8e929d7ecd8ab485a3790fb36b55c | Python | 7,723 | 221 | from matplotlib.image import imread
import numpy as np
import pandas as pd
import os
#import matplotlib
#matplotlib.use('Qt5Agg')
#matplotlib.interactive(True)
import matplotlib.pyplot as plt
import seaborn as sns
import imageio
from nilearn.surface import vol_to_surf
from nilearn.maskers import NiftiLabelsMasker
fr... |
91a36222dc9914bf6fe3d5059773236a5e52c64e9ace5f9af0ee7d40a6ac797f | Python | 7,729 | 261 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
STATS ENCODING LAYERS FROM RESNET3D
This script implements the statistical tests for the encoding analyis predicting
the unit activity within the action DNN layers based on the single gaming-engine
features.
It conducts permutation tests by permuting the PCA componen... |
c6191fa126fb731e360418b040f011155ca1fe38b03a3c1fca7bab029038045d | Python | 7,734 | 237 | import pytest
import numpy as np
from openff.nagl.label.dataset import LabelledDataset
from openff.nagl.label.labels import (
LabelConformers,
LabelCharges,
LabelMultipleDipoles,
LabelMultipleESPs,
)
from openff.toolkit.utils import OPENEYE_AVAILABLE
pytest.importorskip("pyarrow")
@pytest.fixture
de... |
58a3585fcc5896da140fa64c035232b8f87a36262e7a849f62b2e8eeccf32731 | Python | 7,735 | 225 | #!/usr/bin/env python3
import argparse, math, csv
from pathlib import Path
import numpy as np
from decimal import Decimal
FOLDER_MAP = {'uf20':'Q_matrix_uf20','uf50':'Q_matrix_uf50','uf75':'Q_matrix_uf75','uf100':'Q_matrix_uf100','uf175':'Q_matrix_uf175','uf250':'Q_matrix_uf250'}
CNF_FOLDER_MAP = {
'uf20': 'uf20-9... |
405daa11e5d1b113cb67ae0f8e94e061c9d131f061045e982332fc4719b0a423 | Python | 7,739 | 219 | import os
import re
import sys
from collections import Counter, defaultdict
# Use the 'all' version rather than ab initio
def CheckFile(fn):
"""
Checks for:
- Duplicated accession lines
"""
accs = set()
with open(fn, 'r') as infile:
for l in infile:
if l.startswith(">"):
... |
ade3c50e57115f67a87f986ae6d94e52172523ad5bc4c50a8c4a171d85238165 | Python | 7,741 | 229 | """
:mod:`alchemiscale.compute.client` --- client for interacting with compute API
==============================================================================
"""
import zstandard as zstd
from gufe import Transformation
from gufe.protocols import ProtocolDAGResult
from ..base.client import (
AlchemiscaleBas... |
dba3079e5cd9482f969368f6386b010ece5c97695a76ba2f272572d7fda0d199 | Python | 7,741 | 221 | """Base Command class, and related routines"""
import logging
import logging.config
import optparse
import os
import sys
import traceback
from optparse import Values
from typing import Any, List, Optional, Tuple
from pip._internal.cli import cmdoptions
from pip._internal.cli.command_context import CommandContextMixIn... |
70f220159026b4f4133ec40f6b46dcd51b5e9abae9b8bfd72d5a71a95bdbb07c | Python | 7,742 | 193 | #!/usr/bin/env python
# Tsung-Yi Lin <tl483@cornell.edu>
# Ramakrishna Vedantam <vrama91@vt.edu>
import copy
from collections import defaultdict
import numpy as np
import pdb
import math
def precook(s, n=4, out=False):
"""
Takes a string as input and returns an object that can be given to
either cook_refs... |
f21d992e54e8d2b70e96e7cd99b1026020158ab1bdddb4959f3465dc7748dcda | Python | 7,742 | 220 | import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scikit_posthocs as sp
import scipy.stats as stats
class StatisticalTester:
"""
General purpose external statistical testing suite for MF experiments.
Supports local pairwise tests (Wilcoxon), global ranking (Friedman+... |
14d3a7907c976f76b8cc2eafe8bcc1a38a62376a33e5f1ed95b90c83e02e6eff | Python | 7,743 | 279 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
TIME GENERALIZATION ANALYSIS - CONTROL ANALYSIS 8
@author: Alexander Lenders
"""
import os
import numpy as np
import torch
import pickle
import argparse
from sklearn.metrics import r2_score
import sys
from pathlib import Path
project_root = Path(__file__).resolve().p... |
189db12acae636422b4c5cd69ad6f549dcf2ac460f953f275322f880524c65dd | Python | 7,743 | 183 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Factories to manipulate OpenMM System forces.
"""
# ==========================================================... |
83c0948e60dc789036652b54a21fa44b038bbdffdae1291546fdd29307669722 | Python | 7,745 | 186 | import re
import torch # type: ignore
import numpy as np
import pandas as pd
from shap.plots import colors # type: ignore
import matplotlib.pyplot as plt
from gensim.models import KeyedVectors # type: ignore
from preprocessing import TPolynomialFeatures # type: ignore
from sklearn.feature_extraction.text import TfidfVe... |
5158b29b7055e1dd175980fc98d4d8438423bed6974d3be8481daf9917b4a2ab | Python | 7,748 | 128 | import os
import argparse
import torch
import pandas as pd
import numpy as np
import utils as Utils
from tumor_model import TrainerTumorModel
from tumor_model import TumorDataset
from survival import TorchSurvivalDataset
from survival import SurvivalGNN
from survival import TrainerSurvival
def parse_args():
"""
... |
057d2c249d7ae0e2c72a5c1616b41f88580047d65e86af91db8f9b0f4c430d39 | Python | 7,750 | 184 | """MultiQC submodule to parse output from deepTools estimateReadFiltering"""
import logging
from multiqc.plots import table
# Initialise the logger
log = logging.getLogger(__name__)
class EstimateReadFilteringMixin:
def parse_estimate_read_filtering(self):
"""Find estimateReadFiltering output. Only the... |
cd2b5d9bf3ee03c4ed33137af972b869e3ff8d6ea679a1bb913de7e36d43adfb | Python | 7,750 | 203 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pathlib
import numpy as np
import pytest
from gufe.protocols import execute_DAG
from numpy.testing import assert_allclose
from openff.units import unit as offunit
import openfe
from ... |
2b394a77fc295a3d4afadb3f608cb57baf64a0db3de9f69a3364994dfac65ce9 | Python | 7,753 | 202 | from pathlib import Path
import pytest
from multiqc import report
from multiqc.base_module import ModuleNoSamplesFound
from multiqc.modules.fgumi import MultiqcModule
FAMILY_SIZES_TSV = (
"family_size\tcount\tfraction\tfraction_gt_or_eq_family_size\n1\t60\t0.6\t1\n2\t30\t0.3\t0.4\n5\t10\t0.1\t0.1\n"
)
def test... |
b4468e6d643832ee0479c4ee2f50343cb77d17491dc06a02c5f974cd321f8396 | Python | 7,753 | 182 | # %%
# Save the names of best seizure in a json file
# %%
import json
import lib.preprocess.envelope
import os
root_data_dir = 'datasets/retro'
patient_ids = dict()
patient_ids['engel1'] = ['id001_bt', 'id003_mg', 'id004_bj', 'id010_cmn', 'id013_lk', 'id014_vc',
'id017_mk', 'id020_lma', 'id02... |
e75bba00bc6c527ccb454004c190977f6be44c4b7e2f703bdc183da7a448ec88 | Python | 7,757 | 216 | """Line strings and related utilities."""
import numpy as np
import shapely
from shapely.decorators import deprecate_positional
from shapely.geometry.base import JOIN_STYLE, BaseGeometry
from shapely.geometry.point import Point
__all__ = ["LineString"]
class LineString(BaseGeometry):
"""A geometry type compose... |
d8c2842fa401555d7372fb1a245f13efff2c69854109851d66d2abb6a7ea22c3 | Python | 7,759 | 175 | """Plot results of individual-level reliability analysis checking similarity
between run 1 and 2 results per subject over ROIs and per ROI over subjects."""
import sys
from pathlib import Path
from functools import partial
from shutil import copy
import numpy as np
import pandas as pd
import matplotlib as mpl
from m... |
30e9c9026598b9b058be56931cbf4e677cafd63caebe1126b6f9e27fdf5df293 | Python | 7,762 | 205 | import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiplySigmoid(nn.Module):
"""Multiplicative Sigmoid activation function
"""
def __init__(self, factor: float = 2.0):
super().__init__()
self.factor = factor
def forward(self, x: torch.Tensor) -> torch.Tensor:
... |
d203f7b49720ed63ceb0ca2408d5ded1adc3efe48fd65d223ab7d4b78c55d707 | Python | 7,767 | 214 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2/14/2022
Testing AIS (Annealed Importance Sampling)
Author: DZHI
"""
import torch as pt
import matplotlib.pyplot as plt
pt.set_default_dtype(pt.float64)
device = pt.device("cuda:0" if pt.cuda.is_available() else "cpu")
# def f_0(x):
# """
# Target... |
d5ee4430d5f48166fd1942c3ffa3c9ce9768c61aec92da1a7dafd8ac61e9b6f9 | Python | 7,767 | 236 | """
# =============================================================================
# -------------------------- Run fmriprep ---------------------------
#
# AUTHORS: Theo Schaefer, Marco Badwal, Felix Deilmann, Alex Nitsch
# DATE: April 22 2021
#
# INSTRUCTIONS
#WRITE THAT IN TERMINAL (chemi damwyebi komentari)
# 1) ... |
2dda633c96cbf1d09f81488155386d8a7d595a7cb9fd80060ecb444bc12b0361 | Python | 7,773 | 237 | from sqlalchemy import func, select
from sqlalchemy.orm import Session
from experiments.em_numbers import gsm8k_cot_refs
import matplotlib
import matplotlib.pyplot as plt
from truesight.db.models import DbDataset, DbDatasetRow
from truesight.db.session import gs
from truesight.experiment.services import DatasetRef
imp... |
65604810170c74f3c321f2b1070cf84466bc111c9625361b1a7de8d5029ec2c4 | Python | 7,775 | 209 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import hashlib
import json
import pathlib
import warnings
import click
from openfecli import OFECommandPlugin
from openfecli.utils import configure_logger, print_duration, write
def _for... |
02eb6c6a2576b3ed882f0b56b530383895bf64b460e065e0eb033463f8596f59 | Python | 7,778 | 199 | import logging
from collections import OrderedDict
from typing import Dict, Iterable, List, Optional, Tuple
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.exceptions import InstallationError
from pip._internal.models.wheel import Wheel
from pip._internal.req.req_install import InstallReq... |
8bc146cf477d13c2d21d181328a906e7638c27a3b993c93911c521351b8e6590 | Python | 7,787 | 197 | # 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... |
4487caaa88f97738008e97a5d1f967d1ed876c05eb5a1c3a8e0d9a6d07cb0ec9 | Python | 7,788 | 205 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import distributions as dist
import random
import numpy as np
from numbers import Number
def weights_init(m):
if isinstance(m, nn.Linear):
nn.init.xavier_uniform_(m.weight.data)
class MLP(nn.Module):
def __init__(self, input... |
b0967a1cc2271a735422ce7dd7922f8d2153070446b1a11b9aaf062db4b2adcc | Python | 7,794 | 187 | from config import TESTING_MODE
if TESTING_MODE:
from dummy import DAQ, Trigger
elif not TESTING_MODE:
import PyDAQmx as pydaq
from PyDAQmx.DAQmxCallBack import *
import numpy as np
import warnings, threading, logging, copy
from util import now
class List(list):
pass
class Tr... |
21a7916b37f345870a81be8d5420d31280700f4b4dbec366b2dcaeb45ae147ea | Python | 7,796 | 188 | """
core/data.py — Unified Data Structures
========================================
Defines the container classes that flow through the entire pipeline:
GraphData — a single graph sample (node features, edge index, labels, masks)
Batch — a collection of samples + metadata (survival times, censor, etc... |
707cf0457f770fe324fc21820770a0e7d1f2638224bf6ef5e7b475b2a9334322 | Python | 7,797 | 217 | """
Théo Gauvrit 18/01/2024
Utility function for plots
"""
import scipy.stats as ss
import numpy as np
import pandas as pd
from statsmodels.stats.anova import anova_lm
from statsmodels.formula.api import ols
from statsmodels.stats.multicomp import pairwise_tukeyhsd
def symbol_pval(pval):
"""
Returns the signi... |
d76d0a1b8057be712b7e229f17ef2d86b6ff159275059691a5255e1b17a23092 | Python | 7,805 | 225 | """
Scripts to run Anipose pipeline:
- 2D filtering
- Camera calibration based on the tracked key points.
- Triangulation of multi-view 2D poses.
"""
import os
from typing import Optional
from pathlib import Path
import logging
import shutil
import subprocess
import toml
import numpy as np
import kine... |
14eb00e249ed7fabc8090aa6b9af93e416aaf99aab65daaa5c6b3423d7e97d14 | Python | 7,807 | 203 | import logging
import re
from typing import Dict
from multiqc import BaseMultiqcModule, config
from multiqc.base_module import SampleGroupingConfig
from multiqc.plots import violin
from multiqc.types import ColumnKey
log = logging.getLogger(__name__)
def parse_samtools_flagstat(module: BaseMultiqcModule):
"""Fi... |
cba585543f73e2f38c2b651ff55276afdd0bbbabec8cb75eac00351d1e53db23 | Python | 7,822 | 205 | import os
import pandas as pd
import networkx as nx
ALLOWED_CURIS = {'CHEBI',
'CL',
'DB',
'GO',
'HP',
'InterPro',
'PR',
'Pfam',
'MESH',
'NCBITaxon',
'REACT',
'TIGR',
'UBERON',
'UniProt',
'UNII'}
bl_map = pd.read_csv('utils/dmdb_to_bl_map.csv')
BL_NODES = bl_map[['start_bl', 'end_bl']].stack().unique().... |
f0221667b7e05581d48d83c779e490fa70f314cee94c5444c64ebaa519dc932c | Python | 7,823 | 249 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
8b00417615da94b25655af1eab7c064b965849e4040845866644821536b52ced | Python | 7,828 | 212 | #!/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.
# ------------------------------------------... |
72c4ba2ff76e344f7bccf001c0ba7eb72e52dec8403d470e4e61f6bd8a6c7772 | Python | 7,840 | 283 | """
This script contains the code for control analysis 7, which creates a dissimilarity matrix between different feature representations across the whole stimulus set using Kriegeskorte-style (Kriegeskorte et al., 2008) Representational Similarity Analysis (RSA).
"""
import numpy as np
import os
import matplotlib.pypl... |
9bcd72748006465096f3d7e2d295be3b24b81496be64c2a152f80bfd86088d32 | Python | 7,847 | 277 | # 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,... |
5ca97a20edf71ccc3d616a7818f507d245db65cc4d7b9287bf8d110cf5baf19b | Python | 7,859 | 223 | # 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... |
84a269f1b3e2821a23eba2c63f022aca83dc03e5d516cddab9533b04ecc25a60 | Python | 7,866 | 186 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2018 Volker Hovestadt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
1eec12a5670809b5febf693ca4d052c20d6b9f4fe70a6dc4f61a575395dfd2aa | Python | 7,867 | 219 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import click
from typing import List
from openfecli.utils import write, print_duration
from openfecli import OFECommandPlugin
from openfecli.parameters import (
MOL_DIR, MAPPER, OUTPUT... |
8f86238a962a1126746e4ef8039f1fef2e13499b550c4485338c5edeb48be6d7 | Python | 7,872 | 186 | """Train the DCL-GAN baseline (Zhao et al., 2022).
Implements the dual contrastive losses described in "A Closer Look at
Few-shot Image Generation" on top of the conditional WGAN-GP backbone.
See ``src/baselines/models/dclGAN.py``.
Checkpoint: ``src/save/dclGAN.pt``. Slurm: ``baseline_jobs/dclGAN.sh``.
"""
import os... |
f66bc7307f9aeb6142925dc59ba725e3e0a0f527224f93a461dee605d7151597 | Python | 7,874 | 203 |
from diversity import *
# Test dataset generator
def create_test_datasets(n_real=200, n_feat=128, seed=1234):
"""
Creates:
- real_data: N(0,1) baseline (n_real x n_feat)
- test_datasets: dict of 5 synthetic sets designed to stress coverage, geometry, and intrinsic diversity
Scenarios
--... |
e1cd2fc7a555364abae2431aad4979fd786c8a1213dd58fa4bf19c3707f1c2b5 | Python | 7,878 | 194 | import json
import os
import pathlib
from importlib import resources
from unittest import mock
import pytest
from click.testing import CliRunner
from gufe import Transformation
from gufe.tokenization import JSON_HANDLER
from openfecli.commands.quickrun import _hash_quickrun_inputs, quickrun
from ..utils import asser... |
53a5ec5c35ccfcdba2a9e08a2b8d66baebb693f6f26ea6ea415006e739d315d2 | Python | 7,882 | 186 | import logging
import re
from typing import Dict
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The module parses summary statistics generated by versions >= v2.1.0 where... |
6f3923c403b0a06a90bce68a36e08a023dcd290e4c8f3df616433c445fb6478b | Python | 7,883 | 216 | """Final working end-to-end test that matches TimeFlies expectations."""
import anndata as ad
import numpy as np
import pandas as pd
def test_timeflies_with_correct_data_format():
"""
Test TimeFlies with data that matches the expected format.
This discovers what TimeFlies actually expects and tests it.
... |
dc22e798454a58890e8fdf6d04e600a90ed5424b4f9dd27e66a2a36031f751d0 | Python | 7,889 | 217 | # 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,... |
32a007d8ee168756add1e62a3096785b5d0e624ce5be7ff997a10447b2fa754b | Python | 7,890 | 267 | # 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,... |
fc18fcd4799b28a7194f130787c19f22d077922d09f326f52d29b43f1f8656ed | Python | 7,890 | 218 | #!/usr/bin/env python3
import argparse, math, csv
from pathlib import Path
import numpy as np
from scipy.sparse import load_npz, csr_matrix, issparse
from decimal import Decimal
FOLDER_MAP = {'uf20':'H_matrix_uf20','uf50':'H_matrix_uf50','uf75':'H_matrix_uf75','uf100':'H_matrix_uf100','uf175':'H_matrix_uf175','uf250':... |
dd6b1778e0a364369e14de9006c54e0d01d189e5af1cc88551bed295fed69afa | Python | 7,892 | 248 | import numpy as np
from scipy import sparse, stats
import pandas as pd
import bottleneck
import gc
import warnings
def create_cell_labels(adata, study_col, ct_col):
"""Create Cell Labels and Study Cell Type Labels
Utility function that takes anndata object and study column and cell type columns.
Pheno is... |
3a27e7ae01b6a20d90be20d0deb509e41eddb444581328741d261d6c182f88cc | Python | 7,895 | 207 | # -*- 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 ... |
93287a252211693d1b144ae1e48e7c0ce18d901b08e5d8cdff46f1be3ad6b137 | Python | 7,913 | 259 | # 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,... |
84dbb82b59f9a585578333868d91fec81e4fe06d70e3e289c329a8831d2c5a3d | Python | 7,920 | 212 | from pathlib import Path
from pydantic import BaseModel, Field, PositiveInt, field_validator
from ..models import Scope
class ComputeServiceSettings(BaseModel):
"""Core settings schema for a compute service."""
class Config:
arbitrary_types_allowed = True
api_url: str = Field(
..., desc... |
5cc7eb0cad48072e382f71b1dd467607cb3dd154570daf7ae76d0838f9b398e5 | Python | 7,924 | 224 | """Lazy ZIP over HTTP"""
__all__ = ['HTTPRangeRequestUnsupported', 'dist_from_wheel_url']
from bisect import bisect_left, bisect_right
from contextlib import contextmanager
from tempfile import NamedTemporaryFile
from typing import Any, Dict, Iterator, List, Optional, Tuple
from zipfile import BadZipfile, ZipFile
fr... |
f427f41846f130bb817e24ce558b396b886662cbe40556978c159e1be6facc0c | Python | 7,930 | 208 | from pathlib import Path
import sys
parent_dir = Path(__file__).resolve().parent.parent
sys.path.append(str(parent_dir))
import ContinuousObjects as co
import utils.tools as tools
from utils.ContinuousEnvironment import Environment
from ContinuousObjects import Ball, Paddle
import numpy as np
import math
import random... |
01e2ecc5026eb29989a72591ac45084dbbe903be5d35958286ff6dc2bff50c2f | Python | 7,934 | 256 | # -*- 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 ... |
2bfb35ea52ab5b139df2ae703ac7f55616b194ca54377aabeb585657f4e36023 | Python | 7,934 | 209 | """
engine/attention_viz.py — Attention Weight Visualization
=========================================================
Visualizes per-node multi-head attention weights produced by GAT-style
(and GCT-style) models. Given a ``ModelOutput`` that carries attention
matrices in ``output.aux["attn_weights"]``, this module pr... |
739d3a3c40692aaa076de7a469ce8037f0d5a3e060bb969f24e7e3271fd9b239 | Python | 7,941 | 236 | """
Helpers to train with 16-bit precision.
"""
import numpy as np
import torch as th
import torch.nn as nn
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
from . import logger
INITIAL_LOG_LOSS_SCALE = 20.0
def convert_module_to_f16(l):
"""
Convert primitive modules to float16.
... |
f59bfad37808ee95ae1e7299eb5d10a469ac57d3182ad1bb3440bd9f76e75573 | Python | 7,943 | 225 | from pathlib import Path
import sys
parent_dir = Path(__file__).resolve().parent.parent
sys.path.append(str(parent_dir))
import utils.ContinuousObjects as co
import utils.tools as tools
from utils.ContinuousEnvironment import Environment
from utils.ContinuousObjects import Ball, Paddle
import numpy as np
import math
i... |
5a2e30ebd76e28452c9c3bfc1bfd2dd112247c3d3d3ca9b23d7075d063e6b300 | Python | 7,944 | 265 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
569b1d7d41b10489257778e6628c1aa98b4c56131aaea873952c98a5618f860d | Python | 7,947 | 234 | # -*- 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 ... |
6f0359e39574f8e374df537ddb988c92ec24ae01aebf3043d8225e0c5532c47c | Python | 7,950 | 235 | # 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,... |
24ff909b11361768b24317349199d671d6ba4b7309dac9436f427a3a9d5d1b9d | Python | 7,957 | 215 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import logging
from collections import defaultdict
from rdkit import Chem
logger = logging.getLogger(__name__)
ATOM_MAPPING = dict[int, int]
def filter_ringsize_changes(molA: Chem... |
d51539ec8dfadcad36adb2a089b587a7f60cf6cad501f19b7d6f879262acc394 | Python | 7,959 | 281 | """
This script contains the code for control analysis 4, where the image and
video EEG responses for the same stimuli are correlated. Note that the correlation
is computed after applying MVNN, and after averaging across trials, and participants.
The correlation is computed for each electrode separately, and then avera... |
7ccf2529ef6901afb43abad0473e178fe7ddb4aadb46c3a1a8705c15b6a87f2f | Python | 7,960 | 258 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
ca1f2621698b4c9a4558cfaf40bca6010f7846c880dd1414eaac0cb4b3de39a7 | Python | 7,961 | 177 | #!/usr/bin/env python
"""
setup.py: Install ForceBalance.
"""
from __future__ import print_function
__author__ = "Lee-Ping Wang"
from setuptools import setup,Extension
import os,sys,re
import shutil
import glob
import argparse
import subprocess
#===================================#
#| ForceBalance version number ... |
3304f31ad651deca33f0b6740a37a565e35fa92000ba06b705cc961643c15d77 | Python | 7,962 | 192 | """Downstream utility: 3-way CN/MCI/AD diagnosis from imaging.
Tests two hypotheses from the paper:
1. Synthetic PET performs ≈ real PET in limited-data settings.
2. Generated PET unlocks a larger effective dataset that outperforms
the limited real-PET setting.
For each experiment in ``experiments`` (different mi... |
eb42f03ec008bf281693971f985450b486a52e6cd23ea84efa39d91f6a6d7f68 | Python | 7,964 | 217 | # -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
NeuroBED_ML Visualization
Jaccard Overlap among Top-10 ROIs
-------------------------------------------------------------------------------
Lower triangle... |
2023926632caacc62fcce1ea7167a8a3060c7034308170ada0ef2f00e12649ed | Python | 7,967 | 189 | import json
import logging
import re
from typing import Dict, Union
from multiqc.plots import bargraph, table
log = logging.getLogger(__name__)
def parse_samtools_markdup(module) -> int:
raw_by_sample: Dict = dict()
for f in module.find_log_files("samtools/markdup_json", filehandles=True):
raw_d = ... |
38866cf87f560c4b21f254926848ae715d81e04e08331949a2375dec78e15f00 | Python | 7,967 | 214 | # INFERENCIA CLÍNICA FINAL → Compatible con estructura HUCSR (ST0)
import os
import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
from pathlib import Path
import pydicom
from scipy.ndimage import zoom
from skimage.transform import resize
from scripts.s2_load_images_hucsr import process... |
9f2354407bc37adced12eaacd649ade01fbdd396859d670e51ef78fcc4013bc7 | Python | 7,970 | 271 | # 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,... |
2cd422eb4af15b0c68b874a89a39db2a7ec24dcc23bf03f821bb5c4afc92a03d | Python | 7,978 | 195 | import numpy as np
import functools
import itertools
import nrrd
from sklearn.decomposition import PCA
from scipy.stats import beta
# pylint:disable=import-error
from bsb import config
from bsb.config.refs import partition_ref
from bsb.connectivity.strategy import ConnectionStrategy
from nemsi.visual import add_to_pl... |
4fa66c6c9c2ea2bee3288d459e1227f5f185494dc89288f7ebf592b3b51074d2 | Python | 7,983 | 257 | import threading
import time
import os
import pytest
from pathlib import Path
from alchemiscale.models import ScopedKey, Scope
from alchemiscale.storage.models import ComputeManagerID
from alchemiscale.storage.statestore import Neo4jStore
from alchemiscale.storage.objectstore import S3ObjectStore
from alchemiscale.c... |
6896a1fda408a1797c0c49052ecb40de5e92ec84bdaaa5209a83be645c3d0b07 | Python | 7,986 | 233 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test force factories in forcefactories.py.
"""
# ==============================================================... |
e9a54b6aac953ff9b89b061b59a8cbff99e5ab3b381b4a64fffcbb618b232f17 | Python | 7,988 | 235 | # -*- 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 ... |
4afe4d86501bc64d5ff8b60714c91f7dbb0d301f1011169e8979744fd4f79e32 | Python | 7,994 | 241 | # -*- 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 ... |
a8012498d5dbb0eefba41043695bce72fa1273dfa024d940707ab683c79f5492 | Python | 7,997 | 174 | import numpy as np
from trained_untrained_results_funcs import find_best_layer
from plotting_functions import plot_across_subjects
from matplotlib import pyplot as plt
import pandas as pd
dataset_arr = ['pereira', 'fedorenko', 'blank']
feature_extraction_arr = ['', '-mp', '-sp']
perf_arr = ['pearson_r', 'out_of_sample... |
08e453d08a98848d886030b3adeda48fb4b8e9cb79e86cf8a01cc5c4655eb804 | Python | 7,998 | 193 | # -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
NeuroBED_ML Visualization
Split violins — best SINGLE vs best MULTI per target × group (R²)
-------------------------------------------------------------------------------
Author :... |
628180cabf7b97e33f19d5bce56a5299ce1f268b2b7019e816c96906c9cfc2d3 | Python | 8,003 | 237 | # -*- 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 ... |
26d2263a10245b20f4f54b6851de539c57b42aed06da917bd57a40be4405153a | Python | 8,005 | 206 | """External baseline: Cross-Domain Correspondence (CDC) GAN.
Ojha et al., "Few-shot Image Generation via Cross-Domain Correspondence",
CVPR 2021 (https://arxiv.org/abs/2104.06820). The CDC objective
preserves pairwise distances between source and target features so the
model retains the source's generative diversity w... |
21b6f53eae0b24b4d322e07caa8dd543fb24ab8b147e6229b6dfe636ee3a7627 | Python | 8,006 | 237 | import sys
import numpy as np
import pytest
import shapely
from shapely import GeometryCollection, LinearRing, LineString, MultiLineString, Point
from shapely.errors import UnsupportedGEOSVersionError
from shapely.testing import assert_geometries_equal
from shapely.tests.common import (
empty_line_string,
emp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.