sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3585de67af4f39e5f3354e3bcafb3b0aff7879bfbd1973c8684aa9a2c4edc5d0 | Python | 12,365 | 302 | import os
import sys
import logging
from itertools import islice
import torch
from torch import distributed as dist
from torch import nn
from torch.utils import data as torch_data
from torchdrug import data, core, utils
from torchdrug.core import Registry as R
from torchdrug.utils import comm, pretty
module = sys.m... |
586903c0715c36c95d2526341a1f1b66348a0e149dd56184f509d9a30575f193 | Python | 12,373 | 329 | #######################################################################################
# C. Jarne 2024 Analysis Group of D. Vidahurre @cfin #
# #
# Code performs a Ridge regression (called BR in the pap... |
b3bcbb871f3725d75c46d5a70ff70b70857bfc7a34074d5174ec8f919ccf969e | Python | 12,376 | 262 | import torch
import torch.nn.functional as F
import numpy as np
import ABIDEParser as Reader
import argparse
import random
import utils as utils
import time
from torch_geometric.data import Data
from sklearn.model_selection import StratifiedKFold
from scipy.spatial import distance
from model_gat import GAT
... |
f5baa681dc806f58170e10cd367277985850f8ea1fef93414e36ddf53eb3a6fe | Python | 12,377 | 236 | # 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... |
c508ac1ac317e7924e282d99a7caa200cda56010ae791e52bcb657aabdb1f9f7 | Python | 12,388 | 293 | import os
import numpy as np
from scipy.stats import spearmanr
import pandas as pd
from utils import pickle_load, make_dir, phi_stats, \
med_avg_weight, med_euc_dist, \
mannwhitneyu_print, save_plot
from rich_feeder_peripheral import rich_feeder_peripheral
import seaborn as sns
... |
711223a64f1400807625bd54b2ca62e406b4d17907a656d69357cd9661494301 | Python | 12,389 | 313 | """
Script for extracting an analyzing a GraphMCF with a segmented membrane
(v3) 18.11.15 - Modification for not to compute filaments
Input: - Density map tomogram
- Segmentation tomogram
Output: - Connectors clusters
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Pack... |
f75002f0861d4476cb2eabc44f414a05730624cb642c94be9e9f22353d704ff7 | Python | 12,389 | 332 | import os
import numpy as np
import pytest
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
pytest.importorskip("PySide6")
@pytest.fixture(scope="module")
def qapp():
from PySide6.QtWidgets import QApplication
app = QApplication.instance() or QApplication([])
yield app
def test_im... |
4b092a21b8df48f0396c2a91485227e55a8b670eb1f4841dd6ec50f5d7d418e1 | Python | 12,390 | 251 | ''' Modified by Mayank Kabra
From LEAP https://github.com/talmo/leap by Talmo Pereira
'''
import keras
from keras import backend as K
from keras.models import Model
from keras.layers import Input, Conv2D, Conv2DTranspose, Add, MaxPooling2D
from keras.optimizers import Adam
from leap.layers import residual_bottleneck_... |
2cac03b2ed31f538196409069c9be6f2678fc0ab363ecf2c89bea363d27c3196 | Python | 12,391 | 299 | """
Deterministic classification of particles in a STAR file
Input: - The STAR file with the particles to classify
- Classification parameters
Output: - A set of STAR files with the new classes
"""
__author__ = 'Antonio Martinez-Sanchez'
###### Global variables
################# Package... |
597628ce3bae3e412ccbcf1cf0554633f2bd876ac0e2083f4200b45b3b8190cd | Python | 12,396 | 292 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2023/7/21 14:05
# @Author : piaoyang cao
# @File : run_class.py
import argparse
import torch
from torch import nn
from torch_geometric.loader import DataLoader
from torch_geometric.data import Data
from torch.optim.lr_scheduler import StepLR
i... |
b394ec6574569737ee24f618137c1a7ee855d30f4e2e985215637cfe6e3240d0 | Python | 12,398 | 299 | from collections import namedtuple
from typing import Tuple, Optional
import os
import re
import math
import torch
from torch.utils.data.sampler import Sampler
import numpy as np
import pandas as pd
import SimpleITK as sitk
from cl_3d import utils
log = utils.get_logger(__name__)
Location = namedtuple('Location... |
7cc56e063cb6df2042d8667c1425b73e625ab062a0b73c9ebb25dbd853570a75 | Python | 12,400 | 373 | """Core recipes for ORCA."""
from __future__ import annotations
from typing import TYPE_CHECKING
import psutil
from quacc import job
from quacc.atoms.core import perturb
from quacc.recipes.orca._base import run_and_summarize, run_and_summarize_opt
if TYPE_CHECKING:
from typing import Literal
from ase.atom... |
7e734ab47ab76e738ef93adbbbaf2f931e5eac59ac55d9a6d907a083f2aedeb5 | Python | 12,400 | 317 | import math
from datetime import datetime
from pathlib import Path
import dgl
import numpy as np
import pandas as pd
from torch import from_numpy
from preprocess import TCGA_Project
from base import BaseDataset
from utils.logger import get_logger
from utils.util import check_cache_files
class TCGA_Project_Dataset(... |
23e75260ecf414f35ce0a26073ed42f29a02095a110c504869dae4a0bfe42858 | Python | 12,401 | 411 | from time import time
from ncls import NCLS
import pandas as pd
import numpy as np
from sklearn.neighbors import NearestNeighbors
from sklearn.decomposition import TruncatedSVD
from collections import defaultdict
import igraph
import leidenalg
from scipy.sparse import load_npz
from argparse import ArgumentParse... |
20030b4d6adfdcc9b0af2a5a522c757dfaf7303392cf0cfa2a30ec7a6eedb9cf | Python | 12,406 | 358 | from __future__ import annotations
import os
import numpy as np
import pandas as pd
from functools import cached_property
from cuppa.constants import RSCRIPT_PLOT_PREDICTIONS_PATH, META_CLF_NAMES, CLF_GROUPS
from cuppa.logger import LoggerMixin
from cuppa.misc.executors import RscriptExecutor
from cuppa.misc.utils i... |
c1f04fd4ebe845722a40a7a99fb05f4ef90fe7964751255cdff100b814ff9c54 | Python | 12,406 | 255 | #!/bin/env python3
"""
Phase of cyclic wave-like processes
-----------------------------------
When studying periodic/cyclic processes, the term *phase* refers to an angle
:math:`\\phi \\in [0,2\\pi)` that increases as the process progresses. The
angle 0 often refers to the initial/resting state. As the process is per... |
41ea034e90687547b23295f43738b4ad9489672b6771e8e5108b181c864695ec | Python | 12,409 | 313 | """"""
"""
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free softw... |
ccc520a1640824f6bd3ff4842ad1f8f06a04751da0a85ffc4a3ea9ceef55d5b7 | Python | 12,411 | 310 | import torch
import pytorch_lightning as pl
import torch.nn as nn
import torchmetrics
import torch.nn.functional as F
from torch.utils.data import DataLoader
from typing import Any, Tuple, List
class SimCLRTrainer(pl.LightningModule):
r'''
This class supports the implementation of A Simple Framework for Con... |
1a00d7a17b18ca9efb7bba425e560c9d0cfa14bc499a9cb58b70c25188876ddf | Python | 12,416 | 216 | # 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... |
c43a21a73f7a82a82c857e4f10ca17382a3cf30da1a9172922c34a38328f6f6f | Python | 12,417 | 288 | """Unit + integration tests for the MIND-SSD ANTs driver."""
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
ants = pytest.importorskip("ants")
# N... |
9feca05e4f045d31baa56274f5c64b24c669e0956ff4b4c46bd9f10f5ebc55c1 | Python | 12,419 | 366 | """"""
"""
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free softw... |
4c5a8a10553eadffccb4a08630c872f0a9c91769bcbbf7ae7d21b20922f73c60 | Python | 12,420 | 375 | import logging
import time
import unittest
import numpy as np
import pytest
import xarray as xr
from chspy import join
from neurolib.models.aln import ALNModel
from neurolib.models.fhn import FHNModel
from neurolib.models.hopf import HopfModel
from neurolib.models.multimodel import MultiModel
from neurolib.models.mult... |
2dcda3e5c454fd2aeba96070381fcea355c1a10a525eb61c4c7fea169c8a6b1e | Python | 12,422 | 430 | """*================================================================
* Copyright (C) 2021 Yufeng Liu (Braintell, Southeast University). All rights reserved.
*
* Filename : swc_handler.py
* Author : Yufeng Liu
* Date : 2021-03-15
* Description :
*
============================================... |
609766fa5a6609192d93cfaa707738284906a60c3c87639cdc5e2c66dae754db | Python | 12,422 | 292 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Ideal observer code for:
A sequence of noisy images (faces or house). The probability of the
stimulus category (\theta_k, proprotion of house that prevails at trial k)
can be volatile or fixed.
The observer estimate \theta based on the observation recei... |
f7687abcdba5f6cd88699ace3279107cfce3b2ff35333a6b2e17ba97630a00eb | Python | 12,426 | 290 | """
Script for extracting slices from a SynGraphMCF
Input: - List of paths to SynGraphMCF pickles
- Path to XML file with slices description
Output: - Slices segmentations
- UniStat object for every slice
"""
__author__ = 'Antonio Martinez-Sanchez'
import pyseg as ps
#########... |
f56e221e09b9c1e12d122d4b63d331c25eaab75db718511fc07c9e46fce82685 | Python | 12,430 | 294 | import unittest
import numpy as np
from torcheeg.datasets.constants import (DEAP_CHANNEL_LIST,
DEAP_CHANNEL_LOCATION_DICT,
M3CV_CHANNEL_LOCATION_DICT)
from torcheeg.transforms import (ARRCoefficient, BandApproximateEntropy,
... |
9afde26c33ecf59f0f0e0bdf52b18022fad87aa80f96b350bd02a733fb49b147 | Python | 12,433 | 249 | #!/usr/bin/env python3
__author__ = "Zoe Wefers"
__credits__ = ["Ryan Huang"]
__version__ = "1.0.0"
__maintainer__ = "Zoe Wefers"
__email__ = "zoe.wefers@mail.mcgill.ca"
""""Purpose: Executable script which reads annotated and non-annotated MAP2 max projections gif images and generates a print for every
annnotated de... |
e5f6aa44784407a7dda45f69d6b09e10bd6185b574d4d71f195167ea306d1fb0 | Python | 12,434 | 330 | import glob
import os
import cv2
import numpy as np
import torch
import torch.nn.functional as F
from src.common import as_intrinsics_matrix
from torch.utils.data import Dataset
def readEXR_onlydepth(filename):
"""
Read depth data from EXR image file.
Args:
filename (str): File path.
Return... |
2a197ab084c47109f81d0db67d8c9f3721f4f50dfe714216731d2e78173b4369 | Python | 12,436 | 392 | """
Materials Project-compatible recipes.
!!! Important
Make sure that you use the Materials Project-compatible pseudpotential
versions. The GGA workflows use the old (no version) PAW PBE potentials.
The meta-GGA workflows currently use the v.54 PAW PBE potentials.
"""
from __future__ import annotations
... |
092a76c06aab4c381b2d0055b45df94ac8ca51c5ccb9b3273146e01558cd9054 | Python | 12,438 | 332 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Modular prediction of off-target effects
@author: Wei He
@E-mail: whe3@mdanderson.org
@Date: 05/31/2021
"""
#################### Import all the packages #####################
from __future__ import division
import pandas as pd
import math,json,os,pkg_r... |
9bfd1bc2baab1a419d7d5e1c78f39853f7234e9458bab90fd6bdcf3f37ed4f8d | Python | 12,439 | 334 | """
Script for doing Univariate statistical spatial analysis for a 3D distributed point pattern
Input: - XML file with a particle list
- Parameters for setting the statistical analysis
- Tomogram mask (optional)
Output: - Graphs with the results of the statistical analysis
"""
... |
0016bb5476ea042ff6f0c9f8e12ee2ba6220c8c73c01933ad55404941cdc090d | Python | 12,442 | 336 | """
GUI tool to convert legacy TXT point files to napari-style CSV files.
Legacy TXT format:
Line 1: "index"
Line 2: <point count>
Lines 3+: Z Y X (space-separated integers)
Napari CSV format:
index,axis-0,axis-1,axis-2
0.0,z,y,x
...
Supports optional XY downscaling (default 20x)... |
291beca32b9ffa07b6d77e391f2b8ce605d32517ebe8ce62f66b0fdc26e4d4ff | Python | 12,442 | 337 | # 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... |
ab6eff681b200bd6294e931c3a0e06c67ff61239cb72e7b6b51110e4b09273ce | Python | 12,445 | 252 | import sys
import pandas as pd
import matplotlib.pyplot as plt
import netplotbrain as npb
from scipy.io import loadmat
import statsmodels.api as sm
from matplotlib.colors import LinearSegmentedColormap
sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/src/visualization')
fr... |
45b0e0ce598b19cb41cc84ea8308185e9185682ab3c3ca67be2e3ea7a9820557 | Python | 12,447 | 273 | # 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... |
3007a878f0675fa685d76a304d95d5d1396b2fcd20965ba180d2ea05cd3fbfa1 | Python | 12,448 | 250 | """
OXASL - Output module
Copyright (c) 2008 University of Nottingham
"""
import itertools
import numpy as np
from fsl.data.image import Image
from oxasl.options import OptionCategory, OptionGroup
from oxasl import reg, calibration
from oxasl.reporting import LightboxImage
class Options(OptionCategory):
"""
... |
ffd2631348739b8978c9a446a1353d27a8bf871f09212c13f8ac754ab6512164 | Python | 12,448 | 361 | """
Visualization of trial-averaged time-frequency transform, per-trial PSDs,
trial-averaged PSD and corresponding aperiodic FOOOF fit, as well as
trial-averaged time-frequency transform following the subtraction of
the aperiodic activity for channels C3 and C4 (or equivalent).
"""
import numpy as np
import matplotli... |
11497437f3b6c9d5b3b49209d5487d27dedf036ff70402063cd93876c0537479 | Python | 12,451 | 315 | #
# 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,... |
2cd2fad35e813ef169019573368a3f0d60f3bd11697f0fff9bd469e64c3ec943 | Python | 12,457 | 368 | import json
import logging
from optparse import Values
from typing import TYPE_CHECKING, Generator, List, Optional, Sequence, Tuple, cast
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.cli import cmdoptions
from pip._internal.cli.req_command import IndexGroupCommand
from pip._internal.cl... |
1c467e176c84aad03f1b2e46c84f71584c96d466037d76e0deed862229d12869 | Python | 12,460 | 313 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ... |
53b118d6df6ffb59e9676035a3f10e1261bd48790101511a67ffea1c1025df19 | Python | 12,462 | 261 | import torch
from torch_geometric.loader import DataLoader
from imports.ABIDEDataset import ABIDEDataset,MergedDataset
from imports.utils import train_val_test_split,train_val_split,GHMC
import torch.optim as optim
from torch.optim import lr_scheduler
import torch.nn.functional as F
from gnn import GNN
from torch.utils... |
23b5525d527791941f1f1cd03753117ca3ea1f32cbda33bde4288fa5b4de4af2 | Python | 12,463 | 306 | """
Script for extracting an analyzing a GraphMCF with a cleft
(v3) 24.03.16 - Modification for not to compute filaments
Input: - Density map tomogram
- Segmentation tomogram
Output: - GraphMCF
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
import time
... |
4d4ce75aa7541b5a0ada30948dc480e13c48dd4b7ef696e49a01d3147ddd2d85 | Python | 12,465 | 237 | """End-to-end GUI acceptance for live injection, the DA cue and leak control (real model, real widgets).
Drives the actual Observatory window and Continuous Generation dialog offscreen (VTK EGL):
1-9 sampled stream, Russian injection typed into the dialog during generation, provenance colors,
no reservoir rese... |
9fe1fe6417fccec47dc145f9f84f9923268ec2a51509e2b698673cf560db8559 | Python | 12,468 | 454 | import argparse
import inspect
from . import gaussian_diffusion as gd
from .respace import SpacedDiffusion, space_timesteps
from .unet import SuperResModel, UNetModel, EncoderUNetModel
NUM_CLASSES = 1000
def diffusion_defaults():
"""
Defaults for image and classifier training.
"""
return dict(
... |
c8e82bab5f4fe8441ec84a53be08c81e7520852e91ebffa2106d827809fc8794 | Python | 12,470 | 404 | """Methods for creating and handling objects."""
from datetime import datetime
from typing import Any, Union
import numpy as np
import mne
from numpy.typing import NDArray
from coh_handle_entries import create_lambda, rearrange_axes
extra_info_keys = [
"ch_regions",
"ch_subregions",
"ch_hemispheres",
... |
aad4748c74503acb9a1b34855096fda6280a836aea810aba77959cedf8b3235e | Python | 12,472 | 352 | import time
import os
import subprocess
import sys
import re
import argparse
import collections
import gzip
import math
import shutil
import matplotlib.pyplot as plt
import wandb
import numpy as np
from datetime import datetime
import random
import multiprocessing
#import logging
#from silence_tensorflow import silen... |
620fdef7b21b9659c139a79f0108b6806f927c30de703482821c6c2973512087 | Python | 12,474 | 318 | import pickle
import torch
from torch_geometric.data import Data
def get_ehr_data(device):
with open('ehr_atc3.pkl', 'rb') as f:
ehr_records = pickle.load(f)
## Dict Maps
with open('DictMaps/diag_map_dict.pkl', 'rb') as f:
diag_map_dict = pickle.load(f)
with open('DictMaps/diag_map_rev_dict.pkl', 'rb... |
390a119a6d5c852efdfde1e3dba3ed20171b1dd646c16520e2180f99a5becafa | Python | 12,478 | 310 | # Copyright (C) 2019 Computational Science Lab, UPF <http://www.compscience.org/>
# Copying and distribution is allowed under AGPLv3 license
# This script implements functions to generate 3D molecular structures from SMILES strings,
# applies random affine transformations to 3D representations, and prepares molecular ... |
dd77dec36275e787cc952621980ee7daa3be3edb4edebc3b1d32c9445ffb2722 | Python | 12,479 | 387 | import os
import yaml
from yacs.config import CfgNode as CN
_C = CN()
# Base config files
_C.BASE = ['']
# -----------------------------------------------------------------------------
# Data settings
# -----------------------------------------------------------------------------
_C.DATA = CN()
# Batch size for a si... |
2ddb546e350f1345719b11601d7f2ed79f4546f8750a7640df474044e01477f1 | Python | 12,481 | 356 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import subprocess
import sys
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.experiment import ARGPARSER
from lab.steps import Step
from lab import tools
from downward.experiment import FastDownwardExperiment
from downward.rep... |
e117fc47437b8ec0c8344efbe1d1c989eb8c3fe063ea42801c342ddc73b17024 | Python | 12,481 | 399 | """create dpss using nitime code. Scipy v1.1 will have dpss
"""
import numpy as np
import scipy.linalg as linalg
import scipy.interpolate as interpolate
import scipy.fftpack as fftpack
def dpss_windows(N, NW, Kmax, interp_from=None, interp_kind='linear'):
"""
Returns the Discrete Prolate Spheroidal Sequences o... |
3ff01e3c51bc2ec64a5191023ae6a443c9b37312461985d600a46926677f376f | Python | 12,483 | 303 | """Network parameters
---------------------
A dictionary with base network and neuron parameters is enhanced with derived
parameters.
"""
import numpy as np
net_dict = {
# factor to scale the number of neurons
'N_scaling': 1.,
# factor to scale the indegrees
'K_scaling': 1.,
# neuron model
'... |
7ab19e51a154c8b4d1628a6fa30fcb92712918dfa6d579305cfda2997dd0aa4e | Python | 12,483 | 293 | import time
import os
import subprocess
import sys
sys.path.insert(0, '/home/jupyter/repos/genformer')
import re
import argparse
import collections
import gzip
import math
import shutil
import numpy as np
import time
from datetime import datetime
import random
import seaborn as sns
import logging
os.environ['TPU_LOA... |
ecaa1800ecb58f7b8e113dc91fbf50fedd251c216877e8c7270d7df9a53a7bc8 | Python | 12,484 | 371 | # Node-group asset "Simulate Elastic Network" (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 TY... |
5ea63fde6e13e850a5f2d1e22e1af08760b406658f98e2190d8c3f9034a52028 | Python | 12,489 | 284 | import json
import logging
import multiprocessing
import os
import queue
import sys
import threading
import time
from typing import List
import requests
from pydantic import BaseModel, Field
from tqdm import tqdm
from NDATools.Utils import get_request, put_request, Protocol, post_request
logger = logging.getLogger(_... |
ea928365275db58ae1dea245f51d6fc4f678ffc76e6a27a07aa534d5fc00bf6f | Python | 12,489 | 380 | from __future__ import annotations
import numpy as np
import pandas as pd
from scipy.stats import trim_mean
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_is_fitted
from typing import Any, Literal
from numpy.typing import NDArray
from cuppa.logger import LoggerMixin... |
2f2ad3e3af12a922127846811848fe8497191e9b21e16b34a373733b3d3ace51 | Python | 12,491 | 326 | from tensorflow import keras
import tensorflow as tf
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import sys
import sklearn
from sklearn.utils import resample
from pandas import read_csv
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import ... |
90c54ae473f83255cdb972fa8606dbe3a9a14b3685d24015ff6488a4141e7715 | Python | 12,492 | 296 | import argparse
import json
import os
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.colors import LinearSegmentedColormap
import ramanspy as rpy
import autoencoders
import unmix
def _summarise_results(gt_endmembers, gt_abundances, predicted_endme... |
b5b3308a5acccb0a88ebaa5fceaee8642bce3ff0cf8a0ff81216ec04a77c6366 | Python | 12,495 | 380 | """Core recipes for ORCA."""
from __future__ import annotations
from typing import TYPE_CHECKING
import psutil
from quacc import job
from quacc.atoms.core import perturb
from quacc.recipes.orca._base import run_and_summarize, run_and_summarize_opt
if TYPE_CHECKING:
from typing import Any, Literal
from ase... |
dd2ee38e047d4ece22725af3475376da291c4041e1a8d4605afe092237cef5a6 | Python | 12,495 | 298 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Create and load stimulus features.
Created on Thu Nov 4 17:23:06 2021
@author: Hugo Weissbart <hugo.weissbart@donders.ru.nl>
"""
import os.path as op
import sys
import numpy as np
from tqdm import tqdm
import h5py
from audiobook.utils import STORIES
from audioboo... |
4cfab2a02f2224ae27ccfd9a8fa9c7d073301a755ed9c11e0de2b43fc9e662a6 | Python | 12,496 | 357 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import subprocess
import sys
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.experiment import ARGPARSER
from lab.steps import Step
from lab import tools
from downward.experiment import FastDownwardExperiment
from downward.rep... |
ecba3006b58a1c14425c166406289069f7c3a2586dc233d1c822a5cc09fa831d | Python | 12,506 | 315 | import numpy as np
import pandas as pd
import sys
import math
import collections
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
import argparse
import timeit
run_time = timeit.default_timer()
from tensorflow.python.framework import ops
import pickle
import os
def get_parser(parser=None):
if parser... |
802a7d477c3e1fc2ea20d22e9bb9ffc464e70df8070ac2e8b75a21dd920a396d | Python | 12,508 | 357 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import subprocess
import sys
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.experiment import ARGPARSER
from lab.steps import Step
from lab import tools
from downward.experiment import FastDownwardExperiment
from downward.rep... |
62e2aa3bd564677396da064c2bf7fd85ac0e14de8c4bea12f533d0f4c473ab4f | Python | 12,509 | 319 | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import Bio
from Bio import motifs, SeqIO
def read_fasta(fasta_file, skip_duplicate=True, fmt='fasta'):
'''
Read in sequences
'''
id_seq_dict = {} # {sequenceID: fastq sequence}
duplicate_keys = []
for seq_record in SeqIO.parse(fas... |
7fa6ec202fc88986e52d4cfd0d56bbef819e8b189d2969a71af7903f657e311c | Python | 12,510 | 406 | # 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... |
6b3f6225891f4d03f542912001bb09e8509bd88226edd3e15a8c8c5d3ed4a5cf | Python | 12,518 | 323 | #!/usr/bin/env python
#
# Copyright 2009 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... |
7e06312a157172543f88a0cad535dd1c2cf75b91b6f49e0b1d7ab46fd5aa2b89 | Python | 12,522 | 296 | import torch
from src.common import get_rays, raw2outputs_nerf_color, sample_pdf
class Renderer(object):
def __init__(self, cfg, args, slam, points_batch_size=500000, ray_batch_size=100000):
self.ray_batch_size = ray_batch_size
self.points_batch_size = points_batch_size
self.lindisp = cfg... |
c188c0e334c720b382c4871c99435fbfa1de60f877513972c34e4d3800740b57 | Python | 12,523 | 294 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 25 21:27:59 2024
@author: plai
"""
import pandas as pd
import os
def wrapper_table(f, pd, caption, withModel):
f.write('\\begin{table}\n')
f.write('\\begin{tabular}{lllrrrr}\n')
f.write('\\toprule\n')
column_names = pd.columns.tolist()
... |
ad0214bc6c40873393a33edb0e0ac605625734a70cd93b04163dfae98790232c | Python | 12,525 | 271 | ######## Name
######## BiochemStem
######## Requires
######## {Modules}
import re
import numpy as np
import numba
class BiochemStem:
"""Class 'BiochemStem' Illustration!
It is an essential part of the 'BiochemSimul' class!
########
Attributes
initial_state: 'dict'
A dict... |
f32a257079e0b0f466d95aa2e4e8fd8e98a350b824d9f80ea3321b01bef6e8a3 | Python | 12,527 | 363 | from typing import Callable, Tuple, Any
import numpy as np
import netket as nk
import jax
import jax.numpy as jnp
import flax.linen as nn
from typing import Any, Tuple
from netket.utils.types import DType, PyTree, Array, Callable
from functools import partial
import numpy as np
import netket as nk
import jax
import jax... |
9f23bce097121fa7a0d00d0b7cc2c7e594f9a3cac8b81bf91cc7b1a163f77bbb | Python | 12,528 | 373 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author:
Maximilia F. S. Degenhardt <frazaodesouzam2@nih.gov>
Hermann F. Degenhardt <degenhardthf@nih.gov>
"""
import os, sys, math
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from copy import deepcopy
fro... |
e3ac73156bff67e8b32cac8e00c4ed6f232e30be8be8e150a14fbef91cdef8d5 | Python | 12,528 | 298 | """
Generates a ListTomoFilaments object from a input STAR file
Input: - STAR file with the list of filaments, each list pairs tomograms and filament networks
- STAR file for pairing tomograms and segmentations
Output: - A ListTomoFilaments pickled object for every STAR file row
"""
######... |
de984ae1f6eb1245fc0ad9e3ed3ecad6ac26216f2faa94736ffd4037c40d3bbb | Python | 12,531 | 409 | import numpy as np
import numba
from ...utils import model_utils as mu
def timeIntegration(params):
"""Sets up the parameters for time integration
:param params: Parameter dictionary of the model
:type params: dict
:return: Integrated activity variables of the model
:rtype: (numpy.ndarray,)
... |
36ebf1cd7df972d8f81896dfb7468500bdc7c835cf3c26d3039c647568d4b9bf | Python | 12,532 | 354 | """
Compute averaged density in a neighbourhood (it can either uni or bivariate)
Input: - A STAR file with a ListTomoParticles pickle (SetListTomograms object input) used as reference
- A STAR file with a set of ListTomoParticles pickles (SetListTomograms object input) to analyze
- A ... |
695edb8647f97b8fcac4e62136703b0c50002e801deda384c1fadc428df05e40 | Python | 12,533 | 357 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import subprocess
import sys
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.experiment import ARGPARSER
from lab.steps import Step
from lab import tools
from downward.experiment import FastDownwardExperiment
from downward.rep... |
26dfcaa0272bb6b065033a46146c5f99f357a4c8c98e79ce6c963d3c58991265 | Python | 12,536 | 233 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
3c97f0269dd4d486e4d68f7e0e65ce8ad04fcf8da545f7f71df5226b3a475a9e | Python | 12,538 | 409 | # 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... |
1d9221393e43edd919985aa6102391a8f45bfa6ba756dda7369f107ac3482728 | Python | 12,539 | 331 | """
Script for post-processing already reconstructed particles
Input: - STAR file with next columns:
'_rlnMicrographName': tomogram that will be used for reconstruction
'_rlnImageName': tomograms used for picking
'_rlnCtfImage': (optional) CTF model subvolume
... |
388cc8bb4950e77e8d5cc716f4298362e3802696912e5ee5973665f6073a7588 | Python | 12,539 | 357 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import subprocess
import sys
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.experiment import ARGPARSER
from lab.steps import Step
from lab import tools
from downward.experiment import FastDownwardExperiment
from downward.rep... |
6970c3970c28d74236cac2ef4d4a335afe1a807a653febddc2578be01aa59747 | Python | 12,539 | 332 | import time
from itertools import count
from .pr2_utils import get_top_grasps
from .utils import get_pose, set_pose, get_movable_joints, \
set_joint_positions, add_fixed_constraint, enable_real_time, disable_real_time, joint_controller, \
enable_gravity, get_refine_fn, wait_for_duration, link_from_name, get_b... |
b2f7bfdef3bd1bd17f3df926d6ed0868a01c3bdb318fff1243baaeba20d25b54 | Python | 12,541 | 332 | from jax import numpy as jnp, random, nn, jit
import sys, getopt as gopt, optparse, time
from csdp_model import CSDP_SNN as Model
## bring in ngc-learn analysis tools
from ngclearn.utils.metric_utils import measure_ACC, measure_CatNLL
"""
###############################################################################... |
0fbdaeccb7eea8595c6e6634d91a2e02cd79563b16a70c74545a650770c0da3b | Python | 12,542 | 357 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import subprocess
import sys
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.experiment import ARGPARSER
from lab.steps import Step
from lab import tools
from downward.experiment import FastDownwardExperiment
from downward.rep... |
dbe706ea24d218d9642bbc0a9a5444be5d0ed8337c2e50c7308cfcca2f84a723 | Python | 12,542 | 268 | import torch
import torch.nn.functional as F
import numpy as np
import ABIDEParser as Reader
import argparse
import random
import utils as utils
import time
from torch_geometric.data import Data
from sklearn.model_selection import StratifiedKFold
from scipy.spatial import distance
from model_gat import GAT
... |
85d5378a82cc823bd292c3042c969503cf1c60abaa37a1691c657fe392740adc | Python | 12,543 | 282 | #!/usr/bin/env python
# Copyright (c) 2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides an example control for vehicles which
does not use CARLA's vehicle engine.
Limitations:
- Does not respect any t... |
e805091b5dc9cdf7810677a920c2e2a48ff28c943edd90d8341a8067d1b2df8c | Python | 12,546 | 292 | import random
import os
import scipy.io as io
from tqdm import tqdm
from weight_avg import *
import option, bold
from model import *
from abide_dataset import *
from mdd_dataset import *
# init
argv = option.parse()
# seed and device
torch.manual_seed(argv.seed)
np.random.seed(argv.seed)
random.seed(a... |
961a355dc5e1b79bda2095141506d4e102aba392fcde88bee696b50ca45ad985 | Python | 12,548 | 308 | import numpy as np
import torch
import torch.optim as optim
from einops import rearrange
from torch import nn
from typing import Any, Dict, Optional
from dataloaders.torch_dataloader import create_torch_loader
from dataloaders.utils import get_dataset, sample_gt
from models.model import train, save_train_mask, Model
... |
7b791128b46999c37fdaf7dc23fbfa7bc804a694e101bded4757cea01f6899ed | Python | 12,554 | 401 | # 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... |
5cbde557fb32f76ef6fc2e2a0f4f718e22f9bbe5382526806e2962a01c3f0e85 | Python | 12,562 | 334 | """`topf`: a package for topological peak filtering."""
# Copyright (c) 2018 Bastian Rieck
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# no... |
72bb78ca13dead468d4d0ea00eef7d98f902ca1f7ae105a43adefefcc12c80ab | Python | 12,562 | 323 |
import os
import yaml
import itertools
import numpy as np
from plumbum import local, FG
from pathlib import Path
def grid_search(model_type,
dataset_dir,
hyperparameter_selection_dir,
resume,
low_data_setting,
no_cutoff,
... |
6f934377cbb501006f7e400fbe11ac3952adf760e2fb3b655a93dc7ebbcf6eee | Python | 12,563 | 446 | # 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... |
9e7bb8b770bde8b49d20f149769dfa53902b86cad9af9ba4ac2070064cb5372b | Python | 12,564 | 290 | """A map of column value keys into new column values."""
import pandas as pd
from hed.errors.exceptions import HedFileError
from hed.tools.util import data_util
class KeyMap:
"""A map of unique column values for remapping columns.
Attributes:
key_cols (list): A list of column names that will be ha... |
b406e9bc103b4bbe6c345aa3b332b7b459817aad4f20bf6cb17452082dbd2d2e | Python | 12,564 | 374 | #
# 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,... |
6218c792ade3dd14a58ab619a62f3145078c384e3fda58365707d73f8cd74b65 | Python | 12,565 | 325 | import sys
from dataclasses import dataclass
import networkx as nx
import numpy as np
import pandas as pd
from networkx.algorithms.approximation.clustering_coefficient import (
average_clustering as average_clustering_approx,
)
from networkx.algorithms.cluster import average_clustering
from scipy.sparse.linalg imp... |
2da3f80ee6bdfd9ba3d1ab0cc74a04d223e7e37ca39221afa1d38f88efb5a73c | Python | 12,569 | 346 | # -*- coding: utf-8 -*-
import tensorflow as tf
from .. import _logging as logging
from .core import *
__all__ = [
'Quant_DenseLayer',
'Quant_Conv2d',
'Quant_Layer',
'Quant_Layer1',
]
def _quantize_median(x, k):
G = tf.get_default_graph()
n = float(2**k)
with G.gradient_override_map({"R... |
ec1088aef334583784babc164621387b9e682d9f5e8462f59d31f8ac07e9f5ca | Python | 12,570 | 337 | """
Tests module morphology
More tests needed
# Author: Vladan Lucic
# $Id$
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from builtins import zip
#from past.utils import old_div
__version__ = "$Revision$"
import importlib
import numpy
import sc... |
9af1386b8b14582ecd2a2d8eae3d295a9f5a6d5d8ec6f43de21ff7c8bd2e635a | Python | 12,571 | 283 | import io
import os
import shutil
import unittest
import pandas as pd
from hed import schema
from hed.errors import HedFileError
from hed.models import Sidecar, SpreadsheetInput, TabularInput
from hed.models.base_input import BaseInput
from hed.models.column_mapper import ColumnMapper
class Test(unittest.TestCase):... |
46ee749355c08b985ff648525349f65178a920072d491eb6cc89c0a974881e87 | Python | 12,574 | 250 | """Python function to plot SubCortexMesh subcortices
"""
import numpy as np
import copy
import os
os.environ["VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN"] = "1" #safeguard for vtk crash
from brainspace.plotting import plot_surf as ps
from brainspace.mesh import mesh_creation as mc
import vtk
import numpy as np
def surfplot_s... |
fe2f9728d38f31b5f988c3f75b21bf48489930ea713dd594d1c93b76514bf629 | Python | 12,574 | 284 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import wx
import os,sys,pydoc
from pathlib import Pat... |
47911315792e16bdb18d355651bd99fd2f489343cc9c6942b3036db93392310f | Python | 12,575 | 298 | ################################################################################
# Import, Set up MPI Variables, Load Necessary Files
################################################################################
import os
from os.path import join
import sys
import matplotlib
import matplotlib.pyplot as plt
from matp... |
7c468dd144f1226f952302ae4ff73f1b61d2142d44717ab21b96270e96c6024b | Python | 12,577 | 324 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.