Browse Source

Verification and many bugs solved

master
Ilse Bemmel, van 3 months ago
parent
commit
5a4d7463fc
1 changed files with 47 additions and 29 deletions
  1. +47
    -29
      EVN_continuum_pyp.ipynb

+ 47
- 29
EVN_continuum_pyp.ipynb View File

@@ -175,7 +175,7 @@
"metadata": {},
"source": [
"#### Date-time stamp\n",
"To ensure that each run of the notebook results in a new set of calibration tables, uncomment the cell below to add the date and time to the calibration tables. By default this is off, to ensure the directory doesn't overflow."
"To ensure that each run of the notebook results in a new set of calibration tables, comment the second line and uncomment the first line below to add the date and time to the calibration tables. By default this is off, to ensure the directory doesn't overflow."
]
},
{
@@ -184,7 +184,8 @@
"metadata": {},
"outputs": [],
"source": [
"#stamp = datetime.datetime.utcnow().strftime('%y%m%d_%H%M')"
"#stamp = datetime.datetime.utcnow().strftime('%y%m%d_%H%M')\n",
"stamp='debug'"
]
},
{
@@ -217,8 +218,6 @@
"antabfile = mypath+obsid+'.antab'\n",
"\n",
"#CASA calibration tables\n",
"stamp if stamp==stamp else stamp==None # this doesn't work properly if stamp does not exist at all\n",
"\n",
"gcaltab = mypath+obsid+'_'+stamp+'.gcal'\n",
"tsystab = mypath+obsid+'_'+stamp+'.tsys'\n",
"sbdtab = mypath+obsid+'_'+stamp+'.sbd'\n",
@@ -337,7 +336,7 @@
"source": [
"flagdata(vis=vis, mode='list', inpfile=flagfile,\n",
" reason='any', action='apply', flagbackup=False, savepars=False)\n",
"flagmanager(vis=vis,mode='save',versionname='precal_flags',\n",
"flagmanager(vis=vis,mode='save',versionname='archival_flags',\n",
" comment='Archival flags prior to any calibration')"
]
},
@@ -404,7 +403,8 @@
"metadata": {},
"source": [
"After these steps, it can be useful to do a first inspection of the data, and write up the most obvious bad data in a flag command file. E.g.: \n",
"`mode='manual' antenna='SH&*' spw='0,1' timerange='13:15:15.0~13:23:46.0'` \n"
"`mode='manual' antenna='SH&*' spw='0,1' timerange='13:15:15.0~13:23:46.0'` \n",
"This file can be added to the notebook in the `myflags` variable in the Flag settings at the start of the notebook. The flags in this file will be applied in the Flagging section below.\n"
]
},
{
@@ -480,7 +480,9 @@
"msmd.open(vis)\n",
"nspw=msmd.nspw()\n",
"nchan=msmd.nchan(1)\n",
"msmd.done()"
"msmd.done()\n",
"print 'Number of channels:', nchan\n",
"print 'Number of spectral windows:',nspw"
]
},
{
@@ -529,7 +531,7 @@
"outputs": [],
"source": [
"# Flag the edge channels\n",
"flagfraction = int(nchan/edgefraction) \n",
"flagfraction = int(nchan/(100*edgefraction)) \n",
"start = str(flagfraction-1)\n",
"end = str(nchan-flagfraction)\n",
"spwflag = '*:0~'+start+';'+end+'~'+str(nchan-1)\n",
@@ -609,7 +611,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Check the output on the logger to see how many solutions are found by fringefit. This is a good initial indication if this worked well or not. You should have a solution per spectral window."
"Check the output in the log to see how many solutions are found by fringefit. This is a good initial indication if this worked well or not. You should have a solution per spectral window."
]
},
{
@@ -633,12 +635,21 @@
" averagedata=True, avgtime='600')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"flagmanager(vis=vis,mode='restore', versionname='precal_flags')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Multi-band delay\n",
"The next step is the multi-band delay, which includes phases as a function of time and frequency for all the phase-reference scans (delay and rate is determined). Solutions are determined per scan by setting `solint = 'inf'`."
"The next step is the multi-band delay, which includes phases as a function of time and frequency for all the phase-reference scans (delay and rate is determined). Solutions are determined per scan by setting `solint = 'inf'`. A lower value for the SNR is set as well. "
]
},
{
@@ -658,7 +669,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Check the output on the logger to see how many solutions are found by fringefit. This is a good initial indication if this worked well or not. Note that the second fringe fit step determines a single solution for all spectral-windows."
"Check the output in the log to see how many solutions are found by fringefit. This is a good initial indication if this worked well or not. Note that the second fringe fit step determines a single solution for all spectral-windows."
]
},
{
@@ -728,14 +739,17 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"plotms(vis=vis, xaxis='frequency', yaxis='amplitude',\n",
" ydatacolumn='corrected',antenna=refant, correlation='ll,rr',\n",
" coloraxis='baseline', timerange=sbdtimer)"
"# Apply calibration and split sources"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The last step is to apply all calibration tables to the data. Note the specific settings of the swpmap parameter. This step can take a while to run. The splitting is done per pair of target - phase reference source, which is a matter of personal taste."
]
},
{
@@ -744,24 +758,29 @@
"metadata": {},
"outputs": [],
"source": [
"plotms(vis=vis, xaxis='frequency', yaxis='phase',\n",
" ydatacolumn='corrected', antenna=refant, correlation='ll',\n",
" coloraxis='baseline', field=phasecal1,\n",
" averagedata=True, avgtime='120')"
"applycal(vis,\n",
" gaintable=[gcaltab, tsystab, sbdtab, mbdtab, bpasstab],\n",
" interp=['nearest','nearest,nearest','nearest','linear','linear,linear'],\n",
" spwmap=[[], [], [], int(nspw)*[0],[]],\n",
" parang=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Apply calibration and split sources"
"As a final calibration quality check, plot the amplitudes for the timerange in which the single-band delay (instrumental delay) was fitted. Then also plot the phases for the phase calibrator, averaged over the entire scan."
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"The last step is to apply all calibration tables to the data. Note the specific settings of the swpmap parameter. This step can take a while to run. The splitting is done per pair of target - phase reference source, which is a matter of personal taste."
"plotms(vis=vis, xaxis='frequency', yaxis='amplitude',\n",
" ydatacolumn='corrected',antenna=refant, correlation='ll,rr',\n",
" coloraxis='baseline', timerange=sbdtimer)"
]
},
{
@@ -770,11 +789,10 @@
"metadata": {},
"outputs": [],
"source": [
"applycal(vis,\n",
" gaintable=[gcaltab, tsystab, sbdtab, mbdtab, bpasstab],\n",
" interp=['nearest','nearest,nearest','nearest','linear','linear,linear'],\n",
" spwmap=[[], [], [], int(nspw)*[0],[]],\n",
" parang=True)"
"plotms(vis=vis, xaxis='frequency', yaxis='phase',\n",
" ydatacolumn='corrected', antenna=refant, correlation='ll',\n",
" coloraxis='baseline', field=phasecal1,\n",
" averagedata=True, avgscan=True)"
]
},
{


Loading…
Cancel
Save