Example #1
0
def find_calibrator(master_mos):
    '''
  Find the best phase calibrator near the centre of the master mosaic
  
  :param master_mos: A string, the filename of the master mosaic file
  
  '''

    ref_ra, ref_dec = extract_ref_pos(master_mos)

    schedule = cabb.schedule()
    mos_scan = schedule.addScan({
        'source': 'dummy',
        'rightAscension': ref_ra,
        'declination': ref_dec,
        'freq1': 5500,
        'freq2': 9000,
        'project': 'dummy',
        'scanLength': '00:01:00',
        'scanType': 'Mosaic',
        'observer': 'dummy'
    })

    calList = mos_scan.findCalibrator()

    bestCal = calList.getBestCalibrator()

    return bestCal
Example #2
0
def make_sched_file(mosfiles,
                    schedfile,
                    calibrator,
                    freq1=5500,
                    freq2=9000,
                    project='C3278',
                    cal_scan_length='00:02:00',
                    observer='DDobie'):
    '''
  Make an ATCA schedule file to observe a mosaic
  
  :param mosfiles: A list of mosaic filenames
  :param schedfile: A string, the name of the schedule file
  :param freq1: An int, the central frequency of first band
  :param freq1: An int, central frequency of second band
  :param project: A string, the project code
  :param cal_scan_length: A string with the length of scan on phase calibrator in form HH:MM:SS
  :param observer: A string, the name of the Observer
  
  '''

    schedule = cabb.schedule()
    #schedule.disablePriorCalibration()
    for i, mosfile in enumerate(mosfiles):
        ref_ra, ref_dec = extract_ref_pos(mosfile)

        mos_scan = schedule.addScan(
            {
                'source': mosfile.split('.')[0],
                'rightAscension': ref_ra,
                'declination': ref_dec,
                'freq1': freq1,
                'freq2': freq2,
                'project': project,
                'scanLength': '00:01:00',
                'scanType': 'Mosaic',
                'observer': observer
            }
        )  #set scanLength to 1 minute, because the mosaic will loop at least once

        if i % 2 == 0 and i < len(mosfiles) - 1:
            calScan = schedule.addCalibrator(
                calibrator['calibrator'], mos_scan, {
                    'scanLength': cal_scan_length,
                    'scanType': 'Dwell'
                }
            )  #need to change the scanType to Dwell, or it uses same as previous scan (mosaic)

    schedule.setLooping(True)

    schedule.write(name=schedfile)
# example2.py
# This example script shows how to make a schedule and request time for it from
# the web service.

# The modules we'll need.
import atca_rapid_response_api as arrApi
import cabb_scheduler as cabb

# Example 1.
# The situation is the same as in example 1 of the CABB scheduling library example 1.
# Suppose an event trigger has been received for a flaring magnetar at
# coordinates RA = 01:00:43.1, Dec = -72:11:33.8.

# Make a new schedule.
schedule = cabb.schedule()

# Add a scan to look at the magnetar's coordinates.
# This is also where we set our project code; in this example we'll use
# the code C007 (we have a test authorisation token for this project).
# We'll also set it to be 20 minutes long, with Dwell mode.
scan1 = schedule.addScan(
    { 'source': "magnetar", 'rightAscension': "01:00:43.1", 'declination': "-72:11:33.8",
      'freq1': 5500, 'freq2': 9000, 'project': "C007",
      'scanLength': "00:20:00", 'scanType': "Dwell" }
)
# Since we definitely want to get onto source as quickly as possible, we tell the
# library not to go to the calibrator first.
schedule.disablePriorCalibration()

# Request a list of nearby calibrators from the ATCA calibrator database.
Example #4
0
# This program is to test the Python library functionality.

import cabb_scheduler as cabb

# Make a new schedule.
testSchedule = cabb.schedule()
scan1 = testSchedule.addScan({
    'source': "1934-638",
    'rightAscension': "19:39:25.026",
    'freq1': 5500,
    'freq2': 9000
})
scan2 = testSchedule.addScan()
scan3 = testSchedule.addScan({
    'source': "0823-500",
    'rightAscension': "08:25:26.869",
    'declination': "-50:10:38.49"
})
try:
    scan2.setSource("0537-441").setRightAscension("05:38:50.362").setEpoch(
        "J2000")
except cabb.errors.ScanError as e:
    print("Caught exception: ", e.value)
calList = scan3.findCalibrator()
bestCal = calList.getBestCalibrator()
#for i in xrange(0, calList.numCalibrators()):
#    pcal = calList.getCalibrator(i)
if bestCal is not None:
    calObj = bestCal['calibrator']
    fds = calObj.getFluxDensities()
    fdStrings = []
# example3_multifreq.py
# This example script shows how to make a schedule with more than one frequency
# and request time for it from the web service.

# The modules we'll need.
import atca_rapid_response_api as arrApi
import cabb_scheduler as cabb

# Example 3.
# The situation is the same as in example 1 of the CABB scheduling library example 1.
# Suppose an event trigger has been received for a flaring magnetar at
# coordinates RA = 01:00:43.1, Dec = -72:11:33.8.

# Make a new schedule.
schedule = cabb.schedule()

# Add a scan to look at the magnetar's coordinates.
# This is also where we set our project code; in this example we'll use
# the code C006 (we have a test authorisation token for this project).
# We'll also set it to be 20 minutes long, with Dwell mode.
scan1 = schedule.addScan({
    'source': "magnetar",
    'rightAscension': "08:00:43.1",
    'declination': "-72:11:33.8",
    'freq1': 5500,
    'freq2': 9000,
    'project': "C006",
    'scanLength': "00:20:00",
    'scanType': "Dwell"
})