set errors display output to pdf as default
This commit is contained in:
@@ -61,7 +61,12 @@ 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}$]")
|
ax.set_ylabel(r"Flux [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
if not(savename is None):
|
if not(savename is None):
|
||||||
fig.savefig(path_join(plots_folder,savename+"_background_flux.png"), bbox_inches='tight')
|
this_savename = deepcopy(savename)
|
||||||
|
if not savename[-4:] in ['.png', '.jpg', '.pdf']:
|
||||||
|
this_savename += '_background_flux.pdf'
|
||||||
|
else:
|
||||||
|
this_savename = savename[:-4]+"_background_flux"+savename[-4:]
|
||||||
|
fig.savefig(path_join(plots_folder,this_savename), bbox_inches='tight')
|
||||||
|
|
||||||
if not(histograms is None):
|
if not(histograms is None):
|
||||||
filt_obs = {"POL0":0, "POL60":0, "POL120":0}
|
filt_obs = {"POL0":0, "POL60":0, "POL120":0}
|
||||||
@@ -80,7 +85,12 @@ def display_bkg(data, background, std_bkg, headers, histograms=None, binning=Non
|
|||||||
ax_h.set_title("Histogram for each observation")
|
ax_h.set_title("Histogram for each observation")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
if not(savename is None):
|
if not(savename is None):
|
||||||
fig_h.savefig(path_join(plots_folder,savename+'_histograms.png'), bbox_inches='tight')
|
this_savename = deepcopy(savename)
|
||||||
|
if not savename[-4:] in ['.png', '.jpg', '.pdf']:
|
||||||
|
this_savename += '_histograms.pdf'
|
||||||
|
else:
|
||||||
|
this_savename = savename[:-4]+"_histograms"+savename[-4:]
|
||||||
|
fig_h.savefig(path_join(plots_folder,this_savename), bbox_inches='tight')
|
||||||
|
|
||||||
fig2, ax2 = plt.subplots(figsize=(10,10))
|
fig2, ax2 = plt.subplots(figsize=(10,10))
|
||||||
data0 = data[0]*convert_flux[0]
|
data0 = data[0]*convert_flux[0]
|
||||||
@@ -105,7 +115,12 @@ 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}$]")
|
fig2.colorbar(im, cax=cbar_ax, label=r"Flux [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")
|
||||||
|
|
||||||
if not(savename is None):
|
if not(savename is None):
|
||||||
fig2.savefig(path_join(plots_folder,savename+'_'+filt+'_background_location.png'), bbox_inches='tight')
|
this_savename = deepcopy(savename)
|
||||||
|
if not savename[-4:] in ['.png', '.jpg', '.pdf']:
|
||||||
|
this_savename += '_'+filt+'_background_location.pdf'
|
||||||
|
else:
|
||||||
|
this_savename = savename[:-4]+'_'+filt+'_background_location'+savename[-4:]
|
||||||
|
fig2.savefig(path_join(plots_folder,this_savename), bbox_inches='tight')
|
||||||
if not(rectangle is None):
|
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,
|
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)
|
savename=savename+"_background_location",plots_folder=plots_folder)
|
||||||
|
|||||||
@@ -163,7 +163,9 @@ def plot_obs(data_array, headers, shape=None, vmin=None, vmax=None, rectangle=No
|
|||||||
|
|
||||||
if not (savename is None):
|
if not (savename is None):
|
||||||
#fig.suptitle(savename)
|
#fig.suptitle(savename)
|
||||||
fig.savefig(path_join(plots_folder,savename+".png"),bbox_inches='tight')
|
if not savename[-4:] in ['.png', '.jpg', 'pdf']:
|
||||||
|
savename += '.pdf'
|
||||||
|
fig.savefig(path_join(plots_folder,savename),bbox_inches='tight')
|
||||||
plt.show()
|
plt.show()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -213,7 +215,11 @@ def plot_Stokes(Stokes, savename=None, plots_folder=""):
|
|||||||
|
|
||||||
if not (savename is None):
|
if not (savename is None):
|
||||||
#fig.suptitle(savename+"_IQU")
|
#fig.suptitle(savename+"_IQU")
|
||||||
fig.savefig(path_join(plots_folder,savename+"_IQU.png"),bbox_inches='tight')
|
if not savename[-4:] in ['.png', '.jpg', '.pdf']:
|
||||||
|
savename += '_IQU.pdf'
|
||||||
|
else:
|
||||||
|
savename = savename[:-4]+"_IQU"+savename[-4:]
|
||||||
|
fig.savefig(path_join(plots_folder,savename),bbox_inches='tight')
|
||||||
plt.show()
|
plt.show()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -476,7 +482,7 @@ def polarization_map(Stokes, data_mask=None, rectangle=None, SNRp_cut=3., SNRi_c
|
|||||||
ax.axis('equal')
|
ax.axis('equal')
|
||||||
|
|
||||||
if not savename is None:
|
if not savename is None:
|
||||||
if not savename[-4:] in ['.png', '.jpg']:
|
if not savename[-4:] in ['.png', '.jpg', '.pdf']:
|
||||||
savename += '.pdf'
|
savename += '.pdf'
|
||||||
fig.savefig(path_join(plots_folder,savename),bbox_inches='tight',dpi=300)
|
fig.savefig(path_join(plots_folder,savename),bbox_inches='tight',dpi=300)
|
||||||
|
|
||||||
@@ -723,6 +729,8 @@ class overplot_radio(align_maps):
|
|||||||
self.cr_other, = self.ax.plot(*crpix_other, 'g+')
|
self.cr_other, = self.ax.plot(*crpix_other, 'g+')
|
||||||
|
|
||||||
if not(savename is None):
|
if not(savename is None):
|
||||||
|
if not savename[-4:] in ['.png', '.jpg', '.pdf']:
|
||||||
|
savename += '.pdf'
|
||||||
self.fig2.savefig(savename,bbox_inches='tight',dpi=200)
|
self.fig2.savefig(savename,bbox_inches='tight',dpi=200)
|
||||||
|
|
||||||
self.fig2.canvas.draw()
|
self.fig2.canvas.draw()
|
||||||
@@ -814,6 +822,8 @@ class overplot_pol(align_maps):
|
|||||||
self.cr_other, = self.ax.plot(*crpix_other, 'g+')
|
self.cr_other, = self.ax.plot(*crpix_other, 'g+')
|
||||||
|
|
||||||
if not(savename is None):
|
if not(savename is None):
|
||||||
|
if not savename[-4:] in ['.png', '.jpg', '.pdf']:
|
||||||
|
savename += '.pdf'
|
||||||
self.fig2.savefig(savename,bbox_inches='tight',dpi=200)
|
self.fig2.savefig(savename,bbox_inches='tight',dpi=200)
|
||||||
|
|
||||||
self.fig2.canvas.draw()
|
self.fig2.canvas.draw()
|
||||||
@@ -916,7 +926,9 @@ class align_pol(object):
|
|||||||
ax.add_artist(pol_sc)
|
ax.add_artist(pol_sc)
|
||||||
|
|
||||||
if not savename is None:
|
if not savename is None:
|
||||||
fig.savefig(savename+".png",bbox_inches='tight',dpi=300)
|
if not savename[-4:] in ['.png', '.jpg', '.pdf']:
|
||||||
|
savename += '.pdf'
|
||||||
|
fig.savefig(savename,bbox_inches='tight',dpi=300)
|
||||||
|
|
||||||
plt.show(block=True)
|
plt.show(block=True)
|
||||||
return fig, ax
|
return fig, ax
|
||||||
@@ -1612,7 +1624,7 @@ class pol_map(object):
|
|||||||
self.pol_vector(fig=save_fig,ax=save_ax)
|
self.pol_vector(fig=save_fig,ax=save_ax)
|
||||||
self.pol_int(fig=save_fig,ax=save_ax)
|
self.pol_int(fig=save_fig,ax=save_ax)
|
||||||
save_fig.suptitle(r"{0:s} with $SNR_{{p}} \geq$ {1:d} and $SNR_{{I}} \geq$ {2:d}".format(self.targ, int(self.SNRp), int(self.SNRi)))
|
save_fig.suptitle(r"{0:s} with $SNR_{{p}} \geq$ {1:d} and $SNR_{{I}} \geq$ {2:d}".format(self.targ, int(self.SNRp), int(self.SNRi)))
|
||||||
if not expression[-4:] in ['.png', '.jpg']:
|
if not expression[-4:] in ['.png', '.jpg', '.pdf']:
|
||||||
expression += '.pdf'
|
expression += '.pdf'
|
||||||
save_fig.savefig(expression, bbox_inches='tight', dpi=200)
|
save_fig.savefig(expression, bbox_inches='tight', dpi=200)
|
||||||
plt.close(save_fig)
|
plt.close(save_fig)
|
||||||
|
|||||||
Reference in New Issue
Block a user