コード例 #1
0
# which sets the ORAC_INSTRUMENT environment variable to 'SCUBA2_450' or 'SCUBA2_850'
# else default to 850 band
band = os.getenv("ORAC_INSTRUMENT")
if band == None:
    print "ORAC_INSTRUMENT environment variable not set!"
    print "This program expects to be run from a shell"
    print "prepared with the command: oracdr_scuba2_<band> <observation-date>"
    print "where band is: 450 or 850"
    print "and observation-date has the form: YYYYMMDD"
    sys.exit(0)


# print "band={0}".format(band)

# Get WNFACT value and nFrames from data file
wnfact = float(starutil.get_fits_header(indata, "WNFACT"))
# print "wnfact={0}".format(wnfact)
nFrames = int(starutil.get_fits_header(indata, "MIRSTOP")) + 1
# print "nFrames={0}".format(nFrames)

# Gather statistics on the central region of the input spectrum
# We are interested in the z position of the maximum pixel value (peak)
instats = invoke("$KAPPA_DIR/stats ndf={0} quiet".format(indata))
maxpos = starutil.get_task_par("MAXPOS", "stats")
maxposz = maxpos[2]
# print "maxposz={0}".format(maxposz)

# Calculate the band pass frames centered on the peak
if band == "SCUBA2_850":
    wnlbound = 11.2
    wnubound = 12.2
コード例 #2
0
ファイル: pol2sim.py プロジェクト: sladen/starlink
#  line.
   parsys = ParSys( params )

#  It's a good idea to get parameter values early if possible, in case
#  the user goes off for a coffee whilst the script is running and does not
#  see a later parameter propmpt or error...

#  Get the template POL2 data files. They should be supplied as the first
#  item on the command line, in the form of a Starlink "group expression"
#  (i.e.the same way they are supplied to other SMURF commands such as
#  makemap). Quote the string so that it can be used as command line
#  argument when running an atask from the shell.
   indata = parsys["IN"].value

#  AZ/EL pointing correction, for pre 20150929 data.
   if int(starutil.get_fits_header( indata[0], "UTDATE", True )) < 20150929:
      pntfile = os.path.join(NDG.tempdir,"pointing")
      fd = open(pntfile,"w")
      fd.write("# system=azel\n")
      fd.write("# tai dlon dlat\n")
      fd.write("54000 32.1 27.4\n")
      fd.write("56000 32.1 27.4\n")
      fd.close()
   else:
      pntfile = "!"

#  Are we inheriting noise from the input (real) time-streams, rather
#  than generating artificial noise?
   addon = parsys["ADDON"].value

#  Common mode files.
コード例 #3
0
ファイル: jsasplit.py プロジェクト: astrobuff/starlink
#  Get the name of the output NDF. If not supplied, use the name of hte
#  input NDF.
   outndf = parsys["OUT"].value
   if outndf == None:
      outndf = inndf

#  See how the output NDFs are to be trimmed.
   trim = parsys["TRIM"].value

#  See if temp files are to be retained.
   retain = parsys["RETAIN"].value

#  See if the supplied NDF holds data from a JCMT instrument by looking at the
#  "INSTRUME", "BACKEND" and "FILTER" FITS headers.
   instrument = None
   cval = starutil.get_fits_header( inndf, "INSTRUME" )
   if cval == "SCUBA-2":
      cval = starutil.get_fits_header( inndf, "FILTER" )

      if cval == "450":
         instrument = "SCUBA-2(450)"

      elif cval == "850":
         instrument = "SCUBA-2(850)"

   else:
      cval = starutil.get_fits_header( inndf, "BACKEND" )

      if cval == "ACSIS":
         instrument = "ACSIS"
コード例 #4
0
#  Form the polarised intensity map (no de-biassing), and remove the
#  spectral axis.
         tmp1 = NDG( 1 )
         invoke( "$KAPPA_DIR/maths exp=\"'sqrt(ia**2+ib**2)'\" ia={0} ib={1} out={2}"
                 .format(qmap,umap,tmp1) )
         pimap = NDG( 1 )
         invoke( "$KAPPA_DIR/ndfcopy in={0} out={1} trim=yes".format(tmp1,pimap) )

