In [1]:
from __future__ import print_function

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:

In [2]:
from lsl.common import sdf

obs = sdf.Observer("Jayce Dowell", 99)

print(obs)
<lsl.common.sdf.Observer object at 0x108f2d470>

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.

In [4]:
proj = sdf.Project(obs, "This is a LWA1 project", "COMJD")

print(proj)
<lsl.common.sdf.Project object at 0x10943ae80>

Next, the session needs to be created and added to the Project:

In [5]:
ses = sdf.Session("This is a session", 101)
proj.append(ses)

print(ses)
<lsl.common.sdf.Session object at 0x113930588>

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:

In [7]:
# Set the DRX beam to 3
ses.drx_beam = 3

# Set the spectrometer setup to 1,024 channels, 768 windows per integration, and the Stokes IV mode
ses.spectrometer_channels = 1024
ses.spectrometer_integration = 768
ses.spectrometer_metatag = 'Stokes=IV'

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:

In [8]:
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)
TRK_RADEC Obs. of 'Observation1':
 Start UTC 2013/01/01 18:00:00.000000
 Duration 0:10:00.000
 Filter: 7
 Frequency: 37899999.990; 74029999.992 Hz
 RA: 12.513700 hr
 Dec. 12.391100 d

The session and observation information stored within a Project can also be directly accessed:

In [9]:
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)
Session ID: 101
Observation ID: 0
Is Valid? True
TRK_RADEC Obs. of 'Observation1':
 Start UTC 2013/01/01 18:00:00.000000
 Duration 0:10:00.000
 Filter: 7
 Frequency: 37899999.990; 74029999.992 Hz
 RA: 12.513700 hr
 Dec. 12.391100 d

Now all that is left is to create the SDF:

In [10]:
print(proj.render(verbose=True))
[20280] Validating session 1
[20280] Validating observation 1
PI_ID            99
PI_NAME          Jayce Dowell

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 234.73 MB
OBS_START_MJD    56293
OBS_START_MPM    64800000
OBS_START        UTC 2013/01/01 18:00:00.000000
OBS_DUR          600000
OBS_DUR+         0: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


Interferometer Definition Files (IDFs) that are used for scheduling observations with the LWA single baseline interferometer work the same way. Just import the idf from from lsl.common.

In [11]:
from lsl.common import idf

The biggest difference between making IDFs and making SDFs is the terminology. Instead of Sessions there are Runs and instead of Observations there are scans.