<jupyter_start><jupyter_text>Apply standard L-band flags ```run flagging_mkat_lband.py --msfile 'ngc3621.ms' --zeros --lband --gps --glonass --galileo --afristar --iridium --inmarsat```<jupyter_code>flagdata(vis=msfile, mode='shadow');
# if a Leap second warning is raised, simply run the command again to get rid of the warning
flagdata(vis=msfile, mode='elevation', lowerlimit=15., upperlimit=90., action='apply');
flagdata(vis=msfile, mode='clip', clipminmax = [1e-5, 1000.0]);<jupyter_output><empty_output><jupyter_text>Spectral windows are sub-bands. MeerKAT has only one sub-band.Remove bandpass edges and the Milky Way<jupyter_code>flagdata(vis=msfile,
         field='0408-65,1117-248',
         mode='manual',
         spw='*:856~880MHz,*:1658~1800MHz,*:1420.0~1421.3MHz',
         flagbackup=False);<jupyter_output><empty_output><jupyter_text>Check for bad antennasFlag antennas based on the (mis)behaviour of their autocorrelations.<jupyter_code>plotms(vis=msfile,
       xaxis='channel',
       yaxis='phase',
       averagedata=True,
       avgtime='3300',
       correlation='YY',
       field=f_cal,
       coloraxis='baseline')
plotms(vis=msfile,
       xaxis='channel',
       yaxis='phase',
       averagedata=True,
       avgtime='3300',
       correlation='XX',
       field=f_cal,
       coloraxis='baseline')
plotms(vis=msfile,
       xaxis='channel',
       yaxis='phase',
       averagedata=True,
       avgtime='3300',
       correlation='XX',
       field=f_cal,
       antenna='m022',
       coloraxis='corr',
       plotrange=[0,0,-180,180])
plotms(vis=msfile,
       xaxis='channel',
       yaxis='phase',
       averagedata=True,
       avgtime='3300',
       correlation='XX,YY',
       field=f_cal,
       antenna='!m022',
       coloraxis='baseline',
       plotrange=[0,0,-180,180])<jupyter_output><empty_output><jupyter_text>Check all the scans of the primary calibratorsFlag based on the autocorrelations.<jupyter_code>plotms(vis=msfile,
       xaxis='freq',
       yaxis='phase',
       correlation='XX,YY',
       antenna='!m022',
       field=f_cal,
       scan='1',
       coloraxis='corr',
       plotrange=[0,0,-180,180],
       averagedata=True,
       avgtime='3300',
       avgbaseline=True)
plotms(vis=msfile,
       xaxis='freq',
       yaxis='amp',
       correlation='XX,YY',
       antenna='!m022',
       scan='1',
       field=f_cal,
       coloraxis='corr',
       averagedata=True,
       avgtime='3300',
       avgbaseline=True)<jupyter_output><empty_output><jupyter_text>Check all the channels and scans for the secondary calibrator<jupyter_code>plotms(vis=msfile,
       xaxis='channel',
       yaxis='phase',
       correlation='XX,YY',
       antenna='!m022',
       scan='1,3,5,7,9,11',
       field=f_cal+','+g_cal,
       coloraxis='field',
       plotrange=[0,0,-180,180],
       averagedata=True,
       avgtime='3300',
       avgbaseline=True)
plotms(vis=msfile,
       xaxis='channel',
       yaxis='amp',
       correlation='XX,YY',
       antenna='!m022',
       scan='1,3,5,7,9,11',
       field=f_cal+','+g_cal,
       coloraxis='field',
       averagedata=True,
       avgtime='3300',
       avgbaseline=True)
plotms(vis=msfile,
       xaxis='channel',
       yaxis='phase',
       correlation='XX,YY',
       antenna='!m022',
       scan='3,5,7,9,11',
       spw='*:0~780;820~900',
       field=g_cal,
       coloraxis='corr',
       plotrange=[0,0,-180,180],
       averagedata=True,
       avgtime='3300',
       avgbaseline=True)
plotms(vis=msfile,
       xaxis='channel',
       yaxis='amp',
       correlation='XX,YY',
       antenna='!m022',
       spw='*:0~780;820~900',
       scan='3,5,7,9,11',
       field=g_cal,
       coloraxis='corr',
       averagedata=True,
       avgtime='3300',
       avgbaseline=True)
plotms(vis=msfile,
       xaxis='time',
       yaxis='amp',
       correlation='XX,YY',
       antenna='!m022',
       spw='*:0~780;820~900',
       scan='1,3,5,7,9,11',
       field=f_cal+','+g_cal,
       coloraxis='corr',
       averagedata=True,
       avgtime='30',
       avgbaseline=True)
plotms(vis=msfile,
       xaxis='time',
       yaxis='phase',
       correlation='XX,YY',
       field=f_cal+','+g_cal,
       spw='*:2550',
       coloraxis='corr',
       plotrange=[0,0,-180,180])
plotms(vis=msfile,
       xaxis='time',
       yaxis='amp',
       field=f_cal+','+g_cal,
       averagedata=True,
       avgchannel='4096',
       coloraxis='field')<jupyter_output><empty_output><jupyter_text>Flagging data<jupyter_code>flagdata(vis=msfile, mode='manual', antenna='m022');
flagdata(vis=msfile, field='0408-65,1117-248', mode='manual', spw='*:30~35', flagbackup=False);
flagdata(vis=msfile, field='0408-65,1117-248', mode='manual', spw='*:420~440', flagbackup=False);
flagdata(vis=msfile, field='0408-65,1117-248', mode='manual', spw='*:450~470', flagbackup=False);
flagdata(vis=msfile, field='0408-65,1117-248', mode='manual', spw='*:790~807', flagbackup=False);
flagdata(vis=msfile, uvrange='<50lambda', flagbackup=False);<jupyter_output><empty_output><jupyter_text>Checking after flagging<jupyter_code>plotms(vis=msfile,
       xaxis='channel',
       yaxis='phase',
       averagedata=True,
       avgtime='3300',
       correlation='XX,YY',
       field=f_cal,
       coloraxis='baseline',
       plotrange=[0,0,-180,180])
plotms(vis=msfile,
       xaxis='channel',
       yaxis='amp',
       correlation='XX,YY',
       field=f_cal+','+g_cal,
       coloraxis='field',
       averagedata=True,
       avgtime='3300',
       avgbaseline=True)
plotms(vis=msfile,
       xaxis='time',
       yaxis='amp',
       field=f_cal+','+g_cal,
       averagedata=True,
       avgchannel='4096',
       coloraxis='field')
plotms(vis=msfile,
       xaxis='time',
       yaxis='phase',
       correlation='XX,YY',
       field=f_cal+','+g_cal,
       spw='*:2550',
       coloraxis='corr',
       plotrange=[0,0,-180,180])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16745124411566914, 'fraction_numerical': 0.059347679892400806, 'mean_word_length': 3.177668539325843, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '70792', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 2364, 'n_tokens_neox': 2112, 'n_words': 285, 'path': 'casa/Inspect and flagging data before calibration.ipynb', 'repo_name': 'BongaNjamela001/MeerKAT-Cookbook', 'size': '5948'}