sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
174754a57e791a657725aef033fac1e32762d102bc8493a80900755242c7dd38
Python
908
32
from sys import argv from msp import MSP from msp_fly import fly_am msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) fly_am(msp) msp.architecture["propagate_sparsity_spec"] = dict( type="OnlyAllowInfluenceOnSplicesites" ) msp.architecture["final_processor_spec"].update( dict( bottleneck_spec=...
5f88aad4de509d03aea821b65c658bf5da6b5bfb655fadb720e3b4acafadb7f3
Python
908
43
"""Add workflow_step_index_path column to workflow_invocation_message table Revision ID: 312602e3191d Revises: 75b461a2b24a Create Date: 2025-12-27 12:00:00.000000 """ import sqlalchemy as sa from galaxy.model.migrations.util import ( add_column, drop_column, ) # revision identifiers, used by Alembic. revis...
ead64b6f455282a7e9a40a7c5beb34ecd946c6f3c8aa82f85af785b55b56e74d
Python
908
31
import numpy as np import pytest from pyriemann.utils.utils import check_weights @pytest.mark.parametrize("n_matrices", [3, 4, 5]) def test_check_weights_none(n_matrices): w = check_weights(None, n_matrices) assert np.sum(w) == pytest.approx(1.0, abs=1e-10) @pytest.mark.parametrize("n_matrices", [3, 4, 5])...
0cfb8934bcd6a43414021224b132cbbcf85b84673af3018aa254bc56992cf3c9
Python
909
32
"""Utilities for testing spectral parameterization.""" from functools import wraps from specparam.modutils.dependencies import safe_import plt = safe_import('.pyplot', 'matplotlib') ################################################################################################### ##################################...
7f90e44a14c24c82c567ac518588ec41a1e318dc787c28c9493d66d27c5a9798
Python
909
19
import os import sys import numpy as np """ this is the only script you actually should call, it will submit a job this job makes the features, and then does the regression. only change the home_dir variable, everything else should run! """ homedir = '/cbica/projects/abcdfnets/scripts/keller_ridge/pennlinc-regressio...
f0e3bd70067a4df19190ac127ea0fea6b9e797dd150812f25e1725f0b701ed69
Python
909
28
import itertools import numpy as np from larvaworld.lib import util from larvaworld.lib.plot import configure_subplot_grid def test_subplot_grid_configuration(): vs = [None] + np.arange(20).tolist() for idx in itertools.product(vs, vs, vs): if None not in idx or 0 in idx: continue ...
41a9e4057cf07736a14e9d9ea23a729f8168053675a23be866ba9d9e01bc5880
Python
910
28
import pandas as pd from rdkit import Chem def valid_smiles(smi): mol = Chem.MolFromSmiles(smi) if mol is None: # check validity return False try: # check valence, aromaticity, conjugation and hybridization Chem.SanitizeMol(mol) except: return False ...
88a120b95348de1d4bcfb6e3c697970f27c08e8cc5e9b9f6e42a497338f17dc4
Python
910
31
import sqlite3 from .db import DB class DistrictDeathInfo(DB): def __init__(self): super().__init__() self.table_name = 'KL_district_death_info' self.table_desc = 'District wise Death Cases through online and offline mode - post scrutiny status' self.cols = self.getcolumns() ...
3e21beed1b7781ece084379d7410668d921cbbe0fa02c9516c025003b8cdeb12
Python
911
30
from typing import Union import torch from torch import Tensor class RFFT2DTransform: """2D Fast Fourier Transform (RFFT2D) Transformation. This transformation applies the 2D Fast Fourier Transform (RFFT2D) to an image, converting it from the spatial domain to the frequency domain. Input: -...
55aa1365d042d02d04cb1cc1c502771e5a205a7cca8ee83503046906b84b3ae7
Python
911
30
"""Set of random number generator functions: seeding, generator, hashing seeds.""" from typing import Any, Optional, Tuple import numpy as np from gym import error def np_random(seed: Optional[int] = None) -> Tuple[np.random.Generator, Any]: """Generates a random number generator from the seed and returns the G...
019c10a02db3ad3c88888eda5d0e94d974c84595b528983156267aa585ad0861
Python
912
33
# Generated by Django 3.0.4 on 2020-03-22 13:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('biomedisa_app', '0055_auto_20200321_1543'), ] operations = [ migrations.AddField( model_name='mushroomspot', name='d...
3c1fe427b70dbe10579a52fe2b3c8bbb685fea61bb6f539063be7d698a655b89
Python
912
35
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for base.py""" import unittest from sknetwork.base import Algorithm class TestBase(unittest.TestCase): def setUp(self): class NewAlgo(Algorithm): """Docstring""" def __init__(self, param: int, name: str): sel...
449795a25be5d33ee6b3fa5d23a3f62bf7ef796b33203f8a8a3b9a41168f0181
Python
912
29
main_tissue_groups_v1 = { "blood": ["Cells - EBV-transformed lymphocytes", "Whole Blood"], "brain": [ "Brain - Amygdala", "Brain - Anterior cingulate cortex (BA24)", "Brain - Caudate (basal ganglia)", "Brain - Cerebellar Hemisphere", "Brain - Cerebellum", "Brain -...
ac340a78ab59f890b7d6bd5d2e26ee20192f1bbddbc8e992e7317c64bd21cd0b
Python
912
23
import os import nibabel as nib def list_scans(path = None): return [os.path.join(path,scan) for scan in os.listdir(path) if scan.endswith(".nii")] def normalize_HU(range, ct_type): min_, max_ = range for scan_id in list_scans(ct_type): print(f"NORMALIZING {scan_id}") scan_nii ...
3d0090122e7a50f4645b4f0d397c90c8b614d2a8067d6c8dafa5d864ac79bdef
Python
913
31
import sqlite3 from .db import DB class DistrictCaseInfo(DB): def __init__(self): super().__init__() self.table_name = 'KL_district_case_info' self.table_desc = 'District wise summary of Cumulative cases, Active cases, and New positive cases' self.cols = self.getcolumns() de...
62986ed6c5874e217c0d8cd8a71ee86a54eb55a4fefc74a7d5e09c8553bdd4b9
Python
913
38
import hashlib import secrets import bcrypt PREFIX_KEY = "cpt_" # cpt stands for codecarbon project token def generate_api_key() -> str: # Generate a random API key api_key = secrets.token_urlsafe(32) prefixed_api_key = f"{PREFIX_KEY}{api_key}" return prefixed_api_key def get_api_key_hash(api_key...
a46b16d4262db614acc98189ea941a91f74399fb3a701c3087198c127ff3ec67
Python
913
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.sparse_adaptation_params = lambda: "" msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict( type="Motifs", motifs_spec=dict( type="PSAMMotifModel", ...
24d6ff3fa7cfac7153960883274daacab29cf27605d5116de6cd250e30221581
Python
914
36
"""Utility functions. Don't import from here directly anymore, as these are only here for backwards compatibility. """ from kombu.utils.objects import cached_property from kombu.utils.uuid import uuid from .functional import chunks, memoize, noop from .imports import gen_task_name, import_from_cwd, instantiate from ....
6773fed3be88aa4a7f2222f024818d03feb3bc4210344bc772de055f9f9b7098
Python
914
31
import os import tempfile import pandas as pd def annotate_pfms( filename, motifs_db, output_dir=None, out_filename=None, tomtom_exec_path='tomtom', is_writing_tomtom_matrix: bool = True ): if output_dir is None: output_dir = os.getcwd() _, tomtom_fname = tempfile.mkstemp() out_filename = "motifs" i...
71e21149f18139e2727278332e8284d1c9241c89e2948d59466c3faae4677c00
Python
914
23
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 56 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
79c7fc67c0c8cc201bb1ef8504d386ba61a9e644716f59e02296ac79ce48c544
Python
914
34
from typing import List import numpy as np from hobj.benchmarks.binary_classification.simulation import BinaryClassificationSubtask from hobj.learning_models.random_guesser import RandomGuesser from hobj.types import ImageId def create_image_refs(nimages_per_class: int, seed: int) -> List[ImageId]: images = [] ...
a1cf28f4bea8f45df869c476e5fd68d1ef10ded0248d644a09ddbfb91e0ae47f
Python
914
26
import unittest import torch from modular_splicing.models_for_testing.main_models import AM class AMTest(unittest.TestCase): def test_am(self): model = AM.non_binarized_model(1, density_override=0.75).model variable = torch.nn.Parameter(torch.rand(1, 100, 4).cuda()) result = model(varia...
2a19245cb01613904e834bab3e6b53616d2594c73c632ed36470c949e1bcf4ad
Python
915
28
""" This module define a MSEStructure """ # pylint: disable=W0223 import torch class MSEStructure(torch.nn.modules.loss._Loss): # pylint: disable=protected-access """ This class define a specific loss : MSE loss for each token in input """ def __init__(self): super(MSEStructure, self).__init...
64e2076da709f9226db99aeee06a00e43b92218c9e684e06e647d93dfe5c9f50
Python
915
28
import os import os.path from pip._internal.utils.compat import get_path_uid def check_path_owner(path): # If we don't have a way to check the effective uid of this process, then # we'll just assume that we own the directory. if not hasattr(os, "geteuid"): return True previous = None whi...
71b3d1dfa29f6ff5b73a70a4bbea0bc56028c76768a09b6b40165167e10b0a57
Python
915
19
import os import sys import numpy as np """ this is the only script you actually should call, it will submit a job this job makes the features, and then does the regression. only change the home_dir variable, everything else should run! """ homedir = '/cbica/projects/abcdfnets/scripts/keller_ridge/pennlinc-regressio...
7a16af91f9b2109cb6470d299a0973d43f189f4555d1991e843e893e01449b54
Python
915
44
from .models_backbone import ( ElPiGraph_method, PrinCurve_method, SimplePPT_method, backbone_scc, construct_backbone, map_gene_to_backbone, map_points_to_backbone, update_backbone, ) from .models_individual import ( construct_cells, construct_pc, construct_surface, voxel...
51c2c3840c55fef86c796bad371244a6a63bb8dcbd0e609827ce2d52fee8a5bd
Python
916
28
import sqlite3 from .db import Database from .TG_tables import TG_symptomatic, TG_comorbidities, TG_agedist, TG_caseinfo, \ TG_testinfo, TG_contact_testing, TG_district_cases class TelanganaDB(Database): def __init__(self, datadir): super().__init__(datadir) self.init_tables() self.c...
90d5a5cab475e0eaf65ad8a5fd3c21308302bf875b8900262d80ecb311dfdfe8
Python
916
22
import numpy as np import torch import opt_einsum as oe from torch.autograd.functional import jacobian from src.MODEL import * #============================calculate the energy=================================== class Property(torch.nn.Module): def __init__(self,density,nnmod): super(Property,self).__init_...
cf7d250803466db4e6755c2dc679d5a82539605faeb87a6e569c62a9d088a1e0
Python
916
32
#!/usr/bin/env python import sys,re, collections '''reduce the provided example file to only have a single positive and single negative example per receptor (at most)''' #first identify best rmsd bestval = dict() bestlig = dict() for line in open(sys.argv[1]): vals = line.rstrip().split() if len(vals) < 6: ...
86213e8df7e1d9ac5a3a4b0241b437114760751f4dc8ed5c3be2c0b1eaac67f0
Python
917
40
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["splicepoint_model_spec"] = dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepoint-model-donor-1", ) am_e = dict( type="PretrainedEclipMotifM...
26ec076b571abfb0a342c680135a2ff26ff5e7f70a9b8c1b55b5266ffb6e2fdf
Python
918
36
# Copyright 2023 Blue Brain Project, EPFL. # See the top-level LICENSE file for details. # # SPDX-License-Identifier: Apache-2.0 class Argument: """Utility class for holding all arguments for node classes""" def __init__(self): # BaseNode self.class_name = "" self.nmodl_name = "" ...
60e3a2b0b2a1db5362a028ee1c4a9df1862b8db7ea3c333afe623fe4e18d476c
Python
918
32
import sqlite3 from .db import DB class DistrictInformation(DB): def __init__(self): super().__init__() self.table_name = 'MH_district_caseinfo' self.table_desc = 'Maharashtra daily district level case information' self.cols = self.getcolumns() def getcolumns(self): ...
c955e378249522fd59cae8cdeb33997261356e22772d54edfedc4465181223e9
Python
918
31
""" michael.reimann@epfl.ch """ from setuptools import setup, find_packages setup( name='projection_voxels', version='0.10', install_requires=['h5py', 'numpy', 'voxcell', 'simplejson'], packages=find_packages(), include_package_data=True, author=['Michael Reimann'], scripts=['bin/download...
203a9fee5afcbdfe7fe312cc007e16f8f3eb8c78e80ef185688ddb7f7a771f0f
Python
919
29
import sqlite3 from .db import DB class PatientMgmtTable(DB): def __init__(self): super().__init__() self.table_name = 'DL_patient_mgmt' self.table_desc = 'Patient management table containing hospital occupany information for Delhi' self.cols = self.getcolumns() def getcolum...
e74e6a63b3ba26982161d88807f9283924a05ec0200fc012a8829f85c0f0701d
Python
919
19
import os import sys import numpy as np """ this is the only script you actually should call, it will submit a job this job makes the features, and then does the regression. only change the home_dir variable, everything else should run! """ homedir = '/cbica/projects/abcdfnets/scripts/keller_ridge/pennlinc-regressio...
e7be33f01b6b83d815f92d66cea1218f066cc8230765b0c8883ad75b42e36012
Python
919
39
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import pandas as pd import sys import pdb import csv def get_cid(): chembl_fname = "Chembl_ids.txt" with open(chembl_fname, 'r') as f: data...
fb7c2a04fbd333b8c375f4f2b483445f13367ae8098db09944b88bcbda6499a7
Python
919
37
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on May 2019 @author: Nathan de Lara <nathan.delara@polytechnique.org> """ import numpy as np def top_k(scores: np.ndarray, k: int = 1, sort: bool = True): """Return the indices of the k elements of highest values. Parameters ---------- scores...
2f51f9775aa9e40b5a7857f2a17a636c1780f375f11997c5d41e645dc090dc54
Python
920
26
import pytest import gym from gym import spaces from gym.wrappers import GrayScaleObservation @pytest.mark.parametrize("env_id", ["CarRacing-v2"]) @pytest.mark.parametrize("keep_dim", [True, False]) def test_gray_scale_observation(env_id, keep_dim): rgb_env = gym.make(env_id, disable_env_checker=True) asser...
3ece271642a661283f9c75116bf258f0da8cd0daec0cd0d4c37481f9e64d09f2
Python
920
31
import os from shutil import copyfile def check_dir_exists(path): if not os.path.exists(path): os.mkdir(path) def split_by_name(dir_path, real_save_path, fake_save_path): # check_dir_exists(real_save_path) # check_dir_exists(fake_save_path) if not os.path.exists(real_save_path): os.mk...
bad36e2cdc578749a9e36701badf6445df122227fcb93635b855fc440984319d
Python
920
35
#!/usr/bin/env python3 import os import sys import re import json lengths = sys.argv[1] map_all = sys.argv[2] chunks = sys.argv[3] threads = sys.argv[4] n=0 def write_bed(bed): bed.write(line.rstrip().split(' ')[1] + "\t0\t" + line.split(' ')[0] + "\n") def split_bam(bed, bamchunk, bam_all, threads): os.syste...
c20ba326d5c534ec70aec0382a456bdc56b3767826b7be7e0fec81aa198e7e6c
Python
920
30
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._hoverlabel import Hoverlabel from ._legendgrouptitle import Legendgrouptitle from ._marker import Marker from ._selected import Selected from ._textfont import Textfont from ._unselected import Unselected from . import hov...
ce1627ea1353771ad64422cae159ae3c22708af1bbc9911276a39f3b657ee4c2
Python
920
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.sparse_adaptation_params = lambda: "" msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict( type="Motifs", motifs_spec=dict( type="PSAMMotifModel", ...
50c0e5ce49a44bb096ba1acbfcaeb759fd6cda99dd945fa373bb3659c0e15ef6
Python
921
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.sparse_adaptation_params = lambda: "" msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict( type="Motifs", motifs_spec=dict( type="PSAMMotifModel", ...
383a89768d6f95a16c55de1768c49f0964dd7b2a1630c20e2fe4ea96d49019d7
Python
922
37
import os PLOTLY_DIR = os.environ.get( "PLOTLY_DIR", os.path.join(os.path.expanduser("~"), ".plotly") ) TEST_FILE = os.path.join(PLOTLY_DIR, ".permission_test") def _permissions(): try: if not os.path.exists(PLOTLY_DIR): try: os.mkdir(PLOTLY_DIR) except Excepti...
776bcbd68da7386b688045f2f3b6cbcb62f2cb1d6dc416689d440ac86cf6af09
Python
922
30
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Write text files""" from typing import Iterable from .._types import PathArg from .._utils import ui def txt(iterator: Iterable, fmt: str = '%s', delim: str = '\n', dest: PathArg = None): """Write any object that supports iteration to a text file P...
86e4fec63288b32bc9b2e128c653ec427eab9240f5505cd6d6932e4f56f1f413
Python
922
27
#!/usr/bin/env python """ Extract importent information from the standard output file and put it in some standard format, like BED and tabular. """ import sys bed = open(sys.argv[2], "w+") tabular = open(sys.argv[3], "w+") for line in open(sys.argv[1]): # ORGANISM: gi|21226102|ref|NC_003901.1| Methanosarci...
af384bc8950a21faf206c1c12bb302bfc57d2dd522a352a2476b6bb8202d4204
Python
922
30
""" Provides functionality for persistence of data """ from codecarbon.output_methods.base_output import BaseOutput, OutputMethod # noqa: F401 # Output to BoAmps format from codecarbon.output_methods.boamps import BoAmpsOutput # noqa: F401 # emissions data from codecarbon.output_methods.emissions_data import ( # ...
aa423939f6cf646f471638b8f03f0e301bbe1a972026b8fd1dd048cc27a72715
Python
923
41
"""Helper functions for Pillow visualization""" from PIL import Image import numpy as np def make_mask_visible(mask): """Converts Pillow Image representing binary mask to helpful Pillow Image. Args: mask (PIL.Image): Pillow image of binary mask Returns: PIL.Image: Pillow image """ ...
bdec999c115ca92ada9f29279d213445893b10484301477401120fc04de0abe4
Python
923
35
import torch import torch.nn as nn from .sparsity import SparseLayer class DiscretizeMotifsIn(SparseLayer, nn.Module): """ Binarize the motifs after running the given sparse layer. """ def __init__(self, sparse_layer): super().__init__() self.sparse_layer = sparse_layer def forw...
13b505359e1988dfab5e0d4a97aa61af26ac3d2ab5907bb762bdd754f7ab4520
Python
924
30
import sys import os # setting path sys.path.append('../TM2_segmentation') import numpy as np import pandas as pd import nibabel as nib from skimage.transform import resize, rescale from scipy.ndimage import zoom from settings import target_size_unet, scaling_factor import matplotlib.pyplot as plt from scripts.prep...
60a577e0452419cdbcf2ad5f6654afbb8eb0ef8aef8b185bc4bf413511e98d02
Python
924
32
import os import sys import importlib import pandas as pd import anndata as ad from pyprojroot import here proj_root: str = str(here()) sys.path.insert(0, os.path.join(proj_root, "package/python")) from utils import set_file_logger import cembav2env importlib.reload(cembav2env) # * configs rsc_dir = os.path.join(proj...
a952e6dfb1a6d434e5e51b9d8f6de46c1c24f91fdd39cdec00debc68136fbbfa
Python
924
31
"""Utilities for debugging.""" import sys import platform ################################################################################################### ################################################################################################### def sys_info(): """Print out system information.""" ...
3d8bfeef4ed64db7c491325bf85e8b637bd3af31b20c9902a00d4dcdc648c910
Python
925
19
import os import sys import numpy as np """ this is the only script you actually should call, it will submit a job this job makes the features, and then does the regression. only change the home_dir variable, everything else should run! """ homedir = '/cbica/projects/abcdfnets/scripts/keller_ridge/pennlinc-regressio...
4b0a7f878fb690bb3c0f687ff95a1717fb69678f01e2251614ffd6317c7e5033
Python
925
33
from sys import argv from msp import MSP from msp_fly import fly_am msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) fly_am(msp) msp.architecture["propagate_sparsity_spec"] = dict( type="OnlyAllowInfluenceOnSplicesites" ) msp.architecture["final_processor_spec"].update( dict( bottleneck_spec=...
c4c7c76efd432093bad37f98cd5fb1b07fc4bd8b1b25ad37aa46181142e0af40
Python
925
33
""" Test crude AP detection """ import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/") sys.path.insert(0, PATH_SRC) import matplotlib.pyplot as plt import pyabf import pyabf.tools.a...
cbb57a6d534d4bb1e688e0c90cd973f7041a8e435e9d766fd412f56330b3fd98
Python
926
32
"""Simple conversion helpers.""" def int_to_rgba(v: int) -> list[float]: """Get rgba (0-1) e.g. (1, 0.5, 0, 1) from integer. >>> print(int_to_rgba(0)) [0.0, 0.0, 0.0, 0.0] >>> print([round(x, 3) for x in int_to_rgba(100100)]) [0.0, 0.004, 0.529, 0.016] """ return [x / 255 for x in v.to_byt...
f05e21c6ff5ec88f9ebf94dfcbd4e5884df75b84015b5d88ea8079228b251595
Python
926
33
from angorapy.tasks.world_building.base import PhysicalWorld from angorapy.tasks.world_building.entities import Stage from angorapy.tasks.envs.dexterity.mujoco_model.externals import Block from angorapy.tasks.envs.dexterity.mujoco_model.robot import ShadowHand class ShadowHandWithCubeWorld(PhysicalWorld): def __...
09006509efe340a45afe351c2cf3719f2cad78d3bef656acb2cae43bec8b639f
Python
927
36
""" Stand-alone module to provide information about whether optional deps exist. """ from importlib import import_module import logging import sys logger = logging.getLogger(__name__) _not_importable = set() def get_module(name, should_load=True): """ Return module or None. Absolute import is required. ...
46b8a6e84f2e9f09bca75afbf066a0845851ea8cb060c1d15c9ff4af0c2cd80d
Python
927
35
from .params import params # Number of networks to include: N_networks = 30 # Number of sequence templates to run: N_templates = 1 # Number of sequence templates that save dynamics data: N_templates_with_dynamics = 1 # Toggle STD - always an iterable of 0 and/or 1 STDs = (0,1) # Toggle TA - always an iterable of 0...
852850b22fd96bb53e1ad0bcae364bacbb2c0b67ab47fa12135c24a9d0ff0b78
Python
927
30
from collections.abc import Callable from dataclasses import dataclass import numpy as np import torch from torch import nn from neurogym.wrappers.components.modules.base import LayerProbeBase @dataclass class LinearLayerProbe(LayerProbeBase): layer: nn.Linear @staticmethod def layer_types() -> set[typ...
2a9c4c80a6bf1b91b92f800ca672870081942afcc3e3b6c6f7994599d347e83b
Python
929
19
import os import sys import numpy as np """ this is the only script you actually should call, it will submit a job this job makes the features, and then does the regression. only change the home_dir variable, everything else should run! """ homedir = '/cbica/projects/abcdfnets/scripts/keller_ridge/pennlinc-regressio...
522e65e77a51de5a342dbc9413874778bdcc5568141c9e1ed60077c83ea31d2f
Python
929
31
"""Shared config helpers for the models_architecture inspector data layers. These helpers are reused by both the Model Inspector and the Module Inspector data layers to avoid duplicating canonical defaults and copy semantics. """ from __future__ import annotations import copy from typing import Any __all...
05cf79399d3c5e9989a10ff5332200009838310bb128116600edbbd228a531c7
Python
930
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 17 msp.architecture["motif_model_spec"]["motif_feature...
0b141071fc9d2e3c5506907369ce79eefb3e6758760fb1dfcf7c711ce7085ce7
Python
930
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
0b1a314c59a69fa9847b0f7ae49c1904918d0a9d18df64ee80beb1d13320344a
Python
930
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 17 msp.architecture["motif_model_spec"]["motif_feature...
21e9e492588a93ab009366b535f63287e76834396615619189a25de5ef002e92
Python
930
36
"""Worker Event Heartbeat Bootstep.""" from celery import bootsteps from celery.worker import heartbeat from .events import Events __all__ = ('Heart',) class Heart(bootsteps.StartStopStep): """Bootstep sending event heartbeats. This service sends a ``worker-heartbeat`` message every n seconds. Note: ...
29a8201c583adc28e8b92fcfe88bda0fd09317cab2b80700a290539368a52db8
Python
930
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 21 msp.architecture["motif_model_spec"]["motif_feature...
4535ff0d05f3fd5d03fda0ef6aa1886aaed8e849fd74ff469013bb9a687a06ed
Python
930
35
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from setuptools import ( setup, find_packages, ) import versioneer # Give setuptools a hint to complain if it's too old a version # 30.3.0 allows us to put most metadata in setup.cfg # Should match pyproject.toml SETUP_REQUIRES = ['setuptools >= 30.3.0'...
1b37914e36f6a6fde0f2f3701ca4b7125c5776c172fb4da52f19c213b713284b
Python
931
25
import os import numpy as np import shutil from os.path import exists path_annotations = '/mnt/datosnas/Users/cmejia/EMOTION-DETECTION/AFFECTNET-raw/train_set/annotations/' path_images = '/mnt/datosnas/Users/cmejia/EMOTION-DETECTION/AFFECTNET-raw/train_set/images/' path_target = '/mnt/datosnas/Users/cmejia/EMOTION-DET...
f05a5e1beba0131ce99149c774c078c615f1473f3b39ace683e0f0d4dabba702
Python
931
49
__author__ = 'quentin' from ethoscope.tracking.roi_builders import ImgMaskROIBuilder from ethoscope.tracking.cameras import MovieVirtualCamera from ethoscope.tracking.monitor import Monitor from ethoscope.tracking.trackers import AdaptiveBGModel from ethoscope.tracking.interactors import SystemPlaySoundOnStop import...
f21a470b58f00ed932aabd3fb20e953b4c1530b8dad3b9b6dbb46ee2ffd1485d
Python
931
31
import argparse import pandas as pd from statsmodels.stats.multitest import fdrcorrection parser = argparse.ArgumentParser() parser.add_argument("--dapeaks", action = "store", help = "da peaks csv file to be converted to bed") parser.add_argument("--celltype", action = "store", help = "cell type") parser.add_argumen...
4b27ce8bd819f256b24452fe2ebb6b6b1e4ff6a9c1ff8d94ced3bb097e87b638
Python
932
34
from tensorboardX import SummaryWriter from jax.experimental.host_callback import id_tap import jax.numpy as jnp from absl import logging import os summary_writer = None last_step = 0 def init_writer(): global summary_writer logging.info('summary_writer init') if 'custom_config' in os.environ: summary_writer...
51632382f04f2715cd28fad890856bcb7c7fdfa857795ee7cf2cc55e254260b3
Python
932
34
import os; import sys; my_path=os.path.dirname(os.path.realpath(__file__)); root=os.path.abspath(my_path+'/../..') sys.path.insert(0,root); from biswebpython.core.bis_objects import * import biswebpython.core.bis_baseutils as bis_baseutils; # change this fname1= root +'/test/testdata/indiv/prep.nii.gz'; fname2= roo...
803e19d970a736c6eacbeeb28ba9e3d2415269d219ac02ba1c0ed4f684db51ce
Python
932
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
8ad714e4542c93cc45d67a194bcb034eb2534c25b96512521a5b6a78ea6edc13
Python
932
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 21 msp.architecture["motif_model_spec"]["motif_feature...
a6904f49a4d2f8fbb9b40f836772eb5a53549768cf43b4cd06d86d0a0255fde6
Python
932
33
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 11 msp.architecture["motif_model_spec"]["motif_feature...
269441b25d98864223295f2f08324e29a8eda838922fcfaa37f384dab30669a1
Python
933
65
# limits maps to just the TFs which regualte the network from sys import argv from pprint import pprint as pp map_file = open(argv[1]) reg_dic = {} tf_dic = {} line_count = 0 head_line = 0 for n, line in enumerate(map_file): # if n > 5: # break # print(line) if line_count == 0: lin...
f6df5d06e2d98e061a439c429c7073897e553093f366c56f692b781e062e6902
Python
933
38
from dependency_injector import containers, providers from carbonserver.api.infra.repositories.repository_projects import ( SqlAlchemyRepository as ProjectSqlRepository, ) from carbonserver.api.services.project_service import ProjectService class DatabaseMock: def __init__(self, db_url): self.db_url ...
000dedf828115a009d8a4bede9aa9f007e01044fc35eb8175ef6feaa2aeae818
Python
934
39
"""Spatiotemporal modeling of spatial transcriptomics """ from .agg import box_qc_regions, imshow, qc_regions from .align import ( optimization_animation, overlay_slices_2d, plot_deformation_grid, slices_2d, ) from .bbs import delaunay, polygon from .colorlabel import color_label from .contour import sp...
248c49bb8f50605dffb96dff251abe245078fdcdbc2ea2756907e2ae6c091c30
Python
934
26
"""Guard against README indexes referencing files that no longer exist.""" import re from pathlib import Path import pytest REPO_ROOT = Path(__file__).parent.parent # Markdown files whose relative links must all resolve. CHECKED_FILES = [REPO_ROOT / "examples" / "README.md"] LINK_RE = re.compile(r"\[[^\]]*\]\(([^)]...
11d4620742eca9cd833b37847da52878c7bb7678a2b5881ccadd06331ac71e2c
Python
935
34
import pathlib import tempfile import zipfile import numpy as np from impose import formats data_path = pathlib.Path(__file__).parent / "data" def get_ometif(): td = pathlib.Path(tempfile.mkdtemp(prefix="impose_ometif_")) with zipfile.ZipFile(data_path / "fmt_fl_ometif.zip") as arc: arc.extractall...
7e08b1bc2d51eec1f7af5de4b727fb3741402e8a845cbd5c05aae6369484a168
Python
935
23
from distutils.dep_util import newer_group # yes, this is was almost entirely copy-pasted from # 'newer_pairwise()', this is just another convenience # function. def newer_pairwise_group(sources_groups, targets): """Walk both arguments in parallel, testing if each source group is newer than its corresponding t...
a04aae171a52f881e2fe5bf3a9f0cf5350617fe9e425bdd575df07a30f550cb9
Python
935
22
from __future__ import annotations import torch from lightly.loss.dense_relational_utils import roi_resample_to_grid class TestRoiResampleToGrid: def test_output_shape(self) -> None: feat = torch.randn(2, 8, 16, 16) boxes = torch.tensor([[0.0, 0.0, 16.0, 16.0], [4.0, 4.0, 12.0, 12.0]]) o...
b4e62b8ce4d5c8a142b433d650c052e1e88327c2fd187321932e9117e3cfa88e
Python
935
33
"""Handles the TerminalOut Class""" # License: GNU General Public License v3.0 import ipywidgets as widgets from ipywidgets import Widget class TerminalOutput(Widget): """Shows the algorithm output""" def __init__(self, **kwargs): super().__init__(**kwargs) self.out_put = widgets.Output( ...
e04db9d79042f8007b6e5eb5ca61edbd1b1b4d0778f163564e20af248b011030
Python
935
30
from comet_ml import Experiment # isort:skip import tensorflow as tf # Assumes Comet variable environment configuration. # See here to get your API_KEY: # https://www.comet.ml/user/settings/account#section-DEVELOPER_INFORMATION # And here for setup information: # https://www.comet.ml/docs/python-sdk/advanced/#experi...
f9ba5fe88291248f480cd4d5a0534ecff2a647e586bf027fa748db37c72213dc
Python
935
32
from pathlib import Path from typing import Dict, Tuple JOINT_GROUP: Dict[str, Tuple[str, ...]] = { "wrist": ("WRJ1", "WRJ0"), "thumb": ("THJ4", "THJ3", "THJ2", "THJ1", "THJ0"), "first": ("FFJ3", "FFJ2", "FFJ1", "FFJ0"), "middle": ("MFJ3", "MFJ2", "MFJ1", "MFJ0"), "ring": ("RFJ3", "RFJ2", "RFJ1", ...
38655b04aaf34848bd1732308c9cdd51975b1e78f0bf18c7d18b209ef8cd3903
Python
936
33
import os import shutil import tempfile from unittest import TestCase import numpy as np from anndata import AnnData from spateo.configuration import SKM def create_random_adata(layers=None, shape=(3, 3), t=SKM.ADATA_AGG_TYPE): adata = AnnData(X=np.random.random(shape)) if layers: for layer in layer...
28ec7f1e2d2bc1ffa50114560b04446b1388edd5ccbc076b90853bf9ceecc89c
Python
937
38
__author__ = "quentin" import cv2 import numpy as np class EthoscopeException(Exception): def __init__(self, value, img=None): """ A custom exception. It can store an image :param value: A value passed to the exception, generally a text message :param img: an image :type...
bede8d07ba673c3f539bae8923362d939cd8e5ff9f7fa5b11af68ab9ea9e7e4a
Python
937
31
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._domain import Domain from ._hoverlabel import Hoverlabel from ._insidetextfont import Insidetextfont from ._legendgrouptitle import Legendgrouptitle from ._marker import Marker from ._textfont import Textfont from ._title ...
118ca08535db1d1af521afbc2a85e8cae988143ffaaba6d9c790c371a6be3834
Python
938
37
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """"tests for search.py""" import unittest import numpy as np from sknetwork.data import cyclic_digraph from sknetwork.data.test_graphs import * from sknetwork.path import get_dag class TestSearch(unittest.TestCase): def test(self): adjacency = cyclic_dig...
99b31f59e35f1c8012c48a42761886977b368d763dc96b069dd78f6b500899c3
Python
938
33
import numpy as np from .annotation import Annotation class AlternateSites(Annotation): """ Represents a pair of alternate sites, that is, a pair of sites where one should be included and the other should not. """ @classmethod def patterns(self): return ["AA", "DD", "AAA", "DDD"] ...
cf4d2b7203f931a58e26231da1467517b35d9477880f35162a4d58d3a4e28f39
Python
938
48
"""add export association table Revision ID: 59e024ceaca1 Revises: e0e3bb173ee6 Create Date: 2022-10-12 18:02:34.659770 """ from sqlalchemy import ( Column, DateTime, Integer, ) from galaxy.model.custom_types import ( JSONType, TrimmedString, UUIDType, ) from galaxy.model.migrations.util imp...
2f4bd84db8df5f2d330555f15add1c4db80e6872fa324030757429829d7d2faa
Python
939
19
import os import sys import numpy as np """ this is the only script you actually should call, it will submit a job this job makes the features, and then does the regression. only change the home_dir variable, everything else should run! """ homedir = '/cbica/projects/abcdfnets/scripts/keller_ridge/pennlinc-regressio...
3aace398adefd4445c3a4189b80f83b40ab9b43ad571c71d29b6220b48a52a9c
Python
939
37
""" Test a file that Bear had trouble opening """ import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/") sys.path.insert(0, PATH_SRC) import matplotlib.pyplot as plt import pyabf im...
532d40bad87baa4705c289cf8e45b61e661a5bfaa318e7fbf5b63c0a43bcac9a
Python
939
27
from ..parametric import _compute_hommel_value, _true_positive_fraction from nilearn.glm.thresholding import _compute_hommel_value as nl_compute_hommel_value from nilearn.glm.thresholding import _true_positive_fraction as nl_true_positive_fraction from numpy.testing import assert_allclose from scipy.stats import norm ...
59dea0aac4d9e3201eedaf27cd51c00126bf89a2ac408549631376024c9556dc
Python
939
31
import sqlite3 from .db import DB class SurveillanceInfo(DB): def __init__(self): super().__init__() self.table_name = 'KL_surveillance_info' self.table_desc = 'District wise distribution of persons under surveillance (quarantine and isolation)' self.cols = self.getcolumns() ...
63fdb45f3a0e7226ed7f756737caaa4ca27e2a5298e176f2d8b6d0642b396165
Python
939
32
#!/usr/bin/env python # code is same as ~/tools/stats/wiggle_to_simple.py """ Read a wiggle track and print out a series of lines containing "chrom position score". Ignores track lines, handles bed, variableStep and fixedStep wiggle lines. """ import sys import bx.wiggle from galaxy.util.ucsc import ( UCSCLimitE...
69d2228e91e38b5f3b26f3128fcb1f9658501337500be6c3a11a1f5f30ba1604
Python
939
19
import os import sys import numpy as np """ this is the only script you actually should call, it will submit a job this job makes the features, and then does the regression. only change the home_dir variable, everything else should run! """ homedir = '/cbica/projects/abcdfnets/scripts/keller_ridge/pennlinc-regressio...
6ed67e90fa2248503181ba44ec0788157cfa8a5048dcdd1e1916c1915138cbc6
Python
939
1
import numpy as np import pandas as pd import time import random # [1] data preprocessing # df = pd.read_csv('./data/GSE76312_Single_cell_HSCs_expression_RPKM_table.csv', index_col=0) # dimension = (genes x cells) #df1 = df.iloc[0:3,:] print("starting preprocessing:") n1 = df.shape[0] # row genes n2 = df.shape[1] # ...
364d62b15149fe1adea83a1acb636100c8d10d1d463d068313c260097f53901e
Python
940
33
"""Tests for specparam.modes.jacobians.""" from specparam.modes.jacobians import * ################################################################################################### ################################################################################################### def test_jacobian_gauss(): xs...