:py:mod:`survey_to_casda`
=========================
.. py:module:: survey_to_casda
.. autoapi-nested-parse::
This writes the input parset for the casdaupload script.
See https://www.atnf.csiro.au/computing/software/askapsoft/sdp/docs/current/utils/casdaupload.html
-------------------------------------------------------------
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
survey_to_casda.Options
Functions
~~~~~~~~~
.. autoapisummary::
survey_to_casda.update_FITS_header
survey_to_casda.fits_header_check
survey_to_casda.update_FITS_headers
survey_to_casda.arg_init
survey_to_casda.t_string
survey_to_casda.my_grep
survey_to_casda.get_input
survey_to_casda.find_parset
survey_to_casda.get_history
survey_to_casda.check_files_exist
survey_to_casda.pack_flag_cal
survey_to_casda.main
Attributes
~~~~~~~~~~
.. autoapisummary::
survey_to_casda.NOFORMAT
survey_to_casda.explanation
survey_to_casda.casda_production
survey_to_casda.casda_test
survey_to_casda.got_leakage
survey_to_casda.general
survey_to_casda.image
survey_to_casda.catalogue
survey_to_casda.im_art
survey_to_casda.ca_art
survey_to_casda.ms_art
survey_to_casda.ev_art
survey_to_casda.ke_fil
survey_to_casda.ke_typ
survey_to_casda.ke_pro
survey_to_casda.ke_fmt
survey_to_casda.ke_art
survey_to_casda.required_fits_keys
.. py:data:: NOFORMAT
:value: '{noformat}\n'
.. py:data:: explanation
.. py:data:: casda_production
:value: '/group/casda/prd/'
.. py:data:: casda_test
:value: '/group/casda/at'
.. py:data:: got_leakage
:value: False
.. py:data:: general
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""# General
outputdir = "{}"
useAbsolutePaths = true
telescope = ASKAP
sbid = {:d}
# No other sbids provided.
obsprogram = RACS
writeREADYfile = true
"""
.. raw:: html
.. py:data:: image
.. py:data:: catalogue
.. py:data:: im_art
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""
# Images
images.artifactlist = {}"""
.. raw:: html
.. py:data:: ca_art
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""
# Source catalogues
catalogues.artifactlist = {}"""
.. raw:: html
.. py:data:: ms_art
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""
# Measurement sets
measurementsets.artifactlist = {}"""
.. raw:: html
.. py:data:: ev_art
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""
# Evaluation reports
evaluation.artifactlist = {}"""
.. raw:: html
.. py:data:: ke_fil
.. py:data:: ke_typ
.. py:data:: ke_pro
.. py:data:: ke_fmt
.. py:data:: ke_art
# The following uses an original code by Matthew Whiting
# As described below. Here the essentials are extracted as a subroutine to be called by the main racs_to_casda
#
# A python script to update the header keywords of FITS files. The
# headers able to be updated are a small defined set: PROJECT, SBID,
# DATE-OBS, DURATION.
#
# It also allows the specification of HISTORY statments, by giving a
# list of strings following the arguments for the above
#
# Example Usage:
# updateFITSheaders.py --project=AS034 --SBID=1234 --DATE-OBS="2017-01-20T12:34:45" --DURATION=12345.6 "Made by me" "Not by you"
#
#
# @copyright (c) 2017 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
#
# This file is part of the ASKAP software distribution.
#
# The ASKAP software distribution is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the License,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# @author Matthew Whiting
#
import argparse
import astropy.io.fits as fits
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--fitsfile', type=str, help='FITS file to update')
parser.add_argument('--telescope', type=str, default="", help='TELESCOP keyword')
parser.add_argument('--project', type=str, default="", help='OPAL project ID for this observation')
parser.add_argument('--sbid', type=str, default="", help='Scheduling block ID for this observation')
parser.add_argument('--dateobs', type=str, default="", help='DATE-OBS string (YYYY-MM-DDTHH:MM:SS) for this observation')
parser.add_argument('--duration', type=str, default="", help='Length of this observation in sec')
parser.add_argument('history', metavar='hist', type=str, default="", nargs='*', help='A HISTORY statement')
options = parser.parse_args()
.. py:data:: required_fits_keys
:value: ['NAXIS{:d}', 'CTYPE{:d}', 'CRVAL{:d}', 'CDELT{:d}', 'CRPIX{:d}']
.. py:function:: update_FITS_header(options)
.. py:function:: fits_header_check(file_name)
.. py:class:: Options(fitsfile, sbid, dateobs, duration, telescope='ASKAP', project='AS110')
Bases: :py:obj:`object`
.. py:function:: update_FITS_headers(files, row, history)
.. py:function:: arg_init()
.. py:function:: t_string(db_time)
.. py:function:: my_grep(file_name, txt)
.. py:function:: get_input(file_name, key)
.. py:function:: find_parset(root, row)
.. py:function:: get_history(parfile)
.. py:function:: check_files_exist(files)
.. py:function:: pack_flag_cal(root, row)
BPCAL/calparameters_1934_bp_SB{cal_sbid}.tab/
{fld}/cont_gains_cal_SB{sbid}_{fld}.beam??.tab/
diagnostics/Flagging_Summaries/scienceData_SB{sbid}_{fld}.beam??_averaged.ms.flagSummary
.. py:function:: main()