{ "cells": [ { "cell_type": "markdown", "id": "8c8138ef-e687-444e-95b1-9797654f3f62", "metadata": {}, "source": [ "# Frequency-switched Data Reduction\n", "\n", "This notebook shows how to use dysh to calibrate a frequency switched observation. \n", "The idea is similar to an OnOff observation, except the telescope does not move to an Off in position on the sky, but moves its intermediate frequency in frequency space. Here we call the On and Off the Sig and Ref, but both will have the signal, just shifted in the band. Since the telescope is always tracking the target, combining the Sig and a shifted (folded) Ref, a $\\sqrt{2}$ improvement in signal-to-noise can be achieved.\n", "\n", "The retrieval and calibration of frequency-switched observations uses `GBTFITSLoad.getfs`, which returns a `ScanBlock` object. \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", " sdf.select()\n", " sb = sdf.getfs()\n", " ta = sb.timeaverage()\n", " ta.baseline()\n", " ta.average()\n", " ta.plot()\n", "\n", "## Loading Modules\n", "We start by loading the modules we will use for this example. \n" ] }, { "cell_type": "code", "execution_count": 1, "id": "b4967550-2ca1-4931-b53b-6f9868718490", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "import" ] }, "outputs": [], "source": [ "# These modules are required for working with the data.\n", "from dysh.fits.gbtfitsload import GBTFITSLoad\n", "from dysh.log import init_logging\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": "5a180707-0731-448f-92dc-8635eff146ee", "metadata": {}, "source": [ "## Setup\n", "We start the dysh logging, so we get more information about what is happening.\n", "This is only needed if working on a notebook.\n", "If using the CLI through the dysh command, then logging is setup for you." ] }, { "cell_type": "code", "execution_count": 2, "id": "fe33a62b-e224-4615-875f-468a21cb327c", "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": "87669763-8d96-4521-9e81-f69d7213e133", "metadata": {}, "source": [ "## Data Retrieval\n", "\n", "Download the example SDFITS data, if necessary." ] }, { "cell_type": "code", "execution_count": 3, "id": "20611559-a142-4a8e-ae64-6690c93834b8", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "16:31:37.665 I Resolving example=getfs2 -> frequencyswitch/data/TREG_050627/TREG_050627.raw.acs/TREG_050627.raw.acs.fits\n" ] } ], "source": [ "filename = dysh_data(example=\"getfs2\")" ] }, { "cell_type": "markdown", "id": "8017d5a9-7e4d-47db-bd95-082fa56e40f4", "metadata": {}, "source": [ "## Data Loading\n", "\n", "Next, we use `GBTFITSLoad` to load the data, and then its `summary` method to inspect its contents." ] }, { "cell_type": "code", "execution_count": 4, "id": "93a62e3a-c95d-475b-8602-b5b8b7934733", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "load" ] }, "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", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 90 | \n", "W3OH | \n", "0.0 | \n", "Track | \n", "1 | \n", "1.667359 | \n", "1.667359 | \n", "1 | \n", "2 | \n", "6 | \n", "1 | \n", "22.2283 | \n", "18.1145 | \n", "
| 91 | \n", "W3OH | \n", "0.0 | \n", "Track | \n", "1 | \n", "1.667359 | \n", "1.667359 | \n", "1 | \n", "2 | \n", "6 | \n", "1 | \n", "22.3521 | \n", "18.2098 | \n", "
| 92 | \n", "W3OH | \n", "0.0 | \n", "Track | \n", "1 | \n", "1.667359 | \n", "1.667359 | \n", "1 | \n", "2 | \n", "6 | \n", "1 | \n", "22.4739 | \n", "18.3043 | \n", "
| 93 | \n", "W3OH | \n", "0.0 | \n", "Track | \n", "1 | \n", "1.667359 | \n", "1.667359 | \n", "1 | \n", "2 | \n", "6 | \n", "1 | \n", "22.5953 | \n", "18.3993 | \n", "
| 94 | \n", "W3OH | \n", "0.0 | \n", "Track | \n", "1 | \n", "1.667359 | \n", "1.667359 | \n", "1 | \n", "2 | \n", "6 | \n", "1 | \n", "22.7163 | \n", "18.4949 | \n", "