sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
6c514314759d33bfe94f3f272e55796e0b00551b326904a7b2dd3996892f4820 | Python | 9,421 | 263 | """Parameter scaler classes"""
"""
Copyright (c) 2016-2020, EPFL/Blue Brain Project
This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as published
by ... |
e3348056f187542939a86509f992c5111e6412477f7c2c16e6a76d045e7bd8c5 | Python | 9,427 | 311 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# visualqc documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... |
bfe1bc96f863051472f47e1e89b85ba170a9295009f5deaa35ae12406e3eb85c | Python | 9,428 | 229 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import collections
import logging
import regex
import string
import unicodedata
from functools impor... |
84b11ebe04d1c92987725d879c698a5f0e91e291e96445d11c0184929187254f | Python | 9,435 | 238 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import csv
import json
import logging
import pickle
import time
import glob
from pathlib import Path
impor... |
23290503bd8b20eee451b1201dd9f13cd89d4377a75864b8db37416d279e2088 | Python | 9,441 | 275 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 9 15:20:41 2021
@author: Engi
"""
from autoreject import AutoReject
import mne
import evoked.evoked_constants as ev_cs
import numpy as np
import base.files_in_out as in_out
import feather
class AutoHelp():
def __init__(self,files):
self.fi... |
7fb627731012d0ac7e0d161fca4424558c5b54a68766ca3541993726af427b60 | Python | 9,443 | 283 | import json
import os
from sys import stderr
from typing import List, Dict
from deprecation import deprecated
from kgx.utils.kgx_utils import GraphEntityType
from kgx.graph_operations.meta_knowledge_graph import (
generate_meta_knowledge_graph,
MetaKnowledgeGraph,
)
from kgx.transformer import Transformer
fr... |
6bcfc6b4cb5d0087cc11d5e0d6faee25110b640cfe1f1e3383dfa781b76ea742 | Python | 9,446 | 234 | import torch
from torch.utils.data._utils.collate import default_collate
from dataclasses import dataclass
from typing import Dict, List
from .base import (
_CONFIG_MODEL_TYPE,
_CONFIG_TOKENIZER_TYPE)
from fengshen.models.roformer import RoFormerForSequenceClassification
from fengshen.models.longformer import L... |
9961511b05fa568725b4ca3e425d276ffa8ea036ca7343a57d8bd86d00547563 | Python | 9,452 | 266 | # -*- coding: utf-8 -*-
import json
import os
import pytz
import datetime
from dateutil.parser import parse as parse_date
from dateutil.tz import tzutc
from django.db import connection
from guardian.shortcuts import assign_perm
from .common import CatmaidApiTestCase
from catmaid.models import Volume
from catmaid.c... |
9289720f4be05f0802a239effa19c4dbb6876b09f818bd976d8faa6db1e7d338 | Python | 9,456 | 317 | import itertools
import json
import os
import tempfile
from concurrent.futures import ThreadPoolExecutor
import numpy as np
import pytest
import xgboost as xgb
from xgboost import testing as tm
from xgboost.testing.ranking import run_ranking_categorical, run_ranking_qid_df
from xgboost.testing.with_skl import (
r... |
d3cad5ed38f54904b0f52aab093f6deee0c93d938e13aaae026ae0c801353bbc | Python | 9,456 | 225 | # -*- coding: utf-8 -*-
from ast import literal_eval
import json
from typing import List
import yaml
from guardian.shortcuts import assign_perm
from guardian.utils import get_anonymous_user
from catmaid.control import project
from catmaid.models import (Class, ClassInstance, Project, Stack, ProjectStack,
Use... |
820987453e3c85891b9ff2a86578d29eeca921b52f0c075ad44cc90992ce226f | Python | 9,459 | 308 | """Three.js materials module for flexible material configuration.
This module provides Pydantic models for Three.js materials, supporting both
preset strings (e.g., "matt", "shiny") and fully customizable material objects.
"""
from abc import ABC, abstractmethod
from typing import Annotated, Literal
from pydantic im... |
0c4f9bd43d25ecbcb30245a054933e2aa7ecc7969c375d6434147f5ab15372e8 | Python | 9,461 | 341 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
# load wandb_export_2024-06-18T13_30_46.429+02_00.csv as df
# df = pd.read_csv('./Results_Analysis/raw_data/SAC_1... |
e82cdf1e82cf79143ab95581a184b7f3ad37635c069533dedd5419fca9b7bf24 | Python | 9,461 | 272 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Plotting subroutines
"""
from nilearn import plotting
from nilearn.plotting.displays import BaseAxes
import matplotlib.pyplot as plt
from matplotlib import gridspec, cm
import numpy as np
import os
from neuromaps.datasets import fetch_atlas
from brainspace import mesh... |
17d98f466d105b0d77b1b9585a319d6f2dc1864351e56e49215cde26e86b61cb | Python | 9,463 | 245 | # 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
#
# http://w... |
d66af7493165f6805cf1f08876ffcaf97b6de0ac1062fb3dcda266e06361133d | Python | 9,467 | 285 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import json
from typing import Optional, Tuple
import torch
from torch_scatter import segment_csr
def read_json(path: str):
""""""
... |
42930bb6e988fee689d4276a317cb1806696debc40ced730488078ac48cb0b75 | Python | 9,468 | 250 | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
"""
High-level interface for creating HDF5 virtu... |
2a6cc735634e56750181d658f4ef3b6ab5614e4b2225be45e3e6e1f31224e546 | Python | 9,473 | 259 | from __future__ import print_function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.parameter import Parameter
from torch.nn.init import xavier_uniform, xavier_normal_, orthogonal
from torch_scatter import scatter
from ccd... |
779d7cd7443cd5fb57f08e7512fb55109065f458137f38d8a863c19264941978 | Python | 9,473 | 274 | # SPDX-License-Identifier: Apache-2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
import logging
import sys
import numbers
import math
import sklearn
import datetime
import numpy as np
import cv2
import mxnet as mx
from mxnet im... |
1bbde4380f98afba888ba7aeb3d52d1e6459bd4fb7c87d7cf11732f38445e395 | Python | 9,474 | 285 | """
Filesystem related helpers and utilities
Copyright (c) 2020 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import sys
import io
import os
import shutil
import tempfile
import datetime
import logging
from pathlib import Path
from contextlib import contextmanager
import portalocker... |
1e4f821b5274773437f49dd826b77e18818f9af6723dddfb4089ee6d81b1c232 | Python | 9,477 | 309 | # -*- coding: utf-8 -*-
#
# SoccerTrack documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values ha... |
d8b53e208540d7d93b40ba7ee968efbffa95225f47ba20b71c108e8655ef43de | Python | 9,477 | 222 | # -*- coding: utf-8 -*-
import logging
import numpy as np
from typing import Any, Dict, List
logger = logging.getLogger(__name__)
try:
import scipy.cluster.hierarchy as hier
import scipy.spatial.distance as dist
except ImportError:
logger.warning("CATMAID was unable to load the scipy module. "
"O... |
9cc540a873b53410c44eded1fba41e5c6c516684678051025a2a4ac0f0c74450 | Python | 9,487 | 283 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-strict
# pyre-ignore-all-errors[2,3,16,33,6,23]
# NOTE: most Any type in this file should be torch._C.Value - which was not yet annotated.
# pyre also doesn't work well with many Optional in this file
import typing
from collections import C... |
e4f52bbd6e35e36f75a5c72799bf65c84edd05c41e9fc6fdb116e335a7e6ee76 | Python | 9,490 | 279 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import json
import torch
from torch_scatter import segment_csr
def read_json(path):
""""""
if not path.endswith(".j... |
864f6f4005ceb6c6d5d46f051cfc1bf87c88ac2a94f5f0fbf4de41518c1ca127 | Python | 9,496 | 327 | #!/usr/bin/env python3
"""
Create a PRIVATE, BLINDED visual-review packet for CICADA ICs whose final
automatic classification changed in the FIX-training smoothing experiment.
Inputs
------
--comparison:
fixtraining_smoothing_ic_level_PRIVATE.csv
--data-root:
CICADA derivatives root containing sub-* folders
--... |
5171d1a9f2a38039a46896b170f8f4ad377015a4f54a64789a59212447171697 | Python | 9,501 | 235 | #!/usr/bin/env python3
"""
Module for particle image preprocessing
"""
from typing import Tuple, TypeVar, Dict, Any, Union
import numpy as np
import torch
from .grid import dht, smooth_circular_mask, smooth_square_mask, \
get_spectral_indices, get_spectral_avg, spectrum_to_grid
Tensor = TypeVar('torch.tensor'... |
1d3567ee6ad7a54f4a33c2c3c0567b039d128c645d009eb5669b066590deda59 | Python | 9,503 | 286 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from torch_geometric.nn import SchNet
from torch_scatter import scatter
from ocpmodels.common.registry import registry
from ocp... |
799b1c2887ca0cfaef3c0942dc959f89c19e23050f1704a94eed28534eff4fb0 | Python | 9,504 | 334 | """XGBoost collective communication related API."""
import ctypes
import logging
import os
import pickle
from dataclasses import dataclass
from enum import IntEnum, unique
from typing import Any, Dict, Optional, TypeAlias, Union
import numpy as np
from ._typing import _T
from .core import _LIB, _check_call, build_in... |
0242f19886e1563d51b42d33db400e681343752795da2cdf42c8bed1f81d1df7 | Python | 9,512 | 285 | import torch
import itertools
import json
import hashlib
import os
from matplotlib.ticker import FormatStrFormatter, StrMethodFormatter
import umap
from matplotlib import pyplot as plt
import torch.nn as nn
import torch.optim as optim
import torch_geometric
import torch_scatter
import torch.multiprocessing as mp
from ... |
5d2a4576ad40da93d0e7ff1c89944640eaa6ae198236b4cee07943d9e9ec340b | Python | 9,512 | 185 | """Analyse a concord file's cross-references.
A concord is a tab-separated ``subject<TAB>predicate<TAB>object`` file under
``<intermediate_root>/<pipeline>/concords/<SOURCE>``, and every row is fed to :func:`glom` as an
equivalence assertion. That makes an *overused* xref target — one object claimed by many distinct
s... |
fafb60aaae70be55db89560d5b19c737ab65ca38916f4f13706938ef2b13a504 | Python | 9,515 | 199 | #!/usr/bin/env python3
"""Archive a build's summary reports into ``releases/<build>/``.
A finished build directory is hundreds of gigabytes and lives on a cluster that will eventually be
cleaned. A small part of it -- the summary tables, the per-compendium content reports, and the
provenance metadata -- is what people... |
24cc837149d553d422e7fc023ba3da64abfdc09e4a9c62e29959d0008a80867a | Python | 9,516 | 278 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 10 15:29:10 2024
@author: natalie
"""
import json
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import scipy
from scipy import special
import sys
from tqdm import tqdm
pi = np.pi
#%% MISC
def bin_matrix(A, new_shape, mode... |
8b831675e5f7d1be368b9340afd553aef6f5bc471f6a67b2f1ee28aff59b3d35 | Python | 9,517 | 246 | """
Trainer.py
Default class for running training
"""
import wandb
import copy
from dl_utils import *
from torch.nn import MSELoss
from torch.optim.adam import Adam
from torch.optim.sgd import SGD
from torch.optim.lr_scheduler import (ExponentialLR, CosineAnnealingLR,
ReduceLROnP... |
143a5b706de0124b1fbfaaa576945c1f0fe10f51d5c8d974a6a4609b4b7c4516 | Python | 9,525 | 296 | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch_geometric.nn import GCNConv
from torch_geometric.utils import add_self_loops, negative_sampling
from torch_sparse import SparseTensor
from torch.utils.data import DataLoader
from loss import *
def edgeidx2sparse(edge_index, num_no... |
b5f8897a9b2a37a4b9c38dc7f2618ee753e25089182aa903631c689bb631bdfe | Python | 9,526 | 368 | import argparse
import sys
from collections.abc import Callable
from io import StringIO
from pathlib import Path
import pytest
import cwltool.executors
from cwltool.argparser import arg_parser, generate_parser
from cwltool.context import LoadingContext
from cwltool.load_tool import load_tool
from cwltool.main import ... |
45089fb6536df9a3bea4064e088e61e735b269f3c31640205441c70b51005759 | Python | 9,529 | 271 | #!/usr/bin/env python
"""
MetaWIBELE: interproscan_tmhmm_protein_family module
Summary the results of TMHMM from InterProScan
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Softw... |
174a1ab256b84645b4128887bbc24833b7370f78592b9bae01701d2fe1cf9a7c | Python | 9,531 | 253 | """
Convert the voxel data to Hilbert curve representation
"""
import argparse
import json
import multiprocessing as mp
import os
import sys
import time
import h5py as h5
import numpy as np
from feater import io, utils
from hilbertcurve.hilbertcurve import HilbertCurve
def hilbert_map(iteration, dim):
hbc = Hil... |
54f36efed373f24ee010aff57f2678216a8ecfc02c4177b303ad848fc7c1cfd6 | Python | 9,531 | 215 | """PubMed pipeline test: a miniature end-to-end publications build.
Downloads a handful of real PubMed baseline and update files, verifies them against their published
MD5 checksums, parses them into titles/ids/concords, and builds a small Publication.txt compendium —
i.e. every step the `publications` Snakemake targe... |
99a8a4f78703d246546ffe704e449184db663f9275c85c2e8b402ea69a94c78b | Python | 9,533 | 284 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from torch_geometric.nn import SchNet
from torch_scatter import scatter
from ocpmodels.common.registry import registry
from ocp... |
adbef17e32624a936efe821757aa9dddd6c4eb1b4681c49e5d89893464d8b79c | Python | 9,537 | 299 | """
resnet for 1-d signal data, pytorch version
Shenda Hong, Oct 2019
"""
import numpy as np
from collections import Counter
from tqdm import tqdm
from matplotlib import pyplot as plt
from sklearn.metrics import classification_report
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.func... |
960cd5220c77658ff1740dd5f053d575353a3244ccd24eeda6397ac85b60dae2 | Python | 9,538 | 337 | import os
import itertools
import functools
from argparse import Namespace, ArgumentParser
import matplotlib
#matplotlib.use("pgf") # Produces smaller files than Agg
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
from cycler import cycler
import numpy as np
kConfig = {"uni... |
5d3cf876355c52c1908fb57cfb0485c718cbc2214b0f4dbedc49a7836419aac2 | Python | 9,539 | 259 | import csv
import json
import shutil
from pathlib import Path
import pytest
from guppy.testing.api import locate_run_folder, step1
from guppy_test_data import STUBBED_TESTING_DATA
@pytest.mark.parametrize(
"session_subdir, store_id_to_store_label",
[
(
"csv/sample_data_csv_1",
... |
0a473a28b19dbfc1a09aa813c8691049ee3723640b3bcef7a52325ebd353cd48 | Python | 9,540 | 185 | # 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
#
# http://w... |
aab04c5914bc6403fdd534aa69030d312b9700defefb4854391af8b2461d481d | Python | 9,561 | 222 | # -*- coding: utf-8 -*-
from django.db import connection
from django.test import TestCase
from django.test.client import Client
from guardian.shortcuts import assign_perm
from catmaid.models import Project, User, TreenodeConnector
from catmaid.control import node, skeleton, treenode
from catmaid.tests.common import Ca... |
e8f7c93566feb3d1876db500ac103ec6acf0f9b725a825ccc63168e190e7c967 | Python | 9,564 | 229 | import ast
import logging
import numpy as np
from e3nn import o3
from mace import modules
from mace.tools.finetuning_utils import load_foundations_elements
from mace.tools.scripts_utils import extract_config_mace_model
def configure_model(
args, train_loader, atomic_energies, model_foundation=None, heads=None, ... |
0376e0f14a3ad1e3e0c711395cd9629e974ce44156d4c1379ee9bf83f7b4a96b | Python | 9,570 | 288 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import json
from typing import Tuple, Union
import torch
from torch_scatter import segment_csr
def read_json(path: str):
""""""
if... |
662f821942ab03bfabf841a5f266879875e9a6549253afc655f81faf691a755d | Python | 9,574 | 255 | import os
import numpy as np
from brainglobe_ccf_translator.deformation import apply_deformation, route_calculation
import brainglobe_ccf_translator
import pandas as pd
from tqdm import tqdm
import scipy
key_ages = [56, 28, 21, 14, 7, 4]
points_dataset_rat3 = pd.read_excel(r"../data_files/DeMBA_landmarksValidation_Rat... |
41e157e5d7cf69c7e2a9cd9842ffdedb069c190c00e289b026f4c47946032251 | Python | 9,582 | 251 | import os
import gc
import yaml
import torch
import numpy as np
from scipy.signal import resample
from abc import ABC, abstractmethod
from memory_profiler import profile
from auditory_cortex import aux_dir
import logging
logger = logging.getLogger(__name__)
FEATURE_EXTRACTOR_REGISTRY = {}
def register_feature_extr... |
408288123c6cabc4626d6ea54f60d9eef75cbdcb901974b12912eb9b20297f9a | Python | 9,583 | 259 | """Generate a mock NWB file for testing the NWB recording extractor against ndx-fiber-photometry v0.1.0.
IMPORTANT: This script must be run with ndx-fiber-photometry==0.1.0 installed.
The current (post-v0.1.0) version moved device classes to ndx-ophys-devices, making
this script incompatible with the newer package.
T... |
a80f46a1c79b1761ef026ffd9563669b11745840297a50dddf4e58854019ad5c | Python | 9,584 | 302 | # -*- coding: utf-8 -*-
#
# BluePyOpt documentation build configuration file, created by
# sphinx-quickstart on Mon May 11 14:40:15 2015.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... |
b80bca6f428af16aab4d733c953f7f84972c4248a4a0a9c57f195a6302538770 | Python | 9,584 | 223 |
import igraph as ig
import warnings
from collections import Counter
warnings.filterwarnings("ignore")
def retrieve_multiple_edges(graph, source=-1, target=-1):
if source != -1:
e = graph.incident(source, mode=ig.OUT)
if target != -1:
e = set(e).intersection(graph.incident(target, ... |
c30f4d58230b40cebf0e9908a4346f03f0bd927cc53e9961ceeae3b4eb9ec6ea | Python | 9,585 | 290 | """
We need some description about the heart volume objects. Children are assumed to be stored apex to base.
"""
import lib.heart_volume.constants as const
import lib.heart_volume.heart_utils as utils
import numpy as np
import warnings
class HeartVolume:
def __init__(
self,
unique_id="",
... |
7da89b4059f8179cfe3e850fb9d3bef8602cdf992eb4b33a8406e464bbb00b10 | Python | 9,587 | 313 | import typer
from typing import Optional
import medperf.config as config
from medperf.decorators import clean_except
from medperf.entities.model import Model
from medperf.commands.list import EntityList
from medperf.commands.view import EntityView
from medperf.commands.model.submit import SubmitModel
from medperf.comm... |
767fa07d7e06e7729985f7141c9f3376374625c918c49fc96d5c7c8e4f38685b | Python | 9,590 | 217 | import cv2
import numpy as np
import os
import torch
from skimage import transform as trans
from basicsr.utils import imwrite
try:
import dlib
except ImportError:
print('Please install dlib before testing face restoration.'
'Reference: https://github.com/davisking/dlib')
class FaceRestorationHelpe... |
7ff62c4356aa2cb8b8fadc92b09ceedb6c91f4d4eaede262192039f385e8825f | Python | 9,594 | 229 | import copy
import glob
import os.path
import inspect
import numpy as np
import torch
from core.Trainer import Trainer
from time import time
import wandb
import logging
from torchinfo import summary
from projects.moco_t2star.utils import *
from projects.line_detection_t2star.utils import *
class PTrainer(Trainer):
... |
56a0d80afef300e58af5c4be2bf819e5f0d08a9dc7d731acae7bea559ce20d91 | Python | 9,597 | 270 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import torch
from ..initializers import he_orthogonal_init
from .base_layers import Dense
class BasisEmbedding... |
3741dac648840c3eda6e411e485fc1d641e4ef063c29b0ac27ce028cc574440f | Python | 9,606 | 238 | # Standard library imports
import os
import random
from collections import defaultdict
from io import StringIO
from typing import Dict, List, Tuple
from pathlib import Path
import sys
import math
import time
# Third-party library imports
import matplotlib.pyplot as plt
import numpy as np
import torch
from torch.utils.... |
4c58b1d92d026827803c946b5a3723338bb5fbfd620f7172beaee495b7a8a5db | Python | 9,606 | 298 | # tests/test_multi_worker.py
"""Tests for multi-worker scenarios - fixing the MultipleResultsFound bug."""
import uuid
from conftest import make_room_address
from zndraw_joblib.schemas import TaskClaimResponse
def test_two_workers_same_user_can_claim_tasks(client, room_1_address):
"""
Core bug reproduction... |
05e7c8c7cbb8107851366a2d5f143a52d6c90ad35166108fd0e42a088e410fbf | Python | 9,608 | 254 | import logging
import pathlib
from dataclasses import dataclass
from typing import Mapping
import ase
import ase.io as aio
import numpy as np
import torch
import typer
import yaml
from mace.calculators import mace_off
from rdkit import Chem
from simgen.calculators import MaceSimilarityCalculator
from simgen.utils impo... |
5ac6d0bb458b3a36f665f482e018393584b8a8f433d3a63744f2c530f5fcfa0f | Python | 9,615 | 266 | '''
Date: 2022-11-21 15:53:39
LastEditors: yuhhong
LastEditTime: 2022-11-22 23:35:52
'''
import os
import argparse
import pandas as pd
pd.set_option('display.max_columns', None)
import pprint
from tqdm import tqdm
tqdm.pandas()
import numpy as np
import pickle
import random
from rdkit import Chem
# suppress rdkit war... |
7b027403c0d555d867f8760e3dad766fc363703eb8ba6061bcdccdc80fdb536b | Python | 9,619 | 258 | """Translate spatially varying parameter-scaler expressions to Arbor iexprs"""
"""
Copyright (c) 2016-2022, EPFL/Blue Brain Project
This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser Gene... |
19b7fbc59d9bc92cffa71dc61d770e3fc94d29f18b9e6fd411a3ac5e2b739351 | Python | 9,627 | 269 | import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
import numpy as np
from sklearn.metrics import roc_auc_score, average_precision_score
from MobileNet import MobileNet
from RegNetX import RegNetX_400M... |
f7ac5c1e644c15e2d887c290f79add1503fd53a6620bfa6905b7682ffc837be5 | Python | 9,630 | 300 | """Integration tests for vis.sessions (room-scoped session visibility)."""
import json
import pytest
from fastapi_users.jwt import decode_jwt
from redis import Redis
from zndraw import ZnDraw
from zndraw.client import Sessions
from zndraw.geometries.camera import Camera
from zndraw.redis import RedisKey
from zndraw_... |
51f6e0ea8ad919985dba346f0a135581ae4039261b3ed4d839784a8e6dff4010 | Python | 9,633 | 315 | """Test passing of environment variables to tools."""
import os
from abc import ABC, abstractmethod
from collections.abc import Callable, Mapping
from pathlib import Path
from typing import Union
import pytest
from packaging.version import Version
from cwltool.singularity import get_version
from .util import (
... |
302c0b5a759b84564bc67241762479c3bb39aff32ffe1c949faeaf3d966c3aa5 | Python | 9,635 | 156 | import os, argparse, time, json
import numpy as np
from collections import OrderedDict
import nearl
import nearl.data
def parser():
parser = argparse.ArgumentParser(description="Featurize the misato trajectories")
# Input and output settings
parser.add_argument("-f", "--pdbcodes", type=str, required=True, he... |
00e019de645647df45d5f50f4c2c915199c5aabe5abd0fef1f57629ab0813478 | Python | 9,645 | 222 | import argparse
from configparser import Interpolation
import weightAnalysis
from surrogateParams import surrParams
import surrogateTraining
import torch
import numpy as np
import matplotlib.pyplot as plt
classes = {0:'T-shirt/top',
1:'Trouser',
2:'Pullover',
3:'Dress',
... |
8eddb0f9b6c880d57e5352c9ef52e6a0df65b6a78fae5980cd864e38ced82dda | Python | 9,652 | 316 | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
"""
Attributes testing module
Covers all op... |
1e1f08758a1d52816542f9a66513925136dd20e7f81e649cc2d221667238e370 | Python | 9,655 | 325 | from __future__ import annotations
from datetime import datetime
import json
from json.decoder import JSONDecodeError
import logging
import os
import os.path as op
from pathlib import Path
from typing import IO, Any
from unittest.mock import patch
import pydicom as dcm
import pytest
from heudiconv.utils import (
... |
ccda3a5c5296566cbf7048a4c168cea24d213a47a3f1585b303c82e06c4f68ea | Python | 9,656 | 245 | import pysam
import os
from seqUtil import fetchSize, compliment
import numpy as np
def getAlignedReads(bam, region, genome, print_quer = False, print_name = False, refSeq = False, print_ref = False,
print_align = False, compliment_reverse = True, include_quer = False, qual = 15):
'''
Input... |
e02a337ed7fb0e7577996dcdf453f96dafdf1354fb2986a83ac8c914d98eba2c | Python | 9,656 | 255 | ## BRIE model
import time
import numpy as np
from scipy.sparse import issparse
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow_probability import distributions as tfd
class BRIE2():
"""
Ng : number of genes
Nc : number of cells
Kg : number of gene features
Kc : numb... |
8916f664ad8739f9b10a4d55b9181fd5a1da6a245491ce4a552b81e5d9daea5a | Python | 9,672 | 187 | import matplotlib.pyplot as plt
import numpy as np
import pod5 as p5
import sys
import struct
import os
import math, statistics
import pysam
import argparse
import pyarrow as pa
import pyarrow.parquet as pq
parser = argparse.ArgumentParser(description='Predicting the best modification threshold and dist from positive ... |
a6a578d3929a6de9fbc42e417f803fea3585c6d837d6713feff4b57464dab17b | Python | 9,672 | 219 | import torch
import pickle
import numpy as np
from itertools import cycle
from models import get_model
from utils import run_forward
from test import evaluate
from ablate import ablate
def finetune(run_i, ft_cond_ctx, ft_cond_step, rot_cond,
loaders, loss_fn, args):
# Initialize data structures... |
b0f6b95e659abfe93c0de76115d12144c518aef1cb7c0d7832c67b0fc3ad050a | Python | 9,672 | 187 | import matplotlib.pyplot as plt
import numpy as np
import pod5 as p5
import sys
import struct
import os
import math, statistics
import pysam
import argparse
import pyarrow as pa
import pyarrow.parquet as pq
parser = argparse.ArgumentParser(description='Predicting the best modification threshold and dist from positive ... |
a20f08ad91e2098f90cc1538522cc040dade5e97e041e97cf0709dfc4704b090 | Python | 9,684 | 293 | import os
from typing import Union
from medperf.entities.interface import Entity
from medperf.entities.schemas import CubeSchema
from medperf.exceptions import InvalidEntityError, MedperfException
import medperf.config as config
from medperf.comms.entity_resources import resources
from medperf.account_management impor... |
6d735d5fda1709899c4361c3d9e0caee2cfabe6698da80c42057c67b82ca17c1 | Python | 9,686 | 220 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from collections import OrderedDict
import mmengine
import torch
from mmengine.runner import CheckpointLoader
def convert_key_name(ckpt):
new_ckpt = OrderedDict()
for k, v in ckpt.items():
key_list = k.split('.')
... |
b6217b3fd179ab3e7cc966cbaabe50260236320525b998b4ec62526060ab3d4a | Python | 9,688 | 215 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.general import xywh2xyxy
from utils.metrics import bbox_iou
from utils.tal.anchor_generator import dist2bbox, make_anchors, bbox2dist
from utils.tal.assigner import TaskAlignedAssigner
from utils.torch_utils import de_parallel
d... |
cba73235f15416edeee339431f5f601c51d12973cc0731556b74137aa2d30f8b | Python | 9,690 | 186 | #! /bin/python3
import subprocess
import os
import json
import re
import sys
from .jobHandler import *
import pysam
import concurrent.futures
from .cluster import Cluster
from .bcolors import Bcolors
class Sample:
def __init__(self, slurm, modules, logfile, sample_id="", sample_name="", raw_path = "", rdata_path =... |
8989dc82431ae0bd6d5bb8351759d5894045c7abfa5d1e494553518b85cdbea0 | Python | 9,691 | 222 | # 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
#
# http://w... |
679027f2532e1f2a50cc15c169a8556de6f2836a168aa02af35ba65882304b89 | Python | 9,693 | 300 | import os
import shutil
import argparse
import pandas as pd
import yaml
def prepare(data: pd.DataFrame, labels: pd.DataFrame, report: pd.DataFrame):
"""Takes a dataframe containing the raw data and transforms the data.
Args:
data (pd.DataFrame): DataFrame containing the data to be prepared
l... |
291c2be7933677d8cd8e70cc802d2c06c0fee0a84eed596622e5daada6be9768 | Python | 9,697 | 279 |
import sys
import socket
import struct
import math
import re
import multiprocessing
from collections import defaultdict
from ...common import *
from .hmmer_seqio import iter_fasta_seqs
QUERY_TYPE_SEQ = "seq"
QUERY_TYPE_HMM = "hmm"
DB_TYPE_SEQ = "seqdb"
DB_TYPE_HMM = "hmmdb"
def iter_seq_hits(src, translate, cp... |
d76c67637aedd066e70833a5a3b0ad2c3972b5aa89813885e6e6eac5e613d494 | Python | 9,697 | 211 | import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from grakel import Graph
from grakel.kernels import WeisfeilerLehman, SubgraphMatching, NeighborhoodHash
import seaborn as sns
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--alg", default="gl", type=str, help='gl or sdc... |
4fe5ba8941d20b610f9fd181dc8fbb5d18061b3220f18ec19855306b6b7a93d8 | Python | 9,699 | 235 | ##################################################################
# Performing step 1 CytoCommunity in CRC simulation dataset
# Reproducibility for Figure.3C
##################################################################
from sklearn.neighbors import kneighbors_graph
import numpy as np
import pandas as pd
import ... |
07f913853508bb048a74e3b732a9be7af8a7d8b41bd7c5b2dadac70b586be9a6 | Python | 9,700 | 196 | import enum
##
# Residue identities
non_standard_residue_substitutions = {
'2AS':'ASP', '3AH':'HIS', '5HP':'GLU', 'ACL':'ARG', 'AGM':'ARG', 'AIB':'ALA', 'ALM':'ALA', 'ALO':'THR', 'ALY':'LYS', 'ARM':'ARG',
'ASA':'ASP', 'ASB':'ASP', 'ASK':'ASP', 'ASL':'ASP', 'ASQ':'ASP', 'AYA':'ALA', 'BCS':'CYS', 'BHD':'ASP', '... |
a5568651334c26ed6016db09f16b2fa3309a57b74519f9e7844cd248f51c881f | Python | 9,712 | 287 | """
"""
import os, time, random, argparse
import numpy as np
import open3d as o3d
from pytraj import Trajectory
from matplotlib import colormaps
from feater import io, constants
from siesta.scripts import view_obj
element_color_map = {
# BASIC ELEMENTS
12: [0.5, 0.5, 0.5],
1: [1, 1, 1],
14: [0, 0, 1],
... |
2acd986c8a9575b4e4932c00f75746a4b6bf2f563f549ff49ed86b763f1f509b | Python | 9,720 | 286 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
import openai
import json
import requests
import _thread as thread
import base64
import datetime
from dotenv import load_dotenv, find_dotenv
import hashlib
import hmac
import os
import queue
from urllib.parse import urlparse
import ssl
from datetime import datetime
from ... |
79a8e86558fb335061812390af58921942705efd555141746b5149c4fcacc59d | Python | 9,724 | 296 | #!/usr/bin/env python
#
# Separate b=0 and DW images from diffusion dataset
#
# Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca>
# License: see the file LICENSE
import sys
import math
import time
import os
from typing import Sequence
import numpy as np
from spinalcordtoolbox.image import Image, gener... |
85ba1101e75c91483ef66b8f92736239cd6c8652be8d10f4e31cf9f20eeb0e1d | Python | 9,724 | 315 | #!/usr/bin/env python
"""
MetaWIBELE: ddi_DOMINE_ExpAtlas module
Based on Expression Atlas DB, check whether human transcripts expressed in gut for each ORF
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated ... |
f7e5ea5dc9f807bf20ae7a99f70aa06a2d929325f0de10c415680855975d64a1 | Python | 9,732 | 252 | from sklearn.model_selection import KFold
from sklearn.svm import SVR
import pandas as pd
import numpy as np
from nilearn import masking
import nibabel as nib
from itertools import product
import pickle
from sklearn.utils import shuffle
from sklearn.metrics import mean_squared_error
from nilearn.image impor... |
b833452e54ef4ba75bb46478e8be4f9ee10e6b984f5dc77e57855e1ea095cb6b | Python | 9,735 | 310 | import json
import os
import shutil
from unittest import TestCase
from pyalfe.data_structure import (
DefaultALFEDataDir,
Modality,
BIDSDataDir,
)
class TestPipelineDataDir(TestCase):
def setUp(self) -> None:
self.test_dir = os.path.join('/tmp', 'image_pipeline_data_dir_Test')
self.ou... |
3341db46dbe27f7cc445e9bb7c93af261a45ab32064367f378f9a313ec417f0a | Python | 9,737 | 246 | import logging
from collections import OrderedDict
import torch
import torch.nn as nn
from . import network_helpfuns
class SeparationNetworkRegressor(nn.Module):
"""
A network for predicting the enantiomeric enrichment and mass fraction for
classical salt resolution reactions
"""
def __init__(
... |
0423036225ac193f6a6e76dbd68dd1791520e23029d8ef74e88119d67f988004 | Python | 9,740 | 267 | """
Store the mRS probability distributions in here.
Where data are calculated instead of taken directly from the sources,
the calculations are described in the mRS_datasets.ipynb notebook.
Each distribution ending `_mrs6` includes the probability(mRS=6) data
when applicable, else P(mRS=6) is set to zero.
Invalid or mi... |
316bfd07556efc11131a4d70365e4e44fb3f1de061a8a70c2de5e66c250b1959 | Python | 9,740 | 242 | # -*- coding: utf-8 -*-
import json
from django.shortcuts import get_object_or_404
from catmaid.models import Textlabel, TextlabelLocation
from .common import CatmaidApiTestCase
class TextlabelsApiTests(CatmaidApiTestCase):
def test_update_textlabel(self):
self.fake_authentication()
textlabel... |
f481219130ba30eb0fdd74d0fa44c3be5a94e8985609512e428ebb957207e416 | Python | 9,744 | 258 | """Multi-GPU training utilities.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from ..layers.merge import concatenate
from .. import backend as K
from ..layers.core import Lambda
from ..engine.training import Model
from ..models import clone_model
from... |
71976494166efa92a1c470a7604bfac77afb040555a77b522265b5da8d1ca52d | Python | 9,752 | 287 | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google Inc.
#
# 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... |
0976a7323cc9c739797447b7438267b99ab35f1b2eb68809dbcef5c018f5edb2 | Python | 9,755 | 206 | import subprocess, os, sys, time, h5py
import numpy as np
import dask
from dask.distributed import Client
from Nearl import representations, trajloader, features, data_io
from Nearl import utils, printit, savelog
class FeatureLabel(features.Feature):
def __init__(self, affinity_file, atom_of_interest, delimiter="... |
73c80f7a6781d0b79663a315e40c41f454b91194c4273ae40396e7c831582179 | Python | 9,757 | 314 | """Tests for Bookmarks REST API endpoints."""
import pytest
from helpers import (
MockSioServer,
auth_header,
create_test_room,
create_test_user_in_db,
)
from httpx import AsyncClient
from sqlalchemy.ext.asyncio import AsyncSession
from zndraw.exceptions import BookmarkNotFound
from zndraw.models impo... |
24d9152cf36cbaf21d55d0fa0ac5303ac2d200fb0598348d909ee2f4018321b8 | Python | 9,759 | 215 | ## The following code contains work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105.
## Additionally, we waive copyright and related rights in the utilized code worldwide through the CC0 1.0 Universal public domain dedication.
from ipaddress import IPv4Address
fro... |
224e61f131b5255b7686aaa4a35a45baf41d4908cc68736dad5090893ff0be2a | Python | 9,760 | 291 | import torch
import itertools
import json
import hashlib
import os
from matplotlib.ticker import FormatStrFormatter, StrMethodFormatter
import umap
from matplotlib import pyplot as plt
import torch.nn as nn
import torch.optim as optim
import torch_geometric
import torch_scatter
import torch.multiprocessing as mp
from ... |
3f4060cf4d2014d60e839a3cfbe5bf662f711b1050aa321106871705bc3b7ff0 | Python | 9,762 | 314 | """Tests for dask shared by different test modules."""
from typing import Any, List, Literal, Tuple, cast
import numpy as np
import pandas as pd
from dask import array as da
from dask import dataframe as dd
from distributed import Client, get_worker
from packaging.version import parse as parse_version
from sklearn.da... |
37f7cf0a4c771da9f936e3f24b70f32c61553aab428c20fc42b01a1aa25025ea | Python | 9,763 | 304 | """Tests for Chat REST API endpoints."""
from datetime import UTC, datetime
from typing import Any
import pytest
from helpers import (
MockSioServer,
auth_header,
create_test_room,
create_test_user_in_db,
)
from httpx import AsyncClient
from sqlalchemy.ext.asyncio import AsyncSession
from zndraw.mode... |
3684aab436bb63cc9c8dbe31c623104c37dc7e3a9f9a94cea7c0d404efea1e41 | Python | 9,764 | 249 | """
Utility functions for handling annotations.
License: BSD-3-Clause
Author: Hanna M. Tolle
Date: 2024-10-31
"""
import os
import pandas as pd
import numpy as np
from typing import List, Any
from utils.files import get_filepath, raw_data_dir, project_root
def load_annotations(study='psilodep2', filter=None):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.