repo stringlengths 2 99 | file stringlengths 14 239 | code stringlengths 20 3.99M | file_length int64 20 3.99M | avg_line_length float64 9.73 128 | max_line_length int64 11 86.4k | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
presto | presto-master/python/presto/prepfold.py | from __future__ import print_function
from __future__ import absolute_import
from builtins import range
from builtins import object
import sys
import numpy as Num
import copy, random, struct
from presto import psr_utils, infodata, polycos, Pgplot
import six
import numbers
from presto.bestprof import bestprof
from prest... | 41,422 | 46.071591 | 103 | py |
presto | presto-master/python/presto/injectpsr.py |
"""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
import scipy.interpolate
i... | 48,769 | 37.371361 | 94 | py |
presto | presto-master/python/presto/fftfit.py | from _fftfit import * | 21 | 21 | 21 | py |
presto | presto-master/python/presto/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/
... | 29,817 | 41.965418 | 81 | py |
presto | presto-master/python/presto/polycos.py | from __future__ import absolute_import
from builtins import range
from builtins import object
import os
import sys
import subprocess
from presto import parfile
import numpy as Num
# Constants
NUMCOEFFS_DEFAULT = 12
SPAN_DEFAULT = 60 # span of each polyco in minutes
# Telescope name to TEMPO observatory code conversi... | 10,605 | 36.878571 | 92 | py |
presto | presto-master/python/presto/kuiper.py | from __future__ import print_function
from __future__ import absolute_import
from builtins import range
import numpy as num
from presto import Pgplot
from functools import reduce
def noverk(n,k):
# This is the combinations formula
return float(reduce(lambda a,b: a*(n-b)/(b+1), range(k),1))
def Tt(t, z, N):
... | 4,426 | 32.793893 | 87 | py |
presto | presto-master/python/presto/residuals.py | from __future__ import print_function
from builtins import range
from builtins import object
import struct
import numpy as Num
# From the TEMPO Documentation:
#
# The file resid2.tmp contains residuals, etc. in inary format.
# Each record contains eight real*8 values:
# --TOA (MJD, referenced to solar syst... | 3,668 | 38.451613 | 97 | py |
presto | presto-master/python/presto/simple_roots.py | from __future__ import print_function
from builtins import range
# 'Safe' Newton-Raphson and Secant method
# for numerical root-finding
def bisect(func, lox, hix, TOL=1e-14, MAXIT=200):
"""
bisect(func, lox, hix, TOL=1e-14, MAXIT=200):
Try to find a root between 'lox' and 'hix' using a simple
... | 3,967 | 29.75969 | 78 | py |
presto | presto-master/python/presto/bestprof.py | from builtins import object
## Automatically adapted for numpy Apr 14, 2006 by convertcode.py
import numpy as num
def get_epochs(line):
i, f = line.split("=")[-1].split(".")
f = "0."+f
epochi = float(i)
epochf = float(f)
# Check to see if it is very close to 1 sec
# If it is, assume the epoch ... | 5,982 | 42.671533 | 93 | py |
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 |
"""
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
from builtins import rang... | 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 |
"""
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 *
import numpy as Num
from pre... | 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/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/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 |
"""
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 - May. 21, 2015 -- Updated... | 33,809 | 58.211909 | 165 | py |
presto | presto-master/bin/GBT350_drift_search.py | 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 import sifting
from presto... | 28,008 | 46.392555 | 116 | py |
presto | presto-master/bin/sum_profiles.py | 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 presto.psr_constants import... | 15,054 | 37.901809 | 92 | py |
presto | presto-master/bin/combine_weights.py | 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 is None:
w... | 1,009 | 27.857143 | 72 | py |
presto | presto-master/bin/get_TOAs.py | 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',
'Arecibo':'3',
'P... | 17,047 | 40.886978 | 181 | py |
presto | presto-master/bin/pyplotres.py |
# 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
from builtins import str
f... | 28,009 | 37.687845 | 134 | py |
presto | presto-master/bin/simple_zapbirds.py |
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": "JB", "gb43m": "G1",... | 10,606 | 36.613475 | 84 | py |
presto | presto-master/bin/waterfaller.py |
"""
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 import psr_utils
from... | 17,088 | 41.50995 | 97 | py |
presto | presto-master/bin/dat2tim.py | 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,"AOFTM": 3,
... | 2,486 | 34.028169 | 86 | py |
presto | presto-master/bin/gotocand.py | 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'):
if line.start... | 6,431 | 33.031746 | 93 | py |
presto | presto-master/bin/event_peak.py | 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(events*(f+(0.5*fd*eve... | 2,281 | 25.847059 | 71 | py |
presto | presto-master/bin/PALFA_presto_search.py | 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 presto
from presto impo... | 27,092 | 43.19739 | 137 | py |
presto | presto-master/bin/quick_prune_cands.py | 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.print_cand_summary()
ca... | 356 | 21.3125 | 82 | py |
presto | presto-master/bin/GBT350_drift_prep.py | 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 the Spigot FITs file.
... | 4,079 | 36.777778 | 77 | py |
presto | presto-master/bin/chooseN.py | 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.exit(1)
if sys.argv[... | 656 | 26.375 | 101 | py |
presto | presto-master/bin/fit_circular_orbit.py | 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
period = num.asarray([])
ti... | 3,056 | 30.515464 | 87 | py |
presto | presto-master/bin/subband_smearing.py | 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
subbands of bandwidth 'su... | 4,664 | 33.813433 | 72 | py |
presto | presto-master/bin/DDplan.py | 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):
# dt in sec, f_ctr ... | 27,675 | 40.806647 | 122 | py |
presto | presto-master/bin/quickffdots.py | 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.95, 0.995])
rel_alphas... | 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 |
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):
self.freq = freq
... | 4,050 | 35.495495 | 85 | py |
presto | presto-master/bin/injectpsr.py |
"""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
import scipy.interpolate
i... | 48,866 | 37.387274 | 94 | py |
presto | presto-master/bin/psrfits2fil.py |
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
subint_hdr = psrfits_file.... | 6,102 | 37.626582 | 91 | py |
presto | presto-master/bin/GBNCC_search.py | 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 import sifting
import astro... | 27,528 | 44.729236 | 134 | py |
presto | presto-master/bin/detrend_dat.py | 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)
nblocks = 10000
data.... | 779 | 22.636364 | 72 | py |
presto | presto-master/bin/pygaussfit.py | 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 __init__(self, ax, profile... | 13,567 | 40.240122 | 88 | py |
presto | presto-master/bin/filter_zerolags.py | 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 = 0.00008192
flo =... | 2,984 | 26.638889 | 87 | py |
presto | presto-master/bin/fitorb.py |
"""
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 presto import parfile
from ... | 20,742 | 31.563579 | 115 | py |
presto | presto-master/bin/powerstats.py | 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):
while 1:
ans = i... | 5,220 | 39.161538 | 78 | py |
presto | presto-master/bin/orbellipsefit.py | # 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)
# Inputs are a set of .bestprof files or .par files from which the P0 and P1 (or F0 and F1) values
# and their errors are read. It can ignore points with too large an F1 erro... | 10,203 | 31.393651 | 118 | py |
presto | presto-master/bin/weights_to_ignorechan.py | 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.float64)
def build_chanline... | 2,250 | 27.1375 | 89 | py |
presto | presto-master/bin/rfifind_stats.py | 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,
default=200,
... | 2,335 | 47.666667 | 113 | py |
presto | presto-master/bin/single_pulse_search.py | 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 is for Python 2/3 compt... | 31,275 | 44.261939 | 95 | py |
presto | presto-master/bin/tim2dat.py | 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 input file to output file ... | 6,508 | 40.196203 | 81 | py |
presto | presto-master/bin/fb_truncate.py |
"""
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 once
def main(args... | 5,544 | 38.049296 | 89 | py |
presto | presto-master/bin/downsample_filterbank.py | 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.argv[1])
basefilenm =... | 1,777 | 25.939394 | 76 | py |
presto | presto-master/bin/pulsestack.py | # 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 corresponding info is provide... | 57,353 | 37.236 | 131 | py |
presto | presto-master/bin/plot_spd.py | from presto.singlepulse.plot_spd import main
if __name__ == '__main__':
main()
| 107 | 17 | 44 | py |
presto | presto-master/bin/psrfits_quick_bandpass.py | 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"""
def write_bandpas... | 4,103 | 43.129032 | 90 | py |
presto | presto-master/bin/pfd_for_timing.py | 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 pfdfile in sys.argv[1:... | 589 | 25.818182 | 63 | py |
presto | presto-master/bin/GUPPI_drift_prep.py | 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,):
Return the number o... | 4,721 | 35.604651 | 111 | py |
presto | presto-master/bin/guppidrift2fil.py |
#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-D///
import pyslalib.... | 12,480 | 37.403077 | 84 | py |
presto | presto-master/bin/sortwappfiles.py | 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("\.wapp%d?\." % wappnum... | 794 | 29.576923 | 80 | py |
presto | presto-master/bin/make_spd.py |
"""
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 - May. 21, 2015 -- Updated... | 34,019 | 59 | 165 | 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 -n... | 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 | 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 identify which pulsars are "... | 5,371 | 31.361446 | 79 | 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
# last revision: 1 Mar 99
usage = """
Usage: concatdata outfile numpts padval infile1 infile2 ...
This routine helps prop... | 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/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 the log space."""
a, b = min(logx, logy), max(logx... | 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/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 |
AutoCO | AutoCO-main/exp_public/adult/data/process.py | import pandas as pd
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score
data1 = pd.read_csv("./adult.data",header=None)
data2 = pd.read_csv("./adult.test",header=None)
data = pd.concat([data1, data2], axis=0)
data.columns = ["age", "workclass", "fnlwgt", "ed... | 1,767 | 44.333333 | 154 | py |
AutoCO | AutoCO-main/exp_public/adult/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... | 4,315 | 36.206897 | 126 | py |
AutoCO | AutoCO-main/exp_public/adult/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,058 | 42.962179 | 165 | py |
AutoCO | AutoCO-main/exp_public/adult/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,292 | 45.909434 | 141 | py |
AutoCO | AutoCO-main/exp_public/adult/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
import ipdb
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: ... | 55,609 | 50.730233 | 176 | py |
AutoCO | AutoCO-main/exp_public/adult/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... | 635 | 34.333333 | 71 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.