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 |
|---|---|---|---|---|---|---|
presto | presto-master/python/presto/cosine_rand.py | from __future__ import print_function
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import numpy as Num
import os
import json
from presto.psr_utils import hist
from presto.Pgplot import plotxy, closeplot
here = os.path.dirname(__file__)
n = 1000
if (0):... | 1,936 | 27.485294 | 82 | py |
presto | presto-master/python/presto/barycenter.py | from builtins import range
## Automatically adapted for numpy Apr 14, 2006 by convertcode.py
import math
import numpy as Numeric
# Most of these routines were taken from TEMPO v11.004 (arrtim.f, setup.f)
def convert_angle(inval, flag=1):
"""
convert_angle(inval, flag=1):
Converts a coded double to a... | 12,153 | 36.862928 | 78 | py |
presto | presto-master/python/presto/rfifind.py | from __future__ import print_function
from __future__ import absolute_import
from builtins import zip
from builtins import range
from builtins import object
import numpy as np
from scipy.signal import medfilt
from presto import infodata
from presto.Pgplot import *
"""
class rfifind:
Read in stats and mask informat... | 15,832 | 44.108262 | 105 | py |
presto | presto-master/python/presto/psrfits.py | #!/usr/bin/env python
"""
Collect PSRFITS information, emulating behavior of PRESTO.
Read PSRFITS data.
Patrick Lazarus, May 11, 2010
Jul 4, 2016 (Scott Ransom added 2-bit reading)
Mar 25, 2021 (Scott Ransom added 1-bit reading)
"""
from __future__ import print_function
from __future__ import absolute_import
fro... | 27,914 | 41.359636 | 91 | py |
presto | presto-master/python/presto/filterbank.py | """
A module for reading filterbank files.
Patrick Lazarus, June 26, 2012
(Minor modification from file originally from June 6th, 2009)
"""
from __future__ import print_function
from __future__ import absolute_import
from builtins import object
import sys
import os
import os.path
import numpy as np
from presto import... | 10,901 | 33.830671 | 82 | py |
presto | presto-master/python/presto/sinc_interp.py | from __future__ import print_function
from __future__ import absolute_import
import numpy as Num
import numpy.fft as FFT
def kaiser_window(xs, halfwidth, alpha):
"""
kaiser_window(xs, halfwidth, alpha):
Return the kaiser window function for the values 'xs' when the
the half-width of the win... | 6,493 | 34.102703 | 85 | py |
presto | presto-master/python/presto/singlepulse/spcand.py | from __future__ import absolute_import
from builtins import object
import numpy as np
from . import bary_and_topo
def topo_timeshift(bary_start_time, time_shift, topo):
ind = np.where(topo == float(int(bary_start_time)/10*10))[0]
return time_shift[ind]
def numsub(nchans, snr):
if not nchans==960 and np.... | 10,190 | 43.697368 | 116 | py |
presto | presto-master/python/presto/singlepulse/bary_and_topo.py | #! /usr/bin/env python
"""
Original code found in presto. Written by Scott M. Ransom.
Modified by Chitrang Patel to read information from PSRFITs file.
Modified to return topocentric and corresponding barycentric
times.
"""
from __future__ import print_function
from presto.presto.prestoswig import *
impor... | 3,158 | 35.310345 | 92 | py |
presto | presto-master/python/presto/singlepulse/spio.py | from __future__ import print_function
from builtins import range
import numpy as _np
import fileinput as _fileinput
from scipy.special import erf
def get_textfile(txtfile):
""" Read in the groups.txt file.
Contains information about the DM, time, box car width, signal to noise, sample number and rank of gr... | 11,929 | 41.913669 | 169 | py |
presto | presto-master/python/presto/singlepulse/rrattrap.py | #!/usr/bin/env python
"""
rrattrap.py
Single pulse sifting code: performs grouping and ranking of single pulses identified by PRESTO's single_pulse_search.py.
Usage:
python rrattrap.py [OPTIONS] --inffile <.inf file> <.singlepulse files>
Output:
- groups.txt : a file listing all single pulse groups and thei... | 36,982 | 43.773608 | 218 | py |
presto | presto-master/python/presto/singlepulse/sp_pgplot.py | """
Routine for easy to use 1-D and 2-D plotting using 'PGPLOT'
and the Python 'PPGPLOT' package
Written by Scott M. Ransom (ransom@cfa.harvard.edu)
last revision: 01 Jul 2000
'PGPLOT' was writtten by Tim Pearson <tjp@astro.caltech.edu>,
and can be found at http://astro.caltech.edu/~tjp/pgplot/
... | 12,414 | 42.25784 | 93 | py |
presto | presto-master/python/presto/singlepulse/__init__.py | from presto.singlepulse import spio
from presto.singlepulse import bary_and_topo
from presto.singlepulse import read_spd
from presto.singlepulse import spcand
from presto.singlepulse import sp_pgplot
from presto.singlepulse import rrattrap_config
from presto.singlepulse import rrattrap
#from presto.singlepulse import m... | 368 | 35.9 | 46 | py |
presto | presto-master/python/presto/singlepulse/plot_spd.py | #! /usr/bin/env python
"""
plot_spd.py
Generate spd plots either using information from the .spd files that are generated by make_spd.py.
Usage: plot_spd.py [OPTIONS] <.spd file> <.singlepulse files (optional:
if not provided, will leave DM vs Time window blank).>
Chitrang ... | 29,248 | 52.083485 | 153 | py |
presto | presto-master/python/presto/singlepulse/rrattrap_config.py | #! /usr/bin/env python
from builtins import range
CLOSE_DM = 2 # pc cm-3
# MIN_GROUP, DM_THRESH, TIME_THRESH will change later on depending on the DDplan.
MIN_GROUP = 50 #minimum group size that is not considered noise
TIME_THRESH = 0.1
DM_THRESH = 0.5
MIN_SIGMA = 8.0
PLOT = True
PLOTTYPE = 'pgplot' # 'pgplot' or 'mat... | 1,473 | 35.85 | 93 | py |
presto | presto-master/python/presto/singlepulse/read_spd.py | from builtins import object
import numpy as _np
from scipy.special import erf as _erf
import sys
class spd(object):
"""
A class for reading in single pulse files.
A quick description of each item in the class:
data_zerodm
A 2D freq-vs-time array around the pulse, not dedispersed (zero-DM'd ... | 9,961 | 41.033755 | 112 | py |
presto | presto-master/python/presto/singlepulse/make_spd.py | #!/usr/bin/env python
"""
make_spd.py
Make single pulse plots which include the waterfall plots and dedispersed time series with Zero-DM On/Off.
Also includes Signal-to-noise vs DM and DM vs Time subplots.
Usage on the command line:
python make_spd.py [OPTIONS] <psrfits file> <singlepulse files>
Chitrang Patel - Ma... | 33,809 | 58.211909 | 165 | py |
presto | presto-master/python/fftfit_src/test_fftfit.py | from __future__ import print_function
#>>> print fftfit.__doc__
#This module 'fftfit' is auto-generated with f2py (version:2.13.175-1250).
#Functions:
# zbrent = zbrent(x1,x2,f1,f2,tol,tmp,pha,nsum)
# dchisqr = dchisqr(tau,tmp,r,nsum)
# cprof(y,c,amp,pha,nmax=len(y),nh=(len(c)-1))
# fccf(amp,pha,shift)
# ffft(d,np... | 921 | 35.88 | 94 | py |
presto | presto-master/python/wrappers/presto.py | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.1.0
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... | 22,317 | 45.11157 | 215 | py |
presto | presto-master/python/ppgplot_src/__init__.py | from _ppgplot import *
| 23 | 11 | 22 | py |
presto | presto-master/bin/GBT350_drift_search.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import zip
from builtins import str
from builtins import range
from builtins import object
from operator import attrgetter
import glob, os, os.path, shutil, socket, tarfile, stat
import numpy, sys, time
from presto import sigproc
from presto impo... | 28,008 | 46.392555 | 116 | py |
presto | presto-master/bin/sum_profiles.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import zip
from builtins import range
import getopt, sys
import os.path
from presto import fftfit
from presto import psr_utils
from presto import sinc_interp
from presto import Pgplot
import numpy as Num
from presto.prepfold import pfd
from prest... | 15,054 | 37.901809 | 92 | py |
presto | presto-master/bin/combine_weights.py | #!/bin/env python
import numpy as num
import sys
if len(sys.argv)==1:
print("usage: combine_weights.py INPUT_rfifind.weight_FILES")
sys.exit()
wgts = None
for name in sys.argv[1:]:
tmpwgts = num.loadtxt(name, dtype=num.int32, comments="#",
usecols=(1,), unpack=True)
if wgts ... | 1,009 | 27.857143 | 72 | py |
presto | presto-master/bin/get_TOAs.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import range
import getopt, sys
from presto import fftfit
from presto import psr_utils
import numpy as Num
from presto.prepfold import pfd
from presto.polycos import polycos
from presto.psr_constants import *
scopes = {'GBT':'1',
'Arec... | 17,047 | 40.886978 | 181 | py |
presto | presto-master/bin/pyplotres.py | #!/usr/bin/env python
# A simple command line version of plotres written in python
# using matplotlib and numpy
#
# Patrick Lazarus, Feb 26th, 2009
# Many other tweaks by S. Ransom, T. Pennucci et al over years
#
from __future__ import print_function
from __future__ import absolute_import
from builtins import input
... | 28,009 | 37.687845 | 134 | py |
presto | presto-master/bin/simple_zapbirds.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import str
from builtins import range
from builtins import object
import sys
import os
import numpy as np
import presto.infodata as pi
import presto.presto as pp
scopes = {"gbt": "GB", "arecibo": "AO", "vla": "VL", "parkes": "PK",
"jodrell"... | 10,606 | 36.613475 | 84 | py |
presto | presto-master/bin/waterfaller.py | #!/usr/bin/env python
"""
waterfaller.py
Make waterfall plots to show frequency sweep of a single pulse.
Reads PSRFITS or SIGPROC filterbank format files.
Patrick Lazarus - Aug. 19, 2011
Paul Scholz - Nov 2015
"""
import optparse
import matplotlib.pyplot as plt
import matplotlib.cm
import numpy as np
from presto... | 17,088 | 41.50995 | 97 | py |
presto | presto-master/bin/dat2tim.py | #!/usr/bin/env python
from __future__ import print_function
import os, struct, sys
from presto import presto
telescope_ids = {"Fake": 0, "Arecibo": 1, "Ooty": 2, "Nancay": 3,
"Parkes": 4, "Jodrell": 5, "GBT": 6, "GMRT": 7,
"Effelsberg": 8}
machine_ids = {"FAKE": 0, "PSPM": 1, "Wapp":... | 2,486 | 34.028169 | 86 | py |
presto | presto-master/bin/gotocand.py | #!/usr/bin/env python
import sys
import os
import os.path
import glob
import string
import re
from subprocess import Popen, PIPE, STDOUT
from presto.presto import fourierprops, get_rzw_cand
short_re = re.compile("_\d\d\dM_\d\d_ACCEL_")
def determine_dt(candfile):
for line in open(candfile, 'r', encoding='utf-8'):... | 6,431 | 33.031746 | 93 | py |
presto | presto-master/bin/event_peak.py | #!/usr/bin/env python
from __future__ import print_function
import numpy as num
import sys
import presto.events as evts
from presto import kuiper
from presto.Pgplot import *
if len(sys.argv) != 2:
print("\nusage: {} file\n".format(sys.argv[0]))
sys.exit(1)
def calc_phases(events, f, fd):
return num.fmod... | 2,281 | 25.847059 | 71 | py |
presto | presto-master/bin/PALFA_presto_search.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import zip
from builtins import str
from builtins import range
from builtins import object
from operator import attrgetter
import glob, os, os.path, socket, struct, sys, time, tarfile
import numpy
from presto import psr_utils
from presto import p... | 27,092 | 43.19739 | 137 | py |
presto | presto-master/bin/quick_prune_cands.py | #!/usr/bin/env python
import sys
from presto import sifting
if len(sys.argv) < 2:
sys.stderr.write("\nusage: quick_prune_cands.py ACCEL_file_name [sigma]\n\n")
sys.exit()
if len(sys.argv)==3:
sifting.sigma_threshold = float(sys.argv[2])
cands = sifting.read_candidates([sys.argv[1]], track=True)
cands.p... | 356 | 21.3125 | 82 | py |
presto | presto-master/bin/GBT350_drift_prep.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import range
import sys, os, random
from presto import sigproc
from presto import psr_utils as pu
def spigot_samples_per_file(spigot_filenm):
"""
spigot_samples_per_file(spigot_filenm,):
Return the number of samples present in t... | 4,079 | 36.777778 | 77 | py |
presto | presto-master/bin/chooseN.py | #!/usr/bin/env python
from __future__ import (print_function,division)
import presto.psr_utils as pu
import sys
from presto.infodata import infodata
if len(sys.argv) != 2:
print("chooseN <file.inf|numpoints>")
print(" Prints a good value for fast FFTs to be used for -numout in prepdata/prepsubband")
sys... | 656 | 26.375 | 101 | py |
presto | presto-master/bin/fit_circular_orbit.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import range
import sys
import numpy as num
from presto import psr_utils as pu
from presto import psr_constants as pc
from presto import parfile
from presto import bestprof
import matplotlib.pyplot as plt
from scipy.optimize import leastsq
perio... | 3,056 | 30.515464 | 87 | py |
presto | presto-master/bin/subband_smearing.py | #!/usr/bin/env python
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as num
import presto.psr_utils as pu
def subband_smear(DM, subDM, subBW, fctr):
"""
subband_smear(DM, subDM, subBW, fctr):
Return the smearing in ms caused by subbanding at DM='DM' given
sub... | 4,664 | 33.813433 | 72 | py |
presto | presto-master/bin/DDplan.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
from builtins import zip
import numpy as np
from presto.Pgplot import *
import presto.filterbank as fil
import presto.psrfits as pfits
class observation(object):
def __init__(self, dt, f_ctr, BW, numchan, cDM):
... | 27,675 | 40.806647 | 122 | py |
presto | presto-master/bin/quickffdots.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import range
from presto.infodata import *
from presto.presto import ffdot_plane, spectralpower
from pylab import *
import numpy as N
import sys
numharm = 4
# Contour values as a fraction of max in "window"
rel_convals = N.asarray([0.5, 0.8, 0.... | 4,717 | 30.878378 | 74 | py |
presto | presto-master/bin/rrattrap.py | ../python/presto/singlepulse/rrattrap.py | 40 | 40 | 40 | py |
presto | presto-master/bin/makezaplist.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import str
from builtins import range
from builtins import object
import sys
from operator import attrgetter
from presto.presto import read_inffile, binary_velocity, psrepoch
class bird(object):
def __init__(self, freq, width, bary=0):
... | 4,050 | 35.495495 | 85 | py |
presto | presto-master/bin/injectpsr.py | #!/usr/bin/env python
"""Inject a fake pulsar into real data, creating
a filterbank file.
Patrick Lazarus, June 26, 2012
"""
from __future__ import print_function
from builtins import zip
from builtins import object
import sys
import argparse
import warnings
import copy
import numpy as np
import scipy.integrate
impo... | 48,866 | 37.387274 | 94 | py |
presto | presto-master/bin/psrfits2fil.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import range
import numpy as np
from presto import psrfits
from presto import filterbank
from presto import sigproc
import optparse
import sys
import os
import time
def translate_header(psrfits_file):
fits_hdr = psrfits_file.header
subi... | 6,102 | 37.626582 | 91 | py |
presto | presto-master/bin/GBNCC_search.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import zip
from builtins import str
from builtins import range
from builtins import object
from operator import attrgetter
import glob, os, os.path, shutil, socket, tarfile, stat
import numpy, sys, time
from presto import presto
from presto impor... | 27,528 | 44.729236 | 134 | py |
presto | presto-master/bin/detrend_dat.py | #!/usr/bin/env python
import os, sys
import numpy as np
from astropy.stats import sigma_clip
import scipy.signal
if len(sys.argv) != 2:
print("\nusage: {} file\n".format(sys.argv[0]))
sys.exit(1)
os.rename(sys.argv[1], sys.argv[1]+".bak")
data = np.fromfile(sys.argv[1]+".bak", dtype=np.float32)
N = len(data)
... | 779 | 22.636364 | 72 | py |
presto | presto-master/bin/pygaussfit.py | #!/usr/bin/env python
import os
import sys
from presto.psr_utils import gaussian_profile, read_profile
from matplotlib.patches import Rectangle
from presto.bestprof import bestprof
import matplotlib.pyplot as plt
import numpy as np
from presto import mpfit
import subprocess
class GaussianSelector(object):
def __in... | 13,567 | 40.240122 | 88 | py |
presto | presto-master/bin/filter_zerolags.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import range
import numpy as N
import sys, scipy.io, scipy.signal
if len(sys.argv) != 2:
print("\nusage: {} file\n".format(sys.argv[0]))
sys.exit(1)
plot=0
infilenm = sys.argv[1]
basename = infilenm[:infilenm.find(".zerolags")]
dt =... | 2,984 | 26.638889 | 87 | py |
presto | presto-master/bin/fitorb.py | #!/usr/bin/env python
"""
fitorb: A non-linear optimizer for solving pulsar orbits by Ryan Lynch
"""
from __future__ import print_function
from builtins import range
from numpy import *
from presto.mpfit import mpfit
from presto.psr_constants import SECPERDAY,TWOPI,DEGTORAD,SOL
from presto import psr_utils
from prest... | 20,742 | 31.563579 | 115 | py |
presto | presto-master/bin/powerstats.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import input
from presto.events import *
def answer_yes(question):
yes = ['', 'Y', 'y', 'Yes', 'yes', 'YES',
'T', 't', 'True', 'true', 'TRUE']
return input('\n'+question) in yes
def ask_float(question, default=None):
wh... | 5,220 | 39.161538 | 78 | py |
presto | presto-master/bin/orbellipsefit.py | #!/usr/bin/env python
# Fit an ellipse to a set of measured Periods and Accelerations to get an initial orbit estimate
# This uses the methods of Freire et al. (2001)
# This code written by Paul Ray <paul.ray@nrl.navy.mil
# Inputs are a set of .bestprof files or .par files from which the P0 and P1 (or F0 and F1) values... | 10,203 | 31.393651 | 118 | py |
presto | presto-master/bin/weights_to_ignorechan.py | #!/usr/bin/env python
import numpy as np
import sys
#import optparse
def read_weights(filename):
"""
reat_weights(filename):
Read the channels and weights from a .weights text file.
"""
chans, weights = np.loadtxt(filename, unpack=True)
return chans.astype(np.int64), weights.astype(np.float6... | 2,250 | 27.1375 | 89 | py |
presto | presto-master/bin/rfifind_stats.py | #!/usr/bin/env python
import sys
import argparse
from presto import rfifind
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("statsfile", type=str, help="rfifind .stats file to compute the channel mask")
parser.add_argument("--fpower", type=float,
de... | 2,335 | 47.666667 | 113 | py |
presto | presto-master/bin/single_pulse_search.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import str, zip
from optparse import OptionParser
import bisect, os, sys, glob
import numpy as np
import scipy, scipy.signal, scipy.stats
from presto.presto import rfft, next2_to_n
from presto import infodata
from presto.Pgplot import *
# This i... | 31,275 | 44.261939 | 95 | py |
presto | presto-master/bin/tim2dat.py | #!/usr/bin/env python
from __future__ import print_function
import astropy.coordinates as coords
from builtins import str
import os
import os.path
import argparse
import sys
import getpass
import numpy as np
from presto import sigproc
BLOCKSIZE = 10000 # Amount of data to copy at a time
# from inpu... | 6,508 | 40.196203 | 81 | py |
presto | presto-master/bin/fb_truncate.py | #!/usr/bin/env python
"""
A script to truncate a filterbank file in time/frequency.
Patrick Lazarus, Aug 27, 2012
"""
from __future__ import print_function
import sys
import copy
from argparse import ArgumentParser
import numpy as np
from presto import filterbank
BLOCKSIZE = 1e5 # Number of spectra to manipulate at... | 5,544 | 38.049296 | 89 | py |
presto | presto-master/bin/downsample_filterbank.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import range
import sys
import numpy as num
from presto import sigproc
if __name__ == "__main__":
if len(sys.argv)==1:
print("\nusage: downsample_filterbank_hdr.py DS_fact infile.fil\n")
sys.exit()
DS_fact = int(sys.arg... | 1,777 | 25.939394 | 76 | py |
presto | presto-master/bin/pulsestack.py | #!/usr/bin/env python
#
# Script to fold the profile from the dat-file and plot it
# or to plot the time series, or plot the stack of individual
# pulses or subintegrations in different modes
# Also added functionality to use the tim-file in Sigproc-style
# format, and any other raw binary (float) data files
# if corre... | 57,353 | 37.236 | 131 | py |
presto | presto-master/bin/plot_spd.py | #! /usr/bin/env python
from presto.singlepulse.plot_spd import main
if __name__ == '__main__':
main()
| 107 | 17 | 44 | py |
presto | presto-master/bin/psrfits_quick_bandpass.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import zip
import numpy as np
import matplotlib.pyplot as plt
import sys
from presto import psrfits
from optparse import OptionParser
usage = """usage: %prog [options] PSRFITS_FILEs
Calculate the average and stdev bandpass of PSRFITS search data... | 4,103 | 43.129032 | 90 | py |
presto | presto-master/bin/pfd_for_timing.py | #!/usr/bin/env python
from __future__ import print_function
import sys
from presto import prepfold
if len(sys.argv) == 1:
sys.stderr.write("""usage: pfd_for_timing.py PFDFILES\n
This script returns 'true' or 'false' if a .pfd file can be
used for timing via get_TOAs.py or not.\n""")
sys.exit(0)
for ... | 589 | 25.818182 | 63 | py |
presto | presto-master/bin/GUPPI_drift_prep.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import range
import sys, os, random
from astropy.io import fits
from presto import sigproc
from presto import psr_utils as pu
import math as math
def guppi_subint_per_file(guppi_filenm):
"""
guppi_samples_per_file(spigot_filenm,):
... | 4,721 | 35.604651 | 111 | py |
presto | presto-master/bin/guppidrift2fil.py | #!/usr/bin/env python
#Begun on 2/13/2014 from a copy of psrfits2fil.py //NEG-D//
from __future__ import print_function
from builtins import range
import numpy as np
from astropy.io import fits as pyfits
from presto import filterbank
import optparse
import sys
import os
import time
from math import *
# 2/13/2014 //NEG... | 12,480 | 37.403077 | 84 | py |
presto | presto-master/bin/sortwappfiles.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import range
import sys, re
maxwappnum = 7
wappfiles = {}
for filename in sys.argv[1:]:
for wappnum in range(1, maxwappnum + 1):
if ((wappnum == 1 and re.search("\.wapp\.", filename)) or \
(wappnum > 1 and re.search("... | 794 | 29.576923 | 80 | py |
presto | presto-master/bin/make_spd.py | #!/usr/bin/env python
"""
make_spd.py
Make single pulse plots which include the waterfall plots and dedispersed time series with Zero-DM On/Off.
Also includes Signal-to-noise vs DM and DM vs Time subplots.
Usage on the command line:
python make_spd.py [OPTIONS] <psrfits file> <singlepulse files>
Chitrang Patel - Ma... | 34,019 | 59 | 165 | py |
presto | presto-master/tests/dedisp.py | import os
# To use this script to help you dedisperse a bunch of time series, first
# run DDplan.py with appropriate values for your data to generate a
# dedispersion plan:
#
# sransom@foops:~$ DDplan.py -d 200 -t 0.000072 -s 32 -n 96 -b 48.0 -f 820.0
#
# Minimum total smearing : 0.102 ms
# -----------------------... | 2,855 | 35.151899 | 94 | py |
presto | presto-master/tests/test_presto_python.py | from __future__ import print_function
import numpy as np
from presto import presto
import os
from os import path
here = path.dirname(__file__)
print("Testing FFT stuff...", end=' ')
N = 20
x = np.random.standard_normal(N)
nx = presto.rfft(presto.rfft(x, -1), 1)
assert(np.allclose(x, nx, atol=1e-6))
print("success")
... | 6,786 | 32.766169 | 85 | py |
presto | presto-master/tests/test_max_rzw_harmonics.py | import sys
import time
import numpy as np
from numpy.random import standard_normal as norm
from numpy.random import uniform
from presto import presto
if sys.version_info[0]<3:
clk = time.clock
else:
clk = time.perf_counter
N = 2**17
noiseamp = 1.0
numharm = 1
numtrials = 100
us = np.arange(N, dtype=np.float6... | 3,039 | 36.530864 | 93 | py |
presto | presto-master/tests/test_binary_calcs.py | import numpy as np
from presto import presto
from presto import binary_psr
import matplotlib.pyplot as plt
N = 1000 # number of points in each orbit calc
ma = np.arange(float(N))*2.0/N
# This is going for Figure 1 in Hulse & Taylor 1975
psr1 = presto.psrepoch("B1913+16", 42320.0)
# unfortunatey, OMDOT is not in the b... | 1,372 | 28.847826 | 66 | py |
presto | presto-master/tests/python/cvec.py | from __future__ import print_function
from Numeric import *
from cvects import *
def carr(n):
return complex_arr(n)
def multcarr(a, val):
mult_arr(a, val, len(a))
a = open("cvects.h", "r")
print(get_filelen(a))
a.close()
d = arange(10, typecode='d')
print(d)
dgenrotate_1d(d, len(d), 3.5)
print(d)
print(dsta... | 400 | 15.04 | 37 | py |
presto | presto-master/examplescripts/ffdot_example.py | from __future__ import print_function
import numpy as num
from presto import presto
import presto.ppgplot as ppgplot
from presto.Pgplot import pgpalette
from numpy.random import standard_normal as norm
import time
N = 2**14
r = N/4.0 # average freq over "observation"
#r = N/4.0 + 0.5 # average freq over "observation"
... | 3,978 | 33.903509 | 81 | py |
presto | presto-master/examplescripts/pdm2raw.py | from __future__ import print_function
from numpyio import fread, fwrite
from sys import argv
print("\nReading info from %s.hdr and" % argv[1])
print("%s.dat\n" % argv[1])
print("Writing %s.raw\n" % argv[1])
HEADERLEN = 640
BLOCKLEN = 49152
# Read the header file
file = open(argv[1]+'.hdr', 'r')
data = fread(file, H... | 722 | 20.909091 | 50 | py |
presto | presto-master/examplescripts/ACCEL_sift.py | from __future__ import absolute_import
from builtins import map
import re
import glob
import presto.sifting as sifting
from operator import itemgetter, attrgetter
# Note: You will almost certainly want to adjust
# the following variables for your particular search
# glob for ACCEL files
globaccel = "*ACCEL_*0... | 2,805 | 33.219512 | 81 | py |
presto | presto-master/examplescripts/dedisp.py | from __future__ import print_function
from builtins import zip
from builtins import range
import os
# To use this script to help you dedisperse a bunch of time series, first
# run DDplan.py with appropriate values for your data to generate a
# dedispersion plan:
#
# sransom@foops:~$ DDplan.py -d 200 -t 0.000072 -s 32 ... | 3,081 | 35.690476 | 94 | py |
presto | presto-master/examplescripts/jerk_example.py | from __future__ import print_function
import numpy as num
from presto import presto
import presto.ppgplot as ppgplot
import time
from presto.Pgplot import pgpalette
N = 2**14
r = N/4.0 # average freq over "observation"
#r = N/4.0 + 0.5 # average freq over "observation"
rint = num.floor(r)
numbetween = 8
dr = 1.0/numbe... | 5,022 | 34.125874 | 111 | py |
presto | presto-master/examplescripts/full_analysis.py | #!/usr/bin/python
from os import system, chdir, remove, environ
from sys import stdout, argv, exit
from glob import glob
from optparse import OptionParser
from fcntl import *
def myexecute(cmd):
stdout.write("\n'"+cmd+"'\n")
stdout.flush()
system(cmd)
def main():
usage = "usage: %prog [options]"
p... | 5,749 | 49.438596 | 141 | py |
presto | presto-master/examplescripts/ppdot_plane_plot.py | #!/usr/bin/env python
from __future__ import print_function
from builtins import zip
import numpy as np
import presto.psr_utils as pu
import presto.pypsrcat as cat
import matplotlib.pyplot as plt
# Use color?
usecolor = True
# Find a list of the "good" pulsars: those not in GCs and with a measured pdot
# Also identi... | 5,371 | 31.361446 | 79 | py |
presto | presto-master/examplescripts/testcorr.py | from __future__ import print_function
from builtins import range
from numpy import *
from Pgplot import *
from presto import *
file = "testz"
displaybins = 20
numbetween = 16
numpts = displaybins * numbetween
# Read the '.mak' file
md = read_makfile(file)
# Open and read the data
fftfile = open(file+".fft","r")
file... | 1,689 | 29.727273 | 71 | py |
presto | presto-master/examplescripts/short_analysis_simple.py | #!/usr/bin/python
from os import system, chdir
from sys import stdout, argv, exit
from glob import glob
from optparse import OptionParser
from presto.presto import read_inffile, writeinf, get_baryv
from presto import infodata
def myexecute(cmd):
stdout.write("\n'"+cmd+"'\n")
stdout.flush()
system(cmd)
d... | 5,094 | 41.458333 | 95 | py |
presto | presto-master/examplescripts/concatdata.py | from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import range
# Binary floating point data file concatenation routine
#
# Written by Scott M. Ransom <ransom@cfa.harvard.edu>
# last revision: 1 Mar 99
#
usage = """
Usage: concatdata outfile num... | 7,616 | 32.262009 | 76 | py |
presto | presto-master/examplescripts/show_zresp.py | from __future__ import print_function
from builtins import range
from numpy import *
from presto.Pgplot import *
from presto.presto import *
kern_half_width = 10
numbetween = 10
numkern = 2 * numbetween * kern_half_width
f = arange(numkern, dtype=float64) / numbetween - kern_half_width
kern = gen_z_response(0.0, numbe... | 843 | 32.76 | 65 | py |
CTAB-GAN-Plus | CTAB-GAN-Plus-main/model/ctabgan.py | """
Generative model training algorithm based on the CTABGANSynthesiser
"""
import pandas as pd
import time
from model.pipeline.data_preparation import DataPrep
from model.synthesizer.ctabgan_synthesizer import CTABGANSynthesizer
import warnings
warnings.filterwarnings("ignore")
class CTABGAN():
def __init__(s... | 2,364 | 41.232143 | 212 | py |
CTAB-GAN-Plus | CTAB-GAN-Plus-main/model/pipeline/data_preparation.py | import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn import model_selection
class DataPrep(object):
def __init__(self, raw_df: pd.DataFrame, categorical: list, log:list, mixed:dict, general:list, non_categorical:list, integer:list, type:dict, test_ratio:float):
... | 6,035 | 45.076336 | 165 | py |
CTAB-GAN-Plus | CTAB-GAN-Plus-main/model/eval/evaluation.py | import numpy as np
import pandas as pd
from sklearn import metrics
from sklearn import model_selection
from sklearn.preprocessing import MinMaxScaler,StandardScaler
from sklearn.neural_network import MLPClassifier
from sklearn.linear_model import LogisticRegression
from sklearn import svm,tree
from sklearn.ensemble im... | 8,160 | 41.284974 | 178 | py |
CTAB-GAN-Plus | CTAB-GAN-Plus-main/model/privacy_utils/rdp_accountant.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import sys
import numpy as np
from scipy import special
import six
########################
# LOG-SPACE ARITHMETIC #
########################
def _log_add(logx, logy):
"""Add two numbers in th... | 8,040 | 27.717857 | 79 | py |
CTAB-GAN-Plus | CTAB-GAN-Plus-main/model/synthesizer/ctabgan_synthesizer.py | import numpy as np
import pandas as pd
import torch
import torch.utils.data
import torch.optim as optim
from torch.optim import Adam
from torch.nn import functional as F
from torch.nn import (Dropout, LeakyReLU, Linear, Module, ReLU, Sequential,
Conv2d, ConvTranspose2d, Sigmoid, init, BCELoss, CrossEntropyLoss,SmoothL1... | 21,711 | 35.186667 | 173 | py |
CTAB-GAN-Plus | CTAB-GAN-Plus-main/model/synthesizer/transformer.py | import numpy as np
import pandas as pd
import torch
from sklearn.mixture import BayesianGaussianMixture
class DataTransformer():
def __init__(self, train_data=pd.DataFrame, categorical_list=[], mixed_dict={}, general_list=[], non_categorical_list=[], n_clusters=10, eps=0.005):
self.meta = None
... | 17,809 | 40.418605 | 152 | py |
AutoCO | AutoCO-main/exp_simulate/dataset/data_nas/data_loader.py | from sklearn.feature_extraction import DictVectorizer
from sklearn.preprocessing import StandardScaler, OneHotEncoder, LabelEncoder
import numpy as np
import random
import re
import json
import pandas as pd
tfs_feature_file = 'raw_data/tfs_features2.txt'
log_file = "raw_data/log_online.txt"
cnt = 0
X_template = []
X_... | 4,021 | 26.360544 | 85 | py |
AutoCO | AutoCO-main/exp_simulate/fm_nas/simulate.py | import io
import os
import time
import pickle
import random
import logging
import datetime
import argparse
import coloredlogs
import numpy as np
import pandas as pd
from torch.utils.data import WeightedRandomSampler
from policy import FmEGreedy, Random, Greedy, FmGreedy, LinUCB, FmThompson, TS
logger = logging.getLo... | 9,990 | 37.724806 | 122 | py |
AutoCO | AutoCO-main/exp_simulate/fm_nas/utils.py | from collections import defaultdict
import torch
from torch.optim.optimizer import Optimizer
class FTRL(Optimizer):
""" Implements FTRL online learning algorithm.
Arguments:
params (iterable): iterable of parameters to optimize or dicts defining
parameter groups
alpha (float, opti... | 4,886 | 33.907143 | 99 | py |
AutoCO | AutoCO-main/exp_simulate/fm_nas/model.py | import torch
import torch.nn as nn
import torch.distributions.normal as normal
import torch.nn.functional as F
import math
import time
import numpy as np
import random
from torch.autograd import Variable
PRIMITIVES = ['concat', 'multiply', 'max', 'min', 'plus']
# PRIMITIVES = ['zero', 'max', 'min', 'multiply', 'plus', ... | 27,434 | 44.123355 | 197 | py |
AutoCO | AutoCO-main/exp_simulate/fm_nas/policy.py | import time
import torch
import pickle
import numpy as np
import pandas as pd
from torch.utils.data import WeightedRandomSampler
from train import Core
from train_arch import Train_Arch
from model import Linucb
def get_creative(params):
"return global creative list, and item-creatives dict"
with open(params... | 14,589 | 39.082418 | 239 | py |
AutoCO | AutoCO-main/exp_simulate/fm_nas/utils_gen.py | from train import Core
from train_arch import Train_Arch
import argparse
import pickle
import numpy as np
import torch
dataset_name = "data_nas"
def gen_simulation_ctr():
c_list = None
with open("raw_data/"+dataset_name+"/creative_list.pkl", 'rb') as f:
c_list = pickle.load(f)
c_list = np.array(c_... | 3,692 | 30.29661 | 88 | py |
AutoCO | AutoCO-main/exp_simulate/fm_nas/ctr.py | import numpy as np
import pandas as pd
import torch.utils.data
import itertools
import tqdm
import time
def get_index(dataset, dense_list=None):
emb_index = []
cnt = 0
dim = 0
for i in range(len(dataset)):
emb_index.append(dict())
if i in dense_list:
dim += 1
co... | 3,515 | 29.310345 | 101 | py |
AutoCO | AutoCO-main/exp_simulate/fm_nas/train_arch.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import argparse
from model import NAS, NAS_TS, SNAS, DSNAS, SNAS_TS, DSNAS_TS
from ctr import TfsDataset, DirectDataset, DenseDataset
from torch.utils.data import DataLoader
import time
from utils import DataPrefetcher
from sklearn.me... | 15,572 | 42.744382 | 143 | py |
AutoCO | AutoCO-main/exp_simulate/fm_nas/train.py | import os
import time
import torch
import pickle
import numpy as np
import torch.nn.functional as F
from sklearn.metrics import roc_auc_score, log_loss
from torch.utils.data import DataLoader
from ctr import TfsDataset, DirectDataset, DenseDataset
from model import OFM, OFM_TS
from utils import cal_group_auc, FTRL
o... | 11,347 | 39.820144 | 121 | py |
AutoCO | AutoCO-main/exp_public/mushroom/data/simulate_process.py | import numpy as np
import pandas as pd
data = pd.read_csv("data.txt", header=None)
data.columns = ["label", "cap-shape", "cap-surface", "cap-color", "bruises", "odor", "gill-attachment",
"gill-spacing", "gill-size", "gill-color", "stalk-shape", "stalk-root", "stalk-surface-above-ring",
... | 1,784 | 41.5 | 135 | py |
AutoCO | AutoCO-main/exp_public/mushroom/simulate/main.py | import os
import sys
import glob
import numpy as np
import torch
import logging
import argparse
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.utils
import torch.nn.functional as F
from torch.autograd import Variable
import time
import utils
from train import train
from vartional_model import D... | 13,976 | 50.386029 | 137 | py |
AutoCO | AutoCO-main/exp_public/mushroom/simulate/utils.py | import numpy as np
import pandas as pd
import os
import os.path
import sys
import shutil
import torch
import torch.nn as nn
import torch.utils
from sklearn.preprocessing import StandardScaler
from sklearn.feature_extraction import DictVectorizer
from sklearn.utils import shuffle
from torch.utils.data import Dataset, Da... | 6,504 | 43.554795 | 98 | py |
AutoCO | AutoCO-main/exp_public/mushroom/simulate/models.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
import utils
import time
PRIMITIVES_BINARY = ['plus', 'multiply', 'max', 'min', 'concat']
PRIMITIVES_NAS = [0, 2, 4, 8, 16]
SPACE_NAS = pow(len(PRIMITIVES_NAS), 5)
OPS = {
'plus': lambda p, q: ... | 29,059 | 42.897281 | 165 | py |
AutoCO | AutoCO-main/exp_public/mushroom/simulate/baseline.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
import utils
from collections import Counter
from torch.distributions.multivariate_normal import MultivariateNormal
PRIMITIVES_BINARY = ['plus', 'multiply', 'max', 'min', 'concat']
PRIMITIVES_NAS =... | 37,783 | 46.112219 | 141 | py |
AutoCO | AutoCO-main/exp_public/mushroom/simulate/vartional_model.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
import utils
PRIMITIVES_BINARY = ['plus', 'multiply', 'max', 'min', 'concat']
PRIMITIVES_NAS = [0, 2, 4, 8, 16]
SPACE_NAS = pow(len(PRIMITIVES_NAS), 5)
OPS = {
'plus': lambda p, q: p + q,
'... | 50,650 | 49.905528 | 176 | py |
AutoCO | AutoCO-main/exp_public/mushroom/simulate/train.py | import numpy as np
import time
def train(train_queue, model, optimizer, arch_optimizer, logging):
rewards_all = []
losses_all = []
for step, features in enumerate(train_queue):
rewards = model.recommend(features)
rewards_all.append(rewards)
losses = model.step(optimizer, arch_optimizer, step)
losses_all.app... | 608 | 32.833333 | 66 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.