sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2a409b0387b83eece7d35c7f7e236df1076e1e61edf065d116040daaee03b09e | Python | 9,313 | 230 | """
======================================
Getting started programming with pyAFQ
======================================
There are two ways to :doc:`use pyAFQ </howto/getting_started>`: through the
command line interface, and by writing Python code. This tutorial will walk you
through the basics of the latter, using p... |
7da37147a83c1377c7daf79f66ec6673eeeaffe7c19d6d45826ef19821b066d1 | Python | 9,313 | 245 | ## This scripts combines raw SMOS TB and SMAP SM data, reads raw data, calculates 3-day mean per location, and overlaps SMAP SM and SMOS TB by location and date.
# The INPUTS are:
# 1. SMAP "raw" data
# To run this script, there must be SMAP SM data downloaded as .tif files, and regridded to 25 km EASE-2 grid
# To do... |
9863010631a5364853a253526d11484ec5abd22d449348359c11bf4f1632a177 | Python | 9,313 | 220 | import logging
from abc import ABC
from dataclasses import dataclass
from typing import Iterable, Iterator, List, Optional
from typing_extensions import ClassVar
from oaklib.datamodels.association import Association
from oaklib.datamodels.class_enrichment import ClassEnrichmentResult
from oaklib.datamodels.item_list ... |
de40769707b924cda4e21aa5b426541503fe8eedceaed32faa7a3fc7b283b578 | Python | 9,313 | 366 | #%% [markdown]
# # Visualize the connectome
#%%
import datetime
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.patheffects import Normal, Stroke
from pkg.data import load_network_palette, load_unmatched
from pkg.io import get_environment_varia... |
52a6d4caa07768d8a37d3513167ab88526394baacda7327131b6e5f3d5bc7036 | Python | 9,316 | 229 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
3cb1abc85f80cfb579197d6005831701fd0a0069ee226b6fb94b2416d23634c7 | Python | 9,322 | 238 | import torch
import torch_geometric
from torch import Tensor
import torch.nn.functional as F
from typing import Callable, Optional, Tuple, Union
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.nn.norm import LayerNorm
from torch_geometric.nn.dense.linear import Linear
from torch_geometric.nn.ini... |
f5a78e6744f1f934b28ebfa45399d459966c562d7c1e95f6e1a2d4758066b01f | Python | 9,322 | 212 | from __future__ import absolute_import
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
# ---------------... |
a59934097150d7fe6e730020c3a1ec65e08459e76ee4167c7a1fd510d9aedfc2 | Python | 9,327 | 262 | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class FastSal(nn.Module):
def __init__(self, classes=2, aux=False, pretrained='ShuffleNetV2_pretrain.pth'):
super(FastSal, self).__init__()
self.context_path = ShuffleNetV2(pretrained)
if... |
f60838a1304a792fbb2747de457b1174a29c9d0e1aa8c2292ae001482567fded | Python | 9,328 | 342 | #%%
import datetime
import time
from pathlib import Path
import graph_tool as gt
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from giskard.plot import crosstabplot, dissimilarity_clustermap
from giskard.utils import get_paired_inds
from graph_tool.collection import data
... |
4f4caaf9b3af51094f2c3d2ae505ab0a3656c65c38e0ceecdfd64aed72dbef75 | Python | 9,329 | 264 | """
This module provides the EvaluateModel class.
"""
import logging
import math
import os
import warnings
import numpy as np
import torch
import torch.nn as nn
from selene_sdk.sequences import Genome
from selene_sdk.utils import (
PerformanceMetrics,
initialize_logger,
load_model_from_state_dict,
)
from s... |
e05b6d8024d693df98fe905636cee20f8c69292ed40e47248706a0f5c885c096 | Python | 9,340 | 327 | import numpy as np
from cgtasknet.tasks.reduce.go import (
GoDlTask,
GoDlTask1,
GoDlTask2,
GoDlTaskParameters,
GoDlTaskRandomMod,
GoDlTaskRandomModParameters,
GoRtTask,
GoRtTask1,
GoRtTask2,
GoRtTaskParameters,
GoRtTaskRandomMod,
GoRtTaskRandomModParameters,
GoTask,
... |
e82540f0d8bde6b5fce4129577b974770cbcd54f889b32e2621f58214d92d97f | Python | 9,341 | 273 | import math
import copy
import numpy as np
import torch
import torch.nn.functional as F
from torch_geometric.nn import MessagePassing
from torch_sparse import SparseTensor, matmul
from typing import Union, Tuple
from torch import Tensor
from torch_geometric.typing import OptPairTensor, Adj, Size
from graphxai.gnn_m... |
5cdb1fac0008562a21594518eee103100ea7f7f146a95d3716b87755d5f80e6e | Python | 9,344 | 289 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 22 20:49:36 2022
@author: th
"""
import numpy as np
# import ray
import random
from sklearn.linear_model import LinearRegression
from sklearn.ensemble import RandomForestRegressor
from sklearn.preprocessing import StandardScaler as SS
def bat... |
e7ccef04df3656c688b169530e02132c6a71dc7d572a07f4691a5088f584dff6 | Python | 9,344 | 248 | #%%
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from pymaid_creds import url, name, password, token
from data_settings import pairs_path
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
from contools import Celltype, Celltype_Analyzer, Promat
impor... |
76104da2bccc6188f83a7a048c87f683919a3608b71f6ce4237110763b5100e6 | Python | 9,351 | 258 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
# --------------------------------------------------------
# Reorganized... |
097bedbf3312acfe7c5ccfaf88813f90549ab88311900b6a7f7aa2618ed3195a | Python | 9,352 | 228 | #!/usr/bin/env python3
"""
File: export_ieqtl_data.py
Created: 2021/02/26
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foun... |
36cff612e20173515bb048985e05c17eedddd9fb0a7534c12e57aa5025276674 | Python | 9,352 | 237 | import os
import gzip
import torch
import shutil
import zipfile
import requests
from PIL import Image
from torchvision import transforms
from torch.utils.data import Dataset
import numpy as np
class EmnistDataset(Dataset):
"""
EMNIST Dataset class.
Constructs training and query sets for meta-traini... |
5b2bf8792d74f401407e678504e1377b07e66a3b49fef72a570ca6202610a3aa | Python | 9,353 | 215 | import os
import argparse
import pickle
import cv2
import numpy as np
import torch.nn as nn
import torch
import torch.nn.functional as F
from PIL import Image
from ruamel.yaml import safe_load
from torchvision.transforms import Grayscale, Normalize, ToTensor
from utils.helpers import dir_exists, remove_files
def data... |
7a6f90588d66454c513b42c35ceaffb88d05aac9ce86d018d6ef1f4fd516e136 | Python | 9,361 | 208 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
f3c06b443f60046592d7770bd37e37c5c6d09deb5e7253c098d5ce2076244d9c | Python | 9,361 | 313 | """# Helper Functions
Provides
1. Parameter Set Initialisation
2. Functional Definition
3. Plotting tools
"""
# SCSCSCSCSC
# CSB Lab | Indian Institute of Science, Bengaluru
# Chinmay K Haritas
# Toggle Triad in 2D with Diffusion
# Helpers Functions
# Import Block
import numpy as np
import pandas as pd
import matpl... |
8218505e8f5c97d06903d2dfd589f7d81720fe28a9ab94851fee4eb66a1f1374 | Python | 9,363 | 164 | import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing
import h5py
from tqdm import tqdm
from functools import partial
import numpy as np
from scipy.spatial.distance import euclidean... |
9465c181f30c818e6f90574f884cb3e28df3ec70a095215d8aaa2184d90860c3 | Python | 9,363 | 288 | # Copyright 2024 Chen Liang
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
7653361b689dc8db1df5f62685d8f85f68d6f707a343086704a500f4a6bf57b5 | Python | 9,364 | 333 | import torch
import torch.nn.functional as F
from neuralop.models import RNO
import pytest
from math import prod
@pytest.mark.parametrize("n_dim", [1, 2, 3])
@pytest.mark.parametrize("fno_block_precision", ["full"])
@pytest.mark.parametrize("stabilizer", [None, "tanh"])
@pytest.mark.parametrize("lifting_channel_ratio... |
c65450fe886a32514266e6a819c2140ac2067af5d35d21bf380a1e399bd71711 | Python | 9,365 | 375 | import numpy as np
import warnings
_,ar,_,_,_=np.random.get_state()
seed=1528155142
np.random.seed(seed)
import tensorflow as tf
tf.random.set_seed(seed)
import torch.nn.functional as fn
import torch
# from keras.callbacks import Callback
from keras.models import Sequential
from keras.layers import Dense, LSTM
from k... |
f8c1875baa54e6b2255d5010a51d8f059d7788ff4b56c484cb1c89ff916b09e7 | Python | 9,366 | 220 | import torch
import torch.nn as nn
def conv3x3(in_channels, out_channels):
return nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1, bias=False)
class UpsamplingNearest2d(nn.Module):
def __init__(self, scale_factor=2):
super().__init__()
self.scale_factor = scale_factor
... |
6f0011b8b54e40309bc16c2acc95373f93b2d95b938ba8fe2ea0c04767e9609a | Python | 9,372 | 213 | import torch
import torch.nn.functional as F
from torch import nn
from collections import OrderedDict
from torch.nn import BatchNorm2d as bn
# densenet201
Model_CFG = {
'bn_size': 4,
'drop_rate': 0,
'growth_rate': 32,
'num_init_features': 64,
'block_config': (6, 12, 48, 32),
'dropout0': 0.1,
... |
a4ee414e88a4e81f74cc3b81d6f2ac8f81954d746471713834e30e1dd2cfefc4 | Python | 9,374 | 188 | import ship_pairing_analysis
import collections
import pandas as pd
import inspect
import re
import os
import numpy as np
import itertools
import tqdm
import AIS_interp
import functions_basic_sak as funsak
from sklearn.cluster import DBSCAN
from scipy.interpolate import interp1d
import AIS_infer_mmsi
... |
03633b6f27370ea256110d12f95abefb32110059ae689d5263ea2ee2f37a9691 | Python | 9,376 | 235 | import numpy as np
import torch, torchvision
class TrainingTask(torch.nn.Module):
def __init__(self, basemodule, epochs=10, lr=0.001, optim='AdamW', callback=None):
super().__init__()
self.basemodule = basemodule
self.epochs = epochs
self.lr = lr
... |
9b3c4fb217c862fcccc91c2d88a01fee5b19ccd3c3e190b62538c7b8a09bc589 | Python | 9,376 | 226 | from scipy.stats import nchypergeom_fisher
import numpy as np
def fisher_exact_nonunity(table, alternative="two-sided", null_ratio=1):
"""Perform a Fisher exact test on a 2x2 contingency table.
Parameters
----------
table : array_like of ints
A 2x2 contingency table. Elements must be non-nega... |
e2dafd029b7957ade249bf16755ef3305d17ff4e04baca5d6a2b207057711269 | Python | 9,378 | 258 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
26e52f7004f606bd6c11acdd5dd90efb5052ed1c54b32627ce308af06fd44464 | Python | 9,384 | 240 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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 a... |
13bb6d4d085a3c83ea0912b6fd32abba2e18b1055e064655e3b044a2b1892d86 | Python | 9,385 | 260 | from typing import Tuple
import scipy as sp
from .coupling import PhaseStyle
from .rectangular import rectangular
from .vector import vector_unit
from scipy.stats import unitary_group
import numpy as np
from scipy.linalg import svd, qr, block_diag
from .coupling import CouplingNode
from .forward import ForwardMesh
... |
ecb60e3aa357a61fc2d9d69ce7f979f8fb409b4a0e0083128e36317802075dfc | Python | 9,388 | 262 | """Downloads and caches the data files used by osl-dynamics.
The parcellations, masks, surfaces, scanner layouts and scenes are not shipped
with the package. They live in `osl-files
<https://github.com/OHBA-analysis/osl-files>`_ and are downloaded the first
time they are needed, then cached locally.
The cache lives i... |
9f5038a4963ff973f8d2aa3ce29e8aaecc3808d5338b2045d65834e22a877cb2 | Python | 9,391 | 244 | import torch
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
from torch.nn import functional as F
__all__ = ['ResNet', 'resnet50', 'resnet101', 'resnet152']
model_urls = {
'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth',
'resnet101': 'https://download.pyto... |
5d91ae29d83a02455ce5f0117b46e937326be69f3dffc6a774e8106c5b27358f | Python | 9,400 | 171 | import jax.numpy as jnp
import numpy as np
import pytest
from simphox.transform import get_mask_fn, get_smooth_fn, get_symmetry_fn
from simphox.typing import List, Union
from simphox.utils import Box
np.random.seed(0)
TEST_ARRAY = jnp.array([[4., 0., 4., 4., 0.],
[0., 4., 0., 4., 4.],
... |
0ab6f2969e30e63cf545ce2b149b136e389cfca44fe0a57070c027a159408e65 | Python | 9,401 | 250 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module containing useful functions/classes for model manipulation with PyTorch.
Created on Mon Oct 22 13:54:19 2018
@author: nicolas
"""
import os, sys, shutil
import torch
def weights_initialization(model):
"""
Initialize the weights of the given PyTorch ... |
1ab971a2386a87386102fddb93cb3c2b08461b46dbc3ee30debadec9009e393d | Python | 9,406 | 228 | import csv
import logging
from copy import copy
from dataclasses import dataclass, field
from typing import Any, Dict, List, Mapping, Type, Union
from linkml_runtime import CurieNamespace
from linkml_runtime.utils.yamlutils import YAMLRoot
import oaklib.datamodels.summary_statistics_datamodel as summary_stats
from oa... |
e74106fa69cdd07ab6a46addfc501535f77b62c813a51816941bda5e1d9375ec | Python | 9,407 | 336 | import sys
import pandas as pd
import numpy as np
import os
from itertools import groupby
import utils.general_utils as general_utils
import utils.plot_utils as plot_utils
import utils.plot_setting as plot_setting
import utils.math_utils as math_utils
import utils.sync_utils as sync_utils
import utils.list_twoP_exp a... |
47698b759d62de899dbc75b7d7b19a7102d465f029c34a4b16b26b790c0b96d6 | Python | 9,413 | 293 | import inspect
import logging
import os
import pickle
from abc import ABC, abstractmethod
from typing import Optional, Sequence
import numpy as np
import rich
import torch
from anndata import AnnData
from rich.text import Text
from scvi import _CONSTANTS, settings
from scvi.data import get_from_registry, transfer_ann... |
22399883a3f57fa2605bf3a194cc54160a3fbd33a32a6d0392bdebb6a4352011 | Python | 9,418 | 230 | import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
from matplotlib.widgets import SpanSelector
from scipy.optimize import curve_fit
import feather
from scipy.signal import butter, lfilter, freqz
def butter_lowpass(cutoff, fs, order=5):
nyq = 0.5 * fs
normal_cutoff = cutoff / nyq
... |
e9db793d57bb67304668be5f37cde3ec3632f0dff21a9f0f6826f1da1d7e86b7 | Python | 9,418 | 228 | #%%
import sys
sys.path.append('/Users/mwinding/repos/maggot_models')
from pymaid_creds import url, name, password, token
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
import numpy as np
import pandas as pd
import n... |
d44cd6989bda072735bcfd7c239a09a18677e1a9ca13e6adb34bfed8e1cd3cca | Python | 9,420 | 286 | """
Training an FNO with incremental meta-learning
===============================================
A demo of the Incremental FNO meta-learning algorithm on our small Darcy-Flow dataset.
This tutorial demonstrates incremental meta-learning for neural operators, which allows
the model to gradually increase its complexit... |
306f306ba5b1263a19c7b69789d76ab7126e8128400d67875b207b9c8af504c2 | Python | 9,421 | 348 | """Active electrode compensation and quality control.
Ingest raw recordings in the form of ABF files, apply AEC, and sort cells into
`good` and `bad` according to intrinsic reliability and amount of firing rate
drift.
Requires an options JSON file with the following fields:
- AEC_col (str) index column to use for lo... |
917df5a8622ec5a7e270f79a630891beb84890c418ef4f36b0999ffaabab957f | Python | 9,421 | 211 | ####################################################################################################
# Copyright (c) 2019 - 2023, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis>
#
# This program is free ... |
f9df9d098037fb58a00674138d3e21ecd2446ff5070b679d42f2031746d2c172 | Python | 9,421 | 249 | import torch
import torch.nn.functional as F
import torch.nn as nn
import os
class BaseModule(nn.Module):
def __init__(self, n_ent, n_rel, args):
super(BaseModule, self).__init__()
self.lamb = args.lamb
self.p = args.p
self.margin = args.margin
self.temp = args.temp... |
9937df3119b17e3fc1c7562545653b186179d2a214f8d0b6e832ccfd4fe02c29 | Python | 9,423 | 256 | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: http://kazuto1011.github.io
# Created: 2018-03-26
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-... |
9a6baa2d69830bd01180f16f7ead19b83dc502d426a9bea5fc542505a3c4df6f | Python | 9,423 | 200 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
a88edb3f0dcad37aca1837ae04d6502ddc6ea970431f88a2270730799cf94781 | Python | 9,424 | 195 | from .util.utils import *
import tensorlayer as tl
import tensorflow as tf
__all__ = ['UNet_A',
'UNet_B',
]
def upscale(layer, out_channels, out_size=None, scale=None, mode='upconv', name='upsale'):
# if (out_size is None) and (scale is None):
# raise ValueError("At least one of out_size a... |
fd26b4eb80a950942681f466186b0943473875ea341762ce5646974cb6fe26ed | Python | 9,425 | 194 | # -*- coding: utf-8 -*-
"""Preview
Code for 'Inf-Net: Automatic COVID-19 Lung Infection Segmentation from CT Scans'
submit to Transactions on Medical Imaging, 2020.
1st Version: Created on 2020-05-13 (@author: Ge-Peng Ji)
2nd Version: Fix some bugs caused by THOP on 2020-06-10 (@author: Ge-Peng Ji)
"""
import torch
... |
c471c9c87dae74fd0cebab58d456023f3ad11008b95db10a24fff7b24657052f | Python | 9,428 | 266 | # Copyright (c) # Copyright (c) 2018-2020 CVC.
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
""" This module contains PID controllers to perform lateral and longitudinal control. """
from collections import deque
import math
import numpy as np
i... |
75bac75dcfc49cfd4111e92b7fd1a163091b739177d8e2b780cf257b08beef18 | Python | 9,435 | 192 | from tensorflow.python.keras.optimizers import Optimizer
from tensorflow.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2
from tensorflow.python import ops, math_ops, state_ops, control_flow_ops
from tensorflow.python.keras import backend as K
from tensorflow.python.keras import backend_config
import tensorflo... |
a95ea6ff8960cd93145018982c618f6a842a40a259bc554218382e4f80606866 | Python | 9,440 | 229 | import os
from os.path import join
import numpy as np
import pandas as pd
from collections import OrderedDict
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selectio... |
3f2ac1d68122f651a2839f5d5ee1f241d9ed74441c450cd212907883b7ba0e1b | Python | 9,442 | 260 | import numpy as np
import os
import pandas as pd
import torch
import torch.sparse as sparse
from utils.SGCN.common import names, utils
CORRECT_MODEL_FILES_SET = {
names.MODEL_FILE_NAME,
names.X_RES_FILE_NAME,
names.ADJ_RES_NAME,
names.SH_NAME
}
def get_dataloader_description(
datasets,
... |
657b422a3204636cdf5bbb517c8b3500834debca6ef6c182f7a121e74e04d215 | Python | 9,451 | 208 | # SPDX-FileCopyrightText: © 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: MIT
"""
Blueprint Library Module
This module provides functionality for managing CARLA vehicle and pedestrian blueprints,
including finding the best-fit blueprint based on dimensions and handling coordi... |
7223aaace0191d9fe709bb5bcbf7b48976bb0906112dfcdee459c3902ceff858 | Python | 9,451 | 312 | # Copyright 2021 Google Research. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
2810b8bf4e6077a3a73d5d7e8de26a8246555a174056c014e86179176088ffbb | Python | 9,456 | 328 | # %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.patches import Circle
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from sci... |
201a1c9e7740955d668d3656f8eb88fe43cba6e7f238c95deb6239a52089647a | Python | 9,458 | 271 | import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from typing import List, Tuple, Union
""" Based on implementation of spatial transformer networks:
https://github.com/daviddao/spatial-transformer-tensorflow/blob/master/spatial_transformer.py
"""
#----------------------------------------... |
bb01ba20ff8eb709ab4dd135277c2cd092e0305ea5c853cd86c2697bb6009b80 | Python | 9,458 | 238 | #!/usr/bin/env python
from IPython.core.debugger import set_trace
#from transformation_training_data.second_stage_transformation_training_helper import *
from second_stage_transformation_training_helper import *
# coding: utf-8
import sys
from open3d import *
#import ipdb
import numpy as np
import os
from Bio.PDB imp... |
e194ee7ce7d392764e77cb2ab2a784468209d8661b8af8dafdefa33b285f653c | Python | 9,460 | 216 | # Loss functions
import torch
import torch.nn as nn
from utils.general import bbox_iou
from utils.torch_utils import is_parallel
def smooth_BCE(eps=0.1): # https://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441
# return positive, negative label smoothing BCE targets
return 1.0 - 0.5 * eps,... |
4877194fc574b4f047ac05041d824327f7f076af25cb9ddd0d3fb419942c2107 | Python | 9,462 | 328 | # %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.patches import Circle
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from sci... |
07c34dfd6bc92460e67a659c74a24ed081500cd5b3582bc99d895f38b89676e2 | Python | 9,468 | 301 | #%%
import ast
import datetime
import time
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from giskard.plot import crosstabplot
from giskard.utils import get_paired_inds
from graspologic.cluster import DivisiveCluster
from graspologic.cluster.autog... |
8c9767b36eca7bb96278bcf5ca18392262adf5f2ce0c3a80a18e402f17c95b93 | Python | 9,474 | 188 | ##########################################################
## ccAF: Whitfield_classification_ACTINN_analysis.py ##
## ______ ______ __ __ ##
## /\ __ \ /\ ___\ /\ \/\ \ ##
## \ \ __ \ \ \___ \ \ \ \_\ \ ##
## \ \_\ \_\ \/\_____\ ... |
32cd37eca54db4fdc2104c5ed82af0b1d874805b049b0214b434a7fc9d16847f | Python | 9,475 | 224 | import json, time, random, datetime
import os, sys, glob, csv, re, argparse
import numpy as np
import networkx as nx
from collections import defaultdict
from scipy.sparse import csr_matrix, lil_matrix, save_npz, load_npz
from collections import defaultdict
import nltk
# nltk.download('punkt')
from nltk.corpus import s... |
b860666178c6ca2279b2c9a5d04259a79e8c776350a455aa2bd20e927ef1de2a | Python | 9,475 | 269 | #!/usr/bin/env python3
"""
File: compare_deconvolution_matrices.py
Created: 2020/09/03
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free... |
f7f0fae0e753a139c9ae5577733ddbe21d4747c4e586508fe7b9b72778c00d50 | Python | 9,479 | 236 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
d9c5a4dbdea3358d22daead0a2a92b865021882b4c2a27a26eb50dad53f24ec0 | Python | 9,481 | 235 | """
Only the recent torchvision package has gaussian blur.
So I copy the functions here
"""
import torch
from torch import Tensor
from torchvision.transforms.functional import to_pil_image, to_tensor
from torch.nn.functional import conv2d, pad as torch_pad
from typing import Any, List, Sequence, Optional
import numb... |
f92132867f858d31df5bf0f100e6470c5ec9e7e805f498b7c48580bfc5e35135 | Python | 9,485 | 187 | __author__ = 'duarte'
from modules.parameters import ParameterSet, ParameterSpace, extract_nestvalid_dict
from modules.input_architect import EncodingLayer, StimulusSet, InputSignalSet
from modules.net_architect import Network
from modules.io import set_storage_locations
from modules.signals import iterate_obj_list, em... |
3625c1a4fd4d017d071179938e6d720ceb8305cfe3b78d46eeb599ec4b4561c5 | Python | 9,486 | 335 | # -*- coding: utf-8 -*-
import warnings
from numba import njit
import numpy as np
@njit
def simu_logistic_2v(b_xy, b_yx, a_x=3.7, a_y=3.7, n_iter=300, x0=.2, y0=.4, noise=.0, seed=None):
"""
perform the simulation of 2-variable logistic system.
Parameters
----------
b_xy: float
coupling ... |
e3466b61880ea9134f29707b1a9b23703f807bf0171ff43939e9294f0fb71234 | Python | 9,487 | 221 | """Phase 3g: robustness analysis.
Three deliverables:
1. Multi-seed variance bands on the headline LI plot (20 seeds).
2. Lambda sensitivity sweep — how LI effect scales with the precision-
weighting strength `lambda_precision` in the Dual-DAN model.
3. Eta tuning for Dual-Valence to match Mancini's quantit... |
1d3ae40702a3c327f961f682350a6c71c4d4bd6c7812bf71d6601804a3a720c7 | Python | 9,489 | 258 | """
This module provides the `MatFileSampler` class and its supporting
methods.
"""
import h5py
import numpy as np
import scipy.io
from selene_sdk.samplers.samples_batch import SamplesBatch
from .file_sampler import FileSampler
def _load_mat_file(filepath, sequence_key, targets_key=None):
"""
Loads data from... |
2505e6d789518d0b2f36a0d0e2cda212b2530e70b5b671cceb84b4e3d54aa80c | Python | 9,490 | 259 | import matplotlib.pyplot as plt
import numpy as np
from pre_processing import *
from algorithms import *
from spectrum_gen import *
from data_gen import *
from datasets import *
import copy
from scipy import stats
from sklearn.metrics import f1_score
import scanpy as sc
from scipy.signal import savgol_filt... |
6c05746a04ed2bb0f1a915a30d941ed4626fb367ed0a366bcc84906fa0c6a3b6 | Python | 9,492 | 238 | # System imports
import argparse
import h5py
from pathlib import Path
from archngv import NGVCircuit
import pandas as pd
####################################################################################################
# CONSTANTS
#####################################################################################... |
b3bd3b83a3433cecfe3d196b2242ee85268ce6569faf414490cbbbb0409b35ae | Python | 9,494 | 254 | #!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, 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
#
# Unless required by a... |
119e4134135febf07ecdb2060f8f7cf73ea5b619403e9bbcdb02fbbd9eafb2bd | Python | 9,495 | 292 | '''
Train an ANN model based on protein sequence lengths.
'''
# libraries
import pandas as pd
import numpy as np
from sklearn import preprocessing
import biovec
import math
import pickle
import tensorflow as tf
from tensorflow.keras.models import Model, load_model
from tensorflow.keras import optimizers, regularizer... |
6c0809f2ebb5f7570436ca98196aa8d6ae066be04900c98946af33777f16518e | Python | 9,496 | 317 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
3e6484d4dc530ca1a59135d785c5d6aa55de3819234b413f48a5fec639dc3781 | Python | 9,502 | 201 | #!/usr/bin/env python3
"""
File: compare_inter_matrices.py
Created: 2020/04/06
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softwar... |
1a32dbb67167d9a25fbb578ee1cc2050768fc49fcc9ad274d0dbe2cad3cc811d | Python | 9,503 | 325 | # %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from joblib import Parallel, delayed
from matplotlib.patches import Circle
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.mplot3d.a... |
55595f95f24d64367642214ab893603a7406ba9a95f8cdb2e67a074a7fa4e105 | Python | 9,514 | 227 | import os
from os.path import join
import numpy as np
import pandas as pd
from collections import OrderedDict
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selectio... |
74ea4b884a720a9b5cce3ff17d115b000e7c36612c7a2d8780d7f00f33823b19 | Python | 9,519 | 246 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 17 16:28:13 2021
@author: Fuyuki Asano
"""
import glob
import numpy as np
import pandas as pd
import sympy
import csv
import matplotlib.pyplot as plt
import sys
import os
import matplotlib.ticker as ticker
from mpl_toolkits.axes_grid1 import make_axes_l... |
5f84f1f9bc8a4de84abe8eef4bfb111716eb00226cca5d332e2cc5452b64e99c | Python | 9,522 | 243 | import json
import os
from enum import Enum
class CommonSectionNames(Enum):
"""
Notice - these string values should match the strings in the sections_info files (created by prepare_data_for_hmm)
"""
INTRO = "Introduction"
RELATED = "Related Work"
ACK = "Acknowledgments"
class ArticleDataSamp... |
b5a9e65c4f58816d1b4de0f83083d2de722af96263d72850f13a0f52097b0083 | Python | 9,522 | 166 | """Generate ``server/artifacts.lock`` from Hugging Face metadata (no downloads).
Every model artifact baked into the image is pinned here: repo, commit
revision, the files that are actually read at runtime, their sizes and (for
LFS files) sha256. Revisions for the Transfer 2.5 checkpoints are the ones
hard-coded in c... |
d16647e44eb5c6dc3867949608a89cdeaedd4257cb20f3ead28acf983bfd2652 | Python | 9,524 | 298 | import peewee
from peewee import *
from peewee import PrimaryKeyField, ForeignKeyField, DateTimeField, TextField, CharField, IntegerField, FloatField, BooleanField
db_proxy = peewee.Proxy()
class BaseModel(peewee.Model):
class Meta:
database = db_proxy
only_save_dirty = True
class Model_Types(B... |
8b6a7b7b7181a974f57fd64e24fd443385e1fac8112868c47fa62facd2be13aa | Python | 9,525 | 231 | #!/usr/bin/env python
# coding: utf-8
import json
import csv
import PredysUtil8ans as pu
import numpy as np
import os
from sklearn.svm import SVC
from sklearn.svm import LinearSVC
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import accuracy_score
imp... |
cc8e30f641e04e12360aeaaaf0433e020393bf5c34f95beb7c6e530244115e03 | Python | 9,529 | 269 | import preprocess as ppc
import epoch as epo
import cleaning as cln
import evoked as erp
import stats as st
import mne
import sys
import datetime
import os
import fnmatch
from datetime import datetime
import logging
########### Setup for logging ################
protocol = 'WORDS'
if protocol == 'WO... |
fd454d2aee4b65244d3d48d7c27ef96e7103e863e004de95c0024ffe507dc470 | Python | 9,529 | 282 | # Header variables and parameters.
import pymesh
import sys
import os
import time
import numpy as np
from IPython.core.debugger import set_trace
from sklearn import metrics
import importlib
from default_config.masif_opts import masif_opts
# Apply mask to input_feat
def mask_input_feat(input_feat, mask):
mymask = n... |
a059ead00560a99e199f58ed65ab2ac927895442129a9ea54b84f4f0a64c0d46 | Python | 9,530 | 234 | # Copyright 2020 Google Research. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
db38b04599248db650a435d07e91f2f9d660b241e7b420d6fb7a42f2c28fd4fb | Python | 9,531 | 186 | import os
import pickle
import shutil
import torch
import argparse
import numpy as np
from biopandas.pdb import PandasPdb
from data.loader import expand_sh
from data.process_label import parse_pdbfile
from feature import create_basic_features, get_base2d_feature
from data.process_alphafold import process_alphafold_ta... |
752d203f976e115f8cdf21d6bcbaf455089610efc07be018cec27a61d404124d | Python | 9,532 | 278 | ####################################################################################################
# Copyright (c) 2016 - 2022
# Blue Brain Project (BBP) / Ecole Polytechnique Federale de Lausanne (EPFL)
#
# Author(s)
# Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# For complete list of authors, please see AUTHO... |
9800b44677d746f8c56ede1b6dac34dd4b920e6a6c22db2a0441ed383a56f64f | Python | 9,532 | 317 | """Utilities for phys2bids package."""
import json
import logging
import os
import sys
from csv import writer
from pathlib import Path
LGR = logging.getLogger(__name__)
SUPPORTED_FTYPES = ("acq", "txt", "mat", "gep")
def check_input_ext(filename, ext):
"""
Check that the given file has the given extension.... |
e93a1f4c916a6934cb0aabc2fdb4459a54de6807f67648bb440e591f4e3cda77 | Python | 9,534 | 299 | """Classes and functions to make topoplots."""
from typing import List, Optional, Union
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy.interpolate import griddata
from osl_dynamics.files import scanner
def ... |
a7c74edcda778e5d44cd73ee9a06c8244cc69d96ba6686f6588f3bde2bfcb32d | Python | 9,540 | 267 | # coding=utf-8
# Copyright 2020 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... |
dcaaa1487d458c37d7631e14ecc4731ed78b2a92370dae29395eb2b0bbd53b57 | Python | 9,547 | 273 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
232574e44dc4b525714f1e7f18c883c6fcfae9e5d01aeefcd6968074e901731e | Python | 9,559 | 241 | import sys
import os
import torch
import random
import numpy as np
from tqdm import tqdm
from torch.autograd import Variable
from torch.nn.parameter import Parameter
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import math
import pdb
from DGCNN_embedding import DGCNN
from mlp_dropou... |
9714b06eaf4dc63078c09b4736dbd21ec4b09e58840bb9a41b08411bbf4c5ade | Python | 9,560 | 289 | '''
@author: Mahbub Ul Alam (mahbub@dsv.su.se)
@version: 1.0+
@copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se)
@license : MIT License
'''
import numpy as np
from torch.utils.data import WeightedRandomSampler, DataLoader, TensorDataset
import pandas as pd
import torch
def load_train_data(time_win... |
1284abd82c7fbf327f08f9123ab9416e4a81b6e515fc5ff5177dfcc015c43f51 | Python | 9,564 | 233 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
b1cbf58f77240a020e40983a7db42a8013532acd5dfb65c7ff6a6c33ccb1eb04 | Python | 9,569 | 310 | import math
import os
import types
import pytest
from backend import training
from backend.app import App
@pytest.mark.parametrize('key', ['learning_rate', 'lr'])
def test_training_accepts_public_and_legacy_learning_rate_names(key):
options = training.parse_training_options({
'training_type': 'detection... |
3708aaf9529073023500a57992d7faaf162d0dec0f54661b4aa36f798f47481b | Python | 9,574 | 260 | from typing import List, Tuple, Dict
from math import sqrt
import torch
from torch import Tensor
import torch.nn as nn
from torch_geometric.nn import MessagePassing
from torch_geometric.utils import k_hop_subgraph as subgraph
import numpy as np
class GNNPool(nn.Module):
def __init__(self):
super().__ini... |
7c153389af6a6fb4cc954bbb1114991dd0beb9e73ccf5a56c94aed232ff9b67b | Python | 9,575 | 255 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
7f901da89902538bdff0504070a5ab0e82c568f6ae5d36cb407802df623cfc17 | Python | 9,585 | 222 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
6e0b177e73f9e2f544d8a0d4f0a94ac1c4978b58cb97579ba59e19e9ac2b186e | Python | 9,595 | 320 | from __future__ import annotations
from abc import ABC, abstractmethod, abstractproperty
from ast import arg
import logging
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import dask.array as da
import dask.dataframe as dd
from dask import delayed
from dask.diagnostics import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.