user_logger.info("Tracking Target : %s for %s seconds" % (target.name, str(duration))) time.sleep(duration) user_logger.info("Target tracked : %s " % (target.name, )) return True else: user_logger.warning("Unable to track Targe : %s " % (target.name, )) return False # Parse command-line options that allow the defaults to be overridden parser = standard_script_options( usage="usage: %prog [options]", description= "Track sources all around the sky for a few seconds each without recording data\n" + "(mostly to keep tourists or antennas amused). Uses the standard catalogue,\n" + "but excludes the extremely strong sources (Sun, Afristar). Some options\n" + "are **required**.") parser.add_option( '-m', '--max-duration', type='float', default=600.0, help="Maximum time to run experiment, in seconds (default=%default)") parser.add_option( '-t', '--target-duration', type='float', default=10.0,
from __future__ import with_statement import os.path from cStringIO import StringIO import datetime import time import numpy as np from katcorelib import collect_targets, standard_script_options, verify_and_connect, start_session, user_logger import katpoint # Set up standard script options parser = standard_script_options( usage="%prog [options] [<'target/catalogue'> ...]", description= "Perform mini (Zorro) raster scans across (point) sources for pointing " "model fits. This is modifyed so that it can test for offsets. Use the specified target(s) and " "catalogue(s) or the default. This will select a sourse at random then start do a 20 min offset test." " This script is aimed at fast scans across " "a large range of sources. Some options are **required**.") # Add experiment-specific options parser.add_option( '-e', '--scan-in-elevation', action="store_true", default=False, help="Scan in elevation rather than in azimuth (default=%default)") parser.add_option( '-m', '--min-time', type="float", default=-1.0,
if exc_type is KeyboardInterrupt: user_logger.warning(msg) else: user_logger.error(msg, exc_info=True) self.cbf.req.dbe_capture_stop(self.instrument) user_logger.info('beamformer stopped') # Suppress KeyboardInterrupt so as not to scare the lay user, # but allow other exceptions that occurred in the body of with-statement return exc_type is KeyboardInterrupt # Set up standard script options usage = "%prog [options] <'target'> [<'cal_target'>]" description = "Perform a beamforming run on a specified target, optionally " \ "visiting a gain calibrator beforehand to set beamformer weights." parser = standard_script_options(usage, description) # Add experiment-specific options parser.add_option('-a', '--ants', default='all', help="Antennas to include in beamformer (default='%default')") parser.add_option('-b', '--beamformer', default='bf0', help='Name of beamformer instrument to use ' '(bf0 -> H pol, bf1 -> V pol, default=%default)') parser.add_option('-t', '--target-duration', type='float', default=20, help='Minimum duration to track the beamforming target, ' 'in seconds (default=%default)') parser.add_option('-c', '--cal-duration', type='float', default=120, help='Minimum duration to track calibrator, in seconds ' '(default=%default)') parser.add_option('--fix-amp', action='store_true', default=False, help='Fix amplitude as well as phase in beamformer weights') # Set default value for any option (both standard and experiment-specific options)
# for the purpose of baseline calibration. import time from katcorelib import (standard_script_options, verify_and_connect, collect_targets, start_session, user_logger) import katpoint # Set up standard script options description = 'Track various point sources specified by name, string or ' \ 'catalogue, or use the default catalogue if none are ' \ 'specified. This is useful for baseline (antenna location) ' \ 'calibration. Remember to specify the observer and antenna ' \ 'options, as these are **required**.' parser = standard_script_options( usage="%prog [options] [<'target/catalogue'> ...]", description=description) # Add experiment-specific options parser.add_option('-m', '--min-time', type='float', default=-1.0, help="Minimum duration to run experiment, in seconds " "(default=one loop through sources)") # Set default value for any option (both standard and experiment-specific options) parser.set_defaults(description='Baseline calibration', nd_params='off', no_delays=True) # Parse the command line opts, args = parser.parse_args()
#!/usr/bin/python # Perform radial raster scan on specified target(s). Mostly used for beam pattern mapping. # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import numpy as np from katcorelib import standard_script_options, verify_and_connect, collect_targets, start_session, user_logger # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description= 'Perform radial raster scan across one or more sources. Mostly used for ' 'beam pattern mapping and on-the-fly mapping. Some options are ' '**required**.') # Add experiment-specific options parser.add_option('-k', '--num-scans', type='int', default=3, help='Number of scans across target (default=%default)') parser.add_option( '-t', '--scan-duration', type='float', default=20.0, help= 'Minimum duration of each scan across target, in seconds (default=%default)' ) parser.add_option('-l',
hpol = [ 'dig_l_band_rfcu_hpol_rf_power_in', 'dig_l_band_adc_hpol_rf_power_in' ] check_sensors(ant.sensor, hpol) if ant.sensor.rsc_rxl_lna_v_power_enabled.get_value(): print ' L-band LNA V is ON' else: print ' L-band LNA V is OFF' vpol = [ 'dig_l_band_rfcu_vpol_rf_power_in', 'dig_l_band_adc_vpol_rf_power_in' ] check_sensors(ant.sensor, vpol) # Parse command-line options that allow the defaults to be overridden parser = standard_script_options(usage="usage: %prog [options]", description="AR1 antenna quick check") parser.add_option( '--ant', type=str, default=None, help='Antennas to check in the format m0xx. (default="%default")') parser.add_option( '--timeout', type=int, default=60, help= 'Number of seconds to sleep between LNA off and on cycle. (default="%default")' ) parser.add_option( '--repeat', type=int,
# t_az,t_el=kat.ant1.sensor.pos_actual_scan_azim.get_value(),kat.ant1.sensor.pos_actual_scan_elev.get_value() # az=0.0;el=0.0; kat.ant1.req.target_azel(t_az+az,t_el+el); # Now iterate\ively increase az, el to maximize the magnitude # kat.dh.sd.plot_time_series('mag', products=[(1,2,'HH')], start_channel=377,stop_channel=378) # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import sys import time import numpy as np from katcorelib import standard_script_options, verify_and_connect, user_logger, CaptureSession # Set up standard script options parser = standard_script_options(usage="%prog [options]", description="Perform raster scan across holography source. Some options are **required**.") # Add experiment-specific options parser.add_option('-e', '--scan_in_elevation', action="store_true", default=False, help="Scan in elevation rather than in azimuth, (default=%default)") parser.add_option('-X', '--extent', dest='extent_deg', type="float", default=1.5, help="Angular extent of the scan (same for X & Y), in degrees (default=%default)") parser.add_option('-x', '--step', dest='step_deg', type="float", default=0.075, help="Angular spacing of scans (in az or el, depending on scan direction), in degrees (default=%default)") # Set default value for any option (both standard and experiment-specific options) parser.set_defaults(description='Holography script version 2') # Parse the command line opts, args = parser.parse_args() with verify_and_connect(opts) as kat: # Source to scan across
# 60 seconds comes from the antenna specification if (time_to_index > 60.0): user_logger.warning("Indexer took longer than 60 seconds!") user_logger.info("Dwell for %s seconds before " "going to next position." % duration) time.sleep(duration) user_logger.info("Pattern complete. Heading to next sky target.") # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description="Exercise the receiver indexer drive at different elevations.") parser.add_option( '--dwell-time', type='float', default=5.0, help='Time between changing indexer positions in seconds (default=%default)' ) parser.add_option( '--num-repeat', type='int', default=1, help='The number of times to repeat the sequence (once by by default)') parser.add_option('--ap', type='str',
#!/usr/bin/python # Track target(s) for a specified time. # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import time from katcorelib import standard_script_options, verify_and_connect, collect_targets, start_session, user_logger import katpoint # Set up standard script options parser = standard_script_options(usage="%prog [options]", description='Warming up the antennas if they are to cold to move.') # Set default value for any option (both standard and experiment-specific options) parser.set_defaults(description='Target track',dump_rate=1) # Parse the command line opts, args = parser.parse_args() # Check options and build KAT configuration, connecting to proxies and devices with verify_and_connect(opts) as kat: with start_session(kat, **vars(opts)) as session: session.standard_setup(**vars(opts)) # General: 4 Hz dumps, full speed movement. # Test elevation scan: Az=0, El=15 to 60. Stop at 70 for 10 seconds. El from 70 to 15. continue_test=True if not kat.dry_run: # User position sensors to make sure the system is in a safe place before starting movement current_az = session.ants[0].sensor.pos_actual_scan_azim.get_value() current_el = session.ants[0].sensor.pos_actual_scan_elev.get_value() if current_az is None:
# The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import os.path from cStringIO import StringIO import datetime import time from katcorelib import collect_targets, standard_script_options, verify_and_connect, start_session, user_logger import katpoint # Set up standard script options parser = standard_script_options( usage="%prog [options] [<'target/catalogue'> ...]", description="Perform mini (Zorro) raster scans across (point) sources for pointing " "model fits and gain curve calculation. Use the specified target(s) and " "catalogue(s) or the default. This script is aimed at fast scans across " "a large range of sources. Some options are **required**.") # Add experiment-specific options parser.add_option('-e', '--scan-in-elevation', action="store_true", default=False, help="Scan in elevation rather than in azimuth (default=%default)") parser.add_option('-m', '--min-time', type="float", default=-1.0, help="Minimum duration to run experiment, in seconds (default=one loop through sources)") # Set default value for any option (both standard and experiment-specific options) parser.add_option('-z', '--skip-catalogue', help="Name of file containing catalogue of targets to skip (updated with observed targets). " "The default is not to skip any targets.") parser.add_option('--source-strength', type='choice', default='auto', choices=('strong', 'weak', 'auto'), help="Scanning strategy based on source strength, one of 'strong', 'weak' or 'auto' (default). " "Auto is based on flux density specified in catalogue.") parser.add_option( '--quick', action="store_true" , default=False,
import time from katcorelib import (standard_script_options, verify_and_connect, collect_targets, start_session, user_logger) import katpoint class NoTargetsUpError(Exception): """No targets are above the horizon at the start of the observation.""" # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description='Perfrom a drift scan on one or more sources for a ' 'specified time. At least one target must be specified. ' 'Note also some **required** options below.') # Add experiment-specific options parser.add_option( '-t', '--track-duration', type='float', default=60.0, help= 'Length of the drift scan for each source, in seconds (default=%default)') parser.add_option( '-m', '--max-duration', type='float', default=None,
#!/usr/bin/python # Perform mini (Zorro) raster scans across the holography system's satellite of choice, EUTELSAT W2M. # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import time from katcorelib import standard_script_options, verify_and_connect, user_logger, CaptureSession # Set up standard script options parser = standard_script_options(usage="%prog [options]", description="Perform mini (Zorro) raster scans across the holography sources \ Some options are **required**.") # Add experiment-specific options parser.add_option('-e', '--scan_in_elevation', action="store_true", default=False, help="Scan in elevation rather than in azimuth, (default=%default)") parser.add_option('-m', '--min_time', type="float", default=-1.0, help="Minimum duration to run experiment, in seconds (default=one loop through sources)") # Set default value for any option (both standard and experiment-specific options) parser.set_defaults(description='Multiple raster scans on holography target') # Parse the command line opts, args = parser.parse_args() with verify_and_connect(opts) as kat: # Source to scan across pointing_sources = [kat.sources['EUTELSAT W2M']] start_time = time.time() targets_observed = []
# run a simple scan script to derive the horizon mask for KAT-7 # scan over constant elevation range but loop over azimuth # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import time from katcorelib import standard_script_options, verify_and_connect, start_session, user_logger # Set up standard script options parser = standard_script_options( usage="%prog [options]", description= "Derive the horizon mask for a KAT-7 dish. Scan over constant elevation " "range but loop over azimuth. This takes the form of 2x180 raster scans " "in opposite directions, with 180 seconds per scan. " "There are non-optional options.") # Add experiment-specific options parser.add_option( '--elevation-range', dest='elevation_range', type="float", default=13.0, help= "The range in elevation to cover starting from 3.1 degrees elevation (default=%default)" ) parser.add_option( '--scan-spacing', dest='scan_spacing', type="float", default=1.0,
import os import numpy as np try: import matplotlib.pyplot as plt except ImportError: plt = None from katcorelib import standard_script_options, verify_and_connect, collect_targets, start_session, user_logger import katpoint import katfile import scape # Set up standard script options parser = standard_script_options(usage="%prog [options] ['target']", description='Perform mini raster scan across (nearest) point source and reduce ' 'data to check system performance. Some options are **required**.') # Add experiment-specific options parser.add_option('-c', '--channels', default='100,400', help="Frequency channel range to keep (zero-based, specified as 'start,end', default='%default')") parser.add_option('--no-plots', action='store_true', default=False, help='Disable plotting') # Set default value for any option (both standard and experiment-specific options) parser.set_defaults(description='Point source check', observer='check', nd_params='coupler,0,0,-1', dump_rate=2.0) # Parse the command line opts, args = parser.parse_args() # Frequency channels to keep start_freq_channel = int(opts.channels.split(',')[0]) end_freq_channel = int(opts.channels.split(',')[1]) if opts.no_plots: plt = None
def mv_idx(kat, band): stop_ants(kat) user_logger.info("Moving Receiver Indexer to position %s" % string.upper(band)) try: if not kat.dry_run: kat.ants.req.ap_set_indexer_position(string.lower(band)) time.sleep(60) except: raise RuntimeError('Unknown indexer %s' % string.upper(band)) # Set up standard script options parser = standard_script_options( usage="%prog [options]", description= 'Panel Gap Test 5 - Stationary Capture on Az=0, El=16 for 20 min.' 'UHF in focus.') # Add experiment-specific options parser.add_option('--rip', type='string', default='u', help='Receiver indexer position (default=%default)') # Set default value for any option (both standard and experiment-specific options) ## RvR 20151206 -- DUMP-RATE=4 IN INSTRUCTION SET -- DEFAULT DUMP-RATE OF 1 FORCED # parser.set_defaults(description='Panel Gap Test',dump_rate=1) parser.set_defaults(description='Panel Gap Test') # not setting dump-rate ## RvR 20151206 -- DUMP-RATE=4 IN INSTRUCTION SET -- DEFAULT DUMP-RATE OF 1 FORCED # Parse the command line
#!/usr/bin/python import time import string from katcorelib import standard_script_options, verify_and_connect, user_logger from katcorelib import kat_resource import numpy as np import os import katcp import smtplib from email.mime.text import MIMEText # Parse command-line options that allow the defaults to be overridden parser = standard_script_options( usage="usage: %prog [options]", description="Check receptors are in suitable position and command the RSC " "to lubricate vacuum pump for a specified duration. " "Note: AMBIENT TEMP MUST BE ABOVE 16 DEG C") parser.add_option( '--max_elevation', type='int', default=20, help="Make sure receptor stays below this elevation for duration " "of vacuum pump lubrication (default=%default degrees)") parser.add_option( '--run_duration', type='int', default=20, help="Minimum run duration of vacuum pump (default=%default minutes)") parser.add_option( '--lubrication_frequency', type='int', default=14, help='Frequency for running vacuum pump lubrication ' '(default=%default days)') parser.add_option( '--archive_search', type='int', default=30,
user_logger.info("Tracking Target : %s for %s seconds" % (target.name, str(duration))) time.sleep(duration) user_logger.info("Target tracked : %s " % (target.name, )) return True else: user_logger.warning("Unable to track Targe : %s " % (target.name, )) return False # Parse command-line options that allow the defaults to be overridden description = """Track sources all around the sky for a few seconds each without recording data (mostly to keep tourists or antennas amused). Uses the standard catalogue, but excludes the extremely strong sources (Sun, Afristar). Some options are **required**.""" parser = standard_script_options(usage="usage: %prog [options]", description=description) parser.add_option( '-m', '--max-duration', type='float', default=600.0, help="Maximum time to run experiment, in seconds (default=%default)") parser.add_option( '-t', '--target-duration', type='float', default=10.0, help="Time to spend on a target in seconds, in seconds (default=%default)") on_target_duration = 10 parser.set_defaults(nd_params='off')
#!/usr/bin/python # Track target(s) for a specified time. # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import numpy as np import time from katcorelib import collect_targets, standard_script_options, verify_and_connect, start_session, user_logger, ant_array import katpoint # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description= 'Track one or more sources for a specified time and have a selected antenna offset(s)' ' ') # Add experiment-specific options parser.add_option( '-b', '--scan-ants', default='', help= 'This is the selcted antenna that must be offset from the antennas that remain on target(default=%default)' ) parser.add_option( '--repeat', action="store_true", default=False, help= 'Repeatedly loop through the targets until maximum duration (which must be set for this)' )
#!/usr/bin/python # Perform tipping curve scan for a specified azimuth position. # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import time from katcorelib import standard_script_options, verify_and_connect, start_session, user_logger import numpy as np import katpoint # Set up standard script options parser = standard_script_options( usage="%prog [options]", description="Perform tipping curve scan for a specified azimuth position. \ Or Select a Satilite clear Azimith,\ Some options are **required**.") # Add experiment-specific options parser.add_option( '-z', '--az', type="float", default=None, help= 'Azimuth angle along which to do tipping curve, in degrees (default="%default")' ) parser.add_option( '--spacing', type="float", default=1.0, help= 'The Spacing along the elevation axis of the tipping curve that measuremnts are taken, in degrees (default="%default")'
#!/usr/bin/python # Track various point sources as specified in a catalogue for the purpose of baseline calibration. # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import time from katcorelib import standard_script_options, verify_and_connect, collect_targets, start_session, user_logger import katpoint # Set up standard script options parser = standard_script_options(usage="%prog [options] [<'target/catalogue'> ...]", description='Track various point sources specified by name, string or catalogue, or ' 'use the default catalogue if none are specified. This is useful for ' 'baseline (antenna location) calibration. Remember to specify the ' 'observer and antenna options, as these are **required**.') # Add experiment-specific options parser.add_option('-m', '--min-time', type='float', default=-1.0, help="Minimum duration to run experiment, in seconds (default=one loop through sources)") # Set default value for any option (both standard and experiment-specific options) parser.set_defaults(description='Baseline calibration', nd_params='pin,0,0,-1') # Parse the command line opts, args = parser.parse_args() with verify_and_connect(opts) as kat: # Create baseline calibrator catalogue if len(args) > 0: # Load catalogue files or targets if given baseline_sources = collect_targets(kat, args) else:
class Temp(): def __init__(self, ): pass def __enter__(self): pass def __exit__(self, type, value, traceback): pass # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description= 'Track one or more sources for a specified time. then change the frequency of' 'the signal generator. Note also some **required** options below.') # Add experiment-specific options parser.add_option( '-t', '--track-duration', type='float', default=2.0, help='Length of time to track each source, in seconds (default=%default)') parser.add_option( '-m', '--max-duration', type='float', default=None, help=
#!/usr/bin/python # run a simple scan script to derive the horizon mask for KAT-7 # scan over constant elevation range but loop over azimuth # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import numpy as np import time from katcorelib import standard_script_options, verify_and_connect, start_session, user_logger # Set up standard script options parser = standard_script_options( usage="%prog [options]", description= "Perform a rfi scan with the KAT-7. Scan over constant elevation " "with 3 scans at 3.1,9.1,15.1 degrees. This takes the form of 2x180 raster scans " "in opposite directions, with 180 seconds per scan. " "There are non-optional options.(Antennas)") # Add experiment-specific options parser.add_option( '-m', '--min-duration', dest='min_duration', type="float", default=None, help="The The minimum time to repeat the rfi scan over (default=%default)") parser.remove_option('-f') parser.remove_option('-r') parser.remove_option('-p') parser.add_option('-f', '--centre-freq',
def mv_idx(kat, band): stop_ants(kat) user_logger.info("Moving Receiver Indexer to position %s" % string.upper(band)) try: if not kat.dry_run: kat.ants.req.ap_set_indexer_position(string.lower(band)) time.sleep(60) except: raise RuntimeError('Unknown indexer %s' % string.upper(band)) # Set up standard script options parser = standard_script_options( usage="%prog [options]", description= 'Panel Gap Test 2 - Full scan: Az of 0, 1, 3, 7, 15, 31, El from 16 to 86 each time.' '(Return to 0,16).') # Add experiment-specific options parser.add_option('--rip', type='string', default='u', help='Receiver indexer position (default=%default)') # Set default value for any option (both standard and experiment-specific options) ## RvR 20151206 -- DUMP-RATE=4 IN INSTRUCTION SET -- DEFAULT DUMP-RATE OF 1 FORCED # parser.set_defaults(description='Panel Gap Test',dump_rate=1) parser.set_defaults(description='Panel Gap Test') # not setting dump-rate ## RvR 20151206 -- DUMP-RATE=4 IN INSTRUCTION SET -- DEFAULT DUMP-RATE OF 1 FORCED # Parse the command line
#!/usr/bin/python # Track SCP for a specified time for hotbox tests. # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import time from katcorelib import standard_script_options, verify_and_connect, start_session, user_logger import katpoint import numpy as np import pyfits # Set up standard script options parser = standard_script_options( usage="%prog [options] hotload or coldload", description= 'Perform a mesurement of system tempreture using hot and cold on sky loads' 'Over 6 frequency ranges. Note also some **required** options below.') # Add experiment-specific options parser.add_option( '-t', '--track-duration', type='float', default=30.0, help='Length of time for each loading, in seconds (default=%default)') parser.add_option('--no-delays', action="store_true", default=False, help='Do not use delay tracking, and zero delays') parser.add_option( '-m',
#!/usr/bin/python # Track target and calibrators for imaging. # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import time from katcorelib import standard_script_options, verify_and_connect, collect_targets, start_session, user_logger # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description= "Perform an imaging run of a specified target, visiting the bandpass " + "and gain calibrators along the way. The calibrators are identified " + "by tags in their description strings ('bpcal' and 'gaincal', " + "respectively), while the imaging targets may optionally have a tag " + "of 'target'.") # Add experiment-specific options parser.add_option( '-t', '--target-duration', type='float', default=300, help= 'Minimum duration to track the imaging target per visit, in seconds (default="%default")' ) parser.add_option( '-b', '--bpcal-duration', type='float',
#! /usr/bin/python # The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import os import numpy as np import time from katcorelib import standard_script_options, verify_and_connect, collect_targets, start_session, user_logger import katpoint # Set up standard script options parser = standard_script_options(usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description='Perfrom a test track on a target + 8*0.25deg offset points.') # Add experiment-specific options parser.add_option('-t', '--track-duration', type='float', default=60.0, help='Length of the drift scan for each source, in seconds (default=%default)') # Set default value for any option (both standard and experiment-specific options) parser.set_defaults(description='Track Test') # Parse the command line opts, args = parser.parse_args() with verify_and_connect(opts) as kat: observation_sources = katpoint.Catalogue(antenna=kat.sources.antenna) args_target_obj = collect_targets(kat,args) observation_sources.add(args_target_obj) # Quit early if there are no sources to observe if len(observation_sources.filter(el_limit_deg=opts.horizon)) == 0:
#!/usr/bin/python # Track target(s) for a specified time. import time from katcorelib import standard_script_options, verify_and_connect, collect_targets, start_session, user_logger import katpoint # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description='Track one or more sources for a specified time. At least one ' 'target must be specified. Note also some **required** options below.') # Add experiment-specific options parser.add_option( '-t', '--track-duration', type='float', default=60.0, help='Length of time to track each source, in seconds (default=%default)') parser.add_option( '-m', '--max-duration', type='float', default=None, help= 'Maximum duration of the script in seconds, after which script will end ' 'as soon as the current track finishes (no limit by default)') parser.add_option( '--repeat', action="store_true", default=False,
# Return to low elevation elev = 20 # Set this target for the receptor target sensor target = katpoint.Target('Name, azel, %s, %s' % (azim, elev)) user_logger.info("Return to low elevation: '%s' ", target.description) if not dry_run: move_antennas(ants, azim, elev) user_logger.info("Sequence Completed!") # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description="Slew the antennas in elevation at different azimuth.") parser.add_option( '--no-corrections', action='store_true', help= 'Disable static and tilt corrections during the controlled movement, restore afterwards.' ) # Parse the command line opts, args = parser.parse_args() if opts.observer is None: raise RuntimeError("No observer provided script")
# The *with* keyword is standard in Python 2.6, but has to be explicitly imported in Python 2.5 from __future__ import with_statement import time # Import script helper functions from observe.py from katcorelib import standard_script_options, verify_and_connect, collect_targets, \ start_session, user_logger, ant_array import numpy as np import katpoint # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description='This script performs a holography scan on one or more targets. ' 'All the antennas initially track the target, whereafter a subset ' 'of the antennas (the "scan antennas" specified by the --scan-ants ' 'option) perform a radial raster scan on the target. Note also some ' '**required** options below.') # Add experiment-specific options parser.add_option( '-b', '--scan-ants', help= 'Subset of all antennas that will do raster scan (default=first antenna)') parser.add_option('-k', '--num-scans', type='int', default=3, help='Number of scans across target (default=%default)') parser.add_option(
user_logger.info("CCW limit (-185 degrees)...") move_to(ants, -185.0, 25.0) user_logger.info("CW limit (275 degrees)...") move_to(ants, 275.0, 25.0) user_logger.info("CCW limit (-185 degrees)...") move_to(ants, -185.0, 25.0) user_logger.info("Azimuth pattern complete") # Set up standard script options parser = standard_script_options( usage="%prog [options] <'target/catalogue'> [<'target/catalogue'> ...]", description= "Do basic full range elevation and azimuth movement for encoder count measurements" ) # Parse the command line opts, args = parser.parse_args() if opts.observer is None: raise RuntimeError("No observer provided script") # Check options and build KAT configuration, connecting to proxies and devices with verify_and_connect(opts) as kat: # Set sensor strategies" kat.ants.set_sampling_strategy("ap.on-target", "event") kat.ants.set_sampling_strategy("mode", "event")