Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshiwavm committed Jul 3, 2023
1 parent eadb67a commit f1d7142
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 37 deletions.
149 changes: 132 additions & 17 deletions docs/source/tutorials/Mock-observations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,143 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from maria.mock_obs import WeObserve"
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import maria "
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from maria import Simulation\n",
"from maria import mappers"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"We can use maria to make realistic mock observations. We wrote a wrapper, named WeObserve, that simulates a telescopes such as ACT, Toltecc, or AtLAST and generates filtered observations that inlcude a noise term directly derived from the atmospheric model based on an input fits file."
"We can use maria to make realistic mock observations. We wrote a wrapper, named Simulation, that simulates a telescopes such as ACT, Toltecc, or AtLAST and generates tods observations that inlcude a noise term directly derived from the atmospheric model based on an input fits file."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"To the simulation class you can give any inputs which are applicable for the atmosphereseric simulation. For isntance, if you can create an 'AtLAST' like observatory but place it at the GBT site. Or if you want to make Mustang-2 observations, but at poorer weather conditions, one can increase the 'quantiles' key, all within the Simulation keywords. "
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"For a detailed documentation of all keywords we refer too: ... For now, let's initialize an example of mock-observertion of a massive merger at redshift 1 with Mustang-2:"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Computing weights: 100%|██████████| 4/4 [00:00<00:00, 135.46it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"(1000, 1000)\n",
"(1, 1000, 1000)\n"
]
}
],
"source": [
"sim = Simulation(\n",
"\n",
" array = 'MUSTANG-2',\n",
" pointing = 'DAISY_2deg',\n",
" site = 'GBT',\n",
" \n",
" map_file = \"../../../maps/ACT0329_CL0035.097.z_036.00GHz.fits\", #input files\n",
" # map_file = \"../../../maps/tsz_x.fits\", #input files\n",
" map_position = (4, 10.5),\n",
"\n",
" integration_time = 600, # seconds\n",
" pointing_center = (4, 10.5), # degrees\n",
" pointing_frame = \"ra_dec\", # frame\n",
" pointing_throws = (1., 1.), # How large the scanning pattern is\n",
"\n",
" quantiles = {'column_water_vapor' : 0.5}, #weather conditions specific for that site\n",
"\n",
" map_units = 'Jy/pixel', # Kelvin Rayleigh Jeans (KRJ) or Jy/pixel \n",
" inbright = -5.37 * 1e3 * 0.000113, # In units of key units \n",
" incell = 0.5 / 1000, # degree\n",
")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"To get the time ordered domain (TOD) data you run:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Generating layers: 100%|██████████| 388/388 [00:00<00:00, 16936.45it/s]\n",
"Sampling layers: 100%|██████████| 4/4 [00:02<00:00, 1.73it/s]\n"
]
}
],
"source": [
"tod = sim.run()\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"The tod is an object which has the time, and coordinates stored together with the intensity of each scan. "
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"file = \"./maps/tsz.fits\""
"## Mapping\n",
"In order to image the tod we need a mapper. One can implement their own one, but for comfirt we implemented two, the most simplistic which bins the data together and puts it on a grid, and one in which a common mode is subtracted. The latter mapper can remove atmospheric noise which is correlate between the different scans. "
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"For instance, the below snippet generates synthetic Mustang-2 observations. Analyzes plots are saved under the fulder './analyzes'. The synthetic images are saved under the project nam, in this case: './Mock_obs'."
"An example of running a mapper on the tod works as follows:"
]
},
{
Expand All @@ -48,17 +155,11 @@
"metadata": {},
"outputs": [],
"source": [
"obs = WeObserve(\n",
" array_name = 'MUSTANG-2',\n",
" pointing_name = 'DAISY_2deg',\n",
" site_name = 'GBT',\n",
" project = './Mock_obs',\n",
" skymodel = file,\n",
"mapper = mappers.RawBinMapper(resolution=np.radians(0.1/60))\n",
"\n",
" integration_time = 600, # seconds\n",
" coord_center = [4, 10.5], # degree\n",
" coord_frame = \"ra_dec\"\n",
" )"
"mapper.add_tods(tod)\n",
"\n",
"mapper.run()"
]
},
{
Expand Down Expand Up @@ -137,8 +238,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "atmos",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
},
"orig_nbformat": 4
},
Expand Down
43 changes: 24 additions & 19 deletions docs/source/tutorials/mapping.ipynb

Large diffs are not rendered by default.

Binary file added maps/ACT0329_CL0035.097.z_036.00GHz.fits
Binary file not shown.
Binary file added maps/ACT0329_CL0035.097.z_038.00GHz.fits
Binary file not shown.
Binary file added maps/ACT0329_CL0035.097.z_040.00GHz.fits
Binary file not shown.
Binary file added maps/ACT0329_CL0035.097.z_042.00GHz.fits
Binary file not shown.
2 changes: 1 addition & 1 deletion maria/sky.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self,
map_center = kwargs.get("map_center", DEFAULT_MAP_CENTER)
map_res = kwargs.get("map_res", DEFAULT_MAP_RES)
map_units = kwargs.get("units", 'KRJ')
inbright = kwargs.get("inbright", None)
inbright = kwargs.get("inbright", None)

map_header = hudl[0].header
map_header['HISTORY'] = 'History_WeOBSERVE 1'
Expand Down

0 comments on commit f1d7142

Please sign in to comment.