debug for manual input and multiple obs
This commit is contained in:
@@ -11,7 +11,7 @@ import lib.fits as proj_fits #Functions to handle fits files
|
|||||||
import lib.reduction as proj_red #Functions used in reduction pipeline
|
import lib.reduction as proj_red #Functions used in reduction pipeline
|
||||||
import lib.plots as proj_plots #Functions for plotting data
|
import lib.plots as proj_plots #Functions for plotting data
|
||||||
from lib.deconvolve import from_file_psf
|
from lib.deconvolve import from_file_psf
|
||||||
from lib.query import retrieve_products
|
from lib.query import retrieve_products, path_exists, system
|
||||||
|
|
||||||
|
|
||||||
def main(target=None, proposal_id=None, infiles=None, output_dir="./data"):
|
def main(target=None, proposal_id=None, infiles=None, output_dir="./data"):
|
||||||
@@ -69,17 +69,23 @@ def main(target=None, proposal_id=None, infiles=None, output_dir="./data"):
|
|||||||
## Step 1:
|
## Step 1:
|
||||||
# Get data from fits files and translate to flux in erg/cm²/s/Angstrom.
|
# Get data from fits files and translate to flux in erg/cm²/s/Angstrom.
|
||||||
if not infiles is None:
|
if not infiles is None:
|
||||||
products = [np.array([["/".join(filepath.split('/')[:-1]),filepath.split('/')[-1]] for filepath in infiles],dtype=str)]
|
prod = np.array([["/".join(filepath.split('/')[:-1]),filepath.split('/')[-1]] for filepath in infiles],dtype=str)
|
||||||
|
obs_dir = "/".join(infiles[0].split()[:-1])
|
||||||
|
if not path_exists(obs_dir):
|
||||||
|
system("mkdir -p {0:s} {1:s}".format(obs_dir,obs_dir.replace("data","plots")))
|
||||||
if target is None:
|
if target is None:
|
||||||
target = input("Target name:\n>")
|
target = input("Target name:\n>")
|
||||||
else:
|
else:
|
||||||
target, products = retrieve_products(target,proposal_id,output_dir=output_dir)
|
target, products = retrieve_products(target,proposal_id,output_dir=output_dir)
|
||||||
data_folder = products[0][0,0]
|
prod = products.pop()
|
||||||
|
for prods in products:
|
||||||
|
main(target=target,infiles=["/".join(pr) for pr in prods],output_dir=output_dir)
|
||||||
|
data_folder = prod[0,0]
|
||||||
try:
|
try:
|
||||||
plots_folder = data_folder.replace("data","plots")
|
plots_folder = data_folder.replace("data","plots")
|
||||||
except:
|
except:
|
||||||
plots_folder = "."
|
plots_folder = "."
|
||||||
infiles = products[0][:,1]
|
infiles = prod[:,1]
|
||||||
data_array, headers = proj_fits.get_obs_data(infiles, data_folder=data_folder, compute_flux=True)
|
data_array, headers = proj_fits.get_obs_data(infiles, data_folder=data_folder, compute_flux=True)
|
||||||
|
|
||||||
figname = "_".join([target,"FOC"])
|
figname = "_".join([target,"FOC"])
|
||||||
@@ -189,4 +195,4 @@ if __name__ == "__main__":
|
|||||||
help='output directory path for the data products', type=str, default="./data")
|
help='output directory path for the data products', type=str, default="./data")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
exitcode = main(target=args.target, proposal_id=args.proposal_id, infiles=args.files, output_dir=args.output_dir)
|
exitcode = main(target=args.target, proposal_id=args.proposal_id, infiles=args.files, output_dir=args.output_dir)
|
||||||
print("Finished with ExitCode: ",exitcode)
|
print("Finished with ExitCode: ",exitcode)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ def get_product_list(target=None, proposal_id=None):
|
|||||||
else:
|
else:
|
||||||
print(obs)
|
print(obs)
|
||||||
a = [np.array(i.split(":"), dtype=str) for i in input("select observations to be downloaded ('1,3,4,5' or '1,3:5' or 'all','*' default to 1)\n>").split(',')]
|
a = [np.array(i.split(":"), dtype=str) for i in input("select observations to be downloaded ('1,3,4,5' or '1,3:5' or 'all','*' default to 1)\n>").split(',')]
|
||||||
if a[0]==['']:
|
if a[0][0]=='':
|
||||||
a = [[1]]
|
a = [[1]]
|
||||||
if a[0][0] in ['a','all','*']:
|
if a[0][0] in ['a','all','*']:
|
||||||
b = np.ones(len(results),dtype=bool)
|
b = np.ones(len(results),dtype=bool)
|
||||||
|
|||||||
Reference in New Issue
Block a user