sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
29966f8a84826eed71a50fa44bc71c601971bc697e5faabab094b599a18e6225
Python
18,130
451
"""Per-seed ev_lca ceiling resolver for v7+ tax-scope filtering. Replaces the old ``--tax_scope inner_narrowest`` / ``AUTO_SCOPE_CLADES`` logic with an ``ev_lca ≤ ceiling`` gate applied per speciation event. Two built-in auto modes are provided: - ``auto`` (default): Eukaryota ceiling for all eukaryotes; Prokaryot...
86d42baf13531f1310d7631c51e891b852d4dbbcb61ba92b060346220774e8b9
Python
18,146
459
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 2 15:28:30 2023 @author: george """ from qtpy.QtCore import * from qtpy.QtGui import * from qtpy.QtWidgets import * import numpy as np import pandas as pd import pyqtgraph as pg import os # import pyqtgraph modules for dockable windows from pyqtg...
c86b174b7faad7740d6d4cc020a58b60337585d69b2eec243f063f637bdeaa7a
Python
18,157
448
import functools import glob import random import SimpleITK as sitk import numpy as np import os import typing import copy import SimpleITK as sitk import numpy as np import scipy.ndimage.morphology as morph import torch import torch.cuda import torch.nn.functional as F from torch.utils.data import Dataset from tqdm ...
af52d0fd78c1abec2ebc1c89bdf3e9f7a564cb02012948dd68b9be0bca109723
Python
18,198
380
"""Unit tests for the channel-centric NWB metadata form widget. ``MetadataSelector`` is a Panel widget, but it is fully driveable in-process: its values can be set in Python and its button callbacks fired synchronously (``button.clicks += 1``), so the form logic is tested directly without a browser. """ import pytest...
885cfc788f3178c9af10d7f4623a7d1770a34b2d3458bf5a910cf8ae64cc09b9
Python
18,227
439
import torch from torch import nn, einsum, broadcast_tensors import torch.nn.functional as F from einops import rearrange, repeat from einops.layers.torch import Rearrange # types from typing import Optional, List, Union # pytorch geometric try: import torch_geometric from torch_geometric.nn import Message...
a9f33114bb54ea8532cb954a2bdfb8d8107dd308cf90bd592af7e6863f201b64
Python
18,228
413
# pytest unit tests for spinalcordtoolbox.deepseg import json import os import shlex import shutil from pathlib import Path from unittest import mock import pytest import warnings import numpy as np from torch.serialization import SourceChangeWarning import spinalcordtoolbox as sct from spinalcordtoolbox.image impor...
ebdf7c157905c7d7020e0477ee6a6abe59da172274997350934a5a35bd182f52
Python
18,234
522
# Copyright (c) OpenMMLab. All rights reserved. from typing import Tuple, Union import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule from mmengine.model import BaseModule from mmengine.runner import CheckpointLoader from torch import Tensor from mmseg.registry import MODE...
a3b5cb5cfd166ff8d34a13453ac9452eb4638ddc55a09c9a15adc2f43b3d85e4
Python
18,251
470
from operator import index import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_style('ticks') sns.set_context('paper') from RiboGraphViz import RGV from RiboGraphViz import LoopExtruder, StackExtruder from sklearn.model_selection import cross_val_score, cross_val_predi...
9b5058735c1bfbe300b94648f7f521d8e8d153855c960108eaf1f00b59c8fd96
Python
18,254
380
# -*- coding: utf-8 -*- from collections import defaultdict, namedtuple from datetime import datetime, timedelta from functools import partial import json from networkx import connected_components import pytz from typing import Any, DefaultDict, Dict, Iterable, List, Optional, Tuple from django.db.models import Count...
b881355dffdf836237bda02aae633b00239e250a2b6cc7629d9cc6a1b02ca6f7
Python
18,263
449
# !/usr/bin/env python # -*- coding: utf-8 -*- import pandas as pd import json import argparse import torch import os import logging from transformers import AutoTokenizer, AutoModelForSeq2SeqLM from pytorch_lightning.utilities import rank_zero_info from sacrebleu.metrics import BLEU from fengshen.utils.utils import ch...
43103bc9878e03ecfcb133044f5885246e1dd79c215f946af2a720dafdda0fd0
Python
18,289
487
################################################################## # Test TrimNN on independent simulated data for subgraph matching # Reproducibility for Figure.2E ################################################################## import torch import os import numpy as np import dgl import logging import da...
aee0c5a8f59dbd5dd6f34f73593490f1c295347a311c3ad4dfafe7ff521c6916
Python
18,292
595
from medperf.exceptions import CommunicationRetrievalError import pytest import requests from unittest.mock import ANY, call from medperf import config from medperf.enums import Status from medperf.comms.rest import REST from medperf.tests.mocks import MockResponse url = "https://mock.url" full_url = REST.parse_url(u...
10668835f7b3c5797a83f46499fb991123d8e620bf65a1ea92e6865f0384ee00
Python
18,293
516
from torch import nn import torch from torch_geometric.nn import global_max_pool, global_mean_pool from torch.nn import Module, Linear, Softmax, BCEWithLogitsLoss, ModuleList #from torch.nn import Module, Linear, MSELoss, ModuleList from torch.nn.functional import relu from torch import sigmoid from torch.utils.data im...
f78c57797fa3b579aa85a231e46c0bcb265d3b3bd3fc3e3a2ea8d3fe7b6d4476
Python
18,300
519
from rest_framework import status from medperf.tests import MedPerfTest from parameterized import parameterized, parameterized_class class ModelBenchmarksTest(MedPerfTest): def generic_setup(self): # setup users model_owner = "model_owner" bmk_owner = "bmk_owner" bmk_prep_mlcube_...
78768180ada7c172d76d918f6ebba9577591c74b3e0680824d51362f7d72c4d9
Python
18,301
447
# Thomas Lavigne # 18-09-2024 # #------------------------------------------------------------# # Libraries # #------------------------------------------------------------# # # Functions created alongside the theory try: from porous_fenicsx import constitutive_laws, variational_for...
dc5bb6d32e4aabba149d6d0d28177747b864cce5561e59d1adb4fceefc2adf42
Python
18,305
350
from typing import Type import pytest import pytest_mock from CybORG.Shared.Enums import ProcessName from CybORG.Shared.Session import Session from CybORG.Simulator.Actions.AbstractActions.DegradeServices import DegradeServices from CybORG.Simulator.Actions.AbstractActions.DiscoverDeception import DiscoverDeception fro...
55a87a8fcfb5e0be204099cfe7ea0879fd636e32ae9952b12f59146ee3877c81
Python
18,307
447
# Thomas Lavigne # 18-09-2024 # #------------------------------------------------------------# # Libraries # #------------------------------------------------------------# # # Functions created alongside the theory try: from porous_fenicsx import constitutive_laws, variational_for...
21c090c2912ff286391ad243a68224e0b2af1dc8afd6465e65afa9ce56a7b61e
Python
18,334
549
from numpy import float32 import torch import torchvision from torch import Tensor, dropout, nn import torch.nn.functional as F import math import torchinfo from torchvision.models.feature_extraction import get_graph_node_names from torchvision.models.feature_extraction import create_feature_extractor import torchvisio...
41f5bd974c1990b26822113314ba6227a56b46a92562207c973c38b37ac28148
Python
18,348
460
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QListWidget, QFileDialog, QLineEdit, QGroupBox, QMessageBox, QListWidgetItem, QAbstractItemView, QProgressBar, QCheckBox, QFrame, QApplication) fro...
3a41ca5ec277a9a099d5fe5909c556592ebed341a43c71f3fa38d38407f60762
Python
18,356
485
# Copyright DST Group. Licensed under the MIT license. """ This module contains functions for parsing a YAML scenario config file """ import os import yaml from copy import deepcopy from prettytable import PrettyTable from CybORG.Shared.State.Credentials import AccessLevel, Credentials from CybORG.Shared.State.Servic...
5f74023587334f85b0f06ff089d6bc71e34e0dbe44bfa3f71371a086842c3442
Python
18,369
467
#!/usr/bin/env python # # Check the installation and environment variables of the toolbox and its dependencies. # # Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE # TODO: if fail, run with log and display message to send to sourceforge. # TODO: check chmod of binaries ...
68ca13d8f6d80779629a6e5aa63a07b4bee5818322cf8b15bec42f30b29d021b
Python
18,416
443
"""BART Style dataset. Modified from fairseq.""" import numpy as np import torch import math import re from fengshen.data.megatron_dataloader.dataset_utils import ( get_samples_mapping ) class BartDataset(torch.utils.data.Dataset): def __init__(self, name, indexed_dataset, data_prefix, num_...
15f486f22b1c50ac5097383d23a96af2f6bf825428d4771ad1b7e71172e564c4
Python
18,453
480
import copy import gzip import json import logging import os import re import sys from collections import namedtuple from logging.handlers import RotatingFileHandler from pathlib import Path from time import gmtime import curies import psutil import yaml from bmt import Toolkit from humanfriendly import format_size i...
b175c95e815c747cdc9194059466813dd3766e9479150e63a00591b992091df0
Python
18,454
518
""" 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 math import pi as PI from typing import Optional import numpy as np import torch import torch.nn as nn from torch_geometric.nn import M...
8aacac767dd7bea42e2c08f339ef3d972d08f3ce2379ebe43db9f7803ec3b642
Python
18,458
494
import math import numpy as np import numpy.typing as npt import random import scipy.interpolate from dtaidistance import dtw_barycenter from typing import List, Dict, Any, Optional, Tuple, Union # make TensorLike more flexible from tsgm.types import Tensor as TensorLike import logging AugmentationOutput = Union[Te...
66df266dbe14412305ae3398f0ec1bb21b303a93216b102d767e6c4ee5d4c3d7
Python
18,461
454
# Copyright (c) Meta Platforms, Inc. and 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. # Adapted from https://github.com/facebookresearch/segment-anything/blob/main/segment_anything/automatic_mask_generator.py...
93fed31e4deec4a30c6a7109336072ee04beb0b19faaab56e150876885944cbe
Python
18,470
436
# Copyright (c) OpenMMLab. All rights reserved. import warnings import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn import ConvModule, build_activation_layer, build_norm_layer from mmengine.model import BaseModule from mmengine.utils.dl_utils.parrots_wrapper import _BatchNorm from mmseg.registry i...
e4d720f20b2ef62016eac1b1177f76f99a24c8957bed202257ceec6224d5f71e
Python
18,474
447
# -*- coding: utf-8 -*- import atexit import logging import json import ujson import os import shutil from typing import List from pathlib import Path from catmaid import history, spatial from django.apps import AppConfig from django.conf import settings from django.core.checks import Warning, register from django.c...
1ba6d862577a9a1f28ca2267651084f8f73a0179a027e03d1bb414e59872ee50
Python
18,487
428
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from utils import fftshift, ifftshift class FreeSpaceProp(nn.Module): def __init__(self, wlength_vc, ridx_air, total_x_num, total_y_num, dx, dy, ...
bacd42337873e2704d52d90fe4cad894bcfb6872355a7977fa8c74b87bc6d3ed
Python
18,492
462
""" Author : Alexis Lebrun (PhD student) School : Université Laval (Qc, Canada) This module provides different tools to visualize vibrational spectra quickly. """ import matplotlib.pyplot as plt import numpy as np from boxsers._boxsers_utils import _lightdark_switch def random_plot(wn, sp, random_spectra, y_space=0...
6e156dff125453fb95f48ceec69ddaebce3ef9dc436155c206e270f986cef274
Python
18,497
450
import copy import datetime import functools import logging import random from collections.abc import Callable, Mapping, MutableMapping, MutableSequence from typing import cast from uuid import UUID from cwl_utils.types import CWLObjectType from mypy_extensions import mypyc_attr from ruamel.yaml.comments import Commen...
3541bb33763bd7fb68a0a5771fda2a16df093024e43a3c525d44d38bdf9d85d9
Python
18,501
522
"""Adapt independent TDF2 reading results to MassCube's ``MSData`` model. This module adds no dependency beyond MassCube itself. MassCube already depends on NumPy, and the binary reader in :mod:`._tdf` uses only the Python standard library plus the system ``libzstd`` runtime. Mapping from timsTOF's four-dimensional ...
fa9ccc641c20b5bf34f62ad4281f0a2f9062e307199b797b5e398c4db31a5e56
Python
18,501
393
# -*- coding: utf-8 -*- """Locally-connected layers. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from .. import backend as K from .. import activations from .. import initializers from .. import regularizers from .. import constraints from ..engine.b...
7750565a7ef9e0d02394ca2cd744b3ce5b366562be62ada6d3180bfb008c5d32
Python
18,509
409
import os, copy, torch, random, time, datetime import numpy as np import pandas as pd from torch import nn import torch.nn.functional as F from torch.utils.data import Dataset from torch.utils.data import DataLoader from sklearn import metrics from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection ...
5589b55dc143023b195e1abcbc3d63c885e55fadd04dbfdbf9faa0a6700019e2
Python
18,514
463
from myphdlib.interface.session import SessionBase from myphdlib.pipeline.events import EventsProcessingMixin from myphdlib.pipeline.saccades import SaccadesProcessingMixin from myphdlib.general.labjack import filterPulsesFromPhotologicDevice from myphdlib.pipeline.prediction import PredictionProcessingMixin from myphd...
468bdbdf7e126b50a45314301640ef00b08da6803883cec6952fcc6b21708be3
Python
18,518
428
# # report_tables.py # # As part of the `reports/` cleanup, this PR will create a bunch of new tables # in `reports/tables` which: # 1. Will be included in the Babel publication, and # 2. Will be included in the GitHub repository in the `releases/` directory by version number, so that we can # compare between ...
7cb938d4122c35d20f68fba952ebb171810965caeac3543a04c26c1feb22c790
Python
18,532
450
import argparse import csv import glob import hashlib import multiprocessing import os import random import time import numpy as np from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset, Subset import libro...
d4ca39bf23d55bc39a4df0e7801723acb700a62f0c1a95df1f92697d10d5c294
Python
18,532
450
import argparse import csv import glob import hashlib import multiprocessing import os import random import time import numpy as np from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset, Subset import libro...
dad21d13627a5eb6c4ae2a2dbfb435c6d9f6524574f65e8c3e9edc90b157a119
Python
18,532
459
"""Handle BIDS specific operations""" import hashlib import os import os.path as op import logging import re from collections import OrderedDict from datetime import datetime import csv from random import sample from glob import glob from .external.pydicom import dcm from .parser import find_files from .utils import...
70f949f2a4ce8274837f448dffdbf2f3ac13326336c1f477c32b90ece22b052a
Python
18,544
450
import argparse import csv import glob import hashlib import multiprocessing import os import random import time import numpy as np from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset, Subset import libro...
9e839d17665909996230c6e575c0d3848cecf3a06251e80cc57ab62fe4101aca
Python
18,544
450
import argparse import csv import glob import hashlib import multiprocessing import os import random import time import numpy as np from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset, Subset import libro...
1a7f6991d9040db01665da85b84ce2f7a89cd0500b6013a39e24c81bef44f31a
Python
18,550
549
from rest_framework import status from medperf.tests import MedPerfTest from parameterized import parameterized, parameterized_class class DatasetTest(MedPerfTest): def generic_setup(self): # setup users data_owner = "data_owner" bmk_owner = "bmk_owner" bmk_prep_mlcube_owner = "b...
605ef99023976937e399f981974aac834f841c0511ad0a0efb6b026d1e70fa0a
Python
18,551
553
#!/usr/bin/env python3 """ CICADA smoothing-only downstream reclassification in Python. Purpose ------- Reconstruct CICADA's downstream automatic IC classification from the small, language-neutral CSV outputs written by CICADA_2_AutoLabeling.m: * feature_auto_vals.csv (feature_relative_table) * IC_auto_checker.c...
aa50e0a7e9e9ddf82fc041c74a12608b9b32d63a920ed8bc79c2e8c7b236d5a1
Python
18,554
363
import json import os from collections import defaultdict from src import util from src.exporters.duckdb_exporters import log_duckdb_settings_on_error, setup_duckdb from src.memory import log_memory_snapshot logger = util.get_logger(__name__) def check_for_identically_labeled_cliques( parquet_root, duckdb_filen...
3afb4f1e33cd2f0ab86a03f9076338d889166adc89d28c6c920c2db29d76fb03
Python
18,559
465
""" Central place to store the config info """ import textwrap from collections import OrderedDict import numpy as np # default values default_out_dir_name = 'visualqc' annot_vis_dir_name = 'annot_visualizations' default_mri_name = 'orig.mgz' # brainmask would not help check expansion of surfaces into skull default...
3dd68f9d08072e5915d5580f87e9172ba06a0d4ad673d4481bc44f6d3e2dc7c1
Python
18,564
491
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 29 11:35:15 2022 @author: schwab """ from scipy.spatial import KDTree import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import mrcfile from ..utils.utils_new import field2bild def get_ess_grid(grid, points, box...
8478f286afb237c98341c6332f08b6f186fb38a9d9623f56c674967222fc0573
Python
18,571
567
"""Tests for Edit Lock REST API endpoints and WritableRoomDep enforcement.""" import asyncio import json import pytest from helpers import MockSioServer, auth_header, create_test_room, create_test_user_in_db from httpx import AsyncClient from redis.asyncio import Redis from sqlalchemy.ext.asyncio import AsyncSession ...
2196e2c209398e2e334727752b42a3d69953c66ecb0eaf3f906f0e2634922207
Python
18,592
414
import os import tqdm import torch import numpy as np import argparse import json import cv2 import scipy.io as sio import matplotlib.colors as mcolors import matplotlib.cm as cm from scipy.interpolate import interp1d from skimage import io from nns.model import ISOSNet from utils import fix_random_seeds from tools.vis...
d4af4442469beec9f0f7ba93bf248f9c85033ecd16374d22d03b5514a7da40e8
Python
18,594
512
"""Database access for v7+ integer-encoded databases. v7 databases use integer protein IDs with delta-varint encoded BLOBs. This module provides bulk query methods for high-throughput annotation. """ import array import hashlib import logging import os import sqlite3 import tempfile from typing import Dict, Iterable,...
e3ec0efb308a52e0d51d76c86e2213dae1fa1d3c21d2d3e69c4203b4df8bb6a5
Python
18,610
399
import torch import torch.utils.data import configparser import os from glob import glob import multiprocessing from subprocess import call import soundfile as sf import numpy as np import textgrid from collections import Counter import json from tqdm import tqdm import pandas as pd import torch import...
e41161a7d4dc05c3ea895b281f4a531f55f93985563ec98529dfe1256a3d04c3
Python
18,639
539
# dicom operations import os import os.path as op import logging from collections import OrderedDict import tarfile from .external.pydicom import dcm from .utils import ( get_typed_attr, load_json, save_json, SeqInfo, set_readonly, ) import warnings with warnings.catch_warnings(): warnings.sim...
6d6323b0786334922bd2d5ea7b0d88713f9275fe185b817bdffcd13317ca100c
Python
18,650
310
""" Questions are reproduced from the Qualtrics file https://osf.io/e3wkr """ import pandas as pd import random import numpy as np import re from tqdm import tqdm import sys from unsloth import FastLanguageModel import transformers import argparse def randomized_choice_options(num_choices): choice_options = list(m...
7aa33367127098c1773316d08217ae1dde2b66e84eb8bdc43eda762a23112585
Python
18,659
455
import os import tempfile import numpy as np from . import error, run, Image, Overlay, Volume, Surface, Geometry, collect_output class Freeview: '''A visualization class that wraps a freeview command. After configuring the wrapper, the freeview window can be opened with the show() method. Volumes and su...
8c2424c25216e66b4ce8d3d14a1713737231f05e7ea41815e2bac96fd3cb5bf8
Python
18,734
494
# Standard Library Imports import datetime import os import subprocess from itertools import cycle # Third Party Imports import matplotlib.pyplot as plt import MDAnalysis as md import numpy as np from matplotlib.lines import Line2D from matplotlib.path import Path from matplotlib.widgets import Lasso from scipy.interp...
c681e28a39e7eb475d4e27f63620874b245dc61c4810445ae104690702ea7cb7
Python
18,739
490
import copy import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GCNConv, GATConv, global_mean_pool, global_max_pool, TAGConv from torch_geometric.nn import global_add_pool, SAGPooling, ASAPooling, GATv2Conv from torch_geometric.nn.aggr import Attentiona...
ef6122d9263d42c278b3794f925d6ec35dbd5d7e5b878be5e770890f83506202
Python
18,750
399
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
f39b56ade93398ec71e91e49ba70a829ae14515564244ac0705e15e5c0c93621
Python
18,777
519
import os,re from rdkit import Chem from rdkit.Chem.Draw import IPythonConsole from rdkit.Chem import Draw from rdkit.Chem import rdChemReactions # from DrawSVG import DrawSVG from IPython.display import SVG IPythonConsole.ipython_useSVG = True import pandas as pd from rdkit import Chem from rdkit.Chem.BRICS import F...
7f4eda874409305be55d25e032d27f347a295c3765df0c641f0670383c3525e8
Python
18,778
457
import shutil from pathlib import Path import h5py import pytest from guppy.testing.api import locate_run_folder, step1, step2, step3, step4 from guppy_test_data import STUBBED_TESTING_DATA @pytest.mark.filterwarnings("ignore::UserWarning") def test_mixed_modality(tmp_path): """ Integration test for auto mo...
edb7114d9e74cc9141289991d692bff175fcffdbbde864a93e08450ad7f0a17e
Python
18,788
483
# 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...
43f70d3166c3014a5a444e5d107a824e67710ad33ef829bda1179e01f4043657
Python
18,807
517
""" This module provides classes for training neural network models for various synthetic functions. It includes an abstract base class and specific implementations for different synthetic functions. """ from abc import ABC, abstractmethod from dataclasses import dataclass, field from enum import Enum, auto from pathl...
449aa64c48c12577e3fba696d91ffc69dd389d63bc3bbc5f426f8654458bbe9b
Python
18,831
462
import pytest import numpy as np import random import networkx as nx from pettingzoo.test import parallel_api_test from gymnasium import spaces from CybORG import CybORG from CybORG.Simulator.Scenarios import EnterpriseScenarioGenerator from CybORG.Simulator.Scenarios.EnterpriseScenarioGenerator import SUBNET fro...
e2d12d2d43dcad22dc56b17fbdb8587428705dd8e3478ea4fb98be4946ed9c6d
Python
18,845
473
import os import numpy as np import pandas as pd from paq_utilities import * from utilities import * import matplotlib.pyplot as plt import seaborn as sns import tifffile as tf from datetime import datetime sns.set() sns.set_style('white') params = {'legend.fontsize': 'x-large', 'axes.labelsize': 'x-large', ...
998ec3e6815433ea97cd63ed6bf0b3c14709bedd19c3bf7c10c260dab4320851
Python
18,859
585
# 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. # copied from fairseq/fairseq/data/indexed_dataset.py # Removed IndexedRawTextDataset since it relied on Fairseq dictionary # other slight mo...
1297fcf6fe05c20a37f893f4c602b2140858a97634dab55ea427b09746b5c252
Python
18,863
550
import torch import torch.nn as nn import numpy as np import gym import pickle5 as pickle from ray.rllib.utils.annotations import override from ray.rllib.models.torch.torch_modelv2 import TorchModelV2 from ray.rllib.utils.torch_ops import convert_to_torch_tensor import torch.nn.functional as F from typing import Dict f...
cdee3bc88a647d8a7d800dcc6c5c97ca7c03cf249f63116b3c744a562feb72e6
Python
18,884
463
"""Enables Docker software containers via the {u,}docker or podman runtimes.""" import csv import datetime import json import math import os import shutil import subprocess # nosec import sys import threading from collections.abc import Callable, MutableMapping, MutableSequence from io import StringIO # pylint: disa...
51aaf7bfd3f78574012a5c8e57b09035ff03df34682989241219f5d06427ea60
Python
18,886
473
################################################################## # Calculating ROC curve in TrimNN and CytoCommunity # Reproducibility for Figure.3A ################################################################## #TrimNN method import pandas as pd import numpy as np from scipy.spatial import Delaunay from itertoo...
75eebcccb1053f24f33ff35c8108b3671af0c3816158773a12d6e51d92aad2eb
Python
18,891
488
import json import logging import os import random import tempfile import uuid from collections import namedtuple import numpy as np import pytest import xgboost as xgb from xgboost import testing as tm from xgboost.callback import LearningRateScheduler pytestmark = pytest.mark.skipif(**tm.no_spark()) from typing i...
f00c2e35ccbe1d29d416e2374e5d98faff858dc8f1b40913ffca1ce44251b239
Python
18,913
388
#!/usr/bin/env python """ MeteWIBELE workflow: MeteWIBELE characterization workflow 1) clustering into protein families 2) protein family annotation 3) domain/motif annotation 4) abundance annotation 5) integration Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to an...
fed3c48ad85670557098db91e6d5f1ea9388b13e5360cf9d9808b831104a33f8
Python
18,924
493
import os import numpy as np from rdkit import Chem from rdkit.Chem import AllChem, rdFMCS, rdMolTransforms from openbabel import openbabel as ob from . import printit, config # TODO check this function # Default charge partially from Charmm36 forcefield DEFAULT_PARTIAL_CHARGE = { "H": 0.09, # <Atom name="HB1" ...
ec711347b0a477cefdb154d31ab7f9df3ce531d22fad48200135c9573a9d199c
Python
18,927
438
# coding=utf-8 # This file is derived from the code at # https://github.com/huggingface/transformers/blob/master/transformers/tokenization_bert.py # # Original copyright notice: # # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the ...
7665851370ef9e88479c0949d4254a69a93d3cc6aaa153094c75022569dae183
Python
18,948
562
""" Modified from the original file to train the model for diastereomeric resolutions. Date: 2022-11-23 11:29:36 LastEditors: yuhhong LastEditTime: 2022-12-12 12:57:28 """ import argparse from typing import Literal import numpy as np import pandas as pd import pickle import pathlib from tqdm import tqdm import yaml i...
bc1e2882cc87ac04bcccbd4efa2831c9bc10e8c65d053ec5ffb0f3ca23d05033
Python
18,948
361
# 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...
534edbf803b63fbee84653b0ed2ebd41415b33905e46d7e7ac5d5a28333664e5
Python
18,963
594
import itertools import typing from typing import Any, Dict, List, Optional, Iterator, Tuple, Generator from neo4j import GraphDatabase, Neo4jDriver from neo4j.graph import Node, Relationship from kgx.config import get_logger from kgx.source.source import Source from kgx.utils.kgx_utils import ( generate_uuid, ...
27b583bb8e9a3b8347c57acc87cc68f7f351668b12a3ac66a9631946e3afb6bd
Python
18,965
497
## import sys import os import bz2 import gzip import shutil import errno import struct import tempfile import time from os.path import join as pjoin from os.path import exists as pexists from subprocess import Popen, PIPE, run, CalledProcessError from .utils import colorify from .emapperException import EmapperExcep...
c0226c784c6af717d20465789f4b3a2d279713d252fca5d4b8d1b4cbe961ec1a
Python
18,969
539
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
55a47c4381c72fcafd2e25955ab73b1b4bbdbe980ed9695646937e6c5541523a
Python
18,970
390
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from dataclasses import dataclass from diffusers.configuration_utils import ConfigMixin, register_to_config from diffusers.models.modeling_utils import ModelMixin from diffusers.models.embeddings import GaussianFourierProjection, Time...
0db7131d9a4195cbd2cc4ae51c47f578fd47d382fe60dc44f88fab2154da8de4
Python
18,993
410
# coding=utf-8 # Copyright 2022 IDEA-CCNL The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
1e05372c11b589fc1c2015b162bb46920ca0028b4d372e6bf96c1dbd5b6a0174
Python
19,006
507
#!/usr/bin/env python """ MetaWIBELE: maaslin2_summary module Summary association summary for protein families 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 "Software"), to deal ...
a7f112abaa36a105a857681ff06bda18aa2a696dc3216f4a2fc469b83d5a8cc5
Python
19,018
504
""" Copyright (c) 2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE...
b0cb1ed6baadb63488d2302702da6045e9257e36b7a880f7a1fe16bb953f4e0a
Python
19,034
522
import csv import os import tempfile import warnings import numpy as np import pytest import scipy.sparse from hypothesis import given, settings, strategies from scipy.sparse import csr_matrix, rand import xgboost as xgb from xgboost import testing as tm from xgboost.core import DataSplitMode from xgboost.testing.dat...
b33f97425b754e4834ff330ed624417e6bc591ba26af6329e1980922026dc994
Python
19,039
631
import os import subprocess from os import path import numpy as np def write_xyz(path, coords, atoms): coords = np.asarray(coords).astype(str) atoms = np.asarray(atoms).astype(str) xyz_str = str(len(coords)) + "\n\n" for i in range(len(coords)): xyz_str += atoms[i] + " " + " ".join(coords[i]...
d1879efc9a7d21b3d8e751b56cfbfb50aef2459a194597d02b10043227ce78d2
Python
19,068
485
# coding=utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy import logging import math from os.path import join as pjoin import torch import torch.nn as nn import numpy as np from torch.nn import CrossEntropyLoss, Dropout, Softmax, Linear, ...
177f0b0cc513c6a7d58915b12c92543d01fcd0d91c86bf75fe88c47eb7e21cc0
Python
19,069
442
import os,torch,json import datetime, warnings import tensorboardX import numpy as np import torch.nn as nn from utils.config import opt from TSAN.utils.discretize_age import discretize_age from prediction_second_stage import test from model import ScaleDense,Second_stage_ScaleDense from model.ranking_loss imp...
db7285d2a57e3d9056a23d149c0f68f9c162c221381fadf020cf6dbf00fc5031
Python
19,098
504
import threading import time from importlib.metadata import version import panel as pn import pytest from guppy.orchestration.home import build_homepage from guppy.utils import progress def poll_until_stopped(capture_periodic, timeout=3.0): """Drive the poll callback the way the IOLoop would, until it reports t...
66676a2eced7fd1ca6bcb0db1df77466db41c4d4caeda8dd99212986996c935c
Python
19,102
554
""" Parse adapter specifications """ import re import logging from pathlib import Path from typing import Optional, Any from collections.abc import Iterable from xopen import xopen from dnaio.readers import FastaReader from .adapters import ( Adapter, FrontAdapter, NonInternalFrontAdapter, BackAdapter,...
ae1d3e81758b1b2facd1904ad357f26189aa9fa348952728e5b8ec55fc02b4e2
Python
19,105
461
# Copyright (c) OpenMMLab. All rights reserved. from typing import List import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, build_activation_layer, build_norm_layer from mmcv.cnn.bricks.transformer import (FFN, MultiheadAttention, ...
2edce425000fea601398def630160230065a1bebfec46ba60accfddcbd7ba917
Python
19,107
532
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal from TD3.TD3_GNN import GNN_Feature_Extractor from torch_geometric.nn import GCNConv, global_mean_pool, global_add_pool from torch_geometric.nn import global_mean_pool import numpy as np LOG_SIG_MAX = 2 LOG_SIG_MI...
140d823953bc0390cf5f0225d17bb929f46738e3b8444a43c0aa4d003af68e2a
Python
19,144
532
""" Utility functions for manipulating neuprint-python output. """ import re import os import sys import inspect import functools import warnings from textwrap import dedent from collections.abc import Iterable, Iterator, Collection import numpy as np import pandas as pd from requests import Session import ujson cla...
ce2cf32bde4fbe36e3c92668e2536d7d4d9ff3c72ed871c835f6c778398b5406
Python
19,146
428
# 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...
07923a6dc0bb0f574456281758e19a390691c0c16ed6393b14988d7d5da85729
Python
19,189
551
#!/usr/bin/env python """ MetaWIBELE: mspminer_protein_family module Summary MSP annotation for each protein family 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 "Software"), to ...
170b991ff618f3292d580ab533d03f273595c684b5509afc25b97e41ccfe657d
Python
19,208
374
# -*- coding: utf-8 -*- """ Created on Mon May 6 22:24:37 2024 @author: guill """ import numpy as np import external_functions as ef from matplotlib import pyplot as plt from Network_Class_Small import SpikingNetwork, WeightMatrix from tqdm import tqdm from scipy.io import savemat, loadmat from Parameters_Small im...
587adc3f92fbfbb423784ba908b6cc304d781b9527c36628608db50db7a156dc
Python
19,235
387
"""Report on '' occurrences in NCBIGene gene_info.gz that could be *genuine* name components (e.g. double-prime nomenclature) rather than issue-#744 pipe-split artifacts. Classification of a '' occurrence: - **open-marker artifact**: a pipe-fragment that STARTS with '' (e.g. ``''cytochrome P450``) -- the opening of...
7aa2f74dcb0131f1304558688f74005f9be41963e30ad933d3fa0281a1003165
Python
19,242
581
""" Steps of the read output pipeline After all read modifications have been done, a read is written to at most one output file. For this, a pipeline represented as a list of "steps" (SingleEndSteps or PairedEndSteps) is used. Each pipeline step can consume (discard) a read or pass it on to the next step. Steps are a...
bf5568a246ebf9b4b1ef259b4013c22bfe62ca3f1f477e5198ec68a26608804e
Python
19,249
575
from rest_framework import status from medperf.tests import MedPerfTest from parameterized import parameterized, parameterized_class class ModelTest(MedPerfTest): def generic_setup(self): # setup users model_owner = "model_owner" bmk_owner = "bmk_owner" bmk_prep_mlcube_owner = "b...
35797b5f6d37ff8b0eb119bacad7012652f85b4546d780c8041a7c0ee56bc425
Python
19,252
474
import matplotlib.pyplot as plt import numpy as np import torch import torch.nn.functional as F import scipy.ndimage as ndimage class T2StarFit: """ Computes the T2star maps with least_squares_fit. Parameters ---------- dim : int, optional The number of dimensions of the input image. Default ...
a84da164a7d912dd8ef9a44e6a19a5ab64d3ac720372e60e25d121341c9e1a17
Python
19,265
549
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import pickle as pkl import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import pickle as pkl pd.options.display.float_format = '{:,.2f}'.format pd.options.display.width = 0 import sys from datetime import date import joblib...
3437df38de0855d1d0742968722c458f7393858bfde70f6605d83cc2da5ec633
Python
19,295
609
"""Run simple cell optimisation""" """ 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 ...
c8d64e53da5728e5bc5cae3a22513bd6387155e210521c77b417f76573fc887e
Python
19,307
473
''' Ingredient for building the VGAE model, which learns a latent representation of the neuroimaging features. License: BSD 3-Clause Author: Hanna M. Tolle ''' import sys sys.path.append('../../') from sacred import Ingredient from .data_ingredient import data_ingredient import torch from torch_geometric.loader imp...
32b2b1ea47296c09c467bd68451be6e83971b6361496c1a41fc51f923d1052cb
Python
19,330
442
import torch import yaml import argparse import numpy as np import gc import matplotlib.pyplot as plt from scipy.ndimage import binary_fill_holes from dl_utils.config_utils import set_seed from data.t2star_loader import * from projects.moco_t2star.utils import * from mr_utils.parameter_fitting import T2StarFit, CalcSus...
0114485f07db506e335311e5561041b5842c19e013095ceb5dd5cf953c342cab
Python
19,335
458
# Thomas Lavigne # 18-09-2024 # #------------------------------------------------------------# # Libraries # #------------------------------------------------------------# # try: from porous_fenicsx import constitutive_laws, variational_forms, functions except: print("Please run first `python3 -m p...