sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d9d85e13d2b7dfb09d83d278675caee4f0567a630ef6b076a81483fc78f4b1eb
Python
2,101
46
import itertools def wrapper_generate_combination_dict(config_dict): ''' Given a dictionary where a key is a paramater name. We can pass list of values for a certain parameter. Now, our goal is to generate a list of dicts from the original dict such that the keys will be the same, however, each k...
de000e7261e36a8c5cdec8cc280a37ecb1dcdeecbfc7aad9705aa803b15c3439
Python
2,101
57
from __future__ import print_function import string import random import time import torch from robustfill import RobustFill modes = ['single', 'double'] for mode in modes: print("-"*20, "\nmode:%s"%mode) print("Making net...") net = RobustFill( input_vocabularies= [string.asci...
09d438a453bff433aea65b0430b03e84c5c82dc87fbbb45fb8762a28a21ccf23
Python
2,102
56
from __future__ import absolute_import, division, print_function, unicode_literals import argparse import logging import os import sys import tensorflow as tf import matplotlib.pylab as plt from tensorflow.keras import layers from tensorflow.keras import models import numpy as np import PIL.Image as Image import glob ...
4fa3a702ea87496f7ff6e1abec82d696d00ec6c07b82cf5927710c578d8da520
Python
2,103
67
#! /usr/bin/env python # -*- coding: utf-8 -*- #! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, arithmetic_mean, geometric_mean import common_setup from common_setup import IssueConfig, IssueExperiment from rel...
bbb5734b21d0ceb472a0fcae46cf1a6c9eb90901f6fae20249e7eb2ea4e38cfd
Python
2,103
61
import unittest import os import pandas as pd import sys sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src") from hornet.input import save_transformed class TestSaveTransformed(unittest.TestCase): def setUp(self): self.tmp = '.tmp' self.path = '.data_test' # Create...
8281863d113be81852b3f86d29a4bcb997811ed36a39eeb0c8e0f5d392c18f1c
Python
2,104
59
from typing import List, Optional import torch from ._functional import soft_tversky_score from .constants import BINARY_MODE, MULTICLASS_MODE, MULTILABEL_MODE from .dice import DiceLoss __all__ = ["TverskyLoss"] class TverskyLoss(DiceLoss): """Tversky loss for image segmentation task. Where TP and FP is we...
07f09992ca55ceb69f939bf418254fec5d3cefc32a21c0fdc4b455af1b10716f
Python
2,105
68
# 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...
3eabded6cf8f1516c2c1cb37db327450c76709ac1e56414dabef4a64d45874e6
Python
2,105
68
#! /usr/bin/env python # -*- coding: utf-8 -*- import itertools import os from lab.environments import LocalEnvironment, MaiaEnvironment from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment, RelativeScatterPlotReport DIR = os.path.dirname...
4240b83b1e78b950715c7976c836598b2d66d6fe2e74a08fe81f5ce91c169e7b
Python
2,106
53
import argparse import collections import logging from mode import multi_cross_validation_bootstrap, multi_train_bootstrap from parse_config import ConfigParser from utils import set_random_seed, override_n_genes SEED = 1126 set_random_seed(SEED) def main(): args = argparse.ArgumentParser(description='Main') ...
5c7e9e48153b784ded945a18b3658ad608479aabb19f1cc24608e76af32f3aa3
Python
2,106
78
############################################################################### # # # ############################################################################### def define_parameters(): """Create a Python dictionaruy and return all model's parameters.""" p = {} ### Physical Constants ...
79da66f4b7391cc66c18a10dcf49fa89c1d90a8df528e480afe3f402becf72cc
Python
2,106
58
# # 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,...
c19f40d8de276d4df29b0cdf5abe05e5e42fbd87869230b1ddaf9c24f9da2c4b
Python
2,107
61
import json import matplotlib.pyplot as plt import numpy as np import os import pandas as pd from typing import Tuple, Iterable from src.analyze.utils import init_mpl from src.analyze.performance_measures import PerformanceMeasures from constants import ABSOLUTE_ERROR, ERR_LEVEL_TOTAL_SCORE, ERROR_TO_LABEL _FIG_SIZE ...
fdace77ccdbc9e164c6c8c59900bf44dbc0f84b0c6132aac808fc954ade52393
Python
2,107
65
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: A.Akdogan """ import torch import os import cv2 from data_visualizer import one_hot_encode class NailDataset(torch.utils.data.Dataset): """ Args: images_dir (str): path to images folder masks_dir (str): path to segmentation masks fol...
e569baff1ee52ab96a5633c8e4c04dfd1bab7111f0558a10ecab2bb3ce1d7bbb
Python
2,108
57
import functools import logging import re from typing import NewType, Optional, Tuple, cast from pip._vendor.packaging import specifiers, version from pip._vendor.packaging.requirements import Requirement NormalizedExtra = NewType("NormalizedExtra", str) logger = logging.getLogger(__name__) def check_requires_pyth...
49be250f7e58ad4439f9aaf30093f8d5741efe8c083597d1265edf57dab2048a
Python
2,109
59
from __future__ import annotations import os import tempfile import time from typing import NoReturn from optuna.artifacts import FileSystemArtifactStore from optuna.artifacts import upload_artifact from optuna_dashboard import register_preference_feedback_component from optuna_dashboard.preferential import create_st...
5d3de08e75ac0901408ce662dcce76c600ff7501c267f246b461f51386d9226d
Python
2,109
65
import pandas as pd import pickle import argparse import os def parse_nodes(nodes_file): nodes = {} with open(nodes_file, 'r') as file: for line in file: data = line.strip().split('|') tax_id, parent_tax_id, rank = map(str.strip, data[:3]) nodes[tax_id] = {'parent': ...
1229aba7b6d38d56a5b487d5ef8676dc6c14cc0ffb73c4228bef761845f4b104
Python
2,110
71
from collections.abc import Callable, Hashable, Iterable, Iterator from typing import Protocol, Self class _NodeLT(Hashable, Protocol): def __lt__(self, other: Self, /) -> bool: ... class _NodeGT(Hashable, Protocol): def __gt__(self, other: Self, /) -> bool: ... type _Node = _NodeGT | _NodeLT type NodeNe...
2fe836ef94c64a8ee0119cb42c6c8a0a1c3080c4b86feeb795fe15b4a28a3a84
Python
2,110
89
# Node-group asset "Color to LCh" (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 ...
49c23e69400df1a6870060dbd45b020c992363cc05c0f1f017c405217017abf4
Python
2,110
63
import sys sys.path.append(r'..\..\..\..\pylib') import swc_handler import numpy as np import os from pathlib import Path from multiprocessing.pool import Pool from math_utils import min_distances_between_two_sets from morph_topo.morphology import Morphology def inbox(xyz, shape, center): xyz = np.abs(np.array(xy...
8c64b35cb58bc3a7602d8abeb3bf04ac819fd2ce6b4e9739ac2a5ca34aeacc8a
Python
2,111
78
import torch import torch.nn as nn import torch.nn.functional as F from segmentation_models_pytorch.base import modules class PSPBlock(nn.Module): def __init__(self, in_channels, out_channels, pool_size, use_bathcnorm=True): super().__init__() if pool_size == 1: use_bathcnorm = False ...
01b2e12e0d103ba8933c8ced903f3ac43203e6642f24c7c602b281968f8ffb2a
Python
2,112
60
import torch from elasticai.creator.arithmetic import ( FxpArithmetic, FxpParams, ) from elasticai.creator.nn.fixed_point.math_operations import MathOperations from tests.tensor_test_case import TensorTestCase class FixedPointMathOperationsTest(TensorTestCase): def setUp(self) -> None: self.opera...
0c1336e6ee4017ff8979eaaf995e4d6296f07444e9816a1c61751aa39a78c45b
Python
2,112
58
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, Port from elast...
798812f2445805f7239e176be3bc2d1e23d871d13553dc339a1f9b13d924735d
Python
2,113
41
""" Config global options Options can be changed at run time. See tests/test_backoff.py for usage example Options: BACKOFF_MAX_TRIES: maximum number of times to retry failed request to wikidata endpoint. Default: None (retry indefinitely) To disable retry, set value to 1 BACKOFF_M...
89f42408eefb3c8d81d6ee76113eccd865097599e79cb0e34bbafa943f622938
Python
2,113
62
# 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...
a9365a946b1e24adf4b977c19b8a1d9a4dbfd1ced996c7ec3e731015ccca78b1
Python
2,113
63
import numpy as np from scipy.sparse import * from skfeature.utility.construct_W import construct_W def lap_score(X, **kwargs): """ This function implements the laplacian score feature selection, steps are as follows: 1. Construct the affinity matrix W if it is not specified 2. For the r-th feature, w...
ad5be6b1793b591df007ffb601dff105bf1f443bec2f449d23c0be8ef0f96cb9
Python
2,113
68
# 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...
bc3d0164b048ab33eeacb7165fee7104ec2e357ed823a3ea31f240f238ada0fc
Python
2,113
85
from __future__ import annotations import pytest redun = pytest.importorskip("redun") from ase.build import bulk, molecule from quacc import flow 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 @pytest.fixture...
e3caee115a4066183c70146bf1958729cd67f5fadf9e7f3a153f14cacf05f602
Python
2,113
71
"""Generates a graphviz DOT file of an evaluation trace. Usage (need the dot binary, from the graphviz package, www.graphviz.org): python2 dot_graph.py | dot -Tpdf -o graph.pdf """ import autograd.numpy as np from autograd.tracer import Node, trace class GraphNode(Node): # Records the full graph (could having t...
040d4ad89b61a90c26f36394fc01630d98bb1d47db1f2f737b7f61db0e369563
Python
2,114
58
import argparse import cv2 import glob import os def main(args): txt_file = open(args.meta_info, 'w') for folder, root in zip(args.input, args.root): img_paths = sorted(glob.glob(os.path.join(folder, '*'))) for img_path in img_paths: status = True if args.check: ...
243b69d1acf21652afe0606a2cbcceb88240800ef18042b5785655fc8cd4f3cd
Python
2,115
76
import sys, os from pandas.io.parsers import read_csv import numpy as np from collections import Counter import pandas as pd import localInstall localInstall.require(['pysam']) import pysam ### Initialize ### try: inputBamFile = sys.argv[1] transcript2geneID = sys.argv[2] except: sys.exit('Please, give in...
3a030fd09477bcf03ccfa0912d29df4943d3260bf33d289e53e2afa77a0bca21
Python
2,115
72
# %% import os os.environ['CUDA_VISIBLE_DEVICES'] = "0" import numpy as np import torch import torch.nn as nn from torch_geometric.data import DataLoader import argparse from metrics import get_cindex, get_rm2 from dataset import * from model import MGraphDTA from utils import * def val(model, criterion, dataloader, ...
5191026b7c59491b74e51751cc47722603f7770f3566a76d40d8a0c2fd9efec8
Python
2,115
66
# 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...
9847c1d23d38ec45e5e669c532e35b057e55acecd294732b52f61e8a936abbd1
Python
2,115
58
""" Created on Fri Aug 13 16:03:48 2021 @author: Haotian Teng """ import os,sys import numpy as np from matplotlib import pyplot as plt import argparse def map_base(string): base_dict = {'A':1,'C':2,'G':3,'T':4} return np.asarray([base_dict[b] for b in string]) #bonito_ref = "/home/heavens/twilight_data1/S10...
bb4f67cb8dc6864b03fdc3b80de1ad5e0b559a812868e8cea7835ea55db3828b
Python
2,116
87
#!/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 #...
d2d8a5dde0e865ec56ccf9217cb51d75ee4d20eb2d3f79904f40da6a66056d7d
Python
2,116
75
import click import torch import segm.utils.torch as ptu from segm.utils.logger import MetricLogger from segm.model.factory import create_vit from segm.data.factory import create_dataset from segm.data.utils import STATS from segm.metrics import accuracy from segm import config def compute_labels(model, batch): ...
8eb6a609ab2ee3e0dcad7ac771a46d5e4ede729690d4703380d4737f297a9f59
Python
2,117
79
from collections.abc import Callable from functools import wraps import torch from elasticai.creator_plugins.lutron_filter.nn.binarize import Binarize from torch.nn import Module import elasticai.creator.torch2ir as t2i from elasticai.creator.ir import AttributeConvertable from elasticai.creator.torch2ir.default_hand...
c038a011bcd93834122c68f30f6d77a86ea32519a374205f7cfdbcd45717e483
Python
2,117
65
import scipy.optimize import autograd.numpy as np import autograd.numpy.random as npr from autograd import grad from autograd.scipy.special import gammaln # The code in this example implements a method for finding a stationary point of # the negative binomial likelihood via Newton's method, described here: # https://...
ddfe97c03a00af6d979d4b01776175776a744ca7339ef4b6f0970935b01453e5
Python
2,117
64
import torch class LARSOptimizer(torch.optim.Optimizer): def __init__(self, params, lr, momentum=0, weight_decay=0, eps=1e-9, thresh=1e-2): if lr < 0.0: raise ValueError(f'Invalid learning ra...
fea8d694eae07b02fb666e75d5509c163432be41282e023acaf918fe71b85e6b
Python
2,117
58
from typing import List import matplotlib.pyplot as plt import mne import numpy as np import torch from .utils import _plot_to_image _DEFAULT_MONTAGE = mne.channels.make_standard_montage('standard_1020') def plot_signal(tensor: torch.Tensor, channel_list: List[str], sampling_rate: i...
66bc8272147fc90482b1db0c902a714238cb6d0c4e6c0e460ed2c6d114799867
Python
2,118
72
import os import re import sys from typing import List, Optional from pip._internal.locations import site_packages, user_site from pip._internal.utils.virtualenv import ( running_under_virtualenv, virtualenv_no_global, ) __all__ = [ "egg_link_path_from_sys_path", "egg_link_path_from_location", ] def...
317a2a6a0b05f759931f0b9a638819919a5442579a8d016a42bc0fbe039dd564
Python
2,119
49
# Copyright 2020 The HuggingFace 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/LICENSE-2.0 # # Unless required by applicabl...
9eab05f8ee185d1f5cdfd0bdb80bad22c77ff59744211998c8faf2986216ebb8
Python
2,119
67
import matplotlib.pyplot as mp import numpy as np from pyclamp.dsp.fpfunc import geomean, geostd from pyclamp.gui.iplot import itxtplot, isubplot class sumstatplot: def __init__(self, args = None): self.setplots(args) self.initialise() def initialise(self): self.Label = [] self.Value = [] sel...
b155491c0fd0570de6035113175b8b401e5077978d40726921600fbd15cf5d9c
Python
2,119
78
import pytest import torch import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import ( FxpArithmetic, FxpParams, ) from elasticai.creator.nn import Sequential from elasticai.creator.nn.fixed_point import MathOperations from tests.integration_tests.nn.fixed_point.sequential_...
8d363c8aa243a9ae2898bc59ef8d6c3088bc1a5d2233a63063d641dd34a653f2
Python
2,120
67
"""Unit tests for per-region NCC (intensity-based, replaces per-region Dice).""" import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) import numpy as np import pytest from regtools.registrat...
c7ded86f27a37c3ff656a7ad0718b90b28c6d07e00a4877fde40bf9eb5577ae9
Python
2,120
59
# 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...
2640742edde2d3d6fff3152953ac7c777d56f3aa12b1f3acb904c5ef1c6e2b84
Python
2,121
58
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, Port from elast...
326b67914642fb2b4e2bbe854b44c6893b7657a695965b288343dfdd0bdc128d
Python
2,121
58
import numpy as np # Some utility functions for evaluation class ConfusionMatrix: def __init__(self, prediction, reference): self.tp = np.sum(np.logical_and(prediction == 1, reference == 1)) self.tn = np.sum(np.logical_and(prediction == 0, reference == 0)) self.fp = np.sum(np.logical_and(...
3ad367a1576fd27332bb1091dd0639ce24ed314c113b70120b16c645720ef16c
Python
2,121
54
from collections import defaultdict import linecache import os _gen_customizations = defaultdict(dict) def get_customizations_for(language, algo, property=None, default=None): lang_customizations = _gen_customizations[language] if algo not in lang_customizations: custom_file = os.path.join(os.path.di...
dda962bbc2424981d2ec744cfcef511d6e83a53606fc0f7d2044e535e7d958c8
Python
2,121
72
# Node-group asset "Unique Residue ID" (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...
f9fcf41cac81e1c1028d48c38a6ecbff8c4135f796aea734cc2479833227dbaf
Python
2,121
54
import os from typing import Dict, Iterator, Tuple, Union import pandas as pd from torcheeg.datasets.module.base_dataset import BaseDataset from .base_model_selection import BaseModelSelection from .utils import create_subset, read_indices, write_partitions class TrainValTestSplitGroupbyFolder(BaseModelSelection): ...
829eefb5dea8fe405e203fe5bc7b3b854fa0e31fcebe94066a5a49619f7baf03
Python
2,122
66
"""Loader robustness tests.""" from __future__ import annotations from pathlib import Path import numpy as np import pytest from scipy.io import savemat from msfeature.io import load_session def _write_sample_mat(path: Path, *, n_trials: int = 4, n_samples: int = 50) -> None: sess = { "EyeX": np.zeros...
c7d1e3096947001d8f6796482ac772504fe7c483e36dedea1bbcaa16f4f30fbd
Python
2,122
79
"""Tests for the cog.concurrent decorator.""" import sys import types from collections.abc import AsyncIterator import pytest if "coglet" not in sys.modules: coglet = types.ModuleType("coglet") coglet.CancelationException = type("CancelationException", (BaseException,), {}) sys.modules["coglet"] = coglet...
2e31f8df672058e9680b4f986dc5253de88f4a80cfdc4d6999b630d3ed8e93bc
Python
2,123
57
''' Script that generates the ML table for the ECFP data. NOTE: It's very important that the ML table that you use lines up with the ECFPs. So each line number in the ML table should correspond to the line number in the ECFPs .npy file. This is incorporated in the ML-table generation script. Therefore, generate the ...
5094898ed7f012e5fc70cf6176edfa7bd00c0001a9304afbf8cb0e5052a0e6aa
Python
2,123
63
#!/usr/bin/env python # Purpose: Find avg. FD value for each session and for each participant overall. # # Input: Single-column txt file FDRMS for each bold image. These were generated using the CBIG2016 preproc pipeline. # Output: Avg. FD value for each participant's session an deach participant overall. # # Written ...
e5869fdbce46762d28c8b7e241c0d127b318efdaa0999f0de8ae2ae4febeade8
Python
2,123
80
# Node-group asset "Color" (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 from bp...
156c7ce4d27b9c238a13611e5f09722c012bea9244eca65c152e43e69961e1a8
Python
2,124
57
"""The registration tab's Laplacian correspondence dropdown offers the new 'Exterior (damage-aware)' option -> data 'exterior_damage_aware'.""" import os import pytest os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") @pytest.fixture(scope="module") def _qapp(): try: from PySide6.QtWidge...
3fbe6eff1f97b65ab15bf817eb0f79ca31f5571b0b7fa10d4eb67846e31e628a
Python
2,124
84
# 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...
c586350abae0240ebaccdb5b98dad6ca5343476bd7f775cf1148e867e40f5143
Python
2,124
73
import h5py import numpy as np import torch from torch.utils.data import DataLoader, TensorDataset import torch.nn as nn import torch.optim as optim class Autoencoder_super(nn.Module): def __init__(self, latent_dim=10): super(Autoencoder_super, self).__init__() self.encoder = nn.Sequential( ...
288c4368359e818abc2f503a3e3613fcdd6dee2a6aded9ca4fc00ccf380f8e58
Python
2,125
40
"""EXPERIMENTAL example: the original interface with unit-RMS steering normalization. Original: direction = centered / max(RMS(centered), 1) (inactive while RMS < 1) This file: direction = centered / RMS(centered) (always unit RMS) and no steering at all when RMS(centered) < min_rms (a near...
cafca2f09ca28987d220038942033138cd49c75eedc41102eecb01ed543f687e
Python
2,125
67
import math import meep as mp from meep import mpb # A line_defect waveguide in a 2d triangular lattice of dielectric # rods (c.f. tri_rods.ctl), formed by a row of missing rods along the # "x" direction. (Here, "x" and "y" refer to the first and second # basis directions.) This structure supports a single guided b...
ef8d1fd19a85afdb8ea322d5664ef07d2b4184293043630a296c1a5141f93f1c
Python
2,125
72
import h5py import numpy as np import torch from torch.utils.data import DataLoader, TensorDataset import torch.nn as nn import torch.optim as optim class Autoencoder_charge(nn.Module): def __init__(self, latent_dim=10): super(Autoencoder_charge, self).__init__() self.encoder = nn.Sequential( ...
230a2b2685e969781be9662933426642f05c9a27e172648e7e73431028b7b68b
Python
2,126
24
"""posthoc_phase_line_split_2026-10-03.py — POST HOC (after LAW_IN_SPIKES S1 put the spiking line at 0.464 with the standard rule, and showed the two-channel rule does not lower it). PHASE_MAP's spiking runs gave a lower logistic 50% point (FlyWire 0.412, BANC 0.363; C199). Which conditions pull it down? The same fit...
a9686730f2fc2bd8ce498d1e46372408c55fe5fc9f6d2d64b2a5337a53a57f4e
Python
2,126
72
import os, sys, signal, time from pathlib import Path class ExitHandler(object): _instance = None @staticmethod def instance(): if ExitHandler._instance == None: ExitHandler() return ExitHandler._instance def __init__(self): if ExitHandler._instance != None: ...
bedd0f3c99a5daa1284350708f3f7c548f83c45aee779a11b72ccb1c6bb03978
Python
2,126
64
# # 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,...
d99a17d51013f1942e6e7f035ab04c0c7ef002e5ce4907aa78b389563fb54e65
Python
2,126
73
"""Module to merge Data together, along different axis and time points. It does not merge two instances of Data together (TODO). """ from logging import getLogger from numpy import asarray, empty, expand_dims, unique from numpy import concatenate as cat from .. import ChanFreq lg = getLogger(__name__) def concate...
e0005e31060092daf5797ab5f895b9ba61b70d4e05ae18f72d13f1e9b0f4be17
Python
2,126
86
import sys, re from optparse import OptionParser import time import os import getopt import numpy as np from scipy import stats data = [] def save_data(filename, column1, column2): with open(filename, 'w') as f: for a,b in zip(column1,column2): f.write(str(a)+ "\t" + str(b) + "\n") def ...
6a57222b341acabc3a8dd8669fa2448135952017573be232d4e33c99e38da0d0
Python
2,127
44
"""Runs one condition of REAL_ODOURS.py in its own process, odours forward or reversed (same code, same per-odour seeds 1000+k -> identical counts to a single run). Two processes per condition meet in the middle. Writes tmp/real_odours_counts_<cond>_<dir>.npz; merged by real_odours_merge.py into 06-OUTPUT/real_odours_c...
81ddd1cc7841cbd3060d5212765c8381e99d67373c56346983822d0f603b5f12
Python
2,127
73
""" for parseing line-based files """ key_sep = "||" class ModRecord: def __init__(self, fields): self._chromosome = fields[0] self._pos = int(fields[1]) self._site_key = key_sep.join([self._chromosome, str(self._pos)]) self._strand = fields[2] self._pos_in_...
ef02800e2fe901c535b48b050f26ee0595db6c3db638cbf0c07c4e9cd6ac7c3b
Python
2,127
68
# 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...
5c523c0ff482193f08698de327652346c23c5403d341f7f8966d25de5909b4c1
Python
2,128
71
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup_no_benchmarks import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport def main(revisions=None): suite = suites.suite_satisficing_with_ipc11() configs = { IssueConfig('lazy-g...
70c3b66d847338753903bc2b764f697dcb148969b647b44eed7bb4b301b63f6d
Python
2,128
62
#!/usr/bin/env python import imp import sys from setuptools import setup, find_packages if sys.version_info < (3, 8): sys.exit("Sorry, Python < 3.8 is not supported") VERSION = imp.load_source("", "assemblyfire/version.py").__version__ setup( name="assemblyfire", authors=["Andras Ecker", "Michael Reiman...
76865461560079ecbc1bb08ccf9384e98b778e157801d13870cbb3b9ae3b09b9
Python
2,128
63
# 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...
612f1bdb22f8f3be627fbec527d24b27e2ae00f276113fee43a0f24256793fe8
Python
2,129
73
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
804d32e469262e02b03f21733492b40aba0e847c528c82799afb79b5887b8429
Python
2,129
67
from abc import abstractmethod from typing import Callable, Protocol, runtime_checkable from torch.nn import Module, Sequential @runtime_checkable class _ConvProt(Protocol): @property @abstractmethod def kernel_size(self) -> tuple[int, ...]: ... @property @abstractmethod def stride(self) -> t...
be03d99dae1badaf08b7f526c9d7c4cba33c5ebe421f47e35a72afd806b56b33
Python
2,129
86
# %% Package Imports import sys, os sys.path.append(os.path.abspath("..")) sys.path.append(os.path.abspath(".")) import torch import torch.nn as nn import torch.optim as optim import prosper_nn.models.dhcnn as dhcnn from prosper_nn.utils import visualize_forecasts import prosper_nn.utils.generate_time_series_data a...
ec430a50d867049b1062f2c6a2b383572eb2473d37f99a31b04b97ed1a978f4d
Python
2,129
65
import pytest import torch from torch import nn as nn_torch from elasticai.creator.arithmetic import FxpParams from elasticai.creator.nn import fixed_point as nn_creator @pytest.mark.parametrize( "total_bits, frac_bits, num_steps", [(4, 3, 4), (6, 4, 32), (8, 5, 64), (10, 6, 16), (12, 7, 128), (12, 9, 64)], ...
94cf9342e180f70cf0a90ca8926ecbf0a2427c16241e2762b45ed8c043bef426
Python
2,130
70
from __future__ import annotations import pytest from custodian import Custodian from custodian.vasp.handlers import VaspErrorHandler from quacc.calculators.vasp import vasp_custodian from quacc.calculators.vasp.vasp_custodian import run_custodian def mock_custodian_run(*args, **kwargs): # Instead of running Cu...
a3e2fb34a630344214211e7172483386e03dbe609e794ee47109ea87a3f8848a
Python
2,130
58
import pandas as pd from tests.mock_data import MockCvOutput, MockTrainingData from cuppa.components.calibration import RollingAvgCalibration class TestKernel: def test_edge_weight_default(self): kernel = RollingAvgCalibration()._gaussian_kernel(window_size=20, edge_weight=0.16) assert round(ker...
e5e0fac8f8063018557545ce19c060f5b5e346d8d20c8251aaea4a035ee83c4c
Python
2,130
85
from __future__ import annotations import pytest redun = pytest.importorskip("redun") from ase.build import bulk, molecule from quacc import flow 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 @pytest.fixture...
480ed47e49ef1c64b6a9abdc7fd1900290690ab2ee53c8c02eba990f3113f2f6
Python
2,131
64
def findRuns(lst): """ yield (start, end) tuples for all runs of ident. numbers in lst >>> list(findRuns([1,1,1,0,0,1,0,1,1,1])) [(0, 3), (5, 6), (7, 10)] """ start, end = False, False for i, x in enumerate(lst): if x and start is False: start = i if x == 0 and start...
891a5a3418d5d0337060fbbfcfa4e21e0469c186a188cef3b48ff8919e14cfd0
Python
2,131
57
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
290250186784697c167d0cf7dc8566409b32adcad6b3e5b277e3f8455a35555d
Python
2,132
66
#!/usr/bin/python # encoding: utf-8 import os import glob import random import numpy as np import torch from torch.utils.data import Dataset from PIL import Image from datasets.clip import * class UCF_JHMDB_Dataset(Dataset): # clip duration = 8, i.e, for each time 8 frames are considered together def __in...
2c2680201fe62ccc1cd47b7ebcaae38573494192760003a32b6fa8320df62a1f
Python
2,132
57
import numpy as np import logging from typing import Union from .denoising_model import DenoisingModel # import model subclasses here... from .spatial_unet_2d_temporal_denoiser import SpatialUnet2dTemporalDenoiser, PlSpatialUnet2dTemporalDenoiser # ...and add models to this lookup dictionary _MODEL_DICT = { 'sp...
566358239c83c19ff46b972a23a3297669a2730eb6cf94fa97be1fc92bc6a717
Python
2,132
68
#! /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...
6e9db8f8c1b0ca373dceafcf7a3f657678ad0a79704222e05f7191ca7ab6bb82
Python
2,132
73
from __future__ import annotations import pytest dask = pytest.importorskip("dask") pytest.importorskip("distributed") from ase.build import bulk from dask.distributed import get_client from quacc import flow, job from quacc.recipes.emt.core import relax_job # skipcq: PYL-C0412 from quacc.recipes.emt.slabs import ...
5c9d8f4c9e1f76770ba90d7c52fe0797341478b0213309c4a3f7f6af1d6c9785
Python
2,133
56
# coding=utf-8 # Copyright 2020 The Allen Institute for AI team 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...
145fc63b3bd8209ff59ce1cefea284ddde4f070b906094bcec6dee448a9be726
Python
2,134
65
""" Filter Median Class """ import numpy as np from .buffer import Buffer class FilterMedian(Buffer): def __init__(self, L=62, dtype=float, initB=None): Buffer.__init__(self, L=L, dtype=dtype, initB=initB) self._buffer = self._buffer[::-1] self._history = np.linspace(0, L - 1, num=L, dty...
3bc1008c37504e5f61092dbc7ceb66ff83a7cb9522478105ccdbb8bc2bc1f078
Python
2,135
66
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
65859bea8f69ca6e8a2f4dedd8fc1ca6a3393456c99b153cdef4e8f25c7a748f
Python
2,135
57
import torch import torch.nn as nn import torch.nn.functional as F class CALayer(nn.Module): def __init__(self, channel, reduction=16): super(CALayer, self).__init__() self.fc1 = nn.Conv3d(channel, channel // reduction, kernel_size=1) self.fc2 = nn.Conv3d(channel // reduction, channel, kern...
255269a7ccc194de91ab7148fc70cc22dfaa9ac40a08dc22b79c267bb826d534
Python
2,136
53
import os from nipype import Workflow, Node, MapNode, IdentityInterface, Function from nipype.interfaces.io import DataGrabber, DataSink from nipype.interfaces.fsl import BET, FLIRT, MCFLIRT, FNIRT, ApplyWarp, Smooth def create_workflow(name, data_dir, output_dir): # Workflow setup wf = Workflow(name=name) ...
1f88165ae69bf6f4b6a6dc27ef9584f21974e4fff0fa6551010b3eae01c0a791
Python
2,138
79
# Node-group asset "Residue ID" (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 fr...
4a0c0c44bc0661ba22c1f9c20313b78a54c7f90f35cd5d47bdf87cd02bea95a3
Python
2,138
62
# 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...
fdf2d379b4fbe6d5c2c1c50883b6b2c3a135ef994a494948f390a8463c9db4af
Python
2,138
64
import os import torch import random import tqdm import numpy as np import scipy.stats as stats import sklearn.metrics as met def seed_everything(seed=42): random.seed(seed) np.random.seed(seed) os.environ['PYTHONHASHSEED'] = str(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch...
0d759e49e511437271a45b46d7daa63e0754dcbb89d340a281fd66a1e7a88181
Python
2,139
57
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue659-v1-base", "issue659-v1"] CONFIGS = [ IssueConfig(h...
17619fbb838fe6a3c5fc3b127acbb08bcbeca49db7dac736cc0909ded86926b0
Python
2,139
58
import os, warnings, time, tempfile, datetime, pathlib, shutil, subprocess from urllib.request import urlopen from urllib.parse import urlparse from pathlib import Path from tqdm import tqdm import pytest def download_url_to_file(url, dst, progress=True): r"""Download object at the given URL to a local path. ...
a322c07284d9c0cbd6ed45b978c99822a8e6244b2238aec9550473f9edf2256f
Python
2,139
74
# 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...
e01a871135417ecd4d77d89b91c9780414b5707e24419817d039a8eab0a366ed
Python
2,139
23
"""POST HOC: how small a kick ignites the antennal lobe of Shiu's v630 model, and who is inside the ignition?""" import sys; sys.path.insert(0, 'D:/eucys/03-CODE') import numpy as np, pandas as pd, scipy.sparse as sp, SHIU783_SIM as S C = pd.read_parquet('D:/eucys/2023_03_23_connectivity_630_final.parquet', columns=['P...
751f3353ce92eb5696d9e5ccb780b09aafdbbb94af44ad7ac834da91d3c6acf6
Python
2,140
83
# Node-group asset "Boolean Any" (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...
1bf3533245980b4b00247a0af6f74f92d403d4f56e1866d3f3cbf743b09f7afb
Python
2,141
78
""" Algorithms for whitening. ZCA combines a technique used in recent papers from Andrew Ng's group at Stanford, with techniques developed by Nicolas Pinto at MIT. """ import numpy as np def flatten_imageset(images): if images.ndim < 2: return images.reshape(1, -1) else: return images.reshape...
3f7af81a5c4316ca4a04f2750c7b4611022f966e3b8f5c217a03e105b6517b00
Python
2,141
68
# sample 300 points from torus S1 x S1 and 100 points from circle S1 (belonging to the first S1) # Compute distance among the points import math import numpy as np import h5py def angle_distance(phi, theta): s = min(phi, theta) l = max(phi, theta) distance = min(l-s, s + 2 * math.pi - l) return dista...