{ "cells": [ { "cell_type": "markdown", "id": "9359fc63-3229-4fd3-8631-09c181e6a27b", "metadata": {}, "source": [ "# Nodding Data Reduction\n", "\n", "This notebook shows the reduction path of a nodding observation with a multi-beam receiver, the K-band Focal Plane Array (KFPA).\n", "\n", "Similar to a position-switched observation, two beams are selected for simultaneous observing (though the receiver can have more than two beams). In the first scan BEAM1 is looking at the source, while BEAM2 is looking at an assumed OFF position. In the next scan, BEAM2 will be looking at the source, while BEAM1 is looking at (another) OFF position. This will result in two position-switched solutions, which are then averaged for the final spectrum. \n", "\n", "One advantage of this observing mode is that the telescope is always ON source, bringing the noise down by $\\sqrt{2}$ compared to a classic position switched observation. Minus a small amount of slewing time of course. However, the beam separation in the receiver should be large enough to ensure that the off position is not on the source. Otherwise, a proper Position Switching observation is needed with a large enough offset.\n", "\n", "In the observations used in this tutorial there are also position switched observations of the same source, so we can compare the results of using beam nodding versus position switching.\n", "\n", "The data in this tutorial were also presented \n", "[in a similar GBTIDL data reduction](https://gbtdocs.readthedocs.io/en/latest/how-tos/data_reduction/gbtidl.html#basic-nodding).\n", "\n", "\n", "## Background\n", "\n", "The spectral line observed here is the NH$_3$ (1,1) line at 23.69 GHz with the KFPA receiver. This receiver has 7 beams: one central beam and six beams in a roughly hexagonal pattern around the central beam. The source is a position in the W3 cloud, a roughly two degree sized Giant Molecular Cloud (GMC) with active star formation. See also https://herscheltelescope.org.uk/results/w3-star-forming-region/\n", "\n", "## Dysh commands\n", "\n", "The following dysh commands are introduced (leaving out all the function arguments):\n", "\n", " filename = dysh_data()\n", " sdf = GBTFITSLoad()\n", " sb = sdf.getnod()\n", " ta = sb.timeaverage()\n", " ta.baseline()\n", " ta.smooth()\n", " ta.average()\n", " ta.plot()\n", " ta.plot().spectrum\n", "\n", "\n", "## Loading Modules\n", "We start by loading the modules we will use for the data reduction. \n" ] }, { "cell_type": "code", "execution_count": 1, "id": "e34b86e9-6438-4e84-8503-d6dd1699e243", "metadata": {}, "outputs": [], "source": [ "# These modules are required for the data reduction.\n", "from dysh.log import init_logging\n", "from dysh.fits.gbtfitsload import GBTFITSLoad\n", "from astropy import units as u\n", "\n", "# These modules are used for file I/O\n", "from dysh.util.files import dysh_data\n", "from pathlib import Path" ] }, { "cell_type": "markdown", "id": "124a7432-5874-4cf2-81f4-217d2c064575", "metadata": {}, "source": [ "## Setup Logging\n", "\n", "dysh uses a logger to communicate. If you are working in the command line, then the logging is setup for you. If you are working in a jupyter lab instance, then you need to set it up. You can do so using the `init_logging` function imported above. As an argument, `init_logging` takes a number, the verbosity `level`. `level` 0 is for error messages only, 1 for warning, 2 for info and 3 for debug. Here we set it to `level` 2. " ] }, { "cell_type": "code", "execution_count": 2, "id": "65930caf-a171-43fd-8ea1-148ee9d15b59", "metadata": {}, "outputs": [], "source": [ "init_logging(2)\n", "\n", "# also create a local \"output\" directory where temporary notebook files can be stored.\n", "output_dir = Path.cwd() / \"output\"\n", "output_dir.mkdir(exist_ok=True)" ] }, { "cell_type": "markdown", "id": "5554680e-732f-491e-9acc-be087d268905", "metadata": {}, "source": [ "## Data Retrieval\n", "\n", "Download the example SDFITS data, if necessary." ] }, { "cell_type": "code", "execution_count": 3, "id": "be47e0aa-097a-4000-a2aa-fc5b0d4dc49e", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "18:54:34.452 I Resolving example=nod2 -> nod-KFPA/data/TGBT22A_503_02.raw.vegas.trim.fits\n" ] } ], "source": [ "filename = dysh_data(example=\"nod2\")" ] }, { "cell_type": "markdown", "id": "6ac043ae-0334-47c8-bf32-fa032e0113ca", "metadata": {}, "source": [ "## Data Loading\n", "\n", "Next, we use `GBTFITSLoad` to load the data, and then its `summary` method to inspect its contents.\n", "\n", "This trimmed dataset is an extraction from a much larger dataset (19GB) and can take some time to load if it's the first time. This would be `example=\"nod\"`\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "fb10b18f-4510-4707-ad2a-70a1ec2b4d79", "metadata": {}, "outputs": [], "source": [ "sdfits = GBTFITSLoad(filename)" ] }, { "cell_type": "code", "execution_count": 5, "id": "62f47e96-7553-48c9-9dfb-032d2af60897", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| SCAN | \n", "OBJECT | \n", "VELOCITY | \n", "PROC | \n", "PROCSEQN | \n", "RESTFREQ | \n", "DOPFREQ | \n", "# IF | \n", "# POL | \n", "# INT | \n", "# FEED | \n", "AZIMUTH | \n", "ELEVATION | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 60 | \n", "W3_1 | \n", "-40.0 | \n", "OnOff | \n", "1 | \n", "23.694496 | \n", "23.694496 | \n", "1 | \n", "1 | \n", "31 | \n", "1 | \n", "324.2279 | \n", "38.7060 | \n", "
| 61 | \n", "W3_1 | \n", "-40.0 | \n", "OnOff | \n", "2 | \n", "23.694496 | \n", "23.694496 | \n", "1 | \n", "1 | \n", "31 | \n", "1 | \n", "324.1526 | \n", "39.0121 | \n", "
| 62 | \n", "W3_1 | \n", "-40.0 | \n", "Nod | \n", "1 | \n", "23.694496 | \n", "23.694496 | \n", "1 | \n", "1 | \n", "31 | \n", "7 | \n", "324.2743 | \n", "38.4194 | \n", "
| 63 | \n", "W3_1 | \n", "-40.0 | \n", "Nod | \n", "2 | \n", "23.694496 | \n", "23.694496 | \n", "1 | \n", "1 | \n", "31 | \n", "7 | \n", "324.3672 | \n", "38.2858 | \n", "