https://casaguides.nrao.edu/api.php?action=feedcontributions&user=Mlacy&feedformat=atomCASA Guides - User contributions [en]2024-03-28T18:31:04ZUser contributionsMediaWiki 1.38.6https://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4747Simulating Observations in CASA 3.12011-04-11T19:48:45Z<p>Mlacy: /* Tutorials, Recipes, and Example images */</p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"). This is particularly true for observations with poor coverage of the uv-plane, i.e. using telescopes with small numbers of antennas, such as the ALMA Early Science configurations, and/or in short "snapshot" observations. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality.<br />
Users are encouraged to use the ALMA helpdesk (for ALMA simulations) or the NRAO helpdesk (for simulations using other telescopes) to submit queries or comments. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== Simulating ALMA Observations ==<br />
<br />
We will update simdata as ALMA commissioning proceeds. During this period, we expect the noise properties of the telescope to be increasingly better characterized, and its configurations to be refined. Updates will be placed below, under "ALMA updates", along with an estimate of which version of CASA they will be applied to. Configuration files will also be placed here, until they can be incorporated in the next CASA release. <br />
<br />
<br />
Users should also be aware of the Observation Support Tool (OST) [http://almaost.jb.man.ac.uk/ ]. This is a web-based interface to an ALMA simulator hosted by the University of Manchester, UK. Like simdata, it is based on the CASA sm toolkit, but uses different wrapper scripts, and, in particular, has a different treatment of atmospheric effects. Comparisons to the ALMA sensitivity calculator made in March 2011 suggest that both simdata and the OST give similar noises for observations in bands 3-8, but the OST diverges in bands 9 and 10. <font color="red"> In general, however, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it, not simdata or the OST, should be used to estimate exposure times for ALMA Science Goals.</font><br />
<br />
<br />
'''ALMA updates'''<br />
<br />
<font color="red"> March 2011: the receiver temperatures in ALMA bands 6,7 and 9, and the sideband gain in band 9, have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.)</font><br />
<br />
Simdata in CASA 3.1 does not provide the final versions of the ALMA Early Science (Cycle 0) configurations, though they will be present in CASA 3.2. For those who wish to perform Early Science simulations the two configuration files (compact and extended) are available for download below:<br />
<br />
[[File:CompactCycle0.txt]]<br />
<br />
[[File:ExtendedCycle0.txt]]<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: how to run the simulation faster by increasing the [[etime study|exposure time]]<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| The face of Einstein: sky model and lightly annotated script<br><br />
An example of using a non-science image to demonstrate the effects of spatial filtering by ALMA. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:einstein_fs_cfg8_1hr.gif|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[Einstein-Face | simdata recipe page]]<br />
|-<br />
<br />
<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4746Simulating Observations in CASA 3.12011-04-11T19:46:34Z<p>Mlacy: /* Introduction */</p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"). This is particularly true for observations with poor coverage of the uv-plane, i.e. using telescopes with small numbers of antennas, such as the ALMA Early Science configurations, and/or in short "snapshot" observations. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality.<br />
Users are encouraged to use the ALMA helpdesk (for ALMA simulations) or the NRAO helpdesk (for simulations using other telescopes) to submit queries or comments. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== Simulating ALMA Observations ==<br />
<br />
We will update simdata as ALMA commissioning proceeds. During this period, we expect the noise properties of the telescope to be increasingly better characterized, and its configurations to be refined. Updates will be placed below, under "ALMA updates", along with an estimate of which version of CASA they will be applied to. Configuration files will also be placed here, until they can be incorporated in the next CASA release. <br />
<br />
<br />
Users should also be aware of the Observation Support Tool (OST) [http://almaost.jb.man.ac.uk/ ]. This is a web-based interface to an ALMA simulator hosted by the University of Manchester, UK. Like simdata, it is based on the CASA sm toolkit, but uses different wrapper scripts, and, in particular, has a different treatment of atmospheric effects. Comparisons to the ALMA sensitivity calculator made in March 2011 suggest that both simdata and the OST give similar noises for observations in bands 3-8, but the OST diverges in bands 9 and 10. <font color="red"> In general, however, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it, not simdata or the OST, should be used to estimate exposure times for ALMA Science Goals.</font><br />
<br />
<br />
'''ALMA updates'''<br />
<br />
<font color="red"> March 2011: the receiver temperatures in ALMA bands 6,7 and 9, and the sideband gain in band 9, have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.)</font><br />
<br />
Simdata in CASA 3.1 does not provide the final versions of the ALMA Early Science (Cycle 0) configurations, though they will be present in CASA 3.2. For those who wish to perform Early Science simulations the two configuration files (compact and extended) are available for download below:<br />
<br />
[[File:CompactCycle0.txt]]<br />
<br />
[[File:ExtendedCycle0.txt]]<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: increasing the [[etime study|exposure time]] to run faster<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| The face of Einstein: sky model and lightly annotated script<br><br />
An example of using a non-science image to demonstrate the effects of spatial filtering by ALMA. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:einstein_fs_cfg8_1hr.gif|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[Einstein-Face | simdata recipe page]]<br />
|-<br />
<br />
<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4745Simulating Observations in CASA 3.12011-04-11T19:45:23Z<p>Mlacy: </p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"). This is particularly true for observations with poor coverage of the uv-plane, in telescopes with small numbers of antennas, such as the ALMA Early Science configurations, and/or in short "snapshot" observations. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality.<br />
Users are encouraged to use the ALMA helpdesk (for ALMA simulations) or the NRAO helpdesk (for simulations using other telescopes) to submit queries or comments. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== Simulating ALMA Observations ==<br />
<br />
We will update simdata as ALMA commissioning proceeds. During this period, we expect the noise properties of the telescope to be increasingly better characterized, and its configurations to be refined. Updates will be placed below, under "ALMA updates", along with an estimate of which version of CASA they will be applied to. Configuration files will also be placed here, until they can be incorporated in the next CASA release. <br />
<br />
<br />
Users should also be aware of the Observation Support Tool (OST) [http://almaost.jb.man.ac.uk/ ]. This is a web-based interface to an ALMA simulator hosted by the University of Manchester, UK. Like simdata, it is based on the CASA sm toolkit, but uses different wrapper scripts, and, in particular, has a different treatment of atmospheric effects. Comparisons to the ALMA sensitivity calculator made in March 2011 suggest that both simdata and the OST give similar noises for observations in bands 3-8, but the OST diverges in bands 9 and 10. <font color="red"> In general, however, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it, not simdata or the OST, should be used to estimate exposure times for ALMA Science Goals.</font><br />
<br />
<br />
'''ALMA updates'''<br />
<br />
<font color="red"> March 2011: the receiver temperatures in ALMA bands 6,7 and 9, and the sideband gain in band 9, have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.)</font><br />
<br />
Simdata in CASA 3.1 does not provide the final versions of the ALMA Early Science (Cycle 0) configurations, though they will be present in CASA 3.2. For those who wish to perform Early Science simulations the two configuration files (compact and extended) are available for download below:<br />
<br />
[[File:CompactCycle0.txt]]<br />
<br />
[[File:ExtendedCycle0.txt]]<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: increasing the [[etime study|exposure time]] to run faster<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| The face of Einstein: sky model and lightly annotated script<br><br />
An example of using a non-science image to demonstrate the effects of spatial filtering by ALMA. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:einstein_fs_cfg8_1hr.gif|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[Einstein-Face | simdata recipe page]]<br />
|-<br />
<br />
<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4744Simulating Observations in CASA 3.12011-04-11T19:38:09Z<p>Mlacy: </p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"), particularly for Early Science configurations, where the dynamic range of the beam is low. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality.<br />
Users are encouraged to use the ALMA helpdesk (for ALMA simulations) or the NRAO helpdesk (for simulations using other telescopes) to submit queries or comments. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== Simulating ALMA Observations ==<br />
<br />
We will update simdata as ALMA commissioning proceeds. During this period, we expect the noise properties of the telescope to be increasingly better characterized, and its configurations to be refined. Updates will be placed below, under "ALMA updates", along with an estimate of which version of CASA they will be applied to. Configuration files will also be placed here, until they can be incorporated in the next CASA release. <br />
<br />
<br />
Users should also be aware of the Observation Support Tool (OST) [http://almaost.jb.man.ac.uk/ ]. This is a web-based interface to an ALMA simulator hosted by the University of Manchester, UK. Like simdata, it is based on the CASA sm toolkit, but uses different wrapper scripts, and, in particular, has a different treatment of atmospheric effects. Comparisons to the ALMA sensitivity calculator made in March 2011 suggest that both simdata and the OST give similar noises for observations in bands 3-8, but the OST diverges in bands 9 and 10. <font color="red"> In general, however, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it, not simdata or the OST, should be used to estimate exposure times for ALMA Science Goals.</font><br />
<br />
<br />
'''ALMA updates'''<br />
<br />
<font color="red"> March 2011: the receiver temperatures in ALMA bands 6,7 and 9, and the sideband gain in band 9, have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.)</font><br />
<br />
Simdata in CASA 3.1 does not provide the final versions of the ALMA Early Science (Cycle 0) configurations, though they will be present in CASA 3.2. For those who wish to perform Early Science simulations the two configuration files (compact and extended) are available for download below:<br />
<br />
[[File:CompactCycle0.txt]]<br />
<br />
[[File:ExtendedCycle0.txt]]<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: increasing the [[etime study|exposure time]] to run faster<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| The face of Einstein: sky model and lightly annotated script<br><br />
An example of using a non-science image to demonstrate the effects of spatial filtering by ALMA. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:einstein_fs_cfg8_1hr.gif|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[Einstein-Face | simdata recipe page]]<br />
|-<br />
<br />
<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4743Simulating Observations in CASA 3.12011-04-11T19:34:38Z<p>Mlacy: </p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"), particularly for Early Science configurations, where the dynamic range of the beam is low. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality.<br />
Users are encouraged to use the ALMA helpdesk (for help with ALMA simulations) or the NRAO helpdesk (for other telescopes) with any questions. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== Simulating ALMA Observations ==<br />
<br />
We will update simdata as ALMA commissioning proceeds. During this period, we expect the noise properties of the telescope to be increasingly better characterized, and its configurations to be refined. Updates will be placed below, under "ALMA updates", along with an estimate of which version of CASA they will be applied to. Configuration files will also be placed here, until they can be incorporated in the next CASA release. <br />
<br />
<br />
Users should also be aware of the Observation Support Tool (OST) [http://almaost.jb.man.ac.uk/ ]. This is a web-based interface to an ALMA simulator hosted by the University of Manchester, UK. Like simdata, it is based on the CASA sm toolkit, but uses different wrapper scripts, and, in particular, has a different treatment of atmospheric effects. Comparisons to the ALMA sensitivity calculator made in March 2011 suggest that both simdata and the OST give similar noises for observations in bands 3-8, but the OST diverges in bands 9 and 10. <font color="red"> In general, however, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it should be used to estimate exposure times for ALMA Science Goals.</font><br />
<br />
<br />
'''ALMA updates'''<br />
<br />
<font color="red"> March 2011: the receiver temperatures in ALMA bands 6,7 and 9, and the sideband gain in band 9, have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.)</font><br />
Simdata in CASA 3.1 does not provide the final versions of the ALMA Early Science (Cycle 0) configurations, though they will be present in CASA 3.2. For those who wish to perform Early Science simulations the two configuration files (compact and extended) are available for download below:<br />
<br />
[[File:CompactCycle0.txt]]<br />
<br />
[[File:ExtendedCycle0.txt]]<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: increasing the [[etime study|exposure time]] to run faster<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| The face of Einstein: sky model and lightly annotated script<br><br />
An example of using a non-science image to demonstrate the effects of spatial filtering by ALMA. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:einstein_fs_cfg8_1hr.gif|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[Einstein-Face | simdata recipe page]]<br />
|-<br />
<br />
<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4737Simulating Observations in CASA 3.12011-04-05T16:14:37Z<p>Mlacy: </p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <br />
<br />
<font color="red"> NOTE FOR ALMA OBSERVERS: the receiver temperatures in bands 6,7 and 9, and the sideband gain in band 9 have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.) In general, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it should be used to estimate exposure times in ALMA proposals.</font> <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"), particularly for Early Science configurations, where the dynamic range of the beam is low. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality, please email rindebet at nrao.edu with any questions - It's my job to help you use this software. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== ALMA Early Science Configurations ==<br />
<br />
Simdata in CASA 3.1 does not provide the final versions of the ALMA Early Science (Cycle 0) configurations, though they will be present in CASA 3.2. For those who wish to perform Early Science simulations the two configuration files (compact and extended) are available for download below:<br />
<br />
[[File:CompactCycle0.txt]]<br />
<br />
[[File:ExtendedCycle0.txt]]<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: increasing the [[etime study|exposure time]] to run faster<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| The face of Einstein: sky model and lightly annotated script<br><br />
An example of using a non-science image to demonstrate the effects of spatial filtering by ALMA. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:einstein_fs_cfg8_1hr.gif|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[Einstein-Face | simdata recipe page]]<br />
|-<br />
<br />
<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=File:ExtendedCycle0.txt&diff=4736File:ExtendedCycle0.txt2011-04-05T16:10:28Z<p>Mlacy: Cycle 0 extended configuration as of 5th April 2011</p>
<hr />
<div>Cycle 0 extended configuration as of 5th April 2011</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=File:CompactCycle0.txt&diff=4735File:CompactCycle0.txt2011-04-05T16:09:12Z<p>Mlacy: Cycle 0 compact configuration as of 5th April 2011</p>
<hr />
<div>Cycle 0 compact configuration as of 5th April 2011</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4733Simulating Observations in CASA 3.12011-04-01T15:25:49Z<p>Mlacy: /* Tutorials, Recipes, and Example images */</p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <br />
<br />
<font color="red"> NOTE FOR ALMA OBSERVERS: the receiver temperatures in bands 6,7 and 9, and the sideband gain in band 9 have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.) In general, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it should be used to estimate exposure times in ALMA proposals.</font> <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"), particularly for Early Science configurations, where the dynamic range of the beam is low. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality, please email rindebet at nrao.edu with any questions - It's my job to help you use this software. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: increasing the [[etime study|exposure time]] to run faster<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| The face of Einstein: sky model and lightly annotated script<br><br />
An example of using a non-science image to demonstrate the effects of spatial filtering by ALMA. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:einstein_fs_cfg8_1hr.gif|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[Einstein-Face | simdata recipe page]]<br />
|-<br />
<br />
<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4732Einstein-Face (CASA 3.2)2011-04-01T14:49:56Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by simdata (an 8bit to 16bit conversion) and trim it down to 300x300 pixels.<br />
<br />
First, read the FITS file into CASA. Then use immath to trim the image to 300x300 and write it out as 16-bit FITS file:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
importfits(fitsimage='einstein.fits',imagename='testimage',overwrite=T)<br />
default 'immath'<br />
imagename = 'testimage'<br />
expr = 'IM0'<br />
box = '0,0,299,299'<br />
outfile = 'testimage2'<br />
immath()<br />
exportfits(imagename ='testimage2',fitsimage ='einstein16.fits',bitpix=16,overwrite=T)<br />
</source><br />
<br />
<br />
'''Step 4''' Prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing is set to ensure that only one pointing is observed. The image scale is chosen to ensure good sampling of the beam, and the observation is pointed near the Chandra Deep Field South:<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = T<br />
skymodel = 'einstein16.fits'<br />
indirection = 'J2000 03h30m00 -28d00m00'<br />
incell = '0.043arcsec'<br />
incenter = '245GHz'<br />
inwidth = '2GHz'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
overwrite=T<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4731Einstein-Face (CASA 3.2)2011-04-01T14:47:05Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by simdata (an 8bit to 16bit conversion) and trim it down to 300x300 pixels.<br />
<br />
First, read the FITS file into CASA. Then use immath to trim the image to 300x300 and write it out as 16-bit FITS file:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
importfits(fitsimage='einstein.fits',imagename='testimage',overwrite=T)<br />
default 'immath'<br />
imagename = 'testimage'<br />
expr = 'IM0'<br />
box = '0,0,299,299'<br />
outfile = 'testimage2'<br />
immath()<br />
exportfits(imagename ='testimage2',fitsimage ='einstein16.fits',bitpix=16,overwrite=T)<br />
</source><br />
<br />
<br />
'''Step 4''' Prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing is set to ensure that only one pointing is observed. The image scale is chosen to ensure good sampling of the beam, and the observation is pointed near the Chandra Deep Field South:<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = T<br />
skymodel = 'einstein16.fits'<br />
indirection = 'J2000 03h30m00 -28d00m00'<br />
incell = '0.043arcsec'<br />
incenter = '245GHz'<br />
inwidth = '2GHz'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4730Einstein-Face (CASA 3.2)2011-04-01T14:24:04Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by simdata (an 8bit to 16bit conversion) and trim it down to 300x300 pixels.<br />
<br />
First, read the FITS file into CASA. Then use immath to trim the image to 300x300 and write it out as 16-bit FITS file:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
importfits(fitsimage='einstein.fits',imagename='testimage',overwrite=T)<br />
default 'immath'<br />
imagename = 'testimage'<br />
expr = 'IM0'<br />
box = '0,0,299,299'<br />
outfile = 'testimage2'<br />
immath()<br />
exportfits(imagename ='testimage2',fitsimage ='einstein16.fits',bitpix=16,overwrite=T)<br />
</source><br />
<br />
<br />
'''Step 4''' Prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing is set to ensure that only one pointing is observed. The image scale is chosen to ensure good sampling of the beam, and the observation is pointed near the Chandra Deep Field South:<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = T<br />
skymodel = 'einstein16.fits'<br />
indirection = 'J2000 03h30m00 -28d00m00'<br />
incell = '0.043arcsec'<br />
incenter = '245GHz'<br />
inwidith = '2GHz'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4729Einstein-Face (CASA 3.2)2011-04-01T14:14:37Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by simdata (an 8bit to 16bit conversion) and trim it down to 300x300 pixels.<br />
<br />
First, read the FITS file into CASA. Then use immath to trim the image to 300x300 and write it out as 16-bit FITS file:<br />
<br />
<source lang="python"><br />
importfits(fitsimage='einstein.fits',imagename='testimage',overwrite=T)<br />
default 'immath'<br />
imagename = 'testimage'<br />
expr = 'IM0'<br />
box = '0,0,299,299'<br />
outfile = 'testimage2'<br />
immath()<br />
exportfits(imagename ='testimage2.fits',fitsimage ='einstein16.fits',bitpix=16,overwrite=T)<br />
<br />
<br />
ia.fromfits(outfile='testimage',infile='einstein.fits',overwrite=T)<br />
box = rg.box([0,0],[299,299])<br />
im2 = ia.subimage('testimage2',box,overwrite=T)<br />
csys = im2.coordsys()<br />
csys.setdirection(refcode='EQUATORIAL',proj='SIN',projpar=[0,0],refpix=[150,150], refval="52.5deg -28.5deg", incr="-0.043arcsec,0.043arcsec,1.0MHz")<br />
ep = 2000.0<br />
csys.setepoch(ep)<br />
ok = im2.tofits('einstein16.fits',bitpix=16,overwrite=true)<br />
im2.done()<br />
ia.close()<br />
<br />
</source><br />
<br />
Below is the IDL version.<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
If you want to skip the above steps, the fits file is [[File:Twodmodel.fits.txt]]. download it and copy it to twodmodel.fits<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4728Einstein-Face (CASA 3.2)2011-04-01T13:49:37Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by simdata (an 8bit to 16bit conversion) and trim it down to 300x300 pixels.<br />
<br />
First, read in the FITS file. Then use immath to trim the image to 300x300 and write it out as 16-bit FITS file:<br />
<br />
<source lang="python"><br />
importfits(fitsimage='einstein.fits',imagename='testimage',overwrite=T)<br />
default 'immath'<br />
imagename = 'testimage'<br />
expr = 'IM0'<br />
box = '0,0,299,299'<br />
<br />
<br />
ia.fromfits(outfile='testimage',infile='einstein.fits',overwrite=T)<br />
box = rg.box([0,0],[299,299])<br />
im2 = ia.subimage('testimage2',box,overwrite=T)<br />
csys = im2.coordsys()<br />
csys.setdirection(refcode='EQUATORIAL',proj='SIN',projpar=[0,0],refpix=[150,150], refval="52.5deg -28.5deg", incr="-0.043arcsec,0.043arcsec,1.0MHz")<br />
ep = 2000.0<br />
csys.setepoch(ep)<br />
ok = im2.tofits('einstein16.fits',bitpix=16,overwrite=true)<br />
im2.done()<br />
ia.close()<br />
<br />
</source><br />
<br />
Below is the IDL version.<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
If you want to skip the above steps, the fits file is [[File:Twodmodel.fits.txt]]. download it and copy it to twodmodel.fits<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4727Simulating Observations in CASA 3.12011-03-29T19:50:46Z<p>Mlacy: /* Introduction */</p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <br />
<br />
<font color="red"> NOTE FOR ALMA OBSERVERS: the receiver temperatures in bands 6,7 and 9, and the sideband gain in band 9 have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.) In general, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it should be used to estimate exposure times in ALMA proposals.</font> <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"), particularly for Early Science configurations, where the dynamic range of the beam is low. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality, please email rindebet at nrao.edu with any questions - It's my job to help you use this software. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: increasing the [[etime study|exposure time]] to run faster<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4726Simulating Observations in CASA 3.12011-03-29T19:38:35Z<p>Mlacy: /* Introduction */</p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <br />
<br />
<font color="red"> NOTE FOR ALMA OBSERVERS: the receiver temperatures in bands 6,7 and 9, and the sideband gain in band 9 have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.) In general, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it should be used to scale exposure times in ALMA proposals.</font> <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"), particularly for Early Science configurations, where the dynamic range of the beam is low. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality, please email rindebet at nrao.edu with any questions - It's my job to help you use this software. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: increasing the [[etime study|exposure time]] to run faster<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA_3.1&diff=4725Simulating Observations in CASA 3.12011-03-29T18:36:25Z<p>Mlacy: /* Introduction */</p>
<hr />
<div>[[Category: Simulations]] [[Category: ALMA]]<br />
<br />
== Introduction == <br />
<br />
Simulation capability in CASA follows the usual two-layered structure: there is a beginner-level python <tt>task</tt> interface called [[simdata]], which calls methods in the <tt>sm</tt> C++ <tt>tool</tt>. The task interface turns a model of the sky (2 to 4 dimensions including frequency and Stokes) into the visibilities that would be measured with ALMA, (E)VLA, CARMA, SMA, ATCA, PdB, etc. The task also can produce a cleaned image of the model visibilities, compare that image with your input convolved with the synthesized beam, and calculate a fidelity image. <tt>simdata</tt> can add thermal noise (from receiver, atmosphere, and ground) to the visibilities. <font color="red">Note that the receiver temperatures in bands 6,7 and 9, and the sideband gain in band 9 have recently been revised in the ALMA sensitivity calculator. These revisions are not in the current version of simdata. Thus, <br />
the sensitivities in these bands measured from simdata outputs will be incorrect. (We expect the 3.2 version of CASA will contain the corrected values.) In general, because the ALMA sensitivity calculator will be used for the technical assessment of ALMA proposals, only values from it should be used to scale exposure times in ALMA proposals.</font> <br />
<br />
The <tt>sm</tt> tool has methods that can be used to add phase delay variations, gain fluctuations and drift, cross-polarization, and (coming soon) bandpass and pointing errors to your simulated data. <tt>sm</tt> also has more flexibility in adding thermal noise than <tt>simdata</tt>, for example for new observatories that are unknown to <tt>simdata</tt>.<br />
<br />
<font color="red">New for CASA version 3.1.0</font>: The <tt>simdata</tt> task is the task formerly known in 3.0.2 as <tt>simdata2</tt>. The old version of simdata has been removed.<br />
<br />
CASA simulation uses the [http://www.mrao.cam.ac.uk/~bn204/alma/atmomodel.html aatm] atmospheric model, a thin wrapper of Juan Pardo's [http://damir.iem.csic.es/PARDO/class_atm.html ATM] library, to accurately calculate all atmospheric corruption terms (noise, phase delay) accurately as a function of frequency and site characteristics.<br />
<br />
Part of CASA's simulation routines are generic ephemeris and geodesy calculations available in python - see [[simutil.py]].<br />
<br />
'''Note on cleaning:''' just as is the case for real images, cleaning images produced by simdata can lead to a spurious decrease in object fluxes and noise on the image ("clean bias"), particularly for Early Science configurations, where the dynamic range of the beam is low. Users should always clean images with care, using a small number of iterations and/or a conservative (3-5-sigma) threshold, and boxing bright sources.<br />
<br />
<font color="green"> Because <tt>simdata</tt> is still actively being developed, documentation may lag reality, please email rindebet at nrao.edu with any questions - It's my job to help you use this software. In particular, you may find that some of the presentations and graphics below show parameter inputs that are slightly different from the latest version of CASA.</font><br />
<br />
== Steps to simulation ==<br />
<br />
<font color="red">Users of the most recent version of CASA, 3.1.0 and later should use simdata. If you are using CASA 3.0.2, you should use simdata2</font>.<br />
<br />
{| style="width: 100%; valign: top; " cellpadding=10 <br />
|- valign="top"<br />
<br />
<br />
| style="width: 98%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF;" |<br />
<big>'''simdata'''</big> <font color="red">(named simata2 in CASA 3.0.2)</font> [http://casa.nrao.edu/casa_obtaining.shtml Obtaining CASA]<br /> <br />
<br />
1. [[Getting Started in CASA#Installing CASA | Install CASA]]<br />
<br />
<tt>simdata (v3.1.0) and simdata2 (v3.0.2)</tt> inputs look like this (click to enlarge): [[File:Simdata_new.png|100px]] [[File:Simdata2.png|100px]]<br />
<br />
The subtasks are modular i.e. as long as you follow a few conventions about filenames, you can run each <br />
bit independently and optionally. For example, you can modify the sky model, then predict ACA visibilities, then run again and predict<br />
ATCA 12m visibilities and image and analyze both measurement sets together. You can run once to predict, run interactive clean yourself, and as long as you called your image $project.image, run <tt>simdata</tt> just to calculate a difference image and analyze the results.<br />
<br />
2. [[Modify Model]] - relabel (scale) the spectral and spatial coordinates and brightness of the sky model image.<br />
<br />
3. [[Set Pointings]] - calculate a mosaic of pointings and save in a text file. You could also make the text file yourself.<br />
<br />
4. [[Predict]] - Calculate visibilities for a specified array on a specified day<br />
<br />
5. [[Corrupt]] - Corrupt the measurement set with thermal noise, phase noise, cross-polarization, etc.<br />
<br />
6. [[Image]] A subset of <tt>clean</tt> to re-image the visibilities<br />
<br />
7. [[Analyze]] Calculate and display the difference between output and input, and fidelity image.<br />
|}<br />
<br />
== Tutorials, Recipes, and Example images ==<br />
<br />
{| style="width: 100%; valign: top; background-color:#E0FFFF; border:1px solid #3366FF; " cellpadding=0<br />
| New User's Guide to Simulated ALMA Observations: fully annotated tutorial<br><br />
This uses a Spitzer SAGE 8 micron continuum image of 30 Doradus and scales it to greater distance.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:30Dor_ES.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[New Users Guide| simdata recipe page]]<br />
|-<br />
<br />
| Simulated ALMA Observation of M51 at z = 0.1 and z = 0.3: fully annotated tutorial<br><br />
This uses a BIMA-SONG cube of a nearby galaxy and scales it to greater distance.<br />
| rowspan=3; style="border-bottom:1px solid black;" | [[File:M51thumb.png|100px]]<br />
|-<br />
!style="solid black;"| &nbsp;&nbsp; [[M51 at z = 0.1 and z = 0.3|simdata recipe page]]<br />
|-<br />
!style="border-bottom:1px solid black;"| NOTE: increasing the [[etime study|exposure time]] to run faster<br />
|-<br />
<br />
<br />
| Protoplanetary Disk: sky model and lightly annotated script<br><br />
This uses a theoretical model of dust continuum from Sebastian Wolff, scaled to the distance of a nearby star. <br />
| rowspan=2; stype="border-bottom:1px solid black;" | [[File:Psimthumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;" | [[PPdisk simdata2| simdata recipe page]]<br />
|-<br />
<br />
| Nearby edge-on spiral galaxy: sky model, script, and discussion<br><br />
This uses a Galactic CO cube from the Galactic Ring Survey and places <br />
it at 10Mpc, similar to what NGC891 would look like if it were observable from the southern hemisphere.<br />
| rowspan=2; style="border-bottom:1px solid black;" | [[File:N891thumb.png|100px]]<br />
|-<br />
!style="border-bottom:1px solid black;"| [[N891 simdata2| simdata recipe page]]<br />
|-<br />
<br />
| colspan=2; style="border-bottom:1px solid black;" | [[Sim Inputs | Other example input images]]<br />
|-<br />
| colspan=2; | [[Sim Outputs | Other example output simulations]] (scripts to reproduce these are coming)<br />
<br />
|}<br />
<br />
<br />
<br><br />
<br />
== Technical and Planning ==<br />
I always welcome input on developing the CASA simulator, and these links are meetings, technical documents, and planning discussions. Much of it won't make sense to a new user of CASA::simdata, but may be of interest to those wanting to delve deeper:<br />
* [http://almasimulations.pbworks.com/ Simulation Library] This will become a library of use cases and examples illustrating different science and observation setups. It is in early stages as of Jan 2010, and we're actively seeking volunteers to turn their simulation projects into use cases. <br />
* [https://safe.nrao.edu/wiki/bin/view/ALMA/Jan2010Wkshop Jan 2010 workshop] Including slides and discussion of how simdata and Simulator work "under the hood" and plans for development<br />
''Italic text''</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4617Einstein-Face (CASA 3.2)2011-03-07T18:09:49Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by simdata (an 8bit to 16bit conversion) and trim it down to 300x300 pixels. For convenience, we are also adding a World Coordinate System (WCS) at this point (though this is not strictly necessary as the WCS parameters can be supplied directly to the simdata task). As with most operations in CASA, we may either use high level tasks, or the low level toolkit to perform these operations. Users who are more familiar with IDL will probably prefer the toolkit, as it provides similar functionality to the IDL astronomy library. Users who are more familiar with AIPS or IRAF, or who are novices, will probably prefer the tasks approach. For completeness, we give both here.<br />
<br />
Toolkit version:<br />
<br />
First, read in the FITS file. Then define region "box" to trim. The subimage tool is then used to create "testimage2" which has the box applied, and the object becomes im2. im2 then has WCS added and is written to a 16bit integer fits file.<br />
<br />
<source lang="python"><br />
ia.fromfits(outfile='testimage',infile='einstein.fits',overwrite=T)<br />
box = rg.box([0,0],[299,299])<br />
im2 = ia.subimage('testimage2',box,overwrite=T)<br />
csys = im2.coordsys()<br />
csys.setdirection(refcode='EQUATORIAL',proj='SIN',projpar=[0,0],refpix=[150,150], refval="52.5deg -28.5deg", incr="-0.043arcsec,0.043arcsec,1.0MHz")<br />
ep = 2000.0<br />
csys.setepoch(ep)<br />
ok = im2.tofits('einstein16.fits',bitpix=16,overwrite=true)<br />
im2.done()<br />
ia.close()<br />
<br />
</source><br />
<br />
Below is the IDL version.<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
If you want to skip the above steps, the fits file is [[File:Twodmodel.fits.txt]]. download it and copy it to twodmodel.fits<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4611Einstein-Face (CASA 3.2)2011-03-03T22:02:43Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by simdata (an 8bit to 16bit conversion) and trim it down to 300x300 pixels. <br />
For convenience, we are also adding a WCS at this point. We need to use some of the low level toolkit<br />
tasks to perform these conversions:<br />
<br />
Read the FITS file into CASA, trim it, and write it out as a 16-bit integer<br />
<br />
<source lang="python"><br />
ia.fromfits(outfile='testimage',infile='einstein.fits',overwrite=T)<br />
box = rg.box([0,0],[299,299])<br />
im2 = ia.subimage('testimage2',box,overwrite=T)<br />
ok = im2.tofits('einstein16.fits',bitpix=16,overwrite=true)<br />
ia.close()<br />
im2.close()<br />
</source><br />
<br />
Below is the IDL version.<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
If you want to skip the above steps, the fits file is [[File:Twodmodel.fits.txt]]. download it and copy it to twodmodel.fits<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4603Einstein-Face (CASA 3.2)2011-03-03T21:48:11Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by simdata (an 8bit to 16bit conversion) and trim it down to 300x300 pixels. <br />
For convenience, we are also adding a WCS at this point. We need to use some of the low level toolkit<br />
tasks to perform these conversions:<br />
<br />
Read the FITS file into CASA, trim it, and write it out as a 16-bit integer<br />
<br />
<source lang="python"><br />
ia.fromfits(outfile='testimage2.im',infile='einstein.fits')<br />
box = rg.box([0,0],[299,299])<br />
im2 = ia.subimage('testimage2.im',box,overwrite=T)<br />
ok = ia.tofits('einstein16.fits',bitpix=16,overwrite=true)<br />
ia.close()<br />
</source><br />
<br />
Below is the IDL version.<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
If you want to skip the above steps, the fits file is [[File:Twodmodel.fits.txt]]. download it and copy it to twodmodel.fits<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4587Einstein-Face (CASA 3.2)2011-03-02T19:23:18Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by simdata (an 8bit to 16bit conversion) and trim it down to 300x300 pixels. <br />
For convenience, we are also adding a WCS at this point. We need to use some of the low level toolkit<br />
tasks to perform these conversions:<br />
<br />
Read the FITS file into CASA, trim it, and write it out as a 16-bit integer<br />
<br />
<source lang="python"><br />
ia.fromfits(outfile='testimage2.im',infile='einstein.fits')<br />
ok = ia.tofits('einstein16.fits',bitpix=16,overwrite=true)<br />
ia.close()<br />
<\source><br />
<br />
Below is the IDL version.<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
If you want to skip the above steps, the fits file is [[File:Twodmodel.fits.txt]]. download it and copy it to twodmodel.fits<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4586Einstein-Face (CASA 3.2)2011-02-17T16:56:23Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
If you want to skip the above steps, the fits file is [[File:Twodmodel.fits.txt]]. download it and copy it to twodmodel.fits<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4585Einstein-Face (CASA 3.2)2011-02-17T16:55:43Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
If you want to skip the above steps, the fits file is [here [File:twodmodel.fits.txt]]. download it and copy it to twodmodel.fits<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4584Einstein-Face (CASA 3.2)2011-02-17T16:55:14Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
If you want to skip the above steps, the fits file is [here [twodmodel.fits.txt]]. download it and copy it to twodmodel.fits<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=File:Twodmodel.fits.txt&diff=4583File:Twodmodel.fits.txt2011-02-17T16:53:50Z<p>Mlacy: Copy this file to twodmodel.fits</p>
<hr />
<div>Copy this file to twodmodel.fits</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4582Einstein-Face (CASA 3.2)2011-02-17T16:52:29Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation. <br />
To be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4581Einstein-Face (CASA 3.2)2011-02-17T16:51:14Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4580Einstein-Face (CASA 3.2)2011-02-17T16:49:34Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[M51 simulation guide [http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3]].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4579Einstein-Face (CASA 3.2)2011-02-17T16:45:27Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation. Inputs to simdata are given below. The integration time<br />
is set much longer than realistic (300s, compared to 1-10s in practice) to speed the computation. The map spacing <br />
is set to ensure that only one pointing is observed:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4578Einstein-Face (CASA 3.2)2011-02-17T15:43:42Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4577Einstein-Face (CASA 3.2)2011-02-17T15:42:50Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observation:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[http://casaguides.nrao.edu/index.php?title=M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Note that the image quality is noticeably better in this ~full track image, even in Full Science.<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4576Einstein-Face (CASA 3.2)2011-02-17T15:41:00Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide].<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Note that the image quality is noticeably better in this ~full track image, even in Full Science.<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
An attempt to make a higher resolution image shows what happens when short spacings are missing in the configuration.<br />
Configuration 16 has a 0.17x0.15 beam, still better than Nyquist sampling of the model image (which has 0.043" pixels).<br />
However, the lack of short spacings in the configuration leads to poorly sampled structure on large spatial scales. In practice, one<br />
would need to combine these observations with a set in a more compact configuration (such as 8) to sample both the large<br />
and small spatial structures.<br />
<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out16.cfg"<br />
project = 'fs_cfg16_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
The result is: [[File:einstein_fs_cfg16_1hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=File:Einstein_fs_cfg16_1hr.gif&diff=4575File:Einstein fs cfg16 1hr.gif2011-02-17T15:39:00Z<p>Mlacy: </p>
<hr />
<div></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4574Einstein-Face (CASA 3.2)2011-02-17T15:23:27Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg|200px]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_1hr.gif]]<br />
<br />
Note that the image quality is noticeably better in this ~full track image, even in Full Science.<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=File:Einstein_fs_cfg8_1hr.gif&diff=4573File:Einstein fs cfg8 1hr.gif2011-02-17T15:22:12Z<p>Mlacy: </p>
<hr />
<div></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4572Einstein-Face (CASA 3.2)2011-02-17T15:15:06Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. These toy models can be particularly useful for examining the effects of varying uv-coverage on image fidelity if the "truth" model is a familiar object or image. In this example (which is on page 13 of the [http://almatelescope.ca/ALMA-ESPrimer.pdf ALMA Early Science Primer])we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg|200px]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 1hr observation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_1hr'<br />
totaltime = '3600s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
Note that the image quality is noticeably better in this ~full track image, even in Full Science.<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]<br />
<br />
'''Further experiments:'''<br />
<br />
Some more things to try:<br />
<br />
An 8hr observation shows the improvement obtained by obtaining fuller uv-coverage in the full science array:<br />
<source lang="python"><br />
tget simdata<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4571Einstein-Face (CASA 3.2)2011-02-17T15:05:47Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg|200px]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg|300px]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 8hr track:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
Note that the image quality is noticeably better in this ~full track image, even in Full Science.<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and a 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_4hr.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=File:Einstein_es_cfg250_4hr.gif&diff=4570File:Einstein es cfg250 4hr.gif2011-02-17T15:04:13Z<p>Mlacy: </p>
<hr />
<div></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4569Einstein-Face (CASA 3.2)2011-02-17T14:54:39Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 8hr track:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
Note that the image quality is noticeably better in this ~full track image, even in Full Science.<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min and one 4hr:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source><br />
<br />
which looks like this: [[File:einstein_es_cfg250_10min.gif]]<br />
<br />
and the 4hr simulation:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_4hr'<br />
totaltime = '14400s'<br />
simdata<br />
</source></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=File:Einstein_es_cfg250_10min.gif&diff=4568File:Einstein es cfg250 10min.gif2011-02-17T14:53:03Z<p>Mlacy: </p>
<hr />
<div></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4567Einstein-Face (CASA 3.2)2011-02-16T21:39:35Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 8hr track:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
Note that the image quality is noticeably better in this ~full track image, even in Full Science.<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min and one 4hr:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg"<br />
totaltime = '600s'<br />
simdata<br />
</source></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4566Einstein-Face (CASA 3.2)2011-02-16T21:38:45Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 8hr track:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
Note that the image quality is noticeably better in this ~full track image, even in Full Science.<br />
<br />
Finally, two Early Science simulations, using the 250m configuration. One 10min and one 4hr:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'es_cfg250_10m'<br />
antennalist = repodir+"/data/alma/simmos/alma.early.250m.cfg<br />
totaltime = '600s'<br />
simdata<br />
</source></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4565Einstein-Face (CASA 3.2)2011-02-16T21:21:26Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 8hr track:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source><br />
<br />
Which should look something like: [[File:einstein_fs_cfg8_8hr.gif]]<br />
<br />
Note that the image quality is noticeably better in this ~full track image, even in Full Science.</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=File:Einstein_fs_cfg8_8hr.gif&diff=4564File:Einstein fs cfg8 8hr.gif2011-02-16T21:20:00Z<p>Mlacy: </p>
<hr />
<div></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4563Einstein-Face (CASA 3.2)2011-02-16T21:15:19Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
simdata<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 8hr track:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
simdata<br />
</source></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4562Einstein-Face (CASA 3.2)2011-02-16T21:13:38Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]<br />
<br />
Now we repeat for an 8hr track:<br />
<br />
<source lang="python"><br />
tget simdata<br />
project = 'fs_cfg8_8hr'<br />
totaltime = '28800s'<br />
</source></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4561Einstein-Face (CASA 3.2)2011-02-16T21:11:54Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
<br />
</source><br />
<br />
The output image should have a synthesized beam of 0.62"x0.56" and look something like: <br />
[[File:einstein_fs_cfg8_10min.gif]]</div>Mlacyhttps://casaguides.nrao.edu/index.php?title=File:Einstein_fs_cfg8_10min.gif&diff=4560File:Einstein fs cfg8 10min.gif2011-02-16T21:10:25Z<p>Mlacy: </p>
<hr />
<div></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4559Einstein-Face (CASA 3.2)2011-02-16T21:05:33Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
Start with the 10min full science observtion:<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_10m'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '600s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
<br />
</source></div>Mlacyhttps://casaguides.nrao.edu/index.php?title=Einstein-Face_(CASA_3.2)&diff=4558Einstein-Face (CASA 3.2)2011-02-16T21:04:28Z<p>Mlacy: </p>
<hr />
<div>'''Simulations using non-science images: the face of Einstein<br />
'''<br />
<br />
Simdata can be used to simulate any digitized image. In this example, we use the face of Albert Einstein.<br />
<br />
'''Step 1:''' obtain your image. Typically from the internet.<br />
<br />
[[File:Einstein.jpg]]<br />
<br />
In this case, it is a jpg file.<br />
<br />
'''Step 2:''' Convert your image to FITS<br />
<br />
Various software programs have conversion to FITS enabled. The ([http://www.gimp.org GIMP]) was used in this case.<br />
A handy list of FITS conversion programs is maintained by GSFC [http://fits.gsfc.nasa.gov/fits_viewer.html here]<br />
<br />
For the GIMP, start up the software<br />
<br />
>gimp &<br />
<br />
and in the main window select "Open" from the "File" menu.<br />
<br />
The image will open up in a new window, you can use the GIMP to modify<br />
the image (adjust contrast, colormap etc). <br />
<br />
Then, select "Save as" from the "File" menu in the window containing the image,<br />
and hit "Select File Type" in the dialog box to bring up the file type options, and<br />
select "Flexible Image Transport System". Pick a name for your file ending in .fits, e.g. einstein.fits<br />
<br />
[[File:Gimp_save.jpg]]<br />
<br />
'''Step 3:''' check your file<br />
<br />
Read your file into e.g. [http://hea-www.harvard.edu/RD/ds9/ ds9]to check that a valid FITS file has been produced. You can <br />
also examine the pixel values to examine the scaling of the image. In this case, <br />
Einstein's forehead has pixel values around 230 and the background around 40, so there<br />
is plenty of contrast. You can also examine the image header in ds9. Under the "File"<br />
menu, select "Display FITS Header" and examine the output. Make sure that SIMPLE = T, NAXIS=2 and<br />
check BITPIX. In this case, BITPIX=8, which is not valid for reading into CASA, so we need to <br />
change that at the next step.<br />
<br />
FITS header produced by GIMP:<br />
<br />
SIMPLE = T <br />
<br />
BITPIX = 8<br />
<br />
NAXIS = 2 <br />
<br />
NAXIS1 = 300 <br />
<br />
NAXIS2 = 327 <br />
<br />
BZERO = 0.000000 <br />
<br />
BSCALE = 1.000000 <br />
<br />
DATAMIN = 0.000000 <br />
<br />
DATAMAX = 255.000000 <br />
<br />
HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW <br />
<br />
COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available<br />
<br />
COMMENT under the GNU general public licence. <br />
<br />
COMMENT For sources see http://www.kirchgessner.net <br />
<br />
COMMENT Image type within GIMP: GIMP_GRAY_IMAGE <br />
<br />
END <br />
<br />
'''Step 4''' Add FITS header keywords and change the format<br />
<br />
At this stage, we need to perform some manipulations on the FITS file to get it readable by CASA. <br />
For convenience, we are also adding a WCS at this point (though this can also be done in simdata).<br />
This routine is written in IDL, using the [http://idlastro.gsfc.nasa.gov/ IDL astronomy library],<br />
but similar manipulations can be carried out in IRAF, or using the python PyWCS and PyFITS libraries,<br />
available from the [http://www.astropython.org/ astropython project].<br />
<br />
The IDL script is in [[File:Make_2dimage.pro.txt]] (remove the .txt from the filename before using).<br />
<br />
IDL>make_2dimage,'einstein.fits',0,299,27,326<br />
<br />
The IDL code performs the following manipulations:<br />
<br />
1) Reads in the FITS file as a 2D array, trims it to 300x300 pixels and converts it to real, 300x300x1 array<br />
(the third dimension is added for generality to allow the construction of an image cube, it is <br />
not actually necessary in this particular case).<br />
<br />
2) Creates header keywords corresponding to the axis types (CTYPE1,2,3) values at the<br />
reference pixels (CRVAL1,2,3), the reference pixel positions (CRPIX1,2,3) and the axis<br />
increments (CDELT1,2,3), and the epoch (EPOCH).<br />
<br />
3) Writes out the modified FITS file as "twodmodel.fits"<br />
<br />
'''Step 5''' Start CASA and prepare inputs for simdata<br />
<br />
>casapy<br />
<br />
<source lang="python"><br />
<br />
default 'simdata'<br />
project = 'fs_cfg8_8hr'<br />
modifymodel = F<br />
skymodel = 'twodmodel.fits'<br />
setpointings = T<br />
integration = '300s'<br />
mapsize = ['1arcmin','1arcmin']<br />
maptype = 'hexagonal'<br />
pointingspacing = '1arcmin'<br />
predict = T<br />
</source><br />
<br />
Antenna configuration: <br />
ALMA antenna configuration files are stored in a directory that depends on your CASA installation <br />
to be sure of finding them, identify the CASAPATH variable using the os.getenv command, and pick<br />
the configuration you want. Details on configuration choices are given in the <br />
[[File:M51_at_z_%3D_0.1_and_z_%3D_0.3] M51 simulation guide]<br />
<br />
<br />
<source lang="python"><br />
<br />
repodir=os.getenv("CASAPATH").split(' ')[0]<br />
antennalist = repodir+"/data/alma/simmos/alma.out08.cfg"<br />
refdate = '2012/05/21/22:00:00' <br />
totaltime = '28800s'<br />
thermalnoise = ""<br />
image = T<br />
vis = '$project.ms'<br />
imsize = [300,300]<br />
cell = '0.043arcsec'<br />
niter = 2000<br />
weighting = 'natural'<br />
analyze=F<br />
<br />
</source></div>Mlacy