Browse Source

flag_weights.py will also report % of data to flag that were != 0 from the beginning

polconvert
Benito Marcote 3 years ago
parent
commit
593cd52eb1
  1. 3
      antabfs_nominal.py
  2. 6
      flag_weights.py
  3. 2
      ysfocus.py

3
antabfs_nominal.py

@ -1,5 +1,4 @@
#!/opt/local/bin/python3
####!/usr/bin/python3
#!/usr/bin/python3
"""
Python port of Bob Campbell's IDL script to make nominal tsys tables.
It takes the nominal SEFD values from the sefd_values.txt table and generates an ANTAB file using

6
flag_weights.py

@ -26,7 +26,7 @@ from pyrap import tables as pt
import numpy as np
import sys
help_msdata = 'Measurement set containing the data to be corrected.'
help_threshold = 'Visibilities with a weight below this value will be flagged. Must be positive.'
help_v = 'Only checks the visibilities to flag (do not flag the data).'
@ -73,8 +73,10 @@ with pt.table(msdata, readonly=False, ack=False) as ms:
weights = ms.getcol("WEIGHT")
print('Got {0:9} weights'.format(weights.size))
indexes = np.where(weights < threshold)
indexes2 = np.where((weights < threshold) & (weights > 0.0))
print('Got {0:9} bad points'.format(indexes[0].size))
print('{0:04.3}% of the visibilities to flag\n'.format(100.0*indexes[0].size/weights.size))
print('{0:04.3}% of the total visibilities to flag\n'.format(100.0*indexes[0].size/weights.size))
print('{0:04.3}% of actual data (non-zero) to flag\n'.format(100.0*indexes2[0].size/weights.size))
if verbose:
weights[indexes] = -np.abs(weights[indexes])
ms.putcol("WEIGHT", weights)

2
ysfocus.py

@ -88,7 +88,7 @@ with pt.table(msdata, readonly=False, ack=False) as ms:
print('Changing {} mount from {} to {}'.format(a_station, getmount(a_station),
fixed_mounts[a_station]))
mounts[stations.index(a_station)] = fixed_mounts[a_station]
# In case no station has been found in the MS
if len(stations_to_change) == 0:
print("Neither Ys nor Ho found in the MS, exiting without action")

Loading…
Cancel
Save