#!/usr/bin/env python """Создает объедененный список событий и помещает его в uds/products Этот список событий нужен, в основном для извлечения спектров с помощью srctool """ from astropy.wcs import WCS from astropy.io import fits import sys, os, os.path, time, subprocess from pathlib import Path import numpy as np import glob from os.path import dirname import inspect import uds from uds.utils import * from uds.config import * outkey="mosa_tm0" """ find UDS root dir """ root_path=dirname(dirname(dirname(inspect.getfile(uds)))) print("UDS root path: {}".format(root_path)) infile_dir=root_path+'/data/processed' outfile_dir=root_path+'/products' create_folder(outfile_dir) index=5 do_init = True do_merge = True do_adapt = False # requires CIAO events=[] expmaps=[] for tmkey in keylist_tm.keys(): print("TM{} in work... init events".format(tmkey)) for datakey in keylist_tm[tmkey]: print("--> {}".format(datakey)) """ Подготавливаем списки событий индивидуальных наблюдений """ outfile_evtool,outfile_expmap=init_events(key=datakey, eband_index=eband[index], infile_dir=infile_dir, outfile_dir=outfile_dir, do_init=do_init, do_obsmode=True, do_center=True, do_evtool=True, do_expmap=True, ra_cen=ra_cen, de_cen=de_cen, emin_kev=emin_kev[index], emax_kev=emax_kev[index]) events.append(outfile_evtool) expmaps.append(outfile_expmap) """ Собираем общий список событий """ outfile_evtool="{}_EventList_en{}.fits".format(os.path.join(outfile_dir,outkey), eband[index]) outfile_expmap="{}_ExposureMap_en{}.fits".format(os.path.join(outfile_dir,outkey), eband[index]) if(do_merge==True): do_evtool_esass(events=events, outfile=outfile_evtool) outfile_adapt="{}_ImageAdapt_en{}.fits".format(os.path.join(outfile_dir,outkey), eband[index]) if(do_adapt==True): do_adapt_ciao(infile=outfile_evtool, outfile=outfile_adapt)