<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://ovsa.njit.edu//wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Schhabra</id>
	<title>EOVSA Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://ovsa.njit.edu//wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Schhabra"/>
	<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php/Special:Contributions/Schhabra"/>
	<updated>2026-04-17T19:29:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.1</generator>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7755</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7755"/>
		<updated>2023-10-18T10:07:12Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1 s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime;/0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1 - 18 GHz || Sample time: 20 ms:&amp;lt;br/&amp;gt; Full Sweep: 1 s || ~14 - 24 || 2017 - ongoing || Full Sun ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here] &amp;lt;br/&amp;gt; [http://ovsa.njit.edu/browser/?suntoday_date=2023-08-06 EOVSA Browser] || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Pietro Zucca (zucca@astron.nl) &amp;lt;br/&amp;gt;&lt;br /&gt;
Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1 s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2 - 15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80 - 300 MHz || 0.5 s || 01 - 08 || 2014 - ongoing || 30° || depends on configuration;&amp;lt;br/&amp;gt; ~1 - 2&amp;amp;prime;/200 MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1 s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1 s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1 ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100 ms (fast visibilities);&amp;lt;br/&amp;gt; 10 s (regular mode) || 14 - 24 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80 MHz || 24 kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz - 2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz - 19.2 MHz || 3.5–56 s &amp;lt;br/&amp;gt; (higher during &amp;lt;br/&amp;gt; [https://sppgway.jhuapl.edu/encounters encounters]) || 0 - 24 || 2018/10/02 - Present (during PSP Perihelia) || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://fields.ssl.berkeley.edu/data/ FIELDS SOC] &amp;lt;br/&amp;gt; [https://cdaweb.gsfc.nasa.gov/ CDAW for FIELDS] &amp;lt;br/&amp;gt; [https://parker.gsfc.nasa.gov/crocs.html Coordinated Radiodiagnostics]|| Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1 s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3 - 46&amp;amp;Prime; @ 1.3 GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] &amp;lt;br/&amp;gt; [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey Data Survey]|| Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  Ludwig Klein (ludwig.klein@obspm.fr)&amp;lt;br/&amp;gt; Abdallah Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Solarplus_mhz.png|thumb|center|600px|'''Figure 2:''' Radio Instruments (Solar Dedicated and Proposal based observing below 1 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Facilities.png|thumb|center|1000px|'''Figure 3:''' Radio Instruments (Solar Dedicated and Proposal based observing between 10 MHz - 10 GHz) (Image Credit: Bin Chen)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=7544</id>
		<title>Owens Valley Solar Arrays</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=7544"/>
		<updated>2023-08-14T18:40:49Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data from Around The Heliosphere */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Eovsa1.png|border|text-top|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;[http://ovsa.njit.edu/ EOVSA] (Expanded Owens Valley Solar Array) is a solar-dedicated radio interferometer operated by the New Jersey Institute of Technology and serving as a '''National Science Foundation Geospace Facility'''. [[File:NSF.jpg|70px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;Operation of EOVSA is supported by the National Science Foundation under Grant No. AGS-2130832. Any opinions, findings, and conclusions or  recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science  Foundation. &amp;lt;/pre&amp;gt;&lt;br /&gt;
This wiki serves as the site for EOVSA documentation.  &amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== EOVSA Documentation ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;General&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Downconversion and Frequency Tuning]]&lt;br /&gt;
** [[Dealing with Radio Frequency Interference]]&lt;br /&gt;
** [[Switching between 200 MHz and 300 MHz Correlator]]&lt;br /&gt;
** [[Observing in &amp;quot;Fast&amp;quot; Mode]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Computer-Network&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Computing Systems]]&lt;br /&gt;
** [[Network]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Control System&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[27-m Antenna Commands]]&lt;br /&gt;
** [[Schedule Commands]]&lt;br /&gt;
** [[Control Commands]]&lt;br /&gt;
** [[Attenuation and Level Control]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Hardware&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Hardware Overview]]&lt;br /&gt;
** [[2.1-m Antennas]]&lt;br /&gt;
** [[27-m Antennas]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;System Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Calibration Database]]&lt;br /&gt;
** [[Stateframe Database]]&lt;br /&gt;
** [[Database Maintenance]]&lt;br /&gt;
** [[Create CASA measurement sets]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Calibration&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[Calibration Overview]]&lt;br /&gt;
**[[Pointing Calibration]]&lt;br /&gt;
**[[Total Power Calibration]]&lt;br /&gt;
**[[System Gain Calibration]]&lt;br /&gt;
**[[Antenna Position]] (Baseline Calibration)&lt;br /&gt;
**[[Reference Gain Calibration]]&lt;br /&gt;
**[[Daily Gain Calibration]]&lt;br /&gt;
**[[Delay Calibration]]&lt;br /&gt;
**[[Bandpass Calibration]]&lt;br /&gt;
**[[Polarization Calibration]]&lt;br /&gt;
**[[Calibrator Survey]]&lt;br /&gt;
**[[Practical Calibration Tutorial]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Starburst]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using EOVSA Data  ==&lt;br /&gt;
* &amp;lt;big&amp;gt;[[EOVSA Data products]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;Analysis Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [https://github.com/suncasa/suncasa SunCASA] A wrapper around [https://casa.nrao.edu/ CASA (the Common Astronomy Software Applications package)] for synthesis imaging and visualizing solar spectral imaging data. CASA is one of the leading software tool for &amp;quot;supporting the data post-processing needs of the next generation of radio astronomical telescopes such as ALMA and VLA&amp;quot;, an international effort led by the [https://public.nrao.edu/ National Radio Astronomy Observatory]. The current version of CASA uses Python (2.7) interface. More information about CASA can be found on [https://casa.nrao.edu/ NRAO's CASA website ]. Note, CASA is available ONLY on UNIX-BASED PLATFORMS (and therefore, so is SunCASA). &lt;br /&gt;
** [https://github.com/Gelu-Nita/GSFIT GSFIT] A IDL-widget(GUI)-based spectral fitting package called gsfit, which provides a user-friendly display of EOVSA image cubes and an interface to fast fitting codes (via platform-dependent shared-object libraries). &lt;br /&gt;
** [[Spectrogram Software]]&lt;br /&gt;
** [[Mapping Software]]&lt;br /&gt;
* &amp;lt;big&amp;gt;Data Analysis Guides&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial 2022]]&amp;lt;/big&amp;gt; and &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/19NQb6Emb9HvKX4QHq9ZYCP3RM6nT7sDL#scrollTo=cLdDVptBGG-X EOVSA Workspace]&amp;lt;/big&amp;gt; at [https://sphere.boulder.swri.edu/ SPHERE 2022 Workshop]&lt;br /&gt;
** &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL EOVSA Data Analysis Tutorial at RHESSI 19 Workshop]&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial]]&amp;lt;/big&amp;gt; at [http://rhessi18.umn.edu/ RHESSI XVIII Workshop]&lt;br /&gt;
** [[Self-Calibrating Flare Data]] Example script and guides for self-calibrating EOVSA flare data (to be completed)&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
**[[IDB flare pipeline]] Tutorial to run the flare pipeline for quicklook images&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;EOVSA Modeling Guide&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[GX Simulator]]&lt;br /&gt;
&lt;br /&gt;
* Other helpful links&lt;br /&gt;
** [https://casaguides.nrao.edu CASA Guides]&lt;br /&gt;
** [http://www.lmsal.com/solarsoft/ SolarSoft IDL]&lt;br /&gt;
** [http://www.atnf.csiro.au/computing/software/miriad/userguide/userhtml.html Miriad Guides]&lt;br /&gt;
** [https://sites.google.com/site/fgscodes/ Fast Gyrosynchrotron Codes (Alexey Kuznetsov's website)]&lt;br /&gt;
** [[Basic GitHub Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--* &amp;lt;big&amp;gt;[[EOVSA Imaging Workshop]]&amp;lt;/big&amp;gt;--&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Full Disk Simulations]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[All-Day Synthesis Issues]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Analyzing Pre-2017 Data]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Fixing Pipeline Problems pre-2021-Feb-07]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System Software ==&lt;br /&gt;
&lt;br /&gt;
* LabVIEW software&lt;br /&gt;
* Python code [https://github.com/dgary50/eovsa Github repository]&lt;br /&gt;
* [[Python3 Code Installation]]&lt;br /&gt;
&lt;br /&gt;
== Observing Log ==&lt;br /&gt;
[[2016 November]]; [[2016 December| December]]&lt;br /&gt;
&lt;br /&gt;
[[2017 January]]; [[2017 February | February]]; [[2017 March | March]]; [[2017 April | April]]; [[2017 May | May]]; [[2017 June | June]];&lt;br /&gt;
[[2017 July | July]]; [[2017 August | August]]; [[2017 September | September]]; [[2017 October | October]]; [[2017 November | November]]; [[2017 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2018 January]]; [[2018 February | February]]; [[2018 March | March]]; [[2018 April | April]]; [[2018 May | May]]; [[2018 June | June]];&lt;br /&gt;
[[2018 July | July]]; [[2018 August | August]]; [[2018 September | September]]; [[2018 October | October]]; [[2018 November | November]]; [[2018 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2019 January]]; [[2019 February | February]]; [[2019 March | March]]; [[2019 April | April]]; [[2019 May | May]]; [[2019 June | June]];&lt;br /&gt;
[[2019 July | July]]; [[2019 August | August]]; [[2019 September | September]]; [[2019 October | October]]; [[2019 November | November]]; [[2019 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2020 January]]; [[2020 February | February]]; [[2020 March | March]]; [[2020 April | April]]; [[2020 May | May]]; [[2020 June | June]];&lt;br /&gt;
[[2020 July | July]]; [[2020 August | August]]; [[2020 September | September]]; [[2020 October | October]]; [[2020 November | November]]; [[2020 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2021 January]]; [[2021 February | February]]; [[2021 March | March]]; [[2021 April | April]]; [[2021 May | May]]; [[2021 June | June]];&lt;br /&gt;
[[2021 July | July]]; [[2021 August | August]]; [[2021 September | September]]; [[2021 October | October]]; [[2021 November | November]]; [[2021 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2022 SQL Outage]]&lt;br /&gt;
&lt;br /&gt;
[[2023 January]]; [[2023 February | February]]; [[2023 March | March]]; [[2023 April | April]]; [[2023 May | May]]; [[2023 June | June]];&lt;br /&gt;
[[2023 July | July]]; [[2023 August | August]]; [[2023 September | September]]; [[2023 October | October]]; [[2023 November | November]]; [[2023 December | December]]&lt;br /&gt;
&lt;br /&gt;
== Tohbans ==&lt;br /&gt;
&lt;br /&gt;
[[Trouble Shooting Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Records]]&lt;br /&gt;
&lt;br /&gt;
[[Owen's Notes]]&lt;br /&gt;
&lt;br /&gt;
[[Caius' Notes]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban EOVSA Imaging Tutorial A-Z]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Guide to Self Calibration and Imaging for EOVSA]]&lt;br /&gt;
&lt;br /&gt;
[[Guide to Upgrade SolarSoft(SSW)]]&lt;br /&gt;
&lt;br /&gt;
== EOVSA Flare List ==&lt;br /&gt;
&lt;br /&gt;
See [https://docs.google.com/spreadsheets/d/1P8jHuDRF93dMflU6RMQcsJqVepD9vFkPkofV8Imj4xA/edit?usp=sharing this link] for a list of EOVSA flares as a Google Spreadsheet. &lt;br /&gt;
&lt;br /&gt;
[[Recent Flare List (2021-)]]&lt;br /&gt;
&lt;br /&gt;
[http://ovsa.njit.edu/jay/rd_db.php An older link] is available at the EOVSA website.&lt;br /&gt;
&lt;br /&gt;
== EOVSA Publications ==&lt;br /&gt;
Here is a (partial) list of publications that utilize EOVSA data. See also the collection of EOVSA publications at [https://ui.adsabs.harvard.edu/public-libraries/eQ7HfPkySqydu-B8BCt6QQ this NASA/ADS Library].&lt;br /&gt;
; 2023 &lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2023arXiv230107840M/abstract Mondal, S., Chen, B. &amp;amp; Yu, S. (2023) ApJ, submitted] ''Multifrequency microwave imaging of weak transients from the quiet solar corona''&lt;br /&gt;
; 2022&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022FrASS...940945L/abstract Lörinčík et al (2022) Frontiers, 9, 1] ''Rapid variations of Si IV spectra in a flare observed by interface region imaging spectrograph at a sub-second cadence''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022NatCo..13.7680K/abstract Kou et al. (2022) Nature Communications 13, 7680] ''Microwave imaging of quasi-periodic pulsations at flare current sheet''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022Natur.606..674F/abstract Fleishman et al. (2022) Nature 606, 674] ''Solar flare accelerates nearly all electrons in a large coronal volume''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022ApJ...932...92L/abstract Li, X., et al., (2022) ApJ, 932, 92] ''Modeling Electron Acceleration and Transport in the Early Impulsive Phase of the 2017 September 10th Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022ApJ...930..154L/abstract Liu, N., et al., (2022), ApJ, 930, 154] ''Multi-instrument Comparative Study of Temperature, Number Density, and Emission Measure during the Precursor Phase of a Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022arXiv220503518Z/abstract Zhang et al. (2022), ApJ, 932, 53] ''Implications for additional plasma heating driving the extreme-ultraviolet late phase of a solar flare with microwave imaging spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022A%26A...657A..51L/abstract Lopez et al. (2021), A&amp;amp;A, 657, A51] ''A solar flare driven by thermal conduction observed in mid-infrared''&lt;br /&gt;
; 2021&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...923..213W/abstract Wei et al. (2021), ApJ, 923, 213] ''Coronal Magnetic Field Measurements along a Partially Erupting Filament in a Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...919...44S/abstract Shaik &amp;amp; Gary (2021), ApJ, 919, 44] ''Implications of Flat Optically Thick Microwave Spectra in Solar Flares for Source Size and Morphology''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...915...12K/abstract Kocharov et al. (2021), ApJ, 915, 12] ''Multiple Sources of Solar High-energy Protons''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...908L..55C/abstract Chen et al. (2021), ApJL, 908, L55] ''Energetic Electron Distribution of the Coronal Acceleration Region: First results from Joint Microwave and Hard X-ray Imaging Spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...906..132C/abstract Chhabra et al. (2021), ApJ, 906, 132] ''Imaging Spectroscopy of CME-Associated Solar Radio Bursts''&lt;br /&gt;
; 2020&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...905..165R/abstract Reeves et al. (2020), ApJ, 905, 165] ''Hot Plasma Flows and Oscillations in the Loop-top Region During the September 10 2017 X8.2 Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...900...17Y/abstract Yu et al. (2020), ApJ, 900, 17] ''Magnetic Reconnection During the Post Impulsive Phase of the X8.2 Solar Flare: Bi-Directional Outflows as a Cause of Microwave and X-ray Bursts''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020NatAs...4.1140C/abstract Chen et al. (2020b), Nature Astronomy, 4, 1140] ''Measurement of magnetic field and relativistic electrons along a solar flare current sheet''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...895L..50C/abstract Chen et al. (2020a), ApJL, 895, 50] ''Microwave Spectral Imaging of an Erupting Magnetic Flux Rope: Implications for the Standard Solar Flare Model in Three Dimensions''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020FrASS...7...22K/abstract Kuroda et al. (2020), Frontiers, 7, 22] ''Evolution of Flare-accelerated Electrons Quantified by Spatially Resolved Analysis''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...891L..34G/abstract Glesener et al. (2020), ApJL, 891, 34] ''Accelerated Electrons Observed Down to &amp;lt;7 keV in a NuSTAR Solar Microflare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...889...72K/abstract Karlicky at al. (2020), ApJ, 889, 72] ''Drifting Pulsation Structure at the Very Beginning of the 2017 September 10 Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020Sci...367..278F/abstract Fleishman et al. (2020), Science, 367, 278] ''Decay of the coronal magnetic field can release sufficient energy to power a solar flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020AAS...23538501G/abstract Gary et al. (2020), BAAS 52, 385.01] [https://aas235-aas.ipostersessions.com/default.aspx?s=97-69-9E-4B-34-19-68-53-1B-C6-21-0C-16-1C-5C-82&amp;amp;guestview=true Direct link to AAS iPoster] ''A new view of the solar atmosphere: daily full-disk multifrequency radio images from EOVSA''&lt;br /&gt;
; 2018&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...864...63P/abstract Polito et al. (2018), ApJ, 864, 63] ''Broad Non-Gaussian Fe XXIV Line Profiles in the Impulsive Phase of the 2017 September 10 X8.3-class Flare Observed by Hinode/EIS''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...863...83G/abstract Gary et al. (2018), ApJ, 863, 83] ''Microwave and Hard X-Ray Observations of the 2017 September 10 Solar Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...852...32K/abstract Kuroda et al. (2018), ApJ, 852, 32] ''Three-dimensional Forward-fit Modeling of the Hard X-ray and the Microwave Emissions of the 2015 June 22 M6.5 flare''&lt;br /&gt;
; 2017&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2017NatAs...1E..85W/abstract Wang et al. (2017), Nature Astronomy, 1, 85] ''High-resolution observations of flare precursors in the low solar atmosphere''&lt;br /&gt;
; 2016&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2016JAI.....541009N/abstract Nita et al. (2016), J. Astron. Instr., 5, 1641009-7366] ''EOVSA Implementation of a Spectral Kurtosis Correlator for Transient Detection and Classification''&lt;br /&gt;
&lt;br /&gt;
== VLA Flare List and Publications ==&lt;br /&gt;
See [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey#List_of_Jansky_VLA_Solar_Observations this link] for a list of flare observations made by the [https://science.nrao.edu/facilities/vla/ Karl G. Jansky Very Large Array] (VLA). Below is a partial list of publications that utilize VLA solar data (see also [https://ui.adsabs.harvard.edu/public-libraries/ZwbjpLo9RS-viufWEoQ95Q this NASA/ADS Library]).&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2022ApJ...940..137L/abstract Luo et al. (2022), ApJ, 940, 137] ''Multiple Regions of Nonthermal Quasiperiodic Pulsations during the Impulsive Phase of a Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...922..134B/abstract Battaglia et al. (2021), ApJ, 922, 134] ''Multiple Electron Acceleration Instances during a Series of Solar Microflares Observed Simultaneously at X-Rays and Microwaves''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...911....4L/abstract Luo et al. (2021), ApJ, 911, 4] ''Radio Spectral Imaging of an M8.4 Eruptive Solar Flare: Possible Evidence of a Termination Shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...910...40Z/abstract Zhang et al. (2021), ApJ, 910, 40] ''Multiwavelength Observations of the Formation and Eruption of a Complex Filament''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2020ApJ...904...94S/abstract Sharma et al. (2020), ApJ, 904, 94] ''Radio and X-Ray Observations of Short-lived Episodes of Electron Acceleration in a Solar Microflare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...884...63C/abstract Chen et al. (2019), ApJ, 884, 63] ''Radio Spectroscopic Imaging of a Solar Flare Termination Shock: Split-band Feature as Evidence for Shock Compression''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...872...71Y/abstract Yu &amp;amp; Chen (2019), ApJ, 872, 71] ''Possible Detection of Subsecond-period Propagating Magnetohydrodynamics Waves in Post-reconnection Magnetic Loops during a Two-ribbon Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2018ApJ...866...62C/abstract Chen et al. (2018), ApJ, 866, 62] ''Magnetic Reconnection Null Points as the Origin of Semirelativistic Electron Beams in a Solar Jet&lt;br /&gt;
''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2017ApJ...848...77W/abstract Wang et al. (2016), ApJ, 848, 77] ''Dynamic Spectral Imaging of Decimetric Fiber Bursts in an Eruptive Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2015Sci...350.1238C/abstract Chen et al. (2015), Science, 350, 1238] ''Particle acceleration by a solar flare termination shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2014ApJ...794..149C/abstract Chen et al. (2014), ApJ, 794, 149] ''Direct Evidence of an Eruptive, Filament-hosting Magnetic Flux Rope Leading to a Fast Solar Coronal Mass Ejection''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2013ApJ...763L..21C/abstract Chen et al. (2013), ApJL, 763, 21] ''Tracing Electron Beams in the Sun's Corona with Radio Dynamic Imaging Spectroscopy''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radio Data from Around The Heliosphere==&lt;br /&gt;
* [http://ovsa.njit.edu//wiki/index.php/Radio_Data_from_Around_the_World#Radio_Data_Access '' Radio Data '']&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=7543</id>
		<title>Owens Valley Solar Arrays</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=7543"/>
		<updated>2023-08-14T18:40:17Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data from Around The Heliosphere */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Eovsa1.png|border|text-top|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;[http://ovsa.njit.edu/ EOVSA] (Expanded Owens Valley Solar Array) is a solar-dedicated radio interferometer operated by the New Jersey Institute of Technology and serving as a '''National Science Foundation Geospace Facility'''. [[File:NSF.jpg|70px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;Operation of EOVSA is supported by the National Science Foundation under Grant No. AGS-2130832. Any opinions, findings, and conclusions or  recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science  Foundation. &amp;lt;/pre&amp;gt;&lt;br /&gt;
This wiki serves as the site for EOVSA documentation.  &amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== EOVSA Documentation ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;General&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Downconversion and Frequency Tuning]]&lt;br /&gt;
** [[Dealing with Radio Frequency Interference]]&lt;br /&gt;
** [[Switching between 200 MHz and 300 MHz Correlator]]&lt;br /&gt;
** [[Observing in &amp;quot;Fast&amp;quot; Mode]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Computer-Network&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Computing Systems]]&lt;br /&gt;
** [[Network]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Control System&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[27-m Antenna Commands]]&lt;br /&gt;
** [[Schedule Commands]]&lt;br /&gt;
** [[Control Commands]]&lt;br /&gt;
** [[Attenuation and Level Control]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Hardware&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Hardware Overview]]&lt;br /&gt;
** [[2.1-m Antennas]]&lt;br /&gt;
** [[27-m Antennas]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;System Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Calibration Database]]&lt;br /&gt;
** [[Stateframe Database]]&lt;br /&gt;
** [[Database Maintenance]]&lt;br /&gt;
** [[Create CASA measurement sets]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Calibration&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[Calibration Overview]]&lt;br /&gt;
**[[Pointing Calibration]]&lt;br /&gt;
**[[Total Power Calibration]]&lt;br /&gt;
**[[System Gain Calibration]]&lt;br /&gt;
**[[Antenna Position]] (Baseline Calibration)&lt;br /&gt;
**[[Reference Gain Calibration]]&lt;br /&gt;
**[[Daily Gain Calibration]]&lt;br /&gt;
**[[Delay Calibration]]&lt;br /&gt;
**[[Bandpass Calibration]]&lt;br /&gt;
**[[Polarization Calibration]]&lt;br /&gt;
**[[Calibrator Survey]]&lt;br /&gt;
**[[Practical Calibration Tutorial]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Starburst]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using EOVSA Data  ==&lt;br /&gt;
* &amp;lt;big&amp;gt;[[EOVSA Data products]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;Analysis Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [https://github.com/suncasa/suncasa SunCASA] A wrapper around [https://casa.nrao.edu/ CASA (the Common Astronomy Software Applications package)] for synthesis imaging and visualizing solar spectral imaging data. CASA is one of the leading software tool for &amp;quot;supporting the data post-processing needs of the next generation of radio astronomical telescopes such as ALMA and VLA&amp;quot;, an international effort led by the [https://public.nrao.edu/ National Radio Astronomy Observatory]. The current version of CASA uses Python (2.7) interface. More information about CASA can be found on [https://casa.nrao.edu/ NRAO's CASA website ]. Note, CASA is available ONLY on UNIX-BASED PLATFORMS (and therefore, so is SunCASA). &lt;br /&gt;
** [https://github.com/Gelu-Nita/GSFIT GSFIT] A IDL-widget(GUI)-based spectral fitting package called gsfit, which provides a user-friendly display of EOVSA image cubes and an interface to fast fitting codes (via platform-dependent shared-object libraries). &lt;br /&gt;
** [[Spectrogram Software]]&lt;br /&gt;
** [[Mapping Software]]&lt;br /&gt;
* &amp;lt;big&amp;gt;Data Analysis Guides&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial 2022]]&amp;lt;/big&amp;gt; and &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/19NQb6Emb9HvKX4QHq9ZYCP3RM6nT7sDL#scrollTo=cLdDVptBGG-X EOVSA Workspace]&amp;lt;/big&amp;gt; at [https://sphere.boulder.swri.edu/ SPHERE 2022 Workshop]&lt;br /&gt;
** &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL EOVSA Data Analysis Tutorial at RHESSI 19 Workshop]&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial]]&amp;lt;/big&amp;gt; at [http://rhessi18.umn.edu/ RHESSI XVIII Workshop]&lt;br /&gt;
** [[Self-Calibrating Flare Data]] Example script and guides for self-calibrating EOVSA flare data (to be completed)&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
**[[IDB flare pipeline]] Tutorial to run the flare pipeline for quicklook images&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;EOVSA Modeling Guide&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[GX Simulator]]&lt;br /&gt;
&lt;br /&gt;
* Other helpful links&lt;br /&gt;
** [https://casaguides.nrao.edu CASA Guides]&lt;br /&gt;
** [http://www.lmsal.com/solarsoft/ SolarSoft IDL]&lt;br /&gt;
** [http://www.atnf.csiro.au/computing/software/miriad/userguide/userhtml.html Miriad Guides]&lt;br /&gt;
** [https://sites.google.com/site/fgscodes/ Fast Gyrosynchrotron Codes (Alexey Kuznetsov's website)]&lt;br /&gt;
** [[Basic GitHub Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--* &amp;lt;big&amp;gt;[[EOVSA Imaging Workshop]]&amp;lt;/big&amp;gt;--&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Full Disk Simulations]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[All-Day Synthesis Issues]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Analyzing Pre-2017 Data]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Fixing Pipeline Problems pre-2021-Feb-07]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System Software ==&lt;br /&gt;
&lt;br /&gt;
* LabVIEW software&lt;br /&gt;
* Python code [https://github.com/dgary50/eovsa Github repository]&lt;br /&gt;
* [[Python3 Code Installation]]&lt;br /&gt;
&lt;br /&gt;
== Observing Log ==&lt;br /&gt;
[[2016 November]]; [[2016 December| December]]&lt;br /&gt;
&lt;br /&gt;
[[2017 January]]; [[2017 February | February]]; [[2017 March | March]]; [[2017 April | April]]; [[2017 May | May]]; [[2017 June | June]];&lt;br /&gt;
[[2017 July | July]]; [[2017 August | August]]; [[2017 September | September]]; [[2017 October | October]]; [[2017 November | November]]; [[2017 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2018 January]]; [[2018 February | February]]; [[2018 March | March]]; [[2018 April | April]]; [[2018 May | May]]; [[2018 June | June]];&lt;br /&gt;
[[2018 July | July]]; [[2018 August | August]]; [[2018 September | September]]; [[2018 October | October]]; [[2018 November | November]]; [[2018 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2019 January]]; [[2019 February | February]]; [[2019 March | March]]; [[2019 April | April]]; [[2019 May | May]]; [[2019 June | June]];&lt;br /&gt;
[[2019 July | July]]; [[2019 August | August]]; [[2019 September | September]]; [[2019 October | October]]; [[2019 November | November]]; [[2019 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2020 January]]; [[2020 February | February]]; [[2020 March | March]]; [[2020 April | April]]; [[2020 May | May]]; [[2020 June | June]];&lt;br /&gt;
[[2020 July | July]]; [[2020 August | August]]; [[2020 September | September]]; [[2020 October | October]]; [[2020 November | November]]; [[2020 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2021 January]]; [[2021 February | February]]; [[2021 March | March]]; [[2021 April | April]]; [[2021 May | May]]; [[2021 June | June]];&lt;br /&gt;
[[2021 July | July]]; [[2021 August | August]]; [[2021 September | September]]; [[2021 October | October]]; [[2021 November | November]]; [[2021 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2022 SQL Outage]]&lt;br /&gt;
&lt;br /&gt;
[[2023 January]]; [[2023 February | February]]; [[2023 March | March]]; [[2023 April | April]]; [[2023 May | May]]; [[2023 June | June]];&lt;br /&gt;
[[2023 July | July]]; [[2023 August | August]]; [[2023 September | September]]; [[2023 October | October]]; [[2023 November | November]]; [[2023 December | December]]&lt;br /&gt;
&lt;br /&gt;
== Tohbans ==&lt;br /&gt;
&lt;br /&gt;
[[Trouble Shooting Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Records]]&lt;br /&gt;
&lt;br /&gt;
[[Owen's Notes]]&lt;br /&gt;
&lt;br /&gt;
[[Caius' Notes]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban EOVSA Imaging Tutorial A-Z]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Guide to Self Calibration and Imaging for EOVSA]]&lt;br /&gt;
&lt;br /&gt;
[[Guide to Upgrade SolarSoft(SSW)]]&lt;br /&gt;
&lt;br /&gt;
== EOVSA Flare List ==&lt;br /&gt;
&lt;br /&gt;
See [https://docs.google.com/spreadsheets/d/1P8jHuDRF93dMflU6RMQcsJqVepD9vFkPkofV8Imj4xA/edit?usp=sharing this link] for a list of EOVSA flares as a Google Spreadsheet. &lt;br /&gt;
&lt;br /&gt;
[[Recent Flare List (2021-)]]&lt;br /&gt;
&lt;br /&gt;
[http://ovsa.njit.edu/jay/rd_db.php An older link] is available at the EOVSA website.&lt;br /&gt;
&lt;br /&gt;
== EOVSA Publications ==&lt;br /&gt;
Here is a (partial) list of publications that utilize EOVSA data. See also the collection of EOVSA publications at [https://ui.adsabs.harvard.edu/public-libraries/eQ7HfPkySqydu-B8BCt6QQ this NASA/ADS Library].&lt;br /&gt;
; 2023 &lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2023arXiv230107840M/abstract Mondal, S., Chen, B. &amp;amp; Yu, S. (2023) ApJ, submitted] ''Multifrequency microwave imaging of weak transients from the quiet solar corona''&lt;br /&gt;
; 2022&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022FrASS...940945L/abstract Lörinčík et al (2022) Frontiers, 9, 1] ''Rapid variations of Si IV spectra in a flare observed by interface region imaging spectrograph at a sub-second cadence''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022NatCo..13.7680K/abstract Kou et al. (2022) Nature Communications 13, 7680] ''Microwave imaging of quasi-periodic pulsations at flare current sheet''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022Natur.606..674F/abstract Fleishman et al. (2022) Nature 606, 674] ''Solar flare accelerates nearly all electrons in a large coronal volume''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022ApJ...932...92L/abstract Li, X., et al., (2022) ApJ, 932, 92] ''Modeling Electron Acceleration and Transport in the Early Impulsive Phase of the 2017 September 10th Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022ApJ...930..154L/abstract Liu, N., et al., (2022), ApJ, 930, 154] ''Multi-instrument Comparative Study of Temperature, Number Density, and Emission Measure during the Precursor Phase of a Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022arXiv220503518Z/abstract Zhang et al. (2022), ApJ, 932, 53] ''Implications for additional plasma heating driving the extreme-ultraviolet late phase of a solar flare with microwave imaging spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022A%26A...657A..51L/abstract Lopez et al. (2021), A&amp;amp;A, 657, A51] ''A solar flare driven by thermal conduction observed in mid-infrared''&lt;br /&gt;
; 2021&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...923..213W/abstract Wei et al. (2021), ApJ, 923, 213] ''Coronal Magnetic Field Measurements along a Partially Erupting Filament in a Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...919...44S/abstract Shaik &amp;amp; Gary (2021), ApJ, 919, 44] ''Implications of Flat Optically Thick Microwave Spectra in Solar Flares for Source Size and Morphology''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...915...12K/abstract Kocharov et al. (2021), ApJ, 915, 12] ''Multiple Sources of Solar High-energy Protons''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...908L..55C/abstract Chen et al. (2021), ApJL, 908, L55] ''Energetic Electron Distribution of the Coronal Acceleration Region: First results from Joint Microwave and Hard X-ray Imaging Spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...906..132C/abstract Chhabra et al. (2021), ApJ, 906, 132] ''Imaging Spectroscopy of CME-Associated Solar Radio Bursts''&lt;br /&gt;
; 2020&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...905..165R/abstract Reeves et al. (2020), ApJ, 905, 165] ''Hot Plasma Flows and Oscillations in the Loop-top Region During the September 10 2017 X8.2 Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...900...17Y/abstract Yu et al. (2020), ApJ, 900, 17] ''Magnetic Reconnection During the Post Impulsive Phase of the X8.2 Solar Flare: Bi-Directional Outflows as a Cause of Microwave and X-ray Bursts''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020NatAs...4.1140C/abstract Chen et al. (2020b), Nature Astronomy, 4, 1140] ''Measurement of magnetic field and relativistic electrons along a solar flare current sheet''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...895L..50C/abstract Chen et al. (2020a), ApJL, 895, 50] ''Microwave Spectral Imaging of an Erupting Magnetic Flux Rope: Implications for the Standard Solar Flare Model in Three Dimensions''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020FrASS...7...22K/abstract Kuroda et al. (2020), Frontiers, 7, 22] ''Evolution of Flare-accelerated Electrons Quantified by Spatially Resolved Analysis''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...891L..34G/abstract Glesener et al. (2020), ApJL, 891, 34] ''Accelerated Electrons Observed Down to &amp;lt;7 keV in a NuSTAR Solar Microflare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...889...72K/abstract Karlicky at al. (2020), ApJ, 889, 72] ''Drifting Pulsation Structure at the Very Beginning of the 2017 September 10 Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020Sci...367..278F/abstract Fleishman et al. (2020), Science, 367, 278] ''Decay of the coronal magnetic field can release sufficient energy to power a solar flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020AAS...23538501G/abstract Gary et al. (2020), BAAS 52, 385.01] [https://aas235-aas.ipostersessions.com/default.aspx?s=97-69-9E-4B-34-19-68-53-1B-C6-21-0C-16-1C-5C-82&amp;amp;guestview=true Direct link to AAS iPoster] ''A new view of the solar atmosphere: daily full-disk multifrequency radio images from EOVSA''&lt;br /&gt;
; 2018&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...864...63P/abstract Polito et al. (2018), ApJ, 864, 63] ''Broad Non-Gaussian Fe XXIV Line Profiles in the Impulsive Phase of the 2017 September 10 X8.3-class Flare Observed by Hinode/EIS''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...863...83G/abstract Gary et al. (2018), ApJ, 863, 83] ''Microwave and Hard X-Ray Observations of the 2017 September 10 Solar Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...852...32K/abstract Kuroda et al. (2018), ApJ, 852, 32] ''Three-dimensional Forward-fit Modeling of the Hard X-ray and the Microwave Emissions of the 2015 June 22 M6.5 flare''&lt;br /&gt;
; 2017&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2017NatAs...1E..85W/abstract Wang et al. (2017), Nature Astronomy, 1, 85] ''High-resolution observations of flare precursors in the low solar atmosphere''&lt;br /&gt;
; 2016&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2016JAI.....541009N/abstract Nita et al. (2016), J. Astron. Instr., 5, 1641009-7366] ''EOVSA Implementation of a Spectral Kurtosis Correlator for Transient Detection and Classification''&lt;br /&gt;
&lt;br /&gt;
== VLA Flare List and Publications ==&lt;br /&gt;
See [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey#List_of_Jansky_VLA_Solar_Observations this link] for a list of flare observations made by the [https://science.nrao.edu/facilities/vla/ Karl G. Jansky Very Large Array] (VLA). Below is a partial list of publications that utilize VLA solar data (see also [https://ui.adsabs.harvard.edu/public-libraries/ZwbjpLo9RS-viufWEoQ95Q this NASA/ADS Library]).&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2022ApJ...940..137L/abstract Luo et al. (2022), ApJ, 940, 137] ''Multiple Regions of Nonthermal Quasiperiodic Pulsations during the Impulsive Phase of a Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...922..134B/abstract Battaglia et al. (2021), ApJ, 922, 134] ''Multiple Electron Acceleration Instances during a Series of Solar Microflares Observed Simultaneously at X-Rays and Microwaves''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...911....4L/abstract Luo et al. (2021), ApJ, 911, 4] ''Radio Spectral Imaging of an M8.4 Eruptive Solar Flare: Possible Evidence of a Termination Shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...910...40Z/abstract Zhang et al. (2021), ApJ, 910, 40] ''Multiwavelength Observations of the Formation and Eruption of a Complex Filament''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2020ApJ...904...94S/abstract Sharma et al. (2020), ApJ, 904, 94] ''Radio and X-Ray Observations of Short-lived Episodes of Electron Acceleration in a Solar Microflare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...884...63C/abstract Chen et al. (2019), ApJ, 884, 63] ''Radio Spectroscopic Imaging of a Solar Flare Termination Shock: Split-band Feature as Evidence for Shock Compression''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...872...71Y/abstract Yu &amp;amp; Chen (2019), ApJ, 872, 71] ''Possible Detection of Subsecond-period Propagating Magnetohydrodynamics Waves in Post-reconnection Magnetic Loops during a Two-ribbon Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2018ApJ...866...62C/abstract Chen et al. (2018), ApJ, 866, 62] ''Magnetic Reconnection Null Points as the Origin of Semirelativistic Electron Beams in a Solar Jet&lt;br /&gt;
''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2017ApJ...848...77W/abstract Wang et al. (2016), ApJ, 848, 77] ''Dynamic Spectral Imaging of Decimetric Fiber Bursts in an Eruptive Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2015Sci...350.1238C/abstract Chen et al. (2015), Science, 350, 1238] ''Particle acceleration by a solar flare termination shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2014ApJ...794..149C/abstract Chen et al. (2014), ApJ, 794, 149] ''Direct Evidence of an Eruptive, Filament-hosting Magnetic Flux Rope Leading to a Fast Solar Coronal Mass Ejection''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2013ApJ...763L..21C/abstract Chen et al. (2013), ApJL, 763, 21] ''Tracing Electron Beams in the Sun's Corona with Radio Dynamic Imaging Spectroscopy''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radio Data from Around The Heliosphere==&lt;br /&gt;
* [http://ovsa.njit.edu//wiki/index.php/Radio_Data_from_Around_the_Heliosphere#Radio_Data_Access '' Radio Data '']&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=7542</id>
		<title>Owens Valley Solar Arrays</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=7542"/>
		<updated>2023-08-14T18:39:10Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Eovsa1.png|border|text-top|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;[http://ovsa.njit.edu/ EOVSA] (Expanded Owens Valley Solar Array) is a solar-dedicated radio interferometer operated by the New Jersey Institute of Technology and serving as a '''National Science Foundation Geospace Facility'''. [[File:NSF.jpg|70px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;Operation of EOVSA is supported by the National Science Foundation under Grant No. AGS-2130832. Any opinions, findings, and conclusions or  recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science  Foundation. &amp;lt;/pre&amp;gt;&lt;br /&gt;
This wiki serves as the site for EOVSA documentation.  &amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== EOVSA Documentation ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;General&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Downconversion and Frequency Tuning]]&lt;br /&gt;
** [[Dealing with Radio Frequency Interference]]&lt;br /&gt;
** [[Switching between 200 MHz and 300 MHz Correlator]]&lt;br /&gt;
** [[Observing in &amp;quot;Fast&amp;quot; Mode]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Computer-Network&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Computing Systems]]&lt;br /&gt;
** [[Network]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Control System&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[27-m Antenna Commands]]&lt;br /&gt;
** [[Schedule Commands]]&lt;br /&gt;
** [[Control Commands]]&lt;br /&gt;
** [[Attenuation and Level Control]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Hardware&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Hardware Overview]]&lt;br /&gt;
** [[2.1-m Antennas]]&lt;br /&gt;
** [[27-m Antennas]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;System Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Calibration Database]]&lt;br /&gt;
** [[Stateframe Database]]&lt;br /&gt;
** [[Database Maintenance]]&lt;br /&gt;
** [[Create CASA measurement sets]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Calibration&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[Calibration Overview]]&lt;br /&gt;
**[[Pointing Calibration]]&lt;br /&gt;
**[[Total Power Calibration]]&lt;br /&gt;
**[[System Gain Calibration]]&lt;br /&gt;
**[[Antenna Position]] (Baseline Calibration)&lt;br /&gt;
**[[Reference Gain Calibration]]&lt;br /&gt;
**[[Daily Gain Calibration]]&lt;br /&gt;
**[[Delay Calibration]]&lt;br /&gt;
**[[Bandpass Calibration]]&lt;br /&gt;
**[[Polarization Calibration]]&lt;br /&gt;
**[[Calibrator Survey]]&lt;br /&gt;
**[[Practical Calibration Tutorial]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Starburst]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using EOVSA Data  ==&lt;br /&gt;
* &amp;lt;big&amp;gt;[[EOVSA Data products]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;Analysis Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [https://github.com/suncasa/suncasa SunCASA] A wrapper around [https://casa.nrao.edu/ CASA (the Common Astronomy Software Applications package)] for synthesis imaging and visualizing solar spectral imaging data. CASA is one of the leading software tool for &amp;quot;supporting the data post-processing needs of the next generation of radio astronomical telescopes such as ALMA and VLA&amp;quot;, an international effort led by the [https://public.nrao.edu/ National Radio Astronomy Observatory]. The current version of CASA uses Python (2.7) interface. More information about CASA can be found on [https://casa.nrao.edu/ NRAO's CASA website ]. Note, CASA is available ONLY on UNIX-BASED PLATFORMS (and therefore, so is SunCASA). &lt;br /&gt;
** [https://github.com/Gelu-Nita/GSFIT GSFIT] A IDL-widget(GUI)-based spectral fitting package called gsfit, which provides a user-friendly display of EOVSA image cubes and an interface to fast fitting codes (via platform-dependent shared-object libraries). &lt;br /&gt;
** [[Spectrogram Software]]&lt;br /&gt;
** [[Mapping Software]]&lt;br /&gt;
* &amp;lt;big&amp;gt;Data Analysis Guides&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial 2022]]&amp;lt;/big&amp;gt; and &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/19NQb6Emb9HvKX4QHq9ZYCP3RM6nT7sDL#scrollTo=cLdDVptBGG-X EOVSA Workspace]&amp;lt;/big&amp;gt; at [https://sphere.boulder.swri.edu/ SPHERE 2022 Workshop]&lt;br /&gt;
** &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL EOVSA Data Analysis Tutorial at RHESSI 19 Workshop]&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial]]&amp;lt;/big&amp;gt; at [http://rhessi18.umn.edu/ RHESSI XVIII Workshop]&lt;br /&gt;
** [[Self-Calibrating Flare Data]] Example script and guides for self-calibrating EOVSA flare data (to be completed)&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
**[[IDB flare pipeline]] Tutorial to run the flare pipeline for quicklook images&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;EOVSA Modeling Guide&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[GX Simulator]]&lt;br /&gt;
&lt;br /&gt;
* Other helpful links&lt;br /&gt;
** [https://casaguides.nrao.edu CASA Guides]&lt;br /&gt;
** [http://www.lmsal.com/solarsoft/ SolarSoft IDL]&lt;br /&gt;
** [http://www.atnf.csiro.au/computing/software/miriad/userguide/userhtml.html Miriad Guides]&lt;br /&gt;
** [https://sites.google.com/site/fgscodes/ Fast Gyrosynchrotron Codes (Alexey Kuznetsov's website)]&lt;br /&gt;
** [[Basic GitHub Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--* &amp;lt;big&amp;gt;[[EOVSA Imaging Workshop]]&amp;lt;/big&amp;gt;--&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Full Disk Simulations]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[All-Day Synthesis Issues]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Analyzing Pre-2017 Data]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Fixing Pipeline Problems pre-2021-Feb-07]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System Software ==&lt;br /&gt;
&lt;br /&gt;
* LabVIEW software&lt;br /&gt;
* Python code [https://github.com/dgary50/eovsa Github repository]&lt;br /&gt;
* [[Python3 Code Installation]]&lt;br /&gt;
&lt;br /&gt;
== Observing Log ==&lt;br /&gt;
[[2016 November]]; [[2016 December| December]]&lt;br /&gt;
&lt;br /&gt;
[[2017 January]]; [[2017 February | February]]; [[2017 March | March]]; [[2017 April | April]]; [[2017 May | May]]; [[2017 June | June]];&lt;br /&gt;
[[2017 July | July]]; [[2017 August | August]]; [[2017 September | September]]; [[2017 October | October]]; [[2017 November | November]]; [[2017 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2018 January]]; [[2018 February | February]]; [[2018 March | March]]; [[2018 April | April]]; [[2018 May | May]]; [[2018 June | June]];&lt;br /&gt;
[[2018 July | July]]; [[2018 August | August]]; [[2018 September | September]]; [[2018 October | October]]; [[2018 November | November]]; [[2018 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2019 January]]; [[2019 February | February]]; [[2019 March | March]]; [[2019 April | April]]; [[2019 May | May]]; [[2019 June | June]];&lt;br /&gt;
[[2019 July | July]]; [[2019 August | August]]; [[2019 September | September]]; [[2019 October | October]]; [[2019 November | November]]; [[2019 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2020 January]]; [[2020 February | February]]; [[2020 March | March]]; [[2020 April | April]]; [[2020 May | May]]; [[2020 June | June]];&lt;br /&gt;
[[2020 July | July]]; [[2020 August | August]]; [[2020 September | September]]; [[2020 October | October]]; [[2020 November | November]]; [[2020 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2021 January]]; [[2021 February | February]]; [[2021 March | March]]; [[2021 April | April]]; [[2021 May | May]]; [[2021 June | June]];&lt;br /&gt;
[[2021 July | July]]; [[2021 August | August]]; [[2021 September | September]]; [[2021 October | October]]; [[2021 November | November]]; [[2021 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2022 SQL Outage]]&lt;br /&gt;
&lt;br /&gt;
[[2023 January]]; [[2023 February | February]]; [[2023 March | March]]; [[2023 April | April]]; [[2023 May | May]]; [[2023 June | June]];&lt;br /&gt;
[[2023 July | July]]; [[2023 August | August]]; [[2023 September | September]]; [[2023 October | October]]; [[2023 November | November]]; [[2023 December | December]]&lt;br /&gt;
&lt;br /&gt;
== Tohbans ==&lt;br /&gt;
&lt;br /&gt;
[[Trouble Shooting Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Records]]&lt;br /&gt;
&lt;br /&gt;
[[Owen's Notes]]&lt;br /&gt;
&lt;br /&gt;
[[Caius' Notes]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban EOVSA Imaging Tutorial A-Z]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Guide to Self Calibration and Imaging for EOVSA]]&lt;br /&gt;
&lt;br /&gt;
[[Guide to Upgrade SolarSoft(SSW)]]&lt;br /&gt;
&lt;br /&gt;
== EOVSA Flare List ==&lt;br /&gt;
&lt;br /&gt;
See [https://docs.google.com/spreadsheets/d/1P8jHuDRF93dMflU6RMQcsJqVepD9vFkPkofV8Imj4xA/edit?usp=sharing this link] for a list of EOVSA flares as a Google Spreadsheet. &lt;br /&gt;
&lt;br /&gt;
[[Recent Flare List (2021-)]]&lt;br /&gt;
&lt;br /&gt;
[http://ovsa.njit.edu/jay/rd_db.php An older link] is available at the EOVSA website.&lt;br /&gt;
&lt;br /&gt;
== EOVSA Publications ==&lt;br /&gt;
Here is a (partial) list of publications that utilize EOVSA data. See also the collection of EOVSA publications at [https://ui.adsabs.harvard.edu/public-libraries/eQ7HfPkySqydu-B8BCt6QQ this NASA/ADS Library].&lt;br /&gt;
; 2023 &lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2023arXiv230107840M/abstract Mondal, S., Chen, B. &amp;amp; Yu, S. (2023) ApJ, submitted] ''Multifrequency microwave imaging of weak transients from the quiet solar corona''&lt;br /&gt;
; 2022&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022FrASS...940945L/abstract Lörinčík et al (2022) Frontiers, 9, 1] ''Rapid variations of Si IV spectra in a flare observed by interface region imaging spectrograph at a sub-second cadence''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022NatCo..13.7680K/abstract Kou et al. (2022) Nature Communications 13, 7680] ''Microwave imaging of quasi-periodic pulsations at flare current sheet''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022Natur.606..674F/abstract Fleishman et al. (2022) Nature 606, 674] ''Solar flare accelerates nearly all electrons in a large coronal volume''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022ApJ...932...92L/abstract Li, X., et al., (2022) ApJ, 932, 92] ''Modeling Electron Acceleration and Transport in the Early Impulsive Phase of the 2017 September 10th Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022ApJ...930..154L/abstract Liu, N., et al., (2022), ApJ, 930, 154] ''Multi-instrument Comparative Study of Temperature, Number Density, and Emission Measure during the Precursor Phase of a Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022arXiv220503518Z/abstract Zhang et al. (2022), ApJ, 932, 53] ''Implications for additional plasma heating driving the extreme-ultraviolet late phase of a solar flare with microwave imaging spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022A%26A...657A..51L/abstract Lopez et al. (2021), A&amp;amp;A, 657, A51] ''A solar flare driven by thermal conduction observed in mid-infrared''&lt;br /&gt;
; 2021&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...923..213W/abstract Wei et al. (2021), ApJ, 923, 213] ''Coronal Magnetic Field Measurements along a Partially Erupting Filament in a Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...919...44S/abstract Shaik &amp;amp; Gary (2021), ApJ, 919, 44] ''Implications of Flat Optically Thick Microwave Spectra in Solar Flares for Source Size and Morphology''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...915...12K/abstract Kocharov et al. (2021), ApJ, 915, 12] ''Multiple Sources of Solar High-energy Protons''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...908L..55C/abstract Chen et al. (2021), ApJL, 908, L55] ''Energetic Electron Distribution of the Coronal Acceleration Region: First results from Joint Microwave and Hard X-ray Imaging Spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...906..132C/abstract Chhabra et al. (2021), ApJ, 906, 132] ''Imaging Spectroscopy of CME-Associated Solar Radio Bursts''&lt;br /&gt;
; 2020&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...905..165R/abstract Reeves et al. (2020), ApJ, 905, 165] ''Hot Plasma Flows and Oscillations in the Loop-top Region During the September 10 2017 X8.2 Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...900...17Y/abstract Yu et al. (2020), ApJ, 900, 17] ''Magnetic Reconnection During the Post Impulsive Phase of the X8.2 Solar Flare: Bi-Directional Outflows as a Cause of Microwave and X-ray Bursts''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020NatAs...4.1140C/abstract Chen et al. (2020b), Nature Astronomy, 4, 1140] ''Measurement of magnetic field and relativistic electrons along a solar flare current sheet''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...895L..50C/abstract Chen et al. (2020a), ApJL, 895, 50] ''Microwave Spectral Imaging of an Erupting Magnetic Flux Rope: Implications for the Standard Solar Flare Model in Three Dimensions''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020FrASS...7...22K/abstract Kuroda et al. (2020), Frontiers, 7, 22] ''Evolution of Flare-accelerated Electrons Quantified by Spatially Resolved Analysis''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...891L..34G/abstract Glesener et al. (2020), ApJL, 891, 34] ''Accelerated Electrons Observed Down to &amp;lt;7 keV in a NuSTAR Solar Microflare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...889...72K/abstract Karlicky at al. (2020), ApJ, 889, 72] ''Drifting Pulsation Structure at the Very Beginning of the 2017 September 10 Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020Sci...367..278F/abstract Fleishman et al. (2020), Science, 367, 278] ''Decay of the coronal magnetic field can release sufficient energy to power a solar flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020AAS...23538501G/abstract Gary et al. (2020), BAAS 52, 385.01] [https://aas235-aas.ipostersessions.com/default.aspx?s=97-69-9E-4B-34-19-68-53-1B-C6-21-0C-16-1C-5C-82&amp;amp;guestview=true Direct link to AAS iPoster] ''A new view of the solar atmosphere: daily full-disk multifrequency radio images from EOVSA''&lt;br /&gt;
; 2018&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...864...63P/abstract Polito et al. (2018), ApJ, 864, 63] ''Broad Non-Gaussian Fe XXIV Line Profiles in the Impulsive Phase of the 2017 September 10 X8.3-class Flare Observed by Hinode/EIS''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...863...83G/abstract Gary et al. (2018), ApJ, 863, 83] ''Microwave and Hard X-Ray Observations of the 2017 September 10 Solar Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...852...32K/abstract Kuroda et al. (2018), ApJ, 852, 32] ''Three-dimensional Forward-fit Modeling of the Hard X-ray and the Microwave Emissions of the 2015 June 22 M6.5 flare''&lt;br /&gt;
; 2017&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2017NatAs...1E..85W/abstract Wang et al. (2017), Nature Astronomy, 1, 85] ''High-resolution observations of flare precursors in the low solar atmosphere''&lt;br /&gt;
; 2016&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2016JAI.....541009N/abstract Nita et al. (2016), J. Astron. Instr., 5, 1641009-7366] ''EOVSA Implementation of a Spectral Kurtosis Correlator for Transient Detection and Classification''&lt;br /&gt;
&lt;br /&gt;
== VLA Flare List and Publications ==&lt;br /&gt;
See [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey#List_of_Jansky_VLA_Solar_Observations this link] for a list of flare observations made by the [https://science.nrao.edu/facilities/vla/ Karl G. Jansky Very Large Array] (VLA). Below is a partial list of publications that utilize VLA solar data (see also [https://ui.adsabs.harvard.edu/public-libraries/ZwbjpLo9RS-viufWEoQ95Q this NASA/ADS Library]).&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2022ApJ...940..137L/abstract Luo et al. (2022), ApJ, 940, 137] ''Multiple Regions of Nonthermal Quasiperiodic Pulsations during the Impulsive Phase of a Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...922..134B/abstract Battaglia et al. (2021), ApJ, 922, 134] ''Multiple Electron Acceleration Instances during a Series of Solar Microflares Observed Simultaneously at X-Rays and Microwaves''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...911....4L/abstract Luo et al. (2021), ApJ, 911, 4] ''Radio Spectral Imaging of an M8.4 Eruptive Solar Flare: Possible Evidence of a Termination Shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...910...40Z/abstract Zhang et al. (2021), ApJ, 910, 40] ''Multiwavelength Observations of the Formation and Eruption of a Complex Filament''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2020ApJ...904...94S/abstract Sharma et al. (2020), ApJ, 904, 94] ''Radio and X-Ray Observations of Short-lived Episodes of Electron Acceleration in a Solar Microflare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...884...63C/abstract Chen et al. (2019), ApJ, 884, 63] ''Radio Spectroscopic Imaging of a Solar Flare Termination Shock: Split-band Feature as Evidence for Shock Compression''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...872...71Y/abstract Yu &amp;amp; Chen (2019), ApJ, 872, 71] ''Possible Detection of Subsecond-period Propagating Magnetohydrodynamics Waves in Post-reconnection Magnetic Loops during a Two-ribbon Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2018ApJ...866...62C/abstract Chen et al. (2018), ApJ, 866, 62] ''Magnetic Reconnection Null Points as the Origin of Semirelativistic Electron Beams in a Solar Jet&lt;br /&gt;
''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2017ApJ...848...77W/abstract Wang et al. (2016), ApJ, 848, 77] ''Dynamic Spectral Imaging of Decimetric Fiber Bursts in an Eruptive Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2015Sci...350.1238C/abstract Chen et al. (2015), Science, 350, 1238] ''Particle acceleration by a solar flare termination shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2014ApJ...794..149C/abstract Chen et al. (2014), ApJ, 794, 149] ''Direct Evidence of an Eruptive, Filament-hosting Magnetic Flux Rope Leading to a Fast Solar Coronal Mass Ejection''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2013ApJ...763L..21C/abstract Chen et al. (2013), ApJL, 763, 21] ''Tracing Electron Beams in the Sun's Corona with Radio Dynamic Imaging Spectroscopy''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radio Data from Around The Heliosphere==&lt;br /&gt;
* [http://ovsa.njit.edu//wiki/index.php/Radio_Data_from_Around_the_World#Radio_Data_Access '' Radio Data '']&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7539</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7539"/>
		<updated>2023-08-09T03:55:24Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1 s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime;/0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1 - 18 GHz || Sample time: 20 ms:&amp;lt;br/&amp;gt; Full Sweep: 1 s || ~14 - 24 || 2017 - ongoing || Full Sun ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here] &amp;lt;br/&amp;gt; [http://ovsa.njit.edu/browser/?suntoday_date=2023-08-06 EOVSA Browser] || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Pietro Zucca (zucca@astron.nl) &amp;lt;br/&amp;gt;&lt;br /&gt;
Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1 s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2 - 15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80 - 300 MHz || 0.5 s || 01 - 08 || 2014 - ongoing || 30° || depends on configuration;&amp;lt;br/&amp;gt; ~1 - 2&amp;amp;prime;/200 MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1 s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1 s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1 ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100 ms (fast visibilities);&amp;lt;br/&amp;gt; 10 s (regular mode) || 14 - 24 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80 MHz || 24 kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz - 2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz - 19.2 MHz || 7 s || 0 - 24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1 s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3 - 46&amp;amp;Prime; @ 1.3 GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] &amp;lt;br/&amp;gt; [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey Data Survey]|| Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Solarplus_mhz.png|thumb|center|600px|'''Figure 2:''' Radio Instruments (Solar Dedicated and Proposal based observing below 1 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Facilities.png|thumb|center|1000px|'''Figure 3:''' Radio Instruments (Solar Dedicated and Proposal based observing between 10 MHz - 10 GHz) (Image Credit: Bin Chen)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7538</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7538"/>
		<updated>2023-08-09T03:36:35Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms:&amp;lt;br/&amp;gt; Full Sweep: 1s || ~14-24 || 2017 - ongoing || Full Sun ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here] &amp;lt;br/&amp;gt; [http://ovsa.njit.edu/browser/?suntoday_date=2023-08-06 EOVSA Browser] || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Pietro Zucca (zucca@astron.nl) &amp;lt;br/&amp;gt;&lt;br /&gt;
Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100ms (fast visibilities);&amp;lt;br/&amp;gt; 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] &amp;lt;br/&amp;gt; [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey Data Survey]|| Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Solarplus_mhz.png|thumb|center|600px|'''Figure 2:''' Radio Instruments (Solar Dedicated and Proposal based observing below 1 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Facilities.png|thumb|center|1000px|'''Figure 3:''' Radio Instruments (Solar Dedicated and Proposal based observing between 10 MHz - 10 GHz) (Image Credit: Bin Chen)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7537</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7537"/>
		<updated>2023-08-09T03:32:13Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms:&amp;lt;br/&amp;gt; Full Sweep: 1s || ~14-24 || 2017 - ongoing || Full Sun ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here] &amp;lt;br/&amp;gt; [http://ovsa.njit.edu/browser/?suntoday_date=2023-08-06 EOVSA Browser] || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Pietro Zucca (zucca@astron.nl) &amp;lt;br/&amp;gt;&lt;br /&gt;
Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100ms (fast visibilities);&amp;lt;br/&amp;gt; 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey Data Survey]|| Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Solarplus_mhz.png|thumb|center|600px|'''Figure 2:''' Radio Instruments (Solar Dedicated and Proposal based observing below 1 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Facilities.png|thumb|center|1000px|'''Figure 3:''' Radio Instruments (Solar Dedicated and Proposal based observing between 10 MHz - 10 GHz) (Image Credit: Bin Chen)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7536</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7536"/>
		<updated>2023-08-09T03:30:55Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms:&amp;lt;br/&amp;gt; Full Sweep: 1s || ~14-24 || 2017 - ongoing || Full Sun ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here] &amp;lt;br/&amp;gt; [http://ovsa.njit.edu/browser/?suntoday_date=2023-08-06 EOVSA Browser] || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100ms (fast visibilities);&amp;lt;br/&amp;gt; 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey Data Survey]|| Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Solarplus_mhz.png|thumb|center|600px|'''Figure 2:''' Radio Instruments (Solar Dedicated and Proposal based observing below 1 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Facilities.png|thumb|center|1000px|'''Figure 3:''' Radio Instruments (Solar Dedicated and Proposal based observing between 10 MHz - 10 GHz) (Image Credit: Bin Chen)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7532</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7532"/>
		<updated>2023-08-08T16:49:55Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms:&amp;lt;br/&amp;gt; Full Sweep: 1s || ~14-24 || 2017 - ongoing || Point ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here] &amp;lt;br/&amp;gt; [http://ovsa.njit.edu/browser/?suntoday_date=2023-08-06 EOVSA Browser] || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100ms (fast visibilities);&amp;lt;br/&amp;gt; 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey Data Survey]|| Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Solarplus_mhz.png|thumb|center|600px|'''Figure 2:''' Radio Instruments (Solar Dedicated and Proposal based observing below 1 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Facilities.png|thumb|center|1000px|'''Figure 3:''' Radio Instruments (Solar Dedicated and Proposal based observing between 10 MHz - 10 GHz) (Image Credit: Bin Chen)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7530</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7530"/>
		<updated>2023-08-08T16:44:28Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Other Useful Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms:&amp;lt;br/&amp;gt; Full Sweep: 1s || ~14-24 || 2017 - ongoing || Point ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here]  || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100ms (fast visibilities);&amp;lt;br/&amp;gt; 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] || Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Solarplus_mhz.png|thumb|center|600px|'''Figure 2:''' Radio Instruments (Solar Dedicated and Proposal based observing below 1 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Facilities.png|thumb|center|1000px|'''Figure 3:''' Radio Instruments (Solar Dedicated and Proposal based observing between 10 MHz - 10 GHz) (Image Credit: Bin Chen)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7529</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7529"/>
		<updated>2023-08-08T16:44:04Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Other Useful Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms:&amp;lt;br/&amp;gt; Full Sweep: 1s || ~14-24 || 2017 - ongoing || Point ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here]  || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100ms (fast visibilities);&amp;lt;br/&amp;gt; 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] || Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Solarplus_mhz.png|thumb|center|600px|'''Figure 2:''' Radio Instruments (Solar Dedicated and Proposal based observing below 1 GHz) (Image Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Facilities.png|thumb|center|600px|'''Figure 3:''' Radio Instruments (Solar Dedicated and Proposal based observing between 10 MHz - 10 GHz) (Image Credit: Bin Chen)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7527</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7527"/>
		<updated>2023-08-08T16:42:33Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Other Useful Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms:&amp;lt;br/&amp;gt; Full Sweep: 1s || ~14-24 || 2017 - ongoing || Point ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here]  || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100ms (fast visibilities);&amp;lt;br/&amp;gt; 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] || Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Plot Credit: Anshu Kumari)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Solarplus_mhz.png|thumb|center|600px|'''Figure 2:''' Radio Instruments (Solar Dedicated and Proposal based observing below 1 GHz) (Plot Credit: Anshu Kumari)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=File:Solarplus_mhz.png&amp;diff=7525</id>
		<title>File:Solarplus mhz.png</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=File:Solarplus_mhz.png&amp;diff=7525"/>
		<updated>2023-08-08T16:41:08Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7524</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7524"/>
		<updated>2023-08-08T16:37:41Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Other Useful Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 700pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' ||  style=&amp;quot;width: 250pt;&amp;quot; |'''Spectroscopy Frequency Resolution''' || style=&amp;quot;width: 250pt;&amp;quot; |  '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms:&amp;lt;br/&amp;gt; Full Sweep: 1s || ~14-24 || 2017 - ongoing || Point ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here]  || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [https://asvo.mwatelescope.org/ MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum);&amp;lt;br/&amp;gt; 100ms (fast visibilities);&amp;lt;br/&amp;gt; 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode),&amp;lt;br/&amp;gt; 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz;&amp;lt;br/&amp;gt; 0.3 GHz (P-Band) || 50 ms - 5 s,&amp;lt;br/&amp;gt; depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] || Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun - Unresolved || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;br /&gt;
&lt;br /&gt;
[[file:Solar_ghz.png|thumb|center|600px|'''Figure 1:''' Radio Instruments (Solar Dedicated and Proposal based observing between 1 - 40 GHz) (Plot Credit: Anshu Kumari)]]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=File:Solar_ghz.png&amp;diff=7517</id>
		<title>File:Solar ghz.png</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=File:Solar_ghz.png&amp;diff=7517"/>
		<updated>2023-08-08T16:31:45Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7512</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7512"/>
		<updated>2023-08-08T16:23:27Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Other Useful Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 300pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' || '''Spectroscopy Frequency Resolution''' || '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms: Full Sweep: 1s || ~14-24 || 2017 - ongoing || Point ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here]  || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [link MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum); 100ms (fast visibilities); 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode), 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz; 0.3 GHz (P-Band) || 50 ms - 5 s, depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] || Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies: Multiple Instruments Throughout World || Varies || Varies || Ongoing || Full Sun || Varies || Varies || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;br /&gt;
&lt;br /&gt;
# The plots below show the Observation times of different instruments:&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7509</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7509"/>
		<updated>2023-08-08T16:20:22Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Other Useful Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||style=&amp;quot;width: 200pt;&amp;quot; |'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' || '''Spectroscopy Frequency Resolution''' || '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms: Full Sweep: 1s || ~14-24 || 2017 - ongoing || Point ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here]  || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [link MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum); 100ms (fast visibilities); 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode), 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz; 0.3 GHz (P-Band) || 50 ms - 5 s, depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] || Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| E-Callisto || Varies || Varies || Varies || Ongoing || Full Sun || Varies ||  || [https://www.e-callisto.org/Data/data.html E-Callisto] || N/A &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;br /&gt;
&lt;br /&gt;
# The [https://lesia.obspm.fr/cesra/sites.html CESRA-related data centers] is another place where you can find a list of different Radio instruments.&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7506</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7506"/>
		<updated>2023-08-08T16:15:30Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' || '''Spectroscopy Frequency Resolution''' || '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms: Full Sweep: 1s || ~14-24 || 2017 - ongoing || Point ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here]  || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [link MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum); 100ms (fast visibilities); 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode), 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz; 0.3 GHz (P-Band) || 50 ms - 5 s, depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] || Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Other Useful Resources  ==&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7505</id>
		<title>Radio Data from Around the World</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Radio_Data_from_Around_the_World&amp;diff=7505"/>
		<updated>2023-08-08T16:14:34Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Radio Data Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio Data Access  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center; width: 1300px; height: 200px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Instrument''' || style=&amp;quot;width: 400pt;&amp;quot; | '''Frequency Range/Central Frequencies''' ||'''Cadence''' || '''Observing Time (UT)'''|| style=&amp;quot;width: 250pt;&amp;quot; |'''Dates of Operation (start/end)''' || '''FOV''' || style=&amp;quot;width: 130pt;&amp;quot; | '''Imaging FOV / Resolution''' || '''Spectroscopy Frequency Resolution''' || '''Useful Links''' || '''Points of Contact for Data ''' &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| ALMA || 92-96, 104-108, 190-194,&amp;lt;br/&amp;gt; 202-206, 229-233, 245-249,&amp;lt;br/&amp;gt; 338.6-342.6, 350.6-345.6 GHz || 1s || 13 - 21 || 2016 - ongoing || Sun, sub active region scales || 6.54-66&amp;amp;Prime; / 0.62-11.6&amp;amp;Prime; || 2 GHz || [https://ui.adsabs.harvard.edu/abs/2022FrASS...9.7368B/abstract Harvard] ||  Stephen White (stephen.white.24@spaceforce.mil) Tim Bastian &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--  | Arecibo? || X GHz || Ys || Z || XXXX - 2022 || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| EOVSA || 1-18 GHz || Sample time: 20ms: Full Sweep: 1s || ~14-24 || 2017 - ongoing || Point ||57&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; x 51&amp;amp;Prime;/&amp;lt;math&amp;gt;\nu_{GHz}&amp;lt;/math&amp;gt; || 0.500 GHz || [http://ovsa.njit.edu//wiki/index.php You Are Here]  || Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| F10.7|| 2.8 GHz || 3 times daily || 17 (18), 20, 23 (22) || 1947 - ongoing || Full Sun, unresolved || N/A || N/A || [https://www.spaceweather.gc.ca/forecast-prevision/solar-solaire/solarflux/sx-en.php Space Weather Monitor] || Sam Schonfeld (schonfsj@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | IPS || 327 MHz || 6hrs || Depends on Instrument || XXXX - YYYY || Point || M.MM arcsec || /X GHz ||[https://ips.ucsd.edu IPS]||| Bernard Jackson (bvjackson@ucsd.edu)&lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| LOFAR || LBA: 10 - 80 MHz,&amp;lt;br/&amp;gt; HBA: 120 - 240 MHz || 10ms || 8.5-16 || Time Allocation by Proposal|| [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || [https://drive.google.com/file/d/1YaBnSdzuEvxWee-wUAUZcUzxiaO1524J/view?usp=sharing FOV Info] || 10 kHz || [https://docs.google.com/document/d/103S1ANjTPXDIWnOAlhEAbQy2oLm5ZOcqV8x1eR0hvxs/edit LOFAR Info Doc] || Anshu Kumari (anshusingh628@gmail.com)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| LWA-NM  || 10-88 MHz || &amp;lt; 1s || 15 - 23 || April 2011 - ongoing|| Full-sky || All-sky, ~2-15° (zenith) || 7.8 - 612 kHz || [https://leo.phys.unm.edu/~lwa/specs.html LWA Spec] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | MUSER || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| MWA || 80-300MHz || 0.5s || 01:00-08:00 || 2014 - ongoing || 30deg || depends on configuration;&amp;lt;br/&amp;gt; ~1-2&amp;amp;prime;/200MHz || 10/40 kHz || [link MWA]||  Surajit Mondal (surajit.mondal@njit.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRP || 1, 2, 3.75, 9.4, 17, 35, 80 GHz || 0.1s || 23 - 7 || ~1979 - ongoing&amp;lt;br/&amp;gt; (3.75 GHz since 1951) || Full Sun, unresolved || N/A || N/A || [https://solar.nro.nao.ac.jp/norp/index.html NRO] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| NoRH || 17, 34 GHz || 1s, daily || 22.5 - 6.5 || 7/1/1992 - 3/31/2020|| Full Sun || 10&amp;amp;Prime;, 5&amp;amp;Prime; || N/A || [https://hinode.isee.nagoya-u.ac.jp/ICCON/ Hinode Site] || Stephen White (stephen.white.24@spaceforce.mil),&amp;lt;br/&amp;gt; Nat Gopalswamy (nat.gopalswamy@nasa.gov)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| OVRO-LWA || 15-88 MHz || 1ms (dynamic spectrum); 100ms (fast visibilities); 10s (regular mode) || 14-24:00 || under commissioning (some data already available) || Full Sky || 5&amp;amp;prime; at 80MHz || 24kHz (dynamic spectrum and regular mode), 100 kHz (fast visibilities) || [link to come]  ||  Dale Gary (dgary@njit.edu)&amp;lt;br/&amp;gt; Bin Chen (bin.chen@njit.edu)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| PSP/FIELDS || LFR: 10 kHz-2.4 MHz &amp;lt;br/&amp;gt; HFR:1.6 kHz-19.2 MHz || 7s || 0-24 || 2018/10/02 - Present during PSP Perihelia  || N/A || N/A || Non-uniform, &amp;amp;Delta;&amp;amp;nu;/&amp;amp;nu; ~ 4.5% || [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ FIELDS data] &amp;lt;br/&amp;gt; [https://sprg.ssl.berkeley.edu/data/psp/data/sci/fields/ Data Release Notes] || Marc Pulupa (pulupa@berkeley.edu)&amp;lt;br/&amp;gt;  Sam Badman (samuel.badman@cfa.harvard.edu) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--| SO/RPW || X GHz || Ys || Z || XXXX - ongoing || Point || N/A || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| RSTN || 245, 410, 610, 1415,&amp;lt;br/&amp;gt; 4995, 8800, 15400 MHz || 1s || 0 - 24 || 1980 - ongoing|| Full Sun, unresolved || N/A || N/A || [https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-radio/rstn-1-second/ NOAA], [https://www.sws.bom.gov.au/World_Data_Centre/2/8/9 SWS] || Stephen White (stephen.white.24@spaceforce.mil)&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- | SSRT || X GHz || Ys || Z || XXXX - ongoing || Point || M.MM arcsec || /X GHz || [link] link ||  ??? &lt;br /&gt;
|- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| VLA || 1-18 GHz; 0.3 GHz (P-Band) || 50 ms - 5 s, depending on observing frequency || 15 - 23 || from 1990s; based on proposals || 42&amp;amp;prime; at 1 GHz || 1.3-46 &amp;amp;Prime; @ 1.3GHz depending on configuration|| Depends on configuration || [https://data.nrao.edu/portal/#/ NRAO Archive] || Tim Bastian (tbastian@nrao.edu)&lt;br /&gt;
|-&lt;br /&gt;
| NRH || 150, 173, 228, 270, 298, 327, 327.5, 408, 432, 445 MHz || 125 ms || 8 - 15 || Ongoing || Full Sun || 6&amp;amp;prime; @ 150 MHz, 2&amp;amp;prime; @ 450 MHz ||  || [https://secchirh.obspm.fr/ NRH] ||  L. Klein (ludwig.klein@obspm.fr) and A. Hamini (abdallah.hamini@obspm.fr) &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6577</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6577"/>
		<updated>2022-07-07T23:16:19Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_Guide_to_Self_Calibration_and_Imaging_for_EOVSA&amp;diff=6576</id>
		<title>Tohban Guide to Self Calibration and Imaging for EOVSA</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_Guide_to_Self_Calibration_and_Imaging_for_EOVSA&amp;diff=6576"/>
		<updated>2022-07-07T23:14:36Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: Created page with &amp;quot;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis.   === Pre-requisites ===  Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi.   ==== How to connect to pipeline ==== '''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipe...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. The process to add rsa keys to access gues@ovsa is slightly complicated. Please contact Dale for the set up. &lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac, the guest account will be used for people to log in as Tohban.  Rather than using a password, access will be tied to specific computers that you use.  One needs to generate a public + private ssh key pair using ssh-keygen or equivalent program that will result in a public key (plain text) file called id_rsa.pub, created in your ~/.ssh folder, the contents of which can be emailed to Dale or Owen to be added under &amp;quot;authorized keys&amp;quot;. The ssh commands can then be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### will not ask for a password for your computer's authorized key ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown in Figure 1 ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|thumb|right|300px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|400px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the steps below to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                             ###spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|right|300px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']    ###Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|right|300px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons. See Figure 4.&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf.G0.png|thumb|right|300px|Figure 5: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|right|300px|Figure 6: Phase after self-calibration]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                      # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                     # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                    # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                           # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                             # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                             #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                            # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                            #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                               # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|right|300px|Figure 7: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|right|300px|Figure 8: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                   # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                         # gs = gridspec.GridSpec(5, 10)       # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/07/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=6575</id>
		<title>Owens Valley Solar Arrays</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=6575"/>
		<updated>2022-07-07T23:12:34Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Tohbans */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Eovsa1.png|border|text-top|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;[http://ovsa.njit.edu/ EOVSA] (Expanded Owens Valley Solar Array) is a new solar-dedicated radio interferometer operated by the New Jersey Institute of Technology. This wiki serves as the site for EOVSA documentation.  &amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== EOVSA Documentation ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;General&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Downconversion and Frequency Tuning]]&lt;br /&gt;
** [[Dealing with Radio Frequency Interference]]&lt;br /&gt;
** [[Switching between 200 MHz and 300 MHz Correlator]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Computer-Network&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Computing Systems]]&lt;br /&gt;
** [[Network]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Control System&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[27-m Antenna Commands]]&lt;br /&gt;
** [[Schedule Commands]]&lt;br /&gt;
** [[Control Commands]]&lt;br /&gt;
** [[Attenuation and Level Control]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Hardware&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Hardware Overview]]&lt;br /&gt;
** [[2.1-m Antennas]]&lt;br /&gt;
** [[27-m Antennas]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;System Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Calibration Database]]&lt;br /&gt;
** [[Stateframe Database]]&lt;br /&gt;
** [[Database Maintenance]]&lt;br /&gt;
** [[Create CASA measurement sets]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Calibration&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[Calibration Overview]]&lt;br /&gt;
**[[Pointing Calibration]]&lt;br /&gt;
**[[Total Power Calibration]]&lt;br /&gt;
**[[System Gain Calibration]]&lt;br /&gt;
**[[Antenna Position]] (Baseline Calibration)&lt;br /&gt;
**[[Reference Gain Calibration]]&lt;br /&gt;
**[[Daily Gain Calibration]]&lt;br /&gt;
**[[Delay Calibration]]&lt;br /&gt;
**[[Bandpass Calibration]]&lt;br /&gt;
**[[Polarization Calibration]]&lt;br /&gt;
**[[Calibrator Survey]]&lt;br /&gt;
**[[Practical Calibration Tutorial]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Starburst]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using EOVSA Data  ==&lt;br /&gt;
* &amp;lt;big&amp;gt;[[EOVSA Data products]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;Analysis Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [https://github.com/suncasa/suncasa SunCASA] A wrapper around [https://casa.nrao.edu/ CASA (the Common Astronomy Software Applications package)] for synthesis imaging and visualizing solar spectral imaging data. CASA is one of the leading software tool for &amp;quot;supporting the data post-processing needs of the next generation of radio astronomical telescopes such as ALMA and VLA&amp;quot;, an international effort led by the [https://public.nrao.edu/ National Radio Astronomy Observatory]. The current version of CASA uses Python (2.7) interface. More information about CASA can be found on [https://casa.nrao.edu/ NRAO's CASA website ]. Note, CASA is available ONLY on UNIX-BASED PLATFORMS (and therefore, so is SunCASA). &lt;br /&gt;
** [https://github.com/Gelu-Nita/GSFIT GSFIT] A IDL-widget(GUI)-based spectral fitting package called gsfit, which provides a user-friendly display of EOVSA image cubes and an interface to fast fitting codes (via platform-dependent shared-object libraries). &lt;br /&gt;
** [[Spectrogram Software]]&lt;br /&gt;
** [[Mapping Software]]&lt;br /&gt;
* &amp;lt;big&amp;gt;Data Analysis Guides&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial 2022]]&amp;lt;/big&amp;gt; and &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/19NQb6Emb9HvKX4QHq9ZYCP3RM6nT7sDL#scrollTo=cLdDVptBGG-X EOVSA Workspace]&amp;lt;/big&amp;gt; at [https://sphere.boulder.swri.edu/ SPHERE 2022 Workshop]&lt;br /&gt;
** &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL EOVSA Data Analysis Tutorial at RHESSI 19 Workshop]&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial]]&amp;lt;/big&amp;gt; at [http://rhessi18.umn.edu/ RHESSI XVIII Workshop]&lt;br /&gt;
** [[Self-Calibrating Flare Data]] Example script and guides for self-calibrating EOVSA flare data (to be completed)&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
**[[IDB flare pipeline]] Tutorial to run the flare pipeline for quicklook images&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;EOVSA Modeling Guide&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[GX Simulator]]&lt;br /&gt;
&lt;br /&gt;
* Other helpful links&lt;br /&gt;
** [https://casaguides.nrao.edu CASA Guides]&lt;br /&gt;
** [http://www.lmsal.com/solarsoft/ SolarSoft IDL]&lt;br /&gt;
** [http://www.atnf.csiro.au/computing/software/miriad/userguide/userhtml.html Miriad Guides]&lt;br /&gt;
** [https://sites.google.com/site/fgscodes/ Fast Gyrosynchrotron Codes (Alexey Kuznetsov's website)]&lt;br /&gt;
** [[Basic GitHub Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--* &amp;lt;big&amp;gt;[[EOVSA Imaging Workshop]]&amp;lt;/big&amp;gt;--&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Full Disk Simulations]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[All-Day Synthesis Issues]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Analyzing Pre-2017 Data]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Fixing Pipeline Problems pre-2021-Feb-07]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System Software ==&lt;br /&gt;
&lt;br /&gt;
* LabVIEW software&lt;br /&gt;
* Python code [https://github.com/dgary50/eovsa Github repository]&lt;br /&gt;
* [[Python3 Code Installation]]&lt;br /&gt;
&lt;br /&gt;
== Observing Log ==&lt;br /&gt;
[[2016 November]]; [[2016 December| December]]&lt;br /&gt;
&lt;br /&gt;
[[2017 January]]; [[2017 February | February]]; [[2017 March | March]]; [[2017 April | April]]; [[2017 May | May]]; [[2017 June | June]];&lt;br /&gt;
[[2017 July | July]]; [[2017 August | August]]; [[2017 September | September]]; [[2017 October | October]]; [[2017 November | November]]; [[2017 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2018 January]]; [[2018 February | February]]; [[2018 March | March]]; [[2018 April | April]]; [[2018 May | May]]; [[2018 June | June]];&lt;br /&gt;
[[2018 July | July]]; [[2018 August | August]]; [[2018 September | September]]; [[2018 October | October]]; [[2018 November | November]]; [[2018 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2019 January]]; [[2019 February | February]]; [[2019 March | March]]; [[2019 April | April]]; [[2019 May | May]]; [[2019 June | June]];&lt;br /&gt;
[[2019 July | July]]; [[2019 August | August]]; [[2019 September | September]]; [[2019 October | October]]; [[2019 November | November]]; [[2019 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2020 January]]; [[2020 February | February]]; [[2020 March | March]]; [[2020 April | April]]; [[2020 May | May]]; [[2020 June | June]];&lt;br /&gt;
[[2020 July | July]]; [[2020 August | August]]; [[2020 September | September]]; [[2020 October | October]]; [[2020 November | November]]; [[2020 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2021 January]]; [[2021 February | February]]; [[2021 March | March]]; [[2021 April | April]]; [[2021 May | May]]; [[2021 June | June]];&lt;br /&gt;
[[2021 July | July]]; [[2021 August | August]]; [[2021 September | September]]; [[2021 October | October]]; [[2021 November | November]]; [[2021 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2022 SQL Outage]]&lt;br /&gt;
&lt;br /&gt;
== Tohbans ==&lt;br /&gt;
&lt;br /&gt;
[[Trouble Shooting Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Records]]&lt;br /&gt;
&lt;br /&gt;
[[Owen's Notes]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban EOVSA Imaging Tutorial A-Z]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Guide to Self Calibration and Imaging for EOVSA]]&lt;br /&gt;
&lt;br /&gt;
[[Guide to Upgrade SolarSoft(SSW)]]&lt;br /&gt;
&lt;br /&gt;
== EOVSA Flare List ==&lt;br /&gt;
&lt;br /&gt;
See [https://docs.google.com/spreadsheets/d/1P8jHuDRF93dMflU6RMQcsJqVepD9vFkPkofV8Imj4xA/edit?usp=sharing this link] for a list of EOVSA flares as a Google Spreadsheet. &lt;br /&gt;
&lt;br /&gt;
[[Recent Flare List (2021-)]]&lt;br /&gt;
&lt;br /&gt;
[http://ovsa.njit.edu/jay/rd_db.php An older link] is available at the EOVSA website.&lt;br /&gt;
&lt;br /&gt;
== EOVSA Publications ==&lt;br /&gt;
Here is a (partial) list of publications that utilize EOVSA data. See also the collection of EOVSA publications at [https://ui.adsabs.harvard.edu/public-libraries/eQ7HfPkySqydu-B8BCt6QQ this NASA/ADS Library].&lt;br /&gt;
; 2022&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022arXiv220503518Z/abstract Zhang et al. (2022), arXiv 2205.03518] ''Implications for additional plasma heating driving the extreme-ultraviolet late phase of a solar flare with microwave imaging spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2022A%26A...657A..51L/abstract Lopez et al. (2021), A&amp;amp;A, 657, A51] ''A solar flare driven by thermal conduction observed in mid-infrared''&lt;br /&gt;
; 2021&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...923..213W/abstract Wei et al. (2021), ApJ, 923, 213] ''Coronal Magnetic Field Measurements along a Partially Erupting Filament in a Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...919...44S/abstract Shaik &amp;amp; Gary (2021), ApJ, 919, 44] ''Implications of Flat Optically Thick Microwave Spectra in Solar Flares for Source Size and Morphology''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...915...12K/abstract Kocharov et al. (2021), ApJ, 915, 12] ''Multiple Sources of Solar High-energy Protons''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...908L..55C/abstract Chen et al. (2021), ApJL, 908, L55] ''Energetic Electron Distribution of the Coronal Acceleration Region: First results from Joint Microwave and Hard X-ray Imaging Spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...906..132C/abstract Chhabra et al. (2021), ApJ, 906, 132] ''Imaging Spectroscopy of CME-Associated Solar Radio Bursts''&lt;br /&gt;
; 2020&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...905..165R/abstract Reeves et al. (2020), ApJ, 905, 165] ''Hot Plasma Flows and Oscillations in the Loop-top Region During the September 10 2017 X8.2 Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...900...17Y/abstract Yu et al. (2020), ApJ, 900, 17] ''Magnetic Reconnection During the Post Impulsive Phase of the X8.2 Solar Flare: Bi-Directional Outflows as a Cause of Microwave and X-ray Bursts''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020NatAs...4.1140C/abstract Chen et al. (2020b), Nature Astronomy, 4, 1140] ''Measurement of magnetic field and relativistic electrons along a solar flare current sheet''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...895L..50C/abstract Chen et al. (2020a), ApJL, 895, 50] ''Microwave Spectral Imaging of an Erupting Magnetic Flux Rope: Implications for the Standard Solar Flare Model in Three Dimensions''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020FrASS...7...22K/abstract Kuroda et al. (2020), Frontiers, 7, 22] ''Evolution of Flare-accelerated Electrons Quantified by Spatially Resolved Analysis''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...891L..34G/abstract Glesener et al. (2020), ApJL, 891, 34] ''Accelerated Electrons Observed Down to &amp;lt;7 keV in a NuSTAR Solar Microflare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...889...72K/abstract Karlicky at al. (2020), ApJ, 889, 72] ''Drifting Pulsation Structure at the Very Beginning of the 2017 September 10 Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020Sci...367..278F/abstract Fleishman et al. (2020), Science, 367, 278] ''Decay of the coronal magnetic field can release sufficient energy to power a solar flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020AAS...23538501G/abstract Gary et al. (2020), BAAS 52, 385.01] [https://aas235-aas.ipostersessions.com/default.aspx?s=97-69-9E-4B-34-19-68-53-1B-C6-21-0C-16-1C-5C-82&amp;amp;guestview=true Direct link to AAS iPoster] ''A new view of the solar atmosphere: daily full-disk multifrequency radio images from EOVSA''&lt;br /&gt;
; 2018&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...864...63P/abstract Polito et al. (2018), ApJ, 864, 63] ''Broad Non-Gaussian Fe XXIV Line Profiles in the Impulsive Phase of the 2017 September 10 X8.3-class Flare Observed by Hinode/EIS''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...863...83G/abstract Gary et al. (2018), ApJ, 863, 83] ''Microwave and Hard X-Ray Observations of the 2017 September 10 Solar Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...852...32K/abstract Kuroda et al. (2018), ApJ, 852, 32] ''Three-dimensional Forward-fit Modeling of the Hard X-ray and the Microwave Emissions of the 2015 June 22 M6.5 flare''&lt;br /&gt;
; 2017&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2017NatAs...1E..85W/abstract Wang et al. (2017), Nature Astronomy, 1, 85] ''High-resolution observations of flare precursors in the low solar atmosphere''&lt;br /&gt;
; 2016&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2016JAI.....541009N/abstract Nita et al. (2016), J. Astron. Instr., 5, 1641009-7366] ''EOVSA Implementation of a Spectral Kurtosis Correlator for Transient Detection and Classification''&lt;br /&gt;
&lt;br /&gt;
== VLA Flare List and Publications ==&lt;br /&gt;
See [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey#List_of_Jansky_VLA_Solar_Observations this link] for a list of flare observations made by the [https://science.nrao.edu/facilities/vla/ Karl G. Jansky Very Large Array] (VLA). Below is a partial list of publications that utilize VLA solar data (see also [https://ui.adsabs.harvard.edu/public-libraries/ZwbjpLo9RS-viufWEoQ95Q this NASA/ADS Library]).&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...911....4L/abstract Luo et al. (2021), ApJ, 911, 4] ''Radio Spectral Imaging of an M8.4 Eruptive Solar Flare: Possible Evidence of a Termination Shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...910...40Z/abstract Zhang et al. (2021), ApJ, 910, 40] ''Multiwavelength Observations of the Formation and Eruption of a Complex Filament''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2020ApJ...904...94S/abstract Sharma et al. (2020), ApJ, 904, 94] ''Radio and X-Ray Observations of Short-lived Episodes of Electron Acceleration in a Solar Microflare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...884...63C/abstract Chen et al. (2019), ApJ, 884, 63] ''Radio Spectroscopic Imaging of a Solar Flare Termination Shock: Split-band Feature as Evidence for Shock Compression''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...872...71Y/abstract Yu &amp;amp; Chen (2019), ApJ, 872, 71] ''Possible Detection of Subsecond-period Propagating Magnetohydrodynamics Waves in Post-reconnection Magnetic Loops during a Two-ribbon Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2018ApJ...866...62C/abstract Chen et al. (2018), ApJ, 866, 62] ''Magnetic Reconnection Null Points as the Origin of Semirelativistic Electron Beams in a Solar Jet&lt;br /&gt;
''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2017ApJ...848...77W/abstract Wang et al. (2016), ApJ, 848, 77] ''Dynamic Spectral Imaging of Decimetric Fiber Bursts in an Eruptive Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2015Sci...350.1238C/abstract Chen et al. (2015), Science, 350, 1238] ''Particle acceleration by a solar flare termination shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2014ApJ...794..149C/abstract Chen et al. (2014), ApJ, 794, 149] ''Direct Evidence of an Eruptive, Filament-hosting Magnetic Flux Rope Leading to a Fast Solar Coronal Mass Ejection''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2013ApJ...763L..21C/abstract Chen et al. (2013), ApJL, 763, 21] ''Tracing Electron Beams in the Sun's Corona with Radio Dynamic Imaging Spectroscopy''&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6543</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6543"/>
		<updated>2022-07-07T08:41:18Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. The process to add rsa keys to access gues@ovsa is slightly complicated. Please contact Dale for the set up. &lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac, the guest account will be used for people to log in as Tohban.  Rather than using a password, access will be tied to specific computers that you use.  One needs to generate a public + private ssh key pair using ssh-keygen or equivalent program that will result in a public key (plain text) file called id_rsa.pub, created in your ~/.ssh folder, the contents of which can be emailed to Dale or Owen to be added under &amp;quot;authorized keys&amp;quot;. The ssh commands can then be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### will not ask for a password for your computer's authorized key ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown in Figure 1 ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|thumb|right|300px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|400px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the steps below to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                             ###spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|right|300px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']    ###Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|right|300px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons. See Figure 4.&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf.G0.png|thumb|right|300px|Figure 5: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|right|300px|Figure 6: Phase after self-calibration]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                      # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                     # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                    # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                           # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                             # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                             #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                            # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                            #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                               # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|right|300px|Figure 7: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|right|300px|Figure 8: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                   # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                         # gs = gridspec.GridSpec(5, 10)       # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/07/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6542</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6542"/>
		<updated>2022-07-07T08:38:13Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. The process to add rsa keys to access gues@ovsa is slightly complicated. Please contact Dale for the set up. &lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac, the guest account will be used for people to log in as Tohban.  Rather than using a password, access will be tied to specific computers that you use.  One needs to generate a public + private ssh key pair using ssh-keygen or equivalent program that will result in a public key (plain text) file called id_rsa.pub, created in your ~/.ssh folder, the contents of which can be emailed to Dale or Owen to be added under &amp;quot;authorized keys&amp;quot;. The ssh commands can then be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### will not ask for a password for your computer's authorized key ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown in Figure 1 ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|thumb|right|300px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|400px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the steps below to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                             ###spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|right|300px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']    ###Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|right|300px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons. See Figure 4.&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf.G0.png|thumb|right|300px|Figure 5: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|right|300px|Figure 6: Phase after self-calibration]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                      # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                     # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                    # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                           # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                             # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                             #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                            # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                            #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                               # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|right|300px|Figure 7: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|right|300px|Figure 8: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                   # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                         # gs = gridspec.GridSpec(5, 10)       # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/06/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6541</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6541"/>
		<updated>2022-07-07T08:36:58Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac, the guest account will be used for people to log in as Tohban.  Rather than using a password, access will be tied to specific computers that you use.  One needs to generate a public + private ssh key pair using ssh-keygen or equivalent program that will result in a public key (plain text) file called id_rsa.pub, created in your ~/.ssh folder, the contents of which can be emailed to Dale or Owen to be added under &amp;quot;authorized keys&amp;quot;. The ssh commands can then be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### will not ask for a password for your computer's authorized key ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown in Figure 1 ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|thumb|right|300px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|400px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the steps below to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                             ###spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|right|300px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']    ###Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|right|300px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons. See Figure 4.&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf.G0.png|thumb|right|300px|Figure 5: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|right|300px|Figure 6: Phase after self-calibration]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                      # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                     # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                    # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                           # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                             # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                             #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                            # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                            #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                               # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|right|300px|Figure 7: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|right|300px|Figure 8: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                   # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                         # gs = gridspec.GridSpec(5, 10)       # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/06/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6531</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6531"/>
		<updated>2022-07-07T08:22:34Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown in Figure 1 ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|thumb|right|300px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|400px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the steps below to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|right|300px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|right|300px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons. See Figure 4.&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf.G0.png|thumb|right|300px|Figure 5: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|right|300px|Figure 6: Phase after self-calibration]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|right|300px|Figure 7: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|right|300px|Figure 8: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/06/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6377</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6377"/>
		<updated>2022-07-06T11:47:22Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown in Figure 1 ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|thumb|right|250px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|400px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the steps below to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|right|250px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|right|250px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons. See Figure 4.&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf.G0.png|thumb|right|250px|Figure 5: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|right|250px|Figure 6: Phase after self-calibration]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|right|250px|Figure 7: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|right|250px|Figure 8: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/06/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6376</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6376"/>
		<updated>2022-07-06T11:36:33Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown in Figure 1 ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|thumb|right|250px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|right|250px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the steps below to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|right|250px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|right|250px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons. See Figure 4.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|right|250px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|right|250px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|right|250px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|right|250px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/06/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6375</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6375"/>
		<updated>2022-07-06T11:34:13Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown in Figure 1 ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|thumb|right|250px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|right|250px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the steps below to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|right|250px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|right|250px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|right|250px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|right|250px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|right|250px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|right|250px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/06/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6374</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6374"/>
		<updated>2022-07-06T11:27:29Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|thumb|right|350px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/06/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6373</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6373"/>
		<updated>2022-07-06T11:24:21Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
bash&lt;br /&gt;
loadcasa5&lt;br /&gt;
suncasa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/06/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6372</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6372"/>
		<updated>2022-07-06T11:21:37Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 07/06/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6371</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6371"/>
		<updated>2022-07-06T11:20:56Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. &lt;br /&gt;
With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password. Next, ssh into inti.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@afsaccess3.njit.edu                                                           ###Insert UCID password if prompted###&lt;br /&gt;
&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the C:\Program Files\Git\etc\ssh\ssh_config file:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User UCID                                                                                  ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:'''When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For sufficient disk space to analyze EOVSA data on Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, please ask Sijie to set one up.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Both CASA 5 and 6 are available on Inti.''' &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
&lt;br /&gt;
To load CASA 5:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To load CASA 6:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; bash&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) need to be transferred from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
To directly transfer your calibrated .ms data from the Pipeline to Inti:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal. Change to your working directory (where you need the data transferred) and give the following command:&lt;br /&gt;
&lt;br /&gt;
scp -v -C -r -P 8888 PipelineUSERNAME@localhost:PATH/TO/MSFILE ./&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Calibration and Imaging===&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 06/29/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6370</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6370"/>
		<updated>2022-07-06T10:41:25Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;py&amp;quot;&amp;gt;&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One needs to transfer the created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
=== Connection details to Inti server ===&lt;br /&gt;
For Windows, on Mobaxterm,&lt;br /&gt;
&lt;br /&gt;
#With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password.&lt;br /&gt;
#ssh -X UCID@inti.hpcnet.campus.njit.edu &lt;br /&gt;
&lt;br /&gt;
To avoid typing the full inti address each time you attempt for ssh, you may wish to add the following lines with your username to C:\Program Files\Git\etc\ssh\ssh_config on Windows and /.ssh/config on Mac and Linux machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User USERNAME                                                                                              ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have sufficient disk space with EOVSA data analysis over Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, Please take help from Sijie in creating one. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Linux or Mac machine,&lt;br /&gt;
ssh -X UCID@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
For directly transferring your calibrated .ms data between the Pipeline and Inti servers, follow the below given steps. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal.&lt;br /&gt;
&lt;br /&gt;
Change to your working directory and give this command to copy your data on Pipeline.&lt;br /&gt;
scp -v -C -r -P 8888 USERNAMEofPipeline@localhost:PATHofMSDATA/MSfilename ./&lt;br /&gt;
Eg: scp -v -C -r -P 8888 shaheda@localhost:/data1/shaheda/IDB20220118173922_cal.ms ./&lt;br /&gt;
where, MSfilename, PATHofMSDATA are your .ms data and its path on Pipeline machine.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can follow the below procedure to do the transfer.&lt;br /&gt;
&lt;br /&gt;
For Windows, on mobaxterm, drag and drop the ms file to your local machine or use scp command as given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C userid@pipeline:/your/folder/msfile /localmachine/destination/folder/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On mobaxterm and on your local terminal, use the following command to finally copy the ms file to Inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C /localmachine/destination/folder/msfile UCID@inti.hpcnet.campus.njit.edu:/inti/data/users/YOURDIRECTORY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mac and Linux, SCP can be used in the same way. Add the following lines to your SSH config file, to bypass ovsa.njit.edu from copying.&lt;br /&gt;
vi ~/.ssh/config&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User userid&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software details on the servers ===&lt;br /&gt;
On Inti,&lt;br /&gt;
when logging in for the first time, please add the following lines to your accounts ~/.bashrc file.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;vi ~/.bashrc  &lt;br /&gt;
Insert the text given below and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both CASA 5 and 6 are available on Inti. &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
To load CASA 5, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to load CASA 6, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, for example, to use clean, first start ipython as given above, then type in &amp;gt;&amp;gt;from casatasks import tclean&lt;br /&gt;
&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 06/29/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6369</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6369"/>
		<updated>2022-07-06T10:41:10Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pyt&amp;quot;&amp;gt;&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One needs to transfer the created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
=== Connection details to Inti server ===&lt;br /&gt;
For Windows, on Mobaxterm,&lt;br /&gt;
&lt;br /&gt;
#With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password.&lt;br /&gt;
#ssh -X UCID@inti.hpcnet.campus.njit.edu &lt;br /&gt;
&lt;br /&gt;
To avoid typing the full inti address each time you attempt for ssh, you may wish to add the following lines with your username to C:\Program Files\Git\etc\ssh\ssh_config on Windows and /.ssh/config on Mac and Linux machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User USERNAME                                                                                              ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have sufficient disk space with EOVSA data analysis over Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, Please take help from Sijie in creating one. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Linux or Mac machine,&lt;br /&gt;
ssh -X UCID@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
For directly transferring your calibrated .ms data between the Pipeline and Inti servers, follow the below given steps. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal.&lt;br /&gt;
&lt;br /&gt;
Change to your working directory and give this command to copy your data on Pipeline.&lt;br /&gt;
scp -v -C -r -P 8888 USERNAMEofPipeline@localhost:PATHofMSDATA/MSfilename ./&lt;br /&gt;
Eg: scp -v -C -r -P 8888 shaheda@localhost:/data1/shaheda/IDB20220118173922_cal.ms ./&lt;br /&gt;
where, MSfilename, PATHofMSDATA are your .ms data and its path on Pipeline machine.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can follow the below procedure to do the transfer.&lt;br /&gt;
&lt;br /&gt;
For Windows, on mobaxterm, drag and drop the ms file to your local machine or use scp command as given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C userid@pipeline:/your/folder/msfile /localmachine/destination/folder/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On mobaxterm and on your local terminal, use the following command to finally copy the ms file to Inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C /localmachine/destination/folder/msfile UCID@inti.hpcnet.campus.njit.edu:/inti/data/users/YOURDIRECTORY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mac and Linux, SCP can be used in the same way. Add the following lines to your SSH config file, to bypass ovsa.njit.edu from copying.&lt;br /&gt;
vi ~/.ssh/config&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User userid&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software details on the servers ===&lt;br /&gt;
On Inti,&lt;br /&gt;
when logging in for the first time, please add the following lines to your accounts ~/.bashrc file.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;vi ~/.bashrc  &lt;br /&gt;
Insert the text given below and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both CASA 5 and 6 are available on Inti. &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
To load CASA 5, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to load CASA 6, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, for example, to use clean, first start ipython as given above, then type in &amp;gt;&amp;gt;from casatasks import tclean&lt;br /&gt;
&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 06/29/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6368</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6368"/>
		<updated>2022-07-06T10:02:57Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used directly through the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                    {{font color|red|This text is different}} ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the ~/.ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc (on the inti server) file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config (on local machine) file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py (within pipeline) file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to Step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'                            ### Set the path/name for the concatenated files ###&lt;br /&gt;
&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)           &lt;br /&gt;
                                                                                            ### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below ###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
For a single .ms file from Step 1, this will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')                                                                ### Append '_cal' to the ms filename ###&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')         ### Split the corrected column to the new 'caled' ms ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One needs to transfer the created 'caled' ms data files (xxx_concat_cal.ms or xxx_cal.ms) from pipeline to inti server, which has all the casa tasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
=== Connection details to Inti server ===&lt;br /&gt;
For Windows, on Mobaxterm,&lt;br /&gt;
&lt;br /&gt;
#With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password.&lt;br /&gt;
#ssh -X UCID@inti.hpcnet.campus.njit.edu &lt;br /&gt;
&lt;br /&gt;
To avoid typing the full inti address each time you attempt for ssh, you may wish to add the following lines with your username to C:\Program Files\Git\etc\ssh\ssh_config on Windows and /.ssh/config on Mac and Linux machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User USERNAME                                                                                              ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have sufficient disk space with EOVSA data analysis over Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, Please take help from Sijie in creating one. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Linux or Mac machine,&lt;br /&gt;
ssh -X UCID@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
For directly transferring your calibrated .ms data between the Pipeline and Inti servers, follow the below given steps. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal.&lt;br /&gt;
&lt;br /&gt;
Change to your working directory and give this command to copy your data on Pipeline.&lt;br /&gt;
scp -v -C -r -P 8888 USERNAMEofPipeline@localhost:PATHofMSDATA/MSfilename ./&lt;br /&gt;
Eg: scp -v -C -r -P 8888 shaheda@localhost:/data1/shaheda/IDB20220118173922_cal.ms ./&lt;br /&gt;
where, MSfilename, PATHofMSDATA are your .ms data and its path on Pipeline machine.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can follow the below procedure to do the transfer.&lt;br /&gt;
&lt;br /&gt;
For Windows, on mobaxterm, drag and drop the ms file to your local machine or use scp command as given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C userid@pipeline:/your/folder/msfile /localmachine/destination/folder/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On mobaxterm and on your local terminal, use the following command to finally copy the ms file to Inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C /localmachine/destination/folder/msfile UCID@inti.hpcnet.campus.njit.edu:/inti/data/users/YOURDIRECTORY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mac and Linux, SCP can be used in the same way. Add the following lines to your SSH config file, to bypass ovsa.njit.edu from copying.&lt;br /&gt;
vi ~/.ssh/config&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User userid&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software details on the servers ===&lt;br /&gt;
On Inti,&lt;br /&gt;
when logging in for the first time, please add the following lines to your accounts ~/.bashrc file.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;vi ~/.bashrc  &lt;br /&gt;
Insert the text given below and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both CASA 5 and 6 are available on Inti. &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
To load CASA 5, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to load CASA 6, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, for example, to use clean, first start ipython as given above, then type in &amp;gt;&amp;gt;from casatasks import tclean&lt;br /&gt;
&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]                                              # spws=[str(s+1) for s in range(49)]   # For post-2020 data&lt;br /&gt;
antennas='0~12&amp;amp;0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna=antennas,&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='2~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas=antennas &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['2~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]  # Not used?&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna=antennas,&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))                              # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)                                    # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)                                   # spbg=max(int(sp)-2,0)               # For post-2020 data (50 spws)&lt;br /&gt;
                sped=min(int(sp)+2,30)                                  # sped=min(int(sp)+2,49)              # For post-2020 data (50 spws)  &lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
                ax.get_xaxis().set_visible(False)&lt;br /&gt;
                ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                plt.pause(0.5)                                         # Allows viewing of each image as it is plotted.&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:                                           # if sp &amp;lt; 0:                           # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_i = 1                                           #     sp_i = 0                         # For post-2020 data (50 spws)&lt;br /&gt;
                if sp_e &amp;gt; 30:                                          # if sp_e &amp;gt; 49:                        # For post-2020 data (50 spws)&lt;br /&gt;
                    sp_e = 30                                          #     sp_e = 49                        # For post-2020 data (50 spws)&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
        plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
            plt.pause(0.5)                                         # Allows viewing of the plot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))                                  # fig = plt.figure(figsize=(14, 7))   # For post-2020 data (50 spws)&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)                                        # gs = gridspec.GridSpec(5, 10)        # For post-2020 data (50 spws)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 06/29/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6192</id>
		<title>Guide to Upgrade SolarSoft(SSW)</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6192"/>
		<updated>2022-06-07T18:57:28Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide compiles all the (scattered) steps to upgrade SSW taken from different sources.&lt;br /&gt;
SSW upgrade using passive_ftp was stopped in August 2019. The current way to upgrade SSW is to use the WGET executable. If you have done an update on SSW since August 2019 and your system already has WGET, any further upgrade can be made by directly following the steps underlined [https://hesperia.gsfc.nasa.gov/rhessi3/docs/ssw_update_help.html here]. For Linux and MacOS you can check if you already have WGET by typing the command &amp;quot;which wget&amp;quot; in the bash shell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your system was not updated since August 2019, follow the steps below:&lt;br /&gt;
&lt;br /&gt;
=== MacOS ===&lt;br /&gt;
In order to perform the upgrade, you must be the owner of the SSW tree. If you do not have admin privileges, consider installing ssw in $HOME directory.&lt;br /&gt;
If you already have wget installed in your system, then '''skip to point 3'''.&lt;br /&gt;
'''Using homebrew'''&lt;br /&gt;
&lt;br /&gt;
To install homebrew, type the following command in the terminal:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
/usr/bin/ruby -e &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once homebrew is installed, you can simply install wget by using the following command:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
brew install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Using MacPorts'''&lt;br /&gt;
&lt;br /&gt;
Alternatively, wget can also be installed using MacPorts. Directions to install MacPorts for specific OS versions are given [https://www.macports.org/install.php here]&lt;br /&gt;
After installation, the following command will install wget:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
sudo port install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2. Prepare SSW to use wget for the first time ====&lt;br /&gt;
* Go to [http://www.lmsal.com/solarsoft/] and scroll all the way down to the SSW installation form.&lt;br /&gt;
* For &amp;quot;Installation Type&amp;quot;, select &amp;quot;Upgrade Existing&amp;quot;.&lt;br /&gt;
* For &amp;quot;Transfer Protocol&amp;quot;, select &amp;quot;curl&amp;quot;.&lt;br /&gt;
* Specify the existing path to SSW on your computer. (You can find it in your ~/.bashrc or ~/.cshrc)&lt;br /&gt;
* Click on &amp;quot;Generate Installation Script&amp;quot; and download it.&lt;br /&gt;
* If you are in the bash shell, please change to csh or tcsh, open the directory where the installation script was downloaded and run it&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
% tcsh&lt;br /&gt;
Execute the script using the C-Shell &lt;br /&gt;
% csh -f scriptname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 3. Upgrade SSW ====&lt;br /&gt;
* While in SSWIDL type:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /loud , /spawn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will update all the SSW branches listed in the SSW_INSTR environment variable (as well as their dependencies, and always includes gen and packages/binaries). This most likely will not update every branch in your SSW tree since you probably run SSW with a subset of branches activated.&lt;br /&gt;
* To upgrade specific branches, type for example&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /lasco, /spawn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Possible Errors =====&lt;br /&gt;
* '''Error: bash:wget command not found''': Indicates that wget was installed using bash and csh/tcsh is not able to locate it. To resolve, simply give the path to wget in the upgrade command&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /loud, /spawn, wget = 'path/to/wget'                          &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''RD_TFILE: No file: /usr/local/ssw/site/mirror/ssw_upgrade.mirror''': check if the &amp;quot;'''/spawn'''&amp;quot; keyword has been missed&lt;br /&gt;
&lt;br /&gt;
* '''Other errors with WGET ''': Sometimes using an older version of wget gives errors during SSW_upgrade, in this case add the keyword &amp;quot;'''/lmsal'''&amp;quot; to the upgrade command. This allows use of older wget versions.&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6147</id>
		<title>Guide to Upgrade SolarSoft(SSW)</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6147"/>
		<updated>2022-04-05T22:07:00Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide compiles all the (scattered) steps to upgrade SSW taken from different sources.&lt;br /&gt;
SSW upgrade using passive_ftp was stopped in August 2019. The current way to upgrade SSW is to use the WGET executable. If you have done an update on SSW since August 2019 and your system already has WGET, any further upgrade can be made by directly following the steps underlined [https://hesperia.gsfc.nasa.gov/rhessi3/docs/ssw_update_help.html here]. For Linux and MacOS you can check if you already have WGET by typing the command &amp;quot;which wget&amp;quot; in the bash shell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your system was not updated since August 2019, follow the steps below:&lt;br /&gt;
&lt;br /&gt;
=== MacOS ===&lt;br /&gt;
In order to perform the upgrade, you must be the owner of the SSW tree. &lt;br /&gt;
If you already have wget installed in your system, then '''skip to point 3'''.&lt;br /&gt;
'''Using homebrew'''&lt;br /&gt;
&lt;br /&gt;
To install homebrew, type the following command in the terminal:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
/usr/bin/ruby -e &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once homebrew is installed, you can simply install wget by using the following command:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
brew install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Using MacPorts'''&lt;br /&gt;
&lt;br /&gt;
Alternatively, wget can also be installed using MacPorts. Directions to install MacPorts for specific OS versions are given [https://www.macports.org/install.php here]&lt;br /&gt;
After installation, the following command will install wget:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
sudo port install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2. Prepare SSW to use wget for the first time ====&lt;br /&gt;
* Go to [http://www.lmsal.com/solarsoft/] and scroll all the way down to the SSW installation form.&lt;br /&gt;
* For &amp;quot;Installation Type&amp;quot;, select &amp;quot;Upgrade Existing&amp;quot;.&lt;br /&gt;
* For &amp;quot;Transfer Protocol&amp;quot;, select &amp;quot;curl&amp;quot;.&lt;br /&gt;
* Specify the existing path to SSW on your computer. (You can find it in your ~/.bashrc or ~/.cshrc)&lt;br /&gt;
* Click on &amp;quot;Generate Installation Script&amp;quot; and download it.&lt;br /&gt;
* If you are in the bash shell, please change to csh or tcsh, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
% tcsh&lt;br /&gt;
Execute the script using the C-Shell &lt;br /&gt;
% csh -f scriptname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 3. Upgrade SSW ====&lt;br /&gt;
* While in SSWIDL type:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /loud , /spawn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will update all the SSW branches listed in the SSW_INSTR environment variable (as well as their dependencies, and always includes gen and packages/binaries). This most likely will not update every branch in your SSW tree since you probably run SSW with a subset of branches activated.&lt;br /&gt;
* To upgrade specific branches, type for example&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /lasco, /spawn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Possible Errors =====&lt;br /&gt;
* '''Error: bash:wget command not found''': Indicates that wget was installed using bash and csh/tcsh is not able to locate it. To resolve, simply give the path to wget in the upgrade command&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /loud, /spawn, wget = 'path/to/wget'                          &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''RD_TFILE: No file: /usr/local/ssw/site/mirror/ssw_upgrade.mirror''': check if the &amp;quot;'''/spawn'''&amp;quot; keyword has been missed&lt;br /&gt;
&lt;br /&gt;
* '''Other errors with WGET ''': Sometimes using an older version of wget gives errors during SSW_upgrade, in this case add the keyword &amp;quot;'''/lmsal'''&amp;quot; to the upgrade command. This allows use of older wget versions.&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6146</id>
		<title>Guide to Upgrade SolarSoft(SSW)</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6146"/>
		<updated>2022-04-05T22:02:21Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide compiles all the (scattered) steps to upgrade SSW taken from different sources.&lt;br /&gt;
SSW upgrade using passive_ftp was stopped in August 2019. The current way to upgrade SSW is to use the WGET executable. If you have done an update on SSW since August 2019 and your system already has WGET, any further upgrade can be made by directly following the steps underlined [https://hesperia.gsfc.nasa.gov/rhessi3/docs/ssw_update_help.html here]. For Linux and MacOS you can check if you already have WGET by typing the command &amp;quot;which wget&amp;quot; in the bash shell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your system was not updated since August 2019, follow the steps below:&lt;br /&gt;
&lt;br /&gt;
=== MacOS ===&lt;br /&gt;
In order to perform the upgrade, you must be the owner of the SSW tree.&lt;br /&gt;
==== 1. Installing wget ====&lt;br /&gt;
'''USING HOMEBREW'''&lt;br /&gt;
&lt;br /&gt;
To install homebrew, type the following command in the terminal:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
/usr/bin/ruby -e &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once homebrew is installed, you can simply install wget by using the following command:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
brew install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''USING MacPorts'''&lt;br /&gt;
&lt;br /&gt;
Alternatively, wget can also be installed using MacPorts. Directions to install MacPorts for specific OS versions are given [https://www.macports.org/install.php here]&lt;br /&gt;
After installation, the following command will install wget:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
sudo port install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2. Prepare SSW to use wget for the first time ====&lt;br /&gt;
* Go to [http://www.lmsal.com/solarsoft/] and scroll all the way down to the SSW installation form.&lt;br /&gt;
* For &amp;quot;Installation Type&amp;quot;, select &amp;quot;Upgrade Existing&amp;quot;.&lt;br /&gt;
* For &amp;quot;Transfer Protocol&amp;quot;, select &amp;quot;curl&amp;quot;.&lt;br /&gt;
* Specify the existing path to SSW on your computer. (You can find it in your ~/.bashrc or ~/.cshrc)&lt;br /&gt;
* Click on &amp;quot;Generate Installation Script&amp;quot; and download it.&lt;br /&gt;
* If you are in the bash shell, please change to csh or tcsh, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
% tcsh&lt;br /&gt;
Execute the script using the C-Shell &lt;br /&gt;
% csh -f scriptname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 3. Upgrade SSW ====&lt;br /&gt;
* While in SSWIDL type:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /loud , /spawn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will update all the SSW branches listed in the SSW_INSTR environment variable (as well as their dependencies, and always includes gen and packages/binaries). This most likely will not update every branch in your SSW tree since you probably run SSW with a subset of branches activated.&lt;br /&gt;
* To upgrade specific branches, type for example&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /lasco, /spawn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Possible Errors =====&lt;br /&gt;
* '''Error: bash:wget command not found''': Indicates that wget was installed using bash and csh/tcsh is not able to locate it. To resolve, simply give the path to wget in the upgrade command&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /loud, /spawn, wget = 'path/to/wget'                          &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''RD_TFILE: No file: /usr/local/ssw/site/mirror/ssw_upgrade.mirror''': check if the &amp;quot;'''/spawn'''&amp;quot; keyword has been missed&lt;br /&gt;
&lt;br /&gt;
* '''Other errors with WGET ''': Sometimes using an older version of wget gives errors during SSW_upgrade, in this case add the keyword &amp;quot;'''/lmsal'''&amp;quot; to the upgrade command. This allows use of older wget versions.&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6145</id>
		<title>Guide to Upgrade SolarSoft(SSW)</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6145"/>
		<updated>2022-04-05T22:01:35Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide compiles all the (scattered) steps to upgrade SSW taken from different sources.&lt;br /&gt;
SSW upgrade using passive_ftp was stopped in August 2019. The current way to upgrade SSW is to use the WGET executable. If you have done an update on SSW since August 2019 and your system already has WGET, any further upgrade can be made by directly following the steps underlined [https://hesperia.gsfc.nasa.gov/rhessi3/docs/ssw_update_help.html here]. For Linux and MacOS you can check if you already have WGET by typing the command &amp;quot;which wget&amp;quot; in the bash shell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your system was not updated since August 2019, follow the steps below:&lt;br /&gt;
&lt;br /&gt;
=== MacOS ===&lt;br /&gt;
In order to perform the upgrade, you must be the owner of the SSW tree.&lt;br /&gt;
==== 1. Installing wget ====&lt;br /&gt;
'''USING HOMEBREW'''&lt;br /&gt;
&lt;br /&gt;
To install homebrew, type the following command in the terminal:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
/usr/bin/ruby -e &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once homebrew is installed, you can simply install wget by using the following command:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
brew install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''USING MacPorts'''&lt;br /&gt;
&lt;br /&gt;
Alternatively, wget can also be installed using MacPorts. Directions to install MacPorts for specific OS versions are given [https://www.macports.org/install.php here]&lt;br /&gt;
After installation, the following command will install wget:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
sudo port install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2. Prepare SSW to use wget for the first time ====&lt;br /&gt;
* Go to [http://www.lmsal.com/solarsoft/] and scroll all the way down to the SSW installation form.&lt;br /&gt;
* For &amp;quot;Installation Type&amp;quot;, select &amp;quot;Upgrade Existing&amp;quot;.&lt;br /&gt;
* For &amp;quot;Transfer Protocol&amp;quot;, select &amp;quot;curl&amp;quot;.&lt;br /&gt;
* Specify the existing path to SSW on your computer. (You can find it in your ~/.bashrc or ~/.cshrc)&lt;br /&gt;
* Click on &amp;quot;Generate Installation Script&amp;quot; and download it.&lt;br /&gt;
* If you are in the bash shell, please change to csh or tcsh, &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
% tcsh&lt;br /&gt;
Execute the script using the C-Shell &lt;br /&gt;
% csh -f scriptname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 3. Upgrade SSW ====&lt;br /&gt;
* While in SSWIDL type:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /loud , /spawn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will update all the SSW branches listed in the SSW_INSTR environment variable (as well as their dependencies, and always includes gen and packages/binaries). This most likely will not update every branch in your SSW tree since you probably run SSW with a subset of branches activated.&lt;br /&gt;
* To upgrade specific branches, type for example&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /lasco, /spawn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Possible Errors =====&lt;br /&gt;
* '''Error: bash:wget command not found''': Indicates that wget was installed using bash and csh/tcsh is not able to locate it. To resolve, simply give the path to wget in the upgrade command&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
ssw_upgrade, /loud, /spawn, wget = 'path/to/wget'                          &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''RD_TFILE: No file: /usr/local/ssw/site/mirror/ssw_upgrade.mirror''': check if the &amp;quot;''/spawn''&amp;quot; keyword has been missed&lt;br /&gt;
&lt;br /&gt;
* '''Other errors with WGET ''': Sometimes using an older version of wget gives errors during SSW_upgrade, in this case add the keyword &amp;quot;''/lmsal''&amp;quot; to the upgrade command. This allows use of older wget versions.&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6141</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6141"/>
		<updated>2022-04-04T13:49:42Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the .ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc file in order to use CASA on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw (IDB) data on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #######&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
##########################################################################&lt;br /&gt;
&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
# This is to set the path/name for the concatenated files&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)&lt;br /&gt;
### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below ###&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Split the concatenated .ms and replace data column by the 'corrected' data. Append '_cal' to the concatenated .ms&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
This will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
# Append '_cal' to the ms filename and split the corrected column to the new caled ms&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One needs to transfer the created caled ms data files (xxx_concat_cal.ms or xxx_cal.ms) from pipeline to inti server, which has all the casatasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
=== Connection details to Inti server ===&lt;br /&gt;
For Windows, on Mobaxterm,&lt;br /&gt;
&lt;br /&gt;
#With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password.&lt;br /&gt;
#ssh -X UCID@inti.hpcnet.campus.njit.edu &lt;br /&gt;
&lt;br /&gt;
To avoid typing the full inti address each time you attempt for ssh, you may wish to add the following lines with your username to C:\Program Files\Git\etc\ssh\ssh_config on Windows and /.ssh/config on Mac and Linux machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User USERNAME                                                                                              ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have sufficient disk space with EOVSA data analysis over Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, Please take help from Sijie in creating one. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Linux or Mac machine,&lt;br /&gt;
ssh -X UCID@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
For directly transferring your calibrated .ms data between the Pipeline and Inti servers, follow the below given steps. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal.&lt;br /&gt;
&lt;br /&gt;
Change to your working directory and give this command to copy your data on Pipeline.&lt;br /&gt;
scp -v -C -r -P 8888 USERNAMEofPipeline@localhost:PATHofMSDATA/MSfilename ./&lt;br /&gt;
Eg: scp -v -C -r -P 8888 shaheda@localhost:/data1/shaheda/IDB20220118173922_cal.ms ./&lt;br /&gt;
where, MSfilename, PATHofMSDATA are your .ms data and its path on Pipeline machine.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can follow the below procedure to do the transfer.&lt;br /&gt;
&lt;br /&gt;
For Windows, on mobaxterm, drag and drop the ms file to your local machine or use scp command as given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C userid@pipeline:/your/folder/msfile /localmachine/destination/folder/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On mobaxterm and on your local terminal, use the following command to finally copy the ms file to Inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C /localmachine/destination/folder/msfile UCID@inti.hpcnet.campus.njit.edu:/inti/data/users/YOURDIRECTORY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mac and Linux, SCP can be used in the same way. Add the following lines to your SSH config file, to bypass ovsa.njit.edu from copying.&lt;br /&gt;
vi ~/.ssh/config&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User userid&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software details on the servers ===&lt;br /&gt;
On Inti,&lt;br /&gt;
when logging in for the first time, please add the following lines to your accounts ~/.bashrc file.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;vi ~/.bashrc  &lt;br /&gt;
Insert the text given below and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both CASA 5 and 6 are available on Inti. &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
To load CASA 5, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to load CASA 6, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, for example, to use clean, first start ipython as given above, then type in &amp;gt;&amp;gt;from casatasks import tclean&lt;br /&gt;
&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]&lt;br /&gt;
antennas='0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna='0~12',&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='1~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas='0~12' &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['1~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna='0~12',&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)&lt;br /&gt;
                sped=min(int(sp)+2,30)&lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
		ax.get_xaxis().set_visible(False)&lt;br /&gt;
		ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:&lt;br /&gt;
                    sp_i = 1&lt;br /&gt;
                if sp_e &amp;gt; 30:&lt;br /&gt;
                    sp_e = 30&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
	plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 03/29/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6136</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6136"/>
		<updated>2022-03-29T22:58:23Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ~/.ssh/config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the .ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc file in order to use the casa on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the ~/.ssh/config file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw data (IDB) on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer (as shown above) and '''start tcsh to run CASA'''.&lt;br /&gt;
&lt;br /&gt;
The following commands (run within CASA) can be used to import a single IDB file if the given time-range is less than 10 mins.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #####&lt;br /&gt;
outpath = './msdata/'                                                                      ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
######################################################&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add the following lines to your ~/.casa/init.py file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                           ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate multiple .ms files and Calibrate====&lt;br /&gt;
'''Follow this step if there are more than one .ms files for the chosen time-range. If not, move to step 3.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
# This is to set the path/name for the concatenated files&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)&lt;br /&gt;
### If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### &lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
This will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
# Append '_cal' to the ms filename and split the corrected column to the new caled ms&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One needs to transfer the created caled ms data files (xxx_concat_cal.ms or xxx_cal.ms) from pipeline to inti server, which has all the casatasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
=== Connection details to Inti server ===&lt;br /&gt;
For Windows, on Mobaxterm,&lt;br /&gt;
&lt;br /&gt;
#With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password.&lt;br /&gt;
#ssh -X UCID@inti.hpcnet.campus.njit.edu &lt;br /&gt;
&lt;br /&gt;
To avoid typing the full inti address each time you attempt for ssh, you may wish to add the following lines with your username to C:\Program Files\Git\etc\ssh\ssh_config on Windows and /.ssh/config on Mac and Linux machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User USERNAME                                                                                              ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have sufficient disk space with EOVSA data analysis over Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, Please take help from Sijie in creating one. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Linux or Mac machine,&lt;br /&gt;
ssh -X UCID@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
For directly transferring your calibrated .ms data between the Pipeline and Inti servers, follow the below given steps. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal.&lt;br /&gt;
&lt;br /&gt;
Change to your working directory and give this command to copy your data on Pipeline.&lt;br /&gt;
scp -v -C -r -P 8888 USERNAMEofPipeline@localhost:PATHofMSDATA/MSfilename ./&lt;br /&gt;
Eg: scp -v -C -r -P 8888 shaheda@localhost:/data1/shaheda/IDB20220118173922_cal.ms ./&lt;br /&gt;
where, MSfilename, PATHofMSDATA are your .ms data and its path on Pipeline machine.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can follow the below procedure to do the transfer.&lt;br /&gt;
&lt;br /&gt;
For Windows, on mobaxterm, drag and drop the ms file to your local machine or use scp command as given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C userid@pipeline:/your/folder/msfile /localmachine/destination/folder/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On mobaxterm and on your local terminal, use the following command to finally copy the ms file to Inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C /localmachine/destination/folder/msfile UCID@inti.hpcnet.campus.njit.edu:/inti/data/users/YOURDIRECTORY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mac and Linux, SCP can be used in the same way. Add the following lines to your SSH config file, to bypass ovsa.njit.edu from copying.&lt;br /&gt;
vi ~/.ssh/config&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User userid&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software details on the servers ===&lt;br /&gt;
On Inti,&lt;br /&gt;
when logging in for the first time, please add the following lines to your accounts ~/.bashrc file.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;vi ~/.bashrc  &lt;br /&gt;
Insert the text given below and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both CASA 5 and 6 are available on Inti. &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
To load CASA 5, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to load CASA 6, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, for example, to use clean, first start ipython as given above, then type in &amp;gt;&amp;gt;from casatasks import tclean&lt;br /&gt;
&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]&lt;br /&gt;
antennas='0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna='0~12',&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='1~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas='0~12' &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['1~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna='0~12',&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)&lt;br /&gt;
                sped=min(int(sp)+2,30)&lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
		ax.get_xaxis().set_visible(False)&lt;br /&gt;
		ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:&lt;br /&gt;
                    sp_i = 1&lt;br /&gt;
                if sp_e &amp;gt; 30:&lt;br /&gt;
                    sp_e = 30&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
	plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 03/29/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6135</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z V2</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z_V2&amp;diff=6135"/>
		<updated>2022-03-29T22:42:11Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: Created page with &amp;quot;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
=== Pre-requisites === &lt;br /&gt;
Accounts on Pipeline and Inti or Baozi servers. Sijie and Bin can help with the account set-up for pipeline, inti and boazi. &lt;br /&gt;
&lt;br /&gt;
==== How to connect to pipeline ====&lt;br /&gt;
'''Windows:''' On a windows machine Mobaxterm can be used to connect to Pipeline. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh commands can be used: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -L 5902:helios.solar.pvt:20000 guest@ovsa.njit.edu                                     ### when prompted, enter password to guest@ovsa ###&lt;br /&gt;
ssh -XY your_username@pipeline                                                             ### add your username and enter password to your pipeline account, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, to avoid typing the longer commands, proxy commands can be added to the ssh config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host *&lt;br /&gt;
        ForwardX11 yes&lt;br /&gt;
&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User your_username                                                                 ### Insert your pipeline username here ###&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upon saving the .ssh/config file and restarting the terminal, you can connect to pipeline directly using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY pipeline&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== How to connect to the inti server ====&lt;br /&gt;
NOTE: To connect to inti you must have a NJIT UCID. The arcs have granted access to inti for all SRG members. If you encounter any issue with the login. Please let arcs folks (arcs@njit.edu) know.&lt;br /&gt;
&lt;br /&gt;
'''Windows:''' As mentioned above, on a windows machine Mobaxterm can be used to connect to inti. For details, see ...&lt;br /&gt;
&lt;br /&gt;
'''Linux/Unix:''' On a linux/Mac the ssh command can be used:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY UCID@inti.hpcnet.campus.njit.edu                                                   ### insert UCID here and enter your NJIT UCID password, when prompted ### &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When logging in for the first time, please add the following lines (demarcated by #) in your ~/.bashrc file in order to use the casa on inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Proxy commands for inti can also be added to the .ssh/config file for convenience: &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vim ~/.ssh/config                                                                          ### press 'i' to insert content and esc +':wq' to write and quit ###&lt;br /&gt;
&lt;br /&gt;
Host inti&lt;br /&gt;
        Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
        User UCID                                                                          ### insert NJIT UCID here ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
after the proxy is set up, connect to inti by simply typing:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
ssh -XY inti                                                                               ### enter your NJIT UCID password when prompted ###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Downloading data and Preliminary Calibration  === &lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw data (IDB) on Pipeline machine====&lt;br /&gt;
The initial downloading of data and applying refcal and phasecal to the .ms files is performed on the pipeline since the complete EOVSA SQL database is stored here for now.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer and start tcsh to run CASA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                              ###Change accordingly###&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #####&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
######################################################&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add following lines to your ~/.casa/init.py file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate all the 10 mins data, if there are any====&lt;br /&gt;
Follow this step if there are more than one .ms files, if not run step 3 directly. If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
# This is to set the path/name for the concatenated files&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
This will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
# Append '_cal' to the ms filename and split the corrected column to the new caled ms&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One needs to transfer the created caled ms data files (xxx_concat_cal.ms or xxx_cal.ms) from pipeline to inti server, which has all the casatasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
=== Connection details to Inti server ===&lt;br /&gt;
For Windows, on Mobaxterm,&lt;br /&gt;
&lt;br /&gt;
#With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password.&lt;br /&gt;
#ssh -X UCID@inti.hpcnet.campus.njit.edu &lt;br /&gt;
&lt;br /&gt;
To avoid typing the full inti address each time you attempt for ssh, you may wish to add the following lines with your username to C:\Program Files\Git\etc\ssh\ssh_config on Windows and /.ssh/config on Mac and Linux machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User USERNAME                                                                                              ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have sufficient disk space with EOVSA data analysis over Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, Please take help from Sijie in creating one. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Linux or Mac machine,&lt;br /&gt;
ssh -X UCID@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
For directly transferring your calibrated .ms data between the Pipeline and Inti servers, follow the below given steps. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal.&lt;br /&gt;
&lt;br /&gt;
Change to your working directory and give this command to copy your data on Pipeline.&lt;br /&gt;
scp -v -C -r -P 8888 USERNAMEofPipeline@localhost:PATHofMSDATA/MSfilename ./&lt;br /&gt;
Eg: scp -v -C -r -P 8888 shaheda@localhost:/data1/shaheda/IDB20220118173922_cal.ms ./&lt;br /&gt;
where, MSfilename, PATHofMSDATA are your .ms data and its path on Pipeline machine.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can follow the below procedure to do the transfer.&lt;br /&gt;
&lt;br /&gt;
For Windows, on mobaxterm, drag and drop the ms file to your local machine or use scp command as given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C userid@pipeline:/your/folder/msfile /localmachine/destination/folder/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On mobaxterm and on your local terminal, use the following command to finally copy the ms file to Inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C /localmachine/destination/folder/msfile UCID@inti.hpcnet.campus.njit.edu:/inti/data/users/YOURDIRECTORY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mac and Linux, SCP can be used in the same way. Add the following lines to your SSH config file, to bypass ovsa.njit.edu from copying.&lt;br /&gt;
vi ~/.ssh/config&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User userid&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software details on the servers ===&lt;br /&gt;
On Inti,&lt;br /&gt;
when logging in for the first time, please add the following lines to your accounts ~/.bashrc file.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;vi ~/.bashrc  &lt;br /&gt;
Insert the text given below and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both CASA 5 and 6 are available on Inti. &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
To load CASA 5, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to load CASA 6, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, for example, to use clean, first start ipython as given above, then type in &amp;gt;&amp;gt;from casatasks import tclean&lt;br /&gt;
&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]&lt;br /&gt;
antennas='0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna='0~12',&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='1~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas='0~12' &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['1~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna='0~12',&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)&lt;br /&gt;
                sped=min(int(sp)+2,30)&lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
		ax.get_xaxis().set_visible(False)&lt;br /&gt;
		ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:&lt;br /&gt;
                    sp_i = 1&lt;br /&gt;
                if sp_e &amp;gt; 30:&lt;br /&gt;
                    sp_e = 30&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
	plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Page Last Updated: 03/29/2022&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=6134</id>
		<title>Owens Valley Solar Arrays</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=6134"/>
		<updated>2022-03-29T21:47:32Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Tohbans */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Eovsa1.png|border|text-top|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;[http://ovsa.njit.edu/ EOVSA] (Expanded Owens Valley Solar Array) is a new solar-dedicated radio interferometer operated by the New Jersey Institute of Technology. This wiki serves as the site for EOVSA documentation.  &amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== EOVSA Documentation ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;General&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Downconversion and Frequency Tuning]]&lt;br /&gt;
** [[Dealing with Radio Frequency Interference]]&lt;br /&gt;
** [[Switching between 200 MHz and 300 MHz Correlator]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Computer-Network&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Computing Systems]]&lt;br /&gt;
** [[Network]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Control System&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[27-m Antenna Commands]]&lt;br /&gt;
** [[Schedule Commands]]&lt;br /&gt;
** [[Control Commands]]&lt;br /&gt;
** [[Attenuation and Level Control]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Hardware&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Hardware Overview]]&lt;br /&gt;
** [[2.1-m Antennas]]&lt;br /&gt;
** [[27-m Antennas]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;System Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Calibration Database]]&lt;br /&gt;
** [[Stateframe Database]]&lt;br /&gt;
** [[Create CASA measurement sets]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Calibration&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[Calibration Overview]]&lt;br /&gt;
**[[Pointing Calibration]]&lt;br /&gt;
**[[Total Power Calibration]]&lt;br /&gt;
**[[System Gain Calibration]]&lt;br /&gt;
**[[Antenna Position]] (Baseline Calibration)&lt;br /&gt;
**[[Reference Gain Calibration]]&lt;br /&gt;
**[[Daily Gain Calibration]]&lt;br /&gt;
**[[Delay Calibration]]&lt;br /&gt;
**[[Bandpass Calibration]]&lt;br /&gt;
**[[Polarization Calibration]]&lt;br /&gt;
**[[Calibrator Survey]]&lt;br /&gt;
**[[Practical Calibration Tutorial]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Starburst]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using EOVSA Data  ==&lt;br /&gt;
* &amp;lt;big&amp;gt;[[EOVSA Data products]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;Analysis Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [https://github.com/suncasa/suncasa SunCASA] A wrapper around [https://casa.nrao.edu/ CASA (the Common Astronomy Software Applications package)] for synthesis imaging and visualizing solar spectral imaging data. CASA is one of the leading software tool for &amp;quot;supporting the data post-processing needs of the next generation of radio astronomical telescopes such as ALMA and VLA&amp;quot;, an international effort led by the [https://public.nrao.edu/ National Radio Astronomy Observatory]. The current version of CASA uses Python (2.7) interface. More information about CASA can be found on [https://casa.nrao.edu/ NRAO's CASA website ]. Note, CASA is available ONLY on UNIX-BASED PLATFORMS (and therefore, so is SunCASA). &lt;br /&gt;
** [https://github.com/Gelu-Nita/GSFIT GSFIT] A IDL-widget(GUI)-based spectral fitting package called gsfit, which provides a user-friendly display of EOVSA image cubes and an interface to fast fitting codes (via platform-dependent shared-object libraries). &lt;br /&gt;
** [[Spectrogram Software]]&lt;br /&gt;
** [[Mapping Software]]&lt;br /&gt;
* &amp;lt;big&amp;gt;Data Analysis Guides&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL EOVSA Data Analysis Tutorial at RHESSI 19 Workshop]&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial]]&amp;lt;/big&amp;gt; at [http://rhessi18.umn.edu/ RHESSI XVIII Workshop]&lt;br /&gt;
** [[Self-Calibrating Flare Data]] Example script and guides for self-calibrating EOVSA flare data (to be completed)&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
**[[IDB flare pipeline]] Tutorial to run the flare pipeline for quicklook images&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;EOVSA Modeling Guide&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[GX Simulator]]&lt;br /&gt;
&lt;br /&gt;
* Other helpful links&lt;br /&gt;
** [https://casaguides.nrao.edu CASA Guides]&lt;br /&gt;
** [http://www.lmsal.com/solarsoft/ SolarSoft IDL]&lt;br /&gt;
** [http://www.atnf.csiro.au/computing/software/miriad/userguide/userhtml.html Miriad Guides]&lt;br /&gt;
** [https://sites.google.com/site/fgscodes/ Fast Gyrosynchrotron Codes (Alexey Kuznetsov's website)]&lt;br /&gt;
** [[Basic GitHub Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--* &amp;lt;big&amp;gt;[[EOVSA Imaging Workshop]]&amp;lt;/big&amp;gt;--&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Full Disk Simulations]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[All-Day Synthesis Issues]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Analyzing Pre-2017 Data]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Fixing Pipeline Problems pre-2021-Feb-07]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System Software ==&lt;br /&gt;
&lt;br /&gt;
* LabVIEW software&lt;br /&gt;
* Python code [https://github.com/dgary50/eovsa Github repository]&lt;br /&gt;
&lt;br /&gt;
== Observing Log ==&lt;br /&gt;
[[2016 November]]; [[2016 December| December]]&lt;br /&gt;
&lt;br /&gt;
[[2017 January]]; [[2017 February | February]]; [[2017 March | March]]; [[2017 April | April]]; [[2017 May | May]]; [[2017 June | June]];&lt;br /&gt;
[[2017 July | July]]; [[2017 August | August]]; [[2017 September | September]]; [[2017 October | October]]; [[2017 November | November]]; [[2017 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2018 January]]; [[2018 February | February]]; [[2018 March | March]]; [[2018 April | April]]; [[2018 May | May]]; [[2018 June | June]];&lt;br /&gt;
[[2018 July | July]]; [[2018 August | August]]; [[2018 September | September]]; [[2018 October | October]]; [[2018 November | November]]; [[2018 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2019 January]]; [[2019 February | February]]; [[2019 March | March]]; [[2019 April | April]]; [[2019 May | May]]; [[2019 June | June]];&lt;br /&gt;
[[2019 July | July]]; [[2019 August | August]]; [[2019 September | September]]; [[2019 October | October]]; [[2019 November | November]]; [[2019 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2020 January]]; [[2020 February | February]]; [[2020 March | March]]; [[2020 April | April]]; [[2020 May | May]]; [[2020 June | June]];&lt;br /&gt;
[[2020 July | July]]; [[2020 August | August]]; [[2020 September | September]]; [[2020 October | October]]; [[2020 November | November]]; [[2020 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2021 January]]; [[2021 February | February]]; [[2021 March | March]]; [[2021 April | April]]; [[2021 May | May]]; [[2021 June | June]];&lt;br /&gt;
[[2021 July | July]]; [[2021 August | August]]; [[2021 September | September]]; [[2021 October | October]]; [[2021 November | November]]; [[2021 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2022 SQL Outage]]&lt;br /&gt;
&lt;br /&gt;
== Tohbans ==&lt;br /&gt;
&lt;br /&gt;
[[Trouble Shooting Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Records]]&lt;br /&gt;
&lt;br /&gt;
[[Owen's Notes]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban EOVSA Imaging Tutorial A-Z]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban EOVSA Imaging Tutorial A-Z V2]]&lt;br /&gt;
&lt;br /&gt;
[[Guide to Upgrade SolarSoft(SSW)]]&lt;br /&gt;
&lt;br /&gt;
== EOVSA Flare List ==&lt;br /&gt;
&lt;br /&gt;
See [https://docs.google.com/spreadsheets/d/1P8jHuDRF93dMflU6RMQcsJqVepD9vFkPkofV8Imj4xA/edit?usp=sharing this link] for a list of EOVSA flares as a Google Spreadsheet. &lt;br /&gt;
&lt;br /&gt;
[[Recent Flare List (2021-)]]&lt;br /&gt;
&lt;br /&gt;
[http://ovsa.njit.edu/jay/rd_db.php An older link] is available at the EOVSA website.&lt;br /&gt;
&lt;br /&gt;
== EOVSA Publications ==&lt;br /&gt;
Here is a (partial) list of publications that utilize EOVSA data. See also the collection of EOVSA publications at [https://ui.adsabs.harvard.edu/public-libraries/eQ7HfPkySqydu-B8BCt6QQ this NASA/ADS Library].&lt;br /&gt;
; 2021&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021arXiv211015751L/abstract Lopez et al. (2021), arXiv 2110.15751] ''A solar flare driven by thermal conduction observed in mid-infrared''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...923..213W/abstract Wei et al. (2021), ApJ, 923, 213] ''Coronal Magnetic Field Measurements along a Partially Erupting Filament in a Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...919...44S/abstract Shaik &amp;amp; Gary (2021), ApJ, 919, 44] ''Implications of Flat Optically Thick Microwave Spectra in Solar Flares for Source Size and Morphology''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...915...12K/abstract Kocharov et al. (2021), ApJ, 915, 12] ''Multiple Sources of Solar High-energy Protons''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...908L..55C/abstract Chen et al. (2021), ApJL, 908, L55] ''Energetic Electron Distribution of the Coronal Acceleration Region: First results from Joint Microwave and Hard X-ray Imaging Spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...906..132C/abstract Chhabra et al. (2021), ApJ, 906, 132] ''Imaging Spectroscopy of CME-Associated Solar Radio Bursts''&lt;br /&gt;
; 2020&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...905..165R/abstract Reeves et al. (2020), ApJ, 905, 165] ''Hot Plasma Flows and Oscillations in the Loop-top Region During the September 10 2017 X8.2 Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...900...17Y/abstract Yu et al. (2020), ApJ, 900, 17] ''Magnetic Reconnection During the Post Impulsive Phase of the X8.2 Solar Flare: Bi-Directional Outflows as a Cause of Microwave and X-ray Bursts''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020NatAs...4.1140C/abstract Chen et al. (2020b), Nature Astronomy, 4, 1140] ''Measurement of magnetic field and relativistic electrons along a solar flare current sheet''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...895L..50C/abstract Chen et al. (2020a), ApJL, 895, 50] ''Microwave Spectral Imaging of an Erupting Magnetic Flux Rope: Implications for the Standard Solar Flare Model in Three Dimensions''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020FrASS...7...22K/abstract Kuroda et al. (2020), Frontiers, 7, 22] ''Evolution of Flare-accelerated Electrons Quantified by Spatially Resolved Analysis''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...891L..34G/abstract Glesener et al. (2020), ApJL, 891, 34] ''Accelerated Electrons Observed Down to &amp;lt;7 keV in a NuSTAR Solar Microflare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...889...72K/abstract Karlicky at al. (2020), ApJ, 889, 72] ''Drifting Pulsation Structure at the Very Beginning of the 2017 September 10 Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020Sci...367..278F/abstract Fleishman et al. (2020), Science, 367, 278] ''Decay of the coronal magnetic field can release sufficient energy to power a solar flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020AAS...23538501G/abstract Gary et al. (2020), BAAS 52, 385.01] [https://aas235-aas.ipostersessions.com/default.aspx?s=97-69-9E-4B-34-19-68-53-1B-C6-21-0C-16-1C-5C-82&amp;amp;guestview=true Direct link to AAS iPoster] ''A new view of the solar atmosphere: daily full-disk multifrequency radio images from EOVSA''&lt;br /&gt;
; 2018&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...864...63P/abstract Polito et al. (2018), ApJ, 864, 63] ''Broad Non-Gaussian Fe XXIV Line Profiles in the Impulsive Phase of the 2017 September 10 X8.3-class Flare Observed by Hinode/EIS''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...863...83G/abstract Gary et al. (2018), ApJ, 863, 83] ''Microwave and Hard X-Ray Observations of the 2017 September 10 Solar Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...852...32K/abstract Kuroda et al. (2018), ApJ, 852, 32] ''Three-dimensional Forward-fit Modeling of the Hard X-ray and the Microwave Emissions of the 2015 June 22 M6.5 flare''&lt;br /&gt;
; 2017&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2017NatAs...1E..85W/abstract Wang et al. (2017), Nature Astronomy, 1, 85] ''High-resolution observations of flare precursors in the low solar atmosphere''&lt;br /&gt;
; 2016&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2016JAI.....541009N/abstract Nita et al. (2016), J. Astron. Instr., 5, 1641009-7366] ''EOVSA Implementation of a Spectral Kurtosis Correlator for Transient Detection and Classification''&lt;br /&gt;
&lt;br /&gt;
== VLA Flare List and Publications ==&lt;br /&gt;
See [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey#List_of_Jansky_VLA_Solar_Observations this link] for a list of flare observations made by the [https://science.nrao.edu/facilities/vla/ Karl G. Jansky Very Large Array] (VLA). Below is a partial list of publications that utilize VLA solar data (see also [https://ui.adsabs.harvard.edu/public-libraries/ZwbjpLo9RS-viufWEoQ95Q this NASA/ADS Library]).&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...911....4L/abstract Luo et al. (2021), ApJ, 911, 4] ''Radio Spectral Imaging of an M8.4 Eruptive Solar Flare: Possible Evidence of a Termination Shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...910...40Z/abstract Zhang et al. (2021), ApJ, 910, 40] ''Multiwavelength Observations of the Formation and Eruption of a Complex Filament''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2020ApJ...904...94S/abstract Sharma et al. (2020), ApJ, 904, 94] ''Radio and X-Ray Observations of Short-lived Episodes of Electron Acceleration in a Solar Microflare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...884...63C/abstract Chen et al. (2019), ApJ, 884, 63] ''Radio Spectroscopic Imaging of a Solar Flare Termination Shock: Split-band Feature as Evidence for Shock Compression''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...872...71Y/abstract Yu &amp;amp; Chen (2019), ApJ, 872, 71] ''Possible Detection of Subsecond-period Propagating Magnetohydrodynamics Waves in Post-reconnection Magnetic Loops during a Two-ribbon Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2018ApJ...866...62C/abstract Chen et al. (2018), ApJ, 866, 62] ''Magnetic Reconnection Null Points as the Origin of Semirelativistic Electron Beams in a Solar Jet&lt;br /&gt;
''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2017ApJ...848...77W/abstract Wang et al. (2016), ApJ, 848, 77] ''Dynamic Spectral Imaging of Decimetric Fiber Bursts in an Eruptive Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2015Sci...350.1238C/abstract Chen et al. (2015), Science, 350, 1238] ''Particle acceleration by a solar flare termination shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2014ApJ...794..149C/abstract Chen et al. (2014), ApJ, 794, 149] ''Direct Evidence of an Eruptive, Filament-hosting Magnetic Flux Rope Leading to a Fast Solar Coronal Mass Ejection''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2013ApJ...763L..21C/abstract Chen et al. (2013), ApJL, 763, 21] ''Tracing Electron Beams in the Sun's Corona with Radio Dynamic Imaging Spectroscopy''&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z&amp;diff=6133</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z&amp;diff=6133"/>
		<updated>2022-03-29T21:46:28Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to download EOVSA IDB data, obtain and calibrate the measurement sets (.ms), and, transfer them to the inti server for self-calibration and further analysis. &lt;br /&gt;
