# Move there and download files with work_within_directory(temp_dir): work_dir = os.path.abspath(os.getcwd()) # Download exposure map cmd_line = ( "obsid_search_csc obsid=%d download=all outfile=%d.tsv filetype=exp,evt,fov,bkgimg " "mode=h clobber=yes verbose=0 " "columns=m.ra,m.dec,o.theta,m.extent_flag,m.var_flag" % (obsid, obsid)) runner.run(cmd_line) # Download ancillary files needed by the r4_header_update script cmd_line = "download_chandra_obsid %d asol,pbk -q" % (obsid) runner.run(cmd_line) # get paths of files evt3_files = find_files.find_files(work_dir, '*%s*evt3.fits.gz' % obsid) tsv_files = find_files.find_files(work_dir, '*%s*.tsv' % obsid) bkg_files = find_files.find_files(work_dir, '*%s*bkgimg3.fits*' % obsid) if len(evt3_files) == 0:
map(lambda x: x.replace("!", ""), reg_file_fits['SRCREG'].data.SHAPE)) # Copy the region file here and fix the column format, otherwise ftcopy later on will fail # because some files have vector X,Y columns, while some others don't temp_file = "__%i_%s_reg.fits" % (region_id, obsid) shutil.copy2(region_file, "%s.gz" % temp_file) # Unzip the file because fcollen cannot operate on zipped files if os.path.exists(temp_file): os.remove(temp_file) runner.run("gunzip %s.gz" % temp_file, debug=True) # Fix the columns cmd_line = "fcollen '%s' X 1" % temp_file runner.run(cmd_line, debug=True) cmd_line = "fcollen '%s' Y 1" % temp_file runner.run(cmd_line, debug=True) temp_files.append(temp_file) ##############$$$###################### # Check if it might have caused streaks #################$$$###################