generated from erosita/uds
SAS
This commit is contained in:
88
scripts/06_esas_protonscale.py
Executable file
88
scripts/06_esas_protonscale.py
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/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("Root path: {}".format(root_path))
|
||||
|
||||
archive_dir=root_path+'/data/archive'
|
||||
events_dir=root_path+'/data/processed'
|
||||
events_oot_dir=root_path+'/data/processed-oot'
|
||||
products_dir=root_path+'/products/esas'
|
||||
ds9reg_dir=root_path+'/data/ds9reg'
|
||||
|
||||
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)
|
||||
|
||||
if(obsid in skip):
|
||||
continue
|
||||
|
||||
|
||||
|
||||
work_dir = init_work_dir(obsid, products_dir=products_dir)
|
||||
print(f"\n*** jump to {work_dir} ***\n")
|
||||
os.chdir(work_dir)
|
||||
|
||||
|
||||
key="mos1S001"
|
||||
os.chdir(f'ffov_{key}')
|
||||
inargs = [f'maskfile={key}-fovimspdet.fits',
|
||||
f'specfile={key}-fovt.pi',
|
||||
'mode=1',]
|
||||
w('protonscale', inargs).run()
|
||||
os.chdir('../')
|
||||
|
||||
key="mos2S002"
|
||||
os.chdir(f'ffov_{key}')
|
||||
inargs = [f'maskfile={key}-fovimspdet.fits',
|
||||
f'specfile={key}-fovt.pi',
|
||||
'mode=1',]
|
||||
w('protonscale', inargs).run()
|
||||
os.chdir('../')
|
||||
|
||||
key="pnS003"
|
||||
os.chdir(f'ffov_{key}_0')
|
||||
inargs = [f'maskfile={key}-fovimspdet.fits',
|
||||
f'specfile={key}-fovt.pi',
|
||||
'mode=1',]
|
||||
w('protonscale', inargs).run()
|
||||
os.chdir('../')
|
||||
|
||||
key="pnS003"
|
||||
os.chdir(f'ffov_{key}_4')
|
||||
inargs = [f'maskfile={key}-fovimspdet.fits',
|
||||
f'specfile={key}-fovt.pi',
|
||||
'mode=1',]
|
||||
w('protonscale', inargs).run()
|
||||
os.chdir('../')
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user