repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
cutgeneratingfunctionology | cutgeneratingfunctionology-master/cutgeneratingfunctionology/spam/examples/__init__.py | # module
from __future__ import division, print_function, absolute_import
| 75 | 18 | 64 | py |
cutgeneratingfunctionology | cutgeneratingfunctionology-master/cutgeneratingfunctionology/spam/examples/relu.py | r"""
FM elimination examples: relu and clipped relu using BasicSemialgebraicSet_polyhedral_linear_system
"""
from __future__ import division, print_function, absolute_import
from cutgeneratingfunctionology.spam.basic_semialgebraic_linear_system import BasicSemialgebraicSet_polyhedral_linear_system
import itertools
... | 7,134 | 35.778351 | 124 | py |
cutgeneratingfunctionology | cutgeneratingfunctionology-master/docs/source/conf.py | # -*- coding: utf-8 -*-
#
# documentation build configuration file,
# from sage_sample, which was in turn
# inspired by slabbe configuration file created 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... | 15,484 | 33.564732 | 132 | py |
sam-mmrotate | sam-mmrotate-master/engine.py | import os
import torch
from pathlib import Path
from copy import deepcopy
import matplotlib.pyplot as plt
import numpy as np
import cv2
from mmrotate.structures import RotatedBoxes
from mmdet.models.utils import samplelist_boxtype2tensor
from mmengine.runner import load_checkpoint
from utils import show_box, show_mask... | 5,108 | 33.288591 | 97 | py |
sam-mmrotate | sam-mmrotate-master/utils.py | # Stolen from sam
import numpy as np
import matplotlib.pyplot as plt
def show_mask(mask, ax, random_color=False):
if random_color:
color = np.concatenate([np.random.random(3), np.array([0.6])], axis=0)
else:
color = np.array([30 / 255, 144 / 255, 255 / 255, 0.6])
h, w = mask.shape[-2:]
... | 1,273 | 34.388889 | 78 | py |
sam-mmrotate | sam-mmrotate-master/data.py | import copy
import logging
from functools import partial
from typing import Dict, Optional, Union, List
from mmengine.runner import Runner
from mmengine.evaluator import Evaluator
from mmengine.dataset import worker_init_fn
from mmengine.dist import get_rank
from mmengine.logging import print_log
from mmengine.registr... | 10,157 | 33.317568 | 83 | py |
sam-mmrotate | sam-mmrotate-master/visualizer.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional
import numpy as np
import torch
from torch import Tensor
from mmdet.structures.mask import BitmapMasks, PolygonMasks, bitmap_to_polygon
from mmdet.visualization import DetLocalVisualizer, jitter_color
from mmdet.visualization.palette im... | 6,060 | 39.952703 | 78 | py |
sam-mmrotate | sam-mmrotate-master/main_rdet-sam_dota.py | import torch
from tqdm import tqdm
from mmrotate.utils import register_all_modules
from data import build_data_loader, build_evaluator, build_visualizer
from segment_anything import sam_model_registry, SamPredictor
from mmrotate.registry import MODELS
from mmengine import Config
from mmengine.runner.checkpoint impor... | 2,017 | 30.046154 | 102 | py |
sam-mmrotate | sam-mmrotate-master/main_sam_dota.py | import torch
from tqdm import tqdm
import numpy as np
import cv2
from mmrotate.utils import register_all_modules
from data import build_data_loader, build_evaluator, build_visualizer
from utils import show_box, show_mask
import matplotlib.pyplot as plt
from mmengine.structures import InstanceData
from segment_anything ... | 3,739 | 34.283019 | 94 | py |
sam-mmrotate | sam-mmrotate-master/transforms.py | from mmcv.transforms import BaseTransform
from mmrotate.registry import TRANSFORMS
@TRANSFORMS.register_module()
class AddConvertedGTBox(BaseTransform):
"""Convert boxes in results to a certain box type."""
def __init__(self, box_type_mapping: dict) -> None:
self.box_type_mapping = box_type_mapping
... | 796 | 32.208333 | 65 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/default_runtime.py | default_scope = 'mmrotate'
default_hooks = dict(
timer=dict(type='IterTimerHook'),
logger=dict(type='LoggerHook', interval=50),
param_scheduler=dict(type='ParamSchedulerHook'),
checkpoint=dict(type='CheckpointHook', interval=1),
sampler_seed=dict(type='DistSamplerSeedHook'),
visualization=dict(... | 768 | 29.76 | 76 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/schedules/schedule_6x.py | # training schedule for 1x
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=72, val_interval=1)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
# learning rate
param_scheduler = [
dict(
type='LinearLR',
start_factor=1.0 / 3,
by_epoch=False,
begin=0,
en... | 656 | 22.464286 | 77 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/schedules/schedule_40e.py | # training schedule for 1x
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=40, val_interval=1)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
# learning rate
param_scheduler = [
dict(
type='LinearLR',
start_factor=1.0 / 3,
by_epoch=False,
begin=0,
en... | 660 | 22.607143 | 77 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/schedules/schedule_1x.py | # training schedule for 1x
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=12, val_interval=1)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
# learning rate
param_scheduler = [
dict(
type='LinearLR',
start_factor=1.0 / 3,
by_epoch=False,
begin=0,
en... | 655 | 22.428571 | 77 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/schedules/schedule_3x.py | # training schedule for 1x
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=36, val_interval=1)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
# learning rate
param_scheduler = [
dict(
type='LinearLR',
start_factor=1.0 / 3,
by_epoch=False,
begin=0,
en... | 656 | 22.464286 | 77 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/srsdd.py | # dataset settings
dataset_type = 'mmdet.CocoDataset'
data_root = 'data/srsdd/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(
type='mmdet.LoadAnnotations',
with_bbox=True,
with_mask=True,
poly2mask=False),
dict(... | 2,590 | 29.845238 | 79 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/dior.py | # dataset settings
dataset_type = 'DIORDataset'
data_root = 'data/DIOR/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt_bboxes='... | 2,829 | 34.375 | 73 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/hrsid.py | # dataset settings
dataset_type = 'mmdet.CocoDataset'
data_root = 'data/HRSID_JPG/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(
type='mmdet.LoadAnnotations',
with_bbox=True,
with_mask=True,
poly2mask=False),
d... | 2,591 | 30.228916 | 70 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/dotav15.py | # dataset settings
dataset_type = 'DOTAv15Dataset'
data_root = 'data/split_ss_dota1_5/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=d... | 2,966 | 33.5 | 86 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/rsdd.py | # dataset settings
dataset_type = 'mmdet.CocoDataset'
data_root = 'data/rsdd/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(
type='mmdet.LoadAnnotations',
with_bbox=True,
with_mask=True,
poly2mask=False),
dict(t... | 2,503 | 29.536585 | 68 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/dotav2.py | # dataset settings
dataset_type = 'DOTAv2Dataset'
data_root = 'data/split_ss_dota2_0/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=di... | 2,963 | 33.465116 | 84 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/dota_coco.py | # dataset settings
dataset_type = 'mmdet.CocoDataset'
data_root = 'data/split_ms_dota/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(
type='mmdet.LoadAnnotations',
with_bbox=True,
with_mask=True,
poly2mask=False),
... | 3,470 | 30.554545 | 73 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/dota_ms.py | # dataset settings
dataset_type = 'DOTADataset'
data_root = 'data/split_ms_dota/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt... | 3,036 | 32.373626 | 73 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/hrsc.py | # dataset settings
dataset_type = 'HRSCDataset'
data_root = 'data/hrsc/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt_bboxes='... | 2,346 | 33.514706 | 73 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/dota_qbox.py | # dataset settings
dataset_type = 'DOTADataset'
data_root = 'data/split_ss_dota/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_r... | 2,847 | 32.116279 | 75 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/dota.py | # dataset settings
dataset_type = 'DOTADataset'
data_root = 'data/split_ss_dota/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt... | 2,920 | 32.965116 | 73 | py |
sam-mmrotate | sam-mmrotate-master/configs/_base_/datasets/ssdd.py | # dataset settings
dataset_type = 'mmdet.CocoDataset'
data_root = 'data/ssdd/'
backend_args = None
train_pipeline = [
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(
type='mmdet.LoadAnnotations',
with_bbox=True,
with_mask=True,
poly2mask=False),
dict(t... | 2,505 | 29.560976 | 68 | py |
sam-mmrotate | sam-mmrotate-master/configs/rotated_fcos/rotated-fcos-le90_r50_fpn_1x_dota.py | _base_ = [
'../_base_/datasets/dota.py', '../_base_/schedules/schedule_1x.py',
'../_base_/default_runtime.py'
]
angle_version = 'le90'
# model settings
model = dict(
type='mmdet.FCOS',
data_preprocessor=dict(
type='mmdet.DetDataPreprocessor',
mean=[123.675, 116.28, 103.53],
std=... | 2,054 | 29.220588 | 79 | py |
sam-mmrotate | sam-mmrotate-master/configs/rotated_fcos/rotated-fcos-hbox-le90_r50_fpn_1x_dota.py | _base_ = 'rotated-fcos-le90_r50_fpn_1x_dota.py'
model = dict(
bbox_head=dict(
use_hbbox_loss=True,
scale_angle=True,
angle_coder=dict(type='PseudoAngleCoder'),
loss_angle=dict(_delete_=True, type='mmdet.L1Loss', loss_weight=0.2),
loss_bbox=dict(type='mmdet.IoULoss', loss_wei... | 337 | 29.727273 | 77 | py |
sam-mmrotate | sam-mmrotate-master/configs/rotated_fcos/rotated-fcos-le90_r50_fpn_rr-6x_hrsc.py | _base_ = [
'../_base_/datasets/hrsc.py', '../_base_/schedules/schedule_6x.py',
'../_base_/default_runtime.py'
]
angle_version = 'le90'
# model settings
model = dict(
type='mmdet.FCOS',
data_preprocessor=dict(
type='mmdet.DetDataPreprocessor',
mean=[123.675, 116.28, 103.53],
std=... | 2,648 | 30.915663 | 79 | py |
sam-mmrotate | sam-mmrotate-master/configs/rotated_fcos/rotated-fcos-le90_r50_fpn_kld_1x_dota.py | _base_ = 'rotated-fcos-le90_r50_fpn_1x_dota.py'
model = dict(
bbox_head=dict(
loss_bbox=dict(
_delete_=True,
type='GDLoss_v1',
loss_type='kld',
fun='log1p',
tau=1,
loss_weight=1.0)))
| 268 | 21.416667 | 47 | py |
sam-mmrotate | sam-mmrotate-master/configs/rotated_fcos/rotated-fcos-hbox-le90_r50_fpn_csl-gaussian_1x_dota.py | _base_ = 'rotated-fcos-le90_r50_fpn_1x_dota.py'
angle_version = {{_base_.angle_version}}
# model settings
model = dict(
bbox_head=dict(
use_hbbox_loss=True,
scale_angle=False,
angle_coder=dict(
type='CSLCoder',
angle_version=angle_version,
omega=1,
... | 604 | 24.208333 | 62 | py |
ContinualContrastiveLearning | ContinualContrastiveLearning-main/lincls_eval.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import builtins
import os
import random
import shutil
import time
import warnings
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dis... | 21,472 | 38.54512 | 100 | py |
ContinualContrastiveLearning | ContinualContrastiveLearning-main/train.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import builtins
import math
import os
import random
import shutil
import time
import warnings
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distri... | 24,783 | 40.306667 | 140 | py |
ContinualContrastiveLearning | ContinualContrastiveLearning-main/moco/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
| 71 | 35 | 70 | py |
ContinualContrastiveLearning | ContinualContrastiveLearning-main/moco/builder.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
import torch.nn as nn
import torch.nn.functional as F
class MoCoCCL(nn.Module):
def __init__(self, base_encoder, dim=128, K=65536, extra_sample_K=256, m=0.999, teacher_m=0.996, T=0.07, mlp=False):
super(MoCoCCL, self).__in... | 15,456 | 34.780093 | 120 | py |
ContinualContrastiveLearning | ContinualContrastiveLearning-main/moco/loader.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from PIL import ImageFilter
import random
import argparse
import os
import shutil
import time
import numpy as np
import torch
import torchvision.datasets as datasets
class ImageFolder_with_id(datasets.ImageFolder):
def __getitem__(self, index)... | 2,561 | 27.153846 | 81 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig5/fig5.py | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
# load REBOUND data
data = np.loadtxt('tides_on/1Mearth/output/m.txt') # return (N, 2) array
ts = data[:, 0]/1e6 # return only 1st col
mass = data[:, 1] # return onl... | 2,557 | 42.355932 | 76 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig5/tides_on/10Mearth/survey.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
init_as = np.arange(0.4, 1.51, 0.1) # in AU
max_mems = np.zeros(init_as.si... | 4,732 | 35.976563 | 81 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig5/tides_on/100Mearth/survey.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
init_as = np.arange(0.4, 1.51, 0.1) # in AU
max_mems = np.zeros(init_as.si... | 4,733 | 35.984375 | 81 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig5/tides_on/1Mearth/survey.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
init_as = np.arange(0.4, 1.51, 0.1) # in AU
max_mems = np.zeros(init_as.size... | 4,718 | 35.867188 | 81 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig5/tides_off/10Mearth/survey.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
init_as = np.arange(0.4, 1.51, 0.1) # in AU
max_mems = np.zeros(init_as.si... | 4,759 | 36.1875 | 83 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig5/tides_off/100Mearth/survey.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
init_as = np.arange(0.4, 1.51, 0.1) # in AU
max_mems = np.zeros(init_as.si... | 4,760 | 36.195313 | 83 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig5/tides_off/1Mearth/survey.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
init_as = np.arange(0.4, 1.51, 0.1) # in AU
max_mems = np.zeros(init_as.si... | 4,758 | 36.179688 | 83 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/fig4.py | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
# load memory output data
data = np.loadtxt('engulftimes.txt') # return (N, 2) array
interval = data[:, 0] # return only 1st col
engulftimes = data[:, 1]/1e6 # return only 2nd col
data = np.loadtxt('eng_runtim... | 2,711 | 37.742857 | 73 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/expansion/1e2/expand.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e2]).astype(int)
finalas = np.zero... | 4,548 | 34.818898 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/expansion/1e6/expand.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e6]).astype(int)
finalas = np.zero... | 4,548 | 34.818898 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/expansion/1e-1/expand.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e-1])
finalas = np.zeros(intervals... | 4,537 | 34.732283 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/expansion/1e0/expand.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e0]).astype(int)
finalas = np.zero... | 4,548 | 34.818898 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/expansion/1e5/expand.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e5]).astype(int)
finalas = np.zero... | 4,548 | 34.818898 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/expansion/1e4/expand.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e4]).astype(int)
finalas = np.zero... | 4,548 | 34.818898 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/expansion/1e1/expand.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e1]).astype(int)
finalas = np.zero... | 4,548 | 34.818898 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/expansion/1e3/expand.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e3]).astype(int)
finalas = np.zero... | 4,548 | 34.818898 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/engulfment/1e2/engulf.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e2]).astype(int)
engulf_times = np... | 4,550 | 35.119048 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/engulfment/1e6/engulf.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e6]).astype(int)
engulf_times = np... | 4,550 | 35.119048 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/engulfment/1e-1/engulf.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e-1])
engulf_times = np.zeros(inte... | 4,539 | 35.031746 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/engulfment/1e0/engulf.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e0]).astype(int)
engulf_times = np... | 4,550 | 35.119048 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/engulfment/1e5/engulf.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e5]).astype(int)
engulf_times = np... | 4,550 | 35.119048 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/engulfment/1e4/engulf.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e4]).astype(int)
engulf_times = np... | 4,550 | 35.119048 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/engulfment/1e1/engulf.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e1]).astype(int)
engulf_times = np... | 4,550 | 35.119048 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig4/engulfment/1e3/engulf.py | import time
import psutil
import os
import numpy as np
import rebound
import reboundx
# initialize constants
T0 = 12388.5e6 # Sun's age ~ 5 Myr pre-TRGB (sim start)
M0 = 0.8868357536545315 # initial mass of star
# init. param. update interval-rel. vars
intervals = np.array([1e3]).astype(int)
engulf_times = np... | 4,550 | 35.119048 | 86 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig6/gas_giants_tides.py | import numpy as np
import os
import psutil
import rebound
import reboundx
import time
from progress.bar import IncrementalBar
# initialize constants
T0 = 1.2264762530663698e10 # Sun's age ~110 Myr pre-TRGB (sim start)
def memory_usage_psutil():
process = psutil.Process(os.getpid())
mem = process.memory_info()... | 5,473 | 37.822695 | 84 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig6/gas_giants.py | import numpy as np
import os
import psutil
import rebound
import reboundx
import time
from progress.bar import IncrementalBar
# initialize constants
T0 = 1.2264762530663698e10 # Sun's age ~110 Myr pre-TRGB (sim start)
def memory_usage_psutil():
process = psutil.Process(os.getpid())
mem = process.memory_info()... | 4,034 | 34.707965 | 84 | py |
REBOUNDxPaper | REBOUNDxPaper-master/fig6/fig6.py | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
# load REBOUND data
data = np.loadtxt('output/tides/m.txt') # return (N, 2) array
ts = data[:, 0]/1e6 # return only 1st col
mass = data[:, 1] # return only 2nd col
data = np.loadtxt('outp... | 2,119 | 39.769231 | 82 | py |
ddreconf-experiments2023 | ddreconf-experiments2023-main/run.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
gnutime_pass = '/usr/bin/time'
outdir = 'out/'
timeout_seconds = 7300
import os
import sys
import subprocess
import signal
def main():
if not os.path.exists(gnutime_pass):
print('GNU time not found', file = sys.stderr)
exit(1)
if not os.path.exists... | 3,057 | 42.070423 | 223 | py |
MAT-MINERvA | MAT-MINERvA-main/python/PlotUtils/LoadMATMINERvALib.py | """
LoadPlotUtilsLib.py:
The code necessary to load the libplotutils.so library
so that PlotUtils C++ objects are available.
Original author: J. Wolcott (jwolcott@fnal.gov)
November 2012
"""
# hms 2021-11-20 comment out classes that moved to MAT-MINERvA
# to use this you need to
# exp... | 4,105 | 25.152866 | 125 | py |
MAT-MINERvA | MAT-MINERvA-main/python/PlotUtils/__init__.py | # This file, and the fact that the other files here are in the subdirectory PlotUtils,
# exist only so that the line 'import PlotUtils' will work in other packages.
#
# See http://docs.python.org/2/tutorial/modules.html#packages if you're curious
# how this works.
# load the C++ objects and bind them into the namespac... | 444 | 33.230769 | 86 | py |
MAT-MINERvA | MAT-MINERvA-main/test/python_t.py | import sys,os,string
import math
from ROOT import *
from PlotUtils import *
#from ROOT.PlotUtils import MnvH1D, MnvH2D
from array import array
trials = 100000
def func(x):
return 1.0
def Test1D():
TH1.AddDirectory(False)
yscale = array('f', [0.98,1.02])
xoffset = array('f', [-0.5,0.5])
xscale = ... | 4,186 | 20.146465 | 68 | py |
sage | sage-master/output/allresults.py | #!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
# import h5py as h5
import numpy as np
import pylab as plt
from random import sample, seed
from os.path import getsize as getFileSize
# ================================================================================
# Basic variables
# ==================... | 53,849 | 38.508437 | 160 | py |
sage | sage-master/output/plot_read_routines.py | # Routines for reading and plotting to produce comparable figures to the SAGE paper
from pylab import *
from scipy import signal as ss
def galdtype():
# Define the data-type for the public version of SAGE
Galdesc_full = [
('SnapNum' , np.int32),
('Type' , ... | 16,817 | 58.010526 | 444 | py |
sage | sage-master/output/history.py | #!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
# import h5py as h5
import numpy as np
import pylab as plt
from random import sample, seed
from os.path import getsize as getFileSize
# ================================================================================
# Basic variables
# ==================... | 27,194 | 41.625392 | 749 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/mri_model.py | """
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 collections import defaultdict
import numpy as np
import pytorch_lightning as pl
import torch
import torchvision
from torch.utils.data ... | 5,915 | 39.244898 | 124 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/unet_model.py | """
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 import nn
from torch.nn import functional as F
class ConvBlock(nn.Module):
"""
A Convolutional Block that c... | 6,318 | 33.911602 | 98 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/utils.py | import numpy as np
from skimage.measure import compare_ssim
def get_train_directory(args):
"""
Parameters
----------
args : args.data_opt--dataset to be used in training&testing
Note: users should set the directories prior to running train file
Returns
-------
directories of the kspac... | 5,887 | 21.052434 | 112 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/varnet.py | """
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 math
import pathlib
import os
import random
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from pytorch_lightnin... | 15,436 | 36.928747 | 121 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/train_unet.py | """
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 pathlib
import random
import numpy as np
import torch
from pytorch_lightning import Trainer
from pytorch_lightning.logging import Tes... | 12,100 | 41.609155 | 119 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/helpers.py | import torch
import numpy as np
from torch.autograd import Variable
dtype = torch.cuda.FloatTensor
class MaskFunc:
"""
ref: https://github.com/facebookresearch/fastMRI/tree/master/fastmri
MaskFunc creates a sub-sampling mask of a given shape.
The mask selects a subset of columns from the input k-space... | 13,056 | 36.412607 | 155 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/common/evaluate.py | """
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 argparse
import pathlib
from argparse import ArgumentParser
import h5py
import numpy as np
from runstats import Statistics
from skima... | 3,428 | 29.891892 | 96 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/common/args.py | """
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 argparse
import pathlib
class Args(argparse.ArgumentParser):
"""
Defines global default arguments.
"""
def __init__... | 1,896 | 39.361702 | 100 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/common/utils.py | """
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 h5py
def save_reconstructions(reconstructions, out_dir):
"""
Saves the reconstructions from a model into h5 file... | 1,187 | 28.7 | 91 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/common/test_subsample.py | """
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 numpy as np
import pytest
import torch
from common.subsample import MaskFunc
@pytest.mark.parametrize("center_fracs, accelerations,... | 1,506 | 30.395833 | 74 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/common/subsample.py | """
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 numpy as np
import torch
def create_mask_for_mask_type(mask_type_str, center_fractions, accelerations):
if mask_type_str == 'ran... | 7,423 | 42.415205 | 112 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/common/__init__.py | """
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.
"""
| 178 | 24.571429 | 63 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/data/mri_data.py | """
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 pathlib
import random
import h5py
from torch.utils.data import Dataset
class SliceData(Dataset):
"""
A PyTorch Dataset that... | 2,181 | 35.983051 | 95 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/data/__init__.py | """
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.
"""
| 178 | 24.571429 | 63 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/data/test_transforms.py | """
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 numpy as np
import pytest
import torch
from common import utils
from common.subsample import RandomMaskFunc
from data import transfor... | 5,497 | 28.244681 | 83 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/data/transforms.py | """
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 numpy as np
import torch
def to_tensor(data):
"""
Convert numpy array to PyTorch tensor. For complex arrays, the real and ima... | 11,863 | 32.047354 | 155 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/include/__init__.py | from .transforms import *
from .helpers import *
from .mri_helpers import * | 75 | 24.333333 | 26 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/include/mri_helpers.py | import torch
import torch.nn as nn
import torchvision
import sys
import numpy as np
from PIL import Image
import PIL
import numpy as np
from torch.autograd import Variable
import random
import numpy as np
import torch
import matplotlib.pyplot as plt
from PIL import Image
import PIL
from torch.autograd import Vari... | 4,616 | 32.215827 | 106 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/include/helpers.py | import torch
import torch.nn as nn
import torchvision
import sys
import numpy as np
from PIL import Image
import PIL
import numpy as np
from torch.autograd import Variable
import random
import numpy as np
import torch
import matplotlib.pyplot as plt
from PIL import Image
import PIL
from torch.autograd import Vari... | 4,860 | 26.308989 | 84 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/include/transforms.py | """
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 numpy as np
import torch
def to_tensor(data):
"""
Convert numpy array to PyTorch tensor. For complex arrays, the real and ima... | 11,673 | 31.70028 | 155 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/varnet/functions/include/pytorch_ssim/__init__.py | import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
from math import exp
def gaussian(window_size, sigma):
gauss = torch.Tensor([exp(-(x - window_size//2)**2/float(2*sigma**2)) for x in range(window_size)])
return gauss/gauss.sum()
def create_window(window_size,... | 2,641 | 34.702703 | 104 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/unet/functions/mri_model.py | """
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 collections import defaultdict
import numpy as np
import pytorch_lightning as pl
import torch
import torchvision
from torch.utils.data ... | 5,918 | 39.265306 | 124 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/unet/functions/unet_model.py | """
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 import nn
from torch.nn import functional as F
class ConvBlock(nn.Module):
"""
A Convolutional Block that c... | 8,124 | 36.790698 | 114 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/unet/functions/utils.py | import numpy as np
from skimage.measure import compare_ssim
def get_train_directory(args):
"""
Parameters
----------
args : args.data_opt--dataset to be used in training&testing
Note: users should set the directories prior to running train file
Returns
-------
directories of the kspac... | 5,887 | 21.052434 | 112 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/unet/functions/train_unet.py | """
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 pathlib
import random
import numpy as np
import torch
from pytorch_lightning import Trainer
from pytorch_lightning.logging import Tes... | 12,100 | 41.609155 | 119 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/unet/functions/helpers.py | import torch
import numpy as np
from torch.autograd import Variable
dtype = torch.cuda.FloatTensor
class MaskFunc:
"""
ref: https://github.com/facebookresearch/fastMRI/tree/master/fastmri
MaskFunc creates a sub-sampling mask of a given shape.
The mask selects a subset of columns from the input k-space... | 13,056 | 36.412607 | 155 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/unet/functions/common/evaluate.py | """
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 argparse
import pathlib
from argparse import ArgumentParser
import h5py
import numpy as np
from runstats import Statistics
#from skim... | 3,577 | 30.663717 | 96 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/unet/functions/common/args.py | """
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 argparse
import pathlib
class Args(argparse.ArgumentParser):
"""
Defines global default arguments.
"""
def __init__... | 1,896 | 39.361702 | 100 | py |
ttt_for_deep_learning_cs | ttt_for_deep_learning_cs-master/unet/functions/common/utils.py | """
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 h5py
def save_reconstructions(reconstructions, out_dir):
"""
Saves the reconstructions from a model into h5 file... | 1,187 | 28.7 | 91 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.