generated from erosita/uds
69 lines
1.5 KiB
Python
Executable File
69 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
from pysas.wrapper import Wrapper as w
|
|
import os, sys
|
|
from os.path import dirname
|
|
import inspect
|
|
import glob
|
|
|
|
import os.path
|
|
from os import path
|
|
import subprocess
|
|
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
from astropy.io import fits
|
|
from astropy.table import Table
|
|
from matplotlib.colors import LogNorm
|
|
|
|
import pyds9
|
|
|
|
import arches
|
|
from arches.utils import *
|
|
from arches.config import *
|
|
|
|
root_path=dirname(dirname(dirname(inspect.getfile(arches))))
|
|
print("Arches root path: {}".format(root_path))
|
|
|
|
archive_dir=root_path+'/data/archive'
|
|
events_dir=root_path+'/data/processed'
|
|
products_dir=root_path+'/products'
|
|
ds9reg_dir=root_path+'/data/ds9reg'
|
|
|
|
imos=1
|
|
|
|
create_folder(products_dir)
|
|
|
|
inargs = ['--version']
|
|
t = w('sasver', inargs)
|
|
t.run()
|
|
|
|
files = glob.glob(archive_dir+'/*')
|
|
|
|
for obsid in files:
|
|
obsid = os.path.basename(obsid)
|
|
|
|
work_dir = init_work_dir(obsid)
|
|
|
|
os.chdir(work_dir)
|
|
# EPIC_pn_gtiFilteredEvts.ds EPIC_MOS2_Image_0862470501.fit
|
|
search_str = f'{products_dir}/{obsid}/EPIC_MOS{imos}_Image_{obsid}.fit'
|
|
print(search_str)
|
|
epfiles = glob.glob(search_str)
|
|
if not (epfiles):
|
|
print("*** run 02_filter_flares_pn.py ***")
|
|
sys.exit()
|
|
|
|
out_IMFile = epfiles[0]
|
|
|
|
# Visualize the image with ds9
|
|
|
|
d = pyds9.DS9()
|
|
d.set("file "+out_IMFile)
|
|
d.set('cmap bb')
|
|
d.set('scale log')
|
|
d.set(f"region {ds9reg_dir}/arches.reg")
|
|
|
|
print(f'{obsid} MOS{imos}')
|
|
user_input = input()
|
|
|