#  Find the position of the source centre in sky coords within the polarised
#  intensity map.
         invoke("$KAPPA_DIR/centroid ndf={0} mode=int init=\"'0,0'\"".format(pimap) )
         xcen = get_task_par( "xcen", "centroid" )
         ycen = get_task_par( "ycen", "centroid" )

#  Get the elevation at the middle of the observation.
         el1 = float( get_fits_header( qmap, "ELSTART" ) )
         el2 = float( get_fits_header( qmap, "ELEND" ) )
         el = 0.5*( el1 + el2 )
         elist.append( el )

#  Get the azimuth at the middle of the observation.
         az1 = float( get_fits_header( qmap, "AZSTART" ) )
         az2 = float( get_fits_header( qmap, "AZEND" ) )
         az = 0.5*( az1 + az2 )
         alist.append( az )

#  Get the WVM tau at the middle of the observation.
         w1 = float( get_fits_header( qmap, "WVMTAUST" ) )
         w2 = float( get_fits_header( qmap, "WVMTAUEN" ) )
         w = 0.5*( w1 + w2 )
         wvmlist.append( w )
コード例 #5
0
ファイル: pol2scan.py プロジェクト: edwardchapin/starlink
   fd.write("flagslow=0.01\n")
   fd.write("downsampscale=0\n")
   fd.close()

#  If both QREF and UREF were supplied, we will be rotating the
#  polarimetric reference direction. So store the orignal maps in
#  intermediate NDFs rather than the final NDFs.
   if qref and uref:
      tqmap = NDG(1)
      tumap = NDG(1)
   else:
      tqmap = qmap
      tumap = umap

#  AZ/EL pointing correction, for data between 20150606 and 20150930.
   ut = int(starutil.get_fits_header( qts[0], "UTDATE", True ))
   if ut >= 20150606 and ut <= 20150929:
      pntfile = os.path.join(NDG.tempdir,"pointing")
      fd = open(pntfile,"w")
      fd.write("# system=azel\n")
      fd.write("# tai dlon dlat\n")
      fd.write("54000 32.1 27.4\n")
      fd.write("56000 32.1 27.4\n")
      fd.close()
   else:
      pntfile = "!"

#  Make a map from the Q time series.
   msg_out( "Making a map from the Q time series...")
   if qref:
      ref = qref
コード例 #6
0
      os._exit(1)

#  To be a group expression, it must contain at least one of the
#  following characters: ^,= (NDFs are not allowed any of these).
   gexp_chars = set( '^=,' )
   if any( (c in gexp_chars) for c in config1 ):
      isndf1 = False
   else:
      isndf1 = True

#  If it is an NDF, attempt to get the FILTER or SUBARRAY fits header,
#  and determine the waveband. If neither header is found, look for
#  "s4a", etc, in the NDF's provenance info.
   if isndf1:
      try:
         subarray = starutil.get_fits_header( config1, "SUBARRAY" )
         if subarray is None:
            filter = starutil.get_fits_header( config1, "FILTER" )
            if filter is not None:
               filter = filter.strip()
               if filter == "450":
                  subarray = "s4"
               elif filter == "850":
                  subarray = "s8"

         if subarray is None:
            text = starutil.invoke( "$KAPPA_DIR/provshow {0}".format(config1) )
            if "s4a" in text or "s4b" in text or "s4c" in text or "s4d" in text:
               subarray = "s4"
            elif "s8a" in text or "s8b" in text or "s8c" in text or "s8d" in text:
               subarray = "s8"
コード例 #7
0
ファイル: pol2scan.py プロジェクト: astrobuff/starlink
      fd.write("modelorder=(pca,ext,ast,noi)\n")
      fd.write("noisecliphigh=3\n")
      fd.write("numiter=-20\n")
      fd.write("pca.pcathresh=4\n")
      fd.write("spikebox=10\n")
      fd.write("spikethresh=5\n")

#  Now put in values that are absolutely required by this script. These
#  over-write any values in the user-supplied config.
   fd.write("noi.usevar=1\n")
   fd.write("flagslow=0.01\n")
   fd.write("downsampscale=0\n")
   fd.close()

#  AZ/EL pointing correction, for data between 20150606 and 20150930.
   ut = int(starutil.get_fits_header( qts[0], "UTDATE", True ))
   if ut >= 20150606 and ut <= 20150929:
      pntfile = os.path.join(NDG.tempdir,"pointing")
      fd = open(pntfile,"w")
      fd.write("# system=azel\n")
      fd.write("# tai dlon dlat\n")
      fd.write("54000 32.1 27.4\n")
      fd.write("56000 32.1 27.4\n")
      fd.close()
   else:
      pntfile = "!"

#  If a reference map has been supplied, and parameter ALIGN is TRUE,
#  we create an I map and determine any extra pointing corrections
#  that are needed to bring the I map into alignment with the reference map.
   if ref != "!" and align:
コード例 #8
0
ファイル: tilepaste.py プロジェクト: kakirastern/starlink
    #  It's a good idea to get parameter values early if possible, in case
    #  the user goes off for a coffee whilst the script is running and does not
    #  see a later parameter propmpt or error...

    #  Get the input NDFs. They should be supplied as the first item on
    #  the command line, in the form of a Starlink "group expression" (i.e.
    #  the same way they are supplied to other SMURF commands such as makemap).
    #  Quote the string so that it can be used as command line argument when
    #  running an atask from the shell.
    indata = parsys["IN"].value

    #  See if we can determine a good default for INSTRUMENT by looking at
    #  the FITS headers of the first input NDF.
    try:
        cval = starutil.get_fits_header(indata[0], "INSTRUME").strip()
        if cval == "SCUBA-2":
            cval = starutil.get_fits_header(indata[0], "FILTER").strip()

            if cval == "450":
                deflt = "SCUBA-2(450)"

            elif cval == "850":
                deflt = "SCUBA-2(850)"

            else:
                deflt = None

        else:
            cval = starutil.get_fits_header(indata[0], "BACKEND")
コード例 #9
0
#  See if temp files are to be retained.
   retain = parsys["RETAIN"].value

#  Get any supplied Region defining the required sky region.
   region = parsys["REGION"].value

#  Get the list of tile NDFs that are available.
   tiles = parsys["TILES"].value

#  Get the JCMT instrument to which the tiles relate by looking at the
#  "INSTRUME" and "FILTER" FITS headers in the first tile. Check all
#  tiles have the same value.
   instrument0 = None
   for tile in tiles:
      cval = starutil.get_fits_header( tile, "INSTRUME" )
      if cval == "HARP":
         instrument = "HARP"

      elif cval == "SCUBA-2":
         cval = starutil.get_fits_header( tile, "FILTER" )

         if cval == "450":
            instrument = "SCUBA-2(450)"

         elif cval == "850":
            instrument = "SCUBA-2(850)"

         elif cval != None:
            raise starutil.InvalidParameterError("Tile {0} has an unknown "
                           "value '{1}' for the FILTER header.".format(tile,cval) )
コード例 #10
0
#  the mean Q value per bolometer. Astronomical sources will affect this
#  mean to a small extent, but its probably the best we can do for now. To
#  find the gradient and offset of the linear relationship for each Q image,
#  we use kappa:normalize to do a least squares fit between each Q image and
#  the mean Q signal.
         qnm = NDG(qarray)
         qnm.comment = "qnm"
         for (qin,qout) in zip( qarray, qnm ):
            invoke( "$KAPPA_DIR/normalize in1={0} in2={1} out={2} device={3}".
                    format(qcom,qin,qout,ndevice), buffer=True )

#  If required, store the slope and offset in the diagnostics file.
            if diagfd != None:
               slope = starutil.get_task_par( "slope", "normalize" )
               offset = starutil.get_task_par( "offset", "normalize" )
               ichunk = starutil.get_fits_header( qin, "POLCHUNK" )
               iblock = starutil.get_fits_header( qin, "POLBLOCK" )
               diagfd.write("Q {0} {1} {2} {3} {4}\n".format(iblock,a,ichunk,slope,offset))

#  Now substract the normalized mean Q signal from each Q image.
         qsub = NDG(qarray)
         qsub.comment = "qsub"
         invoke( "$KAPPA_DIR/sub in1={0} in2={1} out={2}".
                 format(qarray,qnm,qsub) )

#  And then remove smaller spikes that have now become visible in the
#  Q images as a result of subtracting off the bolometer biases.
         qffb = NDG(qarray)
         qffb.comment = "qffb"
         invoke( "$KAPPA_DIR/ffclean in={0} out={1} box=3 clip=\[2,2,2\]".
                 format(qsub,qffb) )
コード例 #11
0
ファイル: configmeld.py プロジェクト: juandesant/starlink
      os._exit(1)

#  To be a group expression, it must contain at least one of the
#  following characters: ^,= (NDFs are not allowed any of these).
   gexp_chars = set( '^=,' )
   if any( (c in gexp_chars) for c in config1 ):
      isndf1 = False
   else:
      isndf1 = True

#  If it is an NDF, attempt to get the SUBARRAY fits header, and
#  determine the waveband. If no SUBARRAY header is found, look for
#  "s4a", etc, in the NDF's provenance info.
   if isndf1:
      try:
         subarray = starutil.get_fits_header( config1, "SUBARRAY" )
         if subarray is None:
            text = starutil.invoke( "$KAPPA_DIR/provshow {0}".format(config1) )
            if "s4a" in text or "s4b" in text or "s4c" in text or "s4d" in text:
               subarray = "s4"
            elif "s8a" in text or "s8b" in text or "s8c" in text or "s8d" in text:
               subarray = "s8"
            else:
               subarray = None
      except:
         print( "\n!! It looks like NDF '{0}' either does not exist or is "
                "corrupt.".format(config1) )
         os._exit(1)

   if isndf1:
      if subarray is None:
コード例 #12
0
      ref_units = None
   else:

#  See if a filtered and scaled v ersion of the referenc emap is to be
#  created.
      refout = parsys["REFOUT"].value

#  If the REF map is in units of mJy/beam, convert it to pW using the FCF
#  in the "FCF" FITS header if available, or the standard FCF for the
#  wavelength otherwise.
      invoke("$KAPPA_DIR/ndftrace ndf={0} quiet".format(ref) )
      ref_units = get_task_par( "UNITS", "ndftrace" ).replace(" ", "")
      if ref_units != "pW":

         try:
            filter = int( float( get_fits_header( ref, "FILTER", True )))
         except starutil.NoValueError:
            filter = 850
            msg_out( "No value found for FITS header 'FILTER' in {0} - assuming 850".format(ref))

         if filter != 450 and filter != 850:
            raise starutil.InvalidParameterError("Invalid FILTER header value "
                   "'{0} found in {1}.".format( filter, ref ) )

         if ref_units == "mJy/beam":
            if filter == 450:
               fcf = 491000.0
            else:
               fcf = 537000.0

         elif ref_units == "Jy/beam":
コード例 #13
0
# NOTE: This assumes oracdr_scuba2_450 or oracdr_scuba2_850 has been run
# which sets the ORAC_INSTRUMENT environment variable to 'SCUBA2_450' or 'SCUBA2_850'
# else default to 850 band
band = os.getenv('ORAC_INSTRUMENT')
if band is None:
    print "ORAC_INSTRUMENT environment variable not set!"
    print "This program expects to be run from a shell"
    print "prepared with the command: oracdr_scuba2_<band> <observation-date>"
    print "where band is: 450 or 850"
    print "and observation-date has the form: YYYYMMDD"
    sys.exit(0)

# print "band={0}".format(band)

# Get WNFACT value and nFrames from data file
wnfact = float(starutil.get_fits_header(indata, "WNFACT"))
# print "wnfact={0}".format(wnfact)
nFrames = int(starutil.get_fits_header(indata, "MIRSTOP")) + 1
# print "nFrames={0}".format(nFrames)

# Gather statistics on the central region of the input spectrum
# We are interested in the z position of the maximum pixel value (peak)
instats = invoke("$KAPPA_DIR/stats ndf={0} quiet".format(indata))
maxpos = starutil.get_task_par("MAXPOS", "stats")
maxposz = maxpos[2]
# print "maxposz={0}".format(maxposz)

# Calculate the band pass frames centered on the peak
if band == "SCUBA2_850":
    wnlbound = 11.2
    wnubound = 12.2
コード例 #14
0
ファイル: rawregion.py プロジェクト: dt888/starlink
   parsys = ParSys( params )

#  Get the input NDF.
   indata = parsys["IN"].value

#  Get the file in which to put the Region.
   region = parsys["REGION"].value

#  See if temp files are to be retained.
   retain = parsys["RETAIN"].value

#  See if JSA tile indicies are to be displayed.
   tiles = parsys["TILES"].value

#  Get the required FITS headers from the NDF.
   map_hght = float( starutil.get_fits_header( indata, "MAP_HGHT", report=True ) )
   map_wdth = float( starutil.get_fits_header( indata, "MAP_WDTH", report=True ) )
   basec1 = float( starutil.get_fits_header( indata, "BASEC1", report=True ) )
   basec2 = float( starutil.get_fits_header( indata, "BASEC2", report=True ) )
   tracksys = starutil.get_fits_header( indata, "TRACKSYS", report=True )

#  Convert arc-seconds to degrees.
   map_hght /= 3600.0
   map_wdth /= 3600.0

#  Convert degrees to radians.
   map_hght = math.radians( map_hght )
   map_wdth = math.radians( map_wdth )
   basec1 = math.radians( basec1 )
   basec2 = math.radians( basec2 )
コード例 #15
0
ファイル: tilepaste.py プロジェクト: bbrond/starlink
#  It's a good idea to get parameter values early if possible, in case
#  the user goes off for a coffee whilst the script is running and does not
#  see a later parameter propmpt or error...

#  Get the input NDFs. They should be supplied as the first item on
#  the command line, in the form of a Starlink "group expression" (i.e.
#  the same way they are supplied to other SMURF commands such as makemap).
#  Quote the string so that it can be used as command line argument when
#  running an atask from the shell.
   indata = parsys["IN"].value

#  See if we can determine a good default for INSTRUMENT by looking at
#  the FITS headers of the first input NDF.
   try:
      instrume = starutil.get_fits_header( indata[0], "INSTRUME" ).strip();
      if instrume == "HARP":
         deflt = "HARP"

      elif instrume == "SCUBA-2":
         filter = starutil.get_fits_header( indata[0], "FILTER" ).strip();
         if filter == "850":
            deflt = "SCUBA-2(850)";
         else:
            deflt = "SCUBA-2(450)";
      else:
         deflt = None

   except:
      deflt = None
コード例 #16
0
ファイル: pol2stack.py プロジェクト: astrobuff/starlink
#  prompted for it.
   outcat = parsys["CAT"].value

#  See if temp files are to be retained.
   retain = parsys["RETAIN"].value

#  See statistical debiasing is to be performed.
   debias = parsys["DEBIAS"].value

#  See if we should convert pW to Jy.
   jy = parsys["JY"].value

#  Determine the waveband and get the corresponding FCF values with and
#  without POL2 in the beam.
   try:
      filter = int( float( starutil.get_fits_header( qin[0], "FILTER", True )))
   except NoValueError:
      filter = 850
      msg_out( "No value found for FITS header 'FILTER' in {0} - assuming 850".format(qin[0]))

   if filter == 450:
      fcf1 = 962.0
      fcf2 = 491.0
   elif filter == 850:
      fcf1 = 725.0
      fcf2 = 537.0
   else:
      raise starutil.InvalidParameterError("Invalid FILTER header value "
             "'{0} found in {1}.".format( filter, qin[0] ) )

#  Remove any spectral axes
コード例 #17
0
ファイル: tilepaste.py プロジェクト: astrobuff/starlink
#  It's a good idea to get parameter values early if possible, in case
#  the user goes off for a coffee whilst the script is running and does not
#  see a later parameter propmpt or error...

#  Get the input NDFs. They should be supplied as the first item on
#  the command line, in the form of a Starlink "group expression" (i.e.
#  the same way they are supplied to other SMURF commands such as makemap).
#  Quote the string so that it can be used as command line argument when
#  running an atask from the shell.
   indata = parsys["IN"].value

#  See if we can determine a good default for INSTRUMENT by looking at
#  the FITS headers of the first input NDF.
   try:
      cval = starutil.get_fits_header( indata[0], "INSTRUME" ).strip()
      if cval == "SCUBA-2":
         cval = starutil.get_fits_header( indata[0], "FILTER" ).strip()

         if cval == "450":
            deflt = "SCUBA-2(450)"

         elif cval == "850":
            deflt = "SCUBA-2(850)"

         else:
            deflt = None

      else:
         cval = starutil.get_fits_header( indata[0], "BACKEND" )
コード例 #18
0
ファイル: pol2stack.py プロジェクト: kakirastern/starlink
#  prompted for it.
   outcat = parsys["CAT"].value

#  See if temp files are to be retained.
   retain = parsys["RETAIN"].value

#  See statistical debiasing is to be performed.
   debias = parsys["DEBIAS"].value

#  See if we should convert pW to Jy/beam.
   jy = parsys["JY"].value

#  See if the I maps were made from POL2 data.
   ipol2 = None
   for sdf in iin:
      if "pol" in starutil.get_fits_header( sdf, "INBEAM" ):
         if ipol2 is None:
            ipol2 = True
         elif not ipol2:
            ipol2 = None
            break
      else:
         if ipol2 is None:
            ipol2 = False
         elif ipol2:
            ipol2 = None
            break

   if ipol2 is None:
      raise starutil.InvalidParameterError("Mixture of POL2 and non-POL2 "
                      "I maps supplied - all I maps must be the same.")
コード例 #19
0
    parsys = ParSys(params)

    #  Get the input NDF.
    indata = parsys["IN"].value

    #  Get the file in which to put the Region.
    region = parsys["REGION"].value

    #  See if temp files are to be retained.
    retain = parsys["RETAIN"].value

    #  See if JSA tile indices are to be displayed.
    tiles = parsys["TILES"].value

    #  Get the required FITS headers from the NDF.
    map_hght = float(starutil.get_fits_header(indata, "MAP_HGHT", report=True))
    map_wdth = float(starutil.get_fits_header(indata, "MAP_WDTH", report=True))
    basec1 = float(starutil.get_fits_header(indata, "BASEC1", report=True))
    basec2 = float(starutil.get_fits_header(indata, "BASEC2", report=True))
    tracksys = starutil.get_fits_header(indata, "TRACKSYS", report=True)

    #  Convert arc-seconds to degrees.
    map_hght /= 3600.0
    map_wdth /= 3600.0

    #  Convert degrees to radians.
    map_hght = math.radians(map_hght)
    map_wdth = math.radians(map_wdth)
    basec1 = math.radians(basec1)
    basec2 = math.radians(basec2)
コード例 #20
0
    #  line.
    parsys = ParSys(params)

    #  It's a good idea to get parameter values early if possible, in case
    #  the user goes off for a coffee whilst the script is running and does not
    #  see a later parameter propmpt or error...

    #  Get the template POL2 data files. They should be supplied as the first
    #  item on the command line, in the form of a Starlink "group expression"
    #  (i.e.the same way they are supplied to other SMURF commands such as
    #  makemap). Quote the string so that it can be used as command line
    #  argument when running an atask from the shell.
    indata = parsys["IN"].value

    #  AZ/EL pointing correction, for pre 20150929 data.
    if int(starutil.get_fits_header(indata[0], "UTDATE", True)) < 20150929:
        pntfile = os.path.join(NDG.tempdir, "pointing")
        fd = open(pntfile, "w")
        fd.write("# system=azel\n")
        fd.write("# tai dlon dlat\n")
        fd.write("54000 32.1 27.4\n")
        fd.write("56000 32.1 27.4\n")
        fd.close()
    else:
        pntfile = "!"

#  Are we inheriting noise from the input (real) time-streams, rather
#  than generating artificial noise?
    addon = parsys["ADDON"].value

    #  Common mode files.
コード例 #21
0
ファイル: jsasplit.py プロジェクト: kakirastern/starlink
    #  Get the name of the output NDF. If not supplied, use the name of hte
    #  input NDF.
    outndf = parsys["OUT"].value
    if outndf is None:
        outndf = inndf

#  See how the output NDFs are to be trimmed.
    trim = parsys["TRIM"].value

    #  See if temp files are to be retained.
    retain = parsys["RETAIN"].value

    #  See if the supplied NDF holds data from a JCMT instrument by looking at the
    #  "INSTRUME", "BACKEND" and "FILTER" FITS headers.
    instrument = None
    cval = starutil.get_fits_header(inndf, "INSTRUME")
    if cval == "SCUBA-2":
        cval = starutil.get_fits_header(inndf, "FILTER")

        if cval == "450":
            instrument = "SCUBA-2(450)"

        elif cval == "850":
            instrument = "SCUBA-2(850)"

    else:
        cval = starutil.get_fits_header(inndf, "BACKEND")

        if cval == "ACSIS":
            instrument = "ACSIS"
コード例 #22
0
ファイル: configmeld.py プロジェクト: dt888/starlink
      os._exit(1)

#  To be a group expression, it must contain at least one of the
#  following characters: ^,= (NDFs are not allowed any of these).
   gexp_chars = set( '^=,' )
   if any( (c in gexp_chars) for c in config1 ):
      isndf1 = False
   else:
      isndf1 = True

#  If it is an NDF, attempt to get the SUBARRAY fits header, and
#  determine the waveband. If no SUBARRAY header is found, look for
#  "s4a", etc, in the NDF's provenance info.
   if isndf1:
      try:
         subarray = starutil.get_fits_header( config1, "SUBARRAY" )
         if subarray == None:
            text = starutil.invoke( "$KAPPA_DIR/provshow {0}".format(config1) )
            if "s4a" in text or "s4b" in text or "s4c" in text or "s4d" in text:
               subarray = "s4"
            elif "s8a" in text or "s8b" in text or "s8c" in text or "s8d" in text:
               subarray = "s8"
            else:
               subarray = None
      except:
         print( "\n!! It looks like NDF '{0}' either does not exist or is "
                "corrupt.".format(config1) )
         os._exit(1)

   if isndf1:
      if subarray == None:
コード例 #23
0
ファイル: jsajoin.py プロジェクト: kakirastern/starlink
    retain = parsys["RETAIN"].value

    #  Get any supplied Region defining the required sky region.
    region = parsys["REGION"].value

    #  Get the list of tile NDFs that are available.
    tiles = parsys["TILES"].value

    #  Get the JCMT instrument to which the tiles relate by looking at the
    #  "INSTRUME", "BACKEND" and "FILTER" FITS headers in the first tile. Check
    #  all tiles have the same value.
    instrument0 = None
    for tile in tiles:
        instrument = None

        cval = starutil.get_fits_header(tile, "INSTRUME")
        if cval == "SCUBA-2":
            cval = starutil.get_fits_header(tile, "FILTER")

            if cval == "450":
                instrument = "SCUBA-2(450)"

            elif cval == "850":
                instrument = "SCUBA-2(850)"

        else:
            cval = starutil.get_fits_header(tile, "BACKEND")

            if cval == "ACSIS":
                instrument = "ACSIS"
コード例 #24
0
ファイル: jsajoin.py プロジェクト: astrobuff/starlink
   retain = parsys["RETAIN"].value

#  Get any supplied Region defining the required sky region.
   region = parsys["REGION"].value

#  Get the list of tile NDFs that are available.
   tiles = parsys["TILES"].value

#  Get the JCMT instrument to which the tiles relate by looking at the
#  "INSTRUME", "BACKEND" and "FILTER" FITS headers in the first tile. Check
#  all tiles have the same value.
   instrument0 = None
   for tile in tiles:
      instrument = None

      cval = starutil.get_fits_header( tile, "INSTRUME" )
      if cval == "SCUBA-2":
         cval = starutil.get_fits_header( tile, "FILTER" )

         if cval == "450":
            instrument = "SCUBA-2(450)"

         elif cval == "850":
            instrument = "SCUBA-2(850)"

      else:
         cval = starutil.get_fits_header( tile, "BACKEND" )

         if cval == "ACSIS":
            instrument = "ACSIS"
コード例 #25
0
ファイル: pol2sim.py プロジェクト: edwardchapin/starlink
#  line.
   parsys = ParSys( params )

#  It's a good idea to get parameter values early if possible, in case
#  the user goes off for a coffee whilst the script is running and does not
#  see a later parameter propmpt or error...

#  Get the template POL2 data files. They should be supplied as the first
#  item on the command line, in the form of a Starlink "group expression"
#  (i.e.the same way they are supplied to other SMURF commands such as
#  makemap). Quote the string so that it can be used as command line
#  argument when running an atask from the shell.
   indata = parsys["IN"].value

#  AZ/EL pointing correction, for pre 20150929 data.
   if int(starutil.get_fits_header( indata[0], "UTDATE", True )) < 20150929:
      pntfile = os.path.join(NDG.tempdir,"pointing")
      fd = open(pntfile,"w")
      fd.write("# system=azel\n")
      fd.write("# tai dlon dlat\n")
      fd.write("54000 32.1 27.4\n")
      fd.write("56000 32.1 27.4\n")
      fd.close()
   else:
      pntfile = "!"

#  Are we inheriting noise from the input (real) time-streams, rather
#  than generating artificial noise?
   addon = parsys["ADDON"].value

#  Common mode files.