示例#1
0
      if objects[i] in dz.observation_dict['Standard_stars']:
          sigclip = 10.0
      else:
          if colors_arm[i] == 'Blue arm':
              sigclip = 10.0
          elif colors_arm[i] == 'Red arm':
              sigclip = 10.0
      
  print '\n-Treating:', Files_Name[i],' ', i, '/', len(Files_Name), objects[i] + '_lacosmic', sigclip, '\n'
          
  gain            = pyfits.getval(Files_Folder[i] + Files_Name[i], 'GAIN' ,0)
  readnoise       = pyfits.getval(Files_Folder[i] + Files_Name[i], 'READNOIS' ,0)
  lacosmic_param  = [gain, readnoise, sigclip]
          
  #Frame cosmic object
  c = cosmics.cosmicsimage(fitsdata, gain=lacosmic_param[0], readnoise=lacosmic_param[1], sigclip = lacosmic_param[2])
 
  #Run the fitting
  c.run(maxiter = 4)
             
  #Write the cleaned image into a new FITS file, conserving the original header :
  output_clean = Files_Folder[i] + Files_Name[i][0:Files_Name[i].rfind('.')] + '_cr.fits' 
  output_mask = Files_Folder[i] + Files_Name[i][0:Files_Name[i].rfind('.')] + '_mask.fits' 
      
  #Delete the file if it already exists
  if os.path.isfile(output_clean):
      os.remove(output_clean)
  if os.path.isfile(output_mask):
      os.remove(output_mask)        
              
  #Store the frames