sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b3ec999e2b9552c8cffa69c36bd859339ffb6a8289136a1297d024ef64fbf7a5 | Python | 3,423 | 133 | ##
# \file exceptions.py
# \brief User-specific exceptions
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date June 2017
#
##
# Error handling in case the directory does not contain valid nifti file
# \date 2017-06-14 11:11:37+0100
#
class InputFilesNotValid(Exception):
##
# \... |
eef8efa72b77887395c25dc273a4d9acfcad880807c5784b59b466c8daae327c | Python | 3,424 | 116 | """
A script to run and summarise random tournaments.
Generates:
- <directory>/parameters.csv a csv file with parameters for each tournament
- <directory>/data/<seed>.csv a csv file summarising a tournament for a
given <seed>.
"""
import axelrod as axl
import pandas as pd
import random
import glob
impo... |
02373cfa247ac3a5b4b212958c3da846fb525aa29c7383d8fa794c557abe9a20 | Python | 3,425 | 68 | import numpy as np
# torch.backends.cudnn.enabled=False
import sys
import os
sys.path.append(os.getcwd())
import pandas as pd
from src.utils import BoxWrapper, FrameWrapper, CV2VideoWriter, CV2VideoReader, \
ColorBGR, logger, parse_config
if __name__ == '__main__':
# Parse config file
args = parse_config()... |
450d22be0207ee44ff56c1cec879a5fe65074c0743838b1287de216fd582158e | Python | 3,425 | 116 | """
Script for doing Univariate statistical 2nd order spatial analysis for a 3D distributed point pattern
Input: - Star file with surfaces list
- Parameters for setting the statistical analysis
Output: - A numpy Matrix for computing the 2nd order analysis for every particle
"""
__author__ ... |
4662042510831e480a403d6488d7930a1af4546a4c90239872d8ec92d6c3b99b | Python | 3,425 | 59 | import argparse
from utils.train_utils import add_flags_from_config
config_args = {
'training_config': {
'lr': (0.01, 'learning rate'),
'dropout': (0.0, 'dropout probability'),
'cuda': (-1, 'which cuda device to use (-1 for cpu training)'),
'epochs': (5000, 'maximum number of epoch... |
1d2d15695f6d6db5dc38ae6cf8eadb4df7c3e15ce4fe0b7dec4c87561b16fc43 | Python | 3,426 | 85 | import pandas as pd
import os
import json
import matplotlib.pyplot as plt
import numpy as np
from typing import List, Tuple
from constants import ABSOLUTE_ERROR, ERR_LEVEL_TOTAL_SCORE, ERROR_TO_LABEL, R_SQUARED
from src.analyze.utils import init_mpl
from src.analyze.performance_measures import PerformanceMeasures
_FI... |
e819dfbfc4ec7ec060061e4584a2ee660d74cd7965ad3468c0f5abcc644e3b9a | Python | 3,426 | 104 | from __future__ import unicode_literals
import os
import sys
import re
from setuptools import setup, Extension
from distutils.version import LooseVersion
from setuptools.command.build_ext import build_ext as _build_ext
# Get the version number from _version.py, and exe_path
verstrline = open(os.path.join('tombo', ... |
0eecba3cd7e797278c1dcf5d3a94564c18dcc18703273e8eaf4794d3b38c57c1 | Python | 3,427 | 95 | import pandas as pd
import torch
from torch.utils.data import DataLoader, Dataset
import pytorch_lightning as pl
from sklearn.model_selection import train_test_split
from pytorch_lightning.callbacks import ModelCheckpoint
from PilotCareTransNet import PilotCareTransNet # Assuming the model is in a file named Pil... |
1821966aea2a4773e4273e1cfe94746505270ab64bec4464bab46f74d92daec3 | Python | 3,427 | 134 | from collections.abc import Callable
import pytest
import elasticai.creator.graph as gr
from elasticai.creator.graph.base_graph import BaseGraph
from elasticai.creator.graph.graph import Graph
from elasticai.creator.graph.vf2 import find_all_matches, match
from elasticai.creator.graph.vf2.matching import MatchError
... |
232939593d4612f5f8f0d517b653de82f106df63484e84ec5231bde2b1aac868 | Python | 3,427 | 96 | from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port
from elasticai.creator.vhdl.design.design import Design
from elasticai.c... |
46202f591482957598f4e46ed9de0332fb1b39bc807a48013b5b736c927b7918 | Python | 3,427 | 112 | ##
# \file correct_bias_field.py
# \brief Script to correct for bias field. Based on N4ITK
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date October 2017
#
# Import libraries
import numpy as np
import os
import niftymic.base.stack as st
import niftymic.base.data_writer as dw
import niftymi... |
653fbbff330b55ee329d6ca7ee4635345876e0096c02184b9717d8bcb99d0c30 | Python | 3,427 | 122 | #!/bin/env python3
'''
Define a Feynman diagram
'''
import pdlfeynman as fy
import pdlfeynman.particle as fyp
import pdlfeynman.reaction as fyr
import yaml
def determine_particle(node:fy.diagram.Node, key:str='products') -> fyp.Particle|None:
match node.nodetype:
case fy.diagram.NodeType.PARTICLE:
... |
807936f02614704d5fe27224ccccc8c304c46ccd6fe407448833694f5ff14433 | Python | 3,427 | 117 | # Node-group asset "Transform Relative" (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_CHE... |
e944d4cb2c6e4e523f8b468c272fbe2364aea37736c9d242f39bdcde890a0829 | Python | 3,427 | 101 | #
# 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,... |
f2ee35b9672cfefb933027a7912bf91114af3124c01ba1a42c0f8ce48e6f1a28 | Python | 3,427 | 90 | """Windows-only host operations, isolated so future platform_mac/platform_linux
modules slot in without touching the wizard. Stdlib only."""
import os
import re
import subprocess
import tempfile
import urllib.request
from installer import Result
PY312_INSTALLER_URL = "https://www.python.org/ftp/python/3.1... |
3886a09a4a0cecb153b8223d5de51174d8105d58b52127b35c497dcb5e55ac67 | Python | 3,428 | 95 | """Test (ISMR)MRD export."""
import tempfile
from pathlib import Path
import ismrmrd
import numpy as np
import pytest
from console.interfaces.acquisition_data import AcquisitionData
from console.interfaces.dimensions import Dimensions
from console.utilities.data import write_acquisition_to_mrd
from console.utilities.... |
9da9e4cceff17395bc5a20a923349d21ddfcee01746aa4eb056fb049d2609216 | Python | 3,428 | 98 | # Copyright (c) 2021, 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. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
0c115b777e2eed8b655d3f137be21da14b4328d2cfc232ed5ced61fe70daaa45 | Python | 3,431 | 109 | # Node-group asset "Select Bonded" (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... |
0fb21c01b44bdf6294734edcefb55175ef021aee2b43af8adb8807b830e17668 | Python | 3,431 | 85 | import os
from glob import glob
from pandas import DataFrame, read_csv
from nilearn.glm.second_level import SecondLevelModel
def group_onesample(fixedeffect_paths: list, session: str, task_type: str,
contrast: str, group_outdir: str,
model_permutation: str):
"""
This fun... |
93b92b4bb30b0320a3159f108c7a8c33ddafccfb61f76b2e2d48a55f87e5ac43 | Python | 3,431 | 92 | from __future__ import annotations
import re
import urllib.parse
from typing import Any
from wikibaseintegrator.datatypes.basedatatype import BaseDataType
from wikibaseintegrator.wbi_enums import WikibaseSnakType
class GeoShape(BaseDataType):
"""
Implements the Wikibase data type 'geo-shape'
... |
a8708fdeb476a6b4eebc5b761fb7a63d2409091ca0976cc851b1dc2b47830a10 | Python | 3,431 | 103 | import random
import unittest
import torch
import torch.nn as nn
from torch.utils.data import Dataset
from torch.utils.data.dataloader import DataLoader
from torcheeg.trainers import BetaVAETrainer, CBetaVAETrainer
class DummyDataset(Dataset):
def __init__(self, length: int = 101):
self.length = length... |
fe7845fd12490bcb44ed04492ebd67e1123612910b040daf3512883f6a4bb61d | Python | 3,431 | 98 | """
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
Adapted from DeeperCut by Eldar Insafutdinov
https://githu... |
229b0df783758e0d858891e276cf0b8c8dbbbb462d87541be435058ad5e01b04 | Python | 3,432 | 103 | from ._base import EncoderMixin
from timm.models.resnet import ResNet
from timm.models.sknet import SelectiveKernelBottleneck, SelectiveKernelBasic
import torch.nn as nn
class SkNetEncoder(ResNet, EncoderMixin):
def __init__(self, out_channels, depth=5, **kwargs):
super().__init__(**kwargs)
self._... |
35386a4e748bad249a7ab23631f68f4c0e4ada7f851464c61a005987227c215b | Python | 3,434 | 108 | # Node-group asset "Is Hydrogen" (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
f... |
f1775c2abed823f70b4b42428eb1f52e8a1d9c327de7be08c6c82f1bff9e2815 | Python | 3,434 | 113 | #!/usr/bin/env python
"""
Visualize parcel-wise ANOVA results for between-movie ISC differences
using the Schaefer 2018 300-parcel, 17-network atlas.
"""
import os
import pandas as pd
import matplotlib.pyplot as plt
from nltools.data import Brain_Data
from nltools.mask import expand_mask, roi_to_brain
from nltools.st... |
160d0b92a8c195e408bd1507cf0c5144f930f51bb4c827e41917d02b31e2df91 | Python | 3,435 | 117 | # -*- coding: utf-8 -*-
import tensorflow as tf
from .. import _logging as logging
from .core import *
__all__ = [
'StackLayer',
'UnStackLayer',
]
class StackLayer(Layer):
"""
The :class:`StackLayer` class is layer for stacking a list of rank-R tensors into one rank-(R+1) tensor, see `tf.stack() <h... |
b868f0deab7ad62786b57ac132c4c6fbf350f05b65d056d8e415ae11237a1ef4 | Python | 3,435 | 154 | import pandas as pd
import torch
import dgl
from rdkit import Chem
from tdc.single_pred import ADME
from tdc.single_pred import HTS
from tdc.single_pred import Tox
ATOM_VOCAB = [
'C', 'N', 'O', 'S', 'F',
'H', 'Si', 'P', 'Cl', 'Br',
'Li', 'Na', 'K', 'Mg', 'Ca',
'Fe', 'As', 'Al', 'I', 'B',
'V', 'Tl', 'Sb', 'Sn'... |
d07e2db1ce58c9972177dd5b9139ada3ac504a1c0a1e6c9137d83bc4b9262504 | Python | 3,435 | 122 | from __future__ import print_function
import torch
import torch.nn as nn
from IPython.core.debugger import set_trace
__all__ = ['alexnet_gn']
class alexnet_gn(nn.Module):
def __init__(self, in_channel=3, out_dim=128, l2norm=True):
super(alexnet_gn, self).__init__()
self._l2norm = l2norm
s... |
dc2fad12361d81ca6a56d458562c60dcaf69798952ea297bdc9ef7f68dcd4859 | Python | 3,435 | 88 | import numpy as np
import yaml
import torch
def load_params(file):
# load parameters from config.yaml
np.random.seed(seed=123299)
with open(file, "rb") as f:
conf = yaml.safe_load(f.read())
f.close()
return conf
def transform_points(points, affine):
# transform points from one coordi... |
5beb7d95706b6be8aa9de9c4fff74635192b4f16010c715764468ab0631e9c91 | Python | 3,436 | 117 | """Phonon recipes for TBLite."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import flow
from quacc.recipes.common.phonons import phonon_subflow
from quacc.recipes.tblite.core import static_job
from quacc.wflow_to... |
6a2ef6779cccce12688b4a31fd0f261a8d375dff2dc7597c9418901e17bd078b | Python | 3,436 | 96 | # 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... |
cd253cad39b4c58c91f8d1858ee4d77430524248a5e131b2fce6599105a3c992 | Python | 3,436 | 92 | from unittest import TestCase
from pyseg.vtk_ext import vtkClosestPointAlgorithm
import vtk
import time
from pyseg.globals import *
__author__ = 'martinez'
class TestVtkClosestPointAlgorithm(TestCase):
def test_Evaluate(self):
# Read reference
reader = vtk.vtkXMLPolyDataReader()
reader.S... |
d7725e1698714fd4a44df5be8e8c5a97431196f49dd79f41382a3f97218c7d5c | Python | 3,437 | 103 | from __future__ import division, print_function
import sys
from unittest.mock import patch
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from topaz.denoising.datasets import PatchDataset
from torch.utils.data import DataLoader
class LinearClassifier(nn.Module):
'''A simpl... |
2b5280c3c0f8d8d76f35b0a062d21e29d2740375eb3c497b845551dfaac25e08 | Python | 3,438 | 139 | import matplotlib.pyplot as plt
import numpy as np
import meep as mp
r = 0.7 # radius of cylinder
h = 2.3 # height of cylinder
wvl_min = 2 * np.pi * r / 10
wvl_max = 2 * np.pi * r / 2
frq_min = 1 / wvl_max
frq_max = 1 / wvl_min
frq_cen = 0.5 * (frq_min + frq_max)
dfrq = frq_max - frq_min
nfrq = 100
## at least 8... |
3b3ce0df40f7fd46dddbbae865b14450c898d7b0fdccfba4b86ed222c6e30ec7 | Python | 3,438 | 86 | import numpy as np
from scipy.linalg import expm, expm_frechet
from sella.peswrapper import _cell_deformation_jacobian, \
_expm_frechet_3x3_contracted
def test_cell_deformation_jacobian_matches_fd():
"""d(cell)/d(L) must match finite differences of the parameterization
cell(L) = expm(L / factor) @ orig_c... |
3bc880622f658c8ded5aead062be847c0058e79d5499b0e835bd64bf2dba6429 | Python | 3,438 | 104 | # Node-group asset "Transform Local" (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_CHECKI... |
4c3cbef0054114b5a35fd6bd8bea25df2610c5840049e6c0df966cba9cbd6a85 | Python | 3,438 | 97 | # 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... |
a3ebce33febbe4a98da04879bb86f8cac8169c754fc26025a51064abb69dd287 | Python | 3,438 | 94 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
import bindings as bi
class CSharpTypeTranslator(bi.TypeTranslator):
def __init__(self):
bi.TypeTranslator.__init__(self)
self.types["boolean"] = "bool"
self.types["Polymorphic"] = "object"
self.types["Object"] = "object"
self... |
6bd488ad44407a59e77fa721a6af11f8844f220a9f69b73066b02bcce69b90b4 | Python | 3,439 | 68 | # %%
from pathlib import Path
import pandas as pd
import pickle
# NOTE Using uppercase with all variables to indicate they are definitions
# Repo root directory (useful for building paths to datasets)
ROOT_DIR = Path(__file__).resolve().parent.parent
# Other directories
EXPERIMENTS_DIR = ROOT_DIR / 'experiments'
D... |
6e094b0c659b66e5f032e3c417dba99706c4bed730089fc5445b3aa543647758 | Python | 3,439 | 77 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Global vs. per-cell normalization of raw CC values
author: András Ecker, last update: 02.2024
"""
import os
import numpy as np
import sys
sys.path.append("../../../library")
from structural_basic import *
from ... |
d275d648c960d3fb53c75c96d7ddbcbdff9afa0bd83a3f57d2cf77f129cc5a5e | Python | 3,439 | 94 | # 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... |
85b6bcfaca937536b53bc8e5a4c42f878aaf2e4f95cbd6e53803e1248ef13e81 | Python | 3,441 | 91 | """
Render every automatic viewpoint method on ligand-bound structures from tests/data.
uv run docs/dev/viewpoint_gallery.py OUT_DIR
Writes one PNG per structure and method, and results.json with the chosen
direction, solve time and how many ligand atoms have a clear ray to the camera
through the rendered cartoon... |
bb031afc7e93c7b8e2bc5ec2d235d172bdb7e49fd8eddf539a7007a28ff82f64 | Python | 3,441 | 108 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 13 2019
@author: jmagraner
"""
# %%
import autograd.numpy as np
def generate_output(params,target,specs):
### Define tensor product ###
def TFRmodel(params):
# C (nh) , AB (ht''l)
# QU (lkt') , E ... |
fba1afa5e7987374da4d8a0355c3d6e7e0fdbe4b88b89225da94542ce76f1f85 | Python | 3,441 | 134 | import matplotlib
import numpy as np
import meep as mp
matplotlib.use("agg")
import matplotlib.pyplot as plt
resolution = 20 # pixels/μm
fcen = 0.25 # pulse center frequency
df = 0.2 # pulse width (in frequency)
eps = 13 # dielectric constant of waveguide
w = 1.2 # width of waveguide
r = 0.36 # radius of hol... |
7decd6a21dfdc86537d0bc808323b7f2ad4782631b845a65bf9b530ce0c3d1f3 | Python | 3,443 | 75 | from network.Cell import Cell
from network.Segment import Segment
from neuron import h
class Connection(object):
def __init__(self, pre_cell: Cell, pre_seg:Segment, post_cell: Cell, post_seg: Segment, cate: str, w: float) -> None:
assert cate in ['gap_jun', 'exc_syn', 'inh_syn']
assert (w >= 0 and... |
dee5c123108c3ebef52ee59d66637a1a306bf3f8f1a6c6b0e3366174b1289315 | Python | 3,444 | 65 | import os
import unittest
from hed.models.sidecar import Sidecar
from hed.models.tabular_input import TabularInput
from hed.tools.bids.bids_sidecar_file import BidsSidecarFile
from hed.tools.bids.bids_tabular_file import BidsTabularFile
class Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
... |
ff2384af750106289abfe22e5bc89e55b6168092b94b6e93dcb6bf7d4c35236f | Python | 3,444 | 107 | #
# 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,... |
c6390b809d55daa94ec76869e3ce0e3f8d6c018b1009decec67846605670e379 | Python | 3,445 | 93 | #! /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 = ... |
c7d47006c3f36bd0a5e80dba98805d08e4e00094a2e298616be492557f22c3af | Python | 3,446 | 105 | """Pure-logic tests for installer.drift - no venv, no subprocess."""
import os
import sys
# installer/ lives at the repo root and is NOT pip-installed; ensure it imports.
_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if _ROOT not in sys.path:
sys.path.insert(0, _ROOT... |
6f8ef52ded046111f53076cd0b72ab2099045658da37e0dc136ea5820246bb92 | Python | 3,447 | 89 | import torch
from torch.utils.data import Dataset
from data.utils import getPreopBinary, getPostopBinary, getPreopSurvival, getPostopSurvival
from data.constants import RADIOMICS_UID
class ClinicalDataset(Dataset):
def __init__(self, filename,preop=False, postop=False, classification=False, survival=False):
... |
4678adb8451db9196c62b35d9c43a29fe59af07fd7a5b883dbde811a0ef93a21 | Python | 3,448 | 95 | import argparse
import os
import nibabel as nib
import datetime
import multiprocessing
from utils import getfileList, split_list
def edit_sform_qform(im_list, sformcode, qformcode):
"""
This function applies fslorient to edit the sform and the qform of an image.
It sets the sform equal to the qform and se... |
a8ac50a69666bea1df08a0e42e878ff20cc0d54788d6dbdf9955569f4a0f10bc | Python | 3,449 | 65 | """APL_KNOWN.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02b-APL-KNOWN-ANSWER.md
Lin et al. (2014): silencing the APL neuron makes Kenyon-cell odour responses less sparse and more correlated. Whole brain,
Shiu et al.'s file, F4 and Rd, with and without both APLs; 17 Seki odours. usage: python APL_KNOWN.p... |
0f65cfaff78a95e3a02b1380ad7d14ea09db12518d084158d4b97b451223fe6a | Python | 3,450 | 85 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import yaml, io
with open("./config/DryBean_config.yaml", 'r') as stream:
config= yaml.safe_load(stream)
config["default_path"]= str(config["default_path"])
config["split"]= float(config... |
d0011409012743257841df408db998f6654d1dabc19e76e9c5e3e8d3bfc706a5 | Python | 3,450 | 80 | """Adapter for scikit-survival predictions."""
from __future__ import annotations
from abc import ABC
import numpy as np
from SurvivalEVAL.evaluations.custom_types import NumericArrayLike
from .survival_evaluator import SurvivalEvaluator
class ScikitSurvivalEvaluator(SurvivalEvaluator, ABC):
def __init__(
... |
4320c8356bdd518f86b0fbf320614e71ca419606822ef47f67bd1d223def9606 | Python | 3,451 | 107 | # 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... |
6a1ae449ca6dfdca5833a2f39042e40f630622dbeee2e52a1407c85219d0d109 | Python | 3,451 | 126 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestRegressor
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
import os
import random
import pickle
fr... |
df840fbb3bcaa1454fa739971a47867d6a8d928788e09466ac879d5eb47a865d | Python | 3,451 | 87 | #!/usr/bin/env python
import os
import argparse
import sys
sys.path.append(os.path.dirname(__file__)+'/..')
from maggie import utils
import numpy as np
import pandas as pd
import requests
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Split variants based on genomic annotations')
... |
f53fb97462a42c11aced3f45e2bed968ca44b4cd86b7176dd2e8d34350abfff9 | Python | 3,451 | 105 | """NRRD format loader (.nrrd, .nhdr) for volume_io."""
from __future__ import annotations
import numpy as np
try:
import nrrd as _nrrd_mod
_HAS_NRRD = True
except ImportError:
_HAS_NRRD = False
from regtools.utils.io.volume_io import (
VolumeData,
_error_volume,
_FORMAT_NRRD... |
5cdeb531f357781304b2e596f1d6f0149706fffa3acc0f318a0bc8236bbe3747 | Python | 3,453 | 41 | from organsegment import predict_multi
from multiprocessing import freeze_support
import os
# List of NIfTI files (.nii.gz) for processing
list_images = []
if __name__ == "__main__":
freeze_support()
predict_multi(
list_images=list_images,
target="inplace", # 'inplace' writes the segmentation... |
eff9503d8bb802f2fd2231f17cf9fde39656c04d509cec8751ae39e800e348bd | Python | 3,453 | 96 | import torch
import torch.nn as nn
from torch import Generator
from typing import Any
from collections import OrderedDict
from ..prixfixe import CoreBlock
from .add_blocks import SELayerSimple
from .utils import initialize_weights
class AutosomeCoreBlock(CoreBlock):
def __init__(
self,
in_channe... |
91c5b5ecc6c5c6d90d1d15bd82801eed6e5faa6e28b86fbfbf98c259f80ad5bf | Python | 3,454 | 107 | # 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... |
c89be7a35c4199e4b23b8e3e32ef5704cfa5bbc439390a35b33e494155f76422 | Python | 3,454 | 111 | # ---------------------------------------------------
####################################################
# 20 November 2023
# Contributors: Eran Shorer, Kira Dusterwald, Christopher Currin, Joseph Raimondo
# SCS - SINGLE CELL SIMULATOR
# This software offers the ability to simulate neural dynamics
# The script is t... |
1b976439cbdf0695e7f79f7df4299287a08637742100093412fc37c61c414786 | Python | 3,455 | 132 | # transmission around a 90-degree waveguide bend in 2d
import matplotlib.pyplot as plt
import numpy as np
import meep as mp
resolution = 10 # pixels/um
sx = 16 # size of cell in X direction
sy = 32 # size of cell in Y direction
cell = mp.Vector3(sx, sy, 0)
dpml = 1.0
pml_layers = [mp.PML(dpml)]
pad = 4 # paddi... |
a93d072bcdc7ba68de9fcb26f2ebd7a4143ecd2cd89bcc03a31917fc18387672 | Python | 3,455 | 86 | # regtools/registration/gui/batch_2d_points.py
"""Resolve a BatchConfig's points into per-row input_points file lists (no Qt).
Mode 1 (per_image): each row brings its own CSV.
Mode 2 (single_multi_z): one CSV's axis-0 (z) column routes points to rows by
0-based queue position; each non-empty bucket is written as ... |
ab23a103b785f60fc2ba56e6b21f3da736e5894d8f7257b66bbbb709885d021d | Python | 3,455 | 125 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestRegressor
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
import os
import random
import pickle
fr... |
4ba7fb72c628ad1a620fa72f9f78c849961cdc8f0f242e371f988c1694401035 | Python | 3,456 | 104 | import logging
import os
import re
import site
import sys
from typing import List, Optional
logger = logging.getLogger(__name__)
_INCLUDE_SYSTEM_SITE_PACKAGES_REGEX = re.compile(
r"include-system-site-packages\s*=\s*(?P<value>true|false)"
)
def _running_under_venv() -> bool:
"""Checks if sys.base_prefix and ... |
1d3b36a344b6501419d48c36689762e87ac661017a94378a7b3ac092b1536c69 | Python | 3,458 | 32 | """posthoc_dominant_enrichment_2026-10-02.py — POST HOC, descriptive (after KEYSTONES S and DOMINANT_INPUTS, 2 Oct night).
(1) the two v2LN30 against every other neuron by synapses onto uniglomerular PNs, in FlyWire and BANC; (2) does the census's
first-order score rank the 240 checked neurons better than that count? (... |
5d5a33922209dd3d60c73876ea3f232a3e9b206fb4e5c7071fdb61d050b5f3eb | Python | 3,458 | 93 | # TODO: There are now in-place operations in TensorTanh and TensorRelu, why?
import torch
import torch.nn.functional as F
from .base import TensorActivateLayer
from ..utils import expand_to
class TensorTanh(TensorActivateLayer):
def activate(self,
input_tensor: torch.Tensor,
) -... |
5ec4b9ff663c1ec417cde86f4dc83acfe47afc9e7ae7a3b4d5fb6d67c74a2580 | Python | 3,458 | 87 | #
# 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,... |
de4c40fd6ee68c797b7f0d2cbb2b52cbc59d16d5cbfaeb167ee500f2fcdb2ca1 | Python | 3,458 | 68 | import os
import unittest
from hed.models.sidecar import Sidecar
from hed.models.tabular_input import TabularInput
from hed.schema.hed_schema_io import load_schema_version
from hed.tools.analysis.event_manager import EventManager
from hed.tools.analysis.hed_type import HedType
from hed.tools.analysis.hed_type_counts i... |
fb6a116f3cffebac1607ae708cb766e6802341b03e53d1777d5fd690510ae233 | Python | 3,459 | 91 | """Each encoder should have following attributes and methods and be inherited from `_base.EncoderMixin`
Attributes:
_out_channels (list of int): specify number of channels for each encoder feature tensor
_depth (int): specify number of stages in decoder (in other words number of downsampling operations)
_... |
51559d925244a326f81f228a2d9ead7a8936514ccd278bc2413383a992b6359d | Python | 3,460 | 121 | """Custodian handlers for QChem."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import QuaccDefault, get_settings
from quacc.types import DefaultSetting
if TYPE_CHECKING:
from pathlib import Path
has_ob = b... |
e09985232baace26c0727123661e3f5be0326531e550fd192d296319f1c04be9 | Python | 3,461 | 112 | import fire
import os
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
import math
from PIL import Image
import seaborn as sns
from .utils import filter_dataframe
def plot_image(img_path, ax):
im = Image.open(img_path)
img = np.array(im)
ax.imshow(img)
del img
del im
re... |
3ff1845eed6787d0d29bc2a37640f1b58b1ee913b0646f827f739330ae2f935b | Python | 3,462 | 95 | import jax
from jax import numpy as jnp
import numpy as np
from jaxtyping import Array, Float, Int
from typing import Any, Callable, Mapping, Optional
from functools import partial
@partial(jax.jit, static_argnames=('max_n',))
def genlaguerre_recurrence(
n: Int[Array, "n"],
alpha: Float[Array, ""],
x: Floa... |
d4162310f834c645f6cf827c26fab90b412bc00e28e6821f36d9009371a0e70d | Python | 3,462 | 95 | import dotenv
import os
import glob
import json
import importlib
from typing import List
from merlin.core import dataset
envPath = os.path.join(os.path.expanduser('~'), '.merlinenv')
if os.path.exists(envPath):
dotenv.load_dotenv(envPath)
try:
DATA_HOME = os.path.expanduser(os.environ.get('DATA_HOME... |
b1cdda661fb4e85f58104588be30b5c96a38e32c47ce7a2e9a1f73cfdcc30016 | Python | 3,463 | 107 | import jax
import jax.numpy as jnp
import numpy as np
import flax.linen as nn
import jax
import jax.numpy as jnp
import numpy as np
from netket.utils import struct
import netket as nk
from typing import Optional, Any
from netket.sampler import MetropolisSampler, MetropolisRule
import netket.jax as nkjax
from netke... |
f27a038068a6b97feb2f05e7f1d91692ac635153a93129bdfb9f86e506423581 | Python | 3,463 | 94 | """Each encoder should have following attributes and methods and be inherited from `_base.EncoderMixin`
Attributes:
_out_channels (list of int): specify number of channels for each encoder feature tensor
_depth (int): specify number of stages in decoder (in other words number of downsampling operations)
_... |
677e3fc0b71cd0794ea141d4d1f36e1e08bfba3ee705c1bc7a4f361678cc8386 | Python | 3,465 | 97 | import torch
from torch import nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.hardtanh.design import HardTanh as HardTanhDesign
from elasticai.creator.nn.integer.math_operations.math_operations import MathOperations
from elasticai.creator.nn.inte... |
f1f322f74995a6ccba3c10b26e803accc12d0021f032f35176a305c8e3ce4560 | Python | 3,465 | 109 | import torch
import torch.nn as nn
# from tltorch import TRL
class Concater(nn.Module):
"""
Concatenates an output of some module with its input alongside some dimension.
Parameters
----------
module : nn.Module
Module.
dim : int, optional
Dimension to concatenate along. The de... |
f5a653c9c7d077f984d68f14c5b7152b13077e23f659df018ec52e8eeec381c8 | Python | 3,465 | 119 | '''
calculate the PSNR and SSIM.
same as MATLAB's results
from EDVR
'''
import os
import math
import numpy as np
import cv2
import glob
def tensor2img(tensor, out_type=np.uint8, min_max=(0, 1)):
# 4D: grid (B, C, H, W), 3D: (C, H, W), 2D: (H, W)
tensor = tensor.squeeze().float().cpu().clamp_(*min_max)
ten... |
34b14b6847557ba570cea4b66864552402db54397108b3addad4f91a551b8760 | Python | 3,466 | 84 | #
# Copyright (C) from 2009 to Present EPAM Systems.
#
# This file is part of Indigo toolkit.
#
# 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... |
a8e58821df77f08d62397a983621908b30737a6f01c05c89e5268666ad7474bd | Python | 3,466 | 84 | from glob import glob
import os
from pathlib import Path
import pydicom
from Artificial_Data_Generation.CTData import CT3D, CTLayer
class Patient:
def __init__(self, patient_id, path):
self.id = patient_id
self.path = os.path.join(path, patient_id)
self.ct_3d = self.__set_ct3d()
se... |
bd4d69c5d39ca7499701389cf7ef5ee1ef0abec1c59f5a622e99cab2e4fb4962 | Python | 3,466 | 107 | """ "
Using _zensical.toml as a starting file, generate a zensical.toml with navigation links
generated from `docs/reference/SUMMARY.md`.
This is roughly equivalent to what the `mkdocs-literate-nav` plugin would have done.
"""
from __future__ import annotations
import re
import sys
from pathlib import Path
def par... |
0e598bd9448aea5a2a631f9ce035313c6c81c0c1331b03cc1417a6df49d1f552 | Python | 3,467 | 85 | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Literal
from scanpy import settings
from pertpy._logger import logger
from pertpy.data._dataloader import _download
if TYPE_CHECKING:
from collections.abc import Sequence
class MetaData:
"""Superclass for pertpy'... |
520ef3b80ed12f1c97609a903135e4c93b8f0b4183eaece384ace77fbe73b9ff | Python | 3,467 | 90 | # Create a minimal vcf for testing
from dataclasses import dataclass
header = '''##fileformat=VCFv4.2
##FILTER=<ID=LOW_TUMOR_VCN,Description="Germline variant has very low tumor variant copy number">
##FILTER=<ID=PASS,Description="All filters passed">
##FORMAT=<ID=AD,Number=R,Type=Integer,Description="Allelic depths ... |
58b1bbeb3b71161a4107f64bd42aa0c16a4868d40fc1b52fed0043f1d1e0bb4d | Python | 3,467 | 113 | # 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... |
dc5acebce5547e21a6f024a4bcdea0731df32bbdb4bc83d88486e6d45cee5afd | Python | 3,467 | 104 | """Utility functions for pycudadecon."""
import io
import logging
import os
import sys
import warnings
from contextlib import contextmanager
from inspect import signature
from typing import Any, Callable, Iterator, Union
import numpy as np
import tifffile as tf
logging.getLogger("tifffile").setLevel(logging.ERROR)
... |
59b71d274db6ac34fb01339beabb2eec126098a726132f25d8c54fc350c52fda | Python | 3,468 | 103 | # coding=utf-8
# Copyright 2021, The Facebook, Inc. and The HuggingFace Inc. team. All rights reserved.
#
# 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/... |
293c8da9f96d55a5d5d2c3c4a9af6a7f3c87c4cc6a45c5b079800ac78f92a02b | Python | 3,469 | 117 | """Phonon recipes for TBLite."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import flow
from quacc.recipes.common.phonons import phonon_subflow
from quacc.recipes.tblite.core import static_job
from quacc.wflow_to... |
3299ee1bbabc2264a7daac7bf0f9eafef9b99c1b6a7d817024d011e8f427e2ae | Python | 3,469 | 109 | # 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... |
8fd7155fd6c6155ac5865d941d424ba5d77f912e3e094dbe32885c4e2f1c5e39 | Python | 3,469 | 85 | import os, sys, glob, time, argparse, shutil
from dask.distributed import Client, LocalCluster
import m6atm.preprocess.ReadClass as RC
import m6atm.preprocess.ResquiggleUtils as RU
import m6atm.preprocess.ResquiggleViterbi as RV
import m6atm.preprocess.FeatureTable as FT
import m6atm.preprocess.OtherUtils as OU
def p... |
c8fbc725ea4a83f673b04e807e8ca929c7967c1176363cf846e2c851d414a6fe | Python | 3,469 | 93 | # By Shuran Liu, 2023
import random
import numpy as np
from torch.utils.data import Dataset
import h5py
import cv2
class TrainDataset(Dataset):
def __init__(self, h5_file, patch_size, scale):
super(TrainDataset, self).__init__()
self.h5_file = h5_file
self.patch_size = patch_size
s... |
e41c3fd43544f0f177cfebcc00bb20514b26173ff4415db756b6df19c7228cfb | Python | 3,472 | 95 | import mne
import numpy as np
import pandas as pd
from pathlib import Path
from tracking_utils import load_config
from mne_connectivity import spectral_connectivity_time
from warnings import simplefilter
# Suppress future warnings
simplefilter(action='ignore', category=FutureWarning)
def main():
# Load configura... |
8651a3be72834dfd94ffcaaab8df3a97636273dbce2489d480379d674a447437 | Python | 3,473 | 115 | import dreamcoder.domains.arc.arcPrimitives as p
from dreamcoder.domains.arc.makeTasks import get_arc_task
# from dreamcoder.domains.arc.arcInput import load_task
def check_solves(task, program):
for i, ex in enumerate(task.examples):
inp, out = ex[0][0], ex[1]
predicted = program(inp)
if p... |
43366e4fcc08b104e2758a62ca43ab80e2ad7ac65a37621ee9a95b29f99f8807 | Python | 3,474 | 84 | import os
import numpy as np
import pandas as pd
import pytest
def test_count_2d_pair_rejects_bad_point_shape():
# Guard against silent coordinate scrambling: a mis-shaped array must raise,
# not reshape(-1, 2) into garbage (PR #90 Copilot #5).
from regtools.registration.point_registration import... |
b4641eabede908ebe1be5bd21837406906bc02c2552f483487f3fa67c4d54ecd | Python | 3,474 | 90 | #! /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 = ... |
7cacb17d60dc8f4d4abc5f67f0c516465c543d641ea17f198caa7980e4de9c54 | Python | 3,475 | 89 | #! /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 = ... |
58ec2c2518263a0b9a3af1138b8de9540384953b1a4776a2e697b29a4dfc9379 | Python | 3,476 | 92 | import os
from glob import glob
import numba
import numpy as np
import pandas as pd
import scipy.sparse as sp_sparse
from numba import njit
from .utils import _check_data_dir, echo, secho
# ignore division by 0 and division by NaN error
np.seterr(divide="ignore", invalid="ignore")
class Smoother(object):
def _... |
99f95f527efb08ac5cd3405616fd28dcf6e3c27fb7ff7cdd2d5d5c1152117877 | Python | 3,476 | 113 | # Integration tests for solution networks
# -> check that they classify their target datasets correctly
import unittest
import torch
from shapelearningtheory.networks import ColorConvNet, CRectangleConvNet, \
SRectangleConvNet, TextureConvNet, LTConvNet
from shapelearningtheory.datasets import make_rectangles_wrong... |
5cc5118ac4cf1fe5b95e075c7d1bf73d5df9ec551985fe4e3c9e640dcd3404d9 | Python | 3,477 | 120 | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 13 11:01:13 2024
@author: mpolonen
"""
import numpy as np
import pathlib
import scipy.signal as sig
from expyfun.io import read_hdf5, write_hdf5
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
plt.ion()
src = pathlib.Path(__file__... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.