sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c6b0a8856ee40098bd057174a6a6edf39ea0f1b1b013e2fb16da0514043be524 | Python | 4,918 | 177 | # morphoglia/morphometrics/calculators.py
# -*- coding: utf-8 -*-
"""
Calculator registry for morphometric calculators.
What this provides
------------------
1) A global REGISTRY mapping short names → classes.
2) A @register decorator to register classes under short names.
3) Helpers to instantiate calculators from co... |
ff8c53a41676fee83c0dc4918bbbd768e42ba50d7aa2407e03be9c96f3754111 | Python | 4,918 | 134 | # Node-group asset "Select Cube" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING
i... |
6d8014e15a7bce6769157930e355f8f18f358848e56ee8b3fac85026a9e06e5a | Python | 4,919 | 141 | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
7d4d57ce1cc3d8587dfea3b9c837a3df1b8f88f7a1cf1a2090ebd68aedbdf6dc | Python | 4,920 | 122 | """Tests for query_service module: get_query_handlers and search_hed_objs."""
import unittest
from hed import schema
from hed.models import HedString
from hed.models.query_handler import QueryHandler
from hed.models.query_service import get_query_handlers, search_hed_objs
class TestGetQueryHandlers(unittest.TestCas... |
c27e92c13abc7098f9f18f901b1ca21b6f9ae40494cbff639081c6281b301e87 | Python | 4,921 | 152 | from logging import getLogger
from numpy import (asarray, diff, empty, isinf, nan, nanargmax, nanargmin,
negative, ones, sign, where)
from scipy.signal import fftconvolve
lg = getLogger(__name__)
def peaks(data, method='max', axis='time', limits=None):
"""Return the values of an index where t... |
f70f33a8a478047d5c3bef9203ccb83740c959d2772add18bc8ed7378590bbdd | Python | 4,921 | 119 | import torch
from torch_geometric.data import InMemoryDataset,Data
from os.path import join, isfile
from os import listdir
import numpy as np
import os.path as osp
from imports.read_abide_stats_parall import read_data
class ABIDEDataset(InMemoryDataset):
def __init__(self, root, name,raw_folder='raw_depression_HC... |
1938f8e529ee06759b619c98d69fed948712a3d680e30bdc015a471f772140fb | Python | 4,922 | 149 | import bct
import numpy as np
from tqdm import tqdm
from sklearn.utils import check_random_state
def strength_preserving_rand_sa_trajectory(A, rewiring_iter = 10,
nstage = 100, niter = 10000,
temp = 1000, frac = 0.5,
... |
6ba8fb74431033162a17062b6ef490a8f76099bad18284201a1f67b60ba653c2 | Python | 4,922 | 151 | """
Contains CLEVR metadata and minor utilities for working with CLEVR.
"""
from functools import reduce
from pyccg.logic import *
# CLEVR constants
# https://github.com/facebookresearch/clevr-dataset-gen/blob/master/question_generation/metadata.json
ENUMS = {
"shape": ["cube", "sphere", "cylinder"],
"color": [... |
a99ac967c7beb6dd3333a2bbc97922132c0b0640eaa82ed28794e7baefa8929b | Python | 4,924 | 113 | import unittest
import pandas as pd
from hed import HedFileError
from hed.schema.schema_io.df_util import _merge_dataframes, merge_dataframe_dicts
class TestMergeDataFrames(unittest.TestCase):
def setUp(self):
# Sample DataFrames for testing
self.df1 = pd.DataFrame({"label": [1, 2, 3], "A_col1":... |
5dc31f5f0c88cd3729acb5117ca0457cfab7a03517c69d2199007cadccfe0cb6 | Python | 4,925 | 142 | rest_api_version = 99
def update_param(name, param):
if name == 'metalearner_params':
param['default_value'] = None
return param
if name == 'base_models':
param['type'] = 'list'
param['default_value'] = None
return param
return None # param untouched
extensions =... |
d340e42918a2ddb94dc85f53a9a713c04caf85845160b17ceb62f50df824acd6 | Python | 4,925 | 129 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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
# to use, copy, modify, merge,... |
26dadedbaa65f80e2ef33d9913ca30932385cee86d13a38677148ac619838f86 | Python | 4,926 | 72 | """MINIMAL_FIX.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30s-MINIMAL-FIX.md
The shortest prefix of the 122-sign patch (largest output first) that gives a healthy code in all 50 glomeruli, found with
the rate theory and confirmed with spiking. usage: python MINIMAL_FIX.py"""
import sys, os, hashlib, ... |
093360564826db257d7356cef707a6f3afccf17e931b2b84b62b548c1cc6c017 | Python | 4,927 | 138 | from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsOptionError
import distutils
import os
import configparser
from setuptools import Command
__all__ = ['config_file', 'edit_config', 'option_base', 'setopt']
def config_file(kind="local"):
"""Get the filename o... |
83d7dff9234714c90c0622b1e4ca8bb1354c7aed3c1a54d4996e7f62812ba00d | Python | 4,927 | 128 | from collections.abc import Iterable
from dataclasses import dataclass
from unittest import TestCase
from .template import TemplateExpander
@dataclass
class Template:
content: list[str]
parameters: dict[str, str | list[str]]
def newline_join(lines: Iterable[str]) -> str:
return "\n".join(lines)
def e... |
12be091a1d823980410b31c35cab75b037d026a6ac84d853f0fdfa37b20cf6ab | Python | 4,928 | 130 | from typing import Optional, List
import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from ._functional import soft_dice_score, to_tensor
from .constants import BINARY_MODE, MULTICLASS_MODE, MULTILABEL_MODE
__all__ = ["DiceLoss"]
class DiceLoss(_Loss):
def __init__(
self... |
5ee90d380a55d6b16a8c495804d5f9c6d94c4ede9f3838ad3f46d892dc299918 | Python | 4,928 | 127 | import optuna
import torch
from torch.utils.data import DataLoader, TensorDataset
import numpy as np
from sklearn.preprocessing import StandardScaler
from torch.optim import Adam
from torch.nn import MSELoss
from lightning.pytorch import LightningModule
import pandas as pd
import torch.nn as nn
from optuna im... |
9fe61f88128e6fc9926beddd791f1ca203ee42840a463cee5112dbadc1d25d75 | Python | 4,928 | 159 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
659a52227618cb5e0b9cf1d2fb750ce91d754e94cf571d052352ff8b4627df78 | Python | 4,929 | 127 | #! /usr/bin/env python
# ==============================================================================
# Copyright (c) 2023, Ko Sugawara
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Re... |
32d38292886b8a16de689f49adc9d619969715bafe2b9c03c37dacd989de27e3 | Python | 4,930 | 153 | # 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 agreed to in writing, software
# distributed under th... |
9322169b3dd424f8b25d6aae14113006cb84678fb38282705ae85375ec2e98cc | Python | 4,930 | 112 | # src/preparation/utils.py
# Import public modules
import requests
import re
import tqdm
import collections
class NoProteinQuantityFoundException(Exception):
"""
Custom exception for a specific error case during protein scraping
from UniProt that can be catched and treated explicitly.
"""
pass
... |
f5e8e885a7893d0b6c4ec70058c7efc8b83834d7330bfd77917606bb1dfc6da1 | Python | 4,930 | 162 | import numpy as np
import random
import pickle
import torch
import torch.nn.functional as F
from sklearn.metrics import roc_auc_score, average_precision_score, f1_score, jaccard_score, confusion_matrix, precision_score, recall_score
def ddi_score(outputs, output_thresh, ddi_gt, ddi_adj, ddi_thresh):
num_adm = len(ou... |
f7d55a25f2d3f291f4bb5d4c2ea607db246e816c36167340b5bca49ee984330d | Python | 4,930 | 129 | # -*- coding: utf-8 -*-
import time
import numpy as np
import six
import tensorflow as tf
from tfsnippet.utils import (VarScopeObject, get_default_session_or_error,
reopen_variable_scope)
from omni_anomaly.utils import BatchSlidingWindow
__all__ = ['Predictor']
class Predictor(VarScope... |
293c8199d807ea6b6e6ab50383f6b7b65318f2485de62a3ee503ec6ccbc360ee | Python | 4,931 | 116 | import os
path = "/home/zhaomengdi/Project/eworm/Celegans_as_deep_net_net/chemotaxis_net/components/model"
files= os.listdir(path) #得到文件夹下的所有文件名称
s = []
cell_name_list = ["AWAL","AWAR","AWCL","AWCR","AIYL","AIYR","AIAL","AIAR","AIZL","AIZR","RIBL","RIBR","AIBL","AIBR","SAADL","SAADR","SAAVL","SAAVR","RIML","RIMR","AVEL... |
3b46108938188278f75485e1e58d13502ea6269a193f7552bc5d76aa40fc683b | Python | 4,931 | 100 | #! /usr/bin/env python3
import os
import subprocess
import logging
import APT_interface
class cd :
"""Context manager for changing the current working directory, and automagically changing back when done"""
def __init__(self, path):
self.path = path
def __enter__(self):
self.old_path = ... |
5fab47aa76be7cabad2f71ab70651978c9b4b2aca88f4997e9bb30f3a9af6b71 | Python | 4,931 | 149 | #
# Argument processing utilities for ACME
#
# Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Builtin/3rd party package imports
import numpy as np
import collections
import logging
from typing import List, Dict, Any, Tuple, Optional
from numpy.... |
8ef7949782a9ba6ad2eaa6bd6070cba71a49174bc4ef87b73cac37ed1379f81a | Python | 4,931 | 146 | """
1d simulation of a plane wave propagating through a Kerr medium
and generating the third-harmonic frequency component.
ref: https://meep.readthedocs.io/en/latest/Python_Tutorials/Third_Harmonic_Generation/
"""
from typing import Tuple, List, Union
import numpy as np
import matplotlib
matplotlib.use("agg")
import... |
07a50b23cfa26f854762706c2ffe33c252784f61e273049a8d00c26f1483d4e2 | Python | 4,932 | 84 | """ONE_DOOR.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30i-ONE-DOOR.md
Is il3LN6 the cause of the right-side sugar explosion (Santos 2026), or one door into an unstable antennal lobe?
Single sign flips of the 90 uncalled excitatory AL local neurons and 40 control neurons, plus two re-entry tests.
usage: p... |
7b76418d87f9081b0c7ef3736b243509d72d58bd904de71a2ee591479d340f90 | Python | 4,932 | 217 | #!/usr/bin/env python3
#******************************************
#
# SHARC Program Suite
#
# Copyright (c) 2023 University of Vienna
#
# This file is part of SHARC.
#
# SHARC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
... |
b33530fce36eeb2d1e71e62920ace74e0a9c8ae85e7de603af14fedad538a357 | Python | 4,932 | 82 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
def main(revisions=None):
suite=suites.suite_optimal_strips()
suite.extend(suites.suite_... |
c32528b19692b7850c33948dc1eb35a0fa7d8051b244015b5d4d949472202b72 | Python | 4,936 | 148 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
136c883be8c2a983649d5ca146ffed019263e36a2753d88e356dfb4686ed2410 | Python | 4,939 | 108 | import datasets
import lightning.pytorch as pl
from hicdiffusion_model import HiCDiffusion
from lightning.pytorch.callbacks import ModelSummary
from lightning.pytorch.loggers import WandbLogger
import matplotlib.pyplot as plt
import matplotlib
from scipy.ndimage import gaussian_filter
from torchmetrics.image.fid import... |
7e9ef76890637134d0797c2c79abf63fe269e8b22837f50b73b80e283454cc2f | Python | 4,939 | 154 | """Utilities for manipulating geometry of morphology reconstructions."""
import math
import numpy as np
from treem.io import SWC
# pylint: disable=invalid-name
# pylint: disable=too-many-locals
def rotation_matrix(axis, angle):
"""Computes rotation matrix for 3D manipulations.
Args:
axis (float[3]... |
d44fbf6c822138accc8ab4e8d595136c3a03c42bf065b7c6463f0d7785bfb3a5 | Python | 4,939 | 108 | import os
import sys
import time
datadir = sys.argv[1] # should point to the directory where the fast5 & reds dir exist
uncalled_exe = sys.argv[2]
model_name = 'uncalled'
# Python Script Paths
exedir = "../run_scripts/" # the path to HierarchyCall's test/run_scripts dir
uncalled_script_path = "run_uncalled.py "
ex... |
1714127a7ae455db0ed07ecc69832ef5fa7d04f8d3e63217337ea08ca62cf31a | Python | 4,940 | 156 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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
# to use, copy, modify, merge,... |
f0f41e027e611493c92e83f00a67c61699dd9b244336daf9c645b550d31dd081 | Python | 4,941 | 88 | """FAST_LIF.py 2026-10-07. The same simulator as SHIU783_SIM.run (Brian2 behaviour, one trial), computed only on the
neurons that have left rest. A neuron at rest (v = v_0, g = 0, not refractory) stays exactly at rest under the model's
update, so it can be skipped until an input reaches it; the state of the touched neu... |
17dde54f4586a0014bc25fa2df26b3a97920b760ccd762bca04a7f866b3d6517 | Python | 4,942 | 143 | import pysam
from pybedtools import BedTool
import sys
import numpy as np
from tqdm import tqdm
import pyfaidx as pf
bam = pysam.AlignmentFile(sys.argv[1], "rb") # aligned bam
bed = BedTool(sys.argv[2]) # aligned bed
output_bam_name = sys.argv[1][:-3] + "m6A.tagged.bam"
header = bam.header.to_dict()
output_bam =... |
4d5eadbfd5134efe0d7a8f975acc70e21b3a19d6f13d88cc8c1a3f14ba92108d | Python | 4,942 | 150 | #
#
# 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.txt
#
# Unless required by applicable law or agreed to in writing, software
# dis... |
ffd394e77897b951dbd83af47fa49df471a6e0b3a7488784691bf93fa4d89176 | Python | 4,944 | 148 | # USAGE
# python detect_mask_video.py
# import the necessary packages
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
from imutils.video import VideoStream
import numpy as np
import argp... |
3f28d8ed32d379bc4c1a17e8412a6cf2c1d0771cf11def158b24947154fdc812 | Python | 4,945 | 148 | ##
# \file wrap_itk_registration.py
# \brief Class to use registration method based on SimpleITK
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date Aug 2017
#
# Import libraries
import os
import numpy as np
import itk
import SimpleITK as sitk
# Used to parse variable arguments to SimpleITK... |
6694521ab2577ea9b6d480d83091b4c43d8c39e6373a1b986c571df4898a1fb3 | Python | 4,945 | 192 | import numpy as np
from scipy.ndimage import gaussian_filter, percentile_filter
# imageJ ROIs
from read_roi import read_roi_zip
# images
from PIL import Image, ImageDraw
from skimage.draw import polygon, ellipse
from skimage.color import gray2rgb
from matplotlib import colors
def read_imagej_rois(p_roi, res_yx):
... |
2d2ed4adb81bba1ff51fc8c1468d9e91bb73b1c2581d11bc46965168265dddcd | Python | 4,946 | 140 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
5be7085af55a229ab245e3fc22e954de6c21f3958c01a2624b6b08483e6695df | Python | 4,946 | 97 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... |
78a0a3c4f0751ca33f31333b5d47a75fea5213050f263506b867ee2e8b4b7c5d | Python | 4,947 | 146 | """RegistrationApp version + update-available awareness (issues #124, #125).
The check runs synchronously via sync_for_tests=True, with the updater's
git-facing functions monkeypatched (same seam as test_hub_version_badge.py), so
no real git/network happens.
"""
import os
import sys
PROJECT_ROOT = os.path.... |
812a90948c358e692b497fe98334057f04f0b382ea0322d5a8dacf717c4d9fce | Python | 4,948 | 154 | '''
Created on Feb 20, 2017
@author: jumabek
Acquired from https://github.com/Jumabek/darknet_scripts/blob/master/gen_anchors.py
'''
from os import listdir
from os.path import isfile, join
import argparse
import numpy as np
import sys
import os
import shutil
import random
import math
width_in_cfg_file = 224.
height_... |
b83d2a3ddbda5ef1f87b3b096074dbe87b4f27d5656d85949c54453727e0db7f | Python | 4,950 | 128 | """Testing CLI command modify."""
import os
import subprocess
def test_scale(tmp_path):
"""Tests for scaling of dimensions."""
os.chdir(os.path.dirname(__file__) + '/data')
proc = subprocess.Popen(['swc', 'modify', 'pass_simple_branch.swc',
'-s', '1', '1', '1', '-e', '2',
... |
e7ff64367dae65031b3713e6d362d226712e316696cb663bce499aaa111e425c | Python | 4,951 | 134 | from unittest import TestCase
from pyseg.globals import *
from pyseg.disperse_io import *
from pyseg.factory import MembInterSkelGraph
from pyseg.vtk_ext import vtkClosestPointAlgorithm
from pyseg.vtk_ext import vtkFilterRedundacyAlgorithm
import vtk
import numpy as np
__author__ = 'martinez'
# Test variables
TEST_RE... |
0d4beb3b2b9876b9207a907b30a2e4d6815f2429515bb66682833cb8d54a228b | Python | 4,952 | 135 | from unittest import TestCase
from pyseg.globals import *
from pyseg.disperse_io import *
from pyseg.factory import MembTransSkelGraph
from pyseg.vtk_ext import vtkClosestPointAlgorithm
from pyseg.vtk_ext import vtkFilterRedundacyAlgorithm
import vtk
import numpy as np
__author__ = 'martinez'
# Test variables
TEST_RE... |
75267268a4d4e2ca4dd441c386726e0f188c2dcc3cba0f5f0e3192f0853e6832 | Python | 4,952 | 126 | from torch.utils.data import Dataset
import random
import os
import numpy as np
import pandas as pd
from mylib.voxel_transform import rotation, reflection, crop, random_center
from mylib.utils import _triple, categorical_to_one_hot
class LIDCSegDataset(Dataset):
def __init__(self, crop_size, move, data_path, tra... |
a478a0a68784d19c70f186ad6704ca4c856f7188d1ea80f5bfced9b27b8e92f7 | Python | 4,952 | 126 | """Batch cancel marks remaining rows 'skipped', not 'pending'/'failed' (#121);
and the interrupted (cancelled/timed-out) row's partial output is marked
incomplete so it can't be mistaken for a finished result (#120/#3.4)."""
import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import pytest
from un... |
232c64ed532938c2fd5101ad9b4b31cc823db24bf81175cd7487d90e489b4269 | Python | 4,953 | 137 | from functools import partial
from typing import Any, Optional, cast
import torch
from elasticai.creator.base_modules.lstm import LSTM
from elasticai.creator.base_modules.lstm_cell import LSTMCell
from elasticai.creator.base_modules.math_operations_torch import TorchMathOperations
from tests.tensor_test_case import T... |
409d463e35a826d06b352ae8baf21a307ba649dd30afe962860e7b4b780704df | Python | 4,953 | 143 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
0a4c52e5e35fc4a1a1a81070ac77701cd262f614f30f6234daaa400ee08b5b04 | Python | 4,954 | 120 | import os.path
import pandas as pd
from ckg.graphdb_builder import mapping as mp, builder_utils
#####################################
# Textmining (JensenLab.org) #
#####################################
def parser(databases_directory, importDirectory, download=True):
config = builder_utils.get_config(conf... |
75e4bf17ad565286370c6bf0ca9c4216f30a41601564d2c054a99f4a9afc7cde | Python | 4,954 | 138 | """
Script to fit spline model to all pre and post drop tc on hpc. Load pre-computed
tc and fit model to each tc.
ATTENTION(1)1: run from high performace computer; run script from shell with argument
from 0-24, one for each recording.
ATTENTION(2): requires first generation of tc_all_data_nowhisk_compare.pickle file,... |
6dc40ba673b7f3c6fbafdaa03aa59c418e15e7fd9aca6bf1f211dfaeb5b866eb | Python | 4,955 | 126 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 28 23:49:22 2022
@author: felipe
"""
import sys
import os
sys.path.append(os.path.abspath('../'))
import analysis.frequency as frequency
import analysis.synchronization as synchronization
import matplotlib.pyplot as plt
import matplotlib.gridspec ... |
4268448b6345ed539c3e6e7486779395de332563da5c825d520d060d99a9f69e | Python | 4,956 | 131 | from __future__ import annotations
import re
from typing import Any
from wikibaseintegrator.entities.baseentity import BaseEntity, TermsEntity
from wikibaseintegrator.models.aliases import Aliases
from wikibaseintegrator.models.descriptions import Descriptions
from wikibaseintegrator.models.labels import Labe... |
1dc1b22399fe80097bf5ff4cd6779f7a8f1bcba5866be1de7591336987cb522b | Python | 4,958 | 206 | import warnings
import pytest
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import grad
from autograd.test_util import check_grads
npr.seed(1)
def test_grad_fanout():
fun = lambda x: np.sin(np.sin(x) + np.sin(x))
df = grad(fun)
check_grads(fun)(npr.randn())
check_gra... |
86abbf8ad19cacf046cf9bdd0645d67083b0f7d913f82186b4d62562a48bad5d | Python | 4,958 | 132 | import sys
import random
import os
import argparse
import sys
import pwd
import time
import subprocess
import re
import shutil
from sklearn import metrics
import re
from sklearn.metrics import roc_curve,roc_auc_score
import numpy as np
import glob
import logging
import io
import tensorflow as tf
#from callbacks import... |
9e1c483ea9e7111ce86a3f85a78920b7d8b7098003e2d5da6023befa08a96dc6 | Python | 4,960 | 128 | from collections.abc import Iterable
from dataclasses import dataclass
from unittest import TestCase
from elasticai.creator.file_generation.template import TemplateExpander
@dataclass
class Template:
content: list[str]
parameters: dict[str, str | list[str]]
def newline_join(lines: Iterable[str]) -> str:
... |
2db87bd3dec3a7e95227994cd8eaeeee3f4ca89699db8b733be46eebc842ec04 | Python | 4,961 | 131 | from __future__ import annotations
from dataclasses import InitVar, dataclass, field
import numpy as np
from SurvivalEVAL.nonparametric_estimator.util import _compute_event_counts
@dataclass
class NelsonAalen:
"""
Estimate the cumulative hazard and survival functions with Nelson-Aalen increments.
The ... |
69b4f9d31e03df32e57eda12667a01972c58e94577bf5213bd8293a3e21dd049 | Python | 4,961 | 141 | #!/usr/bin/env python
from __future__ import print_function
import cProfile
import pstats
from examples.discrete_belief.dist import DeltaDist, MixtureDist, UniformDist
from examples.discrete_belief.run import revisit_mdp_cost
from pddlstream.algorithms.incremental import solve_incremental
from pddlstream.algorithms.... |
919bdfaa15352c613e88a0d50a03123e4f657380a62b70775a1c1b98d6e3e264 | Python | 4,961 | 137 | ##
# \file evaluate_simulated_stack_similarity.py
# \brief Script to evaluate the similarity of simulated stack from
# obtained reconstruction against the original stack.
#
# This function takes the result of simulate_stacks_from_reconstruction.py as
# input.
# \author Michael Ebner (michael.ebner.... |
175d19d0b4a7d5f3836d28bd6a689c31343842a9bf2512d71a30a29f2649c8f9 | Python | 4,962 | 173 | import random
import math
from dreamcoder.utilities import *
def simulateWithoutPhysics(plan,ordered=True):
def overlap(b1,
b2):
(x,w,h) = b1
(x_,y_,w_,h_) = b2
x1 = x - w/2
x2 = x + w/2
x1_ = x_ - w_/2
x2_ = x_ + w_/2
if x1_ >= x2 or x1 >= x2... |
0609d68d7333b82e36d6ebe6288c31afe32d1de338ae7397b798a3c0d86cef71 | Python | 4,963 | 134 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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
# to use, copy, modify, merge,... |
1f6cd9cc5bf05b26e2e6f30a27ed6cda4c42a52001a7bb885f8ee767f045894b | Python | 4,963 | 169 | #!/usr/bin/env python
"""
Writes dax files or tiff files. This is mostly used
by the simulator.
We try and follow a convention were the first dimension (slow
axis) is the image height and the second dimension (fast axis)
is the image width, so image.shape = [height, width]
Hazen 1/18
"""
import numpy
import os
impo... |
b60aef354b271c6c8bea6bd068f3eeadbc99dfc68f4333352f3881b8f5532225 | Python | 4,963 | 222 | from __future__ import annotations
"""
Developer-level defaults for atomic preprocessing operations.
The existing FluorescenceV1Config values still override the matching entries
for the canonical fluorescence_v1 preset. Additional operations can be tuned
here without expanding the normal PipelineConfig surface.
"""
... |
d3fd7f5cef33fc22e17a03f75697fd549df325c7cb9b434e1d133e8b4624cf7a | Python | 4,963 | 170 | import itertools
from .compat import collections_abc
class DirectedGraph(object):
"""A graph structure with directed edges."""
def __init__(self):
self._vertices = set()
self._forwards = {} # <key> -> Set[<key>]
self._backwards = {} # <key> -> Set[<key>]
def __iter__(self):
... |
23d26d98acf5f8c76636867d8cf5afb0d2dfd1cc1902f0baa84a219bd7f59b9e | Python | 4,964 | 155 | # Plots sum of coefficients as a function of regularization strength for
# feature selection to classify preferential parameters for Fig 7A
from os.path import join
from get_paths import *
import classification
import numpy as np
import matplotlib.pyplot as plt
from TVATAnalysis import TVATAnalysis
from co... |
5c21a1020f8e968aa38b93c51a664f43934d24e50a90184ebaf5c23b60439e1f | Python | 4,964 | 153 | #!/usr/bin/env python
import errno
import glob
import multiprocessing
import os
import subprocess
import sys
CONFIGS = {}
script_dir = os.path.dirname(__file__)
for config_file in sorted(glob.glob(os.path.join(script_dir, "*build_configs.py"))):
with open(config_file) as f:
config_file_content = f.read()
... |
f04c4beb7b6417df79b04f4b4b5898fb289ddb5760d96cce4158f2caabeedc81 | Python | 4,964 | 123 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... |
5cb26e98b2aa3ce9ec0ea17f889ced7b1ac6949908a8aa4fec2172980f921d67 | Python | 4,965 | 202 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 2 09:38:22 2021
@author: leupinv
"""
import mne
import source.source_constants as cs
import os
def check_dir(file_path):
if not os.path.exists(file_path):
os.makedirs(file_path)
def check_type(check_obj,list_type):
for check in li... |
62045e7b94bdb8daa7dbb37da5990f57379e4cd77a9e73d48757f5d048b12915 | Python | 4,965 | 137 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from typing import Any, Dict, List, Optional, Tuple, NamedTuple
import torch
from torch import nn
from torch import Tensor
imp... |
5fa11f4769e91e74ccceae80aef113251598d9774f79522359fd609b7adaaeaa | Python | 4,966 | 126 | """Explicit-mask pathway for exterior-boundary Laplacian correspondences.
Expert-drawn brain masks must be used verbatim as Dirichlet boundary
conditions. The threshold path applies binary_closing(iterations=2), which
smooths concavities -- exactly the fissures that matter in a brain mask.
"""
import numpy as ... |
7cdc4e4950f46ae125b03f1f37db6eab9a6c7e0310f91141b43e17e608e54648 | Python | 4,966 | 120 | """
pip._vendor is for vendoring dependencies of pip to prevent needing pip to
depend on something external.
Files inside of pip._vendor should be considered immutable and should only be
updated to versions from upstream.
"""
from __future__ import absolute_import
import glob
import os.path
import sys
# Downstream r... |
68796baceb2e10712c8dfa2cd33e9bd80e1d0736dc7050d7f2aae4cfc5f0fd57 | Python | 4,967 | 129 | """Remap cell points between the brain canvas frame and CCF voxel
coordinates using the saved CCF->brain alignment transform.
The editor's output (``modified_annotation.nii.gz``) lives in the
brain pixel frame so cell points (also in brain frame) can be
counted directly. Downstream analyses that want labels in CC... |
6c384881830c25b6038a000725d565f748c1192541b9ea97427f8dc1f54140ba | Python | 4,969 | 137 | """Last-used choices for the single-image registration tab.
The registration tab forgot every choice on each launch - the user had to
re-pick the atlas/template, registration method, hemisphere, template-slice
index and moving-µm pitch every single time. This module persists those
last-used values to a small JSON... |
99e6ce0608177520eb1a065c07d9e2e98a5673373d253c29974a51c6a64635ae | Python | 4,969 | 172 | #coding: utf-8
"""
Wet-Chicken benchmark
"""
import numpy as np
import matplotlib.pyplot as plt
import os
import gym
from gym import spaces, logger
from gym.utils import seeding
class Environment(gym.Env):
''' Benchmark '''
def __init__(self, init_state=None,seed=3):
super(Environme... |
b1d50d05530742248003c80b4096da927928b6dc7e5489eeb1dd1a0c3f93fa08 | Python | 4,969 | 116 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.widgets_tracking as widgets_tracking
import control.camera_TI... |
c9c7ab35e0cbc5dd7c9922c258b1c5efa7d5f8a018b4c989baf63bd4f5a85d95 | Python | 4,969 | 113 | import functools
import inspect
import marshal
import os
import types
from pathlib import Path
import joblib
import numpy as np
import pandas as pd
import torch
from ..utils import (ensure_cache, compute_fingerprint as _compute_fingerprint,
validate_cache, compute_checksum)
def _describe_v... |
604158c8107b79a49e05b67ad0e08e550c3b73b097a8246ebf3d940414ee56b6 | Python | 4,970 | 137 | from math import pi
import numpy as np
import scipy.special as sp
from .utils import slice_same
from .orbutils import LinearRGD, GridFunc
from .from_gpaw.gaunt import gaunt
# from .lcaodata import pwc
from .matlcao import MatLCAO, pwc
from .constants import TWOCENTER_RGRID_DEN
class TwoCenterIntgSplines:
'''
... |
913146b1d19ed28b3bb572e71caa704c8f7409712fadc79e6460ac866272e73c | Python | 4,970 | 141 | from typing import cast, List, Optional, Tuple, TYPE_CHECKING, Union
if TYPE_CHECKING:
from .console import (
Console,
ConsoleOptions,
RenderableType,
RenderResult,
)
from .jupyter import JupyterMixin
from .measure import Measurement
from .style import Style
from .segment import... |
64f33b8fd2defa38fc2376af911d653a36d2a6a718476854b2c9c24935caae57 | Python | 4,971 | 170 | #!/usr/bin/env python
"""
Writes dax files or tiff files. This is mostly used
by the simulator.
We try and follow a convention were the first dimension (slow
axis) is the image height and the second dimension (fast axis)
is the image width, so image.shape = [height, width]
Hazen 1/18
"""
import numpy
import os
impo... |
08dbd4a5f2d6d53efc785a862352d44ef8dda936ff83246b7c8978bcfbfbd88f | Python | 4,972 | 128 | import logging
import os
import traceback
from os import PathLike
from typing import List, Union
from tqdm import tqdm
from NDATools import exit_error
from NDATools.Utils import get_directory_input
from NDATools.upload.batch_file_uploader import BatchFileUploader, Uploadable, BatchResults, UploadError, \
UploadCo... |
6a6e21fd5c208a6ef7cbc32097d26af4c79227054e6939d6728665a306892a12 | Python | 4,972 | 138 | # count.py
import numpy as np
import pandas as pd
from umi_tools import UMIClusterer
from umi_tools import __version__ as umi_tools_version
from collections import defaultdict, Counter
from fba.utils import open_by_suffix, get_logger
logger = get_logger(logger_name=__name__)
def generate_matrix(matching_file,
... |
32a4cee727d0031616ffd911f488d9a51fd0f81bb02f6f67fdc5e8e003534742 | Python | 4,973 | 73 | """FLY_LIKE_2G.py 2026-09-29. Pre-registration: 04-NOTES/PREREG-2026-09-29h-FLY-LIKE-2GAINS.md
M** = laboratory prior + fly ORN-synapse depression + ORN output x g + excitatory-LN output x s; (g, s) by leave-one-odour-out
on Seki odours (AL cut-out); then at rest (Hallem resting rates, whole brain) at (g*, s*).
usage: ... |
78340b03714c15fed428ce9a0e2c099d79609df62221ffa58cba4412954282c1 | Python | 4,973 | 96 | """Short steering-layer sensitivity check on identical token contexts (no training, fixed projections).
For each steering layer, the same contexts and 16 forced continuation tokens are scored with the
reservoir started from the same recorded state, and compared with Clean. The intervention size
is `strength x RMS(hidd... |
e2dcb02f809e1941d04584c167f5df4690d6f219c26791dacd52ed5ca5f1afba | Python | 4,976 | 152 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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
# to use, copy, modify, merge,... |
77499f92403ccb0389fd9cdb091749a11e236461a5343a3c68794f7ca1ead158 | Python | 4,977 | 131 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
a69ac3b429b89a42de2c17c5062f05ab597316e40d3499e901896a5d8c457333 | Python | 4,977 | 129 | import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import os
class ES_Adaptive:
"""
This class works for both binary/weighted directed/undirected networks.
"""
def __init__(self,
adjacency_matrix,
num_nodes,
lambda_o,
... |
09f15fa063cd6337fee32e650c797f455acd9d455ba5314ae054c9c6a8dc7b96 | Python | 4,978 | 106 | import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.layers import Input, Embedding, GlobalAveragePooling1D, Dense, Dropout,LayerNormalization
from tensorflow.keras.models import Model
from tensorflow.python.keras.optimizer_v2.adam import Adam
class Mult... |
1357369e82dc1e97a959aa00597626357d35f8120504045ad04385fbd7d1b316 | Python | 4,978 | 150 | # Node-group asset "Select Proximity" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECK... |
a8ad8c7a75584c72b9a850e1262448b45cc037d064c4ec70855e29ebef537822 | Python | 4,979 | 134 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Figure 2 of paper Functional subnetworks
@author: felipe
"""
import sys
import os
sys.path.append(os.path.abspath('../../'))
import analysis.frequency as frequency
import analysis.synchronization as synchronization
import numpy as np
import scipy.io as sio
import sci... |
a33ad82af31f7115ee326e82ad0f4e72d33e2ccef327d06f7d5fc42c5c9f93a8 | Python | 4,980 | 149 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
fea966efee79d61fc61f26bbc64f0c98bf7cb8531dc9c9a09bce25d56dbb1d8c | Python | 4,980 | 111 | import unittest
import torch
import numpy as np
from torcheeg.transforms import ToTensor, Resize, RandomNoise, RandomMask, RandomWindowSlice, RandomWindowWarp, RandomPCANoise, RandomFlip, RandomShift, RandomChannelShuffle, RandomFrequencyShift, RandomSignFlip, Contrastive
class TestTorchTransforms(unittest.TestCase):... |
129fa6f23777be814ee85bf9edc506166cfa25503aec8120ca204ec2fd0de1ad | Python | 4,981 | 154 | """
pygments.formatters.irc
~~~~~~~~~~~~~~~~~~~~~~~
Formatter for IRC output
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pip._vendor.pygments.formatter import Formatter
from pip._vendor.pygments.token import Keyword, Name, Co... |
f779e650770392557013911d8ff80a59c96ae9f4c6e51e6e55323a8069962924 | Python | 4,982 | 147 | """"""
"""
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free softw... |
858e36110a98efd8712466f0baaebb3eeaf0e6b2f73146a484278df902bb84b8 | Python | 4,983 | 121 | # Script to analyze experimental or simulated neuronal network activity for Fragmented Burst detection # Doorn et el. 2024
# Written by Nina Doorn
# last edit: 19-02-2024
# n.doorn-1@utwente.nl
import scipy.io as sio
from brian2 import *
from scipy.stats import norm
import numpy as np
from scipy.signal import find_pe... |
f47d312585bd53a340cda488aafe5b19dfe1db69c7bf073dd03e00cd62bf039b | Python | 4,983 | 121 | """Paired statistical tests on the per-case scores recomputed on 2026-09-29.
The scores in scores/*_2026-09-29.csv were recomputed with meta24_compute_metrics.py
from the predictions in nnUNet_predictions/Dataset222_SBT/*_preds. All models are
evaluated on the same 10 SBT test cases, so the tests are paired (Wilcoxon ... |
a3c2973cba7be080745f29f2c5e2c1de61ded5d398c4e3134c53d60f7bcb33bf | Python | 4,984 | 215 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA, KernelPCA
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import make_pipeline
import random
from pipeline import ProteinDataset
from pipeline.utils import average_structures
model_id = 170 #identifier of ... |
a6182a690093f5ad01154c511c7a52b15e16bc868516c2f7287bc307c45bbbd8 | Python | 4,984 | 137 | import argparse
import pathlib
from pathlib import Path
import json
import os
from collections import OrderedDict
import shutil
import sys
import nibabel as nib
import numpy as np
import re
from tqdm import tqdm
def query_yes_no(question, default="yes"):
valid = {"yes": True, "y": True, "ye": True, "no": False, "n... |
a67d40b16571078042c53cade30bab3dd20e4f2e0418e28b79cd3a795b971550 | Python | 4,984 | 130 | """Single-image RegistrationTab preflight validation (#7).
Built under offscreen Qt. Verifies that ``_validate_before_run`` /
``_validate_with_widgets`` surface problems AND identify the offending control,
and that ``_thread_register`` aborts (never launches a job) when the tab is in
an invalid state.
Construc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.