├── Howto_GPU ├── INSTALL ├── Makefile ├── README ├── README.md ├── bin └── .geomview ├── clig ├── accelsearch.1 ├── accelsearch_cmd.cli ├── bincand.1 ├── bincand_cmd.cli ├── cmdline.cli ├── dftfold.1 ├── dftfold_cmd.cli ├── downsample.1 ├── downsample_cmd.cli ├── mpiprepsubband.1 ├── mpiprepsubband_cmd.cli ├── prepdata.1 ├── prepdata_cmd.cli ├── prepfold.1 ├── prepfold_cmd.cli ├── prepsubband.1 ├── prepsubband_cmd.cli ├── profile.1 ├── profile_cmd.cli ├── readfile.1 ├── readfile_cmd.cli ├── realfft.1 ├── realfft_cmd.cli ├── rednoise.1 ├── rednoise_cmd.cli ├── rfifind.1 ├── rfifind_cmd.cli ├── search_bin.1 ├── search_bin_cmd.cli ├── search_rzw.1 ├── search_rzw_cmd.cli ├── show_pfd.1 ├── show_pfd_cmd.cli ├── spigot2filterbank.1 ├── spigot2filterbank_cmd.cli ├── toas2dat.1 ├── toas2dat_cmd.cli ├── zapbirds.1 └── zapbirds_cmd.cli ├── docs ├── .xvpics │ ├── presto1.jpg │ └── presto2.jpg ├── PRESTO_search_tutorial.odp ├── PRESTO_search_tutorial.pdf ├── a2x.1 ├── accelsearch.1 ├── bincand.1 ├── dftfold.1 ├── downsample.1 ├── mpiprepsubband.1 ├── prepdata.1 ├── prepfold.1 ├── prepsubband.1 ├── presto.tex ├── presto1.jpg ├── presto2.jpg ├── profile.1 ├── readfile.1 ├── realfft.1 ├── rednoise.1 ├── rfifind.1 ├── search_bin.1 ├── search_rzw.1 ├── show_pfd.1 ├── spigot2filterbank.1 ├── toas2dat.1 └── zapbirds.1 ├── include ├── accel.h ├── accel_utils_gpu.h ├── accelsearch_cmd.h ├── bincand_cmd.h ├── bpp.h ├── cdflib.h ├── chkio.h ├── clk_tck.h ├── database.h ├── dftfold.h ├── dftfold_cmd.h ├── downsample_cmd.h ├── f77.h ├── fitsfile.h ├── fitshead.h ├── gmrt.h ├── imio.h ├── makedata.h ├── makeinf.h ├── mask.h ├── meminfo.h ├── misc_utils.h ├── mpiprepsubband_cmd.h ├── multibeam.h ├── multifiles.h ├── orbint.h ├── plot2d.h ├── prepdata_cmd.h ├── prepfold.h ├── prepfold_cmd.h ├── prepsubband_cmd.h ├── presto.h ├── profile_cmd.h ├── psrfits.h ├── randlib.h ├── ransomfft.h ├── rawtype.h ├── rdascat.h ├── readfile_cmd.h ├── realfft_cmd.h ├── rednoise_cmd.h ├── rfifind.h ├── rfifind_cmd.h ├── search_bin_cmd.h ├── search_rzw_cmd.h ├── show_pfd_cmd.h ├── sigproc_fb.h ├── slalib.h ├── slamac.h ├── spigot.h ├── spigot2filterbank_cmd.h ├── toas2dat_cmd.h ├── vectors.h ├── wapp.h ├── wapp_key.h ├── wapp_y.tab.h └── zapbirds_cmd.h ├── lib ├── a2x.ps ├── a2xshell.ps ├── aliases.txt ├── fftw_wisdom.txt ├── goodfactors.txt ├── libpresto.so ├── libsla.so ├── parkes_birds.txt ├── psr_catalog.txt ├── pulsars.cat └── python │ ├── .directory │ ├── PRESTO-0.99.egg-info │ ├── Pgplot.py │ ├── _ppgplot.so │ ├── _presto.so │ ├── barycenter.py │ ├── bestprof.py │ ├── binary_psr.py │ ├── catalog.py │ ├── catalog_oldstyle.py │ ├── catalog_query.txt │ ├── cosine_rand.pickle │ ├── cosine_rand.py │ ├── events.py │ ├── infodata.py │ ├── kuiper.py │ ├── parfile.py │ ├── polycos.py │ ├── ppgplot │ ├── __init__.py │ └── __init__.pyc │ ├── prepfold.py │ ├── presto │ ├── __init__.py │ ├── __init__.pyc │ ├── prestoswig.py │ └── prestoswig.pyc │ ├── psr_constants.py │ ├── psr_utils.py │ ├── residuals.py │ ├── rfifind.py │ ├── sifting.py │ ├── sigproc.py │ ├── simple_roots.py │ └── sinc_interp.py ├── python ├── .directory ├── .ipp.log ├── ACCEL_sift.py ├── Makefile ├── binopttest │ ├── README.txt │ ├── bindata.py │ ├── comb.py │ ├── fits.ps.gz │ ├── logfits.ps.gz │ ├── montebinopt.py │ ├── orbitstuff.pyc │ └── testresults.txt ├── binresponses │ ├── monte_ffdot.py │ ├── monte_short.py │ ├── monte_sideb.py │ ├── montebinresp.c │ ├── montebinresp.py │ └── parjob.txt ├── build │ ├── lib.linux-x86_64-2.7 │ │ ├── _ppgplot.so │ │ ├── _presto.so │ │ ├── ppgplot │ │ │ └── __init__.py │ │ └── presto │ │ │ ├── __init__.py │ │ │ └── prestoswig.py │ └── temp.linux-x86_64-2.7 │ │ ├── ppgplot_src │ │ └── _ppgplot.o │ │ └── presto_src │ │ └── presto_wrap.o ├── concatdata.py ├── dedisp.py ├── dftvectors.py ├── f-fdot_example.ps.gz ├── ffdot_example.py ├── fftfit_src │ ├── brent.f │ ├── cprof.f │ ├── fccf.f │ ├── ffft.f │ ├── fftfit.f │ ├── fftfit.pyf │ ├── fftfit.so │ └── test_fftfit.py ├── full_analysis.py ├── misc │ ├── cbitopt.txt │ └── pychecks.py ├── orbit_fit.py ├── orbitstuff.py ├── pdm2raw.py ├── power_stats.py ├── ppgplot_src │ ├── __init__.py │ └── _ppgplot.c ├── preppaste.py ├── presto_src │ ├── __init__.py │ ├── presto_wrap.c │ └── prestoswig.py ├── setup.py ├── setup_ppgplot.py ├── show_zresp.py ├── testcorr.py ├── testz.mak └── wrappers │ ├── Makefile │ ├── color.i │ ├── numpy.i │ ├── presto.i │ ├── presto.py │ ├── presto_psrdata.i │ ├── presto_structs.i │ └── presto_wrap.c ├── src ├── .directory ├── .geomview ├── GBT350filterbank.c ├── Makefile ├── PMsurv_phasemod.c ├── accel_utils.c ├── accel_utils_gpu.cu ├── accelsearch.c ├── accelsearch_cmd.c ├── amoeba.c ├── apprgrdn.c ├── atwood.c ├── bary.c ├── barycenter.c ├── bincand.c ├── bincand_cmd.c ├── birdzap.c ├── bpp.c ├── cal2mjd.c ├── cand_output.c ├── characteristics.c ├── check_parkes_raw.c ├── chkio.c ├── cldj.c ├── clipping.c ├── com.c ├── corr_prep.c ├── corr_routines.c ├── correlations.c ├── dat2sdat.c ├── database.c ├── dcdflib.c ├── dftfold.c ├── dftfold_cmd.c ├── dispersion.c ├── djcl.c ├── dm_tree.c ├── dm_tree_main.c ├── downsample.c ├── downsample_cmd.c ├── dump_spigot_zerolag.c ├── exploredat.c ├── explorefft.c ├── fastffts.c ├── fftcalls.c ├── fitsdelcol.c ├── fitsdelrow.c ├── fitsfile.c ├── fminbr.c ├── fold.c ├── fresnl.c ├── get_candidates.c ├── gmrt.c ├── hget.c ├── hput.c ├── imio.c ├── ioinf.c ├── iomak.c ├── ipmpar.c ├── least_squares.f ├── makedata.c ├── makeinf.c ├── makewisdom.c ├── mask.c ├── maximize_r.c ├── maximize_rz.c ├── maximize_rzw.c ├── median.c ├── minifft.c ├── misc_utils.c ├── mjd2cal.c ├── mpiprepsubband.c ├── mpiprepsubband_cmd.c ├── mpiprepsubband_utils.c ├── multi_prof_plot.c ├── multibeam.c ├── multifiles.c ├── orbint.c ├── output.c ├── patchdata.c ├── plotbincand.c ├── polycos.c ├── powerplot.c ├── prepdata.c ├── prepdata_cmd.c ├── prepfold.c ├── prepfold_cmd.c ├── prepfold_plot.c ├── prepfold_utils.c ├── prepsubband.c ├── prepsubband_cmd.c ├── profile.c ├── profile_cmd.c ├── psrfits.c ├── psrfits_dumparrays.c ├── psrorbit.c ├── quicklook.c ├── randlib.c ├── range_parse.c ├── rdascat.f ├── read_fft.c ├── readfile.c ├── readfile_cmd.c ├── readpar.c ├── realfft.c ├── realfft_4step.c ├── realfft_cmd.c ├── rednoise.c ├── rednoise_cmd.c ├── responses.c ├── rfi_utils.c ├── rfifind.c ├── rfifind_cmd.c ├── rfifind_plot.c ├── rzinterp.c ├── rzwinterp.c ├── sdat2dat.c ├── search_bin.c ├── search_bin_cmd.c ├── search_rzw.c ├── search_rzw_cmd.c ├── searchmultidms.c ├── select.c ├── shiftdata.c ├── show_pfd.c ├── show_pfd_cmd.c ├── showmulti.c ├── showmulti_dm.c ├── sigproc_fb.c ├── sla.c ├── slalib │ ├── addet.f │ ├── afin.f │ ├── airmas.f │ ├── altaz.f │ ├── amp.f │ ├── ampqk.f │ ├── aop.f │ ├── aoppa.f │ ├── aoppat.f │ ├── aopqk.f │ ├── atmdsp.f │ ├── atms.f │ ├── atmt.f │ ├── av2m.f │ ├── bear.f │ ├── caf2r.f │ ├── caldj.f │ ├── calyd.f │ ├── cc2s.f │ ├── cc62s.f │ ├── cd2tf.f │ ├── cldj.f │ ├── clyd.f │ ├── combn.f │ ├── compile_and_test.txt │ ├── cr2af.f │ ├── cr2tf.f │ ├── cs2c.f │ ├── cs2c6.f │ ├── ctf2d.f │ ├── ctf2r.f │ ├── daf2r.f │ ├── dafin.f │ ├── dat.f │ ├── dav2m.f │ ├── dbear.f │ ├── dbjin.f │ ├── dc62s.f │ ├── dcc2s.f │ ├── dcmpf.f │ ├── dcs2c.f │ ├── dd2tf.f │ ├── de2h.f │ ├── deuler.f │ ├── dfltin.f │ ├── dh2e.f │ ├── dimxv.f │ ├── djcal.f │ ├── djcl.f │ ├── dm2av.f │ ├── dmat.f │ ├── dmoon.f │ ├── dmxm.f │ ├── dmxv.f │ ├── dpav.f │ ├── dr2af.f │ ├── dr2tf.f │ ├── drange.f │ ├── dranrm.f │ ├── ds2c6.f │ ├── ds2tp.f │ ├── dsep.f │ ├── dsepv.f │ ├── dt.f │ ├── dtf2d.f │ ├── dtf2r.f │ ├── dtp2s.f │ ├── dtp2v.f │ ├── dtps2c.f │ ├── dtpv2c.f │ ├── dtt.f │ ├── dv2tp.f │ ├── dvdv.f │ ├── dvn.f │ ├── dvxv.f │ ├── e2h.f │ ├── earth.f │ ├── ecleq.f │ ├── ecmat.f │ ├── ecor.f │ ├── eg50.f │ ├── el2ue.f │ ├── epb.f │ ├── epb2d.f │ ├── epco.f │ ├── epj.f │ ├── epj2d.f │ ├── epv.f │ ├── eqecl.f │ ├── eqeqx.f │ ├── eqgal.f │ ├── etrms.f │ ├── euler.f │ ├── evp.f │ ├── fitxy.f │ ├── fk425.f │ ├── fk45z.f │ ├── fk524.f │ ├── fk52h.f │ ├── fk54z.f │ ├── fk5hz.f │ ├── flotin.f │ ├── galeq.f │ ├── galsup.f │ ├── ge50.f │ ├── geoc.f │ ├── gmst.f │ ├── gmsta.f │ ├── gresid.F │ ├── h2e.f │ ├── h2fk5.f │ ├── hfk5z.f │ ├── idchf.f │ ├── idchi.f │ ├── imxv.f │ ├── intin.f │ ├── invf.f │ ├── kbj.f │ ├── m2av.f │ ├── map.f │ ├── mappa.f │ ├── mapqk.f │ ├── mapqkz.f │ ├── moon.f │ ├── mxm.f │ ├── mxv.f │ ├── nut.f │ ├── nutc.f │ ├── nutc80.f │ ├── oap.f │ ├── oapqk.f │ ├── obs.f │ ├── pa.f │ ├── pav.f │ ├── pcd.f │ ├── pda2h.f │ ├── pdq2h.f │ ├── permut.f │ ├── pertel.f │ ├── pertue.f │ ├── planel.f │ ├── planet.f │ ├── plante.f │ ├── plantu.f │ ├── pm.f │ ├── polmo.f │ ├── prebn.f │ ├── prec.f │ ├── preces.f │ ├── precl.f │ ├── prenut.f │ ├── pv2el.f │ ├── pv2ue.f │ ├── pvobs.f │ ├── pxy.f │ ├── random.F │ ├── range.f │ ├── ranorm.f │ ├── rcc.f │ ├── rdplan.f │ ├── refco.f │ ├── refcoq.f │ ├── refro.f │ ├── refv.f │ ├── refz.f │ ├── rverot.f │ ├── rvgalc.f │ ├── rvlg.f │ ├── rvlsrd.f │ ├── rvlsrk.f │ ├── s2tp.f │ ├── sep.f │ ├── sepv.f │ ├── sla_config.h │ ├── sla_test.f │ ├── smat.f │ ├── subet.f │ ├── supgal.f │ ├── svd.f │ ├── svdcov.f │ ├── svdsol.f │ ├── tp2s.f │ ├── tp2v.f │ ├── tps2c.f │ ├── tpv2c.f │ ├── ue2el.f │ ├── ue2pv.f │ ├── unpcd.f │ ├── v2tp.f │ ├── vdv.f │ ├── veri.f │ ├── vers.f │ ├── vn.f │ ├── vxv.f │ ├── wait.f │ ├── xy2xy.f │ └── zd.f ├── solvopt.c ├── sorter.c ├── spigot.c ├── spigot2filterbank.c ├── spigot2filterbank_cmd.c ├── spigotSband2filterbank.c ├── split_parkes_beams.c ├── swap_endian.c ├── swapendian.c ├── taperaw.c ├── test_multifiles.c ├── testtree.c ├── timetest.c ├── toas2dat.c ├── toas2dat_cmd.c ├── transpose.c ├── twopass.c ├── twopass_real_fwd.c ├── twopass_real_inv.c ├── un_sc_td.c ├── vectors.c ├── wapp.c ├── wapp_head_parse.c ├── wapp_mkheaderlex.c ├── wapp_y.tab.c ├── weight_psrfits.c ├── window.c ├── xyline.c ├── zapbirds.c ├── zapbirds_cmd.c └── zapping.c └── tests ├── INSTALL ├── Makefile ├── barytest.mak ├── bin ├── .geomview ├── DDplan.py ├── GBNCC_search.py ├── GBT350_drift_prep.py ├── GBT350_drift_search.py ├── GBT350filterbank ├── PALFA_presto_search.py ├── a2x ├── accelsearch ├── bary ├── bincand ├── cal2mjd ├── check_parkes_raw ├── dat2sdat ├── dat2tim.py ├── dftfold ├── downsample ├── downsample_filterbank.py ├── dump_spigot_zerolag ├── event_peak.py ├── exploredat ├── explorefft ├── filter_zerolags.py ├── fit_circular_orbit.py ├── fitsdelcol ├── fitsdelrow ├── get_TOAs.py ├── makedata ├── makeinf ├── makezaplist.py ├── mjd2cal ├── patchdata ├── pfd_for_timing.py ├── plotbincand ├── powerstats.py ├── prepdata ├── prepfold ├── prepsubband ├── psrfits_dumparrays ├── psrorbit ├── pygaussfit.py ├── pyplotres.py ├── quickffdots.py ├── quicklook ├── readfile ├── realfft ├── rednoise ├── rfifind ├── sdat2dat ├── search_bin ├── search_rzw ├── shiftdata ├── show_pfd ├── single_pulse_search.py ├── sortwappfiles.py ├── spigot2filterbank ├── spigotSband2filterbank ├── split_parkes_beams ├── sum_profiles.py ├── swap_endian ├── taperaw ├── toas2dat ├── un_sc_td ├── weight_psrfits ├── window └── zapbirds ├── clig ├── accelsearch.1 ├── accelsearch_cmd.cli ├── bincand.1 ├── bincand_cmd.cli ├── cmdline.cli ├── dftfold.1 ├── dftfold_cmd.cli ├── downsample.1 ├── downsample_cmd.cli ├── mpiprepsubband.1 ├── mpiprepsubband_cmd.cli ├── prepdata.1 ├── prepdata_cmd.cli ├── prepfold.1 ├── prepfold_cmd.cli ├── prepsubband.1 ├── prepsubband_cmd.cli ├── profile.1 ├── profile_cmd.cli ├── readfile.1 ├── readfile_cmd.cli ├── realfft.1 ├── realfft_cmd.cli ├── rednoise.1 ├── rednoise_cmd.cli ├── rfifind.1 ├── rfifind_cmd.cli ├── search_bin.1 ├── search_bin_cmd.cli ├── search_rzw.1 ├── search_rzw_cmd.cli ├── show_pfd.1 ├── show_pfd_cmd.cli ├── spigot2filterbank.1 ├── spigot2filterbank_cmd.cli ├── toas2dat.1 ├── toas2dat_cmd.cli ├── zapbirds.1 └── zapbirds_cmd.cli ├── compare.c ├── docs ├── .xvpics │ ├── presto1.jpg │ └── presto2.jpg ├── PRESTO_search_tutorial.odp ├── PRESTO_search_tutorial.pdf ├── a2x.1 ├── accelsearch.1 ├── bincand.1 ├── dftfold.1 ├── downsample.1 ├── mpiprepsubband.1 ├── prepdata.1 ├── prepfold.1 ├── prepsubband.1 ├── presto.tex ├── presto1.jpg ├── presto2.jpg ├── profile.1 ├── readfile.1 ├── realfft.1 ├── rednoise.1 ├── rfifind.1 ├── search_bin.1 ├── search_rzw.1 ├── show_pfd.1 ├── spigot2filterbank.1 ├── toas2dat.1 └── zapbirds.1 ├── include ├── accel.h ├── accelsearch_cmd.h ├── bincand_cmd.h ├── bpp.h ├── cdflib.h ├── chkio.h ├── clk_tck.h ├── database.h ├── dftfold.h ├── dftfold_cmd.h ├── downsample_cmd.h ├── f77.h ├── fitsfile.h ├── fitshead.h ├── gmrt.h ├── imio.h ├── makedata.h ├── makeinf.h ├── mask.h ├── meminfo.h ├── misc_utils.h ├── mpiprepsubband_cmd.h ├── multibeam.h ├── multifiles.h ├── orbint.h ├── plot2d.h ├── prepdata_cmd.h ├── prepfold.h ├── prepfold_cmd.h ├── prepsubband_cmd.h ├── presto.h ├── profile_cmd.h ├── psrfits.h ├── randlib.h ├── ransomfft.h ├── rawtype.h ├── rdascat.h ├── readfile_cmd.h ├── realfft_cmd.h ├── rednoise_cmd.h ├── rfifind.h ├── rfifind_cmd.h ├── search_bin_cmd.h ├── search_rzw_cmd.h ├── show_pfd_cmd.h ├── sigproc_fb.h ├── slalib.h ├── slamac.h ├── spigot.h ├── spigot2filterbank_cmd.h ├── toas2dat_cmd.h ├── vectors.h ├── wapp.h ├── wapp_key.h ├── wapp_y.tab.h └── zapbirds_cmd.h ├── lib ├── a2x.ps ├── a2xshell.ps ├── aliases.txt ├── fftw_wisdom.txt ├── goodfactors.txt ├── libpresto.so ├── libsla.so ├── parkes_birds.txt ├── psr_catalog.txt ├── pulsars.cat └── python │ ├── .directory │ ├── Pgplot.py │ ├── barycenter.py │ ├── bestprof.py │ ├── binary_psr.py │ ├── catalog.py │ ├── catalog_oldstyle.py │ ├── catalog_query.txt │ ├── cosine_rand.pickle │ ├── cosine_rand.py │ ├── events.py │ ├── infodata.py │ ├── kuiper.py │ ├── parfile.py │ ├── polycos.py │ ├── prepfold.py │ ├── psr_constants.py │ ├── psr_utils.py │ ├── residuals.py │ ├── rfifind.py │ ├── sifting.py │ ├── sigproc.py │ ├── simple_roots.py │ └── sinc_interp.py ├── modbstretch.c ├── python ├── Makefile ├── cvec.py ├── cvec.pyc ├── cvects.c ├── cvects.h ├── cvects.i ├── dedisp.py ├── dftvectors.py ├── misc │ ├── cbitopt.txt │ └── pychecks.py ├── pdm2raw.py ├── ppgplot_src │ ├── __init__.py │ └── _ppgplot.c ├── preppaste.py ├── presto_src │ ├── __init__.py │ ├── presto_wrap.c │ ├── presto_wrap.c~ │ ├── prestoswig.py │ └── prestoswig.pyc ├── show_zresp.py ├── test.c ├── test.i ├── test_cvects.c └── wrappers │ ├── Makefile │ ├── color.i │ ├── numpy.i │ ├── presto.i │ ├── presto.py │ ├── presto_psrdata.i │ ├── presto_structs.i │ └── presto_wrap.c ├── test_apps.c ├── test_binary.c ├── test_fdot.mak ├── test_ffts.c ├── test_finterp.mak ├── test_fold.c ├── test_keplar.c ├── test_moments.c ├── test_phasemod.mak ├── test_pkmb_convert.c ├── test_plot.mak ├── test_profile.mak ├── testbess.c ├── testbinresp.c ├── testbinresp_bak.c ├── testdatabase.c ├── tester.c ├── testfold.mak ├── testmulti.c ├── testresp.c ├── testresp.mak ├── testz.mak └── wchar.c /Howto_GPU: -------------------------------------------------------------------------------- 1 | You need a CUDA library to compile the code. And make sure informations for CUDA are correct in the Makefile 2 | under $PRESTO/src. Modify them if necessary. 3 | 4 | Only accelsearch is GPUed. To run accelsearch on GPU, use the -cuda option. Or the program will run on CPU. 5 | For example: accelsearch -numharm 16 -zmax 256 ur_data.dat -cuda 0 6 | 0 means the 1st GPU in your machine. 7 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for PRESTO: Pulsar Search Software 3 | # for Unix (and hopefully MPI soon) 4 | # by Scott M. Ransom 5 | # 6 | DATE = $(shell date +%d%b%y) 7 | 8 | tar: squeaky tags package 9 | 10 | tags: 11 | cd src ; find . -name "*.[ch]" -print | etags - 12 | cd src ; find ../include -name "*.[ch]" -print | etags -a - 13 | 14 | package: 15 | cd ..; tar --exclude=.svn -cvf presto$(DATE).tar presto 16 | gzip -9 ../presto$(DATE).tar 17 | mv ../presto$(DATE).tar.gz . 18 | 19 | squeaky: 20 | rm -f *~ presto*.tar.gz *# 21 | find . -name "*.[oa]" | xargs rm -f 22 | find . -name "*.so" | xargs rm -f 23 | find . -name "*.dat" | xargs rm -f 24 | find . -name "*.fft" | xargs rm -f 25 | find . -name "*.inf" | xargs rm -f 26 | find . -name "*[~#]" | xargs rm -f 27 | cd python ; make clean 28 | cd src ; make squeaky 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > It is a branch of PRESTO. We are working to accelerate the program with GPU. The work is based on Scott Ransom's C version,https://github.com/scottransom/presto 2 | About presto, please refer to http://www.cv.nrao.edu/~sransom/presto/ 3 | 4 | #2013-12-02 5 | ####what's new#### 6 | 1. Texture memory is used to reduce the time required for memory read on GPU. 7 | 2. cuFFT is used in a smarter way. cuFFT plans are stored independently outside functions that actually use them. 8 | 9 | ####test results#### 10 | 1. CPU platform: Intel Xeon E5-1650, 3.20GHz, 12 Cores, 62GByte memory 11 | 2. GPU platform: Nvidia GeForce GTX780, with CUDA 5.5 12 | 13 | #####data point = 83886080, dt per bin(s) = 0.00064##### 14 | 15 | | -numharm | -zmax | CPU runtime(sec) | GPU runtime(sec) | acceleration | 16 | | :-------------: |:-------------:| :-----:| :-----:| :-----:| 17 | | 16 | 256 | 2075.00 | 93.3 | 22.24 | 18 | | 8 | 256 | 1089.82 | 53.96 | 20.19 | 19 | | 1 | 256 | 247.44 | 9.79 | 25.27 | 20 | 21 | #2013-10-23# 22 | 23 | ####The 1st release#### 24 | 25 | 26 | 1. You need a CUDA library to compile the code. 27 | 2. Only accelsearch is GPUed. To run accelsearch on GPU, use the -cuda option. Or the program will run on CPU. 28 | For example: accelsearch -numharm 16 -zmax 256 ur_data.dat -cuda 0, 0 means the 1st GPU in your machine. 29 | -------------------------------------------------------------------------------- /bin/.geomview: -------------------------------------------------------------------------------- 1 | (ui-panel main off) 2 | (ui-panel tools off) 3 | -------------------------------------------------------------------------------- /clig/bincand_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name bincand 4 | 5 | Usage "Generates a set of fake orbits and their Fourier modulation spectra for a binary candidate (usually generated by search_bin). It tries to return the optimum fit for the binary candidate." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Double -plo plo {The low pulsar period to check (s)} \ 14 | -r 0 oo 15 | Double -phi phi {The high pulsar period to check (s)} \ 16 | -r 0 oo 17 | Double -rlo rlo {The low Fourier frequency bin to check} \ 18 | -r 0 oo 19 | Double -rhi rhi {The high Fourier frequency bin to check} \ 20 | -r 0 oo 21 | String -psr psrname {Name of pulsar to check for (do not include J or B)} 22 | Int -candnum candnum {Number of the candidate to optimize from candfile.} \ 23 | -r 1 oo 24 | String -candfile candfile {Name of the bincary candidate file.} 25 | 26 | # Parameters for a binary pulsar 27 | 28 | Flag -usr usr {Describe your own binary candidate. Must include all of the following (assumed) parameters} 29 | Double -pb pb {The orbital period (s)} \ 30 | -r 0 oo 31 | Double -x asinic {The projected orbital semi-major axis (lt-sec)} \ 32 | -r 0 oo 33 | Double -e e {The orbital eccentricity} \ 34 | -r 0 0.9999999 -d 0 35 | Double -To To {The time of periastron passage (MJD)} \ 36 | -r 0 oo 37 | Double -w w {Longitude of periastron (deg)} \ 38 | -r 0 360 39 | Double -wdot wdot {Rate of advance of periastron (deg/yr)} \ 40 | -r -oo oo -d 0 41 | 42 | Flag -mak makefile {Determine optimization parameters from 'infile.mak'} 43 | 44 | # Rest of command line: 45 | 46 | Rest infile {Input fft file name (without a suffix) of floating point fft data. A '.inf' file of the same name must also exist} \ 47 | -c 1 1 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /clig/dftfold_cmd.cli: -------------------------------------------------------------------------------- 1 | Name dftfold 2 | 3 | Usage "Calculates the complex vector addition of a DFT frequency." 4 | 5 | Version [exec date +%d%b%y] 6 | 7 | Commandline full_cmd_line 8 | 9 | Int -n numvect {The number of DFT sub-vectors to save}\ 10 | -r 2 262144 -d 1000 11 | Double -r rr {The Fourier frequency to fold (bins)}\ 12 | -r 1.0 2000000000.0 13 | Double -p pp {The period to fold (s)}\ 14 | -r 0.00000001 100000.0 15 | Double -f ff {The frequency to fold (Hz)}\ 16 | -r 0.00000001 100000.0 17 | Double -norm norm {Raw power divided by this normalizes the power} 18 | Flag -fftnorm fftnorm {Use local powers from '.fft' file to get 'norm'} 19 | Rest infile {Input data file name (without a suffix) of floating point data. A '.inf' file of the same name must also exist} \ 20 | -c 1 1 21 | -------------------------------------------------------------------------------- /clig/downsample.1: -------------------------------------------------------------------------------- 1 | .\" clig manual page template 2 | .\" (C) 1995-2001 Harald Kirsch (kirschh@lionbioscience.com) 3 | .\" 4 | .\" This file was generated by 5 | .\" clig -- command line interface generator 6 | .\" 7 | .\" 8 | .\" Clig will always edit the lines between pairs of `cligPart ...', 9 | .\" but will not complain, if a pair is missing. So, if you want to 10 | .\" make up a certain part of the manual page by hand rather than have 11 | .\" it edited by clig, remove the respective pair of cligPart-lines. 12 | .\" 13 | .\" cligPart TITLE 14 | .TH "downsample" 1 "19Aug13" "Clig-manuals" "Programmer's Manual" 15 | .\" cligPart TITLE end 16 | 17 | .\" cligPart NAME 18 | .SH NAME 19 | downsample \- Downsamples a time series. 20 | .\" cligPart NAME end 21 | 22 | .\" cligPart SYNOPSIS 23 | .SH SYNOPSIS 24 | .B downsample 25 | -factor factor 26 | [-o outfile] 27 | file 28 | .\" cligPart SYNOPSIS end 29 | 30 | .\" cligPart OPTIONS 31 | .SH OPTIONS 32 | .IP -factor 33 | The factor to downsample the data, 34 | .br 35 | 1 Int value between 1 and 100. 36 | .IP -o 37 | Name of the output time series file (with suffix), 38 | .br 39 | 1 String value 40 | .IP file 41 | Input '.dat' or '.sdat' file name. 42 | .\" cligPart OPTIONS end 43 | 44 | .\" cligPart DESCRIPTION 45 | .SH DESCRIPTION 46 | This manual page was generated automagically by clig, the 47 | Command Line Interface Generator. Actually the programmer 48 | using clig was supposed to edit this part of the manual 49 | page after 50 | generating it with clig, but obviously (s)he didn't. 51 | 52 | Sadly enough clig does not yet have the power to pick a good 53 | program description out of blue air ;-( 54 | .\" cligPart DESCRIPTION end 55 | -------------------------------------------------------------------------------- /clig/downsample_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name downsample 4 | 5 | Usage "Downsamples a time series." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Int -factor factor {The factor to downsample the data} \ 14 | -r 1 100 -m 15 | String -o outfile {Name of the output time series file (with suffix)} 16 | 17 | # Rest of command line: 18 | 19 | Rest file {Input '.dat' or '.sdat' file name} \ 20 | -c 1 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /clig/realfft_cmd.cli: -------------------------------------------------------------------------------- 1 | Name realfft 2 | 3 | Usage {Perform a single-precision FFT of real data or its inverse} 4 | 5 | Version [exec date +%d%b%y] 6 | 7 | Commandline full_cmd_line 8 | 9 | Flag -fwd forward {Force an forward FFT (sign=-1) to be performed} 10 | Flag -inv inverse {Force an inverse FFT (sign=+1) to be performed} 11 | Flag -del delete {Delete the original file(s) when performing the FFT} 12 | Flag -disk diskfft {Force the use of the out-of-core memory FFT} 13 | Flag -mem memfft {Force the use of the in-core memory FFT} 14 | String -tmpdir tmpdir {Scratch directory for temp file(s) in out-of-core FFT} 15 | String -outdir outdir {Directory where result file(s) will reside} 16 | Rest infiles {Input data file(s)} \ 17 | -c 1 16 18 | -------------------------------------------------------------------------------- /clig/rednoise.1: -------------------------------------------------------------------------------- 1 | .\" clig manual page template 2 | .\" (C) 1995-2001 Harald Kirsch (kirschh@lionbioscience.com) 3 | .\" 4 | .\" This file was generated by 5 | .\" clig -- command line interface generator 6 | .\" 7 | .\" 8 | .\" Clig will always edit the lines between pairs of `cligPart ...', 9 | .\" but will not complain, if a pair is missing. So, if you want to 10 | .\" make up a certain part of the manual page by hand rather than have 11 | .\" it edited by clig, remove the respective pair of cligPart-lines. 12 | .\" 13 | .\" cligPart TITLE 14 | .TH "rednoise" 1 "19Aug13" "Clig-manuals" "Programmer's Manual" 15 | .\" cligPart TITLE end 16 | 17 | .\" cligPart NAME 18 | .SH NAME 19 | rednoise \- Rednoise extraction routine. 20 | .\" cligPart NAME end 21 | 22 | .\" cligPart SYNOPSIS 23 | .SH SYNOPSIS 24 | .B rednoise 25 | [-startwidth startwidth] 26 | [-endwidth endwidth] 27 | [-endfreq endfreq] 28 | file 29 | .\" cligPart SYNOPSIS end 30 | 31 | .\" cligPart OPTIONS 32 | .SH OPTIONS 33 | .IP -startwidth 34 | The initial windowing size., 35 | .br 36 | 1 Int value between 2 and 50. 37 | .br 38 | Default: `6' 39 | .IP -endwidth 40 | The final windowing size., 41 | .br 42 | 1 Int value between 50 and 500. 43 | .br 44 | Default: `100' 45 | .IP -endfreq 46 | The highest frequency where the windowing increases., 47 | .br 48 | 1 Double value between 0.1 and 10. 49 | .br 50 | Default: `6' 51 | .IP file 52 | Input '.fft' file.. 53 | .\" cligPart OPTIONS end 54 | 55 | .\" cligPart DESCRIPTION 56 | .SH DESCRIPTION 57 | This manual page was generated automagically by clig, the 58 | Command Line Interface Generator. Actually the programmer 59 | using clig was supposed to edit this part of the manual 60 | page after 61 | generating it with clig, but obviously (s)he didn't. 62 | 63 | Sadly enough clig does not yet have the power to pick a good 64 | program description out of blue air ;-( 65 | .\" cligPart DESCRIPTION end 66 | -------------------------------------------------------------------------------- /clig/rednoise_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name rednoise 4 | 5 | Usage "Rednoise extraction routine." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Int -startwidth startwidth {The initial windowing size.} \ 14 | -r 2 50 -d 6 15 | 16 | Int -endwidth endwidth {The final windowing size.} \ 17 | -r 50 500 -d 100 18 | 19 | Double -endfreq endfreq {The highest frequency where the windowing increases.} \ 20 | -r 0.1 10 -d 6 21 | 22 | # Rest of command line: 23 | 24 | Rest file {Input '.fft' file.} \ 25 | -c 1 1 26 | 27 | 28 | -------------------------------------------------------------------------------- /clig/search_bin_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name search_bin 4 | 5 | Usage "Searches a long FFT for binary pulsar candidates using a phase modulation search." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Int -ncand ncand {Number of candidates to try to return} \ 14 | -r 1 10000 -d 100 15 | Int -minfft minfft {Power-of-2 length of the shortest miniFFT} \ 16 | -r 8 1048576 -d 32 17 | Int -maxfft maxfft {Power-of-2 length of the longest miniFFT} \ 18 | -r 8 1048576 -d 65536 19 | Float -flo flo {The low frequency (Hz) to check} \ 20 | -r 0 oo -d 1.0 21 | Float -fhi fhi {The high frequency (Hz) to check} \ 22 | -r 0 oo -d 2000.0 23 | Int -rlo rlo {The low Fourier frequency to check} \ 24 | -r 0 oo 25 | Int -rhi rhi {The high Fourier frequency to check} \ 26 | -r 0 oo 27 | Int -lobin lobin {The first Fourier frequency in the data file} \ 28 | -r 0 oo -d 0 29 | Double -overlap overlap {Fraction of a short FFT length to shift before performing another} \ 30 | -r 0.05 1.0 -d 0.25 31 | Int -harmsum harmsum {Number of harmonics to sum in the miniFFTs} \ 32 | -r 1 20 -d 3 33 | Int -numbetween numbetween {Number of points to interpolate per Fourier bin (2 gives the usual bin value and an interbin)} \ 34 | -r 1 16 -d 2 35 | Int -stack stack {Number of stacked power spectra making up the data. (The default means the data are complex amplitudes)} \ 36 | -r 0 oo -d 0 37 | Flag -interbin interbin {Use interbinning instead of full-blown Fourier interpolation. (Faster but less accurate and sensitive)} 38 | Flag -noalias noalias {Do not add aliased powers to the harmonic sum. (Faster but less accurate and sensitive)} 39 | 40 | # Rest of command line: 41 | 42 | Rest infile {Input file name (no suffix) of floating point fft data. A '.inf' file of the same name must also exist} \ 43 | -c 1 1 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /clig/search_rzw_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name search_rzw 4 | 5 | Usage "Searches an FFT for pulsar candidates using a Fourier domain acceleration search." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Int -ncand ncand {Number of candidates to try to return} \ 14 | -r 1 10000 -d 100 15 | Int -zlo zlo {The low Fourier frequency derivative to search} \ 16 | -r -2000000 2000000 -d " -50" 17 | Int -zhi zhi {The high Fourier frequency derivative to search} \ 18 | -r -2000000 2000000 -d 50 19 | Int -rlo rlo {The lowest Fourier frequency to search} \ 20 | -r 0 oo -d 300 21 | Int -rhi rhi {The highest Fourier frequency to search} \ 22 | -r 0 oo 23 | Int -flo flo {The lowest frequency (Hz) to search} \ 24 | -r 0 oo 25 | Int -fhi fhi {The highest frequency (Hz) to search} \ 26 | -r 0 oo 27 | Int -lobin lobin {The first Fourier frequency in the data file} \ 28 | -r 0 oo -d 0 29 | String -zapfile zapfile {A file containing a list of freqs to ignore (i.e. RFI)} 30 | Double -baryv baryv {The earth's radial velocity component (v/c) towards the observation (used to convert topocentric birdie freqs to barycentric)} \ 31 | -r -0.1 0.1 -d 0.0 32 | Flag -photon photon {Data is poissonian so use freq 0 as power normalization} 33 | 34 | # Rest of command line: 35 | 36 | Rest infile {Input file name (no suffix) of floating point fft data. A '.inf' file of the same name must also exist} \ 37 | -c 1 1 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /clig/show_pfd_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name show_pfd 4 | 5 | Usage "Displays or regenerates the Postscript for a 'pfd' file created by prepfold." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Flag -noxwin noxwin {Do not show the result plots on-screen, only make postscript files} 14 | Flag -scaleparts scaleparts {Scale the part profiles independently} 15 | Flag -allgrey allgrey {Make all the images greyscale instead of color} 16 | Flag -justprofs justprofs {Only output the profile portions of the plot} 17 | Flag -portrait portrait {Orient the output in portrait mode (for -justprofs)} 18 | Flag -events events {The folded data were events instead of samples or bins} 19 | Flag -infoonly infoonly {Display the pfd info and exit without generating plots.} 20 | String -killsubs killsubsstr {Comma separated string (no spaces!) of subbands to explicitly remove from analysis (i.e. zero out). Ranges are specified by min:max[:step]} 21 | String -killparts killpartsstr {Comma separated string (no spaces!) of intervals to explicitly remove from analysis (i.e. zero-out). Ranges are specified by min:max[:step]} 22 | 23 | # Rest of command line: 24 | 25 | Rest infile {The input 'pfd' file name.} \ 26 | -c 1 100 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /clig/spigot2filterbank_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name spigot2filterbank 4 | 5 | Usage "Converts raw GBT Spigot FITs files (lag data) into SIGPROC-style filterbank format." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | String -o outfile {Output file name (optional; for a single output file)} 14 | Flag -nohdr nohdr {Output just raw data. No headers are output} 15 | Flag -stdout stdout {Send the data to STDOUT instead of files} 16 | Flag -floats floats {Output data as 32-bit floats instead of 8-bit unsigned chars} 17 | Flag -zerolags zerolags {Dump the raw spigot zerolags in 32-bit floats format to a file} 18 | Int -skip skip {Number of spectra to skip from the initial value} \ 19 | -r 0 oo -d 0 20 | Int -numout numout {Number of spectra to output (default is all)} \ 21 | -r 0 oo 22 | Int -downsamp downsamp {Number of spectra to average on output} \ 23 | -r 0 oo -d 1 24 | Int -lokill lokill {Number of low-freq channels to ignore} \ 25 | -r 0 oo -d 0 26 | Int -hikill hikill {Number of high-freq channels to ignore} \ 27 | -r 0 oo -d 0 28 | 29 | # Rest of command line: 30 | 31 | Rest fitsfiles {Input Spigot FITs files.} \ 32 | -c 1 1024 33 | -------------------------------------------------------------------------------- /clig/toas2dat_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name toas2dat 4 | 5 | Usage "Converts TOAs into a binned time series." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Int -n numout {The number of bins in the output time series} \ 14 | -r 0 oo -m 15 | Double -dt dt {Time interval in seconds for output time bins} \ 16 | -r 0 oo -m 17 | Double -t0 t0 {Time for the start of bin 0 (same units as the TOAs)} 18 | String -o outfile {Name of the output time series file} \ 19 | -m 20 | Flag -text text {TOAs are ASCII text (default is binary double)} 21 | Flag -float float {TOAs are binary floats (default is binary double)} 22 | Flag -sec sec {TOA unit is seconds (default is days)} 23 | 24 | # Rest of command line: 25 | 26 | Rest file {Input TOA file name} \ 27 | -c 1 1 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /clig/zapbirds_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name zapbirds 4 | 5 | Usage "Allows you to interactively or automatically zap interference from an FFT." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Flag -zap zap \ 14 | {Zap the birds in the FFT from 'zapfile' (write to the FFT file)} 15 | String -zapfile zapfile \ 16 | {A file of freqs and widths to zap from the FFT (when using '-zap')} 17 | String -in inzapfile \ 18 | {A file containing a list of freqs (Hz) and the # of harmonics to zap} 19 | String -out outzapfile \ 20 | {A file to write that will contain the freqs and widths (Hz) zapped} 21 | Double -baryv baryv \ 22 | {The radial velocity component (v/c) towards the target during the obs} \ 23 | -r -0.1 0.1 -d 0.0 24 | 25 | # Rest of command line: 26 | 27 | Rest infile {Input file name (no suffix) of floating point fft data. A '.inf' file of the same name must also exist} \ 28 | -c 1 1 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/.xvpics/presto1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/docs/.xvpics/presto1.jpg -------------------------------------------------------------------------------- /docs/.xvpics/presto2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/docs/.xvpics/presto2.jpg -------------------------------------------------------------------------------- /docs/PRESTO_search_tutorial.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/docs/PRESTO_search_tutorial.odp -------------------------------------------------------------------------------- /docs/PRESTO_search_tutorial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/docs/PRESTO_search_tutorial.pdf -------------------------------------------------------------------------------- /docs/downsample.1: -------------------------------------------------------------------------------- 1 | .\" clig manual page template 2 | .\" (C) 1995-2001 Harald Kirsch (kirschh@lionbioscience.com) 3 | .\" 4 | .\" This file was generated by 5 | .\" clig -- command line interface generator 6 | .\" 7 | .\" 8 | .\" Clig will always edit the lines between pairs of `cligPart ...', 9 | .\" but will not complain, if a pair is missing. So, if you want to 10 | .\" make up a certain part of the manual page by hand rather than have 11 | .\" it edited by clig, remove the respective pair of cligPart-lines. 12 | .\" 13 | .\" cligPart TITLE 14 | .TH "downsample" 1 "19Aug13" "Clig-manuals" "Programmer's Manual" 15 | .\" cligPart TITLE end 16 | 17 | .\" cligPart NAME 18 | .SH NAME 19 | downsample \- Downsamples a time series. 20 | .\" cligPart NAME end 21 | 22 | .\" cligPart SYNOPSIS 23 | .SH SYNOPSIS 24 | .B downsample 25 | -factor factor 26 | [-o outfile] 27 | file 28 | .\" cligPart SYNOPSIS end 29 | 30 | .\" cligPart OPTIONS 31 | .SH OPTIONS 32 | .IP -factor 33 | The factor to downsample the data, 34 | .br 35 | 1 Int value between 1 and 100. 36 | .IP -o 37 | Name of the output time series file (with suffix), 38 | .br 39 | 1 String value 40 | .IP file 41 | Input '.dat' or '.sdat' file name. 42 | .\" cligPart OPTIONS end 43 | 44 | .\" cligPart DESCRIPTION 45 | .SH DESCRIPTION 46 | This manual page was generated automagically by clig, the 47 | Command Line Interface Generator. Actually the programmer 48 | using clig was supposed to edit this part of the manual 49 | page after 50 | generating it with clig, but obviously (s)he didn't. 51 | 52 | Sadly enough clig does not yet have the power to pick a good 53 | program description out of blue air ;-( 54 | .\" cligPart DESCRIPTION end 55 | -------------------------------------------------------------------------------- /docs/presto1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/docs/presto1.jpg -------------------------------------------------------------------------------- /docs/presto2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/docs/presto2.jpg -------------------------------------------------------------------------------- /docs/rednoise.1: -------------------------------------------------------------------------------- 1 | .\" clig manual page template 2 | .\" (C) 1995-2001 Harald Kirsch (kirschh@lionbioscience.com) 3 | .\" 4 | .\" This file was generated by 5 | .\" clig -- command line interface generator 6 | .\" 7 | .\" 8 | .\" Clig will always edit the lines between pairs of `cligPart ...', 9 | .\" but will not complain, if a pair is missing. So, if you want to 10 | .\" make up a certain part of the manual page by hand rather than have 11 | .\" it edited by clig, remove the respective pair of cligPart-lines. 12 | .\" 13 | .\" cligPart TITLE 14 | .TH "rednoise" 1 "19Aug13" "Clig-manuals" "Programmer's Manual" 15 | .\" cligPart TITLE end 16 | 17 | .\" cligPart NAME 18 | .SH NAME 19 | rednoise \- Rednoise extraction routine. 20 | .\" cligPart NAME end 21 | 22 | .\" cligPart SYNOPSIS 23 | .SH SYNOPSIS 24 | .B rednoise 25 | [-startwidth startwidth] 26 | [-endwidth endwidth] 27 | [-endfreq endfreq] 28 | file 29 | .\" cligPart SYNOPSIS end 30 | 31 | .\" cligPart OPTIONS 32 | .SH OPTIONS 33 | .IP -startwidth 34 | The initial windowing size., 35 | .br 36 | 1 Int value between 2 and 50. 37 | .br 38 | Default: `6' 39 | .IP -endwidth 40 | The final windowing size., 41 | .br 42 | 1 Int value between 50 and 500. 43 | .br 44 | Default: `100' 45 | .IP -endfreq 46 | The highest frequency where the windowing increases., 47 | .br 48 | 1 Double value between 0.1 and 10. 49 | .br 50 | Default: `6' 51 | .IP file 52 | Input '.fft' file.. 53 | .\" cligPart OPTIONS end 54 | 55 | .\" cligPart DESCRIPTION 56 | .SH DESCRIPTION 57 | This manual page was generated automagically by clig, the 58 | Command Line Interface Generator. Actually the programmer 59 | using clig was supposed to edit this part of the manual 60 | page after 61 | generating it with clig, but obviously (s)he didn't. 62 | 63 | Sadly enough clig does not yet have the power to pick a good 64 | program description out of blue air ;-( 65 | .\" cligPart DESCRIPTION end 66 | -------------------------------------------------------------------------------- /include/chkio.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef USE_PIOFS 3 | #include 4 | #include 5 | #else 6 | #include 7 | #endif 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | FILE *chkfopen(char *path, const char *mode); 14 | /* Preform a file open with error checking. */ 15 | 16 | size_t chkfread(void *data, size_t type, size_t number, FILE * stream); 17 | /* Preform a file read with error checking. */ 18 | 19 | size_t chkfwrite(void *data, size_t type, size_t number, FILE * stream); 20 | /* Preform a file write with error checking. */ 21 | 22 | size_t chkfseek(FILE * stream, long offset, int whence); 23 | /* NOTE: This is meant only for backwards compatibility. */ 24 | /* You should probably be calling chkfileseek() directly. */ 25 | 26 | size_t chkfileseek(FILE * stream, off_t offset, size_t size, int whence); 27 | /* Preform a file seek with error checking. */ 28 | 29 | long long chkfilelen(FILE *file, size_t size); 30 | /* Return the length of a file (in blocks of 'size'). */ 31 | 32 | int read_int(FILE *infile, int byteswap); 33 | /* Reads a binary integer value from the file 'infile' */ 34 | 35 | float read_float(FILE *infile, int byteswap); 36 | /* Reads a binary float value from the file 'infile' */ 37 | 38 | double read_double(FILE *infile, int byteswap); 39 | /* Reads a double precision value from the file 'infile' */ 40 | 41 | -------------------------------------------------------------------------------- /include/clk_tck.h: -------------------------------------------------------------------------------- 1 | #ifndef CLK_TCK 2 | #define CLK_TCK 100 3 | #endif 4 | -------------------------------------------------------------------------------- /include/dftfold.h: -------------------------------------------------------------------------------- 1 | #include "rawtype.h" 2 | 3 | typedef struct DFTVECTOR { 4 | int n; /* Number of data points in each vector segment */ 5 | int numvect; /* Number of vectors in the fold (vector length) */ 6 | double dt; /* Duration (s) of each data point */ 7 | double r; /* Fourier frequency folded */ 8 | double norm; /* Normalization used on vector */ 9 | double T; /* Total duration of original data set. */ 10 | fcomplex *vector; /* Calculated DFT vector */ 11 | } dftvector; 12 | 13 | void read_dftvector(dftvector *data, char *filename); 14 | /* Read a dftvector data structure from a binary file */ 15 | 16 | void write_dftvector(dftvector *data, char *filename); 17 | /* Write a dftvector data structure to a binary file */ 18 | 19 | void init_dftvector(dftvector *data, int n, int numvect, 20 | double dt, double r, double norm, 21 | double T); 22 | /* Initialize a dftvector and allocate its vector part */ 23 | 24 | void free_dftvector(dftvector *data); 25 | /* Free the dynamically allocated vector in data */ 26 | -------------------------------------------------------------------------------- /include/dftfold_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __dftfold_cmd__ 2 | #define __dftfold_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -n: The number of DFT sub-vectors to save */ 13 | char numvectP; 14 | int numvect; 15 | int numvectC; 16 | /***** -r: The Fourier frequency to fold (bins) */ 17 | char rrP; 18 | double rr; 19 | int rrC; 20 | /***** -p: The period to fold (s) */ 21 | char ppP; 22 | double pp; 23 | int ppC; 24 | /***** -f: The frequency to fold (Hz) */ 25 | char ffP; 26 | double ff; 27 | int ffC; 28 | /***** -norm: Raw power divided by this normalizes the power */ 29 | char normP; 30 | double norm; 31 | int normC; 32 | /***** -fftnorm: Use local powers from '.fft' file to get 'norm' */ 33 | char fftnormP; 34 | /***** uninterpreted command line parameters */ 35 | int argc; 36 | /*@null*/char **argv; 37 | /***** the whole command line concatenated */ 38 | char *full_cmd_line; 39 | } Cmdline; 40 | 41 | 42 | extern char *Program; 43 | extern void usage(void); 44 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 45 | 46 | extern void showOptionValues(void); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /include/downsample_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __downsample_cmd__ 2 | #define __downsample_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -factor: The factor to downsample the data */ 13 | char factorP; 14 | int factor; 15 | int factorC; 16 | /***** -o: Name of the output time series file (with suffix) */ 17 | char outfileP; 18 | char* outfile; 19 | int outfileC; 20 | /***** uninterpreted command line parameters */ 21 | int argc; 22 | /*@null*/char **argv; 23 | /***** the whole command line concatenated */ 24 | char *full_cmd_line; 25 | } Cmdline; 26 | 27 | 28 | extern char *Program; 29 | extern void usage(void); 30 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 31 | 32 | extern void showOptionValues(void); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /include/gmrt.h: -------------------------------------------------------------------------------- 1 | void set_GMRT_padvals(float *fpadvals, int good_padvals); 2 | void get_GMRT_file_info(FILE *files[], char *datfilenms[], int numfiles, 3 | float clipsig, long long *N, int *ptsperblock, int *numchan, 4 | double *dt, double *T, int output); 5 | void GMRT_update_infodata(int numfiles, infodata *idata); 6 | int skip_to_GMRT_rec(FILE *infiles[], int numfiles, int rec); 7 | int read_GMRT_rawblock(FILE *infiles[], int numfiles, unsigned char *data, 8 | int *padding); 9 | int read_GMRT_rawblocks(FILE *infiles[], int numfiles, unsigned char rawdata[], 10 | int numblocks, int *padding); 11 | int read_GMRT(FILE *infiles[], int numfiles, float *data, int numpts, 12 | double *dispdelays, int *padding, int *maskchans, 13 | int *nummasked, mask *obsmask); 14 | void get_GMRT_channel(int channum, float chandat[], 15 | unsigned char rawdata[], int numblocks); 16 | int prep_GMRT_subbands(unsigned char *rawdata, float *data, double *dispdelays, 17 | int numsubbands, int transpose, int *maskchans, 18 | int *nummasked, mask *obsmask); 19 | int read_GMRT_subbands(FILE *infiles[], int numfiles, float *data, 20 | double *dispdelays, int numsubbands, int transpose, 21 | int *padding, int *maskchans, int *nummasked, 22 | mask *obsmask); 23 | void GMRT_hdr_to_inf(char *datfilenm, infodata *idata); 24 | void convert_GMRT_block(short *indata, unsigned char *outdata); 25 | void convert_GMRT_block_8bit(unsigned char *indata, unsigned char *outdata); 26 | -------------------------------------------------------------------------------- /include/meminfo.h: -------------------------------------------------------------------------------- 1 | /* The following definitions can be changed to tweak your */ 2 | /* code. But they probably won't help a whole lot. You */ 3 | /* can calculate their values by running meminit. */ 4 | /* This file was generated by running 'meminit'. */ 5 | #define CODESIZE 2 6 | #define Ramsize 1048576000 7 | #define CacheL1size 65536 8 | #define CacheL2size 262144 9 | #define Cacheburst 32 10 | #define Maxblocksize 67108864 11 | #define MAXREALFFT 1000000000 12 | #define BIGFFTWSIZE 200000000 13 | #define KBF 33554432 14 | #define Cachetreshold 32768 15 | #define Cacheburstblocksize 4 16 | #define Cacheblocksize 64 17 | -------------------------------------------------------------------------------- /include/randlib.h: -------------------------------------------------------------------------------- 1 | /* Prototypes for all user accessible RANDLIB routines */ 2 | 3 | extern void advnst(long k); 4 | extern float genbet(float aa,float bb); 5 | extern float genchi(float df); 6 | extern float genexp(float av); 7 | extern float genf(float dfn, float dfd); 8 | extern float gengam(float a,float r); 9 | extern void genmn(float *parm,float *x,float *work); 10 | extern void genmul(long n,float *p,long ncat,long *ix); 11 | extern float gennch(float df,float xnonc); 12 | extern float gennf(float dfn, float dfd, float xnonc); 13 | extern float gennor(float av,float sd); 14 | extern void genprm(long *iarray,int larray); 15 | extern float genunf(float low,float high); 16 | extern void getsd(long *iseed1,long *iseed2); 17 | extern void gscgn(long getset,long *g); 18 | extern long ignbin(long n,float pp); 19 | extern long ignnbn(long n,float p); 20 | extern long ignlgi(void); 21 | extern long ignpoi(float mu); 22 | extern long ignuin(long low,long high); 23 | extern void initgn(long isdtyp); 24 | extern long mltmod(long a,long s,long m); 25 | extern void phrtsd(char* phrase,long* seed1,long* seed2); 26 | extern float ranf(void); 27 | extern void setall(long iseed1,long iseed2); 28 | extern void setant(long qvalue); 29 | extern void setgmn(float *meanv,float *covm,long p,float *parm); 30 | extern void setsd(long iseed1,long iseed2); 31 | extern float sexpo(void); 32 | extern float sgamma(float a); 33 | extern float snorm(void); 34 | -------------------------------------------------------------------------------- /include/rawtype.h: -------------------------------------------------------------------------------- 1 | /* Note: Define rawtype to be the type you need to transpose */ 2 | 3 | #ifndef _RAWTYPE_PART_DECLARED_ 4 | /* Use the following if you want to transform doubles */ 5 | /* typedef double rawtype_part; */ 6 | typedef float rawtype_part; 7 | #define _RAWTYPE_PART_DECLARED_ 8 | #endif /* _RAWTYPE_PART_DECLARED_ */ 9 | 10 | /* Declare a floating point complex type */ 11 | #ifndef _FCOMPLEX_DECLARED_ 12 | typedef struct FCOMPLEX { 13 | rawtype_part r, i; 14 | } fcomplex; 15 | #define _FCOMPLEX_DECLARED_ 16 | #endif /* _FCOMPLEX_DECLARED_ */ 17 | 18 | /* Declare rawtype as fcomplex */ 19 | #ifndef _RAWTYPE_DECLARED_ 20 | typedef fcomplex rawtype; 21 | typedef rawtype TOMS_el_type; 22 | #define MPI_rawtype fcomplextype 23 | #define _RAWTYPE_DECLARED_ 24 | #endif /* _RAWTYPE_DECLARED_ */ 25 | 26 | 27 | -------------------------------------------------------------------------------- /include/rdascat.h: -------------------------------------------------------------------------------- 1 | implicit real*8 (a-h,o-z) 2 | parameter (NP=800) 3 | real*8 ldeg,lum 4 | character jname*12,bname*8,lcode*1,ucode*1 5 | common/dat/ jname(NP),bname(NP),ra2000(NP),ra1950(NP), 6 | + rae(NP),dec2000(NP),dec1950(NP),dece(NP),nscode(NP), 7 | + dmin(NP),dmax(NP),dist(NP),ndflag(NP),lcode(NP),ucode(NP), 8 | + ldeg(NP),bdeg(NP),pmra(NP),pmrae(NP),pmdec(NP), 9 | + pmdece(NP),posepoch(NP),p(NP),pe(NP),pdot(NP),pdote(NP), 10 | + f2(NP),f2e(NP),f3(NP),f3e(NP),epoch(NP),dm(NP),dme(NP), 11 | + rm(NP), 12 | + rme(NP),we(NP),w50(NP),w10(NP),s400(NP),s600(NP),s1400(NP), 13 | + tau(NP),ntauflag(NP),t408(NP),ntype(NP), 14 | + modcode(NP),limcode(NP), 15 | + distmod(NP),lum(NP),bsurf(NP),age(NP),edot(NP),ibin(NP), 16 | + pb(NP),pbe(NP),a1(NP),a1e(NP),om(NP),ome(NP), 17 | + omdot(NP),omdote(NP),e(NP),ee(NP),t0(NP),t0e(NP), 18 | + gamma(NP),gammae(NP),pbdot(NP),pbdote(NP),si(NP),sie(NP), 19 | + r(NP),re(NP), 20 | + pb2(NP),pb2e(NP),a12(NP),a12e(NP),om2(NP),om2e(NP), 21 | + omdot2(NP),omdot2e(NP),e2(NP),e2e(NP),t02(NP),t02e(NP), 22 | + gamma2(NP),gamma2e(NP),pbdot2(NP),pbdot2e(NP),si2(NP), 23 | + si2e(NP),r2(NP),r2e(NP) 24 | -------------------------------------------------------------------------------- /include/realfft_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __realfft_cmd__ 2 | #define __realfft_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -fwd: Force an forward FFT (sign=-1) to be performed */ 13 | char forwardP; 14 | /***** -inv: Force an inverse FFT (sign=+1) to be performed */ 15 | char inverseP; 16 | /***** -del: Delete the original file(s) when performing the FFT */ 17 | char deleteP; 18 | /***** -disk: Force the use of the out-of-core memory FFT */ 19 | char diskfftP; 20 | /***** -mem: Force the use of the in-core memory FFT */ 21 | char memfftP; 22 | /***** -tmpdir: Scratch directory for temp file(s) in out-of-core FFT */ 23 | char tmpdirP; 24 | char* tmpdir; 25 | int tmpdirC; 26 | /***** -outdir: Directory where result file(s) will reside */ 27 | char outdirP; 28 | char* outdir; 29 | int outdirC; 30 | /***** uninterpreted command line parameters */ 31 | int argc; 32 | /*@null*/char **argv; 33 | /***** the whole command line concatenated */ 34 | char *full_cmd_line; 35 | } Cmdline; 36 | 37 | 38 | extern char *Program; 39 | extern void usage(void); 40 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 41 | 42 | extern void showOptionValues(void); 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /include/rednoise_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __rednoise_cmd__ 2 | #define __rednoise_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -startwidth: The initial windowing size. */ 13 | char startwidthP; 14 | int startwidth; 15 | int startwidthC; 16 | /***** -endwidth: The final windowing size. */ 17 | char endwidthP; 18 | int endwidth; 19 | int endwidthC; 20 | /***** -endfreq: The highest frequency where the windowing increases. */ 21 | char endfreqP; 22 | double endfreq; 23 | int endfreqC; 24 | /***** uninterpreted command line parameters */ 25 | int argc; 26 | /*@null*/char **argv; 27 | /***** the whole command line concatenated */ 28 | char *full_cmd_line; 29 | } Cmdline; 30 | 31 | 32 | extern char *Program; 33 | extern void usage(void); 34 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 35 | 36 | extern void showOptionValues(void); 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /include/show_pfd_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __show_pfd_cmd__ 2 | #define __show_pfd_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -noxwin: Do not show the result plots on-screen, only make postscript files */ 13 | char noxwinP; 14 | /***** -scaleparts: Scale the part profiles independently */ 15 | char scalepartsP; 16 | /***** -allgrey: Make all the images greyscale instead of color */ 17 | char allgreyP; 18 | /***** -justprofs: Only output the profile portions of the plot */ 19 | char justprofsP; 20 | /***** -portrait: Orient the output in portrait mode (for -justprofs) */ 21 | char portraitP; 22 | /***** -events: The folded data were events instead of samples or bins */ 23 | char eventsP; 24 | /***** -infoonly: Display the pfd info and exit without generating plots. */ 25 | char infoonlyP; 26 | /***** -killsubs: Comma separated string (no spaces!) of subbands to explicitly remove from analysis (i.e. zero out). Ranges are specified by min:max[:step] */ 27 | char killsubsstrP; 28 | char* killsubsstr; 29 | int killsubsstrC; 30 | /***** -killparts: Comma separated string (no spaces!) of intervals to explicitly remove from analysis (i.e. zero-out). Ranges are specified by min:max[:step] */ 31 | char killpartsstrP; 32 | char* killpartsstr; 33 | int killpartsstrC; 34 | /***** uninterpreted command line parameters */ 35 | int argc; 36 | /*@null*/char **argv; 37 | /***** the whole command line concatenated */ 38 | char *full_cmd_line; 39 | } Cmdline; 40 | 41 | 42 | extern char *Program; 43 | extern void usage(void); 44 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 45 | 46 | extern void showOptionValues(void); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /include/spigot2filterbank_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __spigot2filterbank_cmd__ 2 | #define __spigot2filterbank_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -o: Output file name (optional; for a single output file) */ 13 | char outfileP; 14 | char* outfile; 15 | int outfileC; 16 | /***** -nohdr: Output just raw data. No headers are output */ 17 | char nohdrP; 18 | /***** -stdout: Send the data to STDOUT instead of files */ 19 | char stdoutP; 20 | /***** -floats: Output data as 32-bit floats instead of 8-bit unsigned chars */ 21 | char floatsP; 22 | /***** -zerolags: Dump the raw spigot zerolags in 32-bit floats format to a file */ 23 | char zerolagsP; 24 | /***** -skip: Number of spectra to skip from the initial value */ 25 | char skipP; 26 | int skip; 27 | int skipC; 28 | /***** -numout: Number of spectra to output (default is all) */ 29 | char numoutP; 30 | int numout; 31 | int numoutC; 32 | /***** -downsamp: Number of spectra to average on output */ 33 | char downsampP; 34 | int downsamp; 35 | int downsampC; 36 | /***** -lokill: Number of low-freq channels to ignore */ 37 | char lokillP; 38 | int lokill; 39 | int lokillC; 40 | /***** -hikill: Number of high-freq channels to ignore */ 41 | char hikillP; 42 | int hikill; 43 | int hikillC; 44 | /***** uninterpreted command line parameters */ 45 | int argc; 46 | /*@null*/char **argv; 47 | /***** the whole command line concatenated */ 48 | char *full_cmd_line; 49 | } Cmdline; 50 | 51 | 52 | extern char *Program; 53 | extern void usage(void); 54 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 55 | 56 | extern void showOptionValues(void); 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /include/toas2dat_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __toas2dat_cmd__ 2 | #define __toas2dat_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -n: The number of bins in the output time series */ 13 | char numoutP; 14 | int numout; 15 | int numoutC; 16 | /***** -dt: Time interval in seconds for output time bins */ 17 | char dtP; 18 | double dt; 19 | int dtC; 20 | /***** -t0: Time for the start of bin 0 (same units as the TOAs) */ 21 | char t0P; 22 | double t0; 23 | int t0C; 24 | /***** -o: Name of the output time series file */ 25 | char outfileP; 26 | char* outfile; 27 | int outfileC; 28 | /***** -text: TOAs are ASCII text (default is binary double) */ 29 | char textP; 30 | /***** -float: TOAs are binary floats (default is binary double) */ 31 | char floatP; 32 | /***** -sec: TOA unit is seconds (default is days) */ 33 | char secP; 34 | /***** uninterpreted command line parameters */ 35 | int argc; 36 | /*@null*/char **argv; 37 | /***** the whole command line concatenated */ 38 | char *full_cmd_line; 39 | } Cmdline; 40 | 41 | 42 | extern char *Program; 43 | extern void usage(void); 44 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 45 | 46 | extern void showOptionValues(void); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /include/wapp_key.h: -------------------------------------------------------------------------------- 1 | struct HEADERKEY { 2 | void *next; 3 | char *name; 4 | int offset; 5 | int type; 6 | int len; /* length of data element */ 7 | int alen; /* array length */ 8 | }; 9 | 10 | struct HEADERVAL { 11 | void *value; 12 | struct HEADERKEY *key; 13 | }; 14 | 15 | struct HEADERP { 16 | struct HEADERKEY *head; 17 | struct HEADERKEY *tail; 18 | char *buf; /* ascii C header declaration */ 19 | int offset; /* len of buf ( offset to start of generic head in file */ 20 | void *header; /* pointer to instance of generic header */ 21 | int headlen; /* len of generic header */ 22 | int fd; /* file des */ 23 | int yacc_offset; /* last returned by head_input */ 24 | }; 25 | 26 | struct HEADERP *head_parse(FILE *f); 27 | extern struct HEADERKEY headerkey[]; 28 | int find_hdrval(struct HEADERP *h, char *name, struct HEADERVAL *hdrval); 29 | void close_parse(struct HEADERP *h); 30 | -------------------------------------------------------------------------------- /include/zapbirds_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __zapbirds_cmd__ 2 | #define __zapbirds_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -zap: Zap the birds in the FFT from 'zapfile' (write to the FFT file) */ 13 | char zapP; 14 | /***** -zapfile: A file of freqs and widths to zap from the FFT (when using '-zap') */ 15 | char zapfileP; 16 | char* zapfile; 17 | int zapfileC; 18 | /***** -in: A file containing a list of freqs (Hz) and the # of harmonics to zap */ 19 | char inzapfileP; 20 | char* inzapfile; 21 | int inzapfileC; 22 | /***** -out: A file to write that will contain the freqs and widths (Hz) zapped */ 23 | char outzapfileP; 24 | char* outzapfile; 25 | int outzapfileC; 26 | /***** -baryv: The radial velocity component (v/c) towards the target during the obs */ 27 | char baryvP; 28 | double baryv; 29 | int baryvC; 30 | /***** uninterpreted command line parameters */ 31 | int argc; 32 | /*@null*/char **argv; 33 | /***** the whole command line concatenated */ 34 | char *full_cmd_line; 35 | } Cmdline; 36 | 37 | 38 | extern char *Program; 39 | extern void usage(void); 40 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 41 | 42 | extern void showOptionValues(void); 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /lib/a2x.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/a2x.ps -------------------------------------------------------------------------------- /lib/a2xshell.ps: -------------------------------------------------------------------------------- 1 | %! 2 | % Copyright (C) 1994-1996 Christoph Beck, 3 | % All rights reserved. 4 | % 5 | % This software may be distributed under the terms of the GNU General 6 | % Public License. 7 | % 8 | % push shell arguments on stack and execute A2x 9 | [ shellarguments { ] a2xdict begin A2x end } { pop } ifelse 10 | -------------------------------------------------------------------------------- /lib/libpresto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/libpresto.so -------------------------------------------------------------------------------- /lib/libsla.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/libsla.so -------------------------------------------------------------------------------- /lib/pulsars.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/pulsars.cat -------------------------------------------------------------------------------- /lib/python/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2013,1,8,13,39,8 3 | ViewMode=2 4 | -------------------------------------------------------------------------------- /lib/python/PRESTO-0.99.egg-info: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.0 2 | Name: PRESTO 3 | Version: 0.99 4 | Summary: Python interfaces to PGPLOT and PRESTO 5 | Home-page: UNKNOWN 6 | Author: Scott Ransom (ppgplot from Nick Patavlis) 7 | Author-email: sransom@nrao.edu 8 | License: UNKNOWN 9 | Description: UNKNOWN 10 | Platform: UNKNOWN 11 | -------------------------------------------------------------------------------- /lib/python/_ppgplot.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/python/_ppgplot.so -------------------------------------------------------------------------------- /lib/python/_presto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/python/_presto.so -------------------------------------------------------------------------------- /lib/python/catalog_query.txt: -------------------------------------------------------------------------------- 1 | http://www.atnf.csiro.au/research/pulsar/psrcat/proc_form.php?Name=Name&JName=JName&RaJ=RaJ&DecJ=DecJ&PMRA=PMRA&PMDec=PMDec&PX=PX&PosEpoch=PosEpoch&GL=GL&GB=GB&P0=P0&P1=P1&F2=F2&F3=F3&PEpoch=PEpoch&DM=DM&DM1=DM1&S400=S400&S1400=S1400&Binary=Binary&T0=T0&PB=PB&A1=A1&OM=OM&Ecc=Ecc&Tasc=Tasc&Eps1=Eps1&Eps2=Eps2&Dist=Dist&Assoc=Assoc&Type=Type&startUserDefined=true&c1_val=&c2_val=&c3_val=&c4_val=&sort_attr=jname&sort_order=asc&condition=&pulsar_names=&ephemeris=short&coords_unit=raj%2Fdecj&radius=&coords_1=&coords_2=&style=Long+with+errors&no_value=*&x_axis=&x_scale=linear&y_axis=&y_scale=linear&state=query&table_bottom.x=40&table_bottom.y=0 2 | -------------------------------------------------------------------------------- /lib/python/cosine_rand.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/python/cosine_rand.pickle -------------------------------------------------------------------------------- /lib/python/ppgplot/__init__.py: -------------------------------------------------------------------------------- 1 | from _ppgplot import * 2 | -------------------------------------------------------------------------------- /lib/python/ppgplot/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/python/ppgplot/__init__.pyc -------------------------------------------------------------------------------- /lib/python/presto/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/python/presto/__init__.pyc -------------------------------------------------------------------------------- /lib/python/presto/prestoswig.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/lib/python/presto/prestoswig.pyc -------------------------------------------------------------------------------- /lib/python/psr_constants.py: -------------------------------------------------------------------------------- 1 | ## Automatically adapted for numpy Apr 14, 2006 by convertcode.py 2 | 3 | ARCSECTORAD = float('4.8481368110953599358991410235794797595635330237270e-6') 4 | RADTOARCSEC = float('206264.80624709635515647335733077861319665970087963') 5 | SECTORAD = float('7.2722052166430399038487115353692196393452995355905e-5') 6 | RADTOSEC = float('13750.987083139757010431557155385240879777313391975') 7 | RADTODEG = float('57.295779513082320876798154814105170332405472466564') 8 | DEGTORAD = float('1.7453292519943295769236907684886127134428718885417e-2') 9 | RADTOHRS = float('3.8197186342054880584532103209403446888270314977710') 10 | HRSTORAD = float('2.6179938779914943653855361527329190701643078328126e-1') 11 | PI = float('3.1415926535897932384626433832795028841971693993751') 12 | TWOPI = float('6.2831853071795864769252867665590057683943387987502') 13 | PIBYTWO = float('1.5707963267948966192313216916397514420985846996876') 14 | SECPERDAY = float('86400.0') 15 | SECPERJULYR = float('31557600.0') 16 | KMPERPC = float('3.0856776e13') 17 | KMPERKPC = float('3.0856776e16') 18 | Tsun = float('4.925490947e-6') # sec 19 | Msun = float('1.9891e30') # kg 20 | Mjup = float('1.8987e27') # kg 21 | Rsun = float('6.9551e8') # m 22 | Rearth = float('6.378e6') # m 23 | SOL = float('299792458.0') # m/s 24 | MSUN = float('1.989e+30') # kg 25 | G = float('6.673e-11') # m^3/s^2/kg 26 | C = SOL 27 | -------------------------------------------------------------------------------- /python/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2013,2,18,17,16,29 3 | ViewMode=1 4 | -------------------------------------------------------------------------------- /python/.ipp.log: -------------------------------------------------------------------------------- 1 | from presto import * 2 | import numpyio 3 | file = open("/pulsar/data/M15short/supershort.fft", 'r') 4 | data = numpyio.fread(file, 500000, 'F') 5 | file.close() 6 | inf = read_inffile("/pulsar/data/M15short/supershort") 7 | show_ffdot_plane(data, 68603, 0.0) 8 | nextplotpage() 9 | nextpageplot() 10 | dir() 11 | from Pgplot import * 12 | nextplotpage() 13 | show_ffdot_plane(data, 68603*2, 0.0) 14 | nextplotpage() 15 | show_ffdot_plane(data, 90223, 0.0) 16 | show_ffdot_plane(data, 90223*2, 0.0) 17 | nextplotpage() 18 | show_ffdot_plane(data, 90223*2, 0.0) 19 | nextplotpage() 20 | show_ffdot_plane(data, 90223/2, 0.0) 21 | nextplotpage() 22 | show_ffdot_plane(data, 69986, 0.0) 23 | nextplotpage() 24 | show_ffdot_plane(data, 69986, 200.0) 25 | nextplotpage() 26 | show_ffdot_plane(data, 69986-100, 200.0) 27 | nextplotpage() 28 | show_ffdot_plane(data, 35114, 0.0) 29 | nextplotpage() 30 | show_ffdot_plane(data, 35114*2, 0.0) 31 | nextplotpage() 32 | show_ffdot_plane(data, 35114*3, 0.0) 33 | nextplotpage() 34 | show_ffdot_plane(data, 49377, 0.0) 35 | nextplotpage() 36 | show_ffdot_plane(data, 49377*2, 0.0) 37 | nextplotpage() 38 | show_ffdot_plane(data, 44450, 0.0) 39 | nextplotpage() 40 | show_ffdot_plane(data, 44450*2, 0.0) 41 | nextplotpage() 42 | show_ffdot_plane(data, 44450*3, 0.0) 43 | nextplotpage() 44 | show_ffdot_plane(data, 44450*3, 100.0) 45 | nextplotpage() 46 | show_ffdot_plane(data, 44450*3, -100.0) 47 | nextplotpage() 48 | show_ffdot_plane(data, 44450*3, 0.0) 49 | closeplot() 50 | -------------------------------------------------------------------------------- /python/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | python setup.py install --home=${PRESTO} 3 | 4 | fftfit: 5 | cd fftfit_src ; f2py -c fftfit.pyf *.f 6 | cd fftfit_src ; cp fftfit.so ${PRESTO}/lib/python 7 | 8 | clean: 9 | rm -rf build 10 | rm -f *~ *.o *.so *.pyc 11 | -------------------------------------------------------------------------------- /python/binopttest/README.txt: -------------------------------------------------------------------------------- 1 | Binary Optimization Peak Width Results 2 | -------------------------------------- 3 | 4 | These results are from a Monte Carlo sample of 287 realistic PSR binaries. 5 | Only 112 of these orbits (those in NS-NS systems that had a significant 6 | eccentricity) were used for the Orb e and Orb w width estimation. 7 | 8 | The results were: 9 | 10 | Logarithmic Fits: 11 | 12 | log(Orb p) width = 0.9792168 * log(Orb p/z) - 10.9658871 (chi-sq: 43.697334) 13 | log(Orb x) width = 0.9572412 * log(1.0/z) + 0.7110553 (chi-sq: 11.204193) 14 | log(Orb t) width = 0.9420009 * log(1.0/z) - 1.1676730 (chi-sq: 34.879553) 15 | 16 | Linear Fits: 17 | 18 | Orb p width = 0.0000160 * Orb p/z + 0.0000841 (chi-sq: 0.000816) 19 | Orb x width = 2.2420709 * 1.0/z + 0.0019139 (chi-sq: 0.004983) 20 | Orb t width = 0.3755975 * 1.0/z + 0.0002719 (chi-sq: 0.000436) 21 | 22 | Note: The above widths are fractional widths. Orb t width is the fraction 23 | of Orb p. The approximate widths of the Orb e and Orb w peaks are: 24 | 25 | Orb e width = 0.016 26 | Orb w width = 0.8 degrees 27 | 28 | The raw data is in the file: testresults.txt 29 | Python scripts for data message are in: bindata.py 30 | Plots of the above fits are in: fits.ps and logfits.ps 31 | The Monte Carlo routine itself is in : montebinopt.py 32 | 33 | Scott M. Ransom 34 | 5 Nov 1998 35 | -------------------------------------------------------------------------------- /python/binopttest/comb.py: -------------------------------------------------------------------------------- 1 | from Numeric import * 2 | from presto import * 3 | from LeastSquares import leastSquaresFit 4 | from orbitstuff import * 5 | 6 | # Observation parameters 7 | dt = 0.000125 # The duration of each data sample 8 | N = 2**28 # The number of points in the observation 9 | T = N*dt # The total observation time 10 | ctype = 'NS' # The type of binary companion: 'WD', 'NS', or 'BH' 11 | 12 | mpsr = mc = 0.0 13 | psr = fake_mspsr(companion = ctype) 14 | psr.orb.e = 0.0 15 | psr.orb.t = 0.0 16 | psr.orb.w = 0.0 17 | z = 2*pi*psr.orb.x/psr.p 18 | print '' 19 | print ' PSR mass =', mpsr 20 | print ' Companion mass =', mc 21 | print ' PSR period (s) =', psr.p 22 | print ' PSR frequency (hz) =', 1.0/psr.p 23 | print ' Orbit period (s) =', psr.orb.p 24 | print ' Orbit asini/c (lt-s) =', psr.orb.x 25 | print ' Orbit eccentricity =', psr.orb.e 26 | print ' Orbit angle (deg) =', psr.orb.w 27 | print ' Orbit time (s) =', psr.orb.t 28 | print ' Orbit Fourier Freq =', T/psr.orb.p 29 | print ' Orbit z =', z 30 | print '' 31 | m = 0 32 | kernel = presto.gen_bin_response(0.0, 1, psr.p, T, psr.orb , 33 | presto.LOWACC, m) 34 | fftlen = next2_to_n(len(kernel)) 35 | comb= zeros(fftlen, 'F') 36 | comb[0:len(kernel)] = kernel 37 | minifft = rfft(spectralpower(comb)) 38 | minipow = spectralpower(minifft) 39 | miniphs = spectralphase(minifft) 40 | miniphs = array(miniphs, typecode='d', copy=1) 41 | for i in range(len(minifft)-1): 42 | if miniphs[i+1]-miniphs[i] < 0.0: 43 | miniphs[i+1:] = miniphs[i+1:] + 360.0 44 | 45 | -------------------------------------------------------------------------------- /python/binopttest/fits.ps.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/python/binopttest/fits.ps.gz -------------------------------------------------------------------------------- /python/binopttest/logfits.ps.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/python/binopttest/logfits.ps.gz -------------------------------------------------------------------------------- /python/binopttest/orbitstuff.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/python/binopttest/orbitstuff.pyc -------------------------------------------------------------------------------- /python/binresponses/parjob.txt: -------------------------------------------------------------------------------- 1 | # @ environment = "LL_JOB=TRUE" 2 | # @ initialdir = /u/user4/ransom 3 | # @ job_type = parallel 4 | # @ comment = protect_hsm 5 | # @ min_processors = 40 6 | # @ environment = COPY_ALL 7 | # @ notification = always 8 | # @ notify_user = ransom@cfa.harvard.edu 9 | # @ error = montebinresp.err 10 | # @ output = montebinresp.out 11 | # @ wall_clock_limit = 11:00:00 12 | # @ queue 13 | # -------------------------------------------------------------------- 14 | tokens 15 | set echo 16 | date 17 | setenv MP_NEWJOB yes 18 | setenv MP_STDINMODE none 19 | setenv HOMEDIR "/afs/theory.cornell.edu/user/user4/ransom" 20 | setenv SCRATCH "/tmp/scratch/ransom" 21 | set spnodes = `echo $LOADL_PROCESSOR_LIST` 22 | set counter = 0 23 | foreach node ( ${spnodes} ) 24 | rsh ${node} mkdir -p $SCRATCH 25 | set node$counter = $node 26 | @ counter++ 27 | end 28 | setenv NODEZERO $node0 29 | cd $SCRATCH 30 | poe << EOF 31 | pwd 32 | mcp $HOMEDIR/bin/parpython parpython 33 | mcp $HOMEDIR/montebinresp.py montebinresp.py 34 | ./parpython montebinresp.py 35 | rm -f parpython montebinresp.py 36 | cp *.out $HOMEDIR 37 | EOF 38 | -------------------------------------------------------------------------------- /python/build/lib.linux-x86_64-2.7/_ppgplot.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/python/build/lib.linux-x86_64-2.7/_ppgplot.so -------------------------------------------------------------------------------- /python/build/lib.linux-x86_64-2.7/_presto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/python/build/lib.linux-x86_64-2.7/_presto.so -------------------------------------------------------------------------------- /python/build/lib.linux-x86_64-2.7/ppgplot/__init__.py: -------------------------------------------------------------------------------- 1 | from _ppgplot import * 2 | -------------------------------------------------------------------------------- /python/build/temp.linux-x86_64-2.7/ppgplot_src/_ppgplot.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/python/build/temp.linux-x86_64-2.7/ppgplot_src/_ppgplot.o -------------------------------------------------------------------------------- /python/build/temp.linux-x86_64-2.7/presto_src/presto_wrap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/python/build/temp.linux-x86_64-2.7/presto_src/presto_wrap.o -------------------------------------------------------------------------------- /python/f-fdot_example.ps.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/python/f-fdot_example.ps.gz -------------------------------------------------------------------------------- /python/fftfit_src/brent.f: -------------------------------------------------------------------------------- 1 | C @(#)brent.f 1.1 9/7/90 2 | function zbrent(x1,x2,f1,f2,tol,tmp,pha,nsum) 3 | 4 | C Brent's method root finding, calls dchisqr(x,tmp,r,nsum) function for fftfit 5 | C Fit refined till output accuracy is tol 6 | 7 | parameter (itmax=100,eps=6.e-8,MAXSAM=8192) 8 | real*4 tmp(MAXSAM/2),pha(MAXSAM/2) 9 | 10 | a=x1 11 | b=x2 12 | fa=f1 13 | fb=f2 14 | fc=fb 15 | do 11 iter=1,itmax 16 | if(fb*fc.gt.0.) then 17 | c=a 18 | fc=fa 19 | d=b-a 20 | e=d 21 | end if 22 | if(abs(fc).lt.abs(fb)) then 23 | a=b 24 | b=c 25 | c=a 26 | fa=fb 27 | fb=fc 28 | fc=fa 29 | end if 30 | tol1=2.*eps*abs(b)+0.5*tol 31 | xm=.5*(c-b) 32 | if(abs(xm).le.tol1 .or. fb.eq.0.) then 33 | zbrent=b 34 | return 35 | end if 36 | if(abs(e).ge.tol1 .and. abs(fa).gt.abs(fb)) then 37 | s=fb/fa 38 | if(a.eq.c) then 39 | p=2.*xm*s 40 | q=1.-s 41 | else 42 | q=fa/fc 43 | r=fb/fc 44 | p=s*(2.*xm*q*(q-r)-(b-a)*(r-1.)) 45 | q=(q-1.)*(r-1.)*(s-1.) 46 | end if 47 | if(p.gt.0.) q=-q 48 | p=abs(p) 49 | if(2.*p .lt. min(3.*xm*q-abs(tol1*q),abs(e*q))) then 50 | e=d 51 | d=p/q 52 | else 53 | d=xm 54 | e=d 55 | end if 56 | else 57 | d=xm 58 | e=d 59 | end if 60 | a=b 61 | fa=fb 62 | if(abs(d) .gt. tol1) then 63 | b=b+d 64 | else 65 | b=b+sign(tol1,xm) 66 | end if 67 | fb=dchisqr(b,tmp,pha,nsum) 68 | 11 continue 69 | zbrent=b 70 | return 71 | end 72 | 73 | function dchisqr(tau,tmp,r,nsum) 74 | 75 | parameter (MAXSAM=8192) 76 | real*4 tmp(MAXSAM/2),r(MAXSAM/2) 77 | 78 | s=0. 79 | do 40 k=1,nsum 80 | 40 s=s+k*tmp(k)*sin(-r(k)+k*tau) 81 | dchisqr=s 82 | return 83 | end 84 | -------------------------------------------------------------------------------- /python/fftfit_src/cprof.f: -------------------------------------------------------------------------------- 1 | C @(#)cprof.f 1.1 9/7/90 2 | subroutine cprof(y,nmax,nh,c,amp,pha) 3 | 4 | C Compute FFT of profile in array y(nmax), and return amplitude and phase 5 | C in arrays amp(nh) and pha(nh). Note that nh=nmax/2, and that the DC term 6 | C is returned in c(0), fundamental in c(1), ..., Nyquist freq in c(nh). 7 | 8 | parameter(MAXSAM=8192) 9 | real*4 y(nmax),amp(nh),pha(nh) 10 | complex c(0:nh),temp(MAXSAM) 11 | 12 | do 10 i=1,nh 13 | 10 temp(i)=cmplx(y(2*i-1),y(2*i)) 14 | call ffft(temp,nmax,1,1) 15 | c(0)=temp(1) 16 | do 20 i=1,nh 17 | c(i)=temp(i+1) 18 | amp(i)=cabs(c(i)) 19 | pha(i)=0. 20 | 20 if(amp(i).gt.0.) pha(i)=aimag(clog(c(i))) 21 | return 22 | end 23 | -------------------------------------------------------------------------------- /python/fftfit_src/fccf.f: -------------------------------------------------------------------------------- 1 | C @(#)fccf.f 1.1 9/7/90 2 | subroutine fccf(amp,pha,shift) 3 | 4 | C Calculates CCF in Fourier domain using 16 harmonics of amp and pha arrays 5 | C amp=p*s,pha=theta-phi. Finds maximum of CCF at 64 lags over the pulsar 6 | C period, and returns value of shift in radians. 7 | 8 | parameter (nprof=64) 9 | parameter (MAXSAM=8192,twopi=6.2831853) 10 | real*4 amp(MAXSAM/2),pha(MAXSAM/2) 11 | complex ccf(0:63) 12 | 13 | nh=nprof/2 14 | ccf(0)=(0.,0.) 15 | do 10 i=1,nh/2 16 | ccf(i)=cmplx(amp(i)*cos(pha(i)),amp(i)*sin(pha(i))) 17 | 10 ccf(nprof-i)=conjg(ccf(i)) 18 | do 20 i=nh/2+1,nh 19 | ccf(i)=(0.,0.) 20 | 20 ccf(nprof-i)=(0.,0.) 21 | call ffft(ccf,nprof,-1,0) 22 | cmax=-1.e30 23 | do 30 i=0,63 24 | rc=real(ccf(i)) 25 | if (rc.gt.cmax) then 26 | cmax=rc 27 | imax=i 28 | end if 29 | 30 continue 30 | 31 | fb=cmax 32 | ia=imax-1 33 | if(ia.eq.-1) ia=nprof-1 34 | fa=real(ccf(ia)) 35 | ic=imax+1 36 | if(ic.eq.nprof) ic=0 37 | fc=real(ccf(ic)) 38 | if ((2*fb-fc-fa).ne.0) then 39 | shift=imax+0.5*(fa-fc)/(2*fb-fc-fa) 40 | else 41 | shift=imax 42 | end if 43 | if(shift.gt.nh) shift=shift-nprof 44 | shift=shift*twopi/nprof 45 | 46 | return 47 | end 48 | -------------------------------------------------------------------------------- /python/fftfit_src/ffft.f: -------------------------------------------------------------------------------- 1 | C @(#)ffft.f 1.1 9/7/90 2 | subroutine ffft(d,npts,isign,ireal) 3 | 4 | C Fourier transform of length npts=2**k, performed in place. 5 | C Input data in array d, treated as complex if ireal=0, and as real if ireal=1. 6 | C In either case the transform values are returned in array d, treated as 7 | C complex. The DC term is d(1), and d(npts/2+1) is the term at the Nyquist 8 | C frequency. The basic algorithm is the same as Norm Brenner's FOUR1, and 9 | C uses radix-2 transforms. 10 | 11 | C J. H. Taylor, Princeton University. 12 | 13 | parameter(MAXSAM=8192) 14 | complex d(MAXSAM),t,w,wstep,tt,uu 15 | data pi/3.14159265/ 16 | 17 | C Shuffle the data to bit-reversed order. 18 | 19 | imax=npts/(ireal+1) 20 | irev=1 21 | do 5 i=1,imax 22 | if(i.ge.irev) go to 2 23 | t=d(i) 24 | d(i)=d(irev) 25 | d(irev)=t 26 | 2 mmax=imax/2 27 | 3 if(irev.le.mmax) go to 5 28 | irev=irev-mmax 29 | mmax=mmax/2 30 | if(mmax.ge.1) go to 3 31 | 5 irev=irev+mmax 32 | 33 | C The radix-2 transform begins here. 34 | 35 | api=isign*pi/2. 36 | mmax=1 37 | 6 istep=2*mmax 38 | wstep=cmplx(-2.*sin(api/mmax)**2,sin(2.*api/mmax)) 39 | w=1. 40 | do 9 m=1,mmax 41 | 42 | C This in the inner-most loop -- optimization here is important! 43 | do 8 i=m,imax,istep 44 | t=w*d(i+mmax) 45 | d(i+mmax)=d(i)-t 46 | 8 d(i)=d(i)+t 47 | 48 | 9 w=w*(1.+wstep) 49 | mmax=istep 50 | if(mmax.lt.imax) go to 6 51 | 52 | if(ireal.eq.0) return 53 | 54 | C Now complete the last stage of a doubled-up real transform. 55 | 56 | jmax=imax/2 + 1 57 | wstep=cmplx(-2.*sin(isign*pi/npts)**2,sin(isign*pi/imax)) 58 | w=1.0 59 | d(imax+1)=d(1) 60 | 61 | do 10 j=1,jmax 62 | uu=cmplx(real(d(j))+real(d(2+imax-j)),aimag(d(j)) - 63 | + aimag(d(2+imax-j))) 64 | tt=w*cmplx(aimag(d(j))+aimag(d(2+imax-j)),-real(d(j)) + 65 | + real(d(2+imax-j))) 66 | d(j)=uu+tt 67 | d(2+imax-j)=conjg(uu-tt) 68 | 10 w=w*(1.+wstep) 69 | 70 | return 71 | end 72 | -------------------------------------------------------------------------------- /python/fftfit_src/fftfit.pyf: -------------------------------------------------------------------------------- 1 | !%f90 -*- f90 -*- 2 | python module fftfit ! in 3 | interface ! in :fftfit 4 | subroutine cprof(y,nmax,nh,c,amp,pha) ! in :fftfit:brent.f,cprof.f,fccf.f,ffft.f,fftfit.f 5 | real*4 dimension(nmax) :: y 6 | integer optional,check(len(y)>=nmax),depend(y) :: nmax=len(y) 7 | integer optional :: nh=(nmax/2) 8 | complex intent(out),dimension(nh+1) :: c 9 | real*4 intent(out),dimension(nh),depend(nh) :: amp 10 | real*4 intent(out),dimension(nh),depend(nh) :: pha 11 | end subroutine cprof 12 | subroutine fftfit(prof,s,phi,nmax,shift,eshift,snr,esnr,b,errb,ngood) ! in :fftfit:fftfit.f 13 | real*4 dimension(nmax),intent(in) :: prof 14 | real*4 dimension(nmax/2),intent(in) :: s 15 | real*4 dimension(nmax/2),intent(in) :: phi 16 | integer optional,check(len(prof)>=nmax),depend(prof) :: nmax=len(prof) 17 | real intent(out) :: shift 18 | real intent(out) :: eshift 19 | real intent(out) :: snr 20 | real intent(out) :: esnr 21 | real intent(out) :: b 22 | real intent(out) :: errb 23 | integer intent(out) :: ngood 24 | end subroutine fftfit 25 | end interface 26 | end python module fftfit 27 | 28 | ! This file was auto-generated with f2py (version:2.13.175-1250). 29 | ! See http://cens.ioc.ee/projects/f2py2e/ 30 | -------------------------------------------------------------------------------- /python/fftfit_src/fftfit.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/python/fftfit_src/fftfit.so -------------------------------------------------------------------------------- /python/fftfit_src/test_fftfit.py: -------------------------------------------------------------------------------- 1 | #>>> print fftfit.__doc__ 2 | #This module 'fftfit' is auto-generated with f2py (version:2.13.175-1250). 3 | #Functions: 4 | # zbrent = zbrent(x1,x2,f1,f2,tol,tmp,pha,nsum) 5 | # dchisqr = dchisqr(tau,tmp,r,nsum) 6 | # cprof(y,c,amp,pha,nmax=len(y),nh=(len(c)-1)) 7 | # fccf(amp,pha,shift) 8 | # ffft(d,npts,isign,ireal) 9 | # fftfit(prof,s,phi,nmax,shift,eshift,snr,esnr,b,errb,ngood) 10 | 11 | import numpy as num 12 | from psr_utils import gaussian_profile, TWOPI 13 | from fftfit import cprof, fftfit 14 | 15 | template = gaussian_profile(64, 0.5, 0.1) 16 | c,amp,pha = cprof(template) 17 | #pha.savespace() 18 | pha1 = pha[0] 19 | pha = num.fmod(pha-num.arange(1,len(pha)+1)*pha1,TWOPI) 20 | for phs in [0.1, 0.3, 0.7]: 21 | prof = gaussian_profile(64, phs, 0.1)+num.random.standard_normal(64) 22 | shift,eshift,snr,esnr,b,errb,ngood = fftfit(prof,amp,pha) 23 | print "True phs = %f, measured phs = %f +/- %f" % (phs, shift/len(prof),eshift/len(prof)) 24 | -------------------------------------------------------------------------------- /python/misc/pychecks.py: -------------------------------------------------------------------------------- 1 | from numpy import * 2 | from Pgplot import * 3 | from psr_utils import * 4 | from presto import * 5 | 6 | # Check the image plotting software 7 | a = distance(201) 8 | b = exp(-a**2/1000.0) 9 | x = arange(-100.0, 101.0, 1.0) 10 | plot2d(b, x, x, contours=array([0.2, 0.5, 0.7]), color='black', labels='white', labelint=50, labelmin=30) 11 | closeplot() 12 | 13 | # Check the f-fdot plane generator 14 | fftfile = open('../../tests/testz.fft') 15 | m = 0 16 | numbetween = 8 17 | lof = 19990.0 18 | loz = -20.0 19 | hiz = 20.0 20 | numz = 81.0 21 | numfplot = 20.0 22 | dz = (hiz-loz)/(numz-1.0) 23 | a = corr_rz_plane_file(fftfile, numbetween, lof, loz, hiz, numz, 1024, LOWACC, m) 24 | a[1] 25 | b = (a[0].real**2 + a[0].imag**2)/get_numphotons(fftfile) 26 | x = arange(numfplot*numbetween, dtype='f') / numbetween + lof 27 | y = arange(numz, dtype='f') * dz + loz 28 | c = arange(6) * 10.0 + 10.0 29 | plot2d(b[:,0:int(numfplot*numbetween)], x, y, \ 30 | labx="Fourier Frequency", laby="Fourier F-dot", \ 31 | contours=c, color='black', image='heat') #, \ 32 | # device='test.ps/CPS') 33 | nextplotpage(1) 34 | plot2d(b[:,0:int(numfplot*numbetween)], x, y, \ 35 | labx="Fourier Frequency", laby="Fourier F-dot", \ 36 | contours=c, color='black', image='astro') #, \ 37 | # device='test.ps/CPS') 38 | closeplot() 39 | 40 | -------------------------------------------------------------------------------- /python/pdm2raw.py: -------------------------------------------------------------------------------- 1 | from numpyio import fread, fwrite 2 | from sys import argv 3 | 4 | print "\nReading info from %s.hdr and" % argv[1] 5 | print "%s.dat\n" % argv[1] 6 | print "Writing %s.raw\n" % argv[1] 7 | 8 | HEADERLEN = 640 9 | BLOCKLEN = 49152 10 | 11 | # Read the header file 12 | 13 | file = open(argv[1]+'.hdr', 'r') 14 | data = fread(file, HEADERLEN+8, 'b') 15 | file.close() 16 | header = data[4:-4] 17 | infile = open(argv[1]+'.dat', 'r') 18 | outfile = open(argv[1]+'.raw', 'w') 19 | 20 | # Read and write the raw data 21 | 22 | while (1): 23 | data = fread(infile, BLOCKLEN+8, 'b') 24 | if (len(data)==BLOCKLEN+8): 25 | fwrite(outfile, HEADERLEN, header, 'b') 26 | fwrite(outfile, BLOCKLEN, data[4:-4], 'b') 27 | else: 28 | break 29 | print '' 30 | infile.close() 31 | outfile.close() 32 | -------------------------------------------------------------------------------- /python/ppgplot_src/__init__.py: -------------------------------------------------------------------------------- 1 | from _ppgplot import * 2 | -------------------------------------------------------------------------------- /python/show_zresp.py: -------------------------------------------------------------------------------- 1 | from numpy import * 2 | from Pgplot import * 3 | from presto import * 4 | 5 | kern_half_width = 10 6 | numbetween = 10 7 | numkern = 2 * numbetween * kern_half_width 8 | f = arange(numkern, dtype=float64) / numbetween - kern_half_width 9 | kern = gen_z_response(0.0, numbetween, 0.0, numkern) 10 | pkern = spectralpower(kern) 11 | print "Freq ", f[len(f)/2], " = ", pkern[len(f)/2] 12 | plotxy(pkern, f, labx="Fourier Frequency Offset", \ 13 | laby="Normalized Power", device="z_responses.eps/CPS") 14 | #plotxy(pkern, f, labx="Fourier Frequency Offset", \ 15 | # laby="Normalized Power") 16 | for i in range(4): 17 | z = 5.0 * i 18 | kern = gen_z_response(0.0, numbetween, z, numkern) 19 | pkern = spectralpower(kern) 20 | plotxy(pkern, f, color=i+1) 21 | ppgplot.pgtext(5.0, 0.8 - i*0.1, 'z = %1.0f' % z) 22 | closeplot() 23 | -------------------------------------------------------------------------------- /python/testcorr.py: -------------------------------------------------------------------------------- 1 | from numpy import * 2 | from Pgplot import * 3 | from presto import * 4 | 5 | file = "testz" 6 | displaybins = 20 7 | numbetween = 16 8 | numpts = displaybins * numbetween 9 | 10 | # Read the '.mak' file 11 | md = read_makfile(file) 12 | 13 | # Open and read the data 14 | fftfile = open(file+".fft","r") 15 | filelen = chkfilelen(fftfile, 8) 16 | data = fftfile.read() 17 | data = fromstring(data, "F") 18 | fftfile.close() 19 | nph = data[0].real 20 | 21 | # Set up some useful things 22 | centerr = md.r + md.z / 2.0 23 | startbin = floor(centerr - displaybins / 2.0) 24 | ca = zeros(numpts, dtype=complex64) 25 | cf = arange(startbin, startbin + displaybins, 1.0 / numbetween) 26 | 27 | # Show the power spectrum without f-dot correction 28 | kern_halfwidth = z_resp_halfwidth(0.0, HIGHACC) 29 | numkern = 2 * numbetween * kern_halfwidth 30 | for i in range(numpts): 31 | ca[i] = rz_interp(data, filelen, cf[i], 0.0, kern_halfwidth) 32 | cpow = spectralpower(asarray(ca)) / nph 33 | cphs = spectralphase(ca) 34 | maxval = argmax(cpow) 35 | plotxy(cpow, cf-1e6, labx="Fourier Frequency - 1e6", laby="Power") 36 | print "Maximum value is at r =", startbin + maxval / float(numbetween) 37 | print " Power =", cpow[maxval], " Phase =", cphs[maxval] 38 | closeplot() 39 | 40 | # Show the power spectrum with f-dot correction 41 | kern_halfwidth = z_resp_halfwidth(md.z, HIGHACC) 42 | numkern = 2 * numbetween * kern_halfwidth 43 | for i in range(numpts): 44 | ca[i] = rz_interp(data, filelen, cf[i], md.z, kern_halfwidth) 45 | cpow = spectralpower(ca) / nph 46 | cphs = spectralphase(ca) 47 | maxval = argmax(cpow) 48 | plotxy(cpow, cf-1e6, labx="Fourier Frequency - 1e6", laby="Power") 49 | print "Maximum value is at r =", startbin + maxval / float(numbetween) 50 | print " Power =", cpow[maxval], " Phase =", cphs[maxval] 51 | closeplot() 52 | 53 | -------------------------------------------------------------------------------- /python/testz.mak: -------------------------------------------------------------------------------- 1 | Test data set with an f-dot 2 | Num data pts = 8388608 3 | dt per bin (s) = 1.1920928955078125e-07 4 | Pulse shape = Sine 5 | Rounding format = Fractional 6 | Pulse freq (hz) = 1000000.345 7 | fdot (s-2) = 5.789 8 | fdotdot (s-3) = 0 9 | Pulse amp = 0.15 10 | Pulse phs (deg) = 224.657 11 | DC backgrnd level = 200 12 | Binary period (s) = 0 13 | Bin asini/c (s) = 0 14 | Bin eccentricity = 0 15 | Ang of Peri (deg) = 0 16 | Tm since peri (s) = 0 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Standard 21 | Noise sigma = 14.142135623731 22 | On/Off Pair 1 = 0 1 23 | -------------------------------------------------------------------------------- /python/wrappers/Makefile: -------------------------------------------------------------------------------- 1 | SWIG = swig 2 | SWIGOPT = -make_default -python -shadow 3 | 4 | prestowrap: 5 | $(SWIG) $(SWIGOPT) presto.i 6 | cp presto.py ../presto_src/prestoswig.py 7 | cp presto_wrap.c ../presto_src/ 8 | clean: 9 | rm -f *~ *.o *.so *.pyc *.py *.c 10 | -------------------------------------------------------------------------------- /python/wrappers/color.i: -------------------------------------------------------------------------------- 1 | %module color 2 | 3 | %{ 4 | #include 5 | #include "plot3d.h" 6 | %} 7 | 8 | typedef struct COLOR { 9 | float r, g, b; 10 | } color; 11 | 12 | void hue(color *x, float val); 13 | void heat(color *x, float val); 14 | void rainbow(color *x, float val); 15 | void gray(color *x, float val); 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2013,1,4,16,52,24 3 | ViewMode=2 4 | -------------------------------------------------------------------------------- /src/.geomview: -------------------------------------------------------------------------------- 1 | (ui-panel main off) 2 | (ui-panel tools off) 3 | -------------------------------------------------------------------------------- /src/djcl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "slamac.h" 4 | 5 | void slaDjcl(double djm, int *iy, int *im, int *id, double *fd, int *j); 6 | 7 | void slaDjcl(double djm, int *iy, int *im, int *id, double *fd, int *j) 8 | /* 9 | ** - - - - - - - - 10 | ** s l a D j c l 11 | ** - - - - - - - - 12 | ** 13 | ** Modified Julian Date to Gregorian year, month, day, 14 | ** and fraction of a day. 15 | ** 16 | ** Given: 17 | ** djm double Modified Julian Date (JD-2400000.5) 18 | ** 19 | ** Returned: 20 | ** *iy int year 21 | ** *im int month 22 | ** *id int day 23 | ** *fd double fraction of day 24 | ** *j int status: 25 | ** -1 = unacceptable date (before 4701BC March 1) 26 | ** 27 | ** The algorithm is derived from that of Hatcher 1984 (QJRAS 25, 53-55). 28 | ** 29 | ** Defined in slamac.h: dmod 30 | ** 31 | ** Last revision: 20 April 1996 32 | ** 33 | ** Copyright P.T.Wallace. All rights reserved. 34 | */ 35 | { 36 | double f, d; 37 | long jd, n4, nd10; 38 | 39 | /* Check if date is acceptable */ 40 | if ((djm <= -2395522.0) || (djm >= 1e9)) { 41 | *j = -1; 42 | return; 43 | } else { 44 | *j = 0; 45 | 46 | /* Separate day and fraction */ 47 | f = dmod(djm, 1.0); 48 | if (f < 0.0) 49 | f += 1.0; 50 | d = djm - f; 51 | d = dnint(d); 52 | 53 | /* Express day in Gregorian calendar */ 54 | jd = (long) dnint(d) + 2400001; 55 | n4 = 4L * (jd + ((6L * ((4L * jd - 17918L) / 146097L)) / 4L + 1L) / 2L - 37L); 56 | nd10 = 10L * (((n4 - 237L) % 1461L) / 4L) + 5L; 57 | *iy = (int) (n4 / 1461L - 4712L); 58 | *im = (int) (((nd10 / 306L + 2L) % 12L) + 1L); 59 | *id = (int) ((nd10 % 306L) / 10L + 1L); 60 | *fd = f; 61 | *j = 0; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/fitsdelrow.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "fitsio.h" 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | fitsfile *infptr; /* FITS file pointers defined in fitsio.h */ 7 | int status = 0; /* status must always be initialized = 0 */ 8 | 9 | if (argc==1) { 10 | printf("usage: fitsdelrow fitsfile.fits[3] 1 7\n" 11 | " where the optional [#] means the HDU number, and 1 and 7\n" 12 | " are the start row and number of rows to delete\n\n"); 13 | exit(0); 14 | } 15 | 16 | /* Open the input file */ 17 | if (!fits_open_file(&infptr, argv[1], READWRITE, &status)) { 18 | /* Delete the first 7 rows */ 19 | fits_delete_rows(infptr, atoi(argv[2]), atoi(argv[3]), &status); 20 | /* Close the input file */ 21 | fits_close_file(infptr, &status); 22 | } 23 | 24 | /* if error occured, print out error message */ 25 | if (status) fits_report_error(stderr, status); 26 | return(status); 27 | } 28 | -------------------------------------------------------------------------------- /src/maximize_r.c: -------------------------------------------------------------------------------- 1 | #include "presto.h" 2 | #define FTOL 3.0e-8 3 | 4 | /* Function declarations */ 5 | 6 | static double power_call_r(double r); 7 | double fminbr(double a, double b, double (*f) (double x), double tol); 8 | 9 | 10 | /* Some Static-Global Variables */ 11 | static fcomplex *maxdata; 12 | static int nummaxdata, max_kern_half_width; 13 | 14 | static double power_call_r(double r) 15 | /* Maximization function used with an array */ 16 | { 17 | double powargr, powargi; 18 | fcomplex ans; 19 | 20 | rz_interp(maxdata, nummaxdata, r, 0.0, max_kern_half_width, &ans); 21 | powargr = (double) ans.r; 22 | powargi = (double) ans.i; 23 | return -POWER(powargr, powargi); 24 | } 25 | 26 | 27 | double max_r_arr(fcomplex * data, int numdata, double rin, 28 | double *rout, rderivs * derivs) 29 | /* Return the Fourier frequency that maximizes the power. */ 30 | { 31 | double ax, bx, xmin, locpow; 32 | 33 | maxdata = data; 34 | nummaxdata = numdata; 35 | 36 | /* Now prep and do the maximization at LOWACC for speed */ 37 | 38 | max_kern_half_width = r_resp_halfwidth(LOWACC); 39 | ax = rin - 0.55; 40 | bx = rin + 0.55; 41 | 42 | xmin = fminbr(ax, bx, power_call_r, FTOL); 43 | 44 | /* Restart at minimum using HIGHACC to get a better result */ 45 | /* Note: Don't know if this is really necessary... */ 46 | 47 | max_kern_half_width = r_resp_halfwidth(HIGHACC); 48 | ax = xmin - 0.05; 49 | bx = xmin + 0.05; 50 | 51 | xmin = fminbr(ax, bx, power_call_r, FTOL); 52 | 53 | /* The following calculate derivatives at the peak */ 54 | /* See characteristics.c for their definitions */ 55 | 56 | *rout = xmin; 57 | locpow = get_localpower(data, numdata, xmin); 58 | get_derivs3d(data, numdata, xmin, 0.0, 0.0, locpow, derivs); 59 | return derivs->pow; 60 | } 61 | 62 | #undef FTOL 63 | -------------------------------------------------------------------------------- /src/mjd2cal.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "slamac.h" 6 | 7 | char months[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", 8 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" 9 | }; 10 | 11 | void slaDjcl(double djm, int *iy, int *im, int *id, double *fd, int *j); 12 | 13 | /* Does not include jump discontinuities from leap seconds. */ 14 | /* I don't really know if it should ! */ 15 | 16 | #ifdef USEDMALLOC 17 | #include "dmalloc.h" 18 | #endif 19 | 20 | int main(int argc, char *argv[]) 21 | { 22 | int year, month, day, hour, min, err; 23 | double MJD, fracday, dh, dm, sec; 24 | 25 | if (argc != 2) { 26 | printf("\nUsage: 'mjd2cal MJD'\n\n"); 27 | exit(1); 28 | } 29 | MJD = atof(argv[1]); 30 | slaDjcl(MJD, &year, &month, &day, &fracday, &err); 31 | 32 | if (err == -1) { 33 | printf("\nTry again. Bad MJD.\n\n"); 34 | exit(1); 35 | } 36 | dh = fracday * 24.0; 37 | hour = (int) dh; 38 | dm = (dh - hour) * 60.0; 39 | min = (int) dm; 40 | sec = (dm - min) * 60.0; 41 | 42 | printf("\nDate is %2d %s %4d at %2d hours %2d minutes and %.8g seconds\n\n", 43 | day, months[month - 1], year, hour, min, sec); 44 | exit(0); 45 | } 46 | -------------------------------------------------------------------------------- /src/powerplot.c: -------------------------------------------------------------------------------- 1 | #include "plot2d.h" 2 | 3 | void powerplot(int npts, float *freqs, float *amp, float norm, int id) 4 | { 5 | float *pwr, xmin, xmax, ymin, ymax; 6 | float overy, over = 0.1; 7 | int i, ptr; 8 | 9 | pwr = (float *) malloc((size_t) npts * sizeof(float)); 10 | if (!pwr) { 11 | printf("Error allocating 'pwr' in powerplot. Exiting.\n\n"); 12 | exit(EXIT_FAILURE); 13 | } 14 | /* Turn the complex amps into a power series: */ 15 | for (i = 0; i < npts; i++) { 16 | ptr = i * 2; 17 | pwr[i] = plot_power(amp[ptr], amp[ptr + 1]) / norm; 18 | } 19 | 20 | /* Determine min and max values to plot and scaling: */ 21 | find_min_max_arr(npts, freqs, &xmin, &xmax); 22 | find_min_max_arr(npts, pwr, &ymin, &ymax); 23 | overy = over * (ymax - ymin); 24 | ymax += overy; 25 | 26 | /* Setup the plot screen: */ 27 | cpgenv(xmin, xmax, ymin, ymax, 0, 1); 28 | 29 | /* Choose the font: */ 30 | cpgscf(2); 31 | 32 | /* Label the axes: */ 33 | cpglab("Frequency", "Power", ""); 34 | 35 | /* Add ID line if required */ 36 | if (id == 1) 37 | cpgiden(); 38 | 39 | /* Plot the points: */ 40 | cpgline(npts, freqs, pwr); 41 | 42 | free(pwr); 43 | } 44 | 45 | double plot_power(double rl, double im) 46 | { 47 | return rl * rl + im * im; 48 | } 49 | -------------------------------------------------------------------------------- /src/sdat2dat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "presto.h" 7 | 8 | #ifdef USEDMALLOC 9 | #include "dmalloc.h" 10 | #endif 11 | 12 | #define BUFFLEN 65536 13 | 14 | int main(int argc, char *argv[]) 15 | { 16 | FILE *infile, *outfile; 17 | int ii, numread; 18 | long long N = 0; 19 | float offset = 0.0, fbuffer[sizeof(float) * BUFFLEN]; 20 | short sbuffer[sizeof(short) * BUFFLEN]; 21 | char *outname; 22 | 23 | if (argc != 2 && argc != 3) { 24 | printf("\nUsage: sdat2dat sdatfilename [offset to add]\n\n"); 25 | exit(1); 26 | } 27 | printf("\n Shorts to Floats Data Conversion Program\n\n"); 28 | 29 | /* Get the root of the input filename and */ 30 | /* generate the output filenames from it. */ 31 | { 32 | char *rootnm, *suffix; 33 | 34 | split_root_suffix(argv[1], &rootnm, &suffix); 35 | outname = (char *) calloc(strlen(rootnm) + 5, sizeof(char)); 36 | sprintf(outname, "%s.dat", rootnm); 37 | free(rootnm); 38 | free(suffix); 39 | } 40 | 41 | if (argc == 3) { 42 | offset = strtod(argv[2], NULL); 43 | printf(" Converting, adding %g, and writing to '%s'...", offset, outname); 44 | } else { 45 | printf(" Converting the data and writing to '%s'...", outname); 46 | } 47 | fflush(NULL); 48 | 49 | infile = chkfopen(argv[1], "rb"); 50 | outfile = chkfopen(outname, "wb"); 51 | while ((numread = chkfread(sbuffer, sizeof(short), BUFFLEN, infile))) { 52 | N += numread; 53 | for (ii = 0; ii < numread; ii++) 54 | fbuffer[ii] = (float) (sbuffer[ii]) + offset; 55 | fwrite(fbuffer, sizeof(float), numread, outfile); 56 | } 57 | printf("done.\n Wrote %lld points.\n\n", N); 58 | fclose(infile); 59 | fclose(outfile); 60 | free(outname); 61 | exit(0); 62 | } 63 | -------------------------------------------------------------------------------- /src/slalib/compile_and_test.txt: -------------------------------------------------------------------------------- 1 | rm *.o 2 | gfortran -fPIC -g -O2 -fno-second-underscore -c -I. *.f *.F 3 | rm sla_test.o 4 | gfortran -shared -o libsla.so -fno-second-underscore -g *.o 5 | gfortran -o sla_test sla_test.f -fno-second-underscore -L. -lsla 6 | ./sla_test 7 | -------------------------------------------------------------------------------- /src/slalib/cs2c.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE sla_CS2C (A, B, V) 2 | *+ 3 | * - - - - - 4 | * C S 2 C 5 | * - - - - - 6 | * 7 | * Spherical coordinates to direction cosines (single precision) 8 | * 9 | * Given: 10 | * A,B real spherical coordinates in radians 11 | * (RA,Dec), (long,lat) etc. 12 | * 13 | * Returned: 14 | * V real(3) x,y,z unit vector 15 | * 16 | * The spherical coordinates are longitude (+ve anticlockwise looking 17 | * from the +ve latitude pole) and latitude. The Cartesian coordinates 18 | * are right handed, with the x axis at zero longitude and latitude, and 19 | * the z axis at the +ve latitude pole. 20 | * 21 | * Last revision: 22 July 2004 22 | * 23 | * Copyright P.T.Wallace. All rights reserved. 24 | * 25 | * License: 26 | * This program is free software; you can redistribute it and/or modify 27 | * it under the terms of the GNU General Public License as published by 28 | * the Free Software Foundation; either version 2 of the License, or 29 | * (at your option) any later version. 30 | * 31 | * This program is distributed in the hope that it will be useful, 32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 34 | * GNU General Public License for more details. 35 | * 36 | * You should have received a copy of the GNU General Public License 37 | * along with this program (see SLA_CONDITIONS); if not, write to the 38 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 39 | * Boston, MA 02111-1307 USA 40 | * 41 | *- 42 | 43 | IMPLICIT NONE 44 | 45 | REAL A,B,V(3) 46 | 47 | REAL COSB 48 | 49 | 50 | 51 | COSB = COS(B) 52 | 53 | V(1) = COS(A)*COSB 54 | V(2) = SIN(A)*COSB 55 | V(3) = SIN(B) 56 | 57 | END 58 | -------------------------------------------------------------------------------- /src/slalib/dcs2c.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE sla_DCS2C (A, B, V) 2 | *+ 3 | * - - - - - - 4 | * D C S 2 C 5 | * - - - - - - 6 | * 7 | * Spherical coordinates to direction cosines (double precision) 8 | * 9 | * Given: 10 | * A,B d spherical coordinates in radians 11 | * (RA,Dec), (long,lat) etc. 12 | * 13 | * Returned: 14 | * V d(3) x,y,z unit vector 15 | * 16 | * The spherical coordinates are longitude (+ve anticlockwise looking 17 | * from the +ve latitude pole) and latitude. The Cartesian coordinates 18 | * are right handed, with the x axis at zero longitude and latitude, and 19 | * the z axis at the +ve latitude pole. 20 | * 21 | * Last revision: 26 December 2004 22 | * 23 | * Copyright P.T.Wallace. All rights reserved. 24 | * 25 | * License: 26 | * This program is free software; you can redistribute it and/or modify 27 | * it under the terms of the GNU General Public License as published by 28 | * the Free Software Foundation; either version 2 of the License, or 29 | * (at your option) any later version. 30 | * 31 | * This program is distributed in the hope that it will be useful, 32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 34 | * GNU General Public License for more details. 35 | * 36 | * You should have received a copy of the GNU General Public License 37 | * along with this program (see SLA_CONDITIONS); if not, write to the 38 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 39 | * Boston, MA 02111-1307 USA 40 | * 41 | *- 42 | 43 | IMPLICIT NONE 44 | 45 | DOUBLE PRECISION A,B,V(3) 46 | 47 | DOUBLE PRECISION COSB 48 | 49 | 50 | COSB = COS(B) 51 | 52 | V(1) = COS(A)*COSB 53 | V(2) = SIN(A)*COSB 54 | V(3) = SIN(B) 55 | 56 | END 57 | -------------------------------------------------------------------------------- /src/slalib/drange.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION sla_DRANGE (ANGLE) 2 | *+ 3 | * - - - - - - - 4 | * D R A N G E 5 | * - - - - - - - 6 | * 7 | * Normalize angle into range +/- pi (double precision) 8 | * 9 | * Given: 10 | * ANGLE dp the angle in radians 11 | * 12 | * The result (double precision) is ANGLE expressed in the range +/- pi. 13 | * 14 | * P.T.Wallace Starlink 23 November 1995 15 | * 16 | * Copyright (C) 1995 Rutherford Appleton Laboratory 17 | * 18 | * License: 19 | * This program is free software; you can redistribute it and/or modify 20 | * it under the terms of the GNU General Public License as published by 21 | * the Free Software Foundation; either version 2 of the License, or 22 | * (at your option) any later version. 23 | * 24 | * This program is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | * GNU General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU General Public License 30 | * along with this program (see SLA_CONDITIONS); if not, write to the 31 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 32 | * Boston, MA 02111-1307 USA 33 | * 34 | *- 35 | 36 | IMPLICIT NONE 37 | 38 | DOUBLE PRECISION ANGLE 39 | 40 | DOUBLE PRECISION DPI,D2PI 41 | PARAMETER (DPI=3.141592653589793238462643D0) 42 | PARAMETER (D2PI=6.283185307179586476925287D0) 43 | 44 | 45 | sla_DRANGE=MOD(ANGLE,D2PI) 46 | IF (ABS(sla_DRANGE).GE.DPI) 47 | : sla_DRANGE=sla_DRANGE-SIGN(D2PI,ANGLE) 48 | 49 | END 50 | -------------------------------------------------------------------------------- /src/slalib/dranrm.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION sla_DRANRM (ANGLE) 2 | *+ 3 | * - - - - - - - 4 | * D R A N R M 5 | * - - - - - - - 6 | * 7 | * Normalize angle into range 0-2 pi (double precision) 8 | * 9 | * Given: 10 | * ANGLE dp the angle in radians 11 | * 12 | * The result is ANGLE expressed in the range 0-2 pi. 13 | * 14 | * Last revision: 22 July 2004 15 | * 16 | * Copyright P.T.Wallace. All rights reserved. 17 | * 18 | * License: 19 | * This program is free software; you can redistribute it and/or modify 20 | * it under the terms of the GNU General Public License as published by 21 | * the Free Software Foundation; either version 2 of the License, or 22 | * (at your option) any later version. 23 | * 24 | * This program is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | * GNU General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU General Public License 30 | * along with this program (see SLA_CONDITIONS); if not, write to the 31 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 32 | * Boston, MA 02111-1307 USA 33 | * 34 | *- 35 | 36 | IMPLICIT NONE 37 | 38 | DOUBLE PRECISION ANGLE 39 | 40 | DOUBLE PRECISION D2PI 41 | PARAMETER (D2PI=6.283185307179586476925286766559D0) 42 | 43 | 44 | sla_DRANRM = MOD(ANGLE,D2PI) 45 | IF (sla_DRANRM.LT.0D0) sla_DRANRM = sla_DRANRM+D2PI 46 | 47 | END 48 | -------------------------------------------------------------------------------- /src/slalib/dsep.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION sla_DSEP (A1, B1, A2, B2) 2 | *+ 3 | * - - - - - 4 | * D S E P 5 | * - - - - - 6 | * 7 | * Angle between two points on a sphere. 8 | * 9 | * (double precision) 10 | * 11 | * Given: 12 | * A1,B1 d spherical coordinates of one point 13 | * A2,B2 d spherical coordinates of the other point 14 | * 15 | * (The spherical coordinates are [RA,Dec], [Long,Lat] etc, in radians.) 16 | * 17 | * The result is the angle, in radians, between the two points. It 18 | * is always positive. 19 | * 20 | * Called: sla_DCS2C, sla_DSEPV 21 | * 22 | * Last revision: 7 May 2000 23 | * 24 | * Copyright P.T.Wallace. All rights reserved. 25 | * 26 | * License: 27 | * This program is free software; you can redistribute it and/or modify 28 | * it under the terms of the GNU General Public License as published by 29 | * the Free Software Foundation; either version 2 of the License, or 30 | * (at your option) any later version. 31 | * 32 | * This program is distributed in the hope that it will be useful, 33 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | * GNU General Public License for more details. 36 | * 37 | * You should have received a copy of the GNU General Public License 38 | * along with this program (see SLA_CONDITIONS); if not, write to the 39 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 40 | * Boston, MA 02111-1307 USA 41 | * 42 | *- 43 | 44 | IMPLICIT NONE 45 | 46 | DOUBLE PRECISION A1,B1,A2,B2 47 | 48 | DOUBLE PRECISION V1(3),V2(3) 49 | DOUBLE PRECISION sla_DSEPV 50 | 51 | 52 | 53 | * Convert coordinates from spherical to Cartesian. 54 | CALL sla_DCS2C(A1,B1,V1) 55 | CALL sla_DCS2C(A2,B2,V2) 56 | 57 | * Angle between the vectors. 58 | sla_DSEP = sla_DSEPV(V1,V2) 59 | 60 | END 61 | -------------------------------------------------------------------------------- /src/slalib/dtp2s.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE sla_DTP2S (XI, ETA, RAZ, DECZ, RA, DEC) 2 | *+ 3 | * - - - - - - 4 | * D T P 2 S 5 | * - - - - - - 6 | * 7 | * Transform tangent plane coordinates into spherical 8 | * (double precision) 9 | * 10 | * Given: 11 | * XI,ETA dp tangent plane rectangular coordinates 12 | * RAZ,DECZ dp spherical coordinates of tangent point 13 | * 14 | * Returned: 15 | * RA,DEC dp spherical coordinates (0-2pi,+/-pi/2) 16 | * 17 | * Called: sla_DRANRM 18 | * 19 | * P.T.Wallace Starlink 24 July 1995 20 | * 21 | * Copyright (C) 1995 Rutherford Appleton Laboratory 22 | * 23 | * License: 24 | * This program is free software; you can redistribute it and/or modify 25 | * it under the terms of the GNU General Public License as published by 26 | * the Free Software Foundation; either version 2 of the License, or 27 | * (at your option) any later version. 28 | * 29 | * This program is distributed in the hope that it will be useful, 30 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32 | * GNU General Public License for more details. 33 | * 34 | * You should have received a copy of the GNU General Public License 35 | * along with this program (see SLA_CONDITIONS); if not, write to the 36 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 37 | * Boston, MA 02111-1307 USA 38 | * 39 | *- 40 | 41 | IMPLICIT NONE 42 | 43 | DOUBLE PRECISION XI,ETA,RAZ,DECZ,RA,DEC 44 | 45 | DOUBLE PRECISION sla_DRANRM 46 | 47 | DOUBLE PRECISION SDECZ,CDECZ,DENOM 48 | 49 | 50 | 51 | SDECZ=SIN(DECZ) 52 | CDECZ=COS(DECZ) 53 | 54 | DENOM=CDECZ-ETA*SDECZ 55 | 56 | RA=sla_DRANRM(ATAN2(XI,DENOM)+RAZ) 57 | DEC=ATAN2(SDECZ+ETA*CDECZ,SQRT(XI*XI+DENOM*DENOM)) 58 | 59 | END 60 | -------------------------------------------------------------------------------- /src/slalib/dvdv.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION sla_DVDV (VA, VB) 2 | *+ 3 | * - - - - - 4 | * D V D V 5 | * - - - - - 6 | * 7 | * Scalar product of two 3-vectors (double precision) 8 | * 9 | * Given: 10 | * VA dp(3) first vector 11 | * VB dp(3) second vector 12 | * 13 | * The result is the scalar product VA.VB (double precision) 14 | * 15 | * P.T.Wallace Starlink November 1984 16 | * 17 | * Copyright (C) 1995 Rutherford Appleton Laboratory 18 | * 19 | * License: 20 | * This program is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU General Public License as published by 22 | * the Free Software Foundation; either version 2 of the License, or 23 | * (at your option) any later version. 24 | * 25 | * This program is distributed in the hope that it will be useful, 26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | * GNU General Public License for more details. 29 | * 30 | * You should have received a copy of the GNU General Public License 31 | * along with this program (see SLA_CONDITIONS); if not, write to the 32 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 33 | * Boston, MA 02111-1307 USA 34 | * 35 | *- 36 | 37 | IMPLICIT NONE 38 | 39 | DOUBLE PRECISION VA(3),VB(3) 40 | 41 | 42 | sla_DVDV=VA(1)*VB(1)+VA(2)*VB(2)+VA(3)*VB(3) 43 | 44 | END 45 | -------------------------------------------------------------------------------- /src/slalib/dvxv.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE sla_DVXV (VA, VB, VC) 2 | *+ 3 | * - - - - - 4 | * D V X V 5 | * - - - - - 6 | * 7 | * Vector product of two 3-vectors (double precision) 8 | * 9 | * Given: 10 | * VA dp(3) first vector 11 | * VB dp(3) second vector 12 | * 13 | * Returned: 14 | * VC dp(3) vector result 15 | * 16 | * P.T.Wallace Starlink March 1986 17 | * 18 | * Copyright (C) 1995 Rutherford Appleton Laboratory 19 | * 20 | * License: 21 | * This program is free software; you can redistribute it and/or modify 22 | * it under the terms of the GNU General Public License as published by 23 | * the Free Software Foundation; either version 2 of the License, or 24 | * (at your option) any later version. 25 | * 26 | * This program is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | * GNU General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU General Public License 32 | * along with this program (see SLA_CONDITIONS); if not, write to the 33 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 34 | * Boston, MA 02111-1307 USA 35 | * 36 | *- 37 | 38 | IMPLICIT NONE 39 | 40 | DOUBLE PRECISION VA(3),VB(3),VC(3) 41 | 42 | DOUBLE PRECISION VW(3) 43 | INTEGER I 44 | 45 | 46 | * Form the vector product VA cross VB 47 | VW(1)=VA(2)*VB(3)-VA(3)*VB(2) 48 | VW(2)=VA(3)*VB(1)-VA(1)*VB(3) 49 | VW(3)=VA(1)*VB(2)-VA(2)*VB(1) 50 | 51 | * Return the result 52 | DO I=1,3 53 | VC(I)=VW(I) 54 | END DO 55 | 56 | END 57 | -------------------------------------------------------------------------------- /src/slalib/epb.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION sla_EPB (DATE) 2 | *+ 3 | * - - - - 4 | * E P B 5 | * - - - - 6 | * 7 | * Conversion of Modified Julian Date to Besselian Epoch 8 | * (double precision) 9 | * 10 | * Given: 11 | * DATE dp Modified Julian Date (JD - 2400000.5) 12 | * 13 | * The result is the Besselian Epoch. 14 | * 15 | * Reference: 16 | * Lieske,J.H., 1979. Astron.Astrophys.,73,282. 17 | * 18 | * P.T.Wallace Starlink February 1984 19 | * 20 | * Copyright (C) 1995 Rutherford Appleton Laboratory 21 | * 22 | * License: 23 | * This program is free software; you can redistribute it and/or modify 24 | * it under the terms of the GNU General Public License as published by 25 | * the Free Software Foundation; either version 2 of the License, or 26 | * (at your option) any later version. 27 | * 28 | * This program is distributed in the hope that it will be useful, 29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 | * GNU General Public License for more details. 32 | * 33 | * You should have received a copy of the GNU General Public License 34 | * along with this program (see SLA_CONDITIONS); if not, write to the 35 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 36 | * Boston, MA 02111-1307 USA 37 | * 38 | *- 39 | 40 | IMPLICIT NONE 41 | 42 | DOUBLE PRECISION DATE 43 | 44 | 45 | sla_EPB = 1900D0 + (DATE-15019.81352D0)/365.242198781D0 46 | 47 | END 48 | -------------------------------------------------------------------------------- /src/slalib/epb2d.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION sla_EPB2D (EPB) 2 | *+ 3 | * - - - - - - 4 | * E P B 2 D 5 | * - - - - - - 6 | * 7 | * Conversion of Besselian Epoch to Modified Julian Date 8 | * (double precision) 9 | * 10 | * Given: 11 | * EPB dp Besselian Epoch 12 | * 13 | * The result is the Modified Julian Date (JD - 2400000.5). 14 | * 15 | * Reference: 16 | * Lieske,J.H., 1979. Astron.Astrophys.,73,282. 17 | * 18 | * P.T.Wallace Starlink February 1984 19 | * 20 | * Copyright (C) 1995 Rutherford Appleton Laboratory 21 | * 22 | * License: 23 | * This program is free software; you can redistribute it and/or modify 24 | * it under the terms of the GNU General Public License as published by 25 | * the Free Software Foundation; either version 2 of the License, or 26 | * (at your option) any later version. 27 | * 28 | * This program is distributed in the hope that it will be useful, 29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 | * GNU General Public License for more details. 32 | * 33 | * You should have received a copy of the GNU General Public License 34 | * along with this program (see SLA_CONDITIONS); if not, write to the 35 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 36 | * Boston, MA 02111-1307 USA 37 | * 38 | *- 39 | 40 | IMPLICIT NONE 41 | 42 | DOUBLE PRECISION EPB 43 | 44 | 45 | sla_EPB2D = 15019.81352D0 + (EPB-1900D0)*365.242198781D0 46 | 47 | END 48 | -------------------------------------------------------------------------------- /src/slalib/epj.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION sla_EPJ (DATE) 2 | *+ 3 | * - - - - 4 | * E P J 5 | * - - - - 6 | * 7 | * Conversion of Modified Julian Date to Julian Epoch (double precision) 8 | * 9 | * Given: 10 | * DATE dp Modified Julian Date (JD - 2400000.5) 11 | * 12 | * The result is the Julian Epoch. 13 | * 14 | * Reference: 15 | * Lieske,J.H., 1979. Astron.Astrophys.,73,282. 16 | * 17 | * P.T.Wallace Starlink February 1984 18 | * 19 | * Copyright (C) 1995 Rutherford Appleton Laboratory 20 | * 21 | * License: 22 | * This program is free software; you can redistribute it and/or modify 23 | * it under the terms of the GNU General Public License as published by 24 | * the Free Software Foundation; either version 2 of the License, or 25 | * (at your option) any later version. 26 | * 27 | * This program is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | * GNU General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU General Public License 33 | * along with this program (see SLA_CONDITIONS); if not, write to the 34 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 35 | * Boston, MA 02111-1307 USA 36 | * 37 | *- 38 | 39 | IMPLICIT NONE 40 | 41 | DOUBLE PRECISION DATE 42 | 43 | 44 | sla_EPJ = 2000D0 + (DATE-51544.5D0)/365.25D0 45 | 46 | END 47 | -------------------------------------------------------------------------------- /src/slalib/epj2d.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION sla_EPJ2D (EPJ) 2 | *+ 3 | * - - - - - - 4 | * E P J 2 D 5 | * - - - - - - 6 | * 7 | * Conversion of Julian Epoch to Modified Julian Date (double precision) 8 | * 9 | * Given: 10 | * EPJ dp Julian Epoch 11 | * 12 | * The result is the Modified Julian Date (JD - 2400000.5). 13 | * 14 | * Reference: 15 | * Lieske,J.H., 1979. Astron.Astrophys.,73,282. 16 | * 17 | * P.T.Wallace Starlink February 1984 18 | * 19 | * Copyright (C) 1995 Rutherford Appleton Laboratory 20 | * 21 | * License: 22 | * This program is free software; you can redistribute it and/or modify 23 | * it under the terms of the GNU General Public License as published by 24 | * the Free Software Foundation; either version 2 of the License, or 25 | * (at your option) any later version. 26 | * 27 | * This program is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | * GNU General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU General Public License 33 | * along with this program (see SLA_CONDITIONS); if not, write to the 34 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 35 | * Boston, MA 02111-1307 USA 36 | * 37 | *- 38 | 39 | IMPLICIT NONE 40 | 41 | DOUBLE PRECISION EPJ 42 | 43 | 44 | sla_EPJ2D = 51544.5D0 + (EPJ-2000D0)*365.25D0 45 | 46 | END 47 | -------------------------------------------------------------------------------- /src/slalib/range.f: -------------------------------------------------------------------------------- 1 | REAL FUNCTION sla_RANGE (ANGLE) 2 | *+ 3 | * - - - - - - 4 | * R A N G E 5 | * - - - - - - 6 | * 7 | * Normalize angle into range +/- pi (single precision) 8 | * 9 | * Given: 10 | * ANGLE dp the angle in radians 11 | * 12 | * The result is ANGLE expressed in the +/- pi (single 13 | * precision). 14 | * 15 | * P.T.Wallace Starlink 23 November 1995 16 | * 17 | * Copyright (C) 1995 Rutherford Appleton Laboratory 18 | * 19 | * License: 20 | * This program is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU General Public License as published by 22 | * the Free Software Foundation; either version 2 of the License, or 23 | * (at your option) any later version. 24 | * 25 | * This program is distributed in the hope that it will be useful, 26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | * GNU General Public License for more details. 29 | * 30 | * You should have received a copy of the GNU General Public License 31 | * along with this program (see SLA_CONDITIONS); if not, write to the 32 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 33 | * Boston, MA 02111-1307 USA 34 | * 35 | *- 36 | 37 | IMPLICIT NONE 38 | 39 | REAL ANGLE 40 | 41 | REAL API,A2PI 42 | PARAMETER (API=3.141592653589793238462643) 43 | PARAMETER (A2PI=6.283185307179586476925287) 44 | 45 | 46 | sla_RANGE=MOD(ANGLE,A2PI) 47 | IF (ABS(sla_RANGE).GE.API) 48 | : sla_RANGE=sla_RANGE-SIGN(A2PI,ANGLE) 49 | 50 | END 51 | -------------------------------------------------------------------------------- /src/slalib/ranorm.f: -------------------------------------------------------------------------------- 1 | REAL FUNCTION sla_RANORM (ANGLE) 2 | *+ 3 | * - - - - - - - 4 | * R A N O R M 5 | * - - - - - - - 6 | * 7 | * Normalize angle into range 0-2 pi (single precision) 8 | * 9 | * Given: 10 | * ANGLE dp the angle in radians 11 | * 12 | * The result is ANGLE expressed in the range 0-2 pi (single 13 | * precision). 14 | * 15 | * P.T.Wallace Starlink 23 November 1995 16 | * 17 | * Copyright (C) 1995 Rutherford Appleton Laboratory 18 | * 19 | * License: 20 | * This program is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU General Public License as published by 22 | * the Free Software Foundation; either version 2 of the License, or 23 | * (at your option) any later version. 24 | * 25 | * This program is distributed in the hope that it will be useful, 26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | * GNU General Public License for more details. 29 | * 30 | * You should have received a copy of the GNU General Public License 31 | * along with this program (see SLA_CONDITIONS); if not, write to the 32 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 33 | * Boston, MA 02111-1307 USA 34 | * 35 | *- 36 | 37 | IMPLICIT NONE 38 | 39 | REAL ANGLE 40 | 41 | REAL A2PI 42 | PARAMETER (A2PI=6.283185307179586476925287) 43 | 44 | 45 | sla_RANORM=MOD(ANGLE,A2PI) 46 | IF (sla_RANORM.LT.0.0) sla_RANORM=sla_RANORM+A2PI 47 | 48 | END 49 | -------------------------------------------------------------------------------- /src/slalib/sep.f: -------------------------------------------------------------------------------- 1 | REAL FUNCTION sla_SEP (A1, B1, A2, B2) 2 | *+ 3 | * - - - - 4 | * S E P 5 | * - - - - 6 | * 7 | * Angle between two points on a sphere. 8 | * 9 | * (single precision) 10 | * 11 | * Given: 12 | * A1,B1 r spherical coordinates of one point 13 | * A2,B2 r spherical coordinates of the other point 14 | * 15 | * (The spherical coordinates are [RA,Dec], [Long,Lat] etc, in radians.) 16 | * 17 | * The result is the angle, in radians, between the two points. It 18 | * is always positive. 19 | * 20 | * Called: sla_DSEP 21 | * 22 | * Last revision: 7 May 2000 23 | * 24 | * Copyright P.T.Wallace. All rights reserved. 25 | * 26 | * License: 27 | * This program is free software; you can redistribute it and/or modify 28 | * it under the terms of the GNU General Public License as published by 29 | * the Free Software Foundation; either version 2 of the License, or 30 | * (at your option) any later version. 31 | * 32 | * This program is distributed in the hope that it will be useful, 33 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | * GNU General Public License for more details. 36 | * 37 | * You should have received a copy of the GNU General Public License 38 | * along with this program (see SLA_CONDITIONS); if not, write to the 39 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 40 | * Boston, MA 02111-1307 USA 41 | * 42 | *- 43 | 44 | IMPLICIT NONE 45 | 46 | REAL A1,B1,A2,B2 47 | 48 | DOUBLE PRECISION sla_DSEP 49 | 50 | 51 | 52 | * Use double precision version. 53 | sla_SEP = REAL(sla_DSEP(DBLE(A1),DBLE(B1),DBLE(A2),DBLE(B2))) 54 | 55 | END 56 | -------------------------------------------------------------------------------- /src/slalib/tp2s.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE sla_TP2S (XI, ETA, RAZ, DECZ, RA, DEC) 2 | *+ 3 | * - - - - - 4 | * T P 2 S 5 | * - - - - - 6 | * 7 | * Transform tangent plane coordinates into spherical 8 | * (single precision) 9 | * 10 | * Given: 11 | * XI,ETA real tangent plane rectangular coordinates 12 | * RAZ,DECZ real spherical coordinates of tangent point 13 | * 14 | * Returned: 15 | * RA,DEC real spherical coordinates (0-2pi,+/-pi/2) 16 | * 17 | * Called: sla_RANORM 18 | * 19 | * P.T.Wallace Starlink 24 July 1995 20 | * 21 | * Copyright (C) 1995 Rutherford Appleton Laboratory 22 | * 23 | * License: 24 | * This program is free software; you can redistribute it and/or modify 25 | * it under the terms of the GNU General Public License as published by 26 | * the Free Software Foundation; either version 2 of the License, or 27 | * (at your option) any later version. 28 | * 29 | * This program is distributed in the hope that it will be useful, 30 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32 | * GNU General Public License for more details. 33 | * 34 | * You should have received a copy of the GNU General Public License 35 | * along with this program (see SLA_CONDITIONS); if not, write to the 36 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 37 | * Boston, MA 02111-1307 USA 38 | * 39 | *- 40 | 41 | IMPLICIT NONE 42 | 43 | REAL XI,ETA,RAZ,DECZ,RA,DEC 44 | 45 | REAL sla_RANORM 46 | 47 | REAL SDECZ,CDECZ,DENOM 48 | 49 | 50 | 51 | SDECZ=SIN(DECZ) 52 | CDECZ=COS(DECZ) 53 | 54 | DENOM=CDECZ-ETA*SDECZ 55 | 56 | RA=sla_RANORM(ATAN2(XI,DENOM)+RAZ) 57 | DEC=ATAN2(SDECZ+ETA*CDECZ,SQRT(XI*XI+DENOM*DENOM)) 58 | 59 | END 60 | -------------------------------------------------------------------------------- /src/slalib/vdv.f: -------------------------------------------------------------------------------- 1 | REAL FUNCTION sla_VDV (VA, VB) 2 | *+ 3 | * - - - - 4 | * V D V 5 | * - - - - 6 | * 7 | * Scalar product of two 3-vectors (single precision) 8 | * 9 | * Given: 10 | * VA real(3) first vector 11 | * VB real(3) second vector 12 | * 13 | * The result is the scalar product VA.VB (single precision) 14 | * 15 | * P.T.Wallace Starlink November 1984 16 | * 17 | * Copyright (C) 1995 Rutherford Appleton Laboratory 18 | * 19 | * License: 20 | * This program is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU General Public License as published by 22 | * the Free Software Foundation; either version 2 of the License, or 23 | * (at your option) any later version. 24 | * 25 | * This program is distributed in the hope that it will be useful, 26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | * GNU General Public License for more details. 29 | * 30 | * You should have received a copy of the GNU General Public License 31 | * along with this program (see SLA_CONDITIONS); if not, write to the 32 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 33 | * Boston, MA 02111-1307 USA 34 | * 35 | *- 36 | 37 | IMPLICIT NONE 38 | 39 | REAL VA(3),VB(3) 40 | 41 | 42 | sla_VDV=VA(1)*VB(1)+VA(2)*VB(2)+VA(3)*VB(3) 43 | 44 | END 45 | -------------------------------------------------------------------------------- /src/slalib/veri.f: -------------------------------------------------------------------------------- 1 | INTEGER FUNCTION sla_VERI () 2 | *+ 3 | * - - - - - 4 | * V E R I 5 | * - - - - - 6 | * 7 | * Report the SLALIB version number as an integer. 8 | * 9 | * Given: 10 | * None 11 | * 12 | * The result is the SLALIB version number as an integer m*1e6+n*1e3+r, 13 | * where m is the major version, n the minor version and r the release 14 | * number. 15 | * 16 | * Notes: 17 | * 18 | * To obtain the version number in a printable form, see 19 | * subroutine sla_vers(version). 20 | * 21 | * The sla_veri subroutine was introduced in SLALIB version 2.5-1, so 22 | * if this function is absent, one can only tell that the release 23 | * predates that one. 24 | * 25 | * Norman Gray Starlink 8 April 2005 26 | * 27 | * Copyright (C) 2005 Council for the Central Laboratory of the 28 | * Research Councils 29 | * 30 | * Licence: 31 | * This program is free software; you can redistribute it and/or modify 32 | * it under the terms of the GNU General Public License as published by 33 | * the Free Software Foundation; either version 2 of the License, or 34 | * (at your option) any later version. 35 | * 36 | * This program is distributed in the hope that it will be useful, 37 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 38 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 39 | * GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License 42 | * along with this program (see SLA_CONDITIONS); if not, write to the 43 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 44 | * Boston, MA 02111-1307 USA 45 | * 46 | *- 47 | 48 | IMPLICIT NONE 49 | 50 | sla_VERI=2005004 51 | 52 | END 53 | -------------------------------------------------------------------------------- /src/slalib/vn.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE sla_VN (V, UV, VM) 2 | *+ 3 | * - - - 4 | * V N 5 | * - - - 6 | * 7 | * Normalizes a 3-vector also giving the modulus (single precision) 8 | * 9 | * Given: 10 | * V real(3) vector 11 | * 12 | * Returned: 13 | * UV real(3) unit vector in direction of V 14 | * VM real modulus of V 15 | * 16 | * If the modulus of V is zero, UV is set to zero as well 17 | * 18 | * P.T.Wallace Starlink 23 November 1995 19 | * 20 | * Copyright (C) 1995 Rutherford Appleton Laboratory 21 | * 22 | * License: 23 | * This program is free software; you can redistribute it and/or modify 24 | * it under the terms of the GNU General Public License as published by 25 | * the Free Software Foundation; either version 2 of the License, or 26 | * (at your option) any later version. 27 | * 28 | * This program is distributed in the hope that it will be useful, 29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 | * GNU General Public License for more details. 32 | * 33 | * You should have received a copy of the GNU General Public License 34 | * along with this program (see SLA_CONDITIONS); if not, write to the 35 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 36 | * Boston, MA 02111-1307 USA 37 | * 38 | *- 39 | 40 | IMPLICIT NONE 41 | 42 | REAL V(3),UV(3),VM 43 | 44 | INTEGER I 45 | REAL W1,W2 46 | 47 | 48 | * Modulus 49 | W1=0.0 50 | DO I=1,3 51 | W2=V(I) 52 | W1=W1+W2*W2 53 | END DO 54 | W1=SQRT(W1) 55 | VM=W1 56 | 57 | * Normalize the vector 58 | IF (W1.LE.0.0) W1=1.0 59 | DO I=1,3 60 | UV(I)=V(I)/W1 61 | END DO 62 | 63 | END 64 | -------------------------------------------------------------------------------- /src/slalib/vxv.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE sla_VXV (VA, VB, VC) 2 | *+ 3 | * - - - - 4 | * V X V 5 | * - - - - 6 | * 7 | * Vector product of two 3-vectors (single precision) 8 | * 9 | * Given: 10 | * VA real(3) first vector 11 | * VB real(3) second vector 12 | * 13 | * Returned: 14 | * VC real(3) vector result 15 | * 16 | * P.T.Wallace Starlink March 1986 17 | * 18 | * Copyright (C) 1995 Rutherford Appleton Laboratory 19 | * 20 | * License: 21 | * This program is free software; you can redistribute it and/or modify 22 | * it under the terms of the GNU General Public License as published by 23 | * the Free Software Foundation; either version 2 of the License, or 24 | * (at your option) any later version. 25 | * 26 | * This program is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | * GNU General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU General Public License 32 | * along with this program (see SLA_CONDITIONS); if not, write to the 33 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 34 | * Boston, MA 02111-1307 USA 35 | * 36 | *- 37 | 38 | IMPLICIT NONE 39 | 40 | REAL VA(3),VB(3),VC(3) 41 | 42 | REAL VW(3) 43 | INTEGER I 44 | 45 | 46 | * Form the vector product VA cross VB 47 | VW(1)=VA(2)*VB(3)-VA(3)*VB(2) 48 | VW(2)=VA(3)*VB(1)-VA(1)*VB(3) 49 | VW(3)=VA(1)*VB(2)-VA(2)*VB(1) 50 | 51 | * Return the result 52 | DO I=1,3 53 | VC(I)=VW(I) 54 | END DO 55 | 56 | END 57 | -------------------------------------------------------------------------------- /src/slalib/wait.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE sla_WAIT (DELAY) 2 | *+ 3 | * - - - - - 4 | * W A I T 5 | * - - - - - 6 | * 7 | * Interval wait 8 | * 9 | * !!! Version for: SPARC/SunOS4, 10 | * SPARC/Solaris2, 11 | * DEC Mips/Ultrix 12 | * DEC AXP/Digital Unix 13 | * Intel/Linux 14 | * Convex 15 | * 16 | * Given: 17 | * DELAY real delay in seconds 18 | * 19 | * Called: SLEEP (a Fortran Intrinsic on all obove platforms) 20 | * 21 | * P.T.Wallace Starlink 22 January 1998 22 | * 23 | * Copyright (C) 1998 Rutherford Appleton Laboratory 24 | * 25 | * License: 26 | * This program is free software; you can redistribute it and/or modify 27 | * it under the terms of the GNU General Public License as published by 28 | * the Free Software Foundation; either version 2 of the License, or 29 | * (at your option) any later version. 30 | * 31 | * This program is distributed in the hope that it will be useful, 32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 34 | * GNU General Public License for more details. 35 | * 36 | * You should have received a copy of the GNU General Public License 37 | * along with this program (see SLA_CONDITIONS); if not, write to the 38 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 39 | * Boston, MA 02111-1307 USA 40 | * 41 | *- 42 | 43 | IMPLICIT NONE 44 | 45 | REAL DELAY 46 | 47 | CALL SLEEP(NINT(DELAY)) 48 | 49 | END 50 | -------------------------------------------------------------------------------- /src/swap_endian.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #ifdef USEDMALLOC 7 | #include "dmalloc.h" 8 | #endif 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | 13 | unsigned char buffer[4]; 14 | int tmp; 15 | long ct = 0; 16 | char innm[40], outnm[40]; 17 | FILE *infile, *outfile; 18 | 19 | /* Get the filename of the datafile and open it */ 20 | 21 | printf("\n\nSwap a Big-Endian Data file to Little Endian\n"); 22 | printf(" or vise-versa. (32 bit data only)\n"); 23 | if (argc > 1) { 24 | sprintf(innm, "%s", argv[1]); 25 | printf("\nReading data from \"%s\".\n", innm); 26 | if (NULL == (infile = fopen(innm, "r+b"))) { 27 | printf("\nCan't open \"%s\", exiting.\n", innm); 28 | exit(1); 29 | } 30 | sprintf(outnm, "%s_swapped", argv[1]); 31 | printf("Writing data to \"%s\".\n\n", outnm); 32 | if (NULL == (outfile = fopen(outnm, "w+b"))) { 33 | printf("\nCan't open %s, exiting.\n", outnm); 34 | exit(1); 35 | } 36 | } else { 37 | printf("\n\nPlease enter a filename for the input data file"); 38 | printf(" after \"readdata\".\n"); 39 | exit(1); 40 | } 41 | 42 | ct = 0; 43 | while (fread(buffer, sizeof(unsigned char), 4, infile)) { 44 | tmp = buffer[0]; 45 | buffer[0] = buffer[3]; 46 | buffer[3] = tmp; 47 | tmp = buffer[1]; 48 | buffer[1] = buffer[2]; 49 | buffer[2] = tmp; 50 | fwrite(buffer, sizeof(unsigned char), 4, outfile); 51 | ct++; 52 | } 53 | printf("Converted %ld points.\n\n", ct); 54 | fclose(infile); 55 | fclose(outfile); 56 | exit(0); 57 | } 58 | -------------------------------------------------------------------------------- /src/taperaw.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define BLOCKLEN 49792 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | FILE *rawfile; 9 | unsigned char block[BLOCKLEN]; 10 | int ii, numwrite; 11 | 12 | if (argc != 4) { 13 | printf("\nusage: taperaw blockfile tapefile number\n\n"); 14 | printf 15 | (" 'blockfile' is the file where we will steal the 1st block to tape\n"); 16 | printf(" 'tapefile' is the file where we will append the block\n"); 17 | printf(" 'number' is the number of times we will tape the block\n\n"); 18 | printf(" This routine appends substitute blocks onto the end of a\n"); 19 | printf(" raw Parkes Multibeam data file. This is useful for\n"); 20 | printf(" replacing a small number of blocks that are unusable\n"); 21 | printf(" for one reason or another.\n\n"); 22 | exit(0); 23 | } 24 | 25 | numwrite = atoi(argv[3]); 26 | printf("\nReading block from '%s' and appending it %d times to '%s'...\n\n", 27 | argv[1], numwrite, argv[2]); 28 | 29 | rawfile = fopen(argv[1], "rb"); 30 | fread(block, sizeof(unsigned char), BLOCKLEN, rawfile); 31 | fclose(rawfile); 32 | 33 | rawfile = fopen(argv[2], "ab"); 34 | for (ii = 0; ii < numwrite; ii++) 35 | fwrite(block, sizeof(unsigned char), BLOCKLEN, rawfile); 36 | 37 | printf("Done.\n\n"); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /src/testtree.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "../include/vectors.h" 5 | 6 | void dedisperse_tree(int, int, int, int, int, float **, float **); 7 | void fast_fold(float *indata, float *outdata, int maxshift, int numpts, int numchan); 8 | 9 | #define NUMCHAN 4 10 | #define NUMPTS 4 11 | 12 | int main(void) 13 | { 14 | float **indata, **outdata; 15 | int ii, jj; 16 | 17 | indata = gen_fmatrix(NUMCHAN, NUMPTS); 18 | outdata = gen_fmatrix(NUMCHAN, NUMPTS); 19 | 20 | printf("\nindata:\n"); 21 | for (ii = 0; ii < NUMCHAN; ii++) { 22 | for (jj = 0; jj < NUMPTS; jj++) { 23 | indata[ii][jj] = ii * NUMPTS + jj; 24 | printf(" %3.0f", indata[ii][jj]); 25 | } 26 | printf("\n"); 27 | } 28 | 29 | /* dedisperse_tree(0, 1, NUMPTS, NUMCHAN, NUMCHAN, outdata, indata); */ 30 | 31 | /* printf("\noutdata (Cornell):\n"); */ 32 | /* for (ii=0; ii 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #ifdef USEDMALLOC 9 | #include "dmalloc.h" 10 | #endif 11 | 12 | int main(void) 13 | { 14 | FILE *file; 15 | double tott; 16 | struct tms runtimes; 17 | int clk_tck = 1; 18 | 19 | tott = times(&runtimes); 20 | sleep(1); 21 | tott = times(&runtimes) - tott; 22 | clk_tck = (int) (tott / 10.0) * 10; 23 | printf("\nSlept for 1 sec.\n"); 24 | printf("Measured time in clock_t was: %f\n\n", tott); 25 | printf("Therefore, CLK_TCK is probably = %d\n\n", clk_tck); 26 | file = fopen("../include/clk_tck.h", "w"); 27 | fprintf(file, "#ifndef CLK_TCK\n"); 28 | fprintf(file, "#define CLK_TCK %d\n", clk_tck); 29 | fprintf(file, "#endif\n"); 30 | fclose(file); 31 | exit(0); 32 | } 33 | -------------------------------------------------------------------------------- /src/un_sc_td.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define HDRLEN 640 6 | #define DATLEN 49152 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | FILE *datfile, *rawfile; 11 | char hdr[HDRLEN+8], filenm[100]; 12 | unsigned char dat[DATLEN+8]; 13 | int ii = 0, numread; 14 | 15 | if (argc != 2) { 16 | printf("usage: un_sc_td basefilename\n"); 17 | exit(0); 18 | } 19 | 20 | sprintf(filenm, "%s.hdr", argv[1]); 21 | datfile = fopen(filenm, "r"); 22 | if ((numread = fread(hdr, sizeof(char), HDRLEN + 8, datfile)) != HDRLEN + 8) { 23 | printf(" Problem reading the header file '%s'\n", argv[1]); 24 | } else { 25 | printf("Successfully read the header file '%s'.\n" 26 | " Now merging '.hdr' and '.dat' files...\n", argv[1]); 27 | } 28 | fclose(datfile); 29 | 30 | sprintf(filenm, "%s.dat", argv[1]); 31 | datfile = fopen(filenm, "r"); 32 | sprintf(filenm, "%s.pkmb", argv[1]); 33 | rawfile = fopen(filenm, "w"); 34 | while (fread(dat, sizeof(unsigned char), DATLEN + 8, datfile)) { 35 | fwrite(hdr + 4, sizeof(char), HDRLEN, rawfile); 36 | fwrite(dat + 4, sizeof(unsigned char), DATLEN, rawfile); 37 | ii++; 38 | } 39 | fclose(datfile); 40 | fclose(rawfile); 41 | printf("Done. Wrote %d blocks.\n", ii); 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for PRESTO: Pulsar Search Software 3 | # for Unix (and hopefully MPI soon) 4 | # by Scott M. Ransom 5 | # 6 | DATE = $(shell date +%d%b%y) 7 | 8 | tar: squeaky tags package 9 | 10 | tags: 11 | cd src ; find . -name "*.[ch]" -print | etags - 12 | cd src ; find ../include -name "*.[ch]" -print | etags -a - 13 | 14 | package: 15 | cd ..; tar --exclude=.svn -cvf presto$(DATE).tar presto 16 | gzip -9 ../presto$(DATE).tar 17 | mv ../presto$(DATE).tar.gz . 18 | 19 | squeaky: 20 | rm -f *~ presto*.tar.gz *# 21 | find . -name "*.[oa]" | xargs rm -f 22 | find . -name "*.so" | xargs rm -f 23 | find . -name "*.dat" | xargs rm -f 24 | find . -name "*.fft" | xargs rm -f 25 | find . -name "*.inf" | xargs rm -f 26 | find . -name "*[~#]" | xargs rm -f 27 | cd python ; make clean 28 | cd src ; make squeaky 29 | -------------------------------------------------------------------------------- /tests/barytest.mak: -------------------------------------------------------------------------------- 1 | asdasd 2 | Num data pts = 1048576 3 | dt per bin (s) = 0.04 4 | Pulse shape = Spike 5 | Rounding format = Fractional 6 | Pulse freq (hz) = 33.3333 7 | fdot (s-2) = 0 8 | fdotdot (s-3) = 0 9 | Pulse amp = 1 10 | Pulse phs (deg) = 0 11 | DC backgrnd level = 0 12 | Binary period (s) = 0 13 | Bin asini/c (s) = 0 14 | Bin eccentricity = 0 15 | Ang of Peri (deg) = 0 16 | Tm since peri (s) = 0 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Other 21 | Noise sigma = 0 22 | On/Off Pair 1 = 0 1 23 | -------------------------------------------------------------------------------- /tests/bin/.geomview: -------------------------------------------------------------------------------- 1 | (ui-panel main off) 2 | (ui-panel tools off) 3 | -------------------------------------------------------------------------------- /tests/bin/GBT350filterbank: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/GBT350filterbank -------------------------------------------------------------------------------- /tests/bin/accelsearch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/accelsearch -------------------------------------------------------------------------------- /tests/bin/bary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/bary -------------------------------------------------------------------------------- /tests/bin/bincand: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/bincand -------------------------------------------------------------------------------- /tests/bin/cal2mjd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/cal2mjd -------------------------------------------------------------------------------- /tests/bin/check_parkes_raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/check_parkes_raw -------------------------------------------------------------------------------- /tests/bin/dat2sdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/dat2sdat -------------------------------------------------------------------------------- /tests/bin/dftfold: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/dftfold -------------------------------------------------------------------------------- /tests/bin/downsample: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/downsample -------------------------------------------------------------------------------- /tests/bin/downsample_filterbank.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys, sigproc 3 | import numpy as num 4 | 5 | if __name__ == "__main__": 6 | if len(sys.argv)==1: 7 | print "\nusage: downsample_filterbank_hdr.py DS_fact infile.fil\n" 8 | sys.exit() 9 | DS_fact = int(sys.argv[1]) 10 | basefilenm = sys.argv[2][:sys.argv[2].find(".fil")] 11 | 12 | filhdr = {} 13 | newhdr = "" 14 | infile = open(sys.argv[2], 'rb') 15 | 16 | # Determine the full size of the file 17 | infile.seek(0, 2) 18 | infilelen = infile.tell() 19 | infile.seek(0, 0) 20 | 21 | outfile = open(basefilenm+"_DS%d.fil"%DS_fact, 'wb') 22 | 23 | # Loop over the values in the .fil file 24 | while 1: 25 | param, val = sigproc.read_hdr_val(infile, stdout=False) 26 | filhdr[param] = val 27 | 28 | if param=="tsamp": 29 | val *= DS_fact 30 | 31 | # Append to the new hdr string 32 | newhdr += sigproc.addto_hdr(param, val) 33 | 34 | # Break out of the loop if the header is over 35 | if param=="HEADER_END": 36 | break 37 | 38 | # Write the new header to the output file 39 | outfile.write(newhdr) 40 | 41 | nchans = filhdr['nchans'] 42 | 43 | # Remove the header length from infilelen and then 44 | # determine how many spectra are in the file 45 | infilelen -= infile.tell() 46 | numspec = infilelen / nchans 47 | if infilelen % nchans: 48 | print "Whoops! File length calculation is not right..." 49 | 50 | # Now loop over the spectra 51 | for ii in xrange(numspec / DS_fact): 52 | try: 53 | x = num.fromfile(infile, dtype=num.ubyte, count=DS_fact*nchans) 54 | x.shape = (DS_fact, nchans) 55 | dsx = (x.mean(0)+0.5).astype(num.ubyte) 56 | dsx.tofile(outfile) 57 | except: 58 | break 59 | 60 | infile.close() 61 | outfile.close() 62 | -------------------------------------------------------------------------------- /tests/bin/dump_spigot_zerolag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/dump_spigot_zerolag -------------------------------------------------------------------------------- /tests/bin/exploredat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/exploredat -------------------------------------------------------------------------------- /tests/bin/explorefft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/explorefft -------------------------------------------------------------------------------- /tests/bin/fitsdelcol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/fitsdelcol -------------------------------------------------------------------------------- /tests/bin/fitsdelrow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/fitsdelrow -------------------------------------------------------------------------------- /tests/bin/makedata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/makedata -------------------------------------------------------------------------------- /tests/bin/makeinf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/makeinf -------------------------------------------------------------------------------- /tests/bin/mjd2cal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/mjd2cal -------------------------------------------------------------------------------- /tests/bin/patchdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/patchdata -------------------------------------------------------------------------------- /tests/bin/pfd_for_timing.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys, prepfold 3 | 4 | if len(sys.argv) == 1: 5 | sys.stderr.write("""usage: pfd_for_timing.py PFDFILES\n 6 | This script returns 'true' or 'false' if a .pfd file can be 7 | used for timing via get_TOAs.py or not.\n""") 8 | sys.exit(0) 9 | 10 | for pfdfile in sys.argv[1:]: 11 | try: 12 | pfd = prepfold.pfd(pfdfile) 13 | if pfd.use_for_timing(): 14 | print "%s: true"%pfdfile 15 | else: 16 | print "%s: false"%pfdfile 17 | except: 18 | sys.stderr.write("Error: Can't check '%s'\n"%pfdfile) 19 | -------------------------------------------------------------------------------- /tests/bin/plotbincand: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/plotbincand -------------------------------------------------------------------------------- /tests/bin/prepdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/prepdata -------------------------------------------------------------------------------- /tests/bin/prepfold: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/prepfold -------------------------------------------------------------------------------- /tests/bin/prepsubband: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/prepsubband -------------------------------------------------------------------------------- /tests/bin/psrfits_dumparrays: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/psrfits_dumparrays -------------------------------------------------------------------------------- /tests/bin/psrorbit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/psrorbit -------------------------------------------------------------------------------- /tests/bin/quicklook: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/quicklook -------------------------------------------------------------------------------- /tests/bin/readfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/readfile -------------------------------------------------------------------------------- /tests/bin/realfft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/realfft -------------------------------------------------------------------------------- /tests/bin/rednoise: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/rednoise -------------------------------------------------------------------------------- /tests/bin/rfifind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/rfifind -------------------------------------------------------------------------------- /tests/bin/sdat2dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/sdat2dat -------------------------------------------------------------------------------- /tests/bin/search_bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/search_bin -------------------------------------------------------------------------------- /tests/bin/search_rzw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/search_rzw -------------------------------------------------------------------------------- /tests/bin/shiftdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/shiftdata -------------------------------------------------------------------------------- /tests/bin/show_pfd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/show_pfd -------------------------------------------------------------------------------- /tests/bin/sortwappfiles.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys, re 3 | 4 | maxwappnum = 7 5 | wappfiles = {} 6 | for filename in sys.argv[1:]: 7 | for wappnum in range(1,maxwappnum+1): 8 | if ((wappnum==1 and re.search("\.wapp\.", filename)) or \ 9 | (wappnum>1 and re.search("\.wapp%d?\."%wappnum, filename))): 10 | if wappfiles.has_key(wappnum): 11 | wappfiles[wappnum].append(filename) 12 | else: 13 | wappfiles[wappnum] = [filename] 14 | break 15 | 16 | for key in wappfiles.keys(): 17 | numfiles = len(wappfiles[key]) 18 | wappfiles[key].sort() 19 | 20 | for filenum in range(numfiles): 21 | for wappnum in range(1,maxwappnum+1): 22 | if wappfiles.has_key(wappnum): 23 | print wappfiles[wappnum][filenum], 24 | -------------------------------------------------------------------------------- /tests/bin/spigot2filterbank: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/spigot2filterbank -------------------------------------------------------------------------------- /tests/bin/spigotSband2filterbank: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/spigotSband2filterbank -------------------------------------------------------------------------------- /tests/bin/split_parkes_beams: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/split_parkes_beams -------------------------------------------------------------------------------- /tests/bin/swap_endian: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/swap_endian -------------------------------------------------------------------------------- /tests/bin/taperaw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/taperaw -------------------------------------------------------------------------------- /tests/bin/toas2dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/toas2dat -------------------------------------------------------------------------------- /tests/bin/un_sc_td: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/un_sc_td -------------------------------------------------------------------------------- /tests/bin/weight_psrfits: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/weight_psrfits -------------------------------------------------------------------------------- /tests/bin/window: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/window -------------------------------------------------------------------------------- /tests/bin/zapbirds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/bin/zapbirds -------------------------------------------------------------------------------- /tests/clig/bincand_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name bincand 4 | 5 | Usage "Generates a set of fake orbits and their Fourier modulation spectra for a binary candidate (usually generated by search_bin). It tries to return the optimum fit for the binary candidate." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Double -plo plo {The low pulsar period to check (s)} \ 14 | -r 0 oo 15 | Double -phi phi {The high pulsar period to check (s)} \ 16 | -r 0 oo 17 | Double -rlo rlo {The low Fourier frequency bin to check} \ 18 | -r 0 oo 19 | Double -rhi rhi {The high Fourier frequency bin to check} \ 20 | -r 0 oo 21 | String -psr psrname {Name of pulsar to check for (do not include J or B)} 22 | Int -candnum candnum {Number of the candidate to optimize from candfile.} \ 23 | -r 1 oo 24 | String -candfile candfile {Name of the bincary candidate file.} 25 | 26 | # Parameters for a binary pulsar 27 | 28 | Flag -usr usr {Describe your own binary candidate. Must include all of the following (assumed) parameters} 29 | Double -pb pb {The orbital period (s)} \ 30 | -r 0 oo 31 | Double -x asinic {The projected orbital semi-major axis (lt-sec)} \ 32 | -r 0 oo 33 | Double -e e {The orbital eccentricity} \ 34 | -r 0 0.9999999 -d 0 35 | Double -To To {The time of periastron passage (MJD)} \ 36 | -r 0 oo 37 | Double -w w {Longitude of periastron (deg)} \ 38 | -r 0 360 39 | Double -wdot wdot {Rate of advance of periastron (deg/yr)} \ 40 | -r -oo oo -d 0 41 | 42 | Flag -mak makefile {Determine optimization parameters from 'infile.mak'} 43 | 44 | # Rest of command line: 45 | 46 | Rest infile {Input fft file name (without a suffix) of floating point fft data. A '.inf' file of the same name must also exist} \ 47 | -c 1 1 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /tests/clig/dftfold_cmd.cli: -------------------------------------------------------------------------------- 1 | Name dftfold 2 | 3 | Usage "Calculates the complex vector addition of a DFT frequency." 4 | 5 | Version [exec date +%d%b%y] 6 | 7 | Commandline full_cmd_line 8 | 9 | Int -n numvect {The number of DFT sub-vectors to save}\ 10 | -r 2 262144 -d 1000 11 | Double -r rr {The Fourier frequency to fold (bins)}\ 12 | -r 1.0 2000000000.0 13 | Double -p pp {The period to fold (s)}\ 14 | -r 0.00000001 100000.0 15 | Double -f ff {The frequency to fold (Hz)}\ 16 | -r 0.00000001 100000.0 17 | Double -norm norm {Raw power divided by this normalizes the power} 18 | Flag -fftnorm fftnorm {Use local powers from '.fft' file to get 'norm'} 19 | Rest infile {Input data file name (without a suffix) of floating point data. A '.inf' file of the same name must also exist} \ 20 | -c 1 1 21 | -------------------------------------------------------------------------------- /tests/clig/downsample.1: -------------------------------------------------------------------------------- 1 | .\" clig manual page template 2 | .\" (C) 1995-2001 Harald Kirsch (kirschh@lionbioscience.com) 3 | .\" 4 | .\" This file was generated by 5 | .\" clig -- command line interface generator 6 | .\" 7 | .\" 8 | .\" Clig will always edit the lines between pairs of `cligPart ...', 9 | .\" but will not complain, if a pair is missing. So, if you want to 10 | .\" make up a certain part of the manual page by hand rather than have 11 | .\" it edited by clig, remove the respective pair of cligPart-lines. 12 | .\" 13 | .\" cligPart TITLE 14 | .TH "downsample" 1 "12Mar10" "Clig-manuals" "Programmer's Manual" 15 | .\" cligPart TITLE end 16 | 17 | .\" cligPart NAME 18 | .SH NAME 19 | downsample \- Downsamples a time series. 20 | .\" cligPart NAME end 21 | 22 | .\" cligPart SYNOPSIS 23 | .SH SYNOPSIS 24 | .B downsample 25 | -factor factor 26 | [-o outfile] 27 | file 28 | .\" cligPart SYNOPSIS end 29 | 30 | .\" cligPart OPTIONS 31 | .SH OPTIONS 32 | .IP -factor 33 | The factor to downsample the data, 34 | .br 35 | 1 Int value between 1 and 100. 36 | .IP -o 37 | Name of the output time series file (with suffix), 38 | .br 39 | 1 String value 40 | .IP file 41 | Input '.dat' or '.sdat' file name. 42 | .\" cligPart OPTIONS end 43 | 44 | .\" cligPart DESCRIPTION 45 | .SH DESCRIPTION 46 | This manual page was generated automagically by clig, the 47 | Command Line Interface Generator. Actually the programmer 48 | using clig was supposed to edit this part of the manual 49 | page after 50 | generating it with clig, but obviously (s)he didn't. 51 | 52 | Sadly enough clig does not yet have the power to pick a good 53 | program description out of blue air ;-( 54 | .\" cligPart DESCRIPTION end 55 | -------------------------------------------------------------------------------- /tests/clig/downsample_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name downsample 4 | 5 | Usage "Downsamples a time series." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Int -factor factor {The factor to downsample the data} \ 14 | -r 1 100 -m 15 | String -o outfile {Name of the output time series file (with suffix)} 16 | 17 | # Rest of command line: 18 | 19 | Rest file {Input '.dat' or '.sdat' file name} \ 20 | -c 1 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/clig/realfft_cmd.cli: -------------------------------------------------------------------------------- 1 | Name realfft 2 | 3 | Usage {Perform a single-precision FFT of real data or its inverse} 4 | 5 | Version [exec date +%d%b%y] 6 | 7 | Commandline full_cmd_line 8 | 9 | Flag -fwd forward {Force an forward FFT (sign=-1) to be performed} 10 | Flag -inv inverse {Force an inverse FFT (sign=+1) to be performed} 11 | Flag -del delete {Delete the original file(s) when performing the FFT} 12 | Flag -disk diskfft {Force the use of the out-of-core memory FFT} 13 | Flag -mem memfft {Force the use of the in-core memory FFT} 14 | String -tmpdir tmpdir {Scratch directory for temp file(s) in out-of-core FFT} 15 | String -outdir outdir {Directory where result file(s) will reside} 16 | Rest infiles {Input data file(s)} \ 17 | -c 1 16 18 | -------------------------------------------------------------------------------- /tests/clig/rednoise.1: -------------------------------------------------------------------------------- 1 | .\" clig manual page template 2 | .\" (C) 1995-2001 Harald Kirsch (kirschh@lionbioscience.com) 3 | .\" 4 | .\" This file was generated by 5 | .\" clig -- command line interface generator 6 | .\" 7 | .\" 8 | .\" Clig will always edit the lines between pairs of `cligPart ...', 9 | .\" but will not complain, if a pair is missing. So, if you want to 10 | .\" make up a certain part of the manual page by hand rather than have 11 | .\" it edited by clig, remove the respective pair of cligPart-lines. 12 | .\" 13 | .\" cligPart TITLE 14 | .TH "rednoise" 1 "12Mar10" "Clig-manuals" "Programmer's Manual" 15 | .\" cligPart TITLE end 16 | 17 | .\" cligPart NAME 18 | .SH NAME 19 | rednoise \- Rednoise extraction routine. 20 | .\" cligPart NAME end 21 | 22 | .\" cligPart SYNOPSIS 23 | .SH SYNOPSIS 24 | .B rednoise 25 | [-startwidth startwidth] 26 | [-endwidth endwidth] 27 | [-endfreq endfreq] 28 | file 29 | .\" cligPart SYNOPSIS end 30 | 31 | .\" cligPart OPTIONS 32 | .SH OPTIONS 33 | .IP -startwidth 34 | The initial windowing size., 35 | .br 36 | 1 Int value between 2 and 50. 37 | .br 38 | Default: `6' 39 | .IP -endwidth 40 | The final windowing size., 41 | .br 42 | 1 Int value between 50 and 500. 43 | .br 44 | Default: `100' 45 | .IP -endfreq 46 | The highest frequency where the windowing increases., 47 | .br 48 | 1 Double value between 0.1 and 10. 49 | .br 50 | Default: `6' 51 | .IP file 52 | Input '.fft' file.. 53 | .\" cligPart OPTIONS end 54 | 55 | .\" cligPart DESCRIPTION 56 | .SH DESCRIPTION 57 | This manual page was generated automagically by clig, the 58 | Command Line Interface Generator. Actually the programmer 59 | using clig was supposed to edit this part of the manual 60 | page after 61 | generating it with clig, but obviously (s)he didn't. 62 | 63 | Sadly enough clig does not yet have the power to pick a good 64 | program description out of blue air ;-( 65 | .\" cligPart DESCRIPTION end 66 | -------------------------------------------------------------------------------- /tests/clig/rednoise_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name rednoise 4 | 5 | Usage "Rednoise extraction routine." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Int -startwidth startwidth {The initial windowing size.} \ 14 | -r 2 50 -d 6 15 | 16 | Int -endwidth endwidth {The final windowing size.} \ 17 | -r 50 500 -d 100 18 | 19 | Double -endfreq endfreq {The highest frequency where the windowing increases.} \ 20 | -r 0.1 10 -d 6 21 | 22 | # Rest of command line: 23 | 24 | Rest file {Input '.fft' file.} \ 25 | -c 1 1 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/clig/search_rzw_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name search_rzw 4 | 5 | Usage "Searches an FFT for pulsar candidates using a Fourier domain acceleration search." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Int -ncand ncand {Number of candidates to try to return} \ 14 | -r 1 10000 -d 100 15 | Int -zlo zlo {The low Fourier frequency derivative to search} \ 16 | -r -2000000 2000000 -d " -50" 17 | Int -zhi zhi {The high Fourier frequency derivative to search} \ 18 | -r -2000000 2000000 -d 50 19 | Int -rlo rlo {The lowest Fourier frequency to search} \ 20 | -r 0 oo -d 300 21 | Int -rhi rhi {The highest Fourier frequency to search} \ 22 | -r 0 oo 23 | Int -flo flo {The lowest frequency (Hz) to search} \ 24 | -r 0 oo 25 | Int -fhi fhi {The highest frequency (Hz) to search} \ 26 | -r 0 oo 27 | Int -lobin lobin {The first Fourier frequency in the data file} \ 28 | -r 0 oo -d 0 29 | String -zapfile zapfile {A file containing a list of freqs to ignore (i.e. RFI)} 30 | Double -baryv baryv {The earth's radial velocity component (v/c) towards the observation (used to convert topocentric birdie freqs to barycentric)} \ 31 | -r -0.1 0.1 -d 0.0 32 | Flag -photon photon {Data is poissonian so use freq 0 as power normalization} 33 | 34 | # Rest of command line: 35 | 36 | Rest infile {Input file name (no suffix) of floating point fft data. A '.inf' file of the same name must also exist} \ 37 | -c 1 1 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /tests/clig/show_pfd_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name show_pfd 4 | 5 | Usage "Displays or regenerates the Postscript for a 'pfd' file created by prepfold." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Flag -noxwin noxwin {Do not show the result plots on-screen, only make postscript files} 14 | Flag -scaleparts scaleparts {Scale the part profiles independently} 15 | Flag -allgrey allgrey {Make all the images greyscale instead of color} 16 | Flag -justprofs justprofs {Only output the profile portions of the plot} 17 | Flag -portrait portrait {Orient the output in portrait mode (for -justprofs)} 18 | Flag -events events {The folded data were events instead of samples or bins} 19 | Flag -infoonly infoonly {Display the pfd info and exit without generating plots.} 20 | String -killsubs killsubsstr {Comma separated string (no spaces!) of subbands to explicitly remove from analysis (i.e. zero out). Ranges are specified by min:max[:step]} 21 | String -killparts killpartsstr {Comma separated string (no spaces!) of intervals to explicitly remove from analysis (i.e. zero-out). Ranges are specified by min:max[:step]} 22 | 23 | # Rest of command line: 24 | 25 | Rest infile {The input 'pfd' file name.} \ 26 | -c 1 100 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/clig/spigot2filterbank_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name spigot2filterbank 4 | 5 | Usage "Converts raw GBT Spigot FITs files (lag data) into SIGPROC-style filterbank format." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | String -o outfile {Output file name (optional; for a single output file)} 14 | Flag -nohdr nohdr {Output just raw data. No headers are output} 15 | Flag -stdout stdout {Send the data to STDOUT instead of files} 16 | Flag -floats floats {Output data as 32-bit floats instead of 8-bit unsigned chars} 17 | Flag -zerolags zerolags {Dump the raw spigot zerolags in 32-bit floats format to a file} 18 | Int -skip skip {Number of spectra to skip from the initial value} \ 19 | -r 0 oo -d 0 20 | Int -numout numout {Number of spectra to output (default is all)} \ 21 | -r 0 oo 22 | Int -downsamp downsamp {Number of spectra to average on output} \ 23 | -r 0 oo -d 1 24 | Int -lokill lokill {Number of low-freq channels to ignore} \ 25 | -r 0 oo -d 0 26 | Int -hikill hikill {Number of high-freq channels to ignore} \ 27 | -r 0 oo -d 0 28 | 29 | # Rest of command line: 30 | 31 | Rest fitsfiles {Input Spigot FITs files.} \ 32 | -c 1 1024 33 | -------------------------------------------------------------------------------- /tests/clig/toas2dat_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name toas2dat 4 | 5 | Usage "Converts TOAs into a binned time series." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Int -n numout {The number of bins in the output time series} \ 14 | -r 0 oo -m 15 | Double -dt dt {Time interval in seconds for output time bins} \ 16 | -r 0 oo -m 17 | Double -t0 t0 {Time for the start of bin 0 (same units as the TOAs)} 18 | String -o outfile {Name of the output time series file} \ 19 | -m 20 | Flag -text text {TOAs are ASCII text (default is binary double)} 21 | Flag -float float {TOAs are binary floats (default is binary double)} 22 | Flag -sec sec {TOA unit is seconds (default is days)} 23 | 24 | # Rest of command line: 25 | 26 | Rest file {Input TOA file name} \ 27 | -c 1 1 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/clig/zapbirds_cmd.cli: -------------------------------------------------------------------------------- 1 | # Admin data 2 | 3 | Name zapbirds 4 | 5 | Usage "Allows you to interactively or automatically zap interference from an FFT." 6 | 7 | Version [exec date +%d%b%y] 8 | 9 | Commandline full_cmd_line 10 | 11 | # Options (in order you want them to appear) 12 | 13 | Flag -zap zap \ 14 | {Zap the birds in the FFT from 'zapfile' (write to the FFT file)} 15 | String -zapfile zapfile \ 16 | {A file of freqs and widths to zap from the FFT (when using '-zap')} 17 | String -in inzapfile \ 18 | {A file containing a list of freqs (Hz) and the # of harmonics to zap} 19 | String -out outzapfile \ 20 | {A file to write that will contain the freqs and widths (Hz) zapped} 21 | Double -baryv baryv \ 22 | {The radial velocity component (v/c) towards the target during the obs} \ 23 | -r -0.1 0.1 -d 0.0 24 | 25 | # Rest of command line: 26 | 27 | Rest infile {Input file name (no suffix) of floating point fft data. A '.inf' file of the same name must also exist} \ 28 | -c 1 1 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/compare.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | typedef struct FCOMPLEX { 6 | float r, i; 7 | } fcomplex; 8 | 9 | #define TOLERANCE (1e-2) 10 | #define SQR(x) ((x) * (x)) 11 | 12 | float compute_error_complex(fcomplex A, fcomplex B) 13 | { 14 | /* compute the relative error */ 15 | float error = 0.0, a, mag; 16 | 17 | a = sqrt(SQR(A.r - B.r) + SQR(A.i - B.i)); 18 | mag = 0.5 * (sqrt(SQR(A.r) + SQR(A.i)) + 19 | sqrt(SQR(B.r) + SQR(B.i))) + TOLERANCE; 20 | a /= mag; 21 | if (a > error) 22 | error = a; 23 | return error; 24 | } 25 | 26 | int main(int argc, char *argv[]) 27 | { 28 | FILE *a, *b; 29 | fcomplex adat[1000], bdat[1000]; 30 | float perc, err; 31 | int ard, brd, i, j=0; 32 | 33 | if (argc < 4){ 34 | printf("\nUsage: compare file1 file2 error(%%)\n\n"); 35 | exit(1); 36 | } 37 | 38 | a = fopen(argv[1], "rb"); 39 | b = fopen(argv[2], "rb"); 40 | perc = atof(argv[3])/100.0; 41 | while ((ard = fread(adat, sizeof(fcomplex), 1000, a)) && 42 | (brd = fread(bdat, sizeof(fcomplex), 1000, b))){ 43 | for(i = 0 ; i perc) 45 | printf("Problem at %d: %s=%g, %g %s=%g, %g err=%g\n",\ 46 | 1000*j+i,argv[1],adat[i].r,adat[i].i 47 | ,argv[2],bdat[i].r,bdat[i].i,err); 48 | } 49 | j++; 50 | } 51 | fclose(a); 52 | fclose(b); 53 | return(0); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /tests/docs/.xvpics/presto1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/docs/.xvpics/presto1.jpg -------------------------------------------------------------------------------- /tests/docs/.xvpics/presto2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/docs/.xvpics/presto2.jpg -------------------------------------------------------------------------------- /tests/docs/PRESTO_search_tutorial.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/docs/PRESTO_search_tutorial.odp -------------------------------------------------------------------------------- /tests/docs/PRESTO_search_tutorial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/docs/PRESTO_search_tutorial.pdf -------------------------------------------------------------------------------- /tests/docs/downsample.1: -------------------------------------------------------------------------------- 1 | .\" clig manual page template 2 | .\" (C) 1995-2001 Harald Kirsch (kirschh@lionbioscience.com) 3 | .\" 4 | .\" This file was generated by 5 | .\" clig -- command line interface generator 6 | .\" 7 | .\" 8 | .\" Clig will always edit the lines between pairs of `cligPart ...', 9 | .\" but will not complain, if a pair is missing. So, if you want to 10 | .\" make up a certain part of the manual page by hand rather than have 11 | .\" it edited by clig, remove the respective pair of cligPart-lines. 12 | .\" 13 | .\" cligPart TITLE 14 | .TH "downsample" 1 "12Mar10" "Clig-manuals" "Programmer's Manual" 15 | .\" cligPart TITLE end 16 | 17 | .\" cligPart NAME 18 | .SH NAME 19 | downsample \- Downsamples a time series. 20 | .\" cligPart NAME end 21 | 22 | .\" cligPart SYNOPSIS 23 | .SH SYNOPSIS 24 | .B downsample 25 | -factor factor 26 | [-o outfile] 27 | file 28 | .\" cligPart SYNOPSIS end 29 | 30 | .\" cligPart OPTIONS 31 | .SH OPTIONS 32 | .IP -factor 33 | The factor to downsample the data, 34 | .br 35 | 1 Int value between 1 and 100. 36 | .IP -o 37 | Name of the output time series file (with suffix), 38 | .br 39 | 1 String value 40 | .IP file 41 | Input '.dat' or '.sdat' file name. 42 | .\" cligPart OPTIONS end 43 | 44 | .\" cligPart DESCRIPTION 45 | .SH DESCRIPTION 46 | This manual page was generated automagically by clig, the 47 | Command Line Interface Generator. Actually the programmer 48 | using clig was supposed to edit this part of the manual 49 | page after 50 | generating it with clig, but obviously (s)he didn't. 51 | 52 | Sadly enough clig does not yet have the power to pick a good 53 | program description out of blue air ;-( 54 | .\" cligPart DESCRIPTION end 55 | -------------------------------------------------------------------------------- /tests/docs/presto1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/docs/presto1.jpg -------------------------------------------------------------------------------- /tests/docs/presto2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/docs/presto2.jpg -------------------------------------------------------------------------------- /tests/docs/rednoise.1: -------------------------------------------------------------------------------- 1 | .\" clig manual page template 2 | .\" (C) 1995-2001 Harald Kirsch (kirschh@lionbioscience.com) 3 | .\" 4 | .\" This file was generated by 5 | .\" clig -- command line interface generator 6 | .\" 7 | .\" 8 | .\" Clig will always edit the lines between pairs of `cligPart ...', 9 | .\" but will not complain, if a pair is missing. So, if you want to 10 | .\" make up a certain part of the manual page by hand rather than have 11 | .\" it edited by clig, remove the respective pair of cligPart-lines. 12 | .\" 13 | .\" cligPart TITLE 14 | .TH "rednoise" 1 "12Mar10" "Clig-manuals" "Programmer's Manual" 15 | .\" cligPart TITLE end 16 | 17 | .\" cligPart NAME 18 | .SH NAME 19 | rednoise \- Rednoise extraction routine. 20 | .\" cligPart NAME end 21 | 22 | .\" cligPart SYNOPSIS 23 | .SH SYNOPSIS 24 | .B rednoise 25 | [-startwidth startwidth] 26 | [-endwidth endwidth] 27 | [-endfreq endfreq] 28 | file 29 | .\" cligPart SYNOPSIS end 30 | 31 | .\" cligPart OPTIONS 32 | .SH OPTIONS 33 | .IP -startwidth 34 | The initial windowing size., 35 | .br 36 | 1 Int value between 2 and 50. 37 | .br 38 | Default: `6' 39 | .IP -endwidth 40 | The final windowing size., 41 | .br 42 | 1 Int value between 50 and 500. 43 | .br 44 | Default: `100' 45 | .IP -endfreq 46 | The highest frequency where the windowing increases., 47 | .br 48 | 1 Double value between 0.1 and 10. 49 | .br 50 | Default: `6' 51 | .IP file 52 | Input '.fft' file.. 53 | .\" cligPart OPTIONS end 54 | 55 | .\" cligPart DESCRIPTION 56 | .SH DESCRIPTION 57 | This manual page was generated automagically by clig, the 58 | Command Line Interface Generator. Actually the programmer 59 | using clig was supposed to edit this part of the manual 60 | page after 61 | generating it with clig, but obviously (s)he didn't. 62 | 63 | Sadly enough clig does not yet have the power to pick a good 64 | program description out of blue air ;-( 65 | .\" cligPart DESCRIPTION end 66 | -------------------------------------------------------------------------------- /tests/include/chkio.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef USE_PIOFS 3 | #include 4 | #include 5 | #else 6 | #include 7 | #endif 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | FILE *chkfopen(char *path, const char *mode); 14 | /* Preform a file open with error checking. */ 15 | 16 | size_t chkfread(void *data, size_t type, size_t number, FILE * stream); 17 | /* Preform a file read with error checking. */ 18 | 19 | size_t chkfwrite(void *data, size_t type, size_t number, FILE * stream); 20 | /* Preform a file write with error checking. */ 21 | 22 | size_t chkfseek(FILE * stream, long offset, int whence); 23 | /* NOTE: This is meant only for backwards compatibility. */ 24 | /* You should probably be calling chkfileseek() directly. */ 25 | 26 | size_t chkfileseek(FILE * stream, off_t offset, size_t size, int whence); 27 | /* Preform a file seek with error checking. */ 28 | 29 | long long chkfilelen(FILE *file, size_t size); 30 | /* Return the length of a file (in blocks of 'size'). */ 31 | 32 | int read_int(FILE *infile, int byteswap); 33 | /* Reads a binary integer value from the file 'infile' */ 34 | 35 | float read_float(FILE *infile, int byteswap); 36 | /* Reads a binary float value from the file 'infile' */ 37 | 38 | double read_double(FILE *infile, int byteswap); 39 | /* Reads a double precision value from the file 'infile' */ 40 | 41 | -------------------------------------------------------------------------------- /tests/include/clk_tck.h: -------------------------------------------------------------------------------- 1 | #ifndef CLK_TCK 2 | #define CLK_TCK 100 3 | #endif 4 | -------------------------------------------------------------------------------- /tests/include/dftfold.h: -------------------------------------------------------------------------------- 1 | #include "rawtype.h" 2 | 3 | typedef struct DFTVECTOR { 4 | int n; /* Number of data points in each vector segment */ 5 | int numvect; /* Number of vectors in the fold (vector length) */ 6 | double dt; /* Duration (s) of each data point */ 7 | double r; /* Fourier frequency folded */ 8 | double norm; /* Normalization used on vector */ 9 | double T; /* Total duration of original data set. */ 10 | fcomplex *vector; /* Calculated DFT vector */ 11 | } dftvector; 12 | 13 | void read_dftvector(dftvector *data, char *filename); 14 | /* Read a dftvector data structure from a binary file */ 15 | 16 | void write_dftvector(dftvector *data, char *filename); 17 | /* Write a dftvector data structure to a binary file */ 18 | 19 | void init_dftvector(dftvector *data, int n, int numvect, 20 | double dt, double r, double norm, 21 | double T); 22 | /* Initialize a dftvector and allocate its vector part */ 23 | 24 | void free_dftvector(dftvector *data); 25 | /* Free the dynamically allocated vector in data */ 26 | -------------------------------------------------------------------------------- /tests/include/dftfold_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __dftfold_cmd__ 2 | #define __dftfold_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -n: The number of DFT sub-vectors to save */ 13 | char numvectP; 14 | int numvect; 15 | int numvectC; 16 | /***** -r: The Fourier frequency to fold (bins) */ 17 | char rrP; 18 | double rr; 19 | int rrC; 20 | /***** -p: The period to fold (s) */ 21 | char ppP; 22 | double pp; 23 | int ppC; 24 | /***** -f: The frequency to fold (Hz) */ 25 | char ffP; 26 | double ff; 27 | int ffC; 28 | /***** -norm: Raw power divided by this normalizes the power */ 29 | char normP; 30 | double norm; 31 | int normC; 32 | /***** -fftnorm: Use local powers from '.fft' file to get 'norm' */ 33 | char fftnormP; 34 | /***** uninterpreted command line parameters */ 35 | int argc; 36 | /*@null*/char **argv; 37 | /***** the whole command line concatenated */ 38 | char *full_cmd_line; 39 | } Cmdline; 40 | 41 | 42 | extern char *Program; 43 | extern void usage(void); 44 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 45 | 46 | extern void showOptionValues(void); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /tests/include/downsample_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __downsample_cmd__ 2 | #define __downsample_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -factor: The factor to downsample the data */ 13 | char factorP; 14 | int factor; 15 | int factorC; 16 | /***** -o: Name of the output time series file (with suffix) */ 17 | char outfileP; 18 | char* outfile; 19 | int outfileC; 20 | /***** uninterpreted command line parameters */ 21 | int argc; 22 | /*@null*/char **argv; 23 | /***** the whole command line concatenated */ 24 | char *full_cmd_line; 25 | } Cmdline; 26 | 27 | 28 | extern char *Program; 29 | extern void usage(void); 30 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 31 | 32 | extern void showOptionValues(void); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /tests/include/gmrt.h: -------------------------------------------------------------------------------- 1 | void set_GMRT_padvals(float *fpadvals, int good_padvals); 2 | void get_GMRT_file_info(FILE *files[], char *datfilenms[], int numfiles, 3 | float clipsig, long long *N, int *ptsperblock, int *numchan, 4 | double *dt, double *T, int output); 5 | void GMRT_update_infodata(int numfiles, infodata *idata); 6 | int skip_to_GMRT_rec(FILE *infiles[], int numfiles, int rec); 7 | int read_GMRT_rawblock(FILE *infiles[], int numfiles, unsigned char *data, 8 | int *padding); 9 | int read_GMRT_rawblocks(FILE *infiles[], int numfiles, unsigned char rawdata[], 10 | int numblocks, int *padding); 11 | int read_GMRT(FILE *infiles[], int numfiles, float *data, int numpts, 12 | double *dispdelays, int *padding, int *maskchans, 13 | int *nummasked, mask *obsmask); 14 | void get_GMRT_channel(int channum, float chandat[], 15 | unsigned char rawdata[], int numblocks); 16 | int prep_GMRT_subbands(unsigned char *rawdata, float *data, double *dispdelays, 17 | int numsubbands, int transpose, int *maskchans, 18 | int *nummasked, mask *obsmask); 19 | int read_GMRT_subbands(FILE *infiles[], int numfiles, float *data, 20 | double *dispdelays, int numsubbands, int transpose, 21 | int *padding, int *maskchans, int *nummasked, 22 | mask *obsmask); 23 | void GMRT_hdr_to_inf(char *datfilenm, infodata *idata); 24 | void convert_GMRT_block(short *indata, unsigned char *outdata); 25 | void convert_GMRT_block_8bit(unsigned char *indata, unsigned char *outdata); 26 | -------------------------------------------------------------------------------- /tests/include/meminfo.h: -------------------------------------------------------------------------------- 1 | /* The following definitions can be changed to tweak your */ 2 | /* code. But they probably won't help a whole lot. You */ 3 | /* can calculate their values by running meminit. */ 4 | /* This file was generated by running 'meminit'. */ 5 | #define CODESIZE 2 6 | #define Ramsize 1048576000 7 | #define CacheL1size 65536 8 | #define CacheL2size 262144 9 | #define Cacheburst 32 10 | #define Maxblocksize 67108864 11 | #define MAXREALFFT 1000000000 12 | #define BIGFFTWSIZE 200000000 13 | #define KBF 33554432 14 | #define Cachetreshold 32768 15 | #define Cacheburstblocksize 4 16 | #define Cacheblocksize 64 17 | -------------------------------------------------------------------------------- /tests/include/randlib.h: -------------------------------------------------------------------------------- 1 | /* Prototypes for all user accessible RANDLIB routines */ 2 | 3 | extern void advnst(long k); 4 | extern float genbet(float aa,float bb); 5 | extern float genchi(float df); 6 | extern float genexp(float av); 7 | extern float genf(float dfn, float dfd); 8 | extern float gengam(float a,float r); 9 | extern void genmn(float *parm,float *x,float *work); 10 | extern void genmul(long n,float *p,long ncat,long *ix); 11 | extern float gennch(float df,float xnonc); 12 | extern float gennf(float dfn, float dfd, float xnonc); 13 | extern float gennor(float av,float sd); 14 | extern void genprm(long *iarray,int larray); 15 | extern float genunf(float low,float high); 16 | extern void getsd(long *iseed1,long *iseed2); 17 | extern void gscgn(long getset,long *g); 18 | extern long ignbin(long n,float pp); 19 | extern long ignnbn(long n,float p); 20 | extern long ignlgi(void); 21 | extern long ignpoi(float mu); 22 | extern long ignuin(long low,long high); 23 | extern void initgn(long isdtyp); 24 | extern long mltmod(long a,long s,long m); 25 | extern void phrtsd(char* phrase,long* seed1,long* seed2); 26 | extern float ranf(void); 27 | extern void setall(long iseed1,long iseed2); 28 | extern void setant(long qvalue); 29 | extern void setgmn(float *meanv,float *covm,long p,float *parm); 30 | extern void setsd(long iseed1,long iseed2); 31 | extern float sexpo(void); 32 | extern float sgamma(float a); 33 | extern float snorm(void); 34 | -------------------------------------------------------------------------------- /tests/include/rawtype.h: -------------------------------------------------------------------------------- 1 | /* Note: Define rawtype to be the type you need to transpose */ 2 | 3 | #ifndef _RAWTYPE_PART_DECLARED_ 4 | /* Use the following if you want to transform doubles */ 5 | /* typedef double rawtype_part; */ 6 | typedef float rawtype_part; 7 | #define _RAWTYPE_PART_DECLARED_ 8 | #endif /* _RAWTYPE_PART_DECLARED_ */ 9 | 10 | /* Declare a floating point complex type */ 11 | #ifndef _FCOMPLEX_DECLARED_ 12 | typedef struct FCOMPLEX { 13 | rawtype_part r, i; 14 | } fcomplex; 15 | #define _FCOMPLEX_DECLARED_ 16 | #endif /* _FCOMPLEX_DECLARED_ */ 17 | 18 | /* Declare rawtype as fcomplex */ 19 | #ifndef _RAWTYPE_DECLARED_ 20 | typedef fcomplex rawtype; 21 | typedef rawtype TOMS_el_type; 22 | #define MPI_rawtype fcomplextype 23 | #define _RAWTYPE_DECLARED_ 24 | #endif /* _RAWTYPE_DECLARED_ */ 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/include/rdascat.h: -------------------------------------------------------------------------------- 1 | implicit real*8 (a-h,o-z) 2 | parameter (NP=800) 3 | real*8 ldeg,lum 4 | character jname*12,bname*8,lcode*1,ucode*1 5 | common/dat/ jname(NP),bname(NP),ra2000(NP),ra1950(NP), 6 | + rae(NP),dec2000(NP),dec1950(NP),dece(NP),nscode(NP), 7 | + dmin(NP),dmax(NP),dist(NP),ndflag(NP),lcode(NP),ucode(NP), 8 | + ldeg(NP),bdeg(NP),pmra(NP),pmrae(NP),pmdec(NP), 9 | + pmdece(NP),posepoch(NP),p(NP),pe(NP),pdot(NP),pdote(NP), 10 | + f2(NP),f2e(NP),f3(NP),f3e(NP),epoch(NP),dm(NP),dme(NP), 11 | + rm(NP), 12 | + rme(NP),we(NP),w50(NP),w10(NP),s400(NP),s600(NP),s1400(NP), 13 | + tau(NP),ntauflag(NP),t408(NP),ntype(NP), 14 | + modcode(NP),limcode(NP), 15 | + distmod(NP),lum(NP),bsurf(NP),age(NP),edot(NP),ibin(NP), 16 | + pb(NP),pbe(NP),a1(NP),a1e(NP),om(NP),ome(NP), 17 | + omdot(NP),omdote(NP),e(NP),ee(NP),t0(NP),t0e(NP), 18 | + gamma(NP),gammae(NP),pbdot(NP),pbdote(NP),si(NP),sie(NP), 19 | + r(NP),re(NP), 20 | + pb2(NP),pb2e(NP),a12(NP),a12e(NP),om2(NP),om2e(NP), 21 | + omdot2(NP),omdot2e(NP),e2(NP),e2e(NP),t02(NP),t02e(NP), 22 | + gamma2(NP),gamma2e(NP),pbdot2(NP),pbdot2e(NP),si2(NP), 23 | + si2e(NP),r2(NP),r2e(NP) 24 | -------------------------------------------------------------------------------- /tests/include/realfft_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __realfft_cmd__ 2 | #define __realfft_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -fwd: Force an forward FFT (sign=-1) to be performed */ 13 | char forwardP; 14 | /***** -inv: Force an inverse FFT (sign=+1) to be performed */ 15 | char inverseP; 16 | /***** -del: Delete the original file(s) when performing the FFT */ 17 | char deleteP; 18 | /***** -disk: Force the use of the out-of-core memory FFT */ 19 | char diskfftP; 20 | /***** -mem: Force the use of the in-core memory FFT */ 21 | char memfftP; 22 | /***** -tmpdir: Scratch directory for temp file(s) in out-of-core FFT */ 23 | char tmpdirP; 24 | char* tmpdir; 25 | int tmpdirC; 26 | /***** -outdir: Directory where result file(s) will reside */ 27 | char outdirP; 28 | char* outdir; 29 | int outdirC; 30 | /***** uninterpreted command line parameters */ 31 | int argc; 32 | /*@null*/char **argv; 33 | /***** the whole command line concatenated */ 34 | char *full_cmd_line; 35 | } Cmdline; 36 | 37 | 38 | extern char *Program; 39 | extern void usage(void); 40 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 41 | 42 | extern void showOptionValues(void); 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /tests/include/rednoise_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __rednoise_cmd__ 2 | #define __rednoise_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -startwidth: The initial windowing size. */ 13 | char startwidthP; 14 | int startwidth; 15 | int startwidthC; 16 | /***** -endwidth: The final windowing size. */ 17 | char endwidthP; 18 | int endwidth; 19 | int endwidthC; 20 | /***** -endfreq: The highest frequency where the windowing increases. */ 21 | char endfreqP; 22 | double endfreq; 23 | int endfreqC; 24 | /***** uninterpreted command line parameters */ 25 | int argc; 26 | /*@null*/char **argv; 27 | /***** the whole command line concatenated */ 28 | char *full_cmd_line; 29 | } Cmdline; 30 | 31 | 32 | extern char *Program; 33 | extern void usage(void); 34 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 35 | 36 | extern void showOptionValues(void); 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /tests/include/show_pfd_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __show_pfd_cmd__ 2 | #define __show_pfd_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -noxwin: Do not show the result plots on-screen, only make postscript files */ 13 | char noxwinP; 14 | /***** -scaleparts: Scale the part profiles independently */ 15 | char scalepartsP; 16 | /***** -allgrey: Make all the images greyscale instead of color */ 17 | char allgreyP; 18 | /***** -justprofs: Only output the profile portions of the plot */ 19 | char justprofsP; 20 | /***** -portrait: Orient the output in portrait mode (for -justprofs) */ 21 | char portraitP; 22 | /***** -events: The folded data were events instead of samples or bins */ 23 | char eventsP; 24 | /***** -infoonly: Display the pfd info and exit without generating plots. */ 25 | char infoonlyP; 26 | /***** -killsubs: Comma separated string (no spaces!) of subbands to explicitly remove from analysis (i.e. zero out). Ranges are specified by min:max[:step] */ 27 | char killsubsstrP; 28 | char* killsubsstr; 29 | int killsubsstrC; 30 | /***** -killparts: Comma separated string (no spaces!) of intervals to explicitly remove from analysis (i.e. zero-out). Ranges are specified by min:max[:step] */ 31 | char killpartsstrP; 32 | char* killpartsstr; 33 | int killpartsstrC; 34 | /***** uninterpreted command line parameters */ 35 | int argc; 36 | /*@null*/char **argv; 37 | /***** the whole command line concatenated */ 38 | char *full_cmd_line; 39 | } Cmdline; 40 | 41 | 42 | extern char *Program; 43 | extern void usage(void); 44 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 45 | 46 | extern void showOptionValues(void); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /tests/include/spigot2filterbank_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __spigot2filterbank_cmd__ 2 | #define __spigot2filterbank_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -o: Output file name (optional; for a single output file) */ 13 | char outfileP; 14 | char* outfile; 15 | int outfileC; 16 | /***** -nohdr: Output just raw data. No headers are output */ 17 | char nohdrP; 18 | /***** -stdout: Send the data to STDOUT instead of files */ 19 | char stdoutP; 20 | /***** -floats: Output data as 32-bit floats instead of 8-bit unsigned chars */ 21 | char floatsP; 22 | /***** -zerolags: Dump the raw spigot zerolags in 32-bit floats format to a file */ 23 | char zerolagsP; 24 | /***** -skip: Number of spectra to skip from the initial value */ 25 | char skipP; 26 | int skip; 27 | int skipC; 28 | /***** -numout: Number of spectra to output (default is all) */ 29 | char numoutP; 30 | int numout; 31 | int numoutC; 32 | /***** -downsamp: Number of spectra to average on output */ 33 | char downsampP; 34 | int downsamp; 35 | int downsampC; 36 | /***** -lokill: Number of low-freq channels to ignore */ 37 | char lokillP; 38 | int lokill; 39 | int lokillC; 40 | /***** -hikill: Number of high-freq channels to ignore */ 41 | char hikillP; 42 | int hikill; 43 | int hikillC; 44 | /***** uninterpreted command line parameters */ 45 | int argc; 46 | /*@null*/char **argv; 47 | /***** the whole command line concatenated */ 48 | char *full_cmd_line; 49 | } Cmdline; 50 | 51 | 52 | extern char *Program; 53 | extern void usage(void); 54 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 55 | 56 | extern void showOptionValues(void); 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /tests/include/toas2dat_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __toas2dat_cmd__ 2 | #define __toas2dat_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -n: The number of bins in the output time series */ 13 | char numoutP; 14 | int numout; 15 | int numoutC; 16 | /***** -dt: Time interval in seconds for output time bins */ 17 | char dtP; 18 | double dt; 19 | int dtC; 20 | /***** -t0: Time for the start of bin 0 (same units as the TOAs) */ 21 | char t0P; 22 | double t0; 23 | int t0C; 24 | /***** -o: Name of the output time series file */ 25 | char outfileP; 26 | char* outfile; 27 | int outfileC; 28 | /***** -text: TOAs are ASCII text (default is binary double) */ 29 | char textP; 30 | /***** -float: TOAs are binary floats (default is binary double) */ 31 | char floatP; 32 | /***** -sec: TOA unit is seconds (default is days) */ 33 | char secP; 34 | /***** uninterpreted command line parameters */ 35 | int argc; 36 | /*@null*/char **argv; 37 | /***** the whole command line concatenated */ 38 | char *full_cmd_line; 39 | } Cmdline; 40 | 41 | 42 | extern char *Program; 43 | extern void usage(void); 44 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 45 | 46 | extern void showOptionValues(void); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /tests/include/wapp_key.h: -------------------------------------------------------------------------------- 1 | struct HEADERKEY { 2 | void *next; 3 | char *name; 4 | int offset; 5 | int type; 6 | int len; /* length of data element */ 7 | int alen; /* array length */ 8 | }; 9 | 10 | struct HEADERVAL { 11 | void *value; 12 | struct HEADERKEY *key; 13 | }; 14 | 15 | struct HEADERP { 16 | struct HEADERKEY *head; 17 | struct HEADERKEY *tail; 18 | char *buf; /* ascii C header declaration */ 19 | int offset; /* len of buf ( offset to start of generic head in file */ 20 | void *header; /* pointer to instance of generic header */ 21 | int headlen; /* len of generic header */ 22 | int fd; /* file des */ 23 | int yacc_offset; /* last returned by head_input */ 24 | }; 25 | 26 | struct HEADERP *head_parse(FILE *f); 27 | extern struct HEADERKEY headerkey[]; 28 | int find_hdrval(struct HEADERP *h, char *name, struct HEADERVAL *hdrval); 29 | void close_parse(struct HEADERP *h); 30 | -------------------------------------------------------------------------------- /tests/include/zapbirds_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __zapbirds_cmd__ 2 | #define __zapbirds_cmd__ 3 | /***** 4 | command line parser interface -- generated by clig 5 | (http://wsd.iitb.fhg.de/~geg/clighome/) 6 | 7 | The command line parser `clig': 8 | (C) 1995-2004 Harald Kirsch (clig@geggus.net) 9 | *****/ 10 | 11 | typedef struct s_Cmdline { 12 | /***** -zap: Zap the birds in the FFT from 'zapfile' (write to the FFT file) */ 13 | char zapP; 14 | /***** -zapfile: A file of freqs and widths to zap from the FFT (when using '-zap') */ 15 | char zapfileP; 16 | char* zapfile; 17 | int zapfileC; 18 | /***** -in: A file containing a list of freqs (Hz) and the # of harmonics to zap */ 19 | char inzapfileP; 20 | char* inzapfile; 21 | int inzapfileC; 22 | /***** -out: A file to write that will contain the freqs and widths (Hz) zapped */ 23 | char outzapfileP; 24 | char* outzapfile; 25 | int outzapfileC; 26 | /***** -baryv: The radial velocity component (v/c) towards the target during the obs */ 27 | char baryvP; 28 | double baryv; 29 | int baryvC; 30 | /***** uninterpreted command line parameters */ 31 | int argc; 32 | /*@null*/char **argv; 33 | /***** the whole command line concatenated */ 34 | char *full_cmd_line; 35 | } Cmdline; 36 | 37 | 38 | extern char *Program; 39 | extern void usage(void); 40 | extern /*@shared*/Cmdline *parseCmdline(int argc, char **argv); 41 | 42 | extern void showOptionValues(void); 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /tests/lib/a2x.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/lib/a2x.ps -------------------------------------------------------------------------------- /tests/lib/a2xshell.ps: -------------------------------------------------------------------------------- 1 | %! 2 | % Copyright (C) 1994-1996 Christoph Beck, 3 | % All rights reserved. 4 | % 5 | % This software may be distributed under the terms of the GNU General 6 | % Public License. 7 | % 8 | % push shell arguments on stack and execute A2x 9 | [ shellarguments { ] a2xdict begin A2x end } { pop } ifelse 10 | -------------------------------------------------------------------------------- /tests/lib/libpresto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/lib/libpresto.so -------------------------------------------------------------------------------- /tests/lib/libsla.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/lib/libsla.so -------------------------------------------------------------------------------- /tests/lib/pulsars.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/lib/pulsars.cat -------------------------------------------------------------------------------- /tests/lib/python/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2013,1,8,13,39,8 3 | ViewMode=2 4 | -------------------------------------------------------------------------------- /tests/lib/python/catalog_query.txt: -------------------------------------------------------------------------------- 1 | http://www.atnf.csiro.au/research/pulsar/psrcat/proc_form.php?Name=Name&JName=JName&RaJ=RaJ&DecJ=DecJ&PMRA=PMRA&PMDec=PMDec&PX=PX&PosEpoch=PosEpoch&GL=GL&GB=GB&P0=P0&P1=P1&F2=F2&F3=F3&PEpoch=PEpoch&DM=DM&DM1=DM1&S400=S400&S1400=S1400&Binary=Binary&T0=T0&PB=PB&A1=A1&OM=OM&Ecc=Ecc&Tasc=Tasc&Eps1=Eps1&Eps2=Eps2&Dist=Dist&Assoc=Assoc&Type=Type&startUserDefined=true&c1_val=&c2_val=&c3_val=&c4_val=&sort_attr=jname&sort_order=asc&condition=&pulsar_names=&ephemeris=short&coords_unit=raj%2Fdecj&radius=&coords_1=&coords_2=&style=Long+with+errors&no_value=*&x_axis=&x_scale=linear&y_axis=&y_scale=linear&state=query&table_bottom.x=40&table_bottom.y=0 2 | -------------------------------------------------------------------------------- /tests/lib/python/cosine_rand.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/lib/python/cosine_rand.pickle -------------------------------------------------------------------------------- /tests/lib/python/psr_constants.py: -------------------------------------------------------------------------------- 1 | ## Automatically adapted for numpy Apr 14, 2006 by convertcode.py 2 | 3 | ARCSECTORAD = float('4.8481368110953599358991410235794797595635330237270e-6') 4 | RADTOARCSEC = float('206264.80624709635515647335733077861319665970087963') 5 | SECTORAD = float('7.2722052166430399038487115353692196393452995355905e-5') 6 | RADTOSEC = float('13750.987083139757010431557155385240879777313391975') 7 | RADTODEG = float('57.295779513082320876798154814105170332405472466564') 8 | DEGTORAD = float('1.7453292519943295769236907684886127134428718885417e-2') 9 | RADTOHRS = float('3.8197186342054880584532103209403446888270314977710') 10 | HRSTORAD = float('2.6179938779914943653855361527329190701643078328126e-1') 11 | PI = float('3.1415926535897932384626433832795028841971693993751') 12 | TWOPI = float('6.2831853071795864769252867665590057683943387987502') 13 | PIBYTWO = float('1.5707963267948966192313216916397514420985846996876') 14 | SECPERDAY = float('86400.0') 15 | SECPERJULYR = float('31557600.0') 16 | KMPERPC = float('3.0856776e13') 17 | KMPERKPC = float('3.0856776e16') 18 | Tsun = float('4.925490947e-6') # sec 19 | Msun = float('1.9891e30') # kg 20 | Mjup = float('1.8987e27') # kg 21 | Rsun = float('6.9551e8') # m 22 | Rearth = float('6.378e6') # m 23 | SOL = float('299792458.0') # m/s 24 | MSUN = float('1.989e+30') # kg 25 | G = float('6.673e-11') # m^3/s^2/kg 26 | C = SOL 27 | -------------------------------------------------------------------------------- /tests/python/Makefile: -------------------------------------------------------------------------------- 1 | LIBS = "/home/ransom/cprogs/Working/presto/lib/" 2 | INC = "/home/ransom/cprogs/Working/presto/include/" 3 | PYINC = "/usr/local/include/python1.5/" 4 | CC = egcc 5 | F77 = g77 6 | CFLAGS = -I$(PYINC) -I$(INC) -I./ -Wall -ansi -pedantic -pipe -fPIC -O -g 7 | 8 | OBJS = cvects.o /home/ransom/cprogs/Working/presto/src/vectors.o 9 | WRAPS = cvects_wrap.o 10 | 11 | all: wrap my_range.so 12 | 13 | wrap: test_wrap.c 14 | swig -python test.i 15 | 16 | libcvects.so: $(OBJS) 17 | $(CC) $(CFLAGS) -shared $(OBJS) -o $@ 18 | 19 | cvects.so: $(OBJS) $(WRAPS) 20 | $(CC) $(CFLAGS) -shared $(OBJS) $(WRAPS) -o $@ 21 | 22 | statsum.so: statsum.o statsum_wrap.o 23 | $(CC) $(CFLAGS) -shared statsum.o statsum_wrap.o -o $@ 24 | 25 | my_range.so: shorttest.o test_wrap.o 26 | $(CC) $(CFLAGS) -shared shorttest.o test_wrap.o -o $@ 27 | 28 | test_cvects: $(OBJS) test_cvects.o 29 | $(CC) $(CFLAGS) -o $@ $(OBJS) test_cvects.o -L./ -lcvects -lm 30 | 31 | clean: 32 | rm -f *.o *~ *# *.so 33 | rm -f test_cvects cvects_wrap.o 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /tests/python/cvec.py: -------------------------------------------------------------------------------- 1 | from Numeric import * 2 | from cvects import * 3 | 4 | def carr(n): 5 | return complex_arr(n) 6 | 7 | def multcarr(a, val): 8 | mult_arr(a, val, len(a)) 9 | 10 | a = open("cvects.h", "r") 11 | print get_filelen(a) 12 | a.close() 13 | 14 | d = arange(10, typecode='d') 15 | print d 16 | dgenrotate_1d(d, len(d), 3.5) 17 | print d 18 | print dstats(d, len(d)) 19 | 20 | f = complex_arr(10) 21 | print f 22 | mult_arr(f, 10.0, len(f)) 23 | print f 24 | -------------------------------------------------------------------------------- /tests/python/cvec.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/python/cvec.pyc -------------------------------------------------------------------------------- /tests/python/cvects.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "vectors.h" 5 | 6 | float *complex_arr(long N); 7 | /* Returns a CFLOAT Python array. */ 8 | 9 | void mult_arr(float *arr, float val, long N); 10 | /* Rotates a vector by bins_to_left places to the left. */ 11 | /* numbins is the number of DOUBLE points to move. */ 12 | 13 | void dgenrotate_1d(double *data, long numbins, double bins_to_left); 14 | /* Rotates a vector by bins_to_left places to the left. */ 15 | /* numbins is the number of DOUBLE points to move. */ 16 | 17 | void dstats(double *x, int n, double *mean, double *var, 18 | double *skew, double *kurt); 19 | /* For a double precision vector, *x, of length n, this routine */ 20 | /* returns the mean, variance, skewness, and kurtosis of *x. */ 21 | 22 | long get_filelen(FILE *file); 23 | /* Return the length of the file *file in bytes without */ 24 | /* losing your place in the file. */ 25 | -------------------------------------------------------------------------------- /tests/python/cvects.i: -------------------------------------------------------------------------------- 1 | %module cvects 2 | %{ 3 | #include "cvects.h" 4 | %} 5 | 6 | %include numpy.i 7 | 8 | float_complex *complex_arr(long ARRAYLEN); 9 | /* Returns a CFLOAT Python array. */ 10 | 11 | void mult_arr(float *IN_1D_CFLOAT, float val, long N); 12 | /* Rotates a vector by bins_to_left places to the left. */ 13 | /* numbins is the number of DOUBLE points to move. */ 14 | 15 | void dgenrotate_1d(double *IN_1D_DOUBLE, long numbins, double bins_to_left); 16 | /* Rotates a vector by bins_to_left places to the left. */ 17 | /* numbins is the number of DOUBLE points to move. */ 18 | 19 | void dstats(double *IN_1D_DOUBLE, int n, double *OUTDOUBLE, double *OUTDOUBLE, 20 | double *OUTDOUBLE, double *OUTDOUBLE); 21 | /* For a double precision vector, *x, of length n, this routine */ 22 | /* returns the mean, variance, skewness, and kurtosis of *x. */ 23 | 24 | long get_filelen(FILE *file); 25 | /* Return the length of the file *file in bytes without */ 26 | /* losing your place in the file. */ 27 | -------------------------------------------------------------------------------- /tests/python/misc/pychecks.py: -------------------------------------------------------------------------------- 1 | from numpy import * 2 | from Pgplot import * 3 | from psr_utils import * 4 | from presto import * 5 | 6 | # Check the image plotting software 7 | a = distance(201) 8 | b = exp(-a**2/1000.0) 9 | x = arange(-100.0, 101.0, 1.0) 10 | plot2d(b, x, x, contours=array([0.2, 0.5, 0.7]), color='black', labels='white', labelint=50, labelmin=30) 11 | closeplot() 12 | 13 | # Check the f-fdot plane generator 14 | fftfile = open('../../tests/testz.fft') 15 | m = 0 16 | numbetween = 8 17 | lof = 19990.0 18 | loz = -20.0 19 | hiz = 20.0 20 | numz = 81.0 21 | numfplot = 20.0 22 | dz = (hiz-loz)/(numz-1.0) 23 | a = corr_rz_plane_file(fftfile, numbetween, lof, loz, hiz, numz, 1024, LOWACC, m) 24 | a[1] 25 | b = (a[0].real**2 + a[0].imag**2)/get_numphotons(fftfile) 26 | x = arange(numfplot*numbetween, dtype='f') / numbetween + lof 27 | y = arange(numz, dtype='f') * dz + loz 28 | c = arange(6) * 10.0 + 10.0 29 | plot2d(b[:,0:int(numfplot*numbetween)], x, y, \ 30 | labx="Fourier Frequency", laby="Fourier F-dot", \ 31 | contours=c, color='black', image='heat') #, \ 32 | # device='test.ps/CPS') 33 | nextplotpage(1) 34 | plot2d(b[:,0:int(numfplot*numbetween)], x, y, \ 35 | labx="Fourier Frequency", laby="Fourier F-dot", \ 36 | contours=c, color='black', image='astro') #, \ 37 | # device='test.ps/CPS') 38 | closeplot() 39 | 40 | -------------------------------------------------------------------------------- /tests/python/pdm2raw.py: -------------------------------------------------------------------------------- 1 | from numpyio import fread, fwrite 2 | from sys import argv 3 | 4 | print "\nReading info from %s.hdr and" % argv[1] 5 | print "%s.dat\n" % argv[1] 6 | print "Writing %s.raw\n" % argv[1] 7 | 8 | HEADERLEN = 640 9 | BLOCKLEN = 49152 10 | 11 | # Read the header file 12 | 13 | file = open(argv[1]+'.hdr', 'r') 14 | data = fread(file, HEADERLEN+8, 'b') 15 | file.close() 16 | header = data[4:-4] 17 | infile = open(argv[1]+'.dat', 'r') 18 | outfile = open(argv[1]+'.raw', 'w') 19 | 20 | # Read and write the raw data 21 | 22 | while (1): 23 | data = fread(infile, BLOCKLEN+8, 'b') 24 | if (len(data)==BLOCKLEN+8): 25 | fwrite(outfile, HEADERLEN, header, 'b') 26 | fwrite(outfile, BLOCKLEN, data[4:-4], 'b') 27 | else: 28 | break 29 | print '' 30 | infile.close() 31 | outfile.close() 32 | -------------------------------------------------------------------------------- /tests/python/ppgplot_src/__init__.py: -------------------------------------------------------------------------------- 1 | from _ppgplot import * 2 | -------------------------------------------------------------------------------- /tests/python/preppaste.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/python/preppaste.py -------------------------------------------------------------------------------- /tests/python/presto_src/prestoswig.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jintaoluo/presto_on_gpu/f2040651ba1b0293b42e746169e1bba824380eec/tests/python/presto_src/prestoswig.pyc -------------------------------------------------------------------------------- /tests/python/show_zresp.py: -------------------------------------------------------------------------------- 1 | from numpy import * 2 | from Pgplot import * 3 | from presto import * 4 | 5 | kern_half_width = 10 6 | numbetween = 10 7 | numkern = 2 * numbetween * kern_half_width 8 | f = arange(numkern, dtype=float64) / numbetween - kern_half_width 9 | kern = gen_z_response(0.0, numbetween, 0.0, numkern) 10 | pkern = spectralpower(kern) 11 | print "Freq ", f[len(f)/2], " = ", pkern[len(f)/2] 12 | plotxy(pkern, f, labx="Fourier Frequency Offset", \ 13 | laby="Normalized Power", device="z_responses.eps/CPS") 14 | #plotxy(pkern, f, labx="Fourier Frequency Offset", \ 15 | # laby="Normalized Power") 16 | for i in range(4): 17 | z = 5.0 * i 18 | kern = gen_z_response(0.0, numbetween, z, numkern) 19 | pkern = spectralpower(kern) 20 | plotxy(pkern, f, color=i+1) 21 | ppgplot.pgtext(5.0, 0.8 - i*0.1, 'z = %1.0f' % z) 22 | closeplot() 23 | -------------------------------------------------------------------------------- /tests/python/test_cvects.c: -------------------------------------------------------------------------------- 1 | #include "cvects.h" 2 | 3 | int main(void) 4 | { 5 | long i, N=10; 6 | float *x, *y; 7 | double *z; 8 | 9 | x = complex_arr(N); 10 | y = complex_arr(N); 11 | mult_arr(y, 3.0, 2*N); 12 | for(i=0; i<2*N; i++){ 13 | x[i] += 2.0; 14 | printf("x[%ld] = %f y[%ld] = %f\n", i, x[i], i, y[i]); 15 | } 16 | free(x); 17 | free(y); 18 | z = gen_dvect(10); 19 | for (i = 0; i<10; i++){ 20 | z[i] = (double) i; 21 | printf("x[%ld] = %f\n", i, z[i]); 22 | } 23 | printf("rotate left...\n"); 24 | dgenrotate_1d(z, 10, 3.5); 25 | for (i = 0; i<10; i++){ 26 | printf("z[%ld] = %f\n", i, z[i]); 27 | } 28 | printf("rotate right...\n"); 29 | dgenrotate_1d(z, 10, -3.5); 30 | for (i = 0; i<10; i++){ 31 | printf("z[%ld] = %f\n", i, z[i]); 32 | } 33 | free(z); 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /tests/python/wrappers/Makefile: -------------------------------------------------------------------------------- 1 | SWIG = swig 2 | SWIGOPT = -make_default -python -shadow 3 | 4 | prestowrap: 5 | $(SWIG) $(SWIGOPT) presto.i 6 | cp presto.py ../presto_src/prestoswig.py 7 | cp presto_wrap.c ../presto_src/ 8 | clean: 9 | rm -f *~ *.o *.so *.pyc *.py *.c 10 | -------------------------------------------------------------------------------- /tests/python/wrappers/color.i: -------------------------------------------------------------------------------- 1 | %module color 2 | 3 | %{ 4 | #include 5 | #include "plot3d.h" 6 | %} 7 | 8 | typedef struct COLOR { 9 | float r, g, b; 10 | } color; 11 | 12 | void hue(color *x, float val); 13 | void heat(color *x, float val); 14 | void rainbow(color *x, float val); 15 | void gray(color *x, float val); 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/test_fdot.mak: -------------------------------------------------------------------------------- 1 | Tests f/fdot interpolation in program test_apps.c. 2 | Num data pts = 131072 3 | dt per bin (s) = 7.62939453125e-06 4 | Pulse shape = Sine 5 | Rounding format = Whole Numbers 6 | Pulse freq (hz) = 2334.0216055 7 | fdot (s-2) = 23.456789 8 | fdotdot (s-3) = 0 9 | Pulse amp = 1 10 | Pulse phs (deg) = 0 11 | DC backgrnd level = 0 12 | Binary period (s) = 0 13 | Bin asini/c (s) = 0 14 | Bin eccentricity = 0 15 | Ang of Peri (deg) = 0 16 | Tm since peri (s) = 0 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Other 21 | Noise sigma = 0 22 | On/Off Pair 1 = 0 1 23 | -------------------------------------------------------------------------------- /tests/test_finterp.mak: -------------------------------------------------------------------------------- 1 | Tests fourier interpolation in program test_apps.c. 2 | Num data pts = 131072 3 | dt per bin (s) = 7.62939453125e-06 4 | Pulse shape = Sine 5 | Rounding format = Whole Numbers 6 | Pulse freq (hz) = 2345.75 7 | fdot (s-2) = 0 8 | fdotdot (s-3) = 0 9 | Pulse amp = 1 10 | Pulse phs (deg) = 0 11 | DC backgrnd level = 0 12 | Binary period (s) = 0 13 | Bin asini/c (s) = 0 14 | Bin eccentricity = 0 15 | Ang of Peri (deg) = 0 16 | Tm since peri (s) = 0 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Other 21 | Noise sigma = 0 22 | On/Off Pair 1 = 0 1 23 | 24 | -------------------------------------------------------------------------------- /tests/test_fold.c: -------------------------------------------------------------------------------- 1 | #include "presto.h" 2 | #include "plot2d.h" 3 | 4 | int main (int argc, char *argv[]) 5 | { 6 | long i, N = 1048576, numfold = 0; 7 | double dt = 0.125, t = 0.0, f = 0.31234, fdot = -5.1e-10, phs = 0.234; 8 | double prof[100], *freqs, onoff[2]; 9 | float data[1048576]; 10 | 11 | for (i = 0 ; i < N ; i++){ 12 | t = i*dt; 13 | data[i] = 0.1234 * cos(TWOPI * (f + 0.5 * fdot * t) * t + phs); 14 | } 15 | for (i = 0 ; i < 100 ; i++){ 16 | prof[i] = 0.0; 17 | } 18 | 19 | onoff[0] = 0; 20 | onoff[1] = 1023; 21 | numfold = 0; 22 | 23 | printf("Data is complete...\n"); 24 | 25 | for (i = 0 ; i < 1024 ; i++){ 26 | fold(data+i*1024, 1024, dt, i*1024*dt, prof, \ 27 | 100, f, fdot, 0.0, 0, NULL, 0, 0, 0, onoff, &numfold); 28 | } 29 | 30 | cpgstart_x("landscape"); 31 | 32 | freqs = gen_dfreqs(100, 0, 0.01); 33 | 34 | dxyline(100, freqs, prof, "Phase", "Relative Intensity", 1); 35 | 36 | cpgend(); 37 | 38 | free(freqs); 39 | return 0; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /tests/test_keplar.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "../include/orbint.h" 5 | 6 | int main (int argc, char **argv) 7 | { 8 | double u, e, p, t = 0.0; 9 | long i, npts; 10 | 11 | npts = atoi(argv[1]); 12 | p = atof(argv[2]); 13 | e = atof(argv[3]); 14 | for (i = 0 ; i <= npts ; i++){ 15 | t = (double) i / (double) npts * p; 16 | u = keplars_eqn(t, 1.0/p, e, 1.0E-14); 17 | printf(" t = %10.6f u = %17.15f\n",t,u); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/test_moments.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "../include/vectors.h" 5 | 6 | void stats(float *x, int n, double *mean, double *var, 7 | double *skew, double *kurt); 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | long N, i; 12 | float *x; 13 | double mean, var, skew, kurt; 14 | 15 | N = strtol(argv[1], NULL, 10); 16 | x = gen_fvect(N); 17 | printf("Number of points = %ld\n",N); 18 | printf("x = {\n"); 19 | for (i = 0 ; i < N ; i++){ 20 | x[i] = (10.0 * rand() / (RAND_MAX + 1.0)) - 5.0; 21 | printf("%15.12f",x[i]); 22 | if (i < N-1) printf(",\n"); 23 | else printf("\n"); 24 | } 25 | printf("}\n"); 26 | stats(x, N, &mean, &var, &skew, &kurt); 27 | printf("\nmean = %20.10f\n",mean); 28 | printf("var = %20.10f\n",var); 29 | printf("skew = %20.10f\n",skew); 30 | printf("kurt = %20.10f\n",kurt); 31 | free(x); 32 | return 0; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /tests/test_phasemod.mak: -------------------------------------------------------------------------------- 1 | Sample test set. 2 | Num data pts = 1048576 3 | dt per bin (s) = 0.00000095367431640625 4 | Pulse shape = Sine 5 | Rounding format = Fractional 6 | Pulse freq (hz) = 250000.826417 7 | fdot (s-2) = 0 8 | fdotdot (s-3) = 0 9 | Pulse amp = 0.00000190734863095344 10 | Pulse phs (deg) = 0 11 | DC backgrnd level = 0 12 | Binary period (s) = 0.02687828983548013818 13 | Bin asini/c (s) = 0.0001070107202800007 14 | Bin eccentricity = 0 15 | Ang of Peri (deg) = 234.567890 16 | Tm since peri (s) = 0.0091981887817382812 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Other 21 | Noise sigma = 0 22 | On/Off Pair 1 = 0 1 23 | 24 | -------------------------------------------------------------------------------- /tests/test_plot.mak: -------------------------------------------------------------------------------- 1 | Tests 3-D plotting routines in program test_apps.c. 2 | Num data pts = 131072 3 | dt per bin (s) = 7.62939453125e-06 4 | Pulse shape = Sine 5 | Rounding format = Whole Numbers 6 | Pulse freq (hz) = 2334.0216055 7 | fdot (s-2) = 23.456789 8 | fdotdot (s-3) = 0 9 | Pulse amp = 1 10 | Pulse phs (deg) = 0 11 | DC backgrnd level = 655.36 12 | Binary period (s) = 0 13 | Bin asini/c (s) = 0 14 | Bin eccentricity = 0 15 | Ang of Peri (deg) = 0 16 | Tm since peri (s) = 0 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Standard 21 | Noise sigma = 25.6 22 | On/Off Pair 1 = 0 1 23 | -------------------------------------------------------------------------------- /tests/test_profile.mak: -------------------------------------------------------------------------------- 1 | Binary orbit to test profile software 2 | Num data pts = 1048576 3 | dt per bin (s) = 0.01 4 | Pulse shape = Spike (FWHM = 0.1) 5 | Rounding format = Fractional 6 | Pulse freq (hz) = 5.45678 7 | fdot (s-2) = 0 8 | fdotdot (s-3) = 0 9 | Pulse amp = 0.2 10 | Pulse phs (deg) = 123.456789 11 | DC backgrnd level = 7.8 12 | Binary period (s) = 3123.4567 13 | Bin asini/c (s) = 1.6879 14 | Bin eccentricity = 0.567 15 | Ang of Peri (deg) = 222.8765 16 | Tm since peri (s) = 1234.56789 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Standard 21 | Noise sigma = 2.79284800875379 22 | On/Off Pair 1 = 0 1 23 | -------------------------------------------------------------------------------- /tests/testbess.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | double *bessjtable(double x, int *N, int tol); 6 | /* Generates the bessel functions needed by fmresp. */ 7 | 8 | #define TOL -15 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | int N, i, offset; 13 | double *bessj, x; 14 | 15 | x = strtod(argv[1], NULL); 16 | printf("x = %f\n",x); 17 | printf("-------------------------------\n"); 18 | bessj = bessjtable(x, &N, TOL); 19 | offset = (N-1)/2; 20 | for (i = 0; i < N; i++) 21 | printf("J_%-4d = % 11.8f\n", i-offset, bessj[i]); 22 | free(bessj); 23 | } 24 | -------------------------------------------------------------------------------- /tests/testdatabase.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "../../include/presto.h" 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | psrdata psr, *psrs; 9 | psrdatabase pdata; 10 | int np, pnum; 11 | 12 | np = read_database(&pdata); 13 | psrs = collect_psrdata(&np); 14 | psr = get_psrdata(argv[1]); 15 | printf("There are %d pulsars in the database.\n\n",np); 16 | printf(" RA = %f\n", psr.ra2000); 17 | printf("DEC = %f\n", psr.dec2000); 18 | printf(" p = %f\n", psr.p); 19 | pnum = psr_number_from_name(argv[1], &pdata); 20 | printf("\nPSR J%.12s is pulsar number %d\n\n", psr.jname, pnum); 21 | printf(" RA = %f\n", psrs[pnum].ra2000); 22 | printf("DEC = %f\n", psrs[pnum].dec2000); 23 | printf(" p = %f\n", psrs[pnum].p); 24 | free(psrs); 25 | return 1; 26 | } 27 | -------------------------------------------------------------------------------- /tests/testfold.mak: -------------------------------------------------------------------------------- 1 | Sample test set. 2 | Num data pts = 1048576 3 | dt per bin (s) = 9.5367431640625e-7 4 | Pulse shape = Spike 5 | Rounding format = Fractional 6 | Pulse freq (hz) = 20000.12345 7 | fdot (s-2) = 0 8 | fdotdot (s-3) = 0 9 | Pulse amp = 0.3 10 | Pulse phs (deg) = 0 11 | DC backgrnd level = 100 12 | Binary period (s) = 0.123 13 | Bin asini/c (s) = 0.003312 14 | Bin eccentricity = 0.234 15 | Ang of Peri (deg) = 20 16 | Tm since peri (s) = 0.05987 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Other 21 | Noise sigma = 0 22 | On/Off Pair 1 = 0 1 23 | 24 | -------------------------------------------------------------------------------- /tests/testresp.mak: -------------------------------------------------------------------------------- 1 | 2 | Num data pts = 32768 3 | dt per bin (s) = 0.000030517578125 4 | Pulse shape = Sine 5 | Rounding format = Fractional 6 | Pulse freq (hz) = 10000.5 7 | fdot (s-2) = 0.6 8 | fdotdot (s-3) = 0 9 | Pulse amp = 1.0 10 | Pulse phs (deg) = 0 11 | DC backgrnd level = 0 12 | Binary period (s) = 0 13 | Bin asini/c (s) = 0 14 | Bin eccentricity = 0 15 | Ang of Peri (deg) = 0 16 | Tm since peri (s) = 0 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Other 21 | Noise sigma = 0.0 22 | On/Off Pair 1 = 0 1 23 | -------------------------------------------------------------------------------- /tests/testz.mak: -------------------------------------------------------------------------------- 1 | Sample test set. 2 | Num data pts = 1048576 3 | dt per bin (s) = 9.5367431640625e-7 4 | Pulse shape = Spike 5 | Rounding format = Fractional 6 | Pulse freq (hz) = 20000.12345 7 | fdot (s-2) = 5.678 8 | fdotdot (s-3) = 0 9 | Pulse amp = 0.15 10 | Pulse phs (deg) = 0 11 | DC backgrnd level = 400 12 | Binary period (s) = 0 13 | Bin asini/c (s) = 0 14 | Bin eccentricity = 0 15 | Ang of Peri (deg) = 0 16 | Tm since peri (s) = 0 17 | Amp Mod amplitude = 0 18 | Amp Mod phs (deg) = 0 19 | Amp Mod freq (hz) = 0 20 | Noise type = Standard 21 | Noise sigma = 40 22 | On/Off Pair 1 = 0 1 23 | -------------------------------------------------------------------------------- /tests/wchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | FILE *file; 7 | char text[] = "Testing"; 8 | 9 | file = fopen("test.txt","wb"); 10 | fwrite(text, sizeof(text), 1, file); 11 | return 1; 12 | } --------------------------------------------------------------------------------