{ "metadata": { "name": "LSL SDF Generation" }, "nbformat": 2, "worksheets": [ { "cells": [ { "cell_type": "markdown", "source": [ "LWA1 observation are controlled through session definition files (SDFs). Each file contains a single session that represents one of the five DP outputs: beams 1 through 4 and TBW/TBN. Although each session uses a ", "single output, there can be multiple observations per session.", "", "The SDF has three basic parts:", "", "1) observer information, ", "", "2) project information, ", "", "3) session Information, and", "", "4) Observational setup.", "", "These four parts are implemented in LSL in the lsl.common.sdf module. ", "", "To create an object to hold information about an observer:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from lsl.common import sdf", "", "obs = sdf.Observer(\"Jayce Dowell\", 99)", "", "print obs" ], "language": "python", "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "" ] } ], "prompt_number": 6 }, { "cell_type": "markdown", "source": [ "Once an observer is defined, you can create the objects that will hold the project information. The only required information is the Observer object, project name, and project code." ] }, { "cell_type": "code", "collapsed": false, "input": [ "proj = sdf.Project(obs, \"This is a LWA1 project\", \"COMJD\")", "", "print proj" ], "language": "python", "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "" ] } ], "prompt_number": 55 }, { "cell_type": "markdown", "source": [ "Next, the session needs to be created and added to the Project:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "ses = sdf.Session(\"This is a session\", 101)", "proj.append(ses)", "", "print ses" ], "language": "python", "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "" ] } ], "prompt_number": 56 }, { "cell_type": "markdown", "source": [ "The Session object has a variety of parameters that can be set on it that control the session-wide setup. This includes which beam the observation runs on and whether or not the DR spectrometer is used: To set the beam and spectrometer mode:" ] }, { "cell_type": "code", "collapsed": true, "input": [ "# Set the DRX beam to 3", "ses.setDRXBeam(3)", "", "# Set the spectrometer setup to 1,024 channels, 768 windows per integration, and the Stokes IV mode", "ses.setSpectrometerChannels(1024)", "ses.setSpectrometerIntegration(768)", "ses.setSpectrometerMetatag('Stokes=IV')" ], "language": "python", "outputs": [], "prompt_number": 57 }, { "cell_type": "markdown", "source": [ "At this point the only thing missing are the actual observations. To define a beamforming observation that tracks a point on the sky, use the DRX object:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "radec = sdf.DRX(\"Observation1\", \"M87\", \"2013/1/1 18:00:00\", \"00:10:00.000\", ", " 12.5137, 12.3911, 37.9e6, 74.03e6, 7)", "print radec", "", "ses.append(radec)" ], "language": "python", "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "TRK_RADEC Obs. of 'Observation1':", " Start 2013/1/1 18:00:00", " Duration 00:10:00.000", " Filter: 7", " Frequency: 37899999.990; 74029999.992", " RA: 12.514", " Dec. 12.391" ] } ], "prompt_number": 58 }, { "cell_type": "markdown", "source": [ "The session and observation information stored within a Project can also be directly accessed:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "for session in proj.sessions:", " print \"Session ID:\", session.id", " for i,obs in enumerate(session.observations):", " print \"Observation ID:\", i", " print \"Is Valid?\", obs.validate()", " print obs" ], "language": "python", "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Session ID: 101", "Observation ID: 0", "Is Valid? True", "TRK_RADEC Obs. of 'Observation1':", " Start 2013/1/1 18:00:00", " Duration 00:10:00.000", " Filter: 7", " Frequency: 37899999.990; 74029999.992", " RA: 12.514", " Dec. 12.391" ] } ], "prompt_number": 59 }, { "cell_type": "markdown", "source": [ "Now all that is left is to create the SDF:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "print proj.render(verbose=True)" ], "language": "python", "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[13818] Validating session 1", "[13818] Validating observation 1", "PI_ID 1", "PI_NAME Observation1", "", "PROJECT_ID COMJD", "PROJECT_TITLE This is a LWA1 project", "PROJECT_REMPI None provided", "PROJECT_REMPO None", "", "SESSION_ID 101", "SESSION_TITLE This is a session", "SESSION_REMPI None provided", "SESSION_REMPO Requested data return method is DRSU", "SESSION_DRX_BEAM 3", "SESSION_SPC 1024 768{Stokes=IV}", "", "OBS_ID 1", "OBS_TITLE Observation1", "OBS_TARGET M87", "OBS_REMPI None provided", "OBS_REMPO Estimated data volume for this observation is 44.15 GB", "OBS_START_MJD 56293", "OBS_START_MPM 64800000", "OBS_START 2013/1/1 18:00:00", "OBS_DUR 600000", "OBS_DUR+ 00:10:00.000", "OBS_MODE TRK_RADEC", "OBS_RA 12.513700000", "OBS_DEC +12.391100000", "OBS_B SIMPLE", "OBS_FREQ1 830506431", "OBS_FREQ1+ 37.899999990 MHz", "OBS_FREQ2 1622226678", "OBS_FREQ2+ 74.029999992 MHz", "OBS_BW 7", "OBS_BW+ 19.600 MHz", "" ] } ], "prompt_number": 60 } ] } ] }