update main script for pylsp

This commit is contained in:
2024-02-23 16:42:13 +01:00
parent 118ba25122
commit d2b59cf05a

View File

@@ -10,7 +10,6 @@ from copy import deepcopy
import lib.fits as proj_fits # Functions to handle fits files 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.query import retrieve_products, path_exists, system from lib.query import retrieve_products, path_exists, system
from matplotlib.colors import LogNorm from matplotlib.colors import LogNorm
@@ -20,6 +19,7 @@ def main(target=None, proposal_id=None, infiles=None, output_dir="./data", crop=
# Deconvolution # Deconvolution
deconvolve = False deconvolve = False
if deconvolve: if deconvolve:
# from lib.deconvolve import from_file_psf
psf = 'gaussian' # Can be user-defined as well psf = 'gaussian' # Can be user-defined as well
# psf = from_file_psf(data_folder+psf_file) # psf = from_file_psf(data_folder+psf_file)
psf_FWHM = 0.15 psf_FWHM = 0.15
@@ -66,8 +66,7 @@ def main(target=None, proposal_id=None, infiles=None, output_dir="./data", crop=
SNRi_cut = 30. # I measurments with SNR>30, which implies an uncertainty in P of 4.7%. SNRi_cut = 30. # I measurments with SNR>30, which implies an uncertainty in P of 4.7%.
flux_lim = None # lowest and highest flux displayed on plot, defaults to bkg and maximum in cut if None flux_lim = None # lowest and highest flux displayed on plot, defaults to bkg and maximum in cut if None
vec_scale = 3 vec_scale = 3
step_vec = 1 #plot all vectors in the array. if step_vec = 2, then every other vector will be plotted step_vec = 1 # plot all vectors in the array. if step_vec = 2, then every other vector will be plotted if step_vec = 0 then all vectors are displayed at full length
# if step_vec = 0 then all vectors are displayed at full length
##### Pipeline start ##### Pipeline start
## Step 1: ## Step 1:
@@ -87,7 +86,7 @@ def main(target=None, proposal_id=None, infiles=None, output_dir="./data", crop=
data_folder = prod[0][0] data_folder = prod[0][0]
try: try:
plots_folder = data_folder.replace("data", "plots") plots_folder = data_folder.replace("data", "plots")
except: except ValueError:
plots_folder = "." plots_folder = "."
if not path_exists(plots_folder): if not path_exists(plots_folder):
system("mkdir -p {0:s} ".format(plots_folder)) system("mkdir -p {0:s} ".format(plots_folder))
@@ -96,11 +95,11 @@ def main(target=None, proposal_id=None, infiles=None, output_dir="./data", crop=
figname = "_".join([target, "FOC"]) figname = "_".join([target, "FOC"])
if rebin: if rebin:
if not px_scale in ['full']: if px_scale not in ['full']:
figtype = "".join(["b", "{0:.2f}".format(pxsize), px_scale]) # additionnal informations figtype = "".join(["b", "{0:.2f}".format(pxsize), px_scale]) # additionnal informations
else: else:
figtype = "full" figtype = "full"
if not smoothing_FWHM is None: if smoothing_FWHM is not None:
figtype += "_"+"".join(["".join([s[0] for s in smoothing_function.split("_")]), "{0:.2f}".format(smoothing_FWHM), smoothing_scale]) # additionnal informations figtype += "_"+"".join(["".join([s[0] for s in smoothing_function.split("_")]), "{0:.2f}".format(smoothing_FWHM), smoothing_scale]) # additionnal informations
if align_center is None: if align_center is None:
figtype += "_not_aligned" figtype += "_not_aligned"