tidy up main script making use of new query library

This commit is contained in:
Thibault Barnouin
2023-05-10 13:03:54 +02:00
parent 4b95bdc673
commit b566052b07
12 changed files with 11363 additions and 553 deletions

View File

@@ -10,6 +10,7 @@ prototypes :
Compute the error (noise) of the input array by looking at the sub-region of minimal flux in every image and of shape sub_shape.
"""
import sys
from os.path import join as path_join
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
@@ -59,7 +60,7 @@ def display_bkg(data, background, std_bkg, headers, histograms=None, binning=Non
ax.set_ylabel(r"Flux [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")
plt.legend()
if not(savename is None):
fig.savefig(plots_folder+savename+"_background_flux.png", bbox_inches='tight')
fig.savefig(path_join(plots_folder,savename+"_background_flux.png"), bbox_inches='tight')
if not(histograms is None):
filt_obs = {"POL0":0, "POL60":0, "POL120":0}
@@ -78,7 +79,7 @@ def display_bkg(data, background, std_bkg, headers, histograms=None, binning=Non
ax_h.set_title("Histogram for each observation")
plt.legend()
if not(savename is None):
fig_h.savefig(plots_folder+savename+'_histograms.png', bbox_inches='tight')
fig_h.savefig(path_join(plots_folder,savename+'_histograms.png'), bbox_inches='tight')
fig2, ax2 = plt.subplots(figsize=(10,10))
data0 = data[0]*convert_flux[0]
@@ -103,7 +104,7 @@ def display_bkg(data, background, std_bkg, headers, histograms=None, binning=Non
fig2.colorbar(im, cax=cbar_ax, label=r"Flux [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")
if not(savename is None):
fig2.savefig(plots_folder+savename+'_'+filt+'_background_location.png', bbox_inches='tight')
fig2.savefig(path_join(plots_folder,savename+'_'+filt+'_background_location.png'), bbox_inches='tight')
if not(rectangle is None):
plot_obs(data, headers, vmin=data[data > 0.].min()*convert_flux.mean(), vmax=data[data > 0.].max()*convert_flux.mean(), rectangle=rectangle,
savename=savename+"_background_location",plots_folder=plots_folder)