Last change
on this file since 2067 was 1313, checked in by mar637, 18 years ago |
scantable plugin to flag negative values in the bandpass (MOPS)
|
File size:
1.0 KB
|
Rev | Line | |
---|
[1313] | 1 | def _vanvleck_flag(scan, level=5.0):
|
---|
| 2 | """
|
---|
| 3 | Find level crossings and flag all data before (and after it).
|
---|
| 4 | This rectifies the problem caused by the MOPS bandpass being negative.
|
---|
| 5 | Use levels greater > 0.0 to get a better result.
|
---|
| 6 | """
|
---|
| 7 | sel = selector()
|
---|
| 8 | saved = scan.get_selection()
|
---|
| 9 | for i in xrange(scan.nrow()):
|
---|
| 10 | sel.reset()
|
---|
| 11 | sel.set_scans(scan.getscan(i))
|
---|
| 12 | sel.set_beams(scan.getbeam(i))
|
---|
| 13 | sel.set_ifs(scan.getif(i))
|
---|
| 14 | sel.set_polarisations(scan.getpol(i))
|
---|
| 15 | sel.set_cycles(scan.getcycle(i))
|
---|
| 16 | scan.set_selection(sel)
|
---|
| 17 | spec = scan._getspectrum()
|
---|
| 18 | msk = mask_not(scan._getmask())
|
---|
| 19 | n = len(msk)
|
---|
| 20 | modified = False
|
---|
| 21 | for j in xrange(n):
|
---|
| 22 | if j < n and spec[j] <= level:
|
---|
| 23 | msk[j] = 1
|
---|
| 24 | modified = True
|
---|
| 25 | if modified:
|
---|
| 26 | scan.flag(msk)
|
---|
| 27 | scan.set_selection(saved)
|
---|
| 28 |
|
---|
| 29 | if not "vanvleck_flag" in dir(scantable):
|
---|
| 30 | scantable.vanvleck_flag = _vanvleck_flag
|
---|
| 31 | del _vanvleck_flag
|
---|
Note:
See
TracBrowser
for help on using the repository browser.