Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
null | msaexp-main/msaexp/msa.py | """
Helper scripts for dealing with MSA metadata files (``MSAMETFL``)
"""
import os
import numpy as np
import astropy.io.fits as pyfits
__all__ = ["regions_from_metafile", "regions_from_fits",
"MSAMetafile"]
def pad_msa_metafile(metafile, pad=0, source_ids=None, slitlet_ids=None, positive_ids=False, prefi... | 35,397 | 35.643892 | 229 | py |
null | msaexp-main/msaexp/pipeline.py | """
Manual extractions of NIRSpec MSA spectra
"""
import os
import glob
import time
import traceback
from collections import OrderedDict
from tqdm import tqdm
import yaml
import numpy as np
import matplotlib.pyplot as plt
import astropy.io.fits as pyfits
import astropy.units as u
from astropy.units.equivalencies im... | 73,191 | 33.090359 | 328 | py |
null | msaexp-main/msaexp/resample.py | import numpy as np
import os
from grizli import utils
def resample_template(spec_wobs, spec_R_fwhm, templ_wobs, templ_flux, velocity_sigma=100, nsig=5):
"""
Resample a high resolution template/model on the wavelength grid of a
spectrum with (potentially) wavelength dependent dispersion
Parameters
... | 1,792 | 30.45614 | 98 | py |
null | msaexp-main/msaexp/resample_numba.py | import numpy as np
import os
from grizli import utils
from numba import jit, njit
@jit(nopython=True, fastmath=True, error_model='numpy')
def resample_template_numba(spec_wobs, spec_R_fwhm, templ_wobs, templ_flux, velocity_sigma=100, nsig=5, fill_value=0.):
"""
Resample a high resolution template/model on the ... | 2,401 | 28.292683 | 119 | py |
null | msaexp-main/msaexp/spectrum.py |
"""
Fits, etc. to extracted spectra
"""
import os
import time
import warnings
import numpy as np
import scipy.ndimage as nd
from scipy.optimize import nnls
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
from matplotlib.gridspec import GridSpec
import astropy.io.fits as pyfits
from g... | 55,977 | 31.357225 | 440 | py |
null | msaexp-main/msaexp/utils.py | """
"""
import os
import warnings
import numpy as np
import astropy.io.fits as pyfits
import grizli.utils
def summary_from_metafiles():
"""
"""
import glob
from grizli import utils, prep
import astropy.io.fits as pyfits
files = glob.glob('*msa.fits')
files.sort()
for file in ... | 74,414 | 31.256177 | 304 | py |
null | msaexp-main/msaexp/data/README.md | Dispersion files from https://jwst-docs.stsci.edu/jwst-near-infrared-spectrograph/nirspec-instrumentation/nirspec-dispersers-and-filters.
| 139 | 45.666667 | 137 | md |
null | msaexp-main/msaexp/data/fix_units.py | """
Fix units of the dispersion tables to be astropy compatible
"""
import astropy.units as u
from astropy.table import Table
import glob
files = glob.glob('*disp.fits')
files.sort()
for file in files:
tab = Table.read(file)
tab['WAVELENGTH'].unit = u.micron
tab['DLDS'].unit = u.micron/u.pixel
tab['... | 376 | 18.842105 | 59 | py |
null | msaexp-main/msaexp/tests/__init__.py | 0 | 0 | 0 | py | |
null | msaexp-main/msaexp/tests/test_drizzle.py | import os
import copy
import numpy as np
from .. import utils
def data_path():
return os.path.join(os.path.dirname(__file__), 'data')
def test_combine():
"""
Test drizzle combination from slitlet
"""
import matplotlib.pyplot as plt
from .. import drizzle as msadrizzle
os.chdir(... | 3,524 | 34.969388 | 110 | py |
null | msaexp-main/msaexp/tests/test_msa.py | from .. import msa
def test_meta_parser():
import matplotlib.pyplot as plt
uri = 'https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:JWST/product/'
meta = msa.MSAMetafile(uri+'jw02756001001_01_msa.fits')
regs = meta.regions_from_metafile(as_string=True, with_bars=True)
fig, ax = ... | 1,110 | 34.83871 | 80 | py |
null | msaexp-main/msaexp/tests/test_spectra.py | """
Test spectrum extractions and fits
"""
import os
import numpy as np
import matplotlib.pyplot as plt
plt.ioff()
import astropy.io.fits as pyfits
from .. import utils, spectrum, pipeline
pipe = None
TARGETS = ['1345_933']
eazy_templates = None
def data_path():
return os.path.join(os.path.dirname(__file__), ... | 6,363 | 27.035242 | 87 | py |
null | msaexp-main/msaexp/tests/test_utils.py | from .. import utils
def test_import():
"""
"""
import msaexp.pipeline
import msaexp.spectrum
import msaexp.utils
def test_wavelength_grids():
import grizli.utils
grizli.utils.set_warnings()
for gr in utils.GRATING_LIMITS:
grid = utils.get_standard_wavelength_grid(gr... | 472 | 22.65 | 72 | py |
ARES | ARES-master/ARES_v2.c | /*
* File: ARES_v2.c
* Author: Sérgio Sousa
*
* Created on Julho 31, 2014
*/
// ARES v2.0 Automatic Routine for Equivalent widths of Spectra
// method and implementation :Sergio G. Sousa (IA - CAUP) sousasag@astro.up.pt
//
// Based on the original code ARES from Sergio Sousa.
// supervised by Nuno C. Santos and ... | 7,362 | 28.218254 | 170 | c |
ARES | ARES-master/README.md | # ARES
Root Webpage:
www.astro.up.pt/~sousasag/ares
----------------------------------------------
-- QUICK README --
----------------------------------------------
More information on www.astro.up.pt/~sousasag/ares
How to use the code:
1. Compile:
make install
2. Test the code:
... | 16,748 | 36.469799 | 231 | md |
ARES | ARES-master/areslib.h | /*
* File: areslib.h
* Author: sousasag
*
* Created on April 25, 2011, 2:58 PM
*/
#ifndef _ARESLIB_H
#define _ARESLIB_H
//// local spec wings type:
#define LOCAL_WINGS_FIT 0 // (ARES Original) No extended wings to fit
//#define LOCAL_WINGS_FIT 1 // New ARES - extending the wings (3x) to fit ones
#include <str... | 24,882 | 34.395448 | 268 | h |
ARES | ARES-master/areslib_gsl1.h | /*
* File: areslib.h
* Author: sousasag
*
* Created on April 25, 2011, 2:58 PM
*/
#ifndef _ARESLIB_H
#define _ARESLIB_H
//// local spec wings type:
//#define LOCAL_WINGS_FIT 0 // (ARES Original) No extended wings to fit
#define LOCAL_WINGS_FIT 0 // New ARES - extending the wings (3x) to fit ones
#include <str... | 24,807 | 34.389444 | 268 | h |
ARES | ARES-master/areslib_gsl2.h | /*
* File: areslib.h
* Author: sousasag
*
* Created on April 25, 2011, 2:58 PM
*/
#ifndef _ARESLIB_H
#define _ARESLIB_H
//// local spec wings type:
//#define LOCAL_WINGS_FIT 0 // (ARES Original) No extended wings to fit
#define LOCAL_WINGS_FIT 0 // New ARES - extending the wings (3x) to fit ones
#include <str... | 24,882 | 34.395448 | 268 | h |
ARES | ARES-master/aresplot.h | /*
* File: areslib.h
* Author: sousasag
*
* Created on April 25, 2011, 2:58 PM
*/
#ifndef _ARESPLOT_H
#define _ARESPLOT_H
// 1- for plot_utils
// 2- for gnuplot
// 3- for gnuplot saving png plots in plotdir
#define PLOT_TYPE 2
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.... | 5,749 | 26.511962 | 161 | h |
ARES | ARES-master/filesio.h | /*
* File: filesio.h
* Author: sousasag
*
* Created on April 23, 2011, 2:21 PM
*/
#ifndef _FILESIO_H
#define _FILESIO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <string.h>
#include "fitsio.h"
/* leitura das opcoes , mine.opt file read*/
//void read_mine(char * mine, char* filetest, char* fileleit... | 12,997 | 31.333333 | 288 | h |
ARES | ARES-master/makefile | install:
gcc -o ARES ARES_v2.c -lcfitsio -lgsl -lgslcblas -lm -lgomp -fopenmp
test:
./ARES > /dev/null
diff test.ares test.ares_ori
clean:
rm -f ARES test.ares
| 166 | 15.7 | 69 | ARES-master/makefile |
ARES | ARES-master/ngaussfdf.h | /*
* File: ngaussdfd.h
* Author: sousasag
*
* Created on April 23, 2011, 12:28 PM
*/
/* expfit.c -- compute residual for exponential
+background model */
struct data {
size_t n;
int para;
double * t;
double * y;
double * sigma;
};
int
expb_f (const gsl_vector * x, void *data,
gsl_vector *... | 2,052 | 19.737374 | 79 | h |
ARES | ARES-master/rvcor.h | /*
* File: rvcor.h
* Author: sousasag
*
* Created on April 20, 2012, 11:45 AM
*/
#ifndef RVCOR_H
#define RVCOR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <gsl/gsl_interp.h>
struct maskstruct{
double center;
double space;
double* lines;
int nl;
};
void correct_lambda(double * lambda , ... | 7,421 | 29.669421 | 152 | h |
ARES | ARES-master/sn_rejt_estimator.h | /*
* File: sn_rejt_estimator.h
* Author: sousasag
*
* Created on December 20, 2012, 3:50 PM
*/
#ifndef SN_REJT_ESTIMATOR_H
#define SN_REJT_ESTIMATOR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <string.h>
#include <stdio.h>
#include <gsl/gsl_statistics.h>
#include <gsl/gsl_sort.h>
#include <gsl/gsl_inter... | 5,565 | 28.924731 | 106 | h |
ARES | ARES-master/ares_cython/areslib.h | /*
* File: areslib.h
* Author: sousasag
*
* Created on April 25, 2011, 2:58 PM
*/
#ifndef _ARESLIB_H
#define _ARESLIB_H
//// local spec wings type:
#define LOCAL_WINGS_FIT 0 // (ARES Original) No extended wings to fit
//#define LOCAL_WINGS_FIT 1 // New ARES - extending the wings (3x) to fit ones
#include <str... | 25,610 | 34.620306 | 253 | h |
ARES | ARES-master/ares_cython/aresplot.h | ../aresplot.h | 13 | 13 | 13 | h |
ARES | ARES-master/ares_cython/filesio.h | ../filesio.h | 12 | 12 | 12 | h |
ARES | ARES-master/ares_cython/ngaussfdf.h | ../ngaussfdf.h | 14 | 14 | 14 | h |
ARES | ARES-master/ares_cython/rvcor.h | ../rvcor.h | 10 | 10 | 10 | h |
ARES | ARES-master/ares_cython/setup.py | from distutils.core import setup, Extension
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
ext_modules = [Extension("ares_module",
["ares_module.pyx"],
libraries=["gsl","gslcblas","cfitsio","gomp","m"])]
setup(cmdclass={'build_ext': build_ex... | 386 | 34.181818 | 101 | py |
ARES | ARES-master/ares_cython/sn_rejt_estimator.h | ../sn_rejt_estimator.h | 22 | 22 | 22 | h |
ARES | ARES-master/ares_cython/interactive_ares/test_iiteractive.py | from astropy.io import fits
import numpy as np
import matplotlib.pyplot as plt
import sys
import time
sys.path.insert(0, '/home/sousasag/Programas/GIT_projects/ARES/ares_cython')
#sys.path.insert(0, '/mnt/e/Linux_stuff/Programas/GIT_Projects/SPECPAR3/codes/ARES/ares_cython')
import ares_module as ares
def tellme(s... | 5,136 | 30.133333 | 129 | py |
ARES | ARES-master/ares_cython/interactive_ares/test_interactive.py | from astropy.io import fits
import numpy as np
import matplotlib.pyplot as plt
import sys
import time
sys.path.insert(0, '/home/sousasag/Programas/GIT_projects/ARES/ares_cython')
#sys.path.insert(0, '/mnt/e/Linux_stuff/Programas/GIT_Projects/SPECPAR3/codes/ARES/ares_cython')
import ares_module as ares
def tellme(s... | 2,266 | 28.828947 | 104 | py |
null | NISR-main/README.md | # NISR
If you use this implementation please cite:
Zhongli Fan et al.: "Nonlinear Intensity, Scale and Rotation Invariant Matching for Multimodal Images"
IEEE TPAMI
| 165 | 32.2 | 102 | md |
CSD-SSD | CSD-SSD-master/README.md | # [CSD: Consistency-based Semi-supervised learning for object Detection (NeurIPS 2019)](https://papers.nips.cc/paper/9259-consistency-based-semi-supervised-learning-for-object-detection)
By [Jisoo Jeong](http://mipal.snu.ac.kr/index.php/Jisoo_Jeong), Seungeui Lee, [Jee-soo Kim](http://mipal.snu.ac.kr/index.php/Jee-so... | 804 | 29.961538 | 196 | md |
CSD-SSD | CSD-SSD-master/csd.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from layers import *
from data import voc300, voc512, coco
import os
import warnings
import math
import numpy as np
import cv2
class SSD_CON(nn.Module):
"""Single Shot Multibox Architecture
The network is co... | 10,782 | 34.705298 | 84 | py |
CSD-SSD | CSD-SSD-master/eval.py | """Adapted from:
@longcw faster_rcnn_pytorch: https://github.com/longcw/faster_rcnn_pytorch
@rbgirshick py-faster-rcnn https://github.com/rbgirshick/py-faster-rcnn
Licensed under The MIT License [see LICENSE for details]
"""
from __future__ import print_function
import torch
import torch.nn as nn
import to... | 16,048 | 35.39229 | 80 | py |
CSD-SSD | CSD-SSD-master/eval512.py | """Adapted from:
@longcw faster_rcnn_pytorch: https://github.com/longcw/faster_rcnn_pytorch
@rbgirshick py-faster-rcnn https://github.com/rbgirshick/py-faster-rcnn
Licensed under The MIT License [see LICENSE for details]
"""
from __future__ import print_function
import torch
import torch.nn as nn
import to... | 16,048 | 35.39229 | 80 | py |
CSD-SSD | CSD-SSD-master/ssd.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from layers import *
from data import voc300, voc512, coco
import os
class SSD(nn.Module):
"""Single Shot Multibox Architecture
The network is composed of a base VGG network followed by the
added multibo... | 8,109 | 36.031963 | 82 | py |
CSD-SSD | CSD-SSD-master/test.py | from __future__ import print_function
import sys
import os
import argparse
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
from torch.autograd import Variable
from data import VOC_ROOT, VOC_CLASSES as labelmap
from PIL import Image
from data import VOC... | 4,031 | 39.32 | 103 | py |
CSD-SSD | CSD-SSD-master/train_csd.py | from data import *
from utils.augmentations import SSDAugmentation
from layers.modules import MultiBoxLoss
from ssd import build_ssd
# from ssd_consistency import build_ssd_con
from csd import build_ssd_con
import os
import sys
import time
import torch
from torch.autograd import Variable
import torch.nn.functional as F... | 17,144 | 38.05467 | 234 | py |
CSD-SSD | CSD-SSD-master/train_ssd.py | from data import *
from utils.augmentations import SSDAugmentation
from layers.modules import MultiBoxLoss
from ssd import build_ssd
import os
import sys
import time
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torch.nn.in... | 9,755 | 35.267658 | 90 | py |
CSD-SSD | CSD-SSD-master/data/__init__.py | from .voc0712 import VOCDetection, VOCAnnotationTransform, VOC_CLASSES, VOC_ROOT
from .voc07_consistency_init import VOCDetection_con_init, VOCAnnotationTransform_con_init, VOC_CLASSES, VOC_ROOT
from .voc07_consistency import VOCDetection_con, VOCAnnotationTransform_con, VOC_CLASSES, VOC_ROOT
from .coco import COCOD... | 1,825 | 32.814815 | 114 | py |
CSD-SSD | CSD-SSD-master/data/coco.py | from .config import HOME
import os
import os.path as osp
import sys
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
import cv2
import numpy as np
COCO_ROOT = osp.join(HOME, 'semi_detection/ssd_semi_good/data/coco/')
IMAGES = 'images'
ANNOTATIONS = 'annotations'
COCO_API = 'Pyth... | 7,197 | 38.767956 | 110 | py |
CSD-SSD | CSD-SSD-master/data/config.py | # config.py
import os.path
# gets home dir cross platform
HOME = os.path.expanduser("~")
# for making bounding boxes pretty
COLORS = ((255, 0, 0, 128), (0, 255, 0, 128), (0, 0, 255, 128),
(0, 255, 255, 128), (255, 0, 255, 128), (255, 255, 0, 128))
MEANS = (104, 117, 123)
# SSD300 CONFIGS
# 'lr_steps': (80... | 1,829 | 27.59375 | 69 | py |
CSD-SSD | CSD-SSD-master/data/voc0712.py | """VOC Dataset Classes
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
"""
from .config import HOME
import os.path as osp
import sys
import torch
import torch.utils.data as data
import cv2
import numpy as np
if sys.ver... | 6,702 | 34.84492 | 85 | py |
CSD-SSD | CSD-SSD-master/data/voc07_consistency.py | """VOC Dataset Classes
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
"""
from .config import HOME
import os.path as osp
import sys
import torch
import torch.utils.data as data
import cv2
import numpy as np
import ran... | 8,414 | 35.428571 | 93 | py |
CSD-SSD | CSD-SSD-master/data/voc07_consistency_init.py | """VOC Dataset Classes
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
"""
from .config import HOME
import os.path as osp
import sys
import torch
import torch.utils.data as data
import cv2
import numpy as np
if sys.ver... | 6,842 | 34.455959 | 85 | py |
CSD-SSD | CSD-SSD-master/data/scripts/COCO2014.sh | #!/bin/bash
start=`date +%s`
# handle optional download dir
if [ -z "$1" ]
then
# navigate to ~/data
echo "navigating to ~/data/ ..."
mkdir -p ~/data
cd ~/data/
mkdir -p ./coco
cd ./coco
mkdir -p ./images
mkdir -p ./annotations
else
# check if specified dir is valid
if [ ! ... | 1,955 | 22.853659 | 85 | sh |
CSD-SSD | CSD-SSD-master/data/scripts/VOC2007.sh | #!/bin/bash
# Ellis Brown
start=`date +%s`
# handle optional download dir
if [ -z "$1" ]
then
# navigate to ~/data
echo "navigating to ~/data/ ..."
mkdir -p ~/data
cd ~/data/
else
# check if is valid directory
if [ ! -d $1 ]; then
echo $1 "is not a valid directory"
exit 0
... | 971 | 22.142857 | 83 | sh |
CSD-SSD | CSD-SSD-master/data/scripts/VOC2012.sh | #!/bin/bash
# Ellis Brown
start=`date +%s`
# handle optional download dir
if [ -z "$1" ]
then
# navigate to ~/data
echo "navigating to ~/data/ ..."
mkdir -p ~/data
cd ~/data/
else
# check if is valid directory
if [ ! -d $1 ]; then
echo $1 "is not a valid directory"
exit 0
... | 763 | 19.105263 | 83 | sh |
CSD-SSD | CSD-SSD-master/demo/__init__.py | 0 | 0 | 0 | py | |
CSD-SSD | CSD-SSD-master/demo/live.py | from __future__ import print_function
import torch
from torch.autograd import Variable
import cv2
import time
from imutils.video import FPS, WebcamVideoStream
import argparse
parser = argparse.ArgumentParser(description='Single Shot MultiBox Detection')
parser.add_argument('--weights', default='weights/ssd_300_VOC0712... | 3,072 | 32.402174 | 78 | py |
CSD-SSD | CSD-SSD-master/layers/__init__.py | from .functions import *
from .modules import *
| 48 | 15.333333 | 24 | py |
CSD-SSD | CSD-SSD-master/layers/box_utils.py | # -*- coding: utf-8 -*-
import torch
def point_form(boxes):
""" Convert prior_boxes to (xmin, ymin, xmax, ymax)
representation for comparison to point form ground truth data.
Args:
boxes: (tensor) center-size default boxes from priorbox layers.
Return:
boxes: (tensor) Converted xmin, y... | 9,427 | 38.283333 | 80 | py |
CSD-SSD | CSD-SSD-master/layers/functions/__init__.py | from .detection import Detect
from .prior_box import PriorBox
__all__ = ['Detect', 'PriorBox']
| 97 | 15.333333 | 32 | py |
CSD-SSD | CSD-SSD-master/layers/functions/detection.py | import torch
from torch.autograd import Function
from ..box_utils import decode, nms
from data import voc300 as cfg
from data import voc512 as cfg
class Detect(Function):
"""At test time, Detect is the final layer of SSD. Decode location preds,
apply non-maximum suppression to location predictions based on c... | 2,812 | 41.621212 | 79 | py |
CSD-SSD | CSD-SSD-master/layers/functions/prior_box.py | from __future__ import division
from math import sqrt as sqrt
from itertools import product as product
import torch
class PriorBox(object):
"""Compute priorbox coordinates in center-offset form for each source
feature map.
"""
def __init__(self, cfg):
super(PriorBox, self).__init__()
s... | 2,001 | 34.75 | 75 | py |
CSD-SSD | CSD-SSD-master/layers/modules/__init__.py | from .l2norm import L2Norm
from .multibox_loss import MultiBoxLoss
__all__ = ['L2Norm', 'MultiBoxLoss']
| 105 | 20.2 | 39 | py |
CSD-SSD | CSD-SSD-master/layers/modules/l2norm.py | import torch
import torch.nn as nn
from torch.autograd import Function
from torch.autograd import Variable
import torch.nn.init as init
class L2Norm(nn.Module):
def __init__(self,n_channels, scale):
super(L2Norm,self).__init__()
self.n_channels = n_channels
self.gamma = scale or None
... | 758 | 29.36 | 81 | py |
CSD-SSD | CSD-SSD-master/layers/modules/multibox_loss.py | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from data import coco as cfg
from ..box_utils import match, log_sum_exp
class MultiBoxLoss(nn.Module):
"""SSD Weighted Loss Function
Compute Targets:
1) Produce Confidence Tar... | 4,925 | 40.394958 | 84 | py |
CSD-SSD | CSD-SSD-master/utils/__init__.py | from .augmentations import SSDAugmentation | 42 | 42 | 42 | py |
CSD-SSD | CSD-SSD-master/utils/augmentations.py | import torch
from torchvision import transforms
import cv2
import numpy as np
import types
from numpy import random
def intersect(box_a, box_b):
max_xy = np.minimum(box_a[:, 2:], box_b[2:])
min_xy = np.maximum(box_a[:, :2], box_b[:2])
inter = np.clip((max_xy - min_xy), a_min=0, a_max=np.inf)
return in... | 13,453 | 31.186603 | 91 | py |
null | BlindPtychography-main/README.md | Code added into folder
| 23 | 11 | 22 | md |
null | BlindPtychography-main/Blind Ptychography via Blind Deconvolution/bptychmultipleshifts.m | %Seperates a vector y into it's convoluted parts
clear all
%% Establishing the variables
L = 64; %number of measurements
delta = ceil(log2(L)); %Support of mask
Ntrue= 6; %Size of unknown part of signal
Tests = 100;
Iterations = 1000;
Y1 = (1/2)*ones(1000,1); Y2 = (1/2)*ones(1000,1); Y3 = (1/2)*ones(1000,1);
errorxma... | 10,656 | 25.50995 | 180 | m |
null | BlindPtychography-main/Blind Ptychography via Blind Deconvolution/bptychmultipleshiftsBar.m | %Seperates a vector y into it's convoluted parts
clear all
%% Establishing the variables
L = 64; %number of measurements
delta = ceil(log2(L)); %Support of mask
Ntrue= 4; %Size of unknown part of signal
Tests = 1000;
Iterations = 1000;
Y1 = (1/2)*ones(1000,1); Y2 = (1/2)*ones(1000,1); Y3 = (1/2)*ones(1000,1);
signaln... | 12,804 | 23.767892 | 180 | m |
null | BlindPtychography-main/Blind Ptychography via Blind Deconvolution/bptychmultipleshiftsN.m | %Seperates a vector y into it's convoluted parts
clear all
%% Establishing the variables
L = 64; %number of measurements
delta = ceil(log2(L)); %Support of mask
Tests = 10;
Iterations = 1000;
errorx = zeros(2*delta,Tests);
errorm = zeros(2*delta,Tests);
errory = zeros(2*delta-1,1);
errorY = zeros((2*delta-1)^2,1);... | 10,312 | 24.91206 | 180 | m |
null | BlindPtychography-main/Blind Ptychography via Blind Deconvolution/bptychmultipleshiftsdelta.m | %Seperates a vector y into it's convoluted parts
clear all
%% Establishing the variables
L = 64; %number of measurements
Tests = 10;
Iterations = 1000;
errorxN = zeros(6,4);
errormN = zeros(6,4);
counter2 = 0;
for delta = 2:2:8 %Support of mask
counter2 = counter2 + 1;
errorx = zeros(2*delta,Tests);
errorm = zeros... | 10,304 | 25.154822 | 180 | m |
multiwoz | multiwoz-master/README.md | # MultiWOZ
Multi-Domain Wizard-of-Oz dataset (MultiWOZ), a fully-labeled collection of human-human written conversations spanning over multiple domains and topics. At a size of 10k dialogues, it is at least one order of magnitude larger than all previous annotated task-oriented corpora.
## Versions
- **The newest, c... | 26,095 | 85.125413 | 642 | md |
multiwoz | multiwoz-master/__init__.py | 0 | 0 | 0 | py | |
multiwoz | multiwoz-master/create_delex_data.py | # -*- coding: utf-8 -*-
import copy
import json
import os
import re
import shutil
import urllib
from collections import OrderedDict
from io import BytesIO
from zipfile import ZipFile
from tqdm import tqdm
import numpy as np
from utils import dbPointer
from utils import delexicalize
from utils.nlp import normalize
... | 16,087 | 34.436123 | 155 | py |
multiwoz | multiwoz-master/evaluate.py | import math
import utils.delexicalize as delex
from collections import Counter
from nltk.util import ngrams
import json
from utils.nlp import normalize
import sqlite3
import os
import random
import logging
from utils.nlp import BLEUScorer
class BaseEvaluator(object):
def initialize(self):
raise NotImpleme... | 26,229 | 41.71987 | 141 | py |
multiwoz | multiwoz-master/test.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import division, print_function, unicode_literals
import argparse
import json
import os
import shutil
import time
import torch
from utils import util
from evaluate import MultiWozEvaluator
from model.model import Model
parser = argparse.ArgumentParser(descriptio... | 7,059 | 36.956989 | 150 | py |
multiwoz | multiwoz-master/train.py | from __future__ import division, print_function, unicode_literals
import argparse
import json
import random
import time
from io import open
import numpy as np
import torch
from torch.optim import Adam
from utils import util
from model.model import Model
parser = argparse.ArgumentParser(description='S2S')
parser.ad... | 8,078 | 45.431034 | 179 | py |
multiwoz | multiwoz-master/data/MultiWOZ_2.2/README.md | # MultiWOZ 2.2
This dataset consists of a schema file `schema.json` describing the ontology and
dialogue files `dialogues_*.json` of dialogue data under the `train`, `dev`, and
`test` folders.
**Notes:**
- Compared to MultiWOZ 2.1, we remove `SNG01862.json` as it's an invalid dialogue.
- MultiWOZ 2.2 is also availab... | 7,230 | 35.520202 | 206 | md |
multiwoz | multiwoz-master/data/MultiWOZ_2.2/convert_to_multiwoz_format.py | """Script to convert MultiWOZ 2.2 from SGD format to MultiWOZ format."""
import glob
import json
import os
from absl import app
from absl import flags
from absl import logging
FLAGS = flags.FLAGS
flags.DEFINE_string("multiwoz21_data_dir", None,
"Path of the MultiWOZ 2.1 dataset.")
flags.DEFINE_st... | 4,297 | 36.701754 | 81 | py |
multiwoz | multiwoz-master/model/__init__.py | 0 | 0 | 0 | py | |
multiwoz | multiwoz-master/model/model.py | from __future__ import division, print_function, unicode_literals
import json
import math
import operator
import os
import random
from io import open
from Queue import PriorityQueue
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
import policy
SOS_token ... | 23,551 | 39.677029 | 176 | py |
multiwoz | multiwoz-master/model/policy.py | import torch
import torch.nn as nn
class DefaultPolicy(nn.Module):
def __init__(self, hidden_size_pol, hidden_size, db_size, bs_size):
super(DefaultPolicy, self).__init__()
self.hidden_size = hidden_size
self.W_u = nn.Linear(hidden_size, hidden_size_pol, bias=False)
self.W_bs = n... | 945 | 30.533333 | 82 | py |
multiwoz | multiwoz-master/utils/__init__.py | 0 | 0 | 0 | py | |
multiwoz | multiwoz-master/utils/dbPointer.py | import sqlite3
import numpy as np
from nlp import normalize
# loading databases
domains = ['restaurant', 'hotel', 'attraction', 'train', 'taxi', 'hospital']#, 'police']
dbs = {}
for domain in domains:
db = 'db/{}-dbase.db'.format(domain)
conn = sqlite3.connect(db)
c = conn.cursor()
dbs[domain] = c
... | 6,587 | 37.302326 | 137 | py |
multiwoz | multiwoz-master/utils/delexicalize.py | import json
import re
from nlp import normalize
digitpat = re.compile('\d+')
timepat = re.compile("\d{1,2}[:]\d{1,2}")
pricepat2 = re.compile("\d{1,3}[.]\d{1,2}")
# FORMAT
# domain_value
# restaurant_postcode
# restaurant_address
# taxi_car8
# taxi_number
# train_id etc..
def prepareSlotValuesIndependent():
do... | 6,348 | 42.486301 | 100 | py |
multiwoz | multiwoz-master/utils/nlp.py | import math
import re
from collections import Counter
from nltk.util import ngrams
timepat = re.compile("\d{1,2}[:]\d{1,2}")
pricepat = re.compile("\d{1,3}[.]\d{1,2}")
with open('utils/mapping.pair') as fin:
replacements = []
for line in fin.readlines():
tok_from, tok_to = line.replace('\n', '').spli... | 7,793 | 30.301205 | 120 | py |
multiwoz | multiwoz-master/utils/util.py | '''
Utility functions
'''
import argparse
import cPickle as pkl
import json
import sys
import math
import time
import numpy as np
import torch
# DEFINE special tokens
SOS_token = 0
EOS_token = 1
UNK_token = 2
PAD_token = 3
def padSequence(tensor):
pad_token = PAD_token
tensor_lengths = [len(sentence) for se... | 2,773 | 27.020202 | 100 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/README.md | # realistic-ssl-evaluation-pytorch
This repository is reimplementation of [Realistic Evaluation of Deep Semi-Supervised Learning Algorithms](https://arxiv.org/abs/1804.09170), by Avital Oliver*, Augustus Odena*, Colin Raffel*, Ekin D. Cubuk, and Ian J. Goodfellow, arXiv preprint arXiv:1804.09170.
Original repo is [here... | 2,275 | 43.627451 | 262 | md |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/build_dataset.py | from torchvision import datasets
import argparse, os
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument("--seed", "-s", default=1, type=int, help="random seed")
parser.add_argument("--dataset", "-d", default="svhn", type=str, help="dataset name : [svhn, cifar10]")
parser.add_argument("--nlabels"... | 5,493 | 38.811594 | 103 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/config.py | from lib.datasets import svhn, cifar10
import numpy as np
shared_config = {
"iteration" : 500000,
"warmup" : 200000,
"lr_decay_iter" : 400000,
"lr_decay_factor" : 0.2,
"batch_size" : 100,
}
### dataset ###
svhn_config = {
"transform" : [False, True, False], # flip, rnd crop, gaussian noise
... | 1,519 | 18.487179 | 72 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/train.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import DataLoader
import argparse, math, time, json, os
from lib import wrn, transform
from config import config
parser = argparse.ArgumentParser()
parser... | 9,756 | 38.82449 | 146 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/__init__.py | 0 | 0 | 0 | py | |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/transform.py | import torch
import torch.nn.functional as F
import random
class transform:
def __init__(self, flip=True, r_crop=True, g_noise=True):
self.flip = flip
self.r_crop = r_crop
self.g_noise = g_noise
print("holizontal flip : {}, random crop : {}, gaussian noise : {}".format(
... | 782 | 29.115385 | 83 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/wrn.py | import torch
import torch.nn as nn
def conv3x3(i_c, o_c, stride=1):
return nn.Conv2d(i_c, o_c, 3, stride, 1, bias=False)
class BatchNorm2d(nn.BatchNorm2d):
def __init__(self, channels, momentum=1e-3, eps=1e-3):
super().__init__(channels)
self.update_batch_stats = True
def forward(self, x)... | 3,664 | 33.252336 | 98 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/algs/__init__.py | 0 | 0 | 0 | py | |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/algs/ict.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class ICT(nn.Module):
def __init__(self, alpha, model, ema_factor):
super().__init__()
self.alpha = alpha
self.mean_teacher = model
self.mean_teacher.train()
self.ema_factor = ema_factor
... | 1,687 | 41.2 | 112 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/algs/mean_teacher.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class MT(nn.Module):
def __init__(self, model, ema_factor):
super().__init__()
self.model = model
self.model.train()
self.ema_factor = ema_factor
self.global_step = 0
def forward(self, x, y, model, mask)... | 912 | 35.52 | 108 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/algs/mixmatch.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class MixMatch(nn.Module):
def __init__(self, temperature, n_augment, alpha):
super().__init__()
self.T = temperature
self.K = n_augment
self.beta_distirb = torch.distributions.beta.Beta(alpha, alpha)
def sharpe... | 1,377 | 36.243243 | 89 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/algs/pimodel.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class PiModel(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, y, model, mask):
# NOTE:
# stochastic transformation is embeded in forward function
# so, pi-model is just to calculate consi... | 560 | 32 | 108 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/algs/pseudo_label.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class PL(nn.Module):
def __init__(self, threshold):
super().__init__()
self.th = threshold
def forward(self, x, y, model, mask):
y_probs = y.softmax(1)
onehot_label = self.__make_one_hot(y_probs.max(1)[1]).float... | 854 | 33.2 | 83 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/algs/vat.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class VAT(nn.Module):
def __init__(self, eps=1.0, xi=1e-6, n_iteration=1):
super().__init__()
self.eps = eps
self.xi = xi
self.n_iteration = n_iteration
def kld(self, q_logit, p_logit):
q = q_logit.softm... | 1,851 | 34.615385 | 102 | py |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/datasets/__init__.py | 0 | 0 | 0 | py | |
realistic-ssl-evaluation-pytorch | realistic-ssl-evaluation-pytorch-master/lib/datasets/cifar10.py | import numpy as np
import os
class CIFAR10:
def __init__(self, root, split="l_train"):
self.dataset = np.load(os.path.join(root, "cifar10", split+".npy"), allow_pickle=True).item()
def __getitem__(self, idx):
image = self.dataset["images"][idx]
label = self.dataset["labels"][idx]
... | 409 | 28.285714 | 101 | py |