sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8a4414f0be03e7265809be18712a59b0c723c5e22f61214e239a7461f0d8876a | Python | 3,579 | 52 | """BUILD_REPORT_PDF.py 2026-10-15. Turns the report (REPORT/REPORT_DRAFT.md) into REPORT/REPORT.pdf with the figures it
cites at the end, so that someone who opens the public record can read it without unpacking anything. The text is not
changed. Markdown -> HTML with markdown-it-py; HTML -> PDF with Chrome (or Edge)... |
b5bf88c04bc04e93184282cd7b7e667ca87a2e0f0fa9440c43b4a73766c21c60 | Python | 3,580 | 108 | # Node-group asset "Offset Matrix" (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... |
c253d632542c2c0045eaebc9978185f0962ffec04851a1def938baa3c32a6b45 | Python | 3,580 | 119 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
3bfeef42a90216e1b8cdd9617fbb54e96d360c3b89a5946b9d9a1fc612601e29 | Python | 3,581 | 92 | import numpy as np
from ...utils.collections import dotdict
def loadDefaultParams(Cmat=None, Dmat=None, seed=None):
"""Load default parameters for the Wong-Wang model
:param Cmat: Structural connectivity matrix (adjacency matrix) of coupling strengths, will be normalized to 1. If not given, then a single no... |
3d9b22e6a69caf6427dca1f0e2ac371a6d4cceb05b94f1e84dd8ea8c7ec4296c | Python | 3,581 | 120 | import collections
import pathlib
import operator
from . import abc
from ._itertools import unique_everseen
from ._compat import ZipPath
def remove_duplicates(items):
return iter(collections.OrderedDict.fromkeys(items))
class FileReader(abc.TraversableResources):
def __init__(self, loader):
self.p... |
3dba93f473ebbf43373ad6f7f39b5c7e0be2c81df3d3233b8382377f2be23799 | Python | 3,581 | 105 | import numpy as np
from config import MODEL_PATH, DATA_DIR, LABEL_FORMAT
from model import CNN
from cv2 import imread, imwrite
import cv2
from preprocess import preprocess, preprocess_basic
import os
import csv
import matplotlib.pyplot as plt
# adapt such that it works for all formats ('one-per-item', ...)
# restore c... |
44083a133c122c08df96e7423776d6e3e939e19bf3641bbf3d054b6cb17c4003 | Python | 3,581 | 101 | # 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... |
c017aef8b3f44b3efe2dd08581b33faaf29d5785491ae63b62d22aae59674abb | Python | 3,581 | 67 | # 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... |
1785ff56ae748287c79f635d80398d5e4746412135b8927a4d42f15d9a3b3ca1 | Python | 3,582 | 87 | """Whole-value rules of the value classes, as the character table defines them.
The dateTimeClass rule is the BIDS Datetime format (RFC 3339 with an optional offset), shared with
hed-specification's character_sets.json, followed by a Gregorian calendar check of the date (Kay,
2026-10-02); the numericClass rule uses AS... |
1cda74f1887dcdd3037c1486123eb445266317eebc826c608670b398ae23cbac | Python | 3,582 | 127 | import os
import pickle
import tempfile
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
import wandb
from sklearn.metrics import (
accuracy_score,
average_precision_score,
confusion_matrix,
precision_recall_curve,
roc_auc_score,
roc_curve,
)
def get_current_ti... |
e45d6ebd7c46d65270826a8cbb13406d92ee8095f2755050420bfb7d2c05c92d | Python | 3,582 | 118 | # Node-group asset "Fallback Camera" (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... |
a31042d92fd1701460fa877225aee9e08a3bddc97f0f89afa90df1965456641c | Python | 3,583 | 98 | from __future__ import annotations
from wikibaseintegrator.models.basemodel import BaseModel
from wikibaseintegrator.models.language_values import LanguageValue
from wikibaseintegrator.wbi_config import config
from wikibaseintegrator.wbi_enums import ActionIfExists
class Aliases(BaseModel):
def __init__... |
0c5cd4d27a797e312edc6fb069a1dace789fb8b87b83094e50aab094f467bdda | Python | 3,584 | 124 | # 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... |
54100d2b3427721c11d61e66e11996868c68af739ddd7fc26322a8e58fe0b9af | Python | 3,584 | 84 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
a0ee6bb02d06edbfa71ea9d6ae5d229c5d1de238375729676f62b68fb2019a67 | Python | 3,584 | 102 | import itertools
from typing import Dict, List, Union
import matplotlib
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from matplotlib import colors
from pylab import cm
from ..utils import LazyLoader as _LazyLoader
from .utils import _plot_to_image
_pyg = _LazyLoader(
'torch_geometric'... |
caad46f035d46cf58728629cb2c97b60ce6417b9902fc8a4c5f1f6e5334fbe6d | Python | 3,584 | 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... |
6995a69d67ef181f364f445ed009a882ae591c4c1742357e6bac6f57508f1d69 | Python | 3,585 | 89 | from pandas import read_table,read_excel
from matplotlib.pyplot import get_cmap
import numpy as np
class Reader:
def __init__(self,data,file,machine):
d_reader = {'NeuroLight':self.read_NeuroLight
,'Diagnosys':self.read_Diagnosys,
'Neuroptics':self.read_Neuropti... |
87407dbd08f4c245a1134e4a34eb327ab4009a2e94418eb9cfd526f15219ba0b | Python | 3,585 | 73 | # MIT License
#
# Copyright (c) 2024 Zihan Zhang, Yi Zhao, Harbin Institute of Technology
#
# 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 limi... |
4775abf9a3bf815b78dc19d793b71f6ba1854cb789e35ddb5050c6af014e6ddc | Python | 3,586 | 97 | '''
Description:
Model evaluations.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import numpy as np
import torch
from scipy.spatial.distance import cdist
from geomloss import SamplesLoss
import pandas as pd
from sklearn.neighbors import NearestNeighbors
# =====================================
# ... |
792c8035af0437692a0ecf20b50b21248aab8cbffa46223227452a40fe1d3393 | Python | 3,586 | 112 | import torch
import pandas as pd
import numpy as np
import math
from utilities.preproc_func import *
def create_simulation_dataset(instances=3000):
dictionary= {
"x0":[],
"x1":[],
"x2":[],
"x3":[],
"x4":[],
"x5":[],
"x6":[],
... |
2a9ef0b1fc390353c21071cdb1730a27e2f54fa7dcddb8939369b596ce61076c | Python | 3,587 | 148 | """
Author: Hao Wu
hwu01@g.harvard.edu
This is the helper class for video reading and saving in DeepLabCut.
Updated by AM
You can set various codecs below,
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
i.e. 'XVID'
"""
import numpy as np
import cv2
class VideoProcessor(object):
'''
Base class for a video processi... |
4cbaa254dccf313b90e5abcbe24de4623260228c3bbf49b52796ebafdb021eca | Python | 3,587 | 115 | #!/usr/bin/env python
#CheckV Copyright (c) 2020, The Regents of the University of California,
#through Lawrence Berkeley National Laboratory (subject to receipt of
#any required approvals from the U.S. Dept. of Energy). All rights reserved.
import Bio.SeqIO, time, gzip
from operator import itemgetter
import numpy as... |
ab0a2dfc615f6d3984306fc581672a2c56f93a720ceb218dc91665df839fee3d | Python | 3,587 | 127 | # 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... |
67e61615e07d2839e37deca5dbb3c213ebd48918246455e6f74d7a79f215b603 | Python | 3,588 | 118 | # -*- coding: utf-8 -*-
#
# Test if Syncopy's basic import setup/tmp storage initialization works as intended
#
# Builtin/3rd party package imports
import os
import sys
import shutil
import time
import tempfile
import importlib
import subprocess
import pytest
from glob import glob
# Local imports
import syncopy
# De... |
f750531a08fb66fb5954a55219d5d1fe147b84e8077c285f6e1d3b55a053e278 | Python | 3,588 | 113 | # Node-group asset "Is Alpha Carbon" (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... |
1678e05ecf1f929541f526e09610319b8218f895aa7f39179a44900236da598b | Python | 3,589 | 82 | import argparse
import json
import os
import sys
from constants import DATA_DIR, REYMULTICLASSIFIER
from config_train import config as train_config
from config_eval import config as cfg_eval
import hyperparameters_multilabel
from src.training.train_utils import Logger
from src.models import get_classifier
from src.dat... |
19caa802698c6eea7ba87694f21ae9925387c2774dee2b1666fd54cbce27ba2f | Python | 3,589 | 119 | from __future__ import annotations
import pytest
torch = pytest.importorskip("torch")
from importlib.util import find_spec
import numpy as np
from ase.build import bulk
from quacc.recipes.mlp.core import relax_job, static_job
methods = []
if has_mace := find_spec("mace"):
methods.append("mace-mp-0")
if has_m... |
26c6c1efacc8eabaefbcd57a2b5d994d5a718db70b22bf840d8b66797acb82d3 | Python | 3,589 | 121 | '''
from unittest import TestCase, skip
from unittest.mock import MagicMock, patch
# from tgan import launcher
launcher = None
@skip()
class TestLauncher(TestCase):
@patch('tgan.launcher.subprocess.call', autospec=True)
@patch('tgan.launcher.multiprocessing.current_process', autospec=True)
def test_work... |
66d0709e10e9400d9bc486b33d7343436e6e371338a76a26b1a491369577ae91 | Python | 3,589 | 127 | """distutils.errors
Provides exceptions used by the Distutils modules. Note that Distutils
modules may raise standard exceptions; in particular, SystemExit is
usually raised for errors that are obviously the end-user's fault
(eg. bad command-line arguments).
This module is safe to use in "from ... import *" mode; it... |
30059ea1025ed751fd437a36ff53705964f0a8c758ce8f917435acd2a6dbef0b | Python | 3,590 | 100 | # Libraries
import os
import sys
import numpy as np
from scipy.sparse import csc_matrix, save_npz
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import argparse
from setting import *
from loader import *
from graphs import *
from utils import *
# Arguments
argParser = argparse.... |
4a35281c8ed20e3654d7911d3c6559f302b9785026800a885548dbc484a01866 | Python | 3,590 | 108 | # Node-group asset "Offset Integer" (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_CHECKIN... |
c9bad439fcd65fe70a42506e6f70d65166d130bd9bf548a694d5e0518ff700fb | Python | 3,590 | 86 | import pandas as pd
import numpy as np
from scipy import sparse
import pickle
from keras import models,regularizers,optimizers
from keras.layers import Dense
from keras.models import load_model
from tensorflow import keras
from keras.utils import to_categorical
from sklearn.utils import shuffle,class_weight
from sklea... |
94e37c48708f2833465f5ae306953e310932ff722c97b0bafdf858d18b12e59d | Python | 3,591 | 103 | """Start acquisition control manager service/process."""
import argparse
import atexit
import logging
from pathlib import Path
from console.service.acquisition_manager import AcquisitionControlManager
from console.spcm_control.acquisition_control import AcquisitionControl
# acquisition_control: AcquisitionControl | N... |
5f8fc6299def41e3e78024dfe27f75b0c6b846a88bae0a9bd54d9970ae1a58f6 | Python | 3,593 | 131 | """Functions to handle data arrays
"""
import numpy as np
from decimal import Decimal, ROUND_HALF_UP
def round_nonzero_decimal(num, precision=1, method="round"):
"""
Rounds an input decimal number starting from its first non-zero value.
For instance, with precision of 1, we have:
0.09324 -> 0.09
... |
74e82245159e024adf0e476f262b0a47426a633f16a3f2391771eed2241c55a8 | Python | 3,593 | 120 | #!/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', ... |
accea64f9a4bbaa57b5b0b1f6ae3ae8d8869a2907e4ee58898bfb8a09bf493d6 | Python | 3,594 | 58 | # -*- coding: utf-8 -*-
################################################################################
## *
## * Function: prepare dag file to run GSEA on CHTC for top outlier sites]
## * Writer:Siyuan Feng
## * Mail: siyuanfeng.bioinfo@gmail.com
## * Created: 04.01.2022
## * Last modified: 10.03.2022
####... |
146a907e6fdcfa50fb306312662d3f690bfa77d7f9be6196c92237cc62992b95 | Python | 3,595 | 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... |
2fd4e549b31d80f226662dd9de687be7db6ab66ca6e9461a14ded812a14a364e | Python | 3,595 | 115 | # Node group ".MN_utils_style_spheres_points" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accesso... |
6fcc9086ac02fc68c019e49f6328bc01dac99bc91aac15201e2dd214f06b653d | Python | 3,595 | 120 | import os
import pybullet as p
from pybullet_tools.utils import create_mesh, set_point, read_pcd_file, disconnect, \
wait_if_gui, mesh_from_points, get_links, get_num_links, connect, load_pybullet, \
create_obj, WHITE, get_client, NULL_ID, set_color, get_all_links
SODA_CLOUD = 'soda.pcd'
CLOUDS = {
'oil': ... |
b6850c86187c407e562b55e2e456296a4d31fdd237ae9ec9ea397547ed6953b5 | Python | 3,595 | 86 | """Foreground-boundary correspondence source for the Laplacian refinement
(--foreground_correspondences {all,exterior})."""
import inspect
import numpy as np
import pytest
def _c():
from regtools.registration.core.laplacian import correspondence as c
return c
# ---- core: foreground-boundary... |
1e632689dbbd50eb6ded3f40c44ce07d6127122aa867efdd697cc733ba3c6447 | Python | 3,596 | 96 | #
# 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,... |
5378ecf9537bad31a787550977ee231ce0a939aa3df9b9659e888f8947e8bb61 | Python | 3,597 | 118 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2021 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : image_io.py
# Author : Yufeng Liu
# Date : 2021-05-17
# Description :
#
#======================... |
d3be91a81a6cf35d24a4d2b7b1ea007a54c20ca83eb73d909af2fcd42a86c62d | Python | 3,597 | 88 | """
This script computes the averaged-ROI ts for the resting state data. It also performs
the scrubbing, applies the Fisher transform, regresses the mean FD and saves the matrices.
@author: trianaa1
"""
import glob, os, sys
import numpy as np
import pandas as pd
from scipy.io import savemat, loadmat
from sklearn.l... |
e8fe8b67ff4a05ab4fc43491c0e943686565f6ee8f7c6bc7a8c028229e1e280d | Python | 3,598 | 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... |
096fdc701e0797f40e16aaf48f8ac8c27a3e21cd749a42191817bfb8fbc97ccd | Python | 3,599 | 118 | import numpy as np
from sklearn.metrics.pairwise import pairwise_distances
def reliefF(X, y, **kwargs):
"""
This function implements the reliefF feature selection
Input
-----
X: {numpy array}, shape (n_samples, n_features)
input data
y: {numpy array}, shape (n_samples,)
input ... |
59bb6bcacbe511d6b98711092c3c68d02468018a9a5157477a0feca43443504f | Python | 3,599 | 123 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 2 17:32:22 2023
@author: trianaa1
This script visualize the FD for the movie watching task
"""
import os
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
def coun... |
62a6b3a0867299afd0d5e8c56b50bb3472904515a5bd691d2bde9544a98305e2 | Python | 3,600 | 92 | """Represents a wheel file and provides access to the various parts of the
name that have meaning.
"""
import re
from typing import Dict, Iterable, List
from pip._vendor.packaging.tags import Tag
from pip._internal.exceptions import InvalidWheelFilename
class Wheel:
"""A wheel file"""
wheel_file_re = re.co... |
cd7d601e97d8817ba6c802e8a150e587ec8d1e03d99c86c66518f91e5630aab0 | Python | 3,600 | 66 | from glob import glob
import torch
from monai.data import Dataset, list_data_collate, DataLoader
from monai import transforms
from monai.utils import first
def get_data_loader(image_dir, batch_size=1, mode='train'):
"""Build and return a data loader."""
channel = 0
assert channel in [0, 1, 2, 3], "Choose ... |
5c9702bd20fe5c6d5dd2c51d8cf195e90f13d22a46d47876ec49a55f8203d671 | Python | 3,601 | 73 | import numpy as np
from scipy.ndimage import zoom
from plantsegtools.utils.io import smart_load, create_h5, create_tiff
from plantsegtools.postprocess.seg_nuclei_consistency import fix_over_under_segmentation_from_nuclei
import os
import argparse
def parse():
parser = argparse.ArgumentParser()
parser.add_argu... |
bf5a9ea776d3283b066aed21a869649a7f4cd55dbc75c47b24a4b6042bb9230c | Python | 3,602 | 99 | import os
import pandas as pd
LABEL_FORMAT_ONE_PER_ITEM = 'one-per-item'
LABEL_FORMAT_THREE_PER_ITEM = 'three-per-item'
def join_ground_truth_files(labels_root: str) -> pd.DataFrame:
"""
find all csv files in labels_root and join them into one pandas dataframe
returns:
pd.DataFrame with merged us... |
c92f90e8882c85fe5f9e19571869c0a51f7c38e079895f8c50c9f713d0c0e8d2 | Python | 3,602 | 122 | import socket
import threading
import socket_tcp
def listenerThread(client, onRecvFunc, onDisconnectFunc):
if not client.isConnect:
raise socket_tcp.portNotConnectError
try:
while client.tbListenerRun:
# 接受一个字节不取出
data = client.recv(bufsize=1, bLog=False,
... |
29378944e7e1066e897afee5ea4d3f4d9378c3027fcd0015c01fbec6e9de7abd | Python | 3,603 | 69 | """PatchCamelyon(PCam) dataset
Small 96x96 patches from histopathology slides from the Camelyon16 dataset.
Please consider citing [1] when used in your publication:
- [1] B. S. Veeling, J. Linmans, J. Winkens, T. Cohen, M. Welling. "Rotation Equivariant CNNs for Digital Pathology". arXiv [cs.CV] (2018), (available at ... |
e8cdcd0a7ab5093d4ef40a9d9eef3431ade6433e9dd6af1125fc81179fa2ceec | Python | 3,603 | 97 | from pathlib import Path
from helpers import load_config, cluster_signal, find_peak, mean_amplitude_around_peak
import pandas as pd
import numpy as np
import mne
mne.set_log_level('ERROR')
if __name__ == '__main__':
# Load configuration
config = load_config('evoked_config.yaml')
no_participants = config[... |
0879cc5cc4ed3b11709f46f393e8baaec221acea1799064066af8288e395bdd5 | Python | 3,604 | 67 | """BUILD_INDEX.py 2026-10-15. Writes INDEX.md at the project root: every script (03-CODE, then the post hoc ones in
08-SANDBOX) with its date, its pre-registration and what it does, taken from the script's own opening text, and every
pre-registration with its title. Descriptive; it changes no other file.
usage: pyth... |
a19ed78af7f653c43ad8739c847fff1e381e6fe30e31fcdbeb775d6000cf1830 | Python | 3,604 | 130 | import os
import toml
import glob
import shutil
import logging
from ase.io import read
from ase.atoms import Atoms
from quacc import get_settings
from quacc import strip_decorator
from typing import List, Dict, Any
from quacc.recipes.mace.ts import ts_job, irc_job, neb_job
def neb_ts_no_hess_irc_mace(
reactan... |
b70cca5a76f694355c43e00e734d36c8ce6e9bed0d3a2fe9abeacaec9e82bdd2 | Python | 3,605 | 102 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import CONV_LAYERS
@CONV_LAYERS.register_module(name='PConv')
class PartialConv2d(nn.Conv2d):
"""Implementation for partial convolution.
Image Inpainting for Irr... |
b88f568343dc1bd21df94e96ade91c9841ae942c8cf1e54d844398f39e21c7ba | Python | 3,606 | 92 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import itertools
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from downward.reports.compare import ComparativeReport
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterP... |
d00a7e127e64a85074cc569cc6ca697ee782f1830211eb4e1c02285489a53a9f | Python | 3,606 | 154 | from random import shuffle
from itertools import islice
import time
import contextlib
import pstats
import cProfile
import numpy as np
INF = float('inf')
RRT_ITERATIONS = 20
RRT_RESTARTS = 2
RRT_SMOOTHING = 20
try:
user_input = raw_input
except NameError:
user_input = input
def irange(start, stop=None, ste... |
f710bd8d737a67ef19b97a4a313cfa7d97400e6b8ba4b93e7a2268884a77001f | Python | 3,607 | 75 |
# 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
#
# ... |
06cf257ab07bb4cc441183dc8688d843b4e3328ce73fba83b87ec7f6067e1325 | Python | 3,608 | 97 | #! /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 = ... |
c53ba679412973cc203b32eefb5f86d86f4ad453c6c7c2612ec949680b93b988 | Python | 3,608 | 122 | # Node-group asset "Color Secondary Structure" (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 T... |
5a228b939274aa4e85a40ac2e922c53fe351efb8d9ff7ae02dad5018141397ac | Python | 3,609 | 164 | from __future__ import annotations
import pytest
parsl = pytest.importorskip("parsl")
from ase.build import bulk, molecule
from quacc import job, subflow
from quacc.recipes.emt.core import relax_job, static_job # skipcq: PYL-C0412
from quacc.recipes.emt.slabs import bulk_to_slabs_flow # skipcq: PYL-C0412
def te... |
42007478601e6fa358130152f877b9352ef7446d78e8e07241b6a22d8bad9d39 | Python | 3,610 | 107 | import numpy as np
import imageio
import tifffile
import mat73
import json
import os
import shutil
import numpy as np
def readtif(filepath, dtype=np.float32):
"""
Read tif or tiff image stack from file.
Returns:
out: image stack in ndarray; (N, H, W)
"""
# Read the tif file... |
4ecfa2c7d697eda9a3f2d2518fdaf5dc13cb48f8894d4dc1f37c2a3a3437ae3f | Python | 3,611 | 111 | # 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... |
d12f31e633c508478c88f33456d1e9587b67af72821f3f9c64ad334525a479ad | Python | 3,611 | 84 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
f05a57eacfc7cf2d785c91e435b4241dcda2f345deab438b17036ec3f08712d9 | Python | 3,611 | 103 | from typing import cast
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
from elasticai.creator.nn.fixed_point.hard_sigmoid.layer import HardSigmoid
def test_vhdl_code_matches_expected_hardsigmoid() -> None:
expected = """-- This is the hard_sigmoid implementation for fixed... |
f759ff86fbaa0c4273295e3c8ba6e822922c2c9aadd1751b4cf011846b13d964 | Python | 3,611 | 96 | import argparse
import os
import numpy as np
from glob import glob
import math
import random
import pandas as pd
import os.path as op
import sys
import mne
import pickle
import nibabel as nib
import os
import re
from segmentation import segment_electrodes, electrode, point_of_electrode, representative, probe, load_p... |
8519dbd54d707ea8b6a62924b2ed474df6f45c39fc2db263fe75e3e217da9e08 | Python | 3,612 | 94 | """"Module to to test the performance of the translation model to extract
meaningfull features for a QSAR modelling. TWO QSAR datasets were extracted
from literature:
Ames mutagenicity: K. Hansen, S. Mika, T. Schroeter, A. Sutter, A. Ter Laak,
T. Steger-Hartmann, N. Heinrich and K.-R. MuÌ´Lller, J. ... |
c98dcc4780479e038166b0e742cc29a00aca1d678d03f02c2c2a094cb4c9610d | Python | 3,612 | 85 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class FCLayer(nn.Module):
def __init__(self, in_size, out_size=1):
super(FCLayer, self).__init__()
self.fc = nn.Sequential(nn.Linear(in_size, out_size))
def forward(self, feats):
x = s... |
23964d8e3dd78b0d9b2aa98d5724e1fcdfc44f833319d995f023d4c49512cd9e | Python | 3,616 | 122 | # 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... |
cc55b460589a561a3141bfeafa65f594fdf3444b5ce8a64a3b0640983f19803d | Python | 3,616 | 125 | #!/usr/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This file containts CallBack class and SensorInterface, responsible of
handling the use of sensors for the agents
"""
import copy
import logging
import numpy as np
import ca... |
aa579c9eef0fc5e2e71aac8cba84405c060f8afb3c93b1ec7f57180286a31759 | Python | 3,617 | 88 | #
# 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,... |
ad6f9b88cc23dff7312b787e61400ff5aa333cec622e3f8b763643e7f2493532 | Python | 3,617 | 102 | """GUI layout/theme regression guard for the Parameters tab.
The affine-stage controls added on top of parameters_tab.py (the "Affine
method" dropdown + the 5 "aff_*" advanced-override fields) live in a
QGridLayout inside a QScrollArea. This guards against them overflowing that
column, mirroring the left-form gua... |
4b7be0ee6d1b1bf81da1fb3f180098100995cd76117f9dbead733081802e68aa | Python | 3,618 | 117 | # -*- coding: utf-8 -*-
"""
Created on March 30th 2023
@author: divyoj
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
def divergence(f):
"""
Computes the divergence of the vector field f, corresponding to dFx/dx + dFy/dy + ...
:param f: List of ndarrays, where ... |
5ea428780dbb2317611138e8c8478bf7e185a9604f93297f12698e9134ce544e | Python | 3,618 | 130 | def get_conditioninfo(condition, srmr_nr):
# return info of the different conditions
class CondInfo():
def __init__(self):
pass
if srmr_nr == 1:
# conditions:
# 1 = rest,
# 2 = median stimulation,
# 3 = tibial stimulation,
# 4 = alternating median... |
7207af9805ac0a06e89e6e8db5f077a07bb2eeefd26da43cd436750ee8e5a1b9 | Python | 3,618 | 104 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to docume... |
92ad4f02d2bf54f2dc0bee230c696140714226c58ba82ffeed3ff5963e4f4631 | Python | 3,618 | 121 | #!/usr/bin/python
import sys, getopt
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm, ticker
from scipy import optimize
def main(argv):
inputfile = ''
outputfile = ''
data_profile = []
## LEGGERE FILES
try:
o... |
b48e7d77ad8bf572941ac1c5bf00ea8ba9fcf18c90ecd3ec1658fdb33ccb3612 | Python | 3,618 | 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... |
c3c253215bd985ac938a9ad4a05a5d9e5d5e72c6cceea70a32acf4146976b9ad | Python | 3,618 | 67 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from lab.reports import Attribute, geometric_mean
from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run
BENCHMARKS_DIR=os.path.expanduser('~/repos/downwar... |
31ce8248c4b52d064d9293a73416409e534d857ee4691dee2d1fad29b88aa538 | Python | 3,619 | 107 | """Models to estimate event probabilities."""
from abc import ABC, abstractmethod
from typing import Any
from warnings import warn
import numpy as np
from hmp.distributions import Gamma
from hmp.patterndata import PatternData
from hmp.patterns import HalfSine, Pattern
class BaseModel(ABC):
"""The model to analy... |
f76f00b8d6728a8fd0dbc467f53141815a36ba15951cc78ecb4f0a2a54addc75 | Python | 3,619 | 53 | """
SENSORY_KNOWN_ANSWER.py written 2026-09-23.
Two sensory populations whose transmitter is known without any classifier:
photoreceptors R1-R8 -> histamine (not in the six-word menu)
olfactory receptor neurons (ORN_*) -> acetylcholine (in the menu)
What does the classifier call them, and how does that propagate ... |
4321cf23ca112a4eac287454ba267c22aa52f416352f0de9dcd3a9576908b397 | Python | 3,620 | 99 | """Split-Attention"""
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import Conv2d, Module, Linear, BatchNorm2d, ReLU
from torch.nn.modules.utils import _pair
__all__ = ['SplAtConv2d']
class SplAtConv2d(Module):
"""Split-Attention Conv2d
"""
def __init__(self, in_channels... |
75436599f1d5e92b017c5816543841568a064325ce19df669c9468feaef40368 | Python | 3,620 | 139 | # 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... |
9ae9e54e8a5da079096ae5729dfd2da46b0ffa7c38a2d3dd3101728b5e5cff9c | Python | 3,620 | 103 | """Implementation of CLI check command."""
import os
import json
import warnings
import numpy as np
from treem.io import SWC, TreemEncoder
def check(args):
"""Checks morphology reconstruction for structural consistency."""
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
da... |
ea2ce3a491d7195c478b262a94d0224aa294306d92fbc949cf997b6bd92506e9 | Python | 3,620 | 116 | # Node-group asset "Fractionate Float" (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_CHEC... |
01c12dd3ce1d9f205f4d14391e19785eea46d1f50d75b3c8f7579a1e6e8a24b2 | Python | 3,621 | 119 | from collections import defaultdict
from codex.data.brain_regions import neuropil_hemisphere
from codex.utils.formatting import display
from codex.utils.graph_vis import make_graph_html
def compile_network_html(
center_ids,
contable,
neuron_db,
show_regions,
connections_cap,
hide_weights,
... |
4894fb059bc1c7261ae8d3308ff8a6b7b8b65fa3cc823eaa9777a89fee103e81 | Python | 3,621 | 108 | # 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 of conditions and the f... |
d512d2b0b0d81678589758e391bc6a5c7d5476e5b0e364a4ad1ca9b1ad2739a3 | Python | 3,621 | 116 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : match_gs_recon.py
# Author : Yufeng Liu
# Date : 2023-04-04
# Description :
#
#================... |
0e19d07a0aec8afc2fc25b512a7d9bbad80f891d8952f0f8bd7bae9102346aea | Python | 3,622 | 125 | from enum import Enum
import cv2
class MethodAveragePrecision(Enum):
"""
Class representing if the coordinates are relative to the
image size or are absolute values.
Developed by: Rafael Padilla
Last modification: Apr 28 2018
"""
EveryPointInterpolation = 1
ElevenPointInterpo... |
d1f0c07921fad37c2b9b00f79cdf4535fdb4cad187522d791b566c90faa9da85 | Python | 3,622 | 80 | """Wording for load-failure dialogs (Qt-free, unit-testable).
A load can fail for two very different reasons:
* the user's file is genuinely unreadable/corrupt/unsupported - "check the
file" is the right nudge; or
* our own code raised on one of its objects (an ``AttributeError`` on a
``VolumeData``, a ``K... |
62426ed477de269decb2925f85a412ee698d0372f2ddee5e4d0b597ecc6597e2 | Python | 3,623 | 120 | """Base jobs for GULP."""
from __future__ import annotations
import os
from logging import getLogger
from typing import TYPE_CHECKING
from ase.calculators.gulp import GULP
from quacc import get_settings
from quacc.runners.ase import Runner
from quacc.schemas.ase import Summarize
from quacc.utils.lists import merge_... |
6569a3766c46cf45191f19a6aeee7147a0a54a6b3c5b47fecf857eac5b66fb9b | Python | 3,623 | 111 | # This code globalSOP_from_ssf_3d.py calculates the static structure factor(ssf) for a monodisperse 3d system(For systems with less than 7% polydispersity, this code can be used). From the ssf the global Mean field caging potential is calculated.
# Once you get the caging potential, the value at r=0 is the depth of th... |
a77b8a3567430b622c773230c947efaef76f745811db768ba82109e833fc2566 | Python | 3,624 | 120 | import json
import sys
import datetime
import os
import SimpleITK as sitk
from shutil import copyfile
from pathlib import Path
from src.utils import file_utils as futils
def get_paths(dir, extensions=list()):
paths = list()
files = os.listdir(dir)
files.sort()
for file in files... |
dbb19bb05ee21143c2e789ed665a9de39af96b9ec7bb6039cca03c7e5601bf4e | Python | 3,624 | 130 | from __future__ import annotations
import pytest
ray = pytest.importorskip("ray")
from pathlib import Path
from quacc import flow, get_settings, job, redecorate, strip_decorator, subflow
from quacc.wflow_tools.customizers import customize_jobs, update_parameters
def test_strip_decorators():
@job
def add(a... |
6cad6f45bd66746da247266fd5b7a3a93bf3d2300915c51a32a98f1334c14173 | Python | 3,626 | 115 | # Node-group asset "Color Goodsell" (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_CHECKIN... |
022652847765d6bbb3b98a1b9b1faa874be615d10709e9fec9744913e64b6f95 | Python | 3,627 | 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... |
26e503805e9fd4226364cdbb21a137f6b328f30b827f15fe5c0112b6c31787da | Python | 3,627 | 99 | # -*- coding: utf-8 -*-
from .models import (AttachJuxtaposeConstituencyParser,
BiaffineDependencyParser,
BiaffineSemanticDependencyParser, CRF2oDependencyParser,
CRFConstituencyParser, CRFDependencyParser,
TetraTaggingConstituencyPars... |
2b7d8105db53d160e33db77fc57e062153e670480cc40b13061c798a4ca3185c | Python | 3,627 | 94 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : calc_glob_features.py
# Author : Yufeng Liu
# Date : 2023-01-24
# Description :
#
#============... |
34aa3c56a2e2a09e279d75c6996e0a75ab3117dd04147919687797d5f4f4f02f | Python | 3,627 | 120 | """
A module that implements tooling to enable easy warnings about deprecations.
"""
import logging
import warnings
from typing import Any, Optional, TextIO, Type, Union
from pip._vendor.packaging.version import parse
from pip import __version__ as current_version # NOTE: tests patch this name.
DEPRECATION_MSG_PRE... |
823132c10631cf29fcbc1be454b64e3bf6789b3170b82b9280020923ef53b95a | Python | 3,628 | 164 | from __future__ import annotations
import pytest
parsl = pytest.importorskip("parsl")
from ase.build import bulk, molecule
from quacc import job, subflow
from quacc.recipes.emt.core import relax_job, static_job # skipcq: PYL-C0412
from quacc.recipes.emt.slabs import bulk_to_slabs_flow # skipcq: PYL-C0412
def te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.