Commit 80285d29 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema

Update reduction script, do dedispersion for numpy

parent 9aef80bc
#!/usr/bin/env python
from __future__ import print_function
import sys
import psrchive
import numpy as np
zapname = sys.argv[1]
npyname = sys.argv[2]
arch = psrchive.Archive_load(zapname)
print('Folding period :', arch.get_Integration(0).get_folding_period())
print('Folding dispersion measure :', arch.get_Integration(0).get_dispersion_measure())
np.save(npyname, arch.get_data() * arch.get_weights()[:, np.newaxis, :, np.newaxis])
#!/bin/bash
for fil in *.fil
set -e
for fil in 2018-01-19-*.fil
do
headername=${fil/fil/txt}
header $fil > ${headername}
......@@ -13,8 +15,12 @@ do
psrsh -e med median_zap.psh $arname 2>&1 > /dev/null
zapname=${arname/.ar/.med}
fi
rm ${arname}
ddname=${arname/.ar/.dd}
pam -e dd -D ${zapname} 2>&1 > /dev/null
npyname=${fil/fil/npy}
python -c "import psrchive; import numpy; archive=psrchive.Archive_load('${zapname}'); print 'Folding period :', archive.get_Integration(0).get_folding_period(); print 'Folding dispersion measure :', archive.get_Integration(0).get_dispersion_measure(); numpy.save('${npyname}', archive.get_data()*archive.get_weights()[:,numpy.newaxis,:,numpy.newaxis])" >> ${headername}
./convert.py ${ddname} ${npyname} >> ${headername}
rm ${ddname}
pngname=${arname/.ar/.png}
pav -dGTp ${zapname} -g ${arname/.ar/.png}/png
cat >> htmlout.html <<EOF
......@@ -24,11 +30,10 @@ do
<td>CB+TJD</td>
<td>
<ul>
<li><a href="${fil}">Filterbank</a> (313 MB)</li>
<li><a href="${fil}">Filterbank</a> ($( du -h ${fil} | awk '{print $1}' ))</li>
<li><a href="${headername}">Filterbank header</a></li>
<li><a href="${zapname}">Pulsar archive</a> (16 MB)</li>
<li><a href="${npyname}">Numpy array</a> (32 MB)</li>
<li><a href="${pngname}">Plot</a></li>
<li><a href="${zapname}">Pulsar archive</a> ($( du -h ${zapname} | awk '{print $1}' ))</li>
<li><a href="${npyname}">Numpy array</a> ($( du -h ${npyname} | awk '{print $1}' ))</li>
</ul>
</td>
<td>420 MHz</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment