Exemplo n.º 1
0
        sys.exit(1)

    # Loop over fits files on command line
    for file in sys.argv[1:]:

        print file

        # If file does not exist, do not go further
        if not os.path.exists(file):
            WriteLog(file, 'does not exist')
            continue

        # Extract fits header values using pyfits
        # header = [<instrument>,<tbl_prefix>,primaryHDU,ext1HDU,ext2HDU,..,extNHDU]
        try:
            header = extractHeader(str(file))
        except HeaderException, e:
            WriteLog(file, str(e))
            continue

        # Pyfits do not recognize this a a fits file. Make a note and skip file.
        if header[0] == 'ERROR':
            WriteLog(file, 'not a valid fits file')
            continue

        instrument = header[0]
        tbl_prefix = header[1]

        # filename (stripped of .fits extension)
        fits_nm = str(os.path.basename(file))[:-5]
Exemplo n.º 2
0
  # file path + file name 
  fits_file = str(file)

  # filename
  fits_nm = str(os.path.basename(file))

  # Check file extention corresponds to a fits file
  if not (fits_nm[-5:] == '.fits'): 
    writeLog(logpath,file,'not .fits ext')
    continue

  # file name prefix (night identifier)
  night_nm = fits_nm[:-9]
    
  # Extract fits header values using pyfits
  header = extractHeader(fits_file)
  header['filename'] = fits_nm[:-5]


  # Either the ccd shutter is closed or some fits keywords
  # are missing. We skip this image.
  if not header['imaging']: 
    writeLog(logpath,file,'Shutter Closed')
    continue

  # Skip spectroscopy images
  if (header['mode'] == 'SPECTROSCOPY'): 
    writeLog(logpath,file,'Spectroscopy')
    continue

  # Execute an external fortran program that will return 
Exemplo n.º 3
0
  for file in sys.argv[1:]:

    # If file does not exist, do not go further
    if not os.path.exists(file): 
      WriteLog(file,'does not exist')	
      continue

    # Only proceed if filename matches standard NOT format
    if not re.search(r'[A-Z]{2}[a-z]{2}[0-9]{6}', file):
      WriteLog(file,'filename does not match standard format')	
      continue

    # Extract fits header values using pyfits
    # header = [<instrument>,<tbl_prefix>,primaryHDU,ext1HDU,ext2HDU,..,extNHDU]
    try:
      header = extractHeader(str(file))
    except HeaderException, e:
      WriteLog(file,str(e))
      continue

    # Pyfits do not recognize this a a fits file. Make a note and skip file.
    if header[0] == 'ERROR':
      WriteLog(file,'not a valid fits file')	
      continue

    instrument = header[0]
    tbl_prefix = header[1]
   
    # filename (stripped of .fits extension)
    fits_nm = str(os.path.basename(file))[:-5]
Exemplo n.º 4
0
    # file path + file name
    fits_file = str(file)

    # filename
    fits_nm = str(os.path.basename(file))

    # Check file extention corresponds to a fits file
    if not (fits_nm[-5:] == '.fits'):
        writeLog(logpath, file, 'not .fits ext')
        continue

    # file name prefix (night identifier)
    night_nm = fits_nm[:-9]

    # Extract fits header values using pyfits
    header = extractHeader(fits_file)
    header['filename'] = fits_nm[:-5]

    # Either the ccd shutter is closed or some fits keywords
    # are missing. We skip this image.
    if not header['imaging']:
        writeLog(logpath, file, 'Shutter Closed')
        continue

    # Skip spectroscopy images
    if (header['mode'] == 'SPECTROSCOPY'):
        writeLog(logpath, file, 'Spectroscopy')
        continue

    # Execute an external fortran program that will return
    # the string 'day' or 'night' depending whether the