&lt;br /&gt;
'''Pre-requisites:''' Accounts on Pipeline and Inti or Baozi servers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Connection details to pipeline server ===&lt;br /&gt;
One can use the Mobaxterm platform to connect to the Pipeline server through a Windows machine or use SSH through a Mac machine.&lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw data (IDB) on Pipeline machine====&lt;br /&gt;
On CASA of the Pipeline machine, which has the complete EOVSA SQL database.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer and start tcsh to run CASA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                               ###Change accordingly###&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #####&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
######################################################&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add following lines to your ~/.casa/init.py file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate all the 10 mins data, if there are any====&lt;br /&gt;
Follow this step if there are more than one .ms files, if not run step 3 directly. If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
# This is to set the path/name for the concatenated files&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
This will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
# Append '_cal' to the ms filename and split the corrected column to the new caled ms&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One needs to transfer the created caled ms data files (xxx_concat_cal.ms or xxx_cal.ms) from pipeline to inti server, which has all the casatasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
=== Connection details to Inti server ===&lt;br /&gt;
For Windows, on Mobaxterm,&lt;br /&gt;
&lt;br /&gt;
#With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password.&lt;br /&gt;
#ssh -X UCID@inti.hpcnet.campus.njit.edu &lt;br /&gt;
&lt;br /&gt;
To avoid typing the full inti address each time you attempt for ssh, you may wish to add the following lines with your username to C:\Program Files\Git\etc\ssh\ssh_config on Windows and /.ssh/config on Mac and Linux machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User USERNAME                                                                                              ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have sufficient disk space with EOVSA data analysis over Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, Please take help from Sijie in creating one. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Linux or Mac machine,&lt;br /&gt;
ssh -X UCID@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
For directly transferring your calibrated .ms data between the Pipeline and Inti servers, follow the below given steps. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal.&lt;br /&gt;
&lt;br /&gt;
Change to your working directory and give this command to copy your data on Pipeline.&lt;br /&gt;
scp -v -C -r -P 8888 USERNAMEofPipeline@localhost:PATHofMSDATA/MSfilename ./&lt;br /&gt;
Eg: scp -v -C -r -P 8888 shaheda@localhost:/data1/shaheda/IDB20220118173922_cal.ms ./&lt;br /&gt;
where, MSfilename, PATHofMSDATA are your .ms data and its path on Pipeline machine.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can follow the below procedure to do the transfer.&lt;br /&gt;
&lt;br /&gt;
For Windows, on mobaxterm, drag and drop the ms file to your local machine or use scp command as given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C userid@pipeline:/your/folder/msfile /localmachine/destination/folder/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On mobaxterm and on your local terminal, use the following command to finally copy the ms file to Inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C /localmachine/destination/folder/msfile UCID@inti.hpcnet.campus.njit.edu:/inti/data/users/YOURDIRECTORY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mac and Linux, SCP can be used in the same way. Add the following lines to your SSH config file, to bypass ovsa.njit.edu from copying.&lt;br /&gt;
vi ~/.ssh/config&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User userid&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software details on the servers ===&lt;br /&gt;
On Inti,&lt;br /&gt;
when logging in for the first time, please add the following lines to your accounts ~/.bashrc file.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;vi ~/.bashrc  &lt;br /&gt;
Insert the text given below and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both CASA 5 and 6 are available on Inti. &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
To load CASA 5, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to load CASA 6, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, for example, to use clean, first start ipython as given above, then type in &amp;gt;&amp;gt;from casatasks import tclean&lt;br /&gt;
&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
Follow the below given steps to run the self-calibration of the imaging data and produce the calibrated images in .fits format. https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]&lt;br /&gt;
antennas='0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna='0~12',&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='1~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas='0~12' &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['1~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna='0~12',&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec        #Change accordingly&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)&lt;br /&gt;
                sped=min(int(sp)+2,30)&lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
		ax.get_xaxis().set_visible(False)&lt;br /&gt;
		ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:&lt;br /&gt;
                    sp_i = 1&lt;br /&gt;
                if sp_e &amp;gt; 30:&lt;br /&gt;
                    sp_e = 30&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
	plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Multi-frequency images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Multi-frequency images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6130</id>
		<title>Guide to Upgrade SolarSoft(SSW)</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6130"/>
		<updated>2022-03-29T19:33:21Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
SSW upgrade using passive_ftp was stopped in August 2019. The current way to upgrade SSW is to use the WGET executable. If you have done and update on SSW since August 2019 and your system already has WGET, any further upgrade can be made by directly following the steps underlined [https://hesperia.gsfc.nasa.gov/rhessi3/docs/ssw_update_help.html here]. For Linux and MacOS you can check if you already have WGET by typing the command &amp;quot;which wget&amp;quot; in the bash shell.&lt;br /&gt;
&lt;br /&gt;
If your system was not updated since August 2019, follow the steps below:&lt;br /&gt;
&lt;br /&gt;
=== MacOS ===&lt;br /&gt;
In order to perform the upgrade, you must be the owner of the SSW tree.&lt;br /&gt;
==== 1. Installing wget ====&lt;br /&gt;
'''USING HOMEBREW'''&lt;br /&gt;
&lt;br /&gt;
To install homebrew, type the following command in the bash shell:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
/usr/bin/ruby -e &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once homebrew is installed, you can simply install wget by using the following command:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
brew install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''USING MacPorts'''&lt;br /&gt;
&lt;br /&gt;
Alternatively, wget can also be installed using MacPorts. Directions to install MacPorts for specific OS versions are given [https://www.macports.org/install.php here]&lt;br /&gt;
After installation, the following command will install wget:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
sudo port install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 2. Update SSW to use wget ====&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z&amp;diff=6128</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z&amp;diff=6128"/>
		<updated>2022-03-29T19:16:06Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to calibrate EOVSA IDB data to obtain measurement sets (.ms), transfer it to the inti server and self-calibrate for further analysis. &lt;br /&gt;
&lt;br /&gt;
'''Pre-requisites:''' Accounts on Pipeline and Inti or Baozi servers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Connection details to pipeline server ===&lt;br /&gt;
One can use the Mobaxterm platform to connect to the Pipeline server through a Windows machine or use SSH through a Mac machine.&lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw data (IDB) on Pipeline machine====&lt;br /&gt;
On CASA of the Pipeline machine, which has the complete EOVSA SQL database.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer and start tcsh to run CASA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                               ###Change accordingly###&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #####&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
######################################################&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add following lines to your ~/.casa/init.py file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate all the 10 mins data, if there are any====&lt;br /&gt;
Follow this step if there are more than one .ms files, if not run step 3 directly. If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
# This is to set the path/name for the concatenated files&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
This will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
# Append '_cal' to the ms filename and split the corrected column to the new caled ms&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One needs to transfer the created caled ms data files (xxx_concat_cal.ms or xxx_cal.ms) from pipeline to inti server, which has all the casatasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
=== Connection details to Inti server ===&lt;br /&gt;
For Windows, on Mobaxterm,&lt;br /&gt;
&lt;br /&gt;
#With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password.&lt;br /&gt;
#ssh -X UCID@inti.hpcnet.campus.njit.edu &lt;br /&gt;
&lt;br /&gt;
To avoid typing the full inti address each time you attempt for ssh, you may wish to add the following lines with your username to C:\Program Files\Git\etc\ssh\ssh_config on Windows and /.ssh/config on Mac and Linux machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User USERNAME                                                                                              ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have sufficient disk space with EOVSA data analysis over Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, Please take help from Sijie in creating one. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Linux or Mac machine,&lt;br /&gt;
ssh -X UCID@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
For directly transferring your calibrated .ms data between the Pipeline and Inti servers, follow the below given steps. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal.&lt;br /&gt;
&lt;br /&gt;
Change to your working directory and give this command to copy your data on Pipeline.&lt;br /&gt;
scp -v -C -r -P 8888 USERNAMEofPipeline@localhost:PATHofMSDATA/MSfilename ./&lt;br /&gt;
Eg: scp -v -C -r -P 8888 shaheda@localhost:/data1/shaheda/IDB20220118173922_cal.ms ./&lt;br /&gt;
where, MSfilename, PATHofMSDATA are your .ms data and its path on Pipeline machine.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can follow the below procedure to do the transfer.&lt;br /&gt;
&lt;br /&gt;
For Windows, on mobaxterm, drag and drop the ms file to your local machine or use scp command as given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C userid@pipeline:/your/folder/msfile /localmachine/destination/folder/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On mobaxterm and on your local terminal, use the following command to finally copy the ms file to Inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C /localmachine/destination/folder/msfile UCID@inti.hpcnet.campus.njit.edu:/inti/data/users/YOURDIRECTORY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mac and Linux, SCP can be used in the same way. Add the following lines to your SSH config file, to bypass ovsa.njit.edu from copying.&lt;br /&gt;
vi ~/.ssh/config&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User userid&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software details on the servers ===&lt;br /&gt;
On Inti,&lt;br /&gt;
when logging in for the first time, please add the following lines to your accounts ~/.bashrc file.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;vi ~/.bashrc  &lt;br /&gt;
Insert the text given below and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both CASA 5 and 6 are available on Inti. &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
To load CASA 5, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to load CASA 6, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, for example, to use clean, first start ipython as given above, then type in &amp;gt;&amp;gt;from casatasks import tclean&lt;br /&gt;
&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]&lt;br /&gt;
antennas='0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna='0~12',&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='1~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas='0~12' &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['1~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna='0~12',&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)&lt;br /&gt;
                sped=min(int(sp)+2,30)&lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
		ax.get_xaxis().set_visible(False)&lt;br /&gt;
		ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:&lt;br /&gt;
                    sp_i = 1&lt;br /&gt;
                if sp_e &amp;gt; 30:&lt;br /&gt;
                    sp_e = 30&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
	plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z&amp;diff=6127</id>
		<title>Tohban EOVSA Imaging Tutorial A-Z</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Tohban_EOVSA_Imaging_Tutorial_A-Z&amp;diff=6127"/>
		<updated>2022-03-29T19:15:46Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial describes the step-by-step procedure to calibrate EOVSA IDB data to obtain measurement sets (.ms), transfer it to the inti server and self-calibrate for further analysis. &lt;br /&gt;
&lt;br /&gt;
Before starting to work on this tutorial one needs accounts and setup on Pipeline and Inti or Baozi servers.&lt;br /&gt;
'''Pre-requisites:''' Accounts on Pipeline and Inti or Baozi servers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Connection details to pipeline server ===&lt;br /&gt;
One can use the Mobaxterm platform to connect to the Pipeline server through a Windows machine or use SSH through a Mac machine.&lt;br /&gt;
&lt;br /&gt;
==== Step 1: Downloading raw data (IDB) on Pipeline machine====&lt;br /&gt;
On CASA of the Pipeline machine, which has the complete EOVSA SQL database.&lt;br /&gt;
&lt;br /&gt;
If you are not using mobaxterm, directly SSH to Pipeline through your Linux or Mac computer and start tcsh to run CASA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from astropy.time import Time&lt;br /&gt;
import os&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:25:00'])                               ###Change accordingly###&lt;br /&gt;
#### (Optional) change output path, default current directory &amp;quot;./&amp;quot; #####&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
######################################################&lt;br /&gt;
msfiles = importeovsa(idbfiles=trange, ncpu=1, visprefix=outpath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: The above step currently gives an error with importeovsa. This is because the data location was changed and the code doesn't know where to look for the IDB files. Sijie is looking into the problem. We will update the page when it is fixed. For now, please use the method below for all time ranges. &lt;br /&gt;
&lt;br /&gt;
OR (for a time range longer than 10 minutes)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.tasks import task_calibeovsa as calibeovsa&lt;br /&gt;
from suncasa.tasks import task_importeovsa as timporteovsa&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import dump_tsys as dt&lt;br /&gt;
from util import Time&lt;br /&gt;
import numpy as np&lt;br /&gt;
import os&lt;br /&gt;
from glob import glob&lt;br /&gt;
from eovsapy import util&lt;br /&gt;
&lt;br /&gt;
trange = Time(['2017-08-21 20:15:00', '2017-08-21 20:35:00'])                               ###Change accordingly###&lt;br /&gt;
idbdir = util.get_idbdir(trange[0])&lt;br /&gt;
&lt;br /&gt;
info = dt.rd_fdb(trange[0])&lt;br /&gt;
for k, v in info.iteritems():&lt;br /&gt;
    info[k] = info[k][~(info[k] == '')]&lt;br /&gt;
&lt;br /&gt;
sidx = np.where(&lt;br /&gt;
    np.logical_and(info['SOURCEID'] == 'Sun', info['PROJECTID'] == 'NormalObserving') &amp;amp; np.logical_and(&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;gt;= trange[0].lv,&lt;br /&gt;
        info['ST_TS'].astype(np.float) &amp;lt;= trange[&lt;br /&gt;
            1].lv))&lt;br /&gt;
filelist = info['FILE'][sidx]&lt;br /&gt;
&lt;br /&gt;
outpath = './msdata/'                                                                       ###Change accordingly###&lt;br /&gt;
if not os.path.exists(outpath):&lt;br /&gt;
    os.makedirs(outpath)&lt;br /&gt;
inpath = idbdir + '{}/'.format(trange[0].datetime.strftime(&amp;quot;%Y%m%d&amp;quot;))&lt;br /&gt;
ncpu = 1&lt;br /&gt;
&lt;br /&gt;
msfiles = timporteovsa.importeovsa(idbfiles=[inpath + ll for ll in filelist], ncpu=ncpu, timebin=&amp;quot;0s&amp;quot;, width=1,&lt;br /&gt;
                                   visprefix=outpath,&lt;br /&gt;
                                   nocreatms=False, doconcat=False,&lt;br /&gt;
                                   modelms=&amp;quot;&amp;quot;, doscaling=False, keep_nsclms=False, udb_corr=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you come across errors with calibeovsa, add following lines to your ~/.casa/init.py file.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.append('/common/python')&lt;br /&gt;
sys.path.append('/common/python/packages/pipeline_casa')&lt;br /&gt;
execfile('/common/python/suncasa/tasks/mytasks.py')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Concatenate all the 10 mins data, if there are any====&lt;br /&gt;
Follow this step if there are more than one .ms files, if not run step 3 directly. If doimage=True, a quicklook image will be produced (by integrating over the entire time) as shown below.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
# This is to set the path/name for the concatenated files&lt;br /&gt;
concatvis = os.path.basename(msfiles[0])[:11] + '_concat_cal.ms'&lt;br /&gt;
vis = calibeovsa.calibeovsa(msfiles, doconcat=True, concatvis=concatvis, caltype=['refpha','phacal'], doimage=True)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[file:Figure1_imagingtutorial.png|frame|center|800px|'''Figure 1:''' Quick-look full-Sun image after the initial calibration.]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Calibration ====&lt;br /&gt;
This will calibrate the input visibility, write out calibration tables under /data1/eovsa/caltable/, and apply the calibration. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
vis = calibeovsa.calibeovsa('IDB20170821202020.ms', caltype=['refpha','phacal'], doimage=True)            ###Change the vis filename accordingly###&lt;br /&gt;
# Append '_cal' to the ms filename and split the corrected column to the new caled ms&lt;br /&gt;
vis_str = str(' '.join(vis))&lt;br /&gt;
caled_vis=vis_str.replace('.ms','_cal.ms')&lt;br /&gt;
split(vis=' '.join(vis),outputvis=caled_vis,datacolumn='corrected',timerange='',correlation='XX')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One needs to transfer the created caled ms data files (xxx_concat_cal.ms or xxx_cal.ms) from pipeline to inti server, which has all the casatasks installed, in order to run the rest of the imaging steps.&lt;br /&gt;
&lt;br /&gt;
=== Connection details to Inti server ===&lt;br /&gt;
For Windows, on Mobaxterm,&lt;br /&gt;
&lt;br /&gt;
#With your NJIT VPN connected, connect to one of the afsconnect servers (for example, afsaccess3.njit.edu) using your UCID and password.&lt;br /&gt;
#ssh -X UCID@inti.hpcnet.campus.njit.edu &lt;br /&gt;
&lt;br /&gt;
To avoid typing the full inti address each time you attempt for ssh, you may wish to add the following lines with your username to C:\Program Files\Git\etc\ssh\ssh_config on Windows and /.ssh/config on Mac and Linux machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host inti&lt;br /&gt;
Hostname inti.hpcnet.campus.njit.edu&lt;br /&gt;
User USERNAME                                                                                              ###Insert UCID/inti username here###&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have sufficient disk space with EOVSA data analysis over Inti, use your dedicated directory YOURDIRECTORY at the location given below. If you do not have a directory, Please take help from Sijie in creating one. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
cd /inti/data/users/YOURDIRECTORY     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Linux or Mac machine,&lt;br /&gt;
ssh -X UCID@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
=== Transferring data files between servers ===&lt;br /&gt;
For directly transferring your calibrated .ms data between the Pipeline and Inti servers, follow the below given steps. &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
1. Log into Inti using your username.&lt;br /&gt;
ssh -X USERNAME@inti.hpcnet.campus.njit.edu&lt;br /&gt;
&lt;br /&gt;
Then create a tunnel into Pipeline from Inti.&lt;br /&gt;
ssh -L 8888:pipeline.solar.pvt:22 guest@ovsa.njit.edu&lt;br /&gt;
&lt;br /&gt;
2. Log into Inti again from a new terminal.&lt;br /&gt;
&lt;br /&gt;
Change to your working directory and give this command to copy your data on Pipeline.&lt;br /&gt;
scp -v -C -r -P 8888 USERNAMEofPipeline@localhost:PATHofMSDATA/MSfilename ./&lt;br /&gt;
Eg: scp -v -C -r -P 8888 shaheda@localhost:/data1/shaheda/IDB20220118173922_cal.ms ./&lt;br /&gt;
where, MSfilename, PATHofMSDATA are your .ms data and its path on Pipeline machine.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can follow the below procedure to do the transfer.&lt;br /&gt;
&lt;br /&gt;
For Windows, on mobaxterm, drag and drop the ms file to your local machine or use scp command as given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C userid@pipeline:/your/folder/msfile /localmachine/destination/folder/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On mobaxterm and on your local terminal, use the following command to finally copy the ms file to Inti.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
scp -r -C /localmachine/destination/folder/msfile UCID@inti.hpcnet.campus.njit.edu:/inti/data/users/YOURDIRECTORY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Mac and Linux, SCP can be used in the same way. Add the following lines to your SSH config file, to bypass ovsa.njit.edu from copying.&lt;br /&gt;
vi ~/.ssh/config&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
Host ovsa&lt;br /&gt;
        HostName ovsa.njit.edu&lt;br /&gt;
        User guest&lt;br /&gt;
Host pipeline&lt;br /&gt;
        Hostname pipeline.solar.pvt&lt;br /&gt;
        User userid&lt;br /&gt;
        ProxyCommand ssh -W %h:%p guest@ovsa.njit.edu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software details on the servers ===&lt;br /&gt;
On Inti,&lt;br /&gt;
when logging in for the first time, please add the following lines to your accounts ~/.bashrc file.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;vi ~/.bashrc  &lt;br /&gt;
Insert the text given below and save it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
#### setting start ####&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;baozi.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /srg/.setenv_baozi&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;inti.hpcnet.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /inti/.setenv_inti&lt;br /&gt;
fi&lt;br /&gt;
if [ $HOSTNAME == &amp;quot;guko.resource.campus.njit.edu&amp;quot; ]; then&lt;br /&gt;
    source /data/data/.setenv_guko&lt;br /&gt;
fi&lt;br /&gt;
#### setting end ####&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both CASA 5 and 6 are available on Inti. &lt;br /&gt;
&lt;br /&gt;
Enter the bash environment on inti, and load the desired casa environment.&lt;br /&gt;
To load CASA 5, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa5&lt;br /&gt;
&amp;gt;&amp;gt; suncasa              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or to load CASA 6, enter bash environment by giving &amp;gt;&amp;gt;bash &lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; loadcasa6&lt;br /&gt;
&amp;gt;&amp;gt; ipython              #This should load the software making you ready for the analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, for example, to use clean, first start ipython as given above, then type in &amp;gt;&amp;gt;from casatasks import tclean&lt;br /&gt;
&lt;br /&gt;
====Step 4: Self-calibration====&lt;br /&gt;
[[file:Figure3_imagingtutorial.png|thumb|center|500px|Figure 2: Cotton-Schwab clean major and minor cycles. [Source: http://www.aoc.nrao.edu/~rurvashi/ImagingAlgorithmsInCasa/node2.html].]]&lt;br /&gt;
https://github.com/binchensun/casa-eovsa/blob/master/slfcal_example.py&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import helioimage2fits as hf&lt;br /&gt;
import os&lt;br /&gt;
import numpy as np&lt;br /&gt;
import pickle&lt;br /&gt;
from matplotlib import gridspec as gridspec&lt;br /&gt;
from sunpy import map as smap&lt;br /&gt;
from matplotlib import pyplot as plt&lt;br /&gt;
from split_cli import split_cli as split&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# =========== task handlers =============&lt;br /&gt;
dofullsun = 1 # initial full-sun imaging                                         ###Change accordingly###&lt;br /&gt;
domasks=1 # get masks                                                            ###Change accordingly###&lt;br /&gt;
doslfcal=1 # main cycle of doing selfcalibration                                 ###Change accordingly###&lt;br /&gt;
doapply=1 # apply the results                                                    ###Change accordingly###&lt;br /&gt;
doclean_slfcaled=1 # perform clean for self-calibrated data                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# ============ declaring the working directories ============&lt;br /&gt;
workdir = os.getcwd()+'/' #main working directory. Using current directory in this example&lt;br /&gt;
slfcaldir = workdir+'slfcal/' #place to put all selfcalibration products&lt;br /&gt;
imagedir = slfcaldir+'images/' #place to put all selfcalibration images&lt;br /&gt;
maskdir = slfcaldir+'masks/' #place to put clean masks&lt;br /&gt;
imagedir_slfcaled = slfcaldir+'images_slfcaled/' #place to put final self-calibrated images&lt;br /&gt;
caltbdir = slfcaldir+'caltbs/' # place to put calibration tables&lt;br /&gt;
# make these directories if they do not already exist&lt;br /&gt;
dirs = [workdir, slfcaldir, imagedir, maskdir, imagedir_slfcaled, caltbdir]&lt;br /&gt;
for d in dirs:&lt;br /&gt;
    if not os.path.exists(d):&lt;br /&gt;
        os.makedirs(d)&lt;br /&gt;
&lt;br /&gt;
# ============ Split a short time for self-calibration ===========&lt;br /&gt;
# input visibility&lt;br /&gt;
ms_in = workdir + 'IDB20170821202020_cal.ms'                                    ###Change the initial calibrated (through calibeovsa) vis accordingly###&lt;br /&gt;
# output, selfcaled, visibility&lt;br /&gt;
ms_slfcaled = workdir + os.path.basename(ms_in).replace('cal','slfcaled') &lt;br /&gt;
# intermediate small visibility for selfcalbration &lt;br /&gt;
# selected time range for generating self-calibration solutions&lt;br /&gt;
trange='2017/08/21/20:21:10~2017/08/21/20:21:30'                                ###Change accordingly###&lt;br /&gt;
slfcalms = slfcaldir+'slfcalms.XX.slfcal'&lt;br /&gt;
slfcaledms = slfcaldir+'slfcalms.XX.slfcaled'&lt;br /&gt;
if not os.path.exists(slfcalms):&lt;br /&gt;
    split(vis=ms_in,outputvis=slfcalms,datacolumn='data',timerange=trange,correlation='XX')&lt;br /&gt;
&lt;br /&gt;
# ============ Prior definitions for spectral windows, antennas, pixel numbers =========&lt;br /&gt;
spws=[str(s+1) for s in range(30)]&lt;br /&gt;
antennas='0~12' &lt;br /&gt;
npix=512&lt;br /&gt;
nround=3 #number of slfcal cycles&lt;br /&gt;
&lt;br /&gt;
# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========&lt;br /&gt;
if dofullsun:&lt;br /&gt;
    #initial mfs clean to find out the image phase center&lt;br /&gt;
    im_init='fullsun_init'&lt;br /&gt;
    os.system('rm -rf '+im_init+'*')&lt;br /&gt;
    tclean(vis=slfcalms,&lt;br /&gt;
            antenna='0~12',&lt;br /&gt;
            imagename=im_init,&lt;br /&gt;
            spw='1~15',&lt;br /&gt;
            specmode='mfs',&lt;br /&gt;
            timerange=trange,&lt;br /&gt;
            imsize=[npix],&lt;br /&gt;
            cell=['5arcsec'],&lt;br /&gt;
            niter=1000,&lt;br /&gt;
            gain=0.05,&lt;br /&gt;
            stokes='I',&lt;br /&gt;
            restoringbeam=['30arcsec'],&lt;br /&gt;
            interactive=False,&lt;br /&gt;
            pbcor=True)&lt;br /&gt;
&lt;br /&gt;
    hf.imreg(vis=slfcalms,imagefile=im_init+'.image.pbcor',fitsfile=im_init+'.fits',&lt;br /&gt;
             timerange=trange,usephacenter=False,verbose=True)&lt;br /&gt;
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual','.sumwt','.pb','.image']     #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
    for clnjunk in clnjunks:&lt;br /&gt;
        if os.path.exists(im_init + clnjunk):&lt;br /&gt;
            os.system('rm -rf '+im_init + clnjunk)&lt;br /&gt;
&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fig = plt.figure(figsize=(6,6))&lt;br /&gt;
    ax = fig.add_subplot(111)&lt;br /&gt;
    eomap=smap.Map(im_init+'.fits')&lt;br /&gt;
    #eomap.data=eomap.data.reshape((npix,npix))&lt;br /&gt;
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
    eomap.plot(axes = ax)&lt;br /&gt;
    eomap.draw_limb()&lt;br /&gt;
    plt.show()&lt;br /&gt;
    viewer(im_init+'.image.pbcor')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure2_imagingtutorial.png|thumb|center|500px|Figure 3: Full-Sun image after initial clean to find the flare location.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# parameters specific to the event (found from step 1)&lt;br /&gt;
phasecenter='J2000 10h02m59 11d58m07'                                               ###Change accordingly###&lt;br /&gt;
xran=[280,480]                                                                      ###Change accordingly###&lt;br /&gt;
yran=[-50,150]                                                                      ###Change accordingly###&lt;br /&gt;
&lt;br /&gt;
# =========== Step 2 (optional), generate masks =========&lt;br /&gt;
# if skipped, will not use any masks&lt;br /&gt;
if domasks:&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    delmod(slfcalms)&lt;br /&gt;
    antennas='0~12' &lt;br /&gt;
    pol='XX'&lt;br /&gt;
    imgprefix=maskdir+'slf_t0'&lt;br /&gt;
&lt;br /&gt;
    # step 1: set up the clean masks&lt;br /&gt;
    img_init=imgprefix+'_init_ar_'&lt;br /&gt;
    os.system('rm -rf '+img_init+'*')&lt;br /&gt;
    #spwrans_mask=['1~5','6~12','13~20','21~30']&lt;br /&gt;
    spwrans_mask=['1~12']&lt;br /&gt;
    #convert to a list of spws&lt;br /&gt;
    spwrans_mask_list = [[str(i) for i in (np.arange(int(m.split('~')[0]),int(m.split('~')[1])))] for m in spwrans_mask]&lt;br /&gt;
    masks=[]&lt;br /&gt;
    imnames=[]&lt;br /&gt;
    for spwran in spwrans_mask:&lt;br /&gt;
        imname=img_init+spwran.replace('~','-')&lt;br /&gt;
        try:&lt;br /&gt;
            tclean(vis=slfcalms,&lt;br /&gt;
                    antenna='0~12',&lt;br /&gt;
                    imagename=imname,&lt;br /&gt;
                    spw=spwran,&lt;br /&gt;
                    specmode='mfs',&lt;br /&gt;
                    timerange=trange,&lt;br /&gt;
                    imsize=[npix],&lt;br /&gt;
                    cell=['2arcsec'],&lt;br /&gt;
                    niter=1000,&lt;br /&gt;
                    gain=0.05,&lt;br /&gt;
                    stokes='XX',&lt;br /&gt;
                    restoringbeam=['20arcsec'],&lt;br /&gt;
                    phasecenter=phasecenter,&lt;br /&gt;
                    weighting='briggs',&lt;br /&gt;
                    robust=1.0,&lt;br /&gt;
                    interactive=True,&lt;br /&gt;
		    datacolumn='data',&lt;br /&gt;
                    pbcor=True,&lt;br /&gt;
                    savemodel='modelcolumn')&lt;br /&gt;
            imnames.append(imname+'.image')&lt;br /&gt;
            masks.append(imname+'.mask')&lt;br /&gt;
            clnjunks = ['.flux', '.model', '.psf', '.residual']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for clnjunk in clnjunks:&lt;br /&gt;
                if os.path.exists(imname + clnjunk):&lt;br /&gt;
                    os.system('rm -rf '+ imname + clnjunk)&lt;br /&gt;
        except:&lt;br /&gt;
            print('error in cleaning spw: '+spwran)&lt;br /&gt;
&lt;br /&gt;
    pickle.dump(masks,open(slfcaldir+'masks.p','wb'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Figure4_imagingtutorial.PNG|thumb|center|800px|Figure 4: Interactive clean window to create masks over the source. The white outline surrounding the source is the mask selected by the polygon drawing option.]]&lt;br /&gt;
&lt;br /&gt;
The outlines drawn for masks can be created by any of the icons with the letter 'R' in the Viewer window. The instructions for doing this can be found by hovering over those icons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 3, main step of selfcalibration =========&lt;br /&gt;
if doslfcal:&lt;br /&gt;
    if os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        masks=pickle.load(open(slfcaldir+'masks.p','rb'))&lt;br /&gt;
    if not os.path.exists(slfcaldir+'masks.p'):&lt;br /&gt;
        print 'masks do not exist. Use default mask'&lt;br /&gt;
        masks=[]&lt;br /&gt;
    os.system('rm -rf '+imagedir+'*')&lt;br /&gt;
    os.system('rm -rf '+caltbdir+'*')&lt;br /&gt;
    #first step: make a mock caltable for the entire database&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    slftbs=[]&lt;br /&gt;
    calprefix=caltbdir+'slf'&lt;br /&gt;
    imgprefix=imagedir+'slf'&lt;br /&gt;
    tb.open(slfcalms+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    # starting beam size at 3.4 GHz in arcsec&lt;br /&gt;
    sbeam=40.&lt;br /&gt;
    strtmp=[m.replace(':','') for m in trange.split('~')]&lt;br /&gt;
    timestr='t'+strtmp[0]+'-'+strtmp[1]&lt;br /&gt;
    refantenna='0'&lt;br /&gt;
    # number of iterations for each round&lt;br /&gt;
    niters=[100, 300, 500]&lt;br /&gt;
    # roburst value for weighting the baselines&lt;br /&gt;
    robusts=[1.0, 0.5, 0.0]&lt;br /&gt;
    # apply calibration tables? Set to true for most cases&lt;br /&gt;
    doapplycal=[1,1,1]&lt;br /&gt;
    # modes for calibration, 'p' for phase-only, 'a' for amplitude only, 'ap' for both&lt;br /&gt;
    calmodes=['p','p','a']&lt;br /&gt;
    # setting uvranges for model image (optional, not used here)&lt;br /&gt;
    uvranges=['','',''] &lt;br /&gt;
    for n in range(nround):&lt;br /&gt;
        slfcal_tb_g= calprefix+'.G'+str(n)&lt;br /&gt;
        fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
        gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
        for s,sp in enumerate(spws):&lt;br /&gt;
            print 'processing spw: '+sp&lt;br /&gt;
            cfreq=cfreqs[int(sp)]&lt;br /&gt;
            # setting restoring beam size (not very useful for selfcal anyway, but just to see the results)&lt;br /&gt;
            bm=max(sbeam*cfreqs[1]/cfreq, 6.)&lt;br /&gt;
            slfcal_img = imgprefix+'.spw'+sp.zfill(2)+'.slfcal'+str(n)&lt;br /&gt;
            # only the first round uses nearby spws for getting initial model&lt;br /&gt;
            if n == 0:&lt;br /&gt;
                spbg=max(int(sp)-2,1)&lt;br /&gt;
                sped=min(int(sp)+2,30)&lt;br /&gt;
                spwran=str(spbg)+'~'+str(sped)&lt;br /&gt;
                print('using spw {0:s} as model'.format(spwran))&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print('using mask {0:s}'.format(mask))&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            else:&lt;br /&gt;
                spwran = sp&lt;br /&gt;
                if 'spwrans_mask' in vars():&lt;br /&gt;
                    for m, spwran_mask in enumerate(spwrans_mask):&lt;br /&gt;
                        if sp in spwran_mask:&lt;br /&gt;
                            mask = masks[m]&lt;br /&gt;
                            print 'using mask {0:s}'.format(mask)&lt;br /&gt;
                            findmask = True&lt;br /&gt;
                    if not findmask:&lt;br /&gt;
                        print('mask not found. Do use any masks')&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=slfcalms,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=slfcal_img,&lt;br /&gt;
                        uvrange=uvranges[n],&lt;br /&gt;
                        spw=spwran,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['2arcsec'],&lt;br /&gt;
                        niter=niters[n],&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes='XX', #use pol XX image as the model&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=robusts[n],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask=mask,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        pbcor=False,&lt;br /&gt;
                        interactive=False,&lt;br /&gt;
                        savemodel='modelcolumn')&lt;br /&gt;
                if os.path.exists(slfcal_img+'.image'):&lt;br /&gt;
                    fitsfile=slfcal_img+'.fits'&lt;br /&gt;
                    hf.imreg(vis=slfcalms,imagefile=slfcal_img+'.image',fitsfile=fitsfile,&lt;br /&gt;
                             timerange=trange,usephacenter=False,toTb=True,verbose=False,overwrite=True)&lt;br /&gt;
                clnjunks = ['.mask','.flux', '.model', '.psf', '.residual', '.image','.pb','.image.pbcor','.sumwt']   #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
                for clnjunk in clnjunks:&lt;br /&gt;
                    if os.path.exists(slfcal_img + clnjunk):&lt;br /&gt;
                        os.system('rm -rf '+ slfcal_img + clnjunk)&lt;br /&gt;
                ax = fig.add_subplot(gs[s])&lt;br /&gt;
                eomap=smap.Map(fitsfile)&lt;br /&gt;
                eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
                eomap.plot(axes = ax)&lt;br /&gt;
                eomap.draw_limb()&lt;br /&gt;
                #eomap.draw_grid()&lt;br /&gt;
                ax.set_title(' ')&lt;br /&gt;
		ax.get_xaxis().set_visible(False)&lt;br /&gt;
		ax.get_yaxis().set_visible(False)&lt;br /&gt;
                ax.set_xlim(xran)&lt;br /&gt;
                ax.set_ylim(yran)&lt;br /&gt;
                os.system('rm -f '+ fitsfile)&lt;br /&gt;
&lt;br /&gt;
            except:&lt;br /&gt;
                print 'error in cleaning spw: '+sp&lt;br /&gt;
                print 'using nearby spws for initial model'&lt;br /&gt;
                sp_e=int(sp)+2&lt;br /&gt;
                sp_i=int(sp)-2&lt;br /&gt;
                if sp_i &amp;lt; 1:&lt;br /&gt;
                    sp_i = 1&lt;br /&gt;
                if sp_e &amp;gt; 30:&lt;br /&gt;
                    sp_e = 30&lt;br /&gt;
                sp_=str(sp_i)+'~'+str(sp_e)&lt;br /&gt;
                try:&lt;br /&gt;
                    tget(tclean)&lt;br /&gt;
                    spw=sp_&lt;br /&gt;
                    print('using spw {0:s} as model'.format(sp_))&lt;br /&gt;
                    tclean()&lt;br /&gt;
                except:&lt;br /&gt;
                    print 'still not successful. abort...'&lt;br /&gt;
                    break&lt;br /&gt;
&lt;br /&gt;
            gaincal(vis=slfcalms, refant=refantenna,antenna=antennas,caltable=slfcal_tb_g,spw=sp, uvrange='',\&lt;br /&gt;
                    gaintable=[],selectdata=True,timerange=trange,solint='inf',gaintype='G',calmode=calmodes[n],\&lt;br /&gt;
                    combine='',minblperant=4,minsnr=2,append=True)&lt;br /&gt;
            if not os.path.exists(slfcal_tb_g):&lt;br /&gt;
                print 'No solution found in spw: '+sp&lt;br /&gt;
        figname=imagedir+'slf_t0_n{:d}.png'.format(n)&lt;br /&gt;
	plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
        plt.savefig(figname)&lt;br /&gt;
        time.sleep(10)&lt;br /&gt;
        plt.close()&lt;br /&gt;
&lt;br /&gt;
        if os.path.exists(slfcal_tb_g):&lt;br /&gt;
            slftbs.append(slfcal_tb_g)&lt;br /&gt;
            slftb=[slfcal_tb_g]&lt;br /&gt;
            os.chdir(slfcaldir)&lt;br /&gt;
            if calmodes[n] == 'p': &lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='phase',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,-180,180],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            if calmodes[n] == 'a':&lt;br /&gt;
                plotcal(caltable=slfcal_tb_g,antenna='1~12',xaxis='freq',yaxis='amp',\&lt;br /&gt;
                        subplot=431,plotrange=[-1,-1,0,2.],iteration='antenna',figfile=slfcal_tb_g+'.png',showgui=False)&lt;br /&gt;
            os.chdir(workdir)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if doapplycal[n]:&lt;br /&gt;
            clearcal(slfcalms)&lt;br /&gt;
            delmod(slfcalms)&lt;br /&gt;
            applycal(vis=slfcalms,gaintable=slftb,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
                     antenna=antennas,interp='nearest',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
&lt;br /&gt;
        if n &amp;lt; nround-1: &lt;br /&gt;
            prompt=raw_input('Continuing to selfcal?')&lt;br /&gt;
            #prompt='y'&lt;br /&gt;
            if prompt.lower() == 'n':&lt;br /&gt;
                if os.path.exists(slfcaledms):&lt;br /&gt;
                    os.system('rm -rf '+slfcaledms)&lt;br /&gt;
                split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
                print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
                break&lt;br /&gt;
            if prompt.lower() == 'y':&lt;br /&gt;
                slfcalms_=slfcalms+str(n)&lt;br /&gt;
                if os.path.exists(slfcalms_):&lt;br /&gt;
                    os.system('rm -rf '+slfcalms_)&lt;br /&gt;
                split(slfcalms,slfcalms_,datacolumn='corrected')&lt;br /&gt;
                slfcalms=slfcalms_&lt;br /&gt;
        else:&lt;br /&gt;
            if os.path.exists(slfcaledms):&lt;br /&gt;
                os.system('rm -rf '+slfcaledms)&lt;br /&gt;
            split(slfcalms,slfcaledms,datacolumn='corrected')&lt;br /&gt;
            print 'Final calibrated ms is {0:s}'.format(slfcaledms)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 4: Apply self-calibration tables =========&lt;br /&gt;
if doapply:&lt;br /&gt;
    import glob&lt;br /&gt;
    os.chdir(workdir)&lt;br /&gt;
    clearcal(ms_in)&lt;br /&gt;
    clearcal(slfcalms)&lt;br /&gt;
    applycal(vis=slfcalms,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    applycal(vis=ms_in,gaintable=slftbs,spw=','.join(spws),selectdata=True,\&lt;br /&gt;
             antenna=antennas,interp='linear',flagbackup=False,applymode='calonly',calwt=False)&lt;br /&gt;
    if os.path.exists(ms_slfcaled):&lt;br /&gt;
        os.system('rm -rf '+ms_slfcaled)&lt;br /&gt;
    split(ms_in, ms_slfcaled,datacolumn='corrected')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[file:Slf.G0.png|thumb|center|500px|Figure 1: Phase before self-calibration]]&lt;br /&gt;
[[file:Slf.G1.png|thumb|center|500px|Figure 2: Phase after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
# =========== Step 5: Generate final self-calibrated images (optional) =========&lt;br /&gt;
if doclean_slfcaled:&lt;br /&gt;
    import glob&lt;br /&gt;
    pol='XX'&lt;br /&gt;
    print('Processing ' + trange)&lt;br /&gt;
    img_final=imagedir_slfcaled+'/slf_final_{0}_t0'.format(pol)&lt;br /&gt;
    vis = ms_slfcaled&lt;br /&gt;
    spws=[str(s+1) for s in range(30)]&lt;br /&gt;
    tb.open(vis+'/SPECTRAL_WINDOW')&lt;br /&gt;
    reffreqs=tb.getcol('REF_FREQUENCY')&lt;br /&gt;
    bdwds=tb.getcol('TOTAL_BANDWIDTH')&lt;br /&gt;
    cfreqs=reffreqs+bdwds/2.&lt;br /&gt;
    tb.close()&lt;br /&gt;
    sbeam=30.&lt;br /&gt;
    from matplotlib import gridspec as gridspec&lt;br /&gt;
    from sunpy import map as smap&lt;br /&gt;
    from matplotlib import pyplot as plt&lt;br /&gt;
    fitsfiles=[]&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        bm=max(sbeam*cfreqs[1]/cfreq,4.)&lt;br /&gt;
        imname=img_final+'_s'+sp.zfill(2)&lt;br /&gt;
        fitsfile=imname+'.fits'&lt;br /&gt;
        if not os.path.exists(fitsfile):&lt;br /&gt;
            print 'cleaning spw {0:s} with beam size {1:.1f}&amp;quot;'.format(sp,bm)&lt;br /&gt;
            try:&lt;br /&gt;
                tclean(vis=vis,&lt;br /&gt;
                        antenna=antennas,&lt;br /&gt;
                        imagename=imname,&lt;br /&gt;
                        spw=sp,&lt;br /&gt;
                        specmode='mfs',&lt;br /&gt;
                        timerange=trange,&lt;br /&gt;
                        imsize=[npix],&lt;br /&gt;
                        cell=['1arcsec'],&lt;br /&gt;
                        niter=1000,&lt;br /&gt;
                        gain=0.05,&lt;br /&gt;
                        stokes=pol,&lt;br /&gt;
                        weighting='briggs',&lt;br /&gt;
                        robust=2.0,&lt;br /&gt;
                        restoringbeam=[str(bm)+'arcsec'],&lt;br /&gt;
                        phasecenter=phasecenter,&lt;br /&gt;
                        mask='',&lt;br /&gt;
                        pbcor=True,&lt;br /&gt;
                        interactive=False)&lt;br /&gt;
            except:&lt;br /&gt;
                print 'cleaning spw '+sp+' unsuccessful. Proceed to next spw'&lt;br /&gt;
                continue&lt;br /&gt;
            if os.path.exists(imname+'.image.pbcor'):&lt;br /&gt;
                imn = imname+'.image.pbcor'&lt;br /&gt;
                hf.imreg(vis=vis,imagefile=imn,fitsfile=fitsfile,&lt;br /&gt;
                         timerange=trange,usephacenter=False,toTb=True,verbose=False)&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
            junks=['.flux','.model','.psf','.residual','.mask','.image','.pb','.image.pbcor','.sumwt']  #Do not run the next 4 lines if needed to view and assess the subset of clean process images&lt;br /&gt;
            for junk in junks:&lt;br /&gt;
                if os.path.exists(imname+junk):&lt;br /&gt;
                    os.system('rm -rf '+imname+junk)&lt;br /&gt;
        else:&lt;br /&gt;
            print('fits file '+fitsfile+' already exists, skip clean...')&lt;br /&gt;
            fitsfiles.append(fitsfile)&lt;br /&gt;
&lt;br /&gt;
    fig = plt.figure(figsize=(8.4,7.))&lt;br /&gt;
    gs = gridspec.GridSpec(5, 6)&lt;br /&gt;
    for s,sp in enumerate(spws):&lt;br /&gt;
        cfreq=cfreqs[int(sp)]&lt;br /&gt;
        ax = fig.add_subplot(gs[s])&lt;br /&gt;
        eomap=smap.Map(fitsfiles[s])&lt;br /&gt;
        eomap.plot_settings['cmap'] = plt.get_cmap('jet')&lt;br /&gt;
        eomap.plot(axes = ax)&lt;br /&gt;
        eomap.draw_limb()&lt;br /&gt;
        ax.set_title(' ')&lt;br /&gt;
        ax.get_xaxis().set_visible(False)&lt;br /&gt;
        ax.get_yaxis().set_visible(False)&lt;br /&gt;
        ax.set_xlim(xran)&lt;br /&gt;
        ax.set_ylim(yran)&lt;br /&gt;
        plt.text(0.98,0.85,'{0:.1f} GHz'.format(cfreq/1e9),transform=ax.transAxes,ha='right',color='w',fontweight='bold')&lt;br /&gt;
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The .fits files of the self calibrated images at each frequency for the given time are saved at /slfcal/images_slfcaled in your working directory.&lt;br /&gt;
&lt;br /&gt;
[[file:Slf_t0_n0.png|thumb|center|500px|Figure 3: Images before self-calibration]]&lt;br /&gt;
[[file:Slf_t0_n1.png|thumb|center|500px|Figure 4: Images after self-calibration]]&lt;br /&gt;
&lt;br /&gt;
====Step 5: Quick-look imaging ==== &amp;lt;!-- ====Step 6: Making the full set of images====  --&amp;gt;&lt;br /&gt;
For spectral imaging analysis of the event, follow [http://www.ovsa.njit.edu/wiki/index.php/EOVSA_Data_Analysis_Tutorial#Spectral_Imaging_with_SunCASA this tutorial] using the self-calibrated data obtained from the previous step or use [https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL this link].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9;overflow: auto;width: auto;&amp;quot;&amp;gt;&lt;br /&gt;
from suncasa.utils import qlookplot as ql    ## (Optional) Supply the npz file of the dynamic spectrum from previous step.&lt;br /&gt;
				            ## If not provided, the program will generate a new one from the visibility.&lt;br /&gt;
                                            ## set the time interval&lt;br /&gt;
from suncasa import dspec as ds&lt;br /&gt;
import time&lt;br /&gt;
visibility_data = 'IDB20170821202020_slfcaled.ms'&lt;br /&gt;
specfile = visibility_data + '.dspec.npz'&lt;br /&gt;
d = ds.Dspec(visibility_data, bl='4&amp;amp;9', specfile=specfile)&lt;br /&gt;
&lt;br /&gt;
timerange = '19:02:00~19:02:10'             ## select frequency range from 2.5 GHz to 3.5 GHz&lt;br /&gt;
spw = '2~5'                                 ## select stokes XX&lt;br /&gt;
stokes = 'XX'                               ## turn off AIA image plotting, default is True&lt;br /&gt;
plotaia = False&lt;br /&gt;
xycen = [375, 45]  ## image center for clean in solar X-Y in arcsec&lt;br /&gt;
cell=['2.0arcsec'] ## pixel size&lt;br /&gt;
imsize=[128]   ## x and y image size in pixels. &lt;br /&gt;
fov = [100,100]  ## field of view of the zoomed-in panels in unit of arcsec&lt;br /&gt;
spw = ['{}'.format(s) for s in range(1,31)]&lt;br /&gt;
clevels = [0.5, 1.0]  ## contour levels to fill in between.&lt;br /&gt;
calpha=0.35  ## now tune down the alpha&lt;br /&gt;
restoringbeam=['6arcsec']&lt;br /&gt;
ql.qlookplot(vis=msfile, specfile=specfile, timerange=timerange, spw=spw, stokes=stokes, \&lt;br /&gt;
            restoringbeam=restoringbeam,imsize=imsize,cell=cell, \&lt;br /&gt;
            xycen=xycen,fov=fov,clevels=clevels,calpha=calpha)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6049</id>
		<title>Guide to Upgrade SolarSoft(SSW)</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Guide_to_Upgrade_SolarSoft(SSW)&amp;diff=6049"/>
		<updated>2022-02-16T20:02:29Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: Created page with &amp;quot; SSW upgrade using passive_ftp was stopped in August 2019. The current way to upgrade SSW is to use the WGET executable. If you have done and update on SSW since August 2019 a...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
SSW upgrade using passive_ftp was stopped in August 2019. The current way to upgrade SSW is to use the WGET executable. If you have done and update on SSW since August 2019 and your system already has WGET, any further upgrade can be made by directly following the steps underlined [https://hesperia.gsfc.nasa.gov/rhessi3/docs/ssw_update_help.html here]. For Linux and MacOS you can check if you already have WGET by typing the command &amp;quot;which wget&amp;quot; in the bash shell.&lt;br /&gt;
&lt;br /&gt;
If your system was not updated since August 2019, follow the steps below:&lt;br /&gt;
&lt;br /&gt;
=== MacOS ===&lt;br /&gt;
==== 1. Installing wget ====&lt;br /&gt;
'''USING HOMEBREW'''&lt;br /&gt;
&lt;br /&gt;
To install homebrew, type the following command in the bash shell:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
/usr/bin/ruby -e &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once homebrew is installed, you can simply install wget by using the following command:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color: #FCEBD9&amp;quot;&amp;gt;&lt;br /&gt;
brew install wget&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''USING MacPorts'''&lt;br /&gt;
&lt;br /&gt;
Alternatively, wget can also be installed using MacPorts. Directions to install MacPorts for specific OS versions are given [https://www.macports.org/install.php here]&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
	<entry>
		<id>http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=6048</id>
		<title>Owens Valley Solar Arrays</title>
		<link rel="alternate" type="text/html" href="http://ovsa.njit.edu//wiki/index.php?title=Owens_Valley_Solar_Arrays&amp;diff=6048"/>
		<updated>2022-02-16T19:20:41Z</updated>

		<summary type="html">&lt;p&gt;Schhabra: /* Tohbans */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Eovsa1.png|border|text-top|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;[http://ovsa.njit.edu/ EOVSA] (Expanded Owens Valley Solar Array) is a new solar-dedicated radio interferometer operated by the New Jersey Institute of Technology. This wiki serves as the site for EOVSA documentation.  &amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== EOVSA Documentation ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;General&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Downconversion and Frequency Tuning]]&lt;br /&gt;
** [[Dealing with Radio Frequency Interference]]&lt;br /&gt;
** [[Switching between 200 MHz and 300 MHz Correlator]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Computer-Network&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Computing Systems]]&lt;br /&gt;
** [[Network]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Control System&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[27-m Antenna Commands]]&lt;br /&gt;
** [[Schedule Commands]]&lt;br /&gt;
** [[Control Commands]]&lt;br /&gt;
** [[Attenuation and Level Control]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Hardware&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Hardware Overview]]&lt;br /&gt;
** [[2.1-m Antennas]]&lt;br /&gt;
** [[27-m Antennas]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;System Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [[Calibration Database]]&lt;br /&gt;
** [[Stateframe Database]]&lt;br /&gt;
** [[Create CASA measurement sets]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;Calibration&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[Calibration Overview]]&lt;br /&gt;
**[[Pointing Calibration]]&lt;br /&gt;
**[[Total Power Calibration]]&lt;br /&gt;
**[[System Gain Calibration]]&lt;br /&gt;
**[[Antenna Position]] (Baseline Calibration)&lt;br /&gt;
**[[Reference Gain Calibration]]&lt;br /&gt;
**[[Daily Gain Calibration]]&lt;br /&gt;
**[[Delay Calibration]]&lt;br /&gt;
**[[Bandpass Calibration]]&lt;br /&gt;
**[[Polarization Calibration]]&lt;br /&gt;
**[[Calibrator Survey]]&lt;br /&gt;
**[[Practical Calibration Tutorial]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Starburst]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using EOVSA Data  ==&lt;br /&gt;
* &amp;lt;big&amp;gt;[[EOVSA Data products]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;Analysis Software&amp;lt;/big&amp;gt;&lt;br /&gt;
** [https://github.com/suncasa/suncasa SunCASA] A wrapper around [https://casa.nrao.edu/ CASA (the Common Astronomy Software Applications package)] for synthesis imaging and visualizing solar spectral imaging data. CASA is one of the leading software tool for &amp;quot;supporting the data post-processing needs of the next generation of radio astronomical telescopes such as ALMA and VLA&amp;quot;, an international effort led by the [https://public.nrao.edu/ National Radio Astronomy Observatory]. The current version of CASA uses Python (2.7) interface. More information about CASA can be found on [https://casa.nrao.edu/ NRAO's CASA website ]. Note, CASA is available ONLY on UNIX-BASED PLATFORMS (and therefore, so is SunCASA). &lt;br /&gt;
** [https://github.com/Gelu-Nita/GSFIT GSFIT] A IDL-widget(GUI)-based spectral fitting package called gsfit, which provides a user-friendly display of EOVSA image cubes and an interface to fast fitting codes (via platform-dependent shared-object libraries). &lt;br /&gt;
** [[Spectrogram Software]]&lt;br /&gt;
** [[Mapping Software]]&lt;br /&gt;
* &amp;lt;big&amp;gt;Data Analysis Guides&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[https://colab.research.google.com/drive/1lSLLxgOG6b8kgu9Sk6kSKvrViyubnXG6?usp=sharing#scrollTo=xbXyyLmCFCGL EOVSA Data Analysis Tutorial at RHESSI 19 Workshop]&amp;lt;/big&amp;gt;&lt;br /&gt;
** &amp;lt;big&amp;gt;[[EOVSA Data Analysis Tutorial]]&amp;lt;/big&amp;gt; at [http://rhessi18.umn.edu/ RHESSI XVIII Workshop]&lt;br /&gt;
** [[Self-Calibrating Flare Data]] Example script and guides for self-calibrating EOVSA flare data (to be completed)&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
**[[IDB flare pipeline]] Tutorial to run the flare pipeline for quicklook images&lt;br /&gt;
&amp;lt;!-- ** [[Imaging]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [[Flare Imaging]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;big&amp;gt;EOVSA Modeling Guide&amp;lt;/big&amp;gt;&lt;br /&gt;
**[[GX Simulator]]&lt;br /&gt;
&lt;br /&gt;
* Other helpful links&lt;br /&gt;
** [https://casaguides.nrao.edu CASA Guides]&lt;br /&gt;
** [http://www.lmsal.com/solarsoft/ SolarSoft IDL]&lt;br /&gt;
** [http://www.atnf.csiro.au/computing/software/miriad/userguide/userhtml.html Miriad Guides]&lt;br /&gt;
** [https://sites.google.com/site/fgscodes/ Fast Gyrosynchrotron Codes (Alexey Kuznetsov's website)]&lt;br /&gt;
** [[Basic GitHub Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--* &amp;lt;big&amp;gt;[[EOVSA Imaging Workshop]]&amp;lt;/big&amp;gt;--&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Full Disk Simulations]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[All-Day Synthesis Issues]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Analyzing Pre-2017 Data]]&amp;lt;/big&amp;gt;&lt;br /&gt;
* &amp;lt;big&amp;gt;[[Fixing Pipeline Problems pre-2021-Feb-07]]&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System Software ==&lt;br /&gt;
&lt;br /&gt;
* LabVIEW software&lt;br /&gt;
* Python code [https://github.com/dgary50/eovsa Github repository]&lt;br /&gt;
&lt;br /&gt;
== Observing Log ==&lt;br /&gt;
[[2016 November]]; [[2016 December| December]]&lt;br /&gt;
&lt;br /&gt;
[[2017 January]]; [[2017 February | February]]; [[2017 March | March]]; [[2017 April | April]]; [[2017 May | May]]; [[2017 June | June]];&lt;br /&gt;
[[2017 July | July]]; [[2017 August | August]]; [[2017 September | September]]; [[2017 October | October]]; [[2017 November | November]]; [[2017 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2018 January]]; [[2018 February | February]]; [[2018 March | March]]; [[2018 April | April]]; [[2018 May | May]]; [[2018 June | June]];&lt;br /&gt;
[[2018 July | July]]; [[2018 August | August]]; [[2018 September | September]]; [[2018 October | October]]; [[2018 November | November]]; [[2018 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2019 January]]; [[2019 February | February]]; [[2019 March | March]]; [[2019 April | April]]; [[2019 May | May]]; [[2019 June | June]];&lt;br /&gt;
[[2019 July | July]]; [[2019 August | August]]; [[2019 September | September]]; [[2019 October | October]]; [[2019 November | November]]; [[2019 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2020 January]]; [[2020 February | February]]; [[2020 March | March]]; [[2020 April | April]]; [[2020 May | May]]; [[2020 June | June]];&lt;br /&gt;
[[2020 July | July]]; [[2020 August | August]]; [[2020 September | September]]; [[2020 October | October]]; [[2020 November | November]]; [[2020 December | December]]&lt;br /&gt;
&lt;br /&gt;
[[2021 January]]; [[2021 February | February]]; [[2021 March | March]]; [[2021 April | April]]; [[2021 May | May]]; [[2021 June | June]];&lt;br /&gt;
[[2021 July | July]]; [[2021 August | August]]; [[2021 September | September]]; [[2021 October | October]]; [[2021 November | November]]; [[2021 December | December]]&lt;br /&gt;
&lt;br /&gt;
== Tohbans ==&lt;br /&gt;
&lt;br /&gt;
[[Trouble Shooting Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban Records]]&lt;br /&gt;
&lt;br /&gt;
[[Owen's Notes]]&lt;br /&gt;
&lt;br /&gt;
[[Tohban EOVSA Imaging Tutorial A-Z]]&lt;br /&gt;
&lt;br /&gt;
[[Guide to Upgrade SolarSoft(SSW)]]&lt;br /&gt;
&lt;br /&gt;
== EOVSA Flare List ==&lt;br /&gt;
&lt;br /&gt;
See [https://docs.google.com/spreadsheets/d/1P8jHuDRF93dMflU6RMQcsJqVepD9vFkPkofV8Imj4xA/edit?usp=sharing this link] for a list of EOVSA flares as a Google Spreadsheet. &lt;br /&gt;
&lt;br /&gt;
[[Recent Flare List (2021-)]]&lt;br /&gt;
&lt;br /&gt;
[http://ovsa.njit.edu/jay/rd_db.php An older link] is available at the EOVSA website.&lt;br /&gt;
&lt;br /&gt;
== EOVSA Publications ==&lt;br /&gt;
Here is a (partial) list of publications that utilize EOVSA data. See also the collection of EOVSA publications at [https://ui.adsabs.harvard.edu/public-libraries/eQ7HfPkySqydu-B8BCt6QQ this NASA/ADS Library].&lt;br /&gt;
; 2021&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021arXiv211015751L/abstract Lopez et al. (2021), arXiv 2110.15751] ''A solar flare driven by thermal conduction observed in mid-infrared''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...923..213W/abstract Wei et al. (2021), ApJ, 923, 213] ''Coronal Magnetic Field Measurements along a Partially Erupting Filament in a Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...919...44S/abstract Shaik &amp;amp; Gary (2021), ApJ, 919, 44] ''Implications of Flat Optically Thick Microwave Spectra in Solar Flares for Source Size and Morphology''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...915...12K/abstract Kocharov et al. (2021), ApJ, 915, 12] ''Multiple Sources of Solar High-energy Protons''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...908L..55C/abstract Chen et al. (2021), ApJL, 908, L55] ''Energetic Electron Distribution of the Coronal Acceleration Region: First results from Joint Microwave and Hard X-ray Imaging Spectroscopy''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2021ApJ...906..132C/abstract Chhabra et al. (2021), ApJ, 906, 132] ''Imaging Spectroscopy of CME-Associated Solar Radio Bursts''&lt;br /&gt;
; 2020&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...905..165R/abstract Reeves et al. (2020), ApJ, 905, 165] ''Hot Plasma Flows and Oscillations in the Loop-top Region During the September 10 2017 X8.2 Solar Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...900...17Y/abstract Yu et al. (2020), ApJ, 900, 17] ''Magnetic Reconnection During the Post Impulsive Phase of the X8.2 Solar Flare: Bi-Directional Outflows as a Cause of Microwave and X-ray Bursts''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020NatAs...4.1140C/abstract Chen et al. (2020b), Nature Astronomy, 4, 1140] ''Measurement of magnetic field and relativistic electrons along a solar flare current sheet''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...895L..50C/abstract Chen et al. (2020a), ApJL, 895, 50] ''Microwave Spectral Imaging of an Erupting Magnetic Flux Rope: Implications for the Standard Solar Flare Model in Three Dimensions''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020FrASS...7...22K/abstract Kuroda et al. (2020), Frontiers, 7, 22] ''Evolution of Flare-accelerated Electrons Quantified by Spatially Resolved Analysis''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...891L..34G/abstract Glesener et al. (2020), ApJL, 891, 34] ''Accelerated Electrons Observed Down to &amp;lt;7 keV in a NuSTAR Solar Microflare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020ApJ...889...72K/abstract Karlicky at al. (2020), ApJ, 889, 72] ''Drifting Pulsation Structure at the Very Beginning of the 2017 September 10 Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020Sci...367..278F/abstract Fleishman et al. (2020), Science, 367, 278] ''Decay of the coronal magnetic field can release sufficient energy to power a solar flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2020AAS...23538501G/abstract Gary et al. (2020), BAAS 52, 385.01] [https://aas235-aas.ipostersessions.com/default.aspx?s=97-69-9E-4B-34-19-68-53-1B-C6-21-0C-16-1C-5C-82&amp;amp;guestview=true Direct link to AAS iPoster] ''A new view of the solar atmosphere: daily full-disk multifrequency radio images from EOVSA''&lt;br /&gt;
; 2018&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...864...63P/abstract Polito et al. (2018), ApJ, 864, 63] ''Broad Non-Gaussian Fe XXIV Line Profiles in the Impulsive Phase of the 2017 September 10 X8.3-class Flare Observed by Hinode/EIS''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...863...83G/abstract Gary et al. (2018), ApJ, 863, 83] ''Microwave and Hard X-Ray Observations of the 2017 September 10 Solar Limb Flare''&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/#abs/2018ApJ...852...32K/abstract Kuroda et al. (2018), ApJ, 852, 32] ''Three-dimensional Forward-fit Modeling of the Hard X-ray and the Microwave Emissions of the 2015 June 22 M6.5 flare''&lt;br /&gt;
; 2017&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2017NatAs...1E..85W/abstract Wang et al. (2017), Nature Astronomy, 1, 85] ''High-resolution observations of flare precursors in the low solar atmosphere''&lt;br /&gt;
; 2016&lt;br /&gt;
: [https://ui.adsabs.harvard.edu/abs/2016JAI.....541009N/abstract Nita et al. (2016), J. Astron. Instr., 5, 1641009-7366] ''EOVSA Implementation of a Spectral Kurtosis Correlator for Transient Detection and Classification''&lt;br /&gt;
&lt;br /&gt;
== VLA Flare List and Publications ==&lt;br /&gt;
See [http://www.ovsa.njit.edu/wiki/index.php/VLA_Data_Survey#List_of_Jansky_VLA_Solar_Observations this link] for a list of flare observations made by the [https://science.nrao.edu/facilities/vla/ Karl G. Jansky Very Large Array] (VLA). Below is a partial list of publications that utilize VLA solar data (see also [https://ui.adsabs.harvard.edu/public-libraries/ZwbjpLo9RS-viufWEoQ95Q this NASA/ADS Library]).&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...911....4L/abstract Luo et al. (2021), ApJ, 911, 4] ''Radio Spectral Imaging of an M8.4 Eruptive Solar Flare: Possible Evidence of a Termination Shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2021ApJ...910...40Z/abstract Zhang et al. (2021), ApJ, 910, 40] ''Multiwavelength Observations of the Formation and Eruption of a Complex Filament''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2020ApJ...904...94S/abstract Sharma et al. (2020), ApJ, 904, 94] ''Radio and X-Ray Observations of Short-lived Episodes of Electron Acceleration in a Solar Microflare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...884...63C/abstract Chen et al. (2019), ApJ, 884, 63] ''Radio Spectroscopic Imaging of a Solar Flare Termination Shock: Split-band Feature as Evidence for Shock Compression''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2019ApJ...872...71Y/abstract Yu &amp;amp; Chen (2019), ApJ, 872, 71] ''Possible Detection of Subsecond-period Propagating Magnetohydrodynamics Waves in Post-reconnection Magnetic Loops during a Two-ribbon Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2018ApJ...866...62C/abstract Chen et al. (2018), ApJ, 866, 62] ''Magnetic Reconnection Null Points as the Origin of Semirelativistic Electron Beams in a Solar Jet&lt;br /&gt;
''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2017ApJ...848...77W/abstract Wang et al. (2016), ApJ, 848, 77] ''Dynamic Spectral Imaging of Decimetric Fiber Bursts in an Eruptive Solar Flare''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2015Sci...350.1238C/abstract Chen et al. (2015), Science, 350, 1238] ''Particle acceleration by a solar flare termination shock''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2014ApJ...794..149C/abstract Chen et al. (2014), ApJ, 794, 149] ''Direct Evidence of an Eruptive, Filament-hosting Magnetic Flux Rope Leading to a Fast Solar Coronal Mass Ejection''&lt;br /&gt;
* [https://ui.adsabs.harvard.edu/abs/2013ApJ...763L..21C/abstract Chen et al. (2013), ApJL, 763, 21] ''Tracing Electron Beams in the Sun's Corona with Radio Dynamic Imaging Spectroscopy''&lt;/div&gt;</summary>
		<author><name>Schhabra</name></author>
	</entry>
</feed>