sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d1002502a8462e49cae9a2dc79897df574e17181cd7081646fb9a968077beb14 | Python | 7,126 | 247 | # 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... |
0d285a5d183483f136c4ce2ffea1dadfbcee4c9f9f27d35e0a80edc6f3746130 | Python | 7,128 | 207 | # Written by Greg Ver Steeg (http://www.isi.edu/~gregv/npeet.html)
import scipy.spatial as ss
from scipy.special import digamma
from math import log
import numpy.random as nr
import numpy as np
import random
# continuous estimators
def entropy(x, k=3, base=2):
"""
The classic K-L k-nearest neighbor continuo... |
8215c1ee2189c39d2733066c39255a7f4cc53ae8dc5f3ceb8d507ca7981b0076 | Python | 7,129 | 163 | import warnings
from unittest.mock import patch
import numpy as np
import pytest
from SurvivalEVAL.nonparametric_estimator.competing_risks import (
AalenJohansenCompetingRisks,
)
from SurvivalEVAL.nonparametric_estimator.single_event import KaplanMeier
def test_km_greenwood_variance_shapes_sides_and_step_tail()... |
59f08c183b900e33f306d1535f4e4e223b363a854a9ac5e14d120006f3336e3c | Python | 7,130 | 205 | # -*- coding: utf-8 -*-
"""Creates a segmentaion file for statistical analysis containg the global offsets."""
import os
import logging
import time
import csv
import itertools
import operator
from datetime import timedelta
# import pyseg as ps
from pyorg import sub
logging.basicConfig(format='%(asctime)s %(message... |
8d6b57d3a8c0272b58ae42433aa125b3dee60a4c87452664a2a5256cc2b941ec | Python | 7,132 | 223 | """Base API."""
from __future__ import annotations
import os
from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import sys
if sys.version_info >= (3, 8): # pragma: no cover (py38+)
from typing import Literal
else: # pragma: no cover (... |
c0182c7f09a6e6b53f7b345fe715624a35f59a60bcd62cf286f90b6f2f45513f | Python | 7,132 | 217 | # 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... |
42a69fb162392cce435947b52ecd65dc58d7a83dbcadd1437e122a82da4d99c6 | Python | 7,134 | 229 | from contextlib import ExitStack
from pathlib import Path
import cocotb as ctb
import pytest
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge
from elasticai.creator.file_generation.resource_utils import get_file_from_package
from elasticai.creator.testing import eai_testbench
pytest_plugins = "e... |
5c24050c78cf8ba00760d759c32d2d034d87f89878f09a7e1ef0a378b78ba775 | Python | 7,134 | 195 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
try:
from msvcrt import get_osfhandle
except ImportError:
def get_osfhandle(_):
raise OSError("This isn't windows!")
from . import win32
# from wincon.h
class WinColor(object):
BLACK = 0
BLUE = 1
GREEN = 2
... |
856ae3bf2fbba6c3d6634c5233bb4b978d5dd49118f240c4a5fbda777db882b9 | Python | 7,135 | 136 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Created on Fri Apr 8 11:29:57 2022
# @author: caroline
"""
Compute logistic regressions of the weights of priors and sensory likelihood for each subject.
# Fit weights of priors and likelihood in T1
## With bayesian combination (= bayesian decision and generative... |
4eae783993a5500adfae5847753bdfc824f84a34e6a61cee86dae96e8336c5ec | Python | 7,136 | 185 | # 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... |
397cafc83d5ac7d217dc2f8ef670204f9e6e80a09c6ab7fe291b1bad2963b74e | Python | 7,139 | 174 | import sys
import traceback
from pathlib import Path
from PIL import Image
import numpy as np
import cv2 as cv
from tqdm import tqdm
from wsilearn.utils.cool_utils import ensure_dir_exists, remap_arr, is_string, is_string_or_path, showims, showim
from wsilearn.utils.parse_utils import parse_string
from wsilearn.wsi.w... |
f61472e790637652e53861996d9a7ceb1327267b3e4073fc4a71023601450d99 | Python | 7,139 | 162 | #!/usr/bin/env python
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Collection of traffic scenarios where the ego vehicle (hero)
is making a right turn
"""
from __future__ import print_function
import sys
import py_trees
import carla
fro... |
151ca143254dc0d1af4476738ab8b67a48ed15f3f28fb145a85e9543fc27b295 | Python | 7,141 | 240 | """
Image processing utilities for preprocessing and artifact removal.
Consolidated from gui/gui_shared.py
"""
import time
import numpy as np
import cv2
import skimage
from scipy.ndimage import binary_dilation, binary_erosion
def normalize_to_uint8(image: np.ndarray, pct_lo: float = 1.0, pct_hi: float = ... |
625dfece4bc4a0087af1fa781e12d597f30b21ee0271da1abd4dd48b70a81b85 | Python | 7,141 | 190 | import abc
import csv
import enum
import json
import logging
import os
import time
from collections import defaultdict
from typing import List
from NDATools import NDA_TOOLS_VAL_FOLDER
from NDATools.upload.cli import ValidatedFile, ValidationError, ManifestValidationError
logger = logging.getLogger(__name__)
class ... |
6a97861633c6c7541ab1028655772e9c28ad17e81c289744bd104879b10a4f5b | Python | 7,141 | 188 | """
Add the particles in a ListTomoParticle to another
Input: - ListTomoParticle STAR file where particles are added
- ListTomoParticle STAR file from where particles are read
Output: - A ListTomoPaticles with the particles of the two input lists
"""
################# Package import
impor... |
5f48ba5c2be0074010c8e421f0a4d5412dc37680df7c0e687c78fdb8048eeb9f | Python | 7,143 | 86 | import numpy as np
import scipy.stats
import sklearn as sklearn
def model_compare_predicted_to_actual(target_actvect, pred_actvect, comparison_type='conditionwise_compthenavg'):
nNodes=np.shape(target_actvect)[0]
nConds=np.shape(target_actvect)[1]
nSubjs=np.shape(target_actvect)[2]
## fu... |
f08bd907ec07e4d6577cc75e149c5e36394d130cbebbeab04d67925fd2e6ad10 | Python | 7,143 | 128 | # 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... |
09daf5192e3d1a18af038a2c67926c58b9ea1cf1d8e55909e226d0dfc218ba4a | Python | 7,144 | 184 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Contents of this file were adapted from the open source fairseq repository.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import math
from typing import Dict, List, Opt... |
84ae310060f6c3facf4167606a5b08c3d953f8e0ff64ac1a1d5e4fe4c0eb877b | Python | 7,145 | 141 | from ..neuralnodes import utils, NL, kernel, func
from ..neuralnodes.utils import gausswin
from functools import partial
import numpy as np
import jax.numpy as jnp
import jax.ops
from .params import Params
from functools import partial
def to_int(x):
return jnp.array(x, dtype=int)
# @partial(jit, static_argnums=... |
e5240d2418303b735263bb7e958aacbac7d6d82d5a3667ad8d0f7877cc590056 | Python | 7,145 | 230 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 13 18:51:40 2021
@author: divyoj
"""
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.animation import FuncAnimation
import numpy as np
import seaborn as sns
sns.set_style("whitegrid")
start=50;
stop=50;
step=10
def calculate_delt... |
b8a39ca158fd37ff0ec278077f3534fea314d0507a9bcc43c4726b8be78298d4 | Python | 7,146 | 146 | from __future__ import print_function
from collections import namedtuple
from copy import deepcopy
from pddlstream.algorithms.common import add_fact, INTERNAL_EVALUATION
from pddlstream.algorithms.downward import make_predicate, make_preconditions, make_effects, add_predicate, \
fd_from_fact
from pddlstream.langu... |
104aaa74109b7a203af39b5c90a6a2597f8564611ce6681b3cb7a41fe6d556b6 | Python | 7,147 | 187 | from __future__ import annotations
import numpy as np
import pytest
from bayes_opt import BayesianOptimization, SequentialDomainReductionTransformer
from bayes_opt.target_space import TargetSpace
def black_box_function(x, y):
"""Function with unknown internals we wish to maximize.
This is just serving as a... |
7fab29589a9ada7c242495eecc37a03db6c843c50ef3aaa897cc4971c2056b15 | Python | 7,148 | 140 | import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sns
from src.analyze.utils import init_mpl
colors = init_mpl(sns_style='ticks', colorpalette='muted')
def get_model_comparison_predictions(results_dir_reg_v1, results_dir_mlc, results_dir_reg_v2,
... |
509d7cbb2e145e0dfddbc5fb6c57d927e97b8e78b2ce80da708a3e4d726ea898 | Python | 7,149 | 162 | # 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... |
50c5b6ed4b1f5a7ed80edb487bef8c2d416137aaf8469df403f54751cd068e3e | Python | 7,149 | 184 | """"""
"""
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... |
6445b3a0e5b87197ab4b7571e9559e592cf22c5b1e55a11f6ca6366503baafc9 | Python | 7,151 | 171 | # Inherits OptimizationData and adds functions for plotting smoothed error
from OptimizationData import OptimizationData
import numpy as np
import matplotlib.pyplot as plt
class OptimizationFitness(OptimizationData):
def __init__(self, dir_data, fname_data, fname_settings, n_bins=1001, w_gaussian=5, load=T... |
86c668c5f2f9f9ade422ce1ce6119624db4f9397d479b36c6f4deccdbebf830a | Python | 7,151 | 159 | # 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... |
160733bc34221513e5d1708c010e3a8a9c19ad7cd8819d8379b5bd779669d570 | Python | 7,153 | 179 | from typing import Tuple
import torch
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from torch import nn
class FeedForward(nn.Module):
def __init__(self, in_channels: int, hid_channels: int):
super().__init__()
self.net = nn.Sequential(
nn.LayerNorm(in... |
d1c5c1cfe9bcbd2866da1e3fcc37c2b4d10924b7d953bc9ddae6cbf7806aaa84 | Python | 7,154 | 176 | """
Set of functions used to generate MERFISH section images with DevCCF/CCFv3 labels.
Used in Fig 5d-e.
"""
import os, subprocess
import pandas as pd
import numpy as np
import json
import matplotlib.pyplot as plt
import requests
import SimpleITK as sitk
import pathlib
def plot_section( xx=None, yy=None, cc=None, va... |
e7043af102f2b1210246199d521db70bcbf1af1885dd7223a40ea946f949c84d | Python | 7,154 | 123 | """MIRROR_SCREEN.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30v-MIRROR-SCREEN.md
Every sensory cell type, left and right separately, on the published signs: which inputs explode on one side only?
Flagged types are rerun under O+il3LN6, D and F4. Secondary: the rate theory on every type and side.
usage:... |
f8f51614ddbc0aa82f8f4b5dc4049709febb89b73bc1b6fc4707bc943d5b33cf | Python | 7,154 | 188 | # Node-group asset "Composite Depth Fog" (CompositorNodeTree), 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_... |
d351a3e5667e4682209c6fa6e88b40e6dabde4e5786ea81b4ccad7b34d2992dc | Python | 7,155 | 130 | import numpy as np
import pandas as pd
from sklearn import preprocessing
class CmaPss:
def __init__(self, file_name: str, rul_early: int, sequence_length: int, test_sequence: int, graph_signals: bool):
self.graph_signals = graph_signals
self.train_df = pd.read_csv('file address' + file_nam... |
31e15581113f7fa202c5deebaa70d4b5f0bed6c205b974be90e52fb182c7ebb8 | Python | 7,156 | 164 | # -*- coding: utf-8 -*-
"""(Keras) Layers for neighbor list"""
import numpy as np
import tensorflow as tf
def _displace_matrix(max_repeat):
"""This is a helper function for cell_list_nl"""
d = []
n_repeat = max_repeat*2 + 1
tot_repeat = tf.reduce_prod(n_repeat)
for i in range(3):
d.append... |
1cb6ed0b0ec5637aaafcd235cf4c04c83e66a3dd55161955ba888d94527dd697 | Python | 7,157 | 211 | """Hyperbolic layers."""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.nn.modules.module import Module
from layers.att_layers import DenseAtt
def get_dim_act_curv(args):
"""
Helper function to get dimension and activation at every laye... |
a6c8a98798c53abf8e7c08ccfab0fd329d23deb7fb6b6e41d82dbf67f93947e0 | Python | 7,157 | 167 | '''
Description:
Figure plotting for using different number of pre-training timepoints.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import numpy as np
import scipy.stats
from plotting import *
from plotting.__init__ import _removeTopRightBorders, _removeAllBorders
# ======================================... |
c829ce4486ee9a44b13df7d1ea8c193658858b27ae8c3dbdf236daba0f0d0dde | Python | 7,157 | 174 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import wx
import os,sys,pydoc
import deeplabcut
media... |
91c3da10e13261dbbf5dad43878e8ac9b07c3230ff5156bbb7b9e86d1121076e | Python | 7,158 | 213 | # -*- coding: utf-8 -*-
#
# The singlepanel plotting functions for Syncopy
# data types
# 1st argument **must** be `data` to revert the (plotting-)selections
#
# Builtin/3rd party package imports
import numpy as np
from numbers import Number
# Syncopy imports
from syncopy import __plt__
from syncopy.shared.errors imp... |
8be3cf7993934014c9786b57b3342ffc2e7d69f49fe653d141902c37c6620577 | Python | 7,159 | 253 | import numpy as np
import math
import cv2
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from hippo.agents.replay_agent import ReplayAgent
from hippo.environments.w_maze import WMazeEnv
from hippo.environments.action_perception import action_perception_loop
from minigrid.wrapp... |
ceddf8a8125331117bb82e7a3448a3b7288fc5c55ada1faf5ce3e77d9eecfea2 | Python | 7,160 | 203 | #
# 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,... |
885a4380cdd2d4d96733b03c7059abf908b34ceff99cce481da02d9bb53e286a | Python | 7,161 | 172 | """
Modules containing class that
1. the most abstract circuit connection information
"""
class AbsSegment:
"""class for abstract segment
Attributes:
cell: AbsCell class, the cell that contains the segment
index: int, segment index in the cell, starts from 0
name: str, segment nam... |
96d9ab5d668c5e38891db632cd6a654dd06f3d83dd2a4f7d1a32ae415ca91995 | Python | 7,161 | 179 | import importlib.util
import os
from collections import namedtuple
from typing import Any, List, Optional
from pip._vendor import tomli
from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
from pip._internal.exceptions import (
InstallationError,
InvalidPyProjectBuildRequires,
Mi... |
0822509e2b79c211fde6d91fe7b4377209cff20614fa52ad85196d6a3a7a63d7 | Python | 7,162 | 198 | import os
import torch
from torch.utils import cpp_extension
from torchdrug import data
from . import decorator, comm
class LazyExtensionLoader(object):
def __init__(self, name, sources, extra_cflags=None, extra_cuda_cflags=None, extra_ldflags=None,
extra_include_paths=None, build_directory=No... |
5445b256c5d43ec67ebea0cfa4155bd28b459059f95769286aa2cfb3e3dca22f | Python | 7,162 | 206 | """Classes for managing counts of HED tags for columnar files."""
import copy
class HedTagCount:
"""Counts for a particular HedTag in particular file."""
def __init__(self, hed_tag, file_name):
"""
Parameters:
hed_tag (HedTag): The HedTag to keep track of.
file_name ... |
bc7861eb38c24c8a0fbec205b9969e650ce345387f912728a52359996acd3cb3 | Python | 7,162 | 187 | # 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... |
65cf0bbd208159760428e162df7ce06f76c3a10a09ebdb246ba4c22ec152d7e9 | Python | 7,163 | 282 | #!/usr/bin/env python
# coding: utf-8
# ## Generate paper figures
#
# Uses the `svgutils.compose` API, [described here](https://svgutils.readthedocs.io/en/latest/tutorials/composing_multipanel_figures.html).
# In[1]:
import os
import shutil
from IPython.display import Image, display, SVG
from lxml import etree
im... |
963591be758b3fc4d004a85a9ed01038655a3ed79334fe6003bc5f98e13591f5 | Python | 7,164 | 214 | #
# 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,... |
bbdc56f160a0c3648d2b93f0e4ba0497c3696e5c379337ffab47043642c8ee59 | Python | 7,164 | 252 | from __future__ import print_function
import numpy as np
class Obj:
def __init__(self, fn):
self.ind_v = 0
self.ind_vt = 0
self.ind_vn = 0
self.fn = fn
self.out = open(fn + ".tmp", "w")
self.out.write("mtllib dinnerware.mtl\n")
def __del__(self):
self.out.close()
import shutil
shutil.move(self.fn ... |
a3d2c793e1b4bd7e82cb7b2d5608212ce3df530e95ebf04161e241e3dd3e839d | Python | 7,166 | 199 | """Prepration for runners."""
from __future__ import annotations
import os
from logging import getLogger
from pathlib import Path
from shutil import move
from typing import TYPE_CHECKING
from monty.shutil import gzip_dir
from quacc import JobFailure, get_settings
from quacc.utils.files import copy_decompress_files,... |
2bf23a60a357fa4bfa9a36a24377ce55a4da8cae0eeac37ca906af3a468e370a | Python | 7,168 | 223 | """Radiation pattern of a dipole antenna in free space.
Tutorial reference:
https://meep.readthedocs.io/en/latest/Python_Tutorials/Near_to_Far_Field_Spectra/#radiation-pattern-of-an-antenna
"""
import math
import matplotlib.pyplot as plt
import meep as mp
import numpy as np
RESOLUTION_UM = 50
PML_UM = 1.0
WAVELEN... |
b08d3b6eb1c88171cc63cd8a283ca4de839c51b5358f88d858fce40d7b9a799c | Python | 7,168 | 109 | """DAMPING_SOURCE.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02f-DAMPING-SOURCE.md
Does the whole brain damp the antennal lobe through the synapses that lateral-horn and mushroom-body neurons make on PN axons
(which a point-neuron model adds to the PN's one voltage)? And does one v2LN30 break smell on its... |
8dbfd161d19ee32a0e79609cc148983b23f64dd2a12a0b26b674e467a190da0e | Python | 7,171 | 197 | import json
from pathlib import Path
import numpy as np
import torch
import tqdm
from scipy.stats import pearsonr, spearmanr
from .prix_fixe_net import PrixFixeNet
from .dataprocessor import DataProcessor
from typing import Any
from abc import ABCMeta, abstractmethod
# default metrics to compute
DEFAULT_METRICS = ... |
f750fa2ba4d2194252b5e43d656a8d97f7cf2c135ac02a6f15f36009d39709b1 | Python | 7,172 | 138 | # coding=utf-8
# Copyright 2020, Microsoft and the HuggingFace Inc. team.
#
# 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 require... |
4489a124686468628fb22615879ea000c7cdfd220f6a1cf90771cf4c31597bd6 | Python | 7,173 | 241 | # 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... |
62783ec2a3f76b924e634d353327483e1fbbcf1ef0e2f59aa297efaaa6606f0c | Python | 7,176 | 183 | from importlib.util import find_spec
import numpy as np
import pandas as pd
import pytest
import scipy.stats
from pandas.core.api import DataFrame
if find_spec("formulaic_contrasts") is None or find_spec("formulaic") is None:
pytestmark = pytest.mark.skip(reason="formulaic_contrasts and formulaic not available")
... |
5f49523821695d175c44ed79493a74a00d6165b2fc2d17d2872c4df51c4e737e | Python | 7,178 | 177 | # 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... |
7259a3d0838c370fb6ca2fe88c63a13ce2b0231c0d968e29d8daf70990793c5d | Python | 7,178 | 267 | # 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... |
2a1653c1d002f441a9ec62b06b50245ad01b0bf14cbcd3ab46c4d37b0f70242d | Python | 7,179 | 238 | # 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... |
cc08dde03fb56191e1cd30eca9f203c355a04c6a367009102c1958621bd43051 | Python | 7,179 | 212 | import gzip
import os
from glob import glob
import numba
import numpy as np
from numba import njit, prange
from .numerics import _calc_mean_shrunken_residuals, _count_n_cells, _count_n_cpg
from .smooth import _load_smoothed_chrom
from .utils import _check_data_dir, _get_filepath, _load_chrom_mat, echo, secho
# ignor... |
12adc4ab3e90672c2d0c7e1183e1e5c7f0085486b8136225d89ec70b7b1f884b | Python | 7,183 | 200 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import logging
import os
from os.path import dirname, join
import re
import subprocess
import sys
import time
import xmlrpclib
import markup
#how many seconds to wait after a failed requests. Will be doubled after each failed request.
#Don't lower this ... |
c0d7e841643a6224cbe45172867e5838cfeae4905c6a8a94f998c136072c2617 | Python | 7,183 | 132 | """Connectome providers: topology and neuron metadata, independent of reservoir dynamics.
A provider returns a Connectome. Optional metadata (neurotransmitter labels, coordinates,
synapse tables) is None when the source does not have it; nothing is invented.
"""
from __future__ import annotations
import hashlib
impor... |
e377b97c8277c824293ffe71e868446dce16f662b49bbfc5d06f7a75c9e3eba6 | Python | 7,183 | 127 | import torch
import torchvision
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class UNetSAR(nn.Module):
def __init__(self):
super(UNetSAR,self).__init__()
self.enc_conv1 = nn.Conv2d(1,16, kernel_size=3, stride=1) # 1 in-channel... |
cfddda0eea879cb594ba19f69bec29cbc13c704c63046cbc9477056b4b6534e4 | Python | 7,184 | 172 | """Unit tests for hed.schema.schema_version_manifest (manifest parsing fast path).
These are pure parsing tests over an in-memory manifest fixture - no network, no real schema files.
The live fetch path (manifest -> hed_cache.get_available_hed_versions / _download_schema_version) is
exercised by the existing schema-ca... |
cd52ba7ec867a1a18c0a74539040852ecf6d44996b8c804b3f64ff0c244fcfff | Python | 7,186 | 174 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
import pandas as pd
import numpy as np #use numpy 1.20
import subprocess
import os
import conntility
import connalysis
database_root = './classification/PCA/'
if not os.path.isfile(database_root+'community_datab... |
1389189441ee20edde214f327f37b5ea4e25d4a765d1103671d9eef72396db80 | Python | 7,187 | 209 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import enum
##############################################################################################################
# Parameters
########################################################... |
b990d588fef5f9cb5bca973fba90971fdd3cde7483a6a182109b316e63c558e0 | Python | 7,187 | 193 | # 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... |
047b3c78417ace2f51894759b9133b3e7ca37e8f648935a942ca21630e133c5f | Python | 7,188 | 202 | # shared functions and classes, including the model and `run`
# which implements the main pre-training and training loop
import os
import torch
import torch.nn.functional as F
from torch import nn, optim
import numpy as np
import copy
import tqdm
from time import strftime, localtime
from .model import *
from .util ... |
f3cec2fee13a0c9d5a6f8671b44cbca1e1a2b33cde2c9c001b950a87292e83d4 | Python | 7,188 | 208 | from collections.abc import Callable
from itertools import starmap
from typing import Any, Protocol
import torch
import torch.nn as nn
from torch import fx
import elasticai.creator.function_dispatch as FD
from elasticai.creator import ir
from elasticai.creator.ir import Edge, Node, StdIrFactory
from .default_handler... |
2449ef2178d61961af2b8574e2a074aff931e911e6acdee0ca2241f5e52cebce | Python | 7,189 | 169 | import torch
import torch.nn.functional as F
from typing import Dict, Callable
from .utils import expand_to
class Loss:
atom_prop = ["forces", "spin_torques", "direct_forces", "peratom_tensor", "peratom_l3_tensor", "magnetic_forces", "projected_fm"]
structure_prop = ["energy", "virial", "dipole", "polarizabi... |
ab746689e86eeba41e9bd2b868aaa5a07b2759bc0e18008d7d8350e300b08bc4 | Python | 7,189 | 228 | #!/usr/bin/env python
#******************************************
#
# 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
#... |
db65a4f394a8c37a897ea4dd9816c97481696beacee6ce2a738a355954b92b06 | Python | 7,189 | 198 | """
Script for cleaning a particle list an generating the required files for rendering it in 3D with ParaView
Input: - XML file with a particle list
- Pre-processing parameters for generating the particle list
- Membrane segmentation (optional)
Output: - Filtered particle list
... |
f28ecc4f890adfee823ad0986d35941cfae016d37920acebb3677ee4d5cf6640 | Python | 7,189 | 180 | #!/bin/env python3
'''
Main tests of the Ithildin Python module
'''
import hashlib
import ithildin as ith
import matplotlib.pyplot as plt
import numpy as np
import os
import shutil
import tempfile
import unittest
import zipfile
import re
SIMSERIES = 'spiral'
SERIALNR = 0
STEM = f'{SIMSERIES}_{SERIALNR}'
class SimData... |
c00f635310d06f24d0b759fc7acff8c4e8ccfc9a5d8d1e7eb1611f87f2a664d9 | Python | 7,190 | 175 | import numpy as np
import math
import cv2
import torch
from cv2 import GaussianBlur, BORDER_REPLICATE
from .pytorch_msssim import ms_ssim
device = torch.device('cuda')
# --------------------------------------------
# Calculate the average number of photons from raw data
# --------------------------------------------
d... |
c5e6ba2ec0fb01f3a33a530c4d59db1e6029a6db64609827e28d9d8b5adac338 | Python | 7,190 | 154 | import argparse
from matplotlib import pyplot as plt
import os
import sys
import pandas as pd
import pytorch_lightning as L
from pytorch_lightning import LightningModule, Trainer
from pytorch_lightning.callbacks import Callback
import seaborn as sns
import torch
from typing import Any, Literal
# local imports
sys.path.... |
d8d38838e189cb7210bec38e59c6b3a2df2c19cb11676e36383b7c7ee887568b | Python | 7,190 | 213 | #
# Test module for ACME configuration classes
#
# Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Builtin/3rd party package imports
import pytest
# Local imports
from acme.config import ACMEConfig
from acme.shared import is_slurm_node
class ... |
033909d75cd7239a1c1bd640407e5dedbf7241b60f90cd8ff616cc4435ad8970 | Python | 7,191 | 202 | # 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... |
7db261bcec3e32e29a12bbbd398ab8ca3756e578ecd81eed3d1a90bedc909b7d | Python | 7,192 | 139 | import argparse
import os
import time
from scipy.io import loadmat, savemat
import numpy as np
import logging
import datetime
import collections
import torch
from torch.utils.data import DataLoader
import network
import loaders
from utils import get_otsu_regions
def main():
start_time = time.time()
# parse ... |
2daa1ef84d669b0cf8c4a471eb0becc499e68e77b21e4ae90330cb6a86357700 | Python | 7,194 | 194 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.linearrelu.design import (
LinearReLU as LinearReLUDesign,
)
from elasticai.creator.nn.integer.math_operations import MathOpera... |
96c9b28f6d4a10d15f7b304866862bd3eb261c9775412e4cabfae875aefe5ff2 | Python | 7,194 | 239 | # 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... |
9aaf9fc8feb0589f34783c5448b2c3e405160179ebdddc78dfdbda906656a6b0 | Python | 7,194 | 233 | # 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... |
c0017bfb7c79a4c24568083bfdc00433f2f9c32dc58fd185cfb22905c75a3888 | Python | 7,203 | 207 | import torch
def AUROC(output, target):
from sklearn.metrics import roc_auc_score
with torch.no_grad():
if output.dim() > 2:
raise TypeError(f'Tensor with {output.dim()} dimensions is not available for AUROC')
elif output.dim() == 2:
if output.shape[-1] == 2:
... |
4cdf3de4d20c822e77ebe99c2b2085f594576ab859f0e7215b974d63e2e70c3e | Python | 7,207 | 210 | # 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... |
04dde8d7ae3b790b86e234e3f5bad12652f617ac583037ca1f25c92222b001dc | Python | 7,208 | 130 | #!/usr/bin/env python
# relion_run_topaz
# This is to run Topaz picking training (https://github.com/tbepler/topaz) from Relion as an External job type
# Rafael Fernandez-Leiro 2020 - CNIO - rfleiro@cnio.es
# Alex J. Noble 2020 - NYSBC - anoble@nysbc.org
# Run with Relion external job
# Provide executable in the gui... |
b052ccf8e845918b8f0bb5c0aef3ca3b7cdd0bea3fa48779991997c7fd771714 | Python | 7,208 | 205 |
from sklearn.metrics import classification_report, confusion_matrix
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torchaudio
import torchvision
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
import seaborn as sn
import matplotlib... |
5539e05724082c4235f64bc02e8a1fcfda164845d4bf2a315a38d91c63792555 | Python | 7,211 | 158 | """Undo/redo history-orchestration mixin for the CCF boundary editor.
Carries the editor's undo/redo machinery: pushing pre-edit snapshots
(``_push_undo`` / ``_push_multi_slice_undo``), capturing redo counterparts
(``_snapshot_for_undo_entry``), applying a restored entry across one or many
slices (``_apply_state_... |
7a3075d350c36595338a597e1f5a7acc870b15136ee6ef820da4bf8b8228f4b3 | Python | 7,211 | 185 | # By Shuran Liu, 2023
import argparse
import yaml
import math
import matplotlib.pyplot as plt
from tqdm import tqdm
from PIL import Image
import os
from skimage.metrics import structural_similarity as ssim
parser = argparse.ArgumentParser(description='Input a config file.')
parser.add_argument('--config', help='Config ... |
cbf10430ac18976f9bcd8043a2f92c4a7f26efaa27d0b75af1ec8992c55013d5 | Python | 7,211 | 210 | """Android."""
from __future__ import annotations
import os
import re
import sys
from functools import lru_cache
from typing import cast
from .api import PlatformDirsABC
class Android(PlatformDirsABC):
"""
Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_. Makes use of the
`... |
38b400be8903cf44c23b22d8f0411264ce801c5661cde3e959be3a57f98b346e | Python | 7,213 | 191 | from __future__ import print_function
import os
import random
import numpy as np
import math
from itertools import count
from collections import namedtuple
from pybullet_tools.utils import read_pickle, INF
Collector = namedtuple('Collector', ['collect_fn', 'gen_fn', 'parameter_fns',
... |
e68aa155915b34be3d6df0a51d72b445e238434d1798bf6a7188b1703d53de60 | Python | 7,215 | 203 | import argparse
import glob
import os
import shutil
from openmm import XmlSerializer, unit
from openmm.app import CheckpointReporter, DCDReporter, PDBFile, StateDataReporter
from colabmda.openmm.modular.utils import (
atomic_rename,
fresh_seed,
load_stage_state,
make_sim,
offset_seed,
sync_out... |
cfffccdc10032efc8ad38f3a3e61bbd9ef35374952979523003b21fe42aa5675 | Python | 7,216 | 181 | #!/bin/usr/python3
# Use example: python preprocessing.py /home/melanie/BIDS_data_test /home/melanie/BIDS_data_test/transforms
## Import libraries
import os
import shutil
import tempfile
from glob import glob
import argparse
import numpy as np
import pandas as pd
import torch
import torchio as tio
from monai.data im... |
676847dc945bf05f00c29194cbe8b17f3415fbcad71414548f5743abbb46317d | Python | 7,218 | 217 | from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
import numpy as np
import math as m
from mpl_toolkits.mplot3d import Axes3D
import torch
import torch.optim as optim
import matplotlib.ticker as ticker
import textwrap
from Rosenbrock import Rosenbrock_func
from Quadratic import Quadratic... |
4f9a94a69a33237509ac4518e0d76506abfb9442ad2a97286493d90deab17a50 | Python | 7,219 | 243 | """Recipes for slabs."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import flow, job
from quacc.recipes.common.slabs import bulk_to_slabs_subflow, slab_to_ads_subflow
from quacc.recipes.vasp._base import run_and_summarize
from quacc.wflow_tools.customizers import customize_jobs
i... |
3055bcacf36746f0ab6b93149492e2beb35623641f7e5c186dfa75f1460c6af3 | Python | 7,221 | 170 | ## -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Imports
# -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
import copy
import os
import scipy.io
import numpy as np
import pandas as pd
from Functions.f_EEGPowerAnalysis import *
from Functions.f_AnalysisFunctions import *
import ... |
36e9889f2bc16a2c840c59ee777dd068a55da9723a2ce8fc5198021dbb63f494 | Python | 7,221 | 229 | def configs_optimal_core():
return {
# A*
"astar_blind": [
"--search",
"astar(blind)"],
"astar_h2": [
"--search",
"astar(hm(2))"],
"astar_ipdb": [
"--search",
"astar(ipdb)"],
"astar_lmcount_lm_merged_rhw_... |
40a9ff49fdf972cc07e4f3337c7e07a9a84ecd627d3577c2f647e7991e1fdbaa | Python | 7,222 | 236 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import pancancer_evaluation.config as cfg
import pancancer_evaluation.utilities.analysis_utilities as au
get_ipython().run_line_magic('load_ext', ... |
4a848e22bacd1914550591453a7648ec891b220c6d966bd064682c1b161ede36 | Python | 7,226 | 199 | import numpy as np
import pytest
from SurvivalEVAL.evaluations.prediction_error import mean_error
from SurvivalEVAL.nonparametric_estimator.single_event import KaplanMeier
@pytest.mark.parametrize(
"error_type, expected", [("absolute", 10 / 3), ("squared", 31 / 3)]
)
def test_ipcw_d_uses_reverse_km_for_mixed_tra... |
6cb1e75a441fd22b5033e3878140e48668d26b761b6dab4f81b834e29a7f2ead | Python | 7,228 | 148 | """Repo-level manifest fast path for HED schema version discovery.
hed-schemas publishes a single ``schema_versions.json`` at its repository root listing every schema
version (released / prerelease / deprecated) for the standard schema and each library, with each
XML file's git blob SHA. hedtools can read that one fil... |
cc2c5bab9a25d6716b394f9fc31dbc9eea62e002b369c1faf3680fac742ff757 | Python | 7,228 | 167 | import copy
import random
import torch
from torch import nn
from torch.nn import functional as F
from torchdrug import core, layers
from torchdrug.core import Registry as R
@R.register("models.InfoGraph")
class InfoGraph(nn.Module, core.Configurable):
"""
InfoGraph proposed in
`InfoGraph: Unsupervised a... |
cfea98484927141492ae155d41ca810d84d208699e14273bbd664168fcf80b00 | Python | 7,229 | 195 | #! /usr/bin/env python
# Time-stamp: <2021-03-23 22:02:10 christophe@pallier.org>
# License: Creative Commons Attribution-ShareAlike CC BY-SA
""" Implementation of Posner's endogeneous attention cueing task (see https://en.wikipedia.org/wiki/Posner_cueing_task)
Note: This experiment is meant to be run on FullHD (1920... |
d489eae8b73b1fd4560aa6710ec2f171b0a5297942b04628e15c30c0a7079a02 | Python | 7,229 | 188 | import numpy as np
import AffinityClustering
import GNN_core
import copy
import ray
import torch
from torch_geometric.loader import DataLoader
import os
import json
import sklearn
def gaussian_sampling(mu,sigma):
cov=np.zeros((len(mu),len(mu)))
np.fill_diagonal(cov,sigma)
samples=np.random.multivariate_nor... |
f70c5ad7afb2ae66bf67011c653db3ebf6d80cfdf760e6d1a866edcbc366b3bb | Python | 7,231 | 254 | # -*- coding: utf-8 -*-
#
# Performs the numerical inner-outer factorization of a spectral matrix, using
# Wilsons method. This implementation here is a Python version of the original
# Matlab implementation by M. Dhamala (mdhamala@bme.ufl.edu) & G. Rangarajan
# (rangaraj@math.iisc.ernet.in), UF, Aug 3-4, 2006.
#
# The... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.