sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2c96b84d9012a54b8d4c19be924795e487cef27f00e1bea7bfad0f154b82bb9c | Python | 2,409 | 78 | # 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... |
2fa74822d91101ca64809a9a4249e2c7207d7eb5506632ebdfdca5e0bf707b42 | Python | 2,409 | 74 | #! /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... |
794310fcc52feddfb8d35b84fe26854618691c30a9e90abfd8a84e11ad2c43e6 | Python | 2,409 | 70 | import numba
import numpy as np
import multiprocessing as mp
from functools import partial
# Cite from https://github.com/numba/numba-examples
@numba.jit(nopython=True, parallel=True)
def get_bin_edges(a, bins):
bin_edges = np.zeros((bins+1,), dtype=np.float64)
a_min = a.min()
a_max = a.max()
delta = (... |
a77ba76310121eaf9ee62a2340c0dc990ba687e877181a507162604a1db9b954 | Python | 2,409 | 76 | # 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... |
206146d0f1a7b98cf4d5af63a669efeda3a50af9bb3ce8cbe11c4bd049eaf037 | Python | 2,410 | 81 | # 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... |
5d42d89dd57355da23c28568ffe114a8de4aba2ba9329c111ab8412c6be57623 | Python | 2,410 | 61 | import warnings
warnings.simplefilter(action='ignore', category=FutureWarning) # Ignore all FutureWarning warnings that might flood the console log
warnings.simplefilter(action='ignore', category=DeprecationWarning) # Ignore all DeprecationWarning warnings that might flood the console log
import os
import json
f... |
03ea1f457cc67d4961615b5c8f6a83f71dfb28061f5f7e89623ed9345b480b50 | Python | 2,411 | 73 | """
Set of convenience functions for parameter handling in MultiModel.
"""
import numpy as np
import sympy as sp
from sympy.core import symbol
def count_float_params(param_dict):
"""
Count number of float parameters in a dictionary, do not count noise
parameters.
"""
return len(
{
... |
979b243a06ac2a4f042786d8eb1bd448aa3e8777d829a1c98fc658f9aaee47b4 | Python | 2,411 | 60 | # Copyright 2018, 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... |
565e95584eef05760fbc29f09aac3c5f6f203e77af63e2e1116b93b5379ea2ac | Python | 2,412 | 64 | # 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... |
ff5b98506c7ecd863adad2d57736192ce91cd038300ed5310973d3cc95be3cb7 | Python | 2,412 | 72 | from collections.abc import Mapping
from typing import Any, Protocol, runtime_checkable
from ._attribute import Attribute, AttributeMapping
@runtime_checkable
class _Node(Protocol):
@property
def attributes(self) -> AttributeMapping: ...
@runtime_checkable
class _ReadOnlyDataGraph[N](Protocol):
@proper... |
9f09e97f4081a0e94bbac860ed3e268675c2011f04df269dc26e153fde4e95b9 | Python | 2,413 | 67 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import torch
import argparse
from setting import *
from loader import *
from models import *
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# Arguments
argParser = argparse.A... |
2dc5b3612286ba0e67ed4be1388e412b15392816f9e3361199be67c6ec617f43 | Python | 2,414 | 82 | from typing import Optional
import torch
import torch.nn.functional as F
from torch import nn, Tensor
__all__ = ["SoftBCEWithLogitsLoss"]
class SoftBCEWithLogitsLoss(nn.Module):
__constants__ = [
"weight",
"pos_weight",
"reduction",
"ignore_index",
"smooth_factor",
]... |
fc4f77e33929c72092a9c0b9d8905eebbabe2df3614aa008e81ce421ba03247f | Python | 2,414 | 76 | from torch.utils.data import Dataset
import numpy as np
import pandas as pd
from Bio.Seq import Seq
from utils import encode_seq, reverse_complement
def read_asb(asb_path: str, pos_fdr_upper: float=0.05, neg_fdr_lower:float = 0.5, for_eval=False, eps=1e-10):
t = pd.read_table(asb_path)
t = t.rename({"#chr"... |
ffdcbba87d13852aa27059405e303e6c5135cab8e6f3f93c3bc6c54db5c76bad | Python | 2,414 | 99 | from pathlib import Path
import openmm
import pytest
from calvados import sim
from calvados.cfg import Components, Config
TEST_DATA = Path(__file__).parent / "data"
def bond_check(i: int, j: int):
""" Define bonded term conditions. """
condition0 = (i%2 == 0) # phosphate
condition1 = (j == i+2) # phosp... |
5190e85e106a717856267dc50567ba05da9cb6186264208559bc03dba3c7f04e | Python | 2,415 | 67 | #----Figure_07_S16_preparation--------------------------------------------------
#-------------------------------------------------------------------------------
# This is the code which has to be run in preparation for Figure 07 Panel E and
# S18 for the connectivity analysis for Reinhard and Fukuda et al. 2024
#... |
9fa7c75663fc90511508b736f41374d738f9f149f03eda07270d3ca98a979814 | Python | 2,415 | 61 | #! /usr/bin/env python
from lab.parser import Parser
parser = Parser()
parser.add_pattern('ms_final_size', 'Final transition system size: (\d+)', required=False, type=int)
parser.add_pattern('ms_construction_time', 'Done initializing merge-and-shrink heuristic \[(.+)s\]', required=False, type=float)
parser.add_patter... |
76c4ddc5fe2e07af7048cf3330bb6f7b5029cd3967a4ceef901caa781c6bf348 | Python | 2,416 | 71 | #!/usr/bin/env python
from __future__ import print_function
from pddlstream.algorithms.focused import solve_focused
from pddlstream.algorithms.incremental import solve_incremental
from pddlstream.language.generator import from_test, from_fn, universe_test
from pddlstream.language.stream import StreamInfo
from pddlstr... |
996af9e97bf9d034f24c1db61355746a641d561e4f28d175b7c84be58c5c28aa | Python | 2,416 | 66 | """load_2d must honour the picked atlas's annotation/template paths
instead of always reading Allen's. Regression coverage for the Atlas
Selector wiring."""
import numpy as np
import pytest
@pytest.fixture
def qapp():
from PySide6.QtWidgets import QApplication
app = QApplication.instance() or QA... |
b9c91087a7cae36305ac3d23a7eaa3ce1beb33a784bce7e3016f30fb30de43d6 | Python | 2,416 | 72 | # 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... |
c7e67bbbf887500b5c574148eaf332db777b5fa060a60bf2237e9f0665139255 | Python | 2,416 | 66 | import torch
import numpy as np
from scipy import signal
import torch.nn.functional as F
from typing import Union
class WeightedHuberLoss(torch.nn.Module):
def __init__(self,
wtp: float = 20,
wfp: float = 13,
wfn: float = 18,
wt... |
11247675b8c14b1945ef117782861679b6897bd186a190a7ca88876ba0354289 | Python | 2,417 | 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... |
3ed9f58674c73af923219e0cfbdfb2191104626b410d962827040bfb91230862 | Python | 2,417 | 87 | from __future__ import annotations
from typing import Dict
import numpy as np
# from gpaw.typing import Array3D
_gaunt: Dict[int, np.ndarray] = {}
_nabla: Dict[int, np.ndarray] = {}
def gaunt(lmax: int = 2): # -> Array3D:
r"""Gaunt coefficients
:::
^ ^ -- L ^
Y (r) Y (r) = ... |
830822fe488ed8298e7dd31a3ae934decbe8074fcd3b05ef4c552dfdf54a3578 | Python | 2,417 | 83 | #!/bin/env python
# This script creates separate user map for Stage 1.
import os
print("Creating separate user map files for each stage...")
# Create general output directories for each stage.
for stage_num in [1,2,3]:
output_directory_path = '../Analysis-outputs-stage' + str(stage_num)
os.makedirs(output_d... |
a9c9933af417bc2243250f32e2daa0db0f072ca5da91164a74ec3fbac32c9593 | Python | 2,417 | 77 | # 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... |
2d9d9b308a929bb91047ffda17182101c61ff756511dd933b9f3de27bdaa3156 | Python | 2,418 | 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... |
6a9e2e9a73c64cf8cfe8fae85381e3c0216a28d540a3045ba4d00040041c9658 | Python | 2,418 | 74 | import math
import meep as mp
from meep import mpb
# Photonic crystal slab consisting of a triangular lattice of air
# holes in a finite_thickness dielectric slab, optionally with a
# substrate on one side of the slab. See the paper: S. G. Johnson,
# S. Fan, P. R. Villeneuve, J. D. Joannopoulos, L. A. Kolodziejski,
... |
e3dca392e33480061de5eb015054e53d651ffc49b97bf9896e6f16ef4d2de97f | Python | 2,418 | 77 | """ICP registration - port of icp_registration.m."""
from __future__ import annotations
from pathlib import Path
from typing import List, Tuple
import numpy as np
from imageio.v2 import imwrite
from .bb_alignment import _preprocess
from .correspondence import (
find_point_correspondence,
outlie... |
4e73a8e009542b6604b5f49756284565aa62324a491271cc01ab7afabb63eb4a | Python | 2,419 | 65 | import sys, pickle
import pandas as pd
import numpy as np
from optparse import OptionParser
from keras.models import Model, load_model
def main():
usage = 'usage: %prog [options] <param_file> <trained_model> <test_file> <outfile>'
parser = OptionParser(usage)
parser.add_option('--revCom', dest='re... |
5c22957e11d14d7cfe03081353c7a7296ce3e14f20ccdcec9cc4f78e02757636 | Python | 2,419 | 60 | """Structural checks for the 2D 'Registration mode' dropdown (Intensity vs
Shape / SDT) that surfaces annotation_sdt_registration in the GUI.
Introspection-only (mirrors test_parameters_tab_ants_overrides): ParametersTab is
a QWidget needing a live app + QApplication, so we assert the class shape and the
relevant... |
d9604835df190997f49d231bc986e22d1871e1f8831728960fe39dac3570ec1c | Python | 2,420 | 60 | #%%
"""Tests for `qm40_dataset_for_ml` package."""
import os
import sys
sys.path.append("/scratch/users/amahamadakalapuwage/testing_QM30/my_template/QM40_dataset_for_ML/qm40_dataset_for_ml/")
import unittest
import utils as ut
class TestQM40DatasetUtils(unittest.TestCase):
"""Tests for `qm40_utils` package."""
... |
0a3182e282c0fec15a91e601c722d435277b00486352c92b30881bac89c0dfa6 | Python | 2,421 | 63 | from torch import optim as optim
try:
from apex.optimizers import FusedAdam, FusedLAMB
except:
FusedAdam = None
FusedLAMB = None
print("To use FusedLAMB or FusedAdam, please install apex.")
def build_optimizer(config, model):
"""
Build optimizer, set weight decay of normalization to 0 by defa... |
fcf68ddb92593e4ed8b8f4e9687225a5c303f93a8daffaba243ebc8be7556e52 | Python | 2,421 | 70 | ################################################################################
# Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md
#
# All rights reserved.... |
845ae8e9a04ba919e190862dd51e43b5186d1f1ae538c5ea616849e150f67dd8 | Python | 2,422 | 93 | from os import environ
from numpy import array
from numpy.testing import assert_array_equal
from pytest import approx, raises
from wonambi.attr import Freesurfer, Surf
from wonambi.attr.anat import import_freesurfer_LUT
from .paths import (FREESURFER_HOME,
LUT_path,
fs_path,
... |
b6ea4d50fdb1fb72c660666ef24e9e86c64460a75dae3fd580e41f7954c072b2 | Python | 2,422 | 79 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 10 15:30:45 2021
@author: eveshalom
"""
from matplotlib import pyplot as plt
import numpy as np
from matplotlib.widgets import LassoSelector
from matplotlib import path
def ROILasso(MaxSlice, datashape, z):
plt.ion()
fig = plt.figure()... |
11f1a26d9c960ee07a4d177d2d40d6c82c22188c93273fd728c2bbf7a348ca27 | Python | 2,423 | 72 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, build_activation_layer
class SimpleGatedConvModule(nn.Module):
"""Simple Gated Convolutional Module.
This module is a simple gated convolutional module. The detailed formula
is... |
301b236f2708f50b8cd7fc2e2cb2065b018543ac1c461099d60789d79d9c8f5d | Python | 2,423 | 61 | #----Figure_03_E_preparation----------------------------------------------------
#-------------------------------------------------------------------------------
# This is the code which has to be run in preparation for Figure 03 Panel E
# for the connectivity analysis for Reinhard and Fukuda et al. 2024
# run firs... |
d0e09044da0788a36acc260f72bd107c4f80de2f309e5ffd71b413bc52abc1c0 | Python | 2,423 | 75 | # 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... |
fb56b8e6010002b4927a6feeb061bd87b2ed2feada5a4501787ab8b51c8a9391 | Python | 2,423 | 66 | #
# 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,... |
358c96a6d26b8748e73f0c832919944f8c864f4956c259e662b3a637151ddab1 | Python | 2,424 | 56 | from pathlib import Path
from wsilearn.utils.cool_utils import read_json_dict
from wsilearn.dataconf import DataConf
from wsilearn.utils.eval_utils import ClfEvaluator
from wsilearn.train_nic import ClfEvaluationHeatmapWriter
import pandas as pd
#some additional evaluation code
def eval_heatmaps(out_dir, n_hm_correc... |
cf0230626475855c810dbba3c58dd033cde0fd8fbda488f432deee99dc66bfbe | Python | 2,424 | 60 | # -*- coding: utf-8 -*-
import os
import json
import shutil
import numpy as np
from scipy.stats import ttest_rel
TARGET = ("CVD", "HF", "AFib", "CAD", "MI", "Stroke", "DENOVO")
ITERATION = tuple(range(100))
FEATURE = ("ALL", "LAB", "ECHO")
ALGORITHM = ("KNN", "LR", "SVM", "RF", "GB")
METRIC = ("AUROC", "A... |
d2f271dde8c5b29bd6f16875b9cc9d8c3acedec39ee90e82d66879f0aee60aa5 | Python | 2,424 | 77 | from typing import cast
import torch
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
from elasticai.creator.nn.fixed_point.precomputed.precomputed_module import (
PrecomputedModule,
)
def test_vhdl_code_matches_expected_for_precomputed_module() -> None:
expected = """... |
6a5ed3e164561f440e7b3edbdf5bc4ca4eea77b083fef17ce04531da6e672308 | Python | 2,425 | 80 | model = dict(
type='ImageClassifier',
backbone=dict(
type='SeqClif2Fc1CeItout',
timestep=20,
c0=1,
h0=120,
w0=120,
nclass=2,
cmode='analog',
amode='mean',
noise=0,
soma_params='all_share',
neuron='lif',
neuron_config... |
97fa2dee1c7b3afb0bcf9960cb686226efe89aac2022569f4ff646144eff1d5c | Python | 2,425 | 61 | import datasets
import lightning.pytorch as pl
from hicdiffusion_model import HiCDiffusion
from lightning.pytorch.callbacks import ModelSummary
import os
import shutil
from lightning.pytorch.loggers import WandbLogger
import time
import argparse
def main(val_chr, test_chr, model_ckpt, hic_filename="", model_ed=None):
... |
1bd96f28691d37804708da8c23e631fb790dd93e5eee6a8d9cafd4460046f87a | Python | 2,426 | 82 | # 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... |
fc18b0e10f9e40e317a1e17d8858e461591eb998fb459db24be671b3ebacc36b | Python | 2,426 | 70 | import snakemake
import os
import shutil
from merlin.util import snakewriter
def test_run_single_task(simple_merfish_task):
simple_merfish_task.save()
assert not simple_merfish_task.is_complete()
snakeRule = snakewriter.SnakemakeRule(simple_merfish_task)
with open('temp.Snakefile', 'w') as outFile:
... |
5072250c8ce5f93526359d4f831f0030ce32f588c59f06c2596cb59af0a88512 | Python | 2,428 | 73 | import numpy as np
import sys
from theano import function
from theano import tensor as T
_, model_path, sigma = sys.argv
from pylearn2.utils import serial
model = serial.load(model_path)
from pylearn2.config import yaml_parse
dataset = yaml_parse.load(model.dataset_yaml_src)
dataset = dataset.get_test_set()
from pyle... |
f404a6722b099edb09151f8c06ea6ab4eaacec5ab7af7e8c639e874dd8ae10ec | Python | 2,428 | 67 | 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... |
a10d23f27af8a0b3af5ba31c371db893c63555df129a507a3be16be56282d590 | Python | 2,429 | 74 | import cocotb
import pytest
from cocotb.triggers import Timer
from elasticai.creator.arithmetic import FxpArithmetic, FxpParams
from elasticai.creator.testing import CocotbTestFixture, eai_testbench
from elasticai.creator_plugins.act_func.utils import load_and_plugin
def act_sign(xin: list[float], config: FxpParams)... |
a5c00deeb4d7cd8cfbe92699187702e17a2d669efc8500aa5f400aef5d7f4f9b | Python | 2,429 | 50 | # 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... |
5343addd311b1d0d5cc79905dc7efd1a037b3e1c6853efa57aabdad238884437 | Python | 2,430 | 99 | from numpy import power, mean, nanmax, std
from numpy.testing import assert_array_equal
from pytest import raises
from wonambi.trans import math
from wonambi.utils import create_data
data = create_data(n_trial=10)
def test_math_incompatible_parameters():
with raises(TypeError):
math(operator_name=('sq... |
64ee628a50e5a2e7f0536c34c3dccac04c80bee46c1cae4dc1f617d3e06d37fa | Python | 2,430 | 79 | #!/usr/bin/env python3
## this script creates dataframes from the distance matrices
## (upper triangle) for each movie and parcel (Emofilm version)
import pandas as pd
from pathlib import Path
# ------------------------------------------------------------------
# settings
# ------------------------------------------... |
dd774cc1a1e50ecea81d2bbbbddfaa69e8a20160c19749150ee77684d64ed9f7 | Python | 2,430 | 71 | ################################################################################
# Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md
#
# All rights reserved.... |
0344498db27a7cc5b045e2f6ab6aab32bd77220f38097372c7d8e57a96742b4d | Python | 2,431 | 65 | import numpy as np
from pyclamp.dsp.abfread import ABFile
from pyclamp.dsp.channel import chWave
class ABF(ABFile):
IntData = None
ADCData = None
def __init__(self, _fileName = None):
if _fileName == None: return
self.OpenFile(_fileName)
def OpenFile(self, _fileName):
self.ReadFileInfo(_fileName)
... |
8ef6cbe132f0494ef630739de6abdb70880fe28ac29275ab9553b1ba369d7f26 | Python | 2,431 | 58 | import itertools
from datetime import timedelta
from math import pi
import numpy as np
from uptake.model.system_definition import MechanicalProperties_Adaptation, MembraneGeometry, ParticleGeometry, Wrapping
def generate_MechanicalProperties_Adaptation_classes(
testcase_name, testcase_number_generator... |
31e58a50d5fcad658880f1e8cceb3d5845ad80aac8b14d95ca6a32283194fcc9 | Python | 2,432 | 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... |
47dcd81323c67f8f53d295bfa774c7c57333ccc28a296291881f26e5fa94af10 | Python | 2,432 | 65 | #!/usr/bin/env python3
import sys, os
from pandas.io.parsers import read_csv
import numpy as np
import pandas as pd
try:
gtffile = sys.argv[1]
output = sys.argv[2]
except:
sys.exit("Please, give: (1) gtf file; (2) exons")
#### Convert gtf file in an easy to handle data frame ####
df = read_csv(gtffile, co... |
697d9ca484da5e5137915d5a8d66e748bfbc5a03f9bddd0f5afd94a3dd511427 | Python | 2,432 | 90 | """Summarizer for phonopy."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import QuaccDefault, __version__, get_settings
from quacc.schemas.atoms import atoms_to_metadata
from quacc.utils.dicts import finalize_dic... |
ae7b0c02f1f348aa8bf6616b41b999a901fa1b7ed14707d718220546bcba07e6 | Python | 2,432 | 54 | """
Loads saved stuff, recalculates similarity matrix and analyse the temporal evolution of the activity
last modified: András Ecker 02.2023
"""
import os
import numpy as np
from scipy.spatial.distance import pdist, squareform
from assemblyfire.config import Config
from assemblyfire.utils import load_spikes_from_h5
f... |
6b8408f82192c1dcd0f5867260d4f456f01b066710fac73991d02200129fd650 | Python | 2,433 | 89 | # Manuel A. Morales (mmoraleq@bidmc.harvard.edu)
# Beth Israel Deaconess Medical Center
# Harvard Medical School
import os
import datetime
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.optim as optim
from Models import *
import sys
# ============================================... |
9636218ea263a05c2abe5a0674536da932c91d1bb9e151e9fc07259f1637c2f8 | Python | 2,433 | 54 | import os
import unittest
import pandas as pd
from hed import schema as hedschema
from hed.models.df_util import expand_defs, shrink_defs
from hed.models.tabular_input import TabularInput
# noinspection PyBroadException
class Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
bids_root_path ... |
d58d601f434ea695789dbaf57a2743e62190f1454f7e25598baad3aab7c2d3a7 | Python | 2,433 | 88 | """
Re-implementation of find_module and get_frozen_object
from the deprecated imp module.
"""
import os
import importlib.util
import importlib.machinery
from importlib.util import module_from_spec
PY_SOURCE = 1
PY_COMPILED = 2
C_EXTENSION = 3
C_BUILTIN = 6
PY_FROZEN = 7
def find_spec(module, paths):
finder =... |
cce2147a4a5832431d86479cfc817984ae9ba207b0865bacb5427e039707044e | Python | 2,434 | 71 | """Generate networks using a planted-partition (stochastic block) model."""
import sys
import igraph as ig
import numpy as np
import pandas as pd
from scipy import sparse
if "snakemake" in sys.modules:
params = snakemake.params["parameters"]
n_nodes = int(params["n"])
n_communities = int(params["q"])
... |
73b38f76b192479315d27fc240e20fb6a7c8a3e1c78200454fcc8b5128b3316f | Python | 2,435 | 92 | # Node-group asset "Check Geometry" (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... |
190524ed741cdbf4e47ec2c6a8e6c609c519df1305417210e9ca5afb9694ff69 | Python | 2,436 | 81 |
import os
import sys
sys.path.append(os.path.abspath('../'))
from multiprocessing import Lock
from model.KuramotoClassFor import Kuramoto
import concurrent.futures
import itertools
import gc
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
def RunKuramotoFor(param_tuple):
#fully co... |
9979ace0e81facb0b2054aa7c26515f858a12a3b8fd11d32925460815d086763 | Python | 2,436 | 80 | # dataset settings
dataset_type = "PascalContextDataset"
data_root = "data/VOCdevkit/VOC2010/"
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True
)
img_scale = (512, 512)
crop_size = (512, 512)
max_ratio = 8
train_pipeline = [
dict(type="LoadImageFromFile"),
dict(... |
a6dc83d75e570413a99668568e88782a8f5b77bc6494b66a17cbad4cab34ec3e | Python | 2,436 | 76 | # 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... |
1426663ac9cb331550734af10e890e374640f01746adfca8a9cba4341fbe62b4 | Python | 2,437 | 75 | from typing import List, Optional
import logging
import pathlib
import sys
import termcolor
def create_logger(name: str,
distributed_rank: int,
output_dir: Optional[pathlib.Path] = None,
filename: str = 'log.txt') -> logging.Logger:
logger = logging.getLogge... |
9fd1a0c9e3bf863e0d21cc4a6ef92cd56a8498212f608daf2c2b0d4d82acd435 | Python | 2,437 | 40 | # -*- coding: utf-8 -*-
import argparse
from supar import AttachJuxtaposeConstituencyParser
from supar.cmds.run import init
def main():
parser = argparse.ArgumentParser(description='Create AttachJuxtapose Constituency Parser.')
parser.set_defaults(Parser=AttachJuxtaposeConstituencyParser)
subparsers = p... |
f55c3e3d43eb805b9e815922cfb22226931a889a1cb53c27651f05fba77fdb6f | Python | 2,437 | 78 | #!/usr/bin/env python3
## this script creates dataframes from the full distance matrices
## for each movie and parcel (Emofilm version)
import pandas as pd
from pathlib import Path
# ------------------------------------------------------------------
# settings
# -------------------------------------------------------... |
0af6b8253d5474350b0fffdb693afe8fa3127982fbf01b52792b5fa00fd3ef63 | Python | 2,438 | 74 | import networkx as nx
import pytest
from skymap.metrics import *
def float_equal(num1: float, num2: float, precision: float = 1e-3):
return abs(num1 - num2) < precision
def test_basic_metrics_1(graph_1):
metrics = compute_basic_metrics(graph_1)
assert metrics["num_nodes"] == 5
assert metrics["den... |
4d71c06f8c39f9e55b1c2f5377a58a524c8d45e14c02e81e6629ace84082b88e | Python | 2,438 | 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... |
7ec3785c8159a9b6be7f3622811225269ca6226d473a82fd8020e38578f87f6b | Python | 2,438 | 77 | #!/usr/bin/env python3
## this script creates dataframes from the similarity matrices
## (upper triangle) for each movie and parcel
## and saves them to a new CSV file
import pandas as pd
from pathlib import Path
# ------------------------------------------------------------------
# settings
# -----------------------... |
9d541f8233e74cb1f3fb0f88493f3f34cced78ffc1bd4f2933895dcd572306e9 | Python | 2,438 | 65 | import sys, math, os
from pybioshell.core.data.io import Pdb, write_pdb
from pybioshell.core.data.basic import Vec3
from pybioshell.std import vector_core_data_basic_Vec3
from pybioshell.core.calc.structural.transformations import *
from pybioshell.utils import LogManager
REFERENCE_FROM, REFERENCE_TO = 23, 32 # 25, ... |
a0d7d23ec4a96d03655e6279fecdcb52cb0b8828857d441709287bd666d82fc8 | Python | 2,438 | 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... |
0979066dcafdd58811e439c1de6b39fa6758ecbaeacbfbd8d20bd8576ff0421f | Python | 2,439 | 96 | """Atoms handling with Phonopy."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
import numpy as np
from monty.dev import requires
from pymatgen.core import Structure
from pymatgen.io.phonopy import get_phonopy_structure, get_pmg_structure
has_phonopy = boo... |
0d3c8da157a1e1efa92b52a0f4e56bff84c3c159ef203d1c5bf83619b5706137 | Python | 2,439 | 65 | import os
from glob import glob
from script_stitch_slide import get_channels, get_time_indices
import json
import sys
import pandas as pd
def get_ny(slide_path):
parameter_path = os.path.join(slide_path, "acquisition parameters.json")
parameters = {}
with open(parameter_path, "r") as f:
parameters ... |
3ccb9d2d0ccdc586e313b6cc2fe8e2c3e9888a6ab529a182b3e0e52e3f74c8b7 | Python | 2,439 | 100 | #!/usr/bin/env python3
"""
Run a flickering checkerboard stimulus.
"""
import argparse
import subprocess
import os.path as op
def cli_parser():
"""
Parse command line arguments to generate a call to my LOVE flickering checkerboard experiment.
"""
parser = argparse.ArgumentParser(description=__doc__)
... |
53cd485bcefac86b0d5127e487118c2ed50491d2fc9d60f762922c9e7a07aaec | Python | 2,439 | 78 | """Unit tests for the regtools logging facility."""
import logging
import pytest
from regtools.utils.logging import (
get_logger,
set_level,
quiet,
_ROOT_NAME,
_HANDLER_FLAG,
)
def test_get_logger_is_under_regtools_namespace():
log = get_logger(__name__)
assert log.name... |
7a6f0d41049491db2d4fbff6eb951633364ca5ada9b09130682993c3815f62bd | Python | 2,440 | 76 | """
This script checks for data missing patterns in the preprocessed cognitive data,
i.e. PVT and n-back scores
Input: path where all the preprocessed data is
Output: path where the figure will be saved
@author: trianaa1
"""
import sys
sys.path.insert(0, "/m/cs/scratch/networks-pm/effects_externalfactors_on_functi... |
b324839242166ae8d877fdbe8fbc159582a2efbaaf7628859ce8c6e0134f3174 | Python | 2,440 | 86 | import math
import pandas as pd
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objects as go
'''
Plot 200 random points (fixed cloud) and their
nearest neighbors in the moving cloud
'''
def find_nn(n, X_fix, X_mov):
"""
args: n -> number of random points
... |
d13c6a1791e4ffdfa6ca6ae13173ce9ff2fe83985b33895291a47e394f1cb594 | Python | 2,440 | 84 | # -*- coding: utf-8 -*-
#
# Test .info property of BaseData
#
import pytest
import numpy as np
import tempfile
import os
# Local imports
import syncopy as spy
from syncopy.shared.tools import SerializableDict
from syncopy.shared.errors import SPYTypeError, SPYError
class TestInfo:
# serializable dict
ok_di... |
3e30cf5c38b5197a92d9d8010c9e05a11f9a444a950f8471748f30f75cd3cd9f | Python | 2,441 | 70 | #! /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 = ... |
47ad5bd4ca6c60193de218e5af1b29d9d36b044e73f16c1f203e93aeaa4a0eee | Python | 2,441 | 121 | """Project constants for the motor intention decoding project."""
from __future__ import annotations
import random
from pathlib import Path
import numpy as np
def set_random_seed() -> None:
random_seed = 1
np.random.seed(random_seed) # noqa: NPY002
random.seed(random_seed)
SRC = Path(__file__).parent... |
9c3b636eb844683bb7f3c7e9e0ee81192a5b8a16661e1ecfa0ecf6861164f908 | Python | 2,442 | 80 | import importlib.util
import sys
class VendorImporter:
"""
A PEP 302 meta path importer for finding optionally-vendored
or otherwise naturally-installed packages from root_name.
"""
def __init__(self, root_name, vendored_names=(), vendor_pkg=None):
self.root_name = root_name
self.... |
7ac1281074d860703486fb8ce04a137d18741ca5d8aa74ec0b814c135e216a72 | Python | 2,443 | 61 | import os
import datetime
import argparse
import random
import numpy as np
import torch
import logging
import logging.config
class OptInit():
def __init__(self):
parser = argparse.ArgumentParser(description='PyTorch implementation of LG-GNN')
parser.add_argument('--train', default=1, type=int, help... |
9434addaa84443a4d770a73d60ad6373b8e17239766a259ef518f60c3cf12263 | Python | 2,443 | 76 | """
Script that jointly checks for all the datasets that we have.
This builds over all the datasets and creates a csv with the progress
of the preprocessing for all of them.
"""
import pandas as pd
import numpy as np
import datetime
import os
out_dir = "
total_csv = f"{out_dir}/data_total.csv"
df_total = pd.read_cs... |
cc673bdf2dbbdb250db3e7bfac10a722c8ddd1564e083ca4883cf0bb7aac23f9 | Python | 2,443 | 72 | #! /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... |
d26620f28c1b0a3e0483f83776c1da3308c184307e7bcfd3cbc50d9e55961844 | Python | 2,443 | 82 | # dataset settings
dataset_type = "CityscapesDataset"
data_root = "data/cityscapes/"
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True
)
crop_size = (768, 768)
max_ratio = 2
train_pipeline = [
dict(type="LoadImageFromFile"),
dict(type="LoadAnnotations"),
dict(... |
22568458aff1ebad8c8a773b462e2b81a389b924984d84f6617dc15555c9f53b | Python | 2,444 | 65 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Test for vedb odo from folder and from cloud
@author: brianszekely
"""
# import sys
from os import getcwd, path
from odopy import headCalibrate
import matplotlib.pyplot as plt
import numpy as np
def quat_to_euler(quaternions):
"""
Convert quaternions to Euler ... |
268d1601890d5872cbd56aa71506d28589990b3488cfc7520eb626cfce804689 | Python | 2,444 | 78 | import torch
import torch.nn as nn
from torch import Generator
from typing import Any
from abc import ABCMeta, abstractmethod
class CoreBlock(nn.Module, metaclass=ABCMeta):
"""
Network core layers performing complex feature extraction
"""
@abstractmethod
def __init__(self,
in_ch... |
cdaa7e2bd2c85c40d17e10d1c0401c71f875df527a48a391d0627b5975c28169 | Python | 2,444 | 70 | #
# 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,... |
081cb9d8397d64f72716ca7bbc8ccf64e282b1a9b2f78adb2977383e26a71971 | Python | 2,446 | 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... |
50e87d5eb5c3aa26a331225bd8f16a20cec3a93bd37db3aa83289b59cb71a37d | Python | 2,446 | 66 | import subprocess
import os
import sys
peak_extend_command = "zcat " + sys.argv[1] + ''' | sort -k1,1 -k2,2n | bedtools cluster -i - > extended.bed'''
subprocess.call(peak_extend_command,shell=True)
command = '''awk '{count[$NF]++} END {for (id in count) print id,count[id]}' extended.bed > cluster_counts.txt'''
su... |
64f0908fcf33dcc7ad70faa62a20d1e36dd664a07baf2143743dff8953816ce3 | Python | 2,447 | 64 | extensions = dict(
required_params=['training_frame', 'x'],
validate_required_params="",
set_required_params="""
parms$training_frame <- training_frame
if(!missing(x)){
parms$ignored_columns <- .verify_datacols(training_frame, x)$cols_ignore
if(!missing(fold_column)){
parms$ignored_columns <- setdif... |
db24c85bd267a79cfde81aa7707b90c7350ad4903ded728840039fdaac05623a | Python | 2,447 | 56 | import os
import h5py
import numpy as np
import scipy.io as sio
ukb_smri_data_path = '/data/users1/xinhui/MISA/MMIVA/UKB/postMMIVAresults/mancovanouts/UKB_MMIVA_C30_preregSite_SMRI_MancovanOuts_wX_FINAL.mat'
ukb_fmri_data_path = '/data/users1/xinhui/MISA/MMIVA/UKB/postMMIVAresults/mancovanouts/UKB_MMIVA_C30_preregSite... |
e82bdbf7871d960d6d6d6ac1fd4bda35ea23a852e89b30f43732c01e985b7103 | Python | 2,447 | 73 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import yaml, io
with open("./config/simul_study_config.yaml", 'r') as stream:
config= yaml.safe_load(stream)
config["default_path"]= str(config["default_path"])
config["split"]= float... |
021c9cdd055390745a5038ee270b19ac3ef8d2217e680166b442bf01db7e2aa0 | Python | 2,448 | 55 | from .chebnet import ChebyshevConvolutionalNetwork
from .gcn import GraphConvolutionalNetwork, RelationalGraphConvolutionalNetwork
from .gat import GraphAttentionNetwork
from .gin import GraphIsomorphismNetwork
from .schnet import SchNet
from .mpnn import MessagePassingNeuralNetwork
from .neuralfp import NeuralFingerpr... |
35dd2dd30f6f7c03ca278a53bc894a55f75eb19a1b6785df4999531309c11697 | Python | 2,448 | 76 | #! /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... |
456b9c5c27e00f7e77d9624df91ac49d3dc939a92d9178a42d0c15fc1facaa81 | Python | 2,450 | 96 | #
# Copyright Bradley Lowekamp
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed ... |
63862b2fb09341942e1cc51fb37f88a4f474dbc12435f026f3db53f474d8104b | Python | 2,450 | 88 | # Node-group asset "URes 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
from ